-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
projects: eval-ad8460: Add project for AD8460
Add initial project files for both basic and IIO examples for AD8460. Signed-off-by: John Erasmus Mari Geronimo <[email protected]>
- Loading branch information
1 parent
dd515bd
commit bced6f9
Showing
15 changed files
with
734 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Select the example you want to enable by choosing y for enabling and n for disabling | ||
BASIC_EXAMPLE = n | ||
IIO_EXAMPLE = y | ||
|
||
include ../../tools/scripts/generic_variables.mk | ||
|
||
include src.mk | ||
|
||
include ../../tools/scripts/generic.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"maxim": { | ||
"basic_example_max32665": { | ||
"flags" : "BASIC_EXAMPLE=y IIO_EXAMPLE=n TARGET=max32665" | ||
}, | ||
"iio_example_max32665": { | ||
"flags" : "BASIC_EXAMPLE=n IIO_EXAMPLE=y TARGET=max32665" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
include $(PROJECT)/src/platform/$(PLATFORM)/platform_src.mk | ||
include $(PROJECT)/src/examples/examples_src.mk | ||
|
||
SRCS += $(PROJECT)/src/platform/$(PLATFORM)/main.c | ||
|
||
INCS += $(PROJECT)/src/common/common_data.h | ||
SRCS += $(PROJECT)/src/common/common_data.c | ||
|
||
INCS += $(PROJECT)/src/platform/platform_includes.h | ||
|
||
INCS += $(PROJECT)/src/platform/$(PLATFORM)/parameters.h | ||
SRCS += $(PROJECT)/src/platform/$(PLATFORM)/parameters.c | ||
|
||
INCS += $(INCLUDE)/no_os_delay.h \ | ||
$(INCLUDE)/no_os_error.h \ | ||
$(INCLUDE)/no_os_gpio.h \ | ||
$(INCLUDE)/no_os_print_log.h \ | ||
$(INCLUDE)/no_os_spi.h \ | ||
$(INCLUDE)/no_os_alloc.h \ | ||
$(INCLUDE)/no_os_irq.h \ | ||
$(INCLUDE)/no_os_list.h \ | ||
$(INCLUDE)/no_os_dma.h \ | ||
$(INCLUDE)/no_os_uart.h \ | ||
$(INCLUDE)/no_os_lf256fifo.h \ | ||
$(INCLUDE)/no_os_util.h \ | ||
$(INCLUDE)/no_os_units.h \ | ||
$(INCLUDE)/no_os_mutex.h | ||
|
||
SRCS += $(DRIVERS)/api/no_os_gpio.c \ | ||
$(NO-OS)/util/no_os_lf256fifo.c \ | ||
$(DRIVERS)/api/no_os_irq.c \ | ||
$(DRIVERS)/api/no_os_spi.c \ | ||
$(DRIVERS)/api/no_os_uart.c \ | ||
$(DRIVERS)/api/no_os_dma.c \ | ||
$(NO-OS)/util/no_os_list.c \ | ||
$(NO-OS)/util/no_os_util.c \ | ||
$(NO-OS)/util/no_os_alloc.c \ | ||
$(NO-OS)/util/no_os_mutex.c | ||
|
||
INCS += $(DRIVERS)/dac/ad8460/ad8460.h | ||
SRCS += $(DRIVERS)/dac/ad8460/ad8460.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/******************************************************************************* | ||
* @file common_data.c | ||
* @brief Defines common data to be used by ad8460 examples. | ||
* @author John Erasmus Mari Geronimo ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2025(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
|
||
#include "common_data.h" | ||
#include <stdbool.h> | ||
|
||
struct no_os_uart_init_param uip = { | ||
.device_id = UART_DEVICE_ID, | ||
.baud_rate = UART_BAUDRATE, | ||
.size = NO_OS_UART_CS_8, | ||
.parity = NO_OS_UART_PAR_NO, | ||
.stop = NO_OS_UART_STOP_1_BIT, | ||
.platform_ops = UART_OPS, | ||
.extra = UART_EXTRA, | ||
}; | ||
|
||
const struct no_os_spi_init_param ad8460_spi_ip = { | ||
.device_id = SPI_DEVICE_ID, | ||
.max_speed_hz = SPI_MAX_SPEED, | ||
.chip_select = SPI_CS, | ||
.mode = NO_OS_SPI_MODE_0, | ||
.bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST, | ||
.platform_ops = SPI_OPS, | ||
.extra = SPI_EXTRA, | ||
.parent = NULL, | ||
}; | ||
|
||
const struct no_os_gpio_init_param ad8460_gpio_rstn = { | ||
.port = GPIO_RSTN_PORT_NUM, | ||
.number = GPIO_RSTN_PIN_NUM, | ||
.platform_ops = GPIO_OPS, | ||
.extra = GPIO_EXTRA, | ||
}; | ||
|
||
struct ad8460_init_param ad8460_ip = { | ||
.spi_init_param = ad8460_spi_ip, | ||
.gpio_rstn = ad8460_gpio_rstn, | ||
.refio_1p2v_mv = 1200, | ||
.ext_resistor_ohms = 2000, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* @file common_data.h | ||
* @brief Defines common data to be used by ad8460 examples. | ||
* @author John Erasmus Mari Geronimo ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2025(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#ifndef __COMMON_DATA_H__ | ||
#define __COMMON_DATA_H__ | ||
|
||
#include "platform_includes.h" | ||
#include "ad8460.h" | ||
#ifdef IIO_SUPPORT | ||
#include "iio_ad8460.h" | ||
#endif | ||
|
||
extern struct no_os_uart_init_param uip; | ||
|
||
extern const struct no_os_spi_init_param ad8460_spi_ip; | ||
extern const struct no_os_gpio_init_param ad8460_gpio_rstn; | ||
extern struct ad8460_init_param ad8460_ip; | ||
|
||
#endif /* __COMMON_DATA_H__ */ |
103 changes: 103 additions & 0 deletions
103
projects/eval-ad8460/src/examples/basic/basic_example.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/******************************************************************************* | ||
* @file basic_example.c | ||
* @brief Basic example code for ad8460 project | ||
* @author John Erasmus Mari Geronimo ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2025(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
|
||
#include "basic_example.h" | ||
#include "common_data.h" | ||
#include "ad8460.h" | ||
#include "no_os_print_log.h" | ||
|
||
/***************************************************************************** | ||
* @brief Basic example main execution. | ||
* | ||
* @return ret - Result of the example execution. If working correctly, will | ||
* execute continuously the while(1) loop and will not return. | ||
*******************************************************************************/ | ||
int basic_example_main() | ||
{ | ||
struct ad8460_device *dev; | ||
int ret, i; | ||
uint16_t val; | ||
uint8_t flag; | ||
|
||
pr_info("\r\nRunning AD8460 Basic Example\r\n"); | ||
|
||
ret = ad8460_init(&dev, &ad8460_ip); | ||
if (ret) | ||
goto error; | ||
|
||
ret = ad8460_reset(dev); | ||
if (ret) | ||
goto free_dev; | ||
|
||
/** Switch to APG mode */ | ||
ret = ad8460_enable_apg_mode(dev, 1); | ||
if (ret) | ||
goto free_dev; | ||
|
||
/** Switch to AWG mode */ | ||
ret = ad8460_enable_apg_mode(dev, 0); | ||
|
||
for (i = 0; i < 16; i++) { | ||
ret = ad8460_set_hvdac_word(dev, i, i); | ||
if (ret) | ||
goto free_dev; | ||
|
||
ret = ad8460_get_hvdac_word(dev, i, &val); | ||
if (ret) | ||
goto free_dev; | ||
|
||
pr_info("HVDAC[%d]: 0x%04X\r\n", i, val); | ||
} | ||
|
||
ret = ad8460_read_shutdown_flag(dev, &flag); | ||
if (ret) | ||
goto free_dev; | ||
|
||
pr_info("Shutdown flag: %d\r\n", flag); | ||
|
||
if (flag) { | ||
ret = ad8460_hv_reset(dev); | ||
if (ret) | ||
goto free_dev; | ||
} | ||
|
||
pr_info("AD8460 Basic Example Done\r\n"); | ||
|
||
return 0; | ||
|
||
free_dev: | ||
ad8460_remove(dev); | ||
error: | ||
pr_info("Error!\r\n"); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* @file basic_example.h | ||
* @brief Basic example header for ad8460 project | ||
* @author John Erasmus Mari Geronimo ([email protected]) | ||
******************************************************************************** | ||
* Copyright 2025(c) Analog Devices, Inc. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of Analog Devices, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*******************************************************************************/ | ||
#ifndef __BASIC_EXAMPLE_H__ | ||
#define __BASIC_EXAMPLE_H__ | ||
|
||
int basic_example_main(); | ||
|
||
#endif /* __BASIC_EXAMPLE_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ifeq (y,$(strip $(IIO_EXAMPLE))) | ||
IIOD=y | ||
CFLAGS += -DIIO_EXAMPLE=1 | ||
SRCS += $(PROJECT)/src/examples/iio_example/iio_example.c | ||
INCS += $(PROJECT)/src/examples/iio_example/iio_example.h | ||
endif | ||
|
||
ifeq (y,$(strip $(BASIC_EXAMPLE))) | ||
CFLAGS += -DBASIC_EXAMPLE=1 | ||
SRCS += $(PROJECT)/src/examples/basic/basic_example.c | ||
INCS += $(PROJECT)/src/examples/basic/basic_example.h | ||
endif | ||
|
||
ifeq (y,$(strip $(IIOD))) | ||
SRC_DIRS += $(NO-OS)/iio/iio_app | ||
INCS += $(DRIVERS)/dac/ad8460/iio_ad8460.h | ||
SRCS += $(DRIVERS)/dac/ad8460/iio_ad8460.c | ||
|
||
INCS += $(INCLUDE)/no_os_list.h \ | ||
$(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h | ||
endif |
Oops, something went wrong.