diff --git a/projects/ad5460/Makefile b/projects/ad5460/Makefile index d40c62dbfb1..68a90ec75fa 100644 --- a/projects/ad5460/Makefile +++ b/projects/ad5460/Makefile @@ -1,12 +1,9 @@ -# Select the example you want to enable by choosing y for enabling and n for disabling -BASIC_EXAMPLE = y -CHANNEL_OUTPUT_EXAMPLE = n -VOLTAGE_OUTPUT_EXAMPLE = n -CURRENT_OUTPUT_EXAMPLE = n +EXAMPLE := basic -# Select the device you want to enable by choosing y for enabling and n for disabling include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/ad5460/builds.json b/projects/ad5460/builds.json index 53a8a1c498f..dc4c6b8a1cb 100644 --- a/projects/ad5460/builds.json +++ b/projects/ad5460/builds.json @@ -1,16 +1,16 @@ { "mbed": { "basic_example": { - "flags" : "RELEASE=y BASIC_EXAMPLE=y" + "flags" : "RELEASE=y EXAMPLE=basic" }, "channel_output_example": { - "flags" : "RELEASE=y BASIC_EXAMPLE=n CHANNEL_OUTPUT_EXAMPLE=y" + "flags" : "RELEASE=y EXAMPLE=channel_output_example" }, "voltage_output_example": { - "flags" : "RELEASE=y BASIC_EXAMPLE=n VOLTAGE_OUTPUT_EXAMPLE=y" + "flags" : "RELEASE=y EXAMPLE=voltage_output_example" }, "current_output_example": { - "flags" : "RELEASE=y BASIC_EXAMPLE=n CURRENT_OUTPUT_EXAMPLE=y" + "flags" : "RELEASE=y EXAMPLE=current_output_example" } } } diff --git a/projects/ad5460/src.mk b/projects/ad5460/src.mk index a0053d6f259..dab72767f96 100644 --- a/projects/ad5460/src.mk +++ b/projects/ad5460/src.mk @@ -1,16 +1,3 @@ -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 \ diff --git a/projects/ad5460/src/common/common_data.h b/projects/ad5460/src/common/common_data.h index 303df2b622c..7f137952db0 100644 --- a/projects/ad5460/src/common/common_data.h +++ b/projects/ad5460/src/common/common_data.h @@ -36,7 +36,7 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "ad5460.h" /******************************************************************************/ diff --git a/projects/ad5460/src/examples/basic/basic_example.c b/projects/ad5460/src/examples/basic/basic_example.c index 20d330e65f4..2528fa1c005 100644 --- a/projects/ad5460/src/examples/basic/basic_example.c +++ b/projects/ad5460/src/examples/basic/basic_example.c @@ -34,7 +34,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "basic_example.h" #include "common_data.h" #include "ad5460.h" #include "no_os_delay.h" @@ -50,7 +49,7 @@ * @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() +int example_main() { struct ad5460_desc *ad5460_desc; int ret; diff --git a/projects/ad5460/src/examples/basic/basic_example.h b/projects/ad5460/src/examples/basic/basic_example.h deleted file mode 100644 index e05d80ded7a..00000000000 --- a/projects/ad5460/src/examples/basic/basic_example.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************//** - * @file basic_example.h - * @brief Basic example header for eval-ad5460 project - * @author Antoniu Miclaus (antoniu.miclaus@analog.com) -******************************************************************************** - * Copyright 2024(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__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int basic_example_main(); - -#endif /* __BASIC_EXAMPLE_H__ */ diff --git a/projects/ad5460/src/examples/channel_output_example/channel_output_example.c b/projects/ad5460/src/examples/channel_output_example/channel_output_example.c index 3f561113cb6..2c46dfa2338 100644 --- a/projects/ad5460/src/examples/channel_output_example/channel_output_example.c +++ b/projects/ad5460/src/examples/channel_output_example/channel_output_example.c @@ -35,7 +35,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "channel_output_example.h" #include "common_data.h" #include "ad5460.h" #include "no_os_delay.h" @@ -51,7 +50,7 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously the while(1) loop and will not return. *******************************************************************************/ -int channel_output_example_main() +int example_main() { struct ad5460_desc *ad5460_desc; union ad5460_live_status *live_status; diff --git a/projects/ad5460/src/examples/channel_output_example/channel_output_example.h b/projects/ad5460/src/examples/channel_output_example/channel_output_example.h deleted file mode 100644 index ad32ca45ab2..00000000000 --- a/projects/ad5460/src/examples/channel_output_example/channel_output_example.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************//** - * @file channel_output_example.h - * @brief Channel output example header for eval-ad5460 project - * @author Akila Marimuthu (akila.marimuthu@analog.com) - * @author Antoniu Miclaus (antoniu.miclaus@analog.com) -******************************************************************************** - * Copyright 2024(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 __CHANNEL_OUTPUT_EXAMPLE_H__ -#define __CHANNEL_OUTPUT_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "ad5460.h" -#include "common_data.h" -#include "no_os_delay.h" -#include "no_os_gpio.h" -#include "no_os_print_log.h" - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int channel_output_example_main(); - -#endif /* __CHANNEL_OUTPUT_EXAMPLE_H__ */ diff --git a/projects/ad5460/src/examples/current_output_example/current_output_example.c b/projects/ad5460/src/examples/current_output_example/current_output_example.c index dec0a0b8c74..a336de3275c 100644 --- a/projects/ad5460/src/examples/current_output_example/current_output_example.c +++ b/projects/ad5460/src/examples/current_output_example/current_output_example.c @@ -35,7 +35,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "current_output_example.h" #include "common_data.h" #include "ad5460.h" #include "no_os_delay.h" @@ -51,7 +50,7 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously the while(1) loop and will not return. *******************************************************************************/ -int current_output_example_main() +int example_main() { struct ad5460_desc *ad5460_desc; int ret; diff --git a/projects/ad5460/src/examples/current_output_example/current_output_example.h b/projects/ad5460/src/examples/current_output_example/current_output_example.h deleted file mode 100644 index b01e9ceacd1..00000000000 --- a/projects/ad5460/src/examples/current_output_example/current_output_example.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************//** - * @file current_output_example.h - * @brief Current output example header for eval-ad5460 project - * @author Akila Marimuthu (akila.marimuthu@analog.com) - * @author Antoniu Miclaus (antoniu.miclaus@analog.com) -******************************************************************************** - * Copyright 2024(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 __CURRENT_OUTPUT_EXAMPLE_H__ -#define __CURRENT_OUTPUT_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "ad5460.h" -#include "common_data.h" -#include "no_os_delay.h" -#include "no_os_gpio.h" -#include "no_os_print_log.h" - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int current_output_example_main(); - -#endif /* __CURRENT_OUTPUT_EXAMPLE_H__ */ diff --git a/projects/ad5460/src/examples/examples_src.mk b/projects/ad5460/src/examples/examples_src.mk deleted file mode 100644 index 5b0e16d2e18..00000000000 --- a/projects/ad5460/src/examples/examples_src.mk +++ /dev/null @@ -1,26 +0,0 @@ -ifeq (y,$(strip $(BASIC_EXAMPLE))) -CFLAGS += -DBASIC_EXAMPLE -SRCS += $(PROJECT)/src/examples/basic/basic_example.c -INCS += $(PROJECT)/src/examples/basic/basic_example.h -endif - -ifeq (y,$(strip $(CHANNEL_OUTPUT_EXAMPLE))) -CFLAGS += -DCHANNEL_OUTPUT_EXAMPLE -SRCS += $(PROJECT)/src/examples/channel_output_example/channel_output_example.c -INCS += $(PROJECT)/src/examples/channel_output_example/channel_output_example.h -endif - -ifeq (y,$(strip $(VOLTAGE_OUTPUT_EXAMPLE))) -CFLAGS += -DVOLTAGE_OUTPUT_EXAMPLE -SRCS += $(PROJECT)/src/examples/voltage_output_example/voltage_output_example.c -INCS += $(PROJECT)/src/examples/voltage_output_example/voltage_output_example.h -endif - -ifeq (y,$(strip $(CURRENT_OUTPUT_EXAMPLE))) -CFLAGS += -DCURRENT_OUTPUT_EXAMPLE -SRCS += $(PROJECT)/src/examples/current_output_example/current_output_example.c -INCS += $(PROJECT)/src/examples/current_output_example/current_output_example.h -endif - -INCS += $(INCLUDE)/no_os_list.h \ - $(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h diff --git a/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.c b/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.c index 32c07152dce..8a9c41c1304 100644 --- a/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.c +++ b/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.c @@ -35,7 +35,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "voltage_output_example.h" #include "common_data.h" #include "ad5460.h" #include "no_os_delay.h" @@ -51,7 +50,7 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously the while(1) loop and will not return. *******************************************************************************/ -int voltage_output_example_main() +int example_main() { struct ad5460_desc *ad5460_desc; int ret; diff --git a/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.h b/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.h deleted file mode 100644 index 3a8f67e09cb..00000000000 --- a/projects/ad5460/src/examples/voltage_output_example/voltage_output_example.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************//** - * @file voltage_output_example.h - * @brief Voltage output example header for eval-ad5460 project - * @author Akila Marimuthu (akila.marimuthu@analog.com) - * @author Antoniu Miclaus (antoniu.miclaus@analog.com) -******************************************************************************** - * Copyright 2024(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 __VOLTAGE_OUTPUT_EXAMPLE_H__ -#define __VOLTAGE_OUTPUT_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#include "ad5460.h" -#include "common_data.h" -#include "no_os_delay.h" -#include "no_os_gpio.h" -#include "no_os_print_log.h" - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int voltage_output_example_main(); - -#endif /* __VOLTAGE_OUTPUT_EXAMPLE_H__ */ diff --git a/projects/ad5460/src/platform/mbed/main.c b/projects/ad5460/src/platform/mbed/main.c index b695b87c755..fdf251aef2e 100644 --- a/projects/ad5460/src/platform/mbed/main.c +++ b/projects/ad5460/src/platform/mbed/main.c @@ -34,24 +34,10 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" -#ifdef BASIC_EXAMPLE -#include "basic_example.h" -#endif - -#ifdef CHANNEL_OUTPUT_EXAMPLE -#include "channel_output_example.h" -#endif - -#ifdef VOLTAGE_OUTPUT_EXAMPLE -#include "voltage_output_example.h" -#endif - -#ifdef CURRENT_OUTPUT_EXAMPLE -#include "current_output_example.h" -#endif +extern int example_main(); /***************************************************************************//** * @brief Main function for Mbed platform. @@ -64,7 +50,6 @@ int main() int ret; ad5460_ip.spi_ip = ad5460_spi_ip; -#ifdef BASIC_EXAMPLE struct no_os_uart_desc* uart; ret = no_os_uart_init(&uart, &ad5460_uart_ip); if (ret) { @@ -72,55 +57,11 @@ int main() return ret; } no_os_uart_stdio(uart); - ret = basic_example_main(); + ret = example_main(); if (ret) { no_os_uart_remove(uart); return ret; } -#endif - -#ifdef CHANNEL_OUTPUT_EXAMPLE - struct no_os_uart_desc* uart; - ret = no_os_uart_init(&uart, &ad5460_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart); - ret = channel_output_example_main(); - no_os_uart_remove(uart); - if (ret) - return ret; -#endif - -#ifdef VOLTAGE_OUTPUT_EXAMPLE - struct no_os_uart_desc* uart; - ret = no_os_uart_init(&uart, &ad5460_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart); - ret = voltage_output_example_main(); - no_os_uart_remove(uart); - if (ret) - return ret; -#endif - -#ifdef CURRENT_OUTPUT_EXAMPLE - struct no_os_uart_desc* uart; - ret = no_os_uart_init(&uart, &ad5460_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart); - ret = current_output_example_main(); - no_os_uart_remove(uart); - if (ret) - return ret; -#endif -#if (BASIC_EXAMPLE+CHANNEL_OUTPUT_EXAMPLE+VOLTAGE_OUTPUT_EXAMPLE+CURRENT_OUTPUT_EXAMPLE != 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif return 0; } diff --git a/projects/ad5460/src/platform/platform_includes.h b/projects/ad5460/src/platform/platform_includes.h deleted file mode 100644 index 425895d367d..00000000000 --- a/projects/ad5460/src/platform/platform_includes.h +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by eval-ad5460 project. - * @author Antoniu Miclaus (antoniu.miclaus@analog.com) -******************************************************************************** - * Copyright 2024(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#ifdef MBED_PLATFORM -#include "mbed/parameters.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/ad74416h/Makefile b/projects/ad74416h/Makefile index 3da261ed336..b5686d677dd 100644 --- a/projects/ad74416h/Makefile +++ b/projects/ad74416h/Makefile @@ -1,9 +1,9 @@ -# Select the example you want to enable by choosing y for enabling and n for disabling -BASIC_EXAMPLE = y +EXAMPLE ?= basic -# Select the device you want to enable by choosing y for enabling and n for disabling include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/ad74416h/builds.json b/projects/ad74416h/builds.json index fb39ec74991..9d684837940 100644 --- a/projects/ad74416h/builds.json +++ b/projects/ad74416h/builds.json @@ -1,12 +1,12 @@ { "stm32": { "basic_example": { - "flags" : "BASIC_EXAMPLE=y" + "flags" : "EXAMPLE=basic" } }, "mbed": { "basic_example": { - "flags" : "BASIC_EXAMPLE=y" + "flags" : "EXAMPLE=basic" } } } diff --git a/projects/ad74416h/src.mk b/projects/ad74416h/src.mk index 9cb70ebd828..54919c69097 100644 --- a/projects/ad74416h/src.mk +++ b/projects/ad74416h/src.mk @@ -1,16 +1,3 @@ -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 \ diff --git a/projects/ad74416h/src/common/common_data.h b/projects/ad74416h/src/common/common_data.h index a38ff1991a2..ae395ae6f44 100644 --- a/projects/ad74416h/src/common/common_data.h +++ b/projects/ad74416h/src/common/common_data.h @@ -36,7 +36,7 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "ad74416h.h" /******************************************************************************/ diff --git a/projects/ad74416h/src/examples/basic/basic_example.c b/projects/ad74416h/src/examples/basic/basic_example.c index 1f6d707b1a7..e23ba1685d0 100644 --- a/projects/ad74416h/src/examples/basic/basic_example.c +++ b/projects/ad74416h/src/examples/basic/basic_example.c @@ -50,11 +50,19 @@ * @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() +int example_main() { struct ad74416h_desc *ad74416h_desc; int ret; + struct no_os_uart_desc *uart_desc; + + ret = no_os_uart_init(&uart_desc, &ad74416h_uart_ip); + if (ret) + return ret; + + no_os_uart_stdio(uart_desc); + ret = ad74416h_init(&ad74416h_desc, &ad74416h_ip); if (ret) goto error; diff --git a/projects/ad74416h/src/examples/basic/basic_example.h b/projects/ad74416h/src/examples/basic/basic_example.h index fea261476b8..9218fba462f 100644 --- a/projects/ad74416h/src/examples/basic/basic_example.h +++ b/projects/ad74416h/src/examples/basic/basic_example.h @@ -40,6 +40,6 @@ /******************************************************************************/ /************************ Functions Declarations ******************************/ /******************************************************************************/ -int basic_example_main(); +int example_main(); #endif /* __BASIC_EXAMPLE_H__ */ diff --git a/projects/ad74416h/src/examples/examples_src.mk b/projects/ad74416h/src/examples/examples_src.mk deleted file mode 100644 index 9289e591e98..00000000000 --- a/projects/ad74416h/src/examples/examples_src.mk +++ /dev/null @@ -1,8 +0,0 @@ -ifeq (y,$(strip $(BASIC_EXAMPLE))) -CFLAGS += -DBASIC_EXAMPLE -SRCS += $(PROJECT)/src/examples/basic/basic_example.c -INCS += $(PROJECT)/src/examples/basic/basic_example.h -endif - -INCS += $(INCLUDE)/no_os_list.h \ - $(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h diff --git a/projects/ad74416h/src/platform/mbed/main.c b/projects/ad74416h/src/platform/mbed/main.c index 79a56d97d93..5862be5fec6 100644 --- a/projects/ad74416h/src/platform/mbed/main.c +++ b/projects/ad74416h/src/platform/mbed/main.c @@ -34,12 +34,10 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" -#ifdef BASIC_EXAMPLE -#include "basic_example.h" -#endif +extern int example_main(); /***************************************************************************//** * @brief Main function for Mbed platform. @@ -49,27 +47,7 @@ int main() { - int ret; ad74416h_ip.spi_ip = ad74416h_spi_ip; -#ifdef BASIC_EXAMPLE - struct no_os_uart_desc* uart; - ret = no_os_uart_init(&uart, &ad74416h_uart_ip); - if (ret) { - no_os_uart_remove(uart); - return ret; - } - no_os_uart_stdio(uart); - ret = basic_example_main(); - if (ret) { - no_os_uart_remove(uart); - return ret; - } -#endif - -#if (IIO_EXAMPLE+BASIC_EXAMPLE != 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif - return 0; + return example_main(); } diff --git a/projects/ad74416h/src/platform/platform_includes.h b/projects/ad74416h/src/platform/platform_includes.h deleted file mode 100644 index 1d4a51599b3..00000000000 --- a/projects/ad74416h/src/platform/platform_includes.h +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by eval-ad74416h project. - * @author Antoniu Miclaus (antoniu.miclaus@analog.com) -******************************************************************************** - * Copyright 2023(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#ifdef STM32_PLATFORM -#include "stm32/parameters.h" -#endif - -#ifdef MBED_PLATFORM -#include "mbed/parameters.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/ad74416h/src/platform/stm32/main.c b/projects/ad74416h/src/platform/stm32/main.c index 28b1aa293db..d51175571ae 100644 --- a/projects/ad74416h/src/platform/stm32/main.c +++ b/projects/ad74416h/src/platform/stm32/main.c @@ -34,7 +34,7 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" @@ -49,31 +49,10 @@ *******************************************************************************/ int main() { - int ret = -EINVAL; ad74416h_ip.spi_ip = ad74416h_spi_ip; ad74416h_spi_extra_ip.get_input_clock = HAL_RCC_GetPCLK1Freq; stm32_init(); -#ifdef BASIC_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &ad74416h_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = basic_example_main(); - if (ret) { - no_os_uart_remove(uart_desc); - return ret; - } - -#endif - -#if (BASIC_EXAMPLE == 0) -#error At least one example has to be selected using y value in Makefile. -#endif - - return 0; + return example_main(); } diff --git a/projects/adf4368/Makefile b/projects/adf4368/Makefile index 59494b11612..602f66ca6b8 100644 --- a/projects/adf4368/Makefile +++ b/projects/adf4368/Makefile @@ -1,8 +1,10 @@ -# Uncomment to use the desired platform PLATFORM = mbed +EXAMPLE ?= basic include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/adf4368/src.mk b/projects/adf4368/src.mk index 207073ecf14..e87a4ab5d7f 100644 --- a/projects/adf4368/src.mk +++ b/projects/adf4368/src.mk @@ -1,16 +1,3 @@ -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 - SRCS += $(DRIVERS)/api/no_os_uart.c \ $(DRIVERS)/api/no_os_gpio.c \ $(DRIVERS)/api/no_os_spi.c \ diff --git a/projects/adf4368/src/common/common_data.h b/projects/adf4368/src/common/common_data.h index 56e40864143..5dde4690ff3 100644 --- a/projects/adf4368/src/common/common_data.h +++ b/projects/adf4368/src/common/common_data.h @@ -33,7 +33,7 @@ #ifndef __COMMON_DATA_H__ #define __COMMON_DATA_H__ -#include "platform_includes.h" +#include "parameters.h" #include "adf4368.h" #include "no_os_spi.h" #include "no_os_uart.h" diff --git a/projects/adf4368/src/examples/basic/basic_example.c b/projects/adf4368/src/examples/basic/basic_example.c index 8900dd1b09c..ab0272e7198 100644 --- a/projects/adf4368/src/examples/basic/basic_example.c +++ b/projects/adf4368/src/examples/basic/basic_example.c @@ -31,7 +31,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "basic_example.h" +#include "parameters.h" #include "common_data.h" #include "no_os_delay.h" #include "no_os_print_log.h" @@ -42,13 +42,20 @@ * @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() +int example_main() { struct adf4368_dev *dev; int ret; + struct no_os_uart_desc *uart_desc; pr_info("Enter basic example \n"); + ret = no_os_uart_init(&uart_desc, &adf4368_uart_ip); + if (ret) + return ret; + + no_os_uart_stdio(uart_desc); + ret = adf4368_init(&dev, &adf4368_ip); if (ret) goto error; diff --git a/projects/adf4368/src/examples/basic/basic_example.h b/projects/adf4368/src/examples/basic/basic_example.h deleted file mode 100644 index b6ca8065dce..00000000000 --- a/projects/adf4368/src/examples/basic/basic_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file basic_example.h - * @brief Basic example header for eval-adf4368 - * @author Sirac Kucukarabacioglu (sirac.kucukarabacioglu@analog.com) -******************************************************************************** - * Copyright 2024(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__ */ diff --git a/projects/adf4368/src/examples/examples_src.mk b/projects/adf4368/src/examples/examples_src.mk deleted file mode 100644 index 72c80584f32..00000000000 --- a/projects/adf4368/src/examples/examples_src.mk +++ /dev/null @@ -1,24 +0,0 @@ -EXAMPLE ?= basic - -ifeq (basic,$(strip $(EXAMPLE))) -CFLAGS += -DBASIC_EXAMPLE -SRCS += $(PROJECT)/src/examples/basic/basic_example.c -INCS += $(PROJECT)/src/examples/basic/basic_example.h -endif - -ifeq (iio_example,$(strip $(EXAMPLE))) -IIOD=y -CFLAGS += -DIIO_EXAMPLE -SRCS += $(PROJECT)/src/examples/iio_example/iio_example.c -INCS += $(PROJECT)/src/examples/iio_example/iio_example.h -endif - -ifeq (y,$(strip $(IIOD))) -SRC_DIRS += $(NO-OS)/iio/iio_app - -INCS += $(DRIVERS)/frequency/adf4368/iio_adf4368.h -SRCS += $(DRIVERS)/frequency/adf4368/iio_adf4368.c - -INCS += $(INCLUDE)/no_os_list.h \ - $(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h -endif diff --git a/projects/adf4368/src/examples/iio_example/iio_example.c b/projects/adf4368/src/examples/iio_example/iio_example.c index 1fdb50411ea..58ac97b63ec 100644 --- a/projects/adf4368/src/examples/iio_example/iio_example.c +++ b/projects/adf4368/src/examples/iio_example/iio_example.c @@ -32,7 +32,6 @@ *******************************************************************************/ #include "common_data.h" -#include "iio_example.h" #include "iio_adf4368.h" #include "iio_app.h" #include "no_os_print_log.h" @@ -43,7 +42,7 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously function iio_app_run and will not return. */ -int iio_example_main() +int example_main() { struct adf4368_iio_dev *adf4368_iio_dev; struct adf4368_iio_dev_init_param adf4368_iio_ip; diff --git a/projects/adf4368/src/examples/iio_example/iio_example.h b/projects/adf4368/src/examples/iio_example/iio_example.h deleted file mode 100644 index de91408cb3a..00000000000 --- a/projects/adf4368/src/examples/iio_example/iio_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file iio_example.h - * @brief IIO example header for adf4368 project - * @author Sirac Kucukarabacioglu (sirac.kucukarabacioglu@analog.com) -******************************************************************************** - * Copyright 2024(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 __IIO_EXAMPLE_H__ -#define __IIO_EXAMPLE_H__ - -int iio_example_main(); - -#endif /* __IIO_EXAMPLE_H__ */ diff --git a/projects/adf4368/src/examples/iio_example/iio_example.mk b/projects/adf4368/src/examples/iio_example/iio_example.mk new file mode 100644 index 00000000000..82beac95203 --- /dev/null +++ b/projects/adf4368/src/examples/iio_example/iio_example.mk @@ -0,0 +1,3 @@ +IIOD=y +INCS += $(DRIVERS)/frequency/adf4368/iio_adf4368.h +SRCS += $(DRIVERS)/frequency/adf4368/iio_adf4368.c \ No newline at end of file diff --git a/projects/adf4368/src/platform/mbed/main.c b/projects/adf4368/src/platform/mbed/main.c index b4102b48299..3c66dc41f29 100644 --- a/projects/adf4368/src/platform/mbed/main.c +++ b/projects/adf4368/src/platform/mbed/main.c @@ -34,17 +34,11 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef BASIC_EXAMPLE -#include "basic_example.h" -#endif - -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif +extern int example_main(); /** * @brief Main function execution for mbed platform. @@ -52,24 +46,5 @@ */ int main() { - int ret = -EINVAL; - -#ifdef BASIC_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adf4368_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = basic_example_main(); - if (ret) - no_os_uart_remove(uart_desc); -#endif - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - - return ret; + return example_main(); } diff --git a/projects/adf4368/src/platform/platform_includes.h b/projects/adf4368/src/platform/platform_includes.h deleted file mode 100644 index 05b06fa01a6..00000000000 --- a/projects/adf4368/src/platform/platform_includes.h +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by ADF4368 project. - * @author Sirac Kucukarabacioglu (sirac.kucukarabacioglu@analog.com) -******************************************************************************** - * Copyright 2024(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#ifdef MBED_PLATFORM -#include "mbed/parameters.h" -#endif - -#ifdef IIO_SUPPORT -#include "iio_app.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/adf4382/Makefile b/projects/adf4382/Makefile index 05154b3610a..b5686d677dd 100644 --- a/projects/adf4382/Makefile +++ b/projects/adf4382/Makefile @@ -1,13 +1,9 @@ -# Uncomment to use the desired platform -# PLATFORM = stm32 -PLATFORM = mbed - -# Select the example you want to enable by chossing y for enabling and n for disabling -BASIC_EXAMPLE = n -IIO_EXAMPLE = y +EXAMPLE ?= basic include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/adf4382/builds.json b/projects/adf4382/builds.json index 454711b6b73..a527938cb6a 100644 --- a/projects/adf4382/builds.json +++ b/projects/adf4382/builds.json @@ -1,18 +1,18 @@ { "mbed": { "basic_example": { - "flags" : "BASIC_EXAMPLE=y IIO_EXAMPLE=n" + "flags" : "EXAMPLE=basic" }, "iio": { - "flags": "IIO_EXAMPLE=y BASIC_EXAMPLE=n" + "flags": "EXAMPLE=iio_example" } }, "stm32": { "basic_example": { - "flags" : "BASIC_EXAMPLE=y IIO_EXAMPLE=n HARDWARE=sdp-ck1z.ioc" + "flags" : "EXAMPLE=basic HARDWARE=sdp-ck1z.ioc" }, "iio": { - "flags": "IIO_EXAMPLE=y BASIC_EXAMPLE=n HARDWARE=sdp-ck1z.ioc" + "flags": "EXAMPLE=iio_example HARDWARE=sdp-ck1z.ioc" } } } diff --git a/projects/adf4382/src.mk b/projects/adf4382/src.mk index ae41d11071c..9cf6b07f97c 100644 --- a/projects/adf4382/src.mk +++ b/projects/adf4382/src.mk @@ -1,16 +1,3 @@ -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 - SRCS += $(DRIVERS)/api/no_os_uart.c \ $(DRIVERS)/api/no_os_gpio.c \ $(DRIVERS)/api/no_os_spi.c \ diff --git a/projects/adf4382/src/common/common_data.h b/projects/adf4382/src/common/common_data.h index 175d26b7c6a..428a8802efc 100644 --- a/projects/adf4382/src/common/common_data.h +++ b/projects/adf4382/src/common/common_data.h @@ -33,7 +33,7 @@ #ifndef __COMMON_DATA_H__ #define __COMMON_DATA_H__ -#include "platform_includes.h" +#include "parameters.h" #include "adf4382.h" #include "no_os_spi.h" #include "no_os_uart.h" diff --git a/projects/adf4382/src/examples/basic/basic_example.c b/projects/adf4382/src/examples/basic/basic_example.c index 98c81bd3909..d02285f8680 100644 --- a/projects/adf4382/src/examples/basic/basic_example.c +++ b/projects/adf4382/src/examples/basic/basic_example.c @@ -31,7 +31,6 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "basic_example.h" #include "common_data.h" #include "no_os_delay.h" #include "no_os_print_log.h" @@ -42,13 +41,21 @@ * @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() +int example_main() { struct adf4382_dev *dev; int ret; pr_info("Enter basic example \n"); + struct no_os_uart_desc *uart_desc; + + ret = no_os_uart_init(&uart_desc, &adf4382_uart_ip); + if (ret) + return ret; + + no_os_uart_stdio(uart_desc); + ret = adf4382_init(&dev, &adf4382_ip); if (ret) goto error; diff --git a/projects/adf4382/src/examples/basic/basic_example.h b/projects/adf4382/src/examples/basic/basic_example.h deleted file mode 100644 index 966fd00b3d0..00000000000 --- a/projects/adf4382/src/examples/basic/basic_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file basic_example.h - * @brief Basic example header for eval-adf4382 - * @author CHegbeli (ciprian.hegbeli@analog.com) -******************************************************************************** - * Copyright 2022(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__ */ diff --git a/projects/adf4382/src/examples/examples_src.mk b/projects/adf4382/src/examples/examples_src.mk deleted file mode 100644 index 662acc8809a..00000000000 --- a/projects/adf4382/src/examples/examples_src.mk +++ /dev/null @@ -1,22 +0,0 @@ -ifeq (y,$(strip $(BASIC_EXAMPLE))) -CFLAGS += -DBASIC_EXAMPLE -SRCS += $(PROJECT)/src/examples/basic/basic_example.c -INCS += $(PROJECT)/src/examples/basic/basic_example.h -endif - -ifeq (y,$(strip $(IIO_EXAMPLE))) -IIOD=y -CFLAGS += -DIIO_EXAMPLE -SRCS += $(PROJECT)/src/examples/iio_example/iio_example.c -INCS += $(PROJECT)/src/examples/iio_example/iio_example.h -endif - -ifeq (y,$(strip $(IIOD))) -SRC_DIRS += $(NO-OS)/iio/iio_app - -INCS += $(DRIVERS)/frequency/adf4382/iio_adf4382.h -SRCS += $(DRIVERS)/frequency/adf4382/iio_adf4382.c - -INCS += $(INCLUDE)/no_os_list.h \ - $(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h -endif diff --git a/projects/adf4382/src/examples/iio_example/iio_example.c b/projects/adf4382/src/examples/iio_example/iio_example.c index 6df176b712a..3c6cbc99c9c 100644 --- a/projects/adf4382/src/examples/iio_example/iio_example.c +++ b/projects/adf4382/src/examples/iio_example/iio_example.c @@ -32,7 +32,6 @@ *******************************************************************************/ #include "common_data.h" -#include "iio_example.h" #include "iio_adf4382.h" #include "iio_app.h" #include "no_os_print_log.h" @@ -43,7 +42,7 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously function iio_app_run and will not return. */ -int iio_example_main() +int example_main() { struct adf4382_iio_dev *adf4382_iio_dev; struct adf4382_iio_dev_init_param adf4382_iio_ip; diff --git a/projects/adf4382/src/examples/iio_example/iio_example.h b/projects/adf4382/src/examples/iio_example/iio_example.h deleted file mode 100644 index caf759bfac5..00000000000 --- a/projects/adf4382/src/examples/iio_example/iio_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file iio_example.h - * @brief IIO example header for adf4382 project - * @author CHegbeli (ciprian.hegbeli@analog.com) -******************************************************************************** - * Copyright 2023(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 __IIO_EXAMPLE_H__ -#define __IIO_EXAMPLE_H__ - -int iio_example_main(); - -#endif /* __IIO_EXAMPLE_H__ */ diff --git a/projects/adf4382/src/examples/iio_example/iio_example.mk b/projects/adf4382/src/examples/iio_example/iio_example.mk new file mode 100644 index 00000000000..6281aca74a3 --- /dev/null +++ b/projects/adf4382/src/examples/iio_example/iio_example.mk @@ -0,0 +1,3 @@ +IIOD = y +INCS += $(DRIVERS)/frequency/adf4382/iio_adf4382.h +SRCS += $(DRIVERS)/frequency/adf4382/iio_adf4382.c \ No newline at end of file diff --git a/projects/adf4382/src/platform/mbed/main.c b/projects/adf4382/src/platform/mbed/main.c index 2f99db0947f..aafe727e697 100644 --- a/projects/adf4382/src/platform/mbed/main.c +++ b/projects/adf4382/src/platform/mbed/main.c @@ -34,17 +34,11 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef BASIC_EXAMPLE -#include "basic_example.h" -#endif - -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif +extern int example_main(); /** * @brief Main function execution for mbed platform. @@ -52,24 +46,5 @@ */ int main() { - int ret = -EINVAL; - -#ifdef BASIC_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adf4382_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = basic_example_main(); - if (ret) - no_os_uart_remove(uart_desc); -#endif - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - - return ret; + return example_main(); } diff --git a/projects/adf4382/src/platform/platform_includes.h b/projects/adf4382/src/platform/platform_includes.h deleted file mode 100644 index 9039a580d7a..00000000000 --- a/projects/adf4382/src/platform/platform_includes.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by ADF4382 project. - * @author CHegbeli (ciprian.hegbeli@analog.com) -******************************************************************************** - * Copyright 2023(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#ifdef STM32_PLATFORM -#include "stm32/parameters.h" -#endif - -#ifdef MBED_PLATFORM -#include "mbed/parameters.h" -#endif - -#ifdef IIO_SUPPORT -#include "iio_app.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/adf4382/src/platform/stm32/main.c b/projects/adf4382/src/platform/stm32/main.c index cbb806139b2..169350750bf 100644 --- a/projects/adf4382/src/platform/stm32/main.c +++ b/projects/adf4382/src/platform/stm32/main.c @@ -31,17 +31,11 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef BASIC_EXAMPLE -#include "basic_example.h" -#endif - -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif +extern int example_main(); /** * @brief Main function execution for STM32 platform. @@ -49,27 +43,9 @@ */ int main() { - int ret = -EINVAL; adf4382_spi_extra_ip.get_input_clock = HAL_RCC_GetPCLK1Freq; stm32_init(); -#ifdef BASIC_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adf4382_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = basic_example_main(); - if (ret) - no_os_uart_remove(uart_desc); -#endif - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - - return ret; + return example_main(); } diff --git a/projects/adin1110/Makefile b/projects/adin1110/Makefile index 76e474c1c2b..79bbd6fd740 100644 --- a/projects/adin1110/Makefile +++ b/projects/adin1110/Makefile @@ -1,8 +1,9 @@ -# Select the example you want to enable by choosing y for enabling and n for disabling -FRAME_RX_TX = y +EXAMPLE ?= frame_rx_tx include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/adin1110/builds.json b/projects/adin1110/builds.json index eab6da3ca64..763c82da95c 100644 --- a/projects/adin1110/builds.json +++ b/projects/adin1110/builds.json @@ -1,7 +1,7 @@ { "maxim": { "frame_rx_tx": { - "flags" : "FRAME_RX_TX=y TARGET=max32650" + "flags" : "EXAMPLE=frame_rx_tx TARGET=max32650" } } } diff --git a/projects/adin1110/src.mk b/projects/adin1110/src.mk index 07dfd894575..f51f3a80ba0 100644 --- a/projects/adin1110/src.mk +++ b/projects/adin1110/src.mk @@ -1,16 +1,3 @@ -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 \ diff --git a/projects/adin1110/src/common/common_data.h b/projects/adin1110/src/common/common_data.h index 66e36ecb115..d5f9ed6cd58 100644 --- a/projects/adin1110/src/common/common_data.h +++ b/projects/adin1110/src/common/common_data.h @@ -33,7 +33,7 @@ #ifndef __COMMON_DATA_H__ #define __COMMON_DATA_H__ -#include "platform_includes.h" +#include "parameters.h" #include "no_os_spi.h" #include "no_os_uart.h" #include "no_os_gpio.h" diff --git a/projects/adin1110/src/examples/examples_src.mk b/projects/adin1110/src/examples/examples_src.mk deleted file mode 100644 index 592277ad8ec..00000000000 --- a/projects/adin1110/src/examples/examples_src.mk +++ /dev/null @@ -1,8 +0,0 @@ -ifeq (y,$(strip $(FRAME_RX_TX))) -CFLAGS += -DFRAME_RX_TX -SRCS += $(PROJECT)/src/examples/frame_rx_tx/frame_rx_tx_example.c -INCS += $(PROJECT)/src/examples/frame_rx_tx/frame_rx_tx_example.h -endif - -INCS += $(DRIVERS)/net/adin1110/adin1110.h -SRCS += $(DRIVERS)/net/adin1110/adin1110.c diff --git a/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx.mk b/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx.mk new file mode 100644 index 00000000000..ab454d2c6b0 --- /dev/null +++ b/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx.mk @@ -0,0 +1,2 @@ +SRCS += $(PROJECT)/src/examples/frame_rx_tx/frame_rx_tx_example.c +INCS += $(PROJECT)/src/examples/frame_rx_tx/frame_rx_tx_example.h diff --git a/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.c b/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.c index cd970c7b60c..f3dc2496490 100644 --- a/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.c +++ b/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.c @@ -31,7 +31,6 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include -#include "frame_rx_tx_example.h" #include "common_data.h" #include "no_os_delay.h" #include "no_os_print_log.h" @@ -119,7 +118,7 @@ uint8_t eth_rx_buff[ADIN1110_BUFF_LEN]; * @return ret - Result of the example execution. If working correctly, will * execute continuously the while(1) loop and will not return. *******************************************************************************/ -int frame_rx_tx_example_main() +int example_main() { uint32_t ucast_frame_rx_cnt; uint32_t bcast_frame_rx_cnt; diff --git a/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.h b/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.h deleted file mode 100644 index 89169c04d41..00000000000 --- a/projects/adin1110/src/examples/frame_rx_tx/frame_rx_tx_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file frame_rx_tx_example.h - * @brief Frame receive and trasmit example header for the ADIN1110 project - * @author Ciprian Regus (ciprian.regus@analog.com) -******************************************************************************** - * Copyright 2023(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 __FRAME_RX_TX_EXAMPLE_H__ -#define __FRAME_RX_TX_EXAMPLE_H__ - -int frame_rx_tx_example_main(); - -#endif /* __FRAME_RX_TX_EXAMPLE_H__ */ diff --git a/projects/adin1110/src/platform/maxim/main.c b/projects/adin1110/src/platform/maxim/main.c index 14ba1beed1e..631dc7b569e 100644 --- a/projects/adin1110/src/platform/maxim/main.c +++ b/projects/adin1110/src/platform/maxim/main.c @@ -31,11 +31,11 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#include "frame_rx_tx_example.h" +extern int example_main(); /***************************************************************************//** * @brief Main function execution for Maxim platform. @@ -53,9 +53,5 @@ int main() return ret; no_os_uart_stdio(uart_desc); - return frame_rx_tx_example_main(); - -#ifndef FRAME_RX_TX -#error No example was selected. -#endif + return example_main(); } diff --git a/projects/adin1110/src/platform/platform_includes.h b/projects/adin1110/src/platform/platform_includes.h deleted file mode 100644 index 381cb7dfb84..00000000000 --- a/projects/adin1110/src/platform/platform_includes.h +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by the ADIN1110 project. - * @author Ciprian Regus (ciprian.regus@analog.com) -******************************************************************************** - * Copyright 2023(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -#ifdef MAXIM_PLATFORM -#include "maxim/parameters.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/adp1050/Makefile b/projects/adp1050/Makefile index ea22697a376..b5686d677dd 100644 --- a/projects/adp1050/Makefile +++ b/projects/adp1050/Makefile @@ -1,9 +1,9 @@ -# Select the example you want to enable by choosing y for enabling and n for disabling -BASIC_EXAMPLE = n -IIO_EXAMPLE = y +EXAMPLE ?= basic include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/adp1050/README.rst b/projects/adp1050/README.rst index dc98850bcc8..4d13945a214 100644 --- a/projects/adp1050/README.rst +++ b/projects/adp1050/README.rst @@ -158,9 +158,9 @@ In order to build the IIO project make sure you have the following configuration .. code-block:: bash - # Select the example you want to enable by choosing y for enabling and n for disabling - BASIC_EXAMPLE = n - IIO__EXAMPLE = y + # Select the example you want to build by passing one of the following to make + EXAMPLE = basic + EXAMPLE = iio_example No-OS Supported Platforms ------------------------- @@ -222,6 +222,6 @@ J2: # to delete current build make reset # to build the project - make PLATFORM=maxim TARGET=max32690 + make PLATFORM=maxim TARGET=max32690 EXAMPLE=basic # to flash the code make run diff --git a/projects/adp1050/builds.json b/projects/adp1050/builds.json index 09b5bc3f856..45c834757d6 100644 --- a/projects/adp1050/builds.json +++ b/projects/adp1050/builds.json @@ -1,10 +1,10 @@ { "maxim": { "basic_example_max32690": { - "flags" : "BASIC_EXAMPLE=y IIO_EXAMPLE=n TARGET=max32690" + "flags" : "EXAMPLE=basic TARGET=max32690" }, "iio_example_max32690": { - "flags" : "BASIC_EXAMPLE=n IIO_EXAMPLE=y TARGET=max32690" + "flags" : "EXAMPLE=iio_example TARGET=max32690" } } } diff --git a/projects/adp1050/src.mk b/projects/adp1050/src.mk index 401177d40e8..2747d75f2fc 100644 --- a/projects/adp1050/src.mk +++ b/projects/adp1050/src.mk @@ -1,16 +1,3 @@ -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_list.h \ diff --git a/projects/adp1050/src/common/common_data.h b/projects/adp1050/src/common/common_data.h index 54eea1862be..22e74049093 100644 --- a/projects/adp1050/src/common/common_data.h +++ b/projects/adp1050/src/common/common_data.h @@ -33,7 +33,7 @@ #ifndef __COMMON_DATA_H__ #define __COMMON_DATA_H__ -#include "platform_includes.h" +#include "parameters.h" #include "no_os_i2c.h" #include "no_os_gpio.h" #include "no_os_pwm.h" diff --git a/projects/adp1050/src/examples/basic/basic_example.c b/projects/adp1050/src/examples/basic/basic_example.c index 18a938a5d64..6b6da6a1c3c 100644 --- a/projects/adp1050/src/examples/basic/basic_example.c +++ b/projects/adp1050/src/examples/basic/basic_example.c @@ -31,7 +31,6 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include "common_data.h" -#include "basic_example.h" #include "no_os_delay.h" #include "no_os_i2c.h" #include "no_os_print_log.h" @@ -39,7 +38,7 @@ #include "no_os_pwm.h" #include "adp1050.h" -int basic_example_main() +int example_main() { int ret; @@ -48,6 +47,14 @@ int basic_example_main() uint8_t data2[2]; uint16_t vout; + struct no_os_uart_desc *uart_desc; + + ret = no_os_uart_init(&uart_desc, &adp1050_uart_ip); + if (ret) + return ret; + + no_os_uart_stdio(uart_desc); + ret = adp1050_init(&adp1050_desc, &adp1050_ip); if (ret) goto exit; diff --git a/projects/adp1050/src/examples/basic/basic_example.h b/projects/adp1050/src/examples/basic/basic_example.h deleted file mode 100644 index 4264b72c5a0..00000000000 --- a/projects/adp1050/src/examples/basic/basic_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file basic_example.h - * @brief Basic example header file for adp1050 project. - * @author Radu Sabau (radu.sabau@analog.com) -******************************************************************************** - * Copyright 2024(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__ */ diff --git a/projects/adp1050/src/examples/examples_src.mk b/projects/adp1050/src/examples/examples_src.mk deleted file mode 100644 index cd3bef49b0a..00000000000 --- a/projects/adp1050/src/examples/examples_src.mk +++ /dev/null @@ -1,28 +0,0 @@ -ifeq (y,$(strip $(IIO_EXAMPLE))) -IIOD=y -CFLAGS += -DIIO_EXAMPLE -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 -SRCS += $(PROJECT)/src/examples/basic/basic_example.c -INCS += $(PROJECT)/src/examples/basic/basic_example.h -endif - -ifeq (y, $(strip $(IIOD))) -LIBRARIES += iio -SRCS += $(NO-OS)/iio/iio_app/iio_app.c \ - $(DRIVERS)/power/adp1050/iio_adp1050.c \ - $(NO-OS)/iio/iio.c \ - $(NO-OS)/iio/iiod.c \ - $(NO-OS)/util/no_os_fifo.c - -INCS += $(NO-OS)/iio/iio_app/iio_app.h \ - $(DRIVERS)/power/adp1050/iio_adp1050.h \ - $(NO-OS)/iio/iio.h \ - $(NO-OS)/iio/iiod.h \ - $(NO-OS)/iio/iio_types.h \ - $(NO-OS)/include/no_os_fifo.h -endif diff --git a/projects/adp1050/src/examples/iio_example/iio_example.c b/projects/adp1050/src/examples/iio_example/iio_example.c index 044ed5a9302..6c5cba3c1a6 100644 --- a/projects/adp1050/src/examples/iio_example/iio_example.c +++ b/projects/adp1050/src/examples/iio_example/iio_example.c @@ -30,13 +30,12 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "iio_example.h" #include "iio_adp1050.h" #include "common_data.h" #include "no_os_print_log.h" #include "iio_app.h" -int iio_example_main() +int example_main() { int ret; diff --git a/projects/adp1050/src/examples/iio_example/iio_example.h b/projects/adp1050/src/examples/iio_example/iio_example.h deleted file mode 100644 index 2a78314f495..00000000000 --- a/projects/adp1050/src/examples/iio_example/iio_example.h +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************//** - * @file iio_example.h - * @brief IIO example header file for adp1050 project. - * @author Radu Sabau (radu.sabau@analog.com) -******************************************************************************** - * Copyright 2024(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 __IIO_EXAMPLE_H__ -#define __IIO_EXAMPLE_H__ - -int iio_example_main(); - -#endif /* __IIO_EXAMPLE_H__ */ diff --git a/projects/adp1050/src/examples/iio_example/iio_example.mk b/projects/adp1050/src/examples/iio_example/iio_example.mk new file mode 100644 index 00000000000..ecc4310a1a8 --- /dev/null +++ b/projects/adp1050/src/examples/iio_example/iio_example.mk @@ -0,0 +1,3 @@ +IIOD = y +SRCS += $(DRIVERS)/power/adp1050/iio_adp1050.c +INCS += $(DRIVERS)/power/adp1050/iio_adp1050.h \ No newline at end of file diff --git a/projects/adp1050/src/platform/maxim/main.c b/projects/adp1050/src/platform/maxim/main.c index 98a193918df..597697cbc60 100644 --- a/projects/adp1050/src/platform/maxim/main.c +++ b/projects/adp1050/src/platform/maxim/main.c @@ -30,43 +30,13 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef BASIC_EXAMPLE -#include "basic_example.h" -#endif - -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif +extern int example_main(); int main() { - int ret = -EINVAL; - -#ifdef BASIC_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adp1050_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = basic_example_main(); -#endif - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - -#if (BASIC_EXAMPLE + IIO_EXAMPLE == 0) -#error At least one example has to be selected using y value in Makefile. -#elif (BASIC_EXAMPLE + IIO_EXAMPLE > 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif - - return ret; + return example_main(); } diff --git a/projects/adp1050/src/platform/maxim/parameters.h b/projects/adp1050/src/platform/maxim/parameters.h index d6c0363ffa7..976f2d18e32 100644 --- a/projects/adp1050/src/platform/maxim/parameters.h +++ b/projects/adp1050/src/platform/maxim/parameters.h @@ -39,9 +39,7 @@ #include "maxim_uart.h" #include "maxim_uart_stdio.h" -#ifdef IIO_SUPPORT #define INTC_DEVICE_ID 0 -#endif #define UART_DEVICE_ID 0 #define UART_BAUDRATE 57600 diff --git a/projects/adp1050/src/platform/platform_includes.h b/projects/adp1050/src/platform/platform_includes.h deleted file mode 100644 index d989f4e7bda..00000000000 --- a/projects/adp1050/src/platform/platform_includes.h +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by adp1050 project. - * @author Radu Sabau (radu.sabau@analog.com) -******************************************************************************** - * Copyright 2024(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -#ifdef MAXIM_PLATFORM -#include "maxim/parameters.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/adt7420-pmdz/Makefile b/projects/adt7420-pmdz/Makefile index f8f60111802..1bbae7e8ab9 100644 --- a/projects/adt7420-pmdz/Makefile +++ b/projects/adt7420-pmdz/Makefile @@ -1,9 +1,9 @@ -# Select the example you want to enable by choosing y for enabling and n for disabling -DUMMY_EXAMPLE = n -IIO_EXAMPLE = y +EXAMPLE ?= dummy include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/adt7420-pmdz/src.mk b/projects/adt7420-pmdz/src.mk index 75a209b1d20..2208756221e 100644 --- a/projects/adt7420-pmdz/src.mk +++ b/projects/adt7420-pmdz/src.mk @@ -1,16 +1,3 @@ -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 \ diff --git a/projects/adt7420-pmdz/src/common/common_data.h b/projects/adt7420-pmdz/src/common/common_data.h index c4c6484537e..5a94f2c6f84 100644 --- a/projects/adt7420-pmdz/src/common/common_data.h +++ b/projects/adt7420-pmdz/src/common/common_data.h @@ -36,11 +36,8 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "adt7420.h" -#ifdef IIO_SUPPORT -#include "iio_adt7420.h" -#endif /******************************************************************************/ /********************** Macros and Constants Definitions **********************/ diff --git a/projects/adt7420-pmdz/src/examples/dummy/dummy_example.c b/projects/adt7420-pmdz/src/examples/dummy/dummy_example.c index c506b381530..e0f9b5240ce 100644 --- a/projects/adt7420-pmdz/src/examples/dummy/dummy_example.c +++ b/projects/adt7420-pmdz/src/examples/dummy/dummy_example.c @@ -34,7 +34,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "dummy_example.h" #include "common_data.h" #include "adt7420.h" #include "no_os_delay.h" @@ -63,7 +62,7 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously the while(1) loop and will not return. *******************************************************************************/ -int dummy_example_main() +int example_main() { struct adt7420_dev *adt7420; uint16_t temp_max = 0, temp_min = 0; @@ -72,6 +71,14 @@ int dummy_example_main() float temp_now; int ret; + struct no_os_uart_desc *uart; + + ret = no_os_uart_init(&uart, &uip); + if (ret) + goto error; + + no_os_uart_stdio(uart); + ret = adt7420_init(&adt7420, adt7420_user_init); if (ret) goto error; diff --git a/projects/adt7420-pmdz/src/examples/dummy/dummy_example.h b/projects/adt7420-pmdz/src/examples/dummy/dummy_example.h deleted file mode 100644 index 32e607e33e1..00000000000 --- a/projects/adt7420-pmdz/src/examples/dummy/dummy_example.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************//** - * @file dummy_example.h - * @brief DUMMY example header for adt7420-pmdz project - * @author RNechita (ramona.nechita@analog.com) -******************************************************************************** - * Copyright 2022(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 __DUMMY_EXAMPLE_H__ -#define __DUMMY_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int dummy_example_main(); - -#endif /* __DUMMY_EXAMPLE_H__ */ diff --git a/projects/adt7420-pmdz/src/examples/examples_src.mk b/projects/adt7420-pmdz/src/examples/examples_src.mk deleted file mode 100644 index b22f8d29f99..00000000000 --- a/projects/adt7420-pmdz/src/examples/examples_src.mk +++ /dev/null @@ -1,22 +0,0 @@ -ifeq (y,$(strip $(IIO_EXAMPLE))) -IIOD=y -CFLAGS += -DIIO_EXAMPLE -SRCS += $(PROJECT)/src/examples/iio_example/iio_example.c -INCS += $(PROJECT)/src/examples/iio_example/iio_example.h -endif - -ifeq (y,$(strip $(DUMMY_EXAMPLE))) -CFLAGS += -DDUMMY_EXAMPLE -SRCS += $(PROJECT)/src/examples/dummy/dummy_example.c -INCS += $(PROJECT)/src/examples/dummy/dummy_example.h -endif - -ifeq (y,$(strip $(IIOD))) -SRC_DIRS += $(NO-OS)/iio/iio_app -INCS += $(DRIVERS)/temperature/adt7420/iio_adt7420.h - -SRCS += $(DRIVERS)/temperature/adt7420/iio_adt7420.c - -INCS += $(INCLUDE)/no_os_list.h \ - $(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h -endif diff --git a/projects/adt7420-pmdz/src/examples/iio_example/iio_example.c b/projects/adt7420-pmdz/src/examples/iio_example/iio_example.c index 47ab678e5c7..047adac3baa 100644 --- a/projects/adt7420-pmdz/src/examples/iio_example/iio_example.c +++ b/projects/adt7420-pmdz/src/examples/iio_example/iio_example.c @@ -34,7 +34,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "iio_example.h" #include "iio_adt7420.h" #include "common_data.h" @@ -57,7 +56,7 @@ uint8_t iio_data_buffer[DATA_BUFFER_SIZE * sizeof(int16_t)]; * @return ret - Result of the example execution. If working correctly, will * execute continuously function iio_app_run and will not return. *******************************************************************************/ -int iio_example_main() +int example_main() { int ret; struct adt7420_iio_dev *adt7420_iio_desc; diff --git a/projects/adt7420-pmdz/src/examples/iio_example/iio_example.h b/projects/adt7420-pmdz/src/examples/iio_example/iio_example.h deleted file mode 100644 index 6f265b591b6..00000000000 --- a/projects/adt7420-pmdz/src/examples/iio_example/iio_example.h +++ /dev/null @@ -1,41 +0,0 @@ -/***************************************************************************//** - * @file iio_example.h - * @brief IIO example header for adt7420-pmdz project - * @author RNechita (ramona.nechita@analog.com) -******************************************************************************** - * Copyright 2022(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 __IIO_EXAMPLE_H__ -#define __IIO_EXAMPLE_H__ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int iio_example_main(); - -#endif /* __IIO_EXAMPLE_H__ */ diff --git a/projects/adt7420-pmdz/src/examples/iio_example/iio_example.mk b/projects/adt7420-pmdz/src/examples/iio_example/iio_example.mk new file mode 100644 index 00000000000..ab06942bdce --- /dev/null +++ b/projects/adt7420-pmdz/src/examples/iio_example/iio_example.mk @@ -0,0 +1,3 @@ +IIOD = y +INCS += $(DRIVERS)/temperature/adt7420/iio_adt7420.h +SRCS += $(DRIVERS)/temperature/adt7420/iio_adt7420.c diff --git a/projects/adt7420-pmdz/src/platform/maxim/main.c b/projects/adt7420-pmdz/src/platform/maxim/main.c index 73fb25955c9..165cf5a48f5 100644 --- a/projects/adt7420-pmdz/src/platform/maxim/main.c +++ b/projects/adt7420-pmdz/src/platform/maxim/main.c @@ -34,16 +34,10 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif - -#ifdef DUMMY_EXAMPLE -#include "dummy_example.h" -#endif +int example_main(); /***************************************************************************//** * @brief Main function execution for MAX32655 platform. @@ -52,35 +46,5 @@ *******************************************************************************/ int main() { - int ret; - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); - if (ret) - goto error; -#endif - -#ifdef DUMMY_EXAMPLE - struct no_os_uart_desc *uart; - - ret = no_os_uart_init(&uart, &uip); - if (ret) - goto error; - - no_os_uart_stdio(uart); - ret = dummy_example_main(); - if (ret) - goto error; -#endif - -#if (IIO_EXAMPLE+DUMMY_EXAMPLE != 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif - -error: -#ifdef DUMMY_EXAMPLE - no_os_uart_remove(uart); -#endif - return 0; + return example_main(); } diff --git a/projects/adt7420-pmdz/src/platform/mbed/main.c b/projects/adt7420-pmdz/src/platform/mbed/main.c index 0c3f5e06631..0a2ee8f8a7c 100644 --- a/projects/adt7420-pmdz/src/platform/mbed/main.c +++ b/projects/adt7420-pmdz/src/platform/mbed/main.c @@ -34,16 +34,10 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif - -#ifdef DUMMY_EXAMPLE -#include "dummy_example.h" -#endif +int example_main(); /***************************************************************************//** * @brief Main function for Mbed platform. @@ -53,31 +47,5 @@ int main() { - int ret; -#ifdef IIO_EXAMPLE - ret = iio_example_main(); - if (ret) - return ret; -#endif - -#ifdef DUMMY_EXAMPLE - struct no_os_uart_desc* uart; - ret = no_os_uart_init(&uart, &uip); - if (ret) { - no_os_uart_remove(uart); - return ret; - } - no_os_uart_stdio(uart); - ret = dummy_example_main(); - if (ret) { - no_os_uart_remove(uart); - return ret; - } -#endif - -#if (IIO_EXAMPLE+DUMMY_EXAMPLE != 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif - return 0; + return example_main(); } diff --git a/projects/adt7420-pmdz/src/platform/platform_includes.h b/projects/adt7420-pmdz/src/platform/platform_includes.h deleted file mode 100644 index 6057b55762e..00000000000 --- a/projects/adt7420-pmdz/src/platform/platform_includes.h +++ /dev/null @@ -1,49 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by adt7420-pmdz project. - * @author RNechita (ramona.nechita@analog.com) -******************************************************************************** - * Copyright 2022(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#ifdef MAXIM_PLATFORM -#include "maxim/parameters.h" -#elif MBED_PLATFORM -#include "mbed/parameters.h" -#endif - -#ifdef IIO_SUPPORT -#include "iio_app.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/eval-adxl355-pmdz/Makefile b/projects/eval-adxl355-pmdz/Makefile index c7a3c6bd42f..bf3a9f416de 100644 --- a/projects/eval-adxl355-pmdz/Makefile +++ b/projects/eval-adxl355-pmdz/Makefile @@ -1,15 +1,22 @@ -# Select the example you want to enable by choosing y for enabling and n for disabling -DUMMY_EXAMPLE = n -IIO_EXAMPLE = n -IIO_TRIGGER_EXAMPLE = y -IIO_LWIP_EXAMPLE = n +EXAMPLE ?= iio_trigger_example # Select the device you want to enable by choosing y for enabling and n for disabling ADXL355 = y ADXL357 = n ADXL359 = n + +ifeq (y,$(strip $(ADXL355))) +CFLAGS += -DADXL355_DEV +else ifeq (y,$(strip $(ADXL357))) +CFLAGS += -DADXL357_DEV +else +CFLAGS += -DADXL359_DEV +endif + include ../../tools/scripts/generic_variables.mk +include ../../tools/scripts/examples.mk + include src.mk include ../../tools/scripts/generic.mk diff --git a/projects/eval-adxl355-pmdz/builds.json b/projects/eval-adxl355-pmdz/builds.json index e058a50f180..448595eb8a2 100644 --- a/projects/eval-adxl355-pmdz/builds.json +++ b/projects/eval-adxl355-pmdz/builds.json @@ -1,100 +1,100 @@ { "stm32": { "dummy_example": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n IIO_LWIP_EXAMPLE=n ADXL355=y HARDWARE=sdp-ck1z.ioc" + "flags" : "EXAMPLE=dummy ADXL355=y HARDWARE=sdp-ck1z.ioc" }, "iio_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n IIO_LWIP_EXAMPLE=n ADXL355=y HARDWARE=sdp-ck1z.ioc" + "flags" : "EXAMPLE=iio_example ADXL355=y HARDWARE=sdp-ck1z.ioc" }, "iio_trigger_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y IIO_LWIP_EXAMPLE=n ADXL355=y HARDWARE=sdp-ck1z.ioc" + "flags" : "EXAMPLE=iio_trigger_example ADXL355=y HARDWARE=sdp-ck1z.ioc" }, "iio_lwip_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n IIO_LWIP_EXAMPLE=y ADXL355=y HARDWARE=adin1110ebz.ioc" + "flags" : "EXAMPLE=iio_lwip_example ADXL355=y HARDWARE=adin1110ebz.ioc" } }, "maxim": { "dummy_example_max32650_adxl355": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max32650 ADXL355=y" + "flags" : "EXAMPLE=dummy TARGET=max32650 ADXL355=y" }, "iio_example_max32650_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max32650 ADXL355=y" + "flags" : "EXAMPLE=iio_example TARGET=max32650 ADXL355=y" }, "dummy_example_max32655_adxl355": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max32655 ADXL355=y" + "flags" : "EXAMPLE=dummy TARGET=max32655 ADXL355=y" }, "iio_example_max32655_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max32655 ADXL355=y" + "flags" : "EXAMPLE=iio_example TARGET=max32655 ADXL355=y" }, "iio_trigger_example_max32655_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y TARGET=max32655 ADXL355=y" + "flags" : "EXAMPLE=iio_trigger_example TARGET=max32655 ADXL355=y" }, "dummy_example_max32660_adxl355": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max32660 ADXL355=y" + "flags" : "EXAMPLE=dummy TARGET=max32660 ADXL355=y" }, "iio_example_max32660_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max32660 ADXL355=y" + "flags" : "EXAMPLE=iio_example TARGET=max32660 ADXL355=y" }, "dummy_example_max32665_adxl355": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max32665 ADXL355=y" + "flags" : "EXAMPLE=dummy TARGET=max32665 ADXL355=y" }, "iio_example_max32665_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max32665 ADXL355=y" + "flags" : "EXAMPLE=iio_example TARGET=max32665 ADXL355=y" }, "dummy_example_max78000_adxl355": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max78000 ADXL355=y" + "flags" : "EXAMPLE=dummy TARGET=max78000 ADXL355=y" }, "iio_example_max78000_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max78000 ADXL355=y" + "flags" : "EXAMPLE=iio_example TARGET=max78000 ADXL355=y" }, "dummy_example_max78000_adxl359": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max78000 ADXL359=y" + "flags" : "EXAMPLE=dummy TARGET=max78000 ADXL359=y" }, "iio_example_max78000_adxl359": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max78000 ADXL359=y" + "flags" : "EXAMPLE=iio_example TARGET=max78000 ADXL359=y" }, "iio_trigger_example_max78000_adxl359": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y TARGET=max32655 ADXL359=y" + "flags" : "EXAMPLE=iio_trigger_example TARGET=max32655 ADXL359=y" }, "dummy_example_max32655_adxl357": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max32655 ADXL357=y" + "flags" : "EXAMPLE=dummy TARGET=max32655 ADXL357=y" }, "iio_example_max32655_adxl357": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max32655 ADXL357=y" + "flags" : "EXAMPLE=iio_example TARGET=max32655 ADXL357=y" }, "iio_trigger_example_max32655_adxl357": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y TARGET=max32655 ADXL357=y" + "flags" : "EXAMPLE=iio_trigger_example TARGET=max32655 ADXL357=y" }, "dummy_example_max32690_adxl355": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n TARGET=max32690 ADXL355=y" + "flags" : "EXAMPLE=dummy TARGET=max32690 ADXL355=y" }, "iio_example_max32690_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n TARGET=max32690 ADXL355=y" + "flags" : "EXAMPLE=iio_example TARGET=max32690 ADXL355=y" }, "iio_trigger_example_max32690_adxl355": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y TARGET=max32690 ADXL355=y" + "flags" : "EXAMPLE=iio_trigger_example TARGET=max32690 ADXL355=y" } }, "pico": { "iio_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n ADXL355=y" + "flags" : "EXAMPLE=iio_example ADXL355=y" }, "iio_trigger_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y ADXL355=y" + "flags" : "EXAMPLE=iio_trigger_example ADXL355=y" }, "dummy_example": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n ADXL355=y" + "flags" : "EXAMPLE=dummy ADXL355=y" } }, "aducm3029": { "dummy_example": { - "flags" : "DUMMY_EXAMPLE=y IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=n ADXL355=y" + "flags" : "EXAMPLE=dummy ADXL355=y" }, "iio_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=y IIO_TRIGGER_EXAMPLE=n ADXL355=y" + "flags" : "EXAMPLE=iio_example ADXL355=y" }, "iio_trigger_example": { - "flags" : "DUMMY_EXAMPLE=n IIO_EXAMPLE=n IIO_TRIGGER_EXAMPLE=y ADXL355=y" + "flags" : "EXAMPLE=iio_trigger_example ADXL355=y" } } } diff --git a/projects/eval-adxl355-pmdz/src.mk b/projects/eval-adxl355-pmdz/src.mk index f9959fbf0a2..b46a200760a 100644 --- a/projects/eval-adxl355-pmdz/src.mk +++ b/projects/eval-adxl355-pmdz/src.mk @@ -1,16 +1,3 @@ -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 \ @@ -44,12 +31,3 @@ SRCS += $(DRIVERS)/api/no_os_gpio.c \ INCS += $(DRIVERS)/accel/adxl355/adxl355.h SRCS += $(DRIVERS)/accel/adxl355/adxl355.c - -ifdef IIO_LWIP_EXAMPLE -INCS += $(INCLUDE)/no_os_crc8.h -INCS += $(DRIVERS)/net/adin1110/adin1110.h -INCS += $(NO-OS)/network/lwip_raw_socket/netdevs/adin1110/lwip_adin1110.h -SRCS += $(NO-OS)/network/lwip_raw_socket/netdevs/adin1110/lwip_adin1110.c -SRCS += $(DRIVERS)/net/adin1110/adin1110.c -SRCS += $(NO-OS)/util/no_os_crc8.c -endif diff --git a/projects/eval-adxl355-pmdz/src/common/common_data.c b/projects/eval-adxl355-pmdz/src/common/common_data.c index 91e8a28278d..200deb3b138 100644 --- a/projects/eval-adxl355-pmdz/src/common/common_data.c +++ b/projects/eval-adxl355-pmdz/src/common/common_data.c @@ -51,26 +51,6 @@ struct no_os_uart_init_param adxl355_uart_ip = { .platform_ops = UART_OPS, }; -#ifdef IIO_TRIGGER_EXAMPLE -/* GPIO trigger */ -struct no_os_irq_init_param adxl355_gpio_irq_ip = { - .irq_ctrl_id = GPIO_IRQ_ID, - .platform_ops = GPIO_IRQ_OPS, - .extra = GPIO_IRQ_EXTRA, -}; - -struct iio_hw_trig_init_param adxl355_gpio_trig_ip = { - .irq_id = ADXL355_GPIO_TRIG_IRQ_ID, - .irq_trig_lvl = NO_OS_IRQ_EDGE_RISING, - .cb_info = { - .event = NO_OS_EVT_GPIO, - .peripheral = NO_OS_GPIO_IRQ, - .handle = ADXL355_GPIO_CB_HANDLE, - }, - .name = ADXL355_GPIO_TRIG_NAME, -}; -#endif - struct no_os_spi_init_param adxl355_spi_ip = { .device_id = SPI_DEVICE_ID, .max_speed_hz = SPI_BAUDRATE, @@ -91,32 +71,3 @@ struct adxl355_init_param adxl355_ip = { .dev_type = ID_ADXL355, #endif }; - -#ifdef IIO_LWIP_EXAMPLE -uint8_t adin1110_mac_address[6] = {0x00, 0x18, 0x80, 0x03, 0x25, 0x80}; - -const struct no_os_gpio_init_param adin1110_reset_ip = { - .port = ADIN1110_GPIO_RESET_PORT, - .number = ADIN1110_GPIO_RESET_PIN, - .pull = NO_OS_PULL_NONE, - .platform_ops = GPIO_OPS, - .extra = &adin1110_reset_gpio_extra_ip, -}; - -const struct no_os_spi_init_param adin1110_spi_ip = { - .device_id = ADIN1110_SPI_DEVICE_ID, - .max_speed_hz = ADIN1110_SPI_CLK_RATE, - .bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST, - .mode = NO_OS_SPI_MODE_0, - .platform_ops = SPI_OPS, - .chip_select = ADIN1110_SPI_CS, - .extra = &adin1110_spi_extra_ip, -}; - -struct adin1110_init_param adin1110_ip = { - .chip_type = ADIN1110, - .comm_param = adin1110_spi_ip, - .reset_param = adin1110_reset_ip, - .append_crc = false, -}; -#endif diff --git a/projects/eval-adxl355-pmdz/src/common/common_data.h b/projects/eval-adxl355-pmdz/src/common/common_data.h index e52d76205b0..38959d73111 100644 --- a/projects/eval-adxl355-pmdz/src/common/common_data.h +++ b/projects/eval-adxl355-pmdz/src/common/common_data.h @@ -36,17 +36,8 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "adxl355.h" -#ifdef IIO_SUPPORT -#include "iio_adxl355.h" -#ifdef IIO_TRIGGER_EXAMPLE -#include "iio_trigger.h" -#endif -#ifdef IIO_LWIP_EXAMPLE -#include "adin1110.h" -#endif -#endif /******************************************************************************/ /********************** Macros and Constants Definitions **********************/ @@ -55,16 +46,4 @@ extern struct no_os_uart_init_param adxl355_uart_ip; extern struct no_os_spi_init_param adxl355_spi_ip; extern struct adxl355_init_param adxl355_ip; -#ifdef IIO_TRIGGER_EXAMPLE -#define ADXL355_GPIO_TRIG_NAME "adxl355-dev0" - -extern struct iio_hw_trig_init_param adxl355_gpio_trig_ip; -extern struct no_os_irq_init_param adxl355_gpio_irq_ip; -#endif - -#ifdef IIO_LWIP_EXAMPLE -extern uint8_t adin1110_mac_address[6]; -extern struct adin1110_init_param adin1110_ip; -#endif - #endif /* __COMMON_DATA_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.c b/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.c index 230d1b1e344..d77ff65a76e 100644 --- a/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.c +++ b/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.c @@ -34,7 +34,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "dummy_example.h" #include "common_data.h" #include "adxl355.h" #include "no_os_delay.h" @@ -49,11 +48,18 @@ * @return ret - Result of the example execution. If working correctly, will * execute continuously the while(1) loop and will not return. *******************************************************************************/ -int dummy_example_main() +int example_main() { struct adxl355_dev *adxl355_desc; + struct no_os_uart_desc *uart_desc; int ret; + ret = no_os_uart_init(&uart_desc, &adxl355_uart_ip); + if (ret) + goto error; + + no_os_uart_stdio(uart_desc); + ret = adxl355_init(&adxl355_desc, adxl355_ip); if (ret) goto error; diff --git a/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.h b/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.h deleted file mode 100644 index a9e77781cae..00000000000 --- a/projects/eval-adxl355-pmdz/src/examples/dummy/dummy_example.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************//** - * @file dummy_example.h - * @brief DUMMY example header for eval-adxl355-pmdz project - * @author RBolboac (ramona.bolboaca@analog.com) -******************************************************************************** - * Copyright 2022(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 __DUMMY_EXAMPLE_H__ -#define __DUMMY_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int dummy_example_main(); - -#endif /* __DUMMY_EXAMPLE_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/examples/examples_src.mk b/projects/eval-adxl355-pmdz/src/examples/examples_src.mk deleted file mode 100644 index a60f0a0adc9..00000000000 --- a/projects/eval-adxl355-pmdz/src/examples/examples_src.mk +++ /dev/null @@ -1,52 +0,0 @@ -ifeq (y,$(strip $(ADXL355))) -CFLAGS += -DADXL355_DEV -else ifeq (y,$(strip $(ADXL357))) -CFLAGS += -DADXL357_DEV -else -CFLAGS += -DADXL359_DEV -endif - -ifeq (y,$(strip $(IIO_EXAMPLE))) -IIOD=y -CFLAGS += -DIIO_EXAMPLE -SRCS += $(PROJECT)/src/examples/iio_example/iio_example.c -INCS += $(PROJECT)/src/examples/iio_example/iio_example.h -endif - -ifeq (y,$(strip $(IIO_TRIGGER_EXAMPLE))) -IIOD=y -CFLAGS += -DIIO_TRIGGER_EXAMPLE -SRCS += $(PROJECT)/src/examples/iio_trigger_example/iio_trigger_example.c -INCS += $(PROJECT)/src/examples/iio_trigger_example/iio_trigger_example.h -endif - -ifeq (y,$(strip $(DUMMY_EXAMPLE))) -CFLAGS += -DDUMMY_EXAMPLE -SRCS += $(PROJECT)/src/examples/dummy/dummy_example.c -INCS += $(PROJECT)/src/examples/dummy/dummy_example.h -endif - -ifeq (y,$(strip $(IIO_LWIP_EXAMPLE))) -IIOD = y -CFLAGS += -DIIO_LWIP_EXAMPLE -CFLAGS += -DNO_OS_LWIP_NETWORKING -LIBRARIES += lwip -SRCS += $(PROJECT)/src/examples/iio_lwip_example/iio_lwip_example.c -INCS += $(PROJECT)/src/examples/iio_lwip_example/iio_lwip_example.h -endif - -ifeq (y,$(strip $(IIOD))) -SRC_DIRS += $(NO-OS)/iio/iio_app - -INCS += $(DRIVERS)/accel/adxl355/iio_adxl355.h -SRCS += $(DRIVERS)/accel/adxl355/iio_adxl355.c - -ifeq (y,$(strip $(IIO_TRIGGER_EXAMPLE))) -SRCS += $(NO-OS)/iio/iio_trigger.c -INCS += $(NO-OS)/iio/iio_trigger.h -SRCS += $(DRIVERS)/accel/adxl355/iio_adxl355_trig.c -endif - -INCS += $(INCLUDE)/no_os_list.h \ - $(PLATFORM_DRIVERS)/$(PLATFORM)_uart.h -endif diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.c b/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.c index 74cbdf9a262..dd186d50f13 100644 --- a/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.c +++ b/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.c @@ -34,7 +34,6 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "iio_example.h" #include "iio_adxl355.h" #include "common_data.h" #include "iio_app.h" @@ -61,7 +60,7 @@ uint8_t iio_data_buffer[DATA_BUFFER_SIZE * 3 * sizeof(int)]; * execute continuously function iio_app_run and will not return. *******************************************************************************/ -int iio_example_main() +int example_main() { int ret; struct adxl355_iio_dev *adxl355_iio_desc; diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.h b/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.h deleted file mode 100644 index c0f1b96f057..00000000000 --- a/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************//** - * @file iio_example.h - * @brief IIO example header for eval-adxl355-pmdz project - * @author RBolboac (ramona.bolboaca@analog.com) -******************************************************************************** - * Copyright 2022(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 __IIO_EXAMPLE_H__ -#define __IIO_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int iio_example_main(); - -#endif /* __IIO_EXAMPLE_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.mk b/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.mk new file mode 100644 index 00000000000..f33249f646d --- /dev/null +++ b/projects/eval-adxl355-pmdz/src/examples/iio_example/iio_example.mk @@ -0,0 +1,3 @@ +IIOD = y +INCS += $(DRIVERS)/accel/adxl355/iio_adxl355.h +SRCS += $(DRIVERS)/accel/adxl355/iio_adxl355.c \ No newline at end of file diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.c b/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.c index 47f48668b5e..97159e2c56f 100644 --- a/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.c +++ b/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.c @@ -34,12 +34,12 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "iio_lwip_example.h" #include "iio_adxl355.h" #include "common_data.h" #include "iio_app.h" #include "lwip_socket.h" #include "lwip_adin1110.h" +#include "adin1110.h" /******************************************************************************/ /********************** Macros and Constants Definitions **********************/ @@ -53,6 +53,33 @@ /******************************************************************************/ uint8_t iio_data_buffer[DATA_BUFFER_SIZE * 3 * sizeof(int)]; +uint8_t adin1110_mac_address[6] = {0x00, 0x18, 0x80, 0x03, 0x25, 0x80}; + +const struct no_os_gpio_init_param adin1110_reset_ip = { + .port = ADIN1110_GPIO_RESET_PORT, + .number = ADIN1110_GPIO_RESET_PIN, + .pull = NO_OS_PULL_NONE, + .platform_ops = GPIO_OPS, + .extra = &adin1110_reset_gpio_extra_ip, +}; + +const struct no_os_spi_init_param adin1110_spi_ip = { + .device_id = ADIN1110_SPI_DEVICE_ID, + .max_speed_hz = ADIN1110_SPI_CLK_RATE, + .bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST, + .mode = NO_OS_SPI_MODE_0, + .platform_ops = SPI_OPS, + .chip_select = ADIN1110_SPI_CS, + .extra = &adin1110_spi_extra_ip, +}; + +struct adin1110_init_param adin1110_ip = { + .chip_type = ADIN1110, + .comm_param = adin1110_spi_ip, + .reset_param = adin1110_reset_ip, + .append_crc = false, +}; + /******************************************************************************/ /************************ Functions Definitions *******************************/ /******************************************************************************/ @@ -63,7 +90,7 @@ uint8_t iio_data_buffer[DATA_BUFFER_SIZE * 3 * sizeof(int)]; * execute continuously function iio_app_run and will not return. *******************************************************************************/ -int iio_lwip_example_main() +int example_main() { int ret; struct adxl355_iio_dev *adxl355_iio_desc; diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.h b/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.h deleted file mode 100644 index 58fd7deb9c8..00000000000 --- a/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************//** - * @file iio_lwip_example.h - * @brief IIO LWIP example header for eval-adxl355-pmdz project - * @author Ciprian Regus (ciprian.regus@analog.com) -******************************************************************************** - * Copyright 2023(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 __IIO_LWIP_EXAMPLE_H__ -#define __IIO_LWIP_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int iio_lwip_example_main(); - -#endif /* __IIO_LWIP_EXAMPLE_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.mk b/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.mk new file mode 100644 index 00000000000..1b483f4493c --- /dev/null +++ b/projects/eval-adxl355-pmdz/src/examples/iio_lwip_example/iio_lwip_example.mk @@ -0,0 +1,14 @@ +IIOD = y +CFLAGS += -DNO_OS_LWIP_NETWORKING +LIBRARIES += lwip + +INCS += $(DRIVERS)/accel/adxl355/iio_adxl355.h +SRCS += $(DRIVERS)/accel/adxl355/iio_adxl355.c +INCS += $(INCLUDE)/no_os_crc8.h +INCS += $(DRIVERS)/net/adin1110/adin1110.h +INCS += $(NO-OS)/network/lwip_raw_socket/netdevs/adin1110/lwip_adin1110.h +SRCS += $(NO-OS)/network/lwip_raw_socket/netdevs/adin1110/lwip_adin1110.c +SRCS += $(DRIVERS)/net/adin1110/adin1110.c +SRCS += $(NO-OS)/util/no_os_crc8.c +SRCS += $(PROJECT)/src/examples/iio_lwip_example/iio_lwip_example.c +INCS += $(PROJECT)/src/examples/iio_lwip_example/iio_lwip_example.h \ No newline at end of file diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.c b/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.c index d088ec31bb2..3617d492241 100644 --- a/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.c +++ b/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.c @@ -34,8 +34,11 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "iio_trigger_example.h" #include "common_data.h" +#include "iio_app.h" +#include "parameters.h" +#include "iio_trigger.h" +#include "iio_adxl355.h" /******************************************************************************/ /********************** Macros and Constants Definitions **********************/ @@ -44,11 +47,32 @@ #define DATA_BUFFER_SIZE 400 #endif + +#define ADXL355_GPIO_TRIG_NAME "adxl355-dev0" + /******************************************************************************/ /************************ Variable Declarations ******************************/ /******************************************************************************/ uint8_t iio_data_buffer[DATA_BUFFER_SIZE * 3 * sizeof(int)]; +/* GPIO trigger */ +struct no_os_irq_init_param adxl355_gpio_irq_ip = { + .irq_ctrl_id = GPIO_IRQ_ID, + .platform_ops = GPIO_IRQ_OPS, + .extra = GPIO_IRQ_EXTRA, +}; + +struct iio_hw_trig_init_param adxl355_gpio_trig_ip = { + .irq_id = ADXL355_GPIO_TRIG_IRQ_ID, + .irq_trig_lvl = NO_OS_IRQ_EDGE_RISING, + .cb_info = { + .event = NO_OS_EVT_GPIO, + .peripheral = NO_OS_GPIO_IRQ, + .handle = ADXL355_GPIO_CB_HANDLE, + }, + .name = ADXL355_GPIO_TRIG_NAME, +}; + /******************************************************************************/ /************************ Functions Definitions *******************************/ /******************************************************************************/ @@ -59,7 +83,7 @@ uint8_t iio_data_buffer[DATA_BUFFER_SIZE * 3 * sizeof(int)]; * execute continuously function iio_app_run_with_trigs and will * not return. *******************************************************************************/ -int iio_trigger_example_main() +int example_main() { int ret; struct adxl355_iio_dev *adxl355_iio_desc; diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.h b/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.h deleted file mode 100644 index 82ee5ee57f2..00000000000 --- a/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.h +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************//** - * @file iio_trigger_example.h - * @brief IIO trigger example header for eval-adxl355-pmdz project - * @author RBolboac (ramona.bolboaca@analog.com) -******************************************************************************** - * Copyright 2022(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 __IIO_TRIGGER_EXAMPLE_H__ -#define __IIO_TRIGGER_EXAMPLE_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ - -/******************************************************************************/ -/************************ Functions Declarations ******************************/ -/******************************************************************************/ -int iio_trigger_example_main(); - -#endif /* __IIO_EXAMPLE_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.mk b/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.mk new file mode 100644 index 00000000000..ca8f11b1c69 --- /dev/null +++ b/projects/eval-adxl355-pmdz/src/examples/iio_trigger_example/iio_trigger_example.mk @@ -0,0 +1,8 @@ +IIOD = y +INCS += $(DRIVERS)/accel/adxl355/iio_adxl355.h +SRCS += $(DRIVERS)/accel/adxl355/iio_adxl355.c +SRCS += $(PROJECT)/src/examples/iio_trigger_example/iio_trigger_example.c +INCS += $(PROJECT)/src/examples/iio_trigger_example/iio_trigger_example.h +SRCS += $(NO-OS)/iio/iio_trigger.c +INCS += $(NO-OS)/iio/iio_trigger.h +SRCS += $(DRIVERS)/accel/adxl355/iio_adxl355_trig.c \ No newline at end of file diff --git a/projects/eval-adxl355-pmdz/src/platform/aducm3029/main.c b/projects/eval-adxl355-pmdz/src/platform/aducm3029/main.c index ff2b56b5238..5612347761e 100644 --- a/projects/eval-adxl355-pmdz/src/platform/aducm3029/main.c +++ b/projects/eval-adxl355-pmdz/src/platform/aducm3029/main.c @@ -34,20 +34,10 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" -#ifdef DUMMY_EXAMPLE -#include "dummy_example.h" -#endif - -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif - -#ifdef IIO_TRIGGER_EXAMPLE -#include "iio_trigger_example.h" -#endif +extern int example_main(); /***************************************************************************//** * @brief Main function execution for ADUCM3029 platform. @@ -57,62 +47,19 @@ int main() { int ret; - adxl355_ip.comm_init.spi_init = adxl355_spi_ip; - - ret = platform_init(); - if (ret) - goto error; - -#ifdef DUMMY_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adxl355_uart_ip); - if (ret) - goto error; - - no_os_uart_stdio(uart_desc); - - ret = dummy_example_main(); - if (ret) - goto error_uart; -error_uart: - return no_os_uart_remove(uart_desc); -#endif - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); - if (ret) - goto error; -#endif + struct no_os_gpio_desc *adxl355_gpio_desc; -#ifdef IIO_TRIGGER_EXAMPLE + adxl355_ip.comm_init.spi_init = adxl355_spi_ip; - struct no_os_gpio_desc *adxl355_gpio_desc; + platform_init(); - /* Initialize DATA READY pin */ ret = no_os_gpio_get_optional(&adxl355_gpio_desc, &adxl355_gpio_drdy_ip); if (ret) - goto error; + return ret; ret = no_os_gpio_direction_input(adxl355_gpio_desc); if (ret) - goto error_gpio; - - ret = iio_trigger_example_main(); - if (ret) - goto error_gpio; - -error_gpio: - return no_os_gpio_remove(adxl355_gpio_desc); -#endif - -#if (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE == 0) -#error At least one example has to be selected using y value in Makefile. -#elif (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE > 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif + return ret; -error: - return ret; + return example_main(); } diff --git a/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.c b/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.c index 1af6211b55d..b4f5f5d3ed1 100644 --- a/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.c +++ b/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.c @@ -46,11 +46,9 @@ struct aducm_spi_init_param adxl355_spi_extra_ip = { .master_mode = MASTER }; -#ifdef IIO_TRIGGER_EXAMPLE struct no_os_gpio_init_param adxl355_gpio_drdy_ip = { .port = GPIO_DRDY_PORT_NUM, .number = GPIO_DRDY_PIN_NUM, .pull = NO_OS_PULL_NONE, .platform_ops = GPIO_OPS, }; -#endif diff --git a/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.h b/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.h index 4cded6dd98d..ed1770dea44 100644 --- a/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.h +++ b/projects/eval-adxl355-pmdz/src/platform/aducm3029/parameters.h @@ -68,7 +68,6 @@ #define SPI_OPS &aducm_spi_ops #define SPI_EXTRA &adxl355_spi_extra_ip -#ifdef IIO_TRIGGER_EXAMPLE #define GPIO_DRDY_PIN_NUM 12 #define GPIO_DRDY_PORT_NUM 0 #define GPIO_OPS &aducm_gpio_ops @@ -82,7 +81,6 @@ #define ADXL355_GPIO_CB_HANDLE NULL /* Not used for aducm3029 platform */ extern struct no_os_gpio_init_param adxl355_gpio_drdy_ip; -#endif extern struct aducm_spi_init_param adxl355_spi_extra_ip; #endif /* __PARAMETERS_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/platform/maxim/main.c b/projects/eval-adxl355-pmdz/src/platform/maxim/main.c index 178ded9f9b6..aa600a23fa5 100644 --- a/projects/eval-adxl355-pmdz/src/platform/maxim/main.c +++ b/projects/eval-adxl355-pmdz/src/platform/maxim/main.c @@ -34,21 +34,11 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif - -#ifdef IIO_TRIGGER_EXAMPLE -#include "iio_trigger_example.h" -#endif - -#ifdef DUMMY_EXAMPLE -#include "dummy_example.h" -#endif +extern int example_main(); /***************************************************************************//** * @brief Main function execution for Maxim platform. @@ -61,16 +51,8 @@ int main() adxl355_ip.comm_init.spi_init = adxl355_spi_ip; -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - -#ifdef IIO_TRIGGER_EXAMPLE +#ifdef GPIO_DRDY_PORT_NUM struct no_os_gpio_desc *adxl355_gpio_desc; - struct no_os_irq_ctrl_desc *nvic_desc; - struct no_os_irq_init_param nvic_ip = { - .platform_ops = &max_irq_ops, - }; /* Initialize DATA READY pin */ ret = no_os_gpio_get_optional(&adxl355_gpio_desc, &adxl355_gpio_drdy_ip); @@ -80,7 +62,12 @@ int main() ret = no_os_gpio_direction_input(adxl355_gpio_desc); if (ret) return ret; - +#endif +#ifdef NVIC_GPIO_IRQ + struct no_os_irq_ctrl_desc *nvic_desc; + struct no_os_irq_init_param nvic_ip = { + .platform_ops = &max_irq_ops, + }; /* Initialize GPIO IRQ controller */ ret = no_os_irq_ctrl_init(&nvic_desc, &nvic_ip); if (ret) @@ -89,28 +76,8 @@ int main() ret = no_os_irq_enable(nvic_desc, NVIC_GPIO_IRQ); if (ret) return ret; - - ret = iio_trigger_example_main(); -#endif - -#ifdef DUMMY_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adxl355_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = dummy_example_main(); -#endif - -#if (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE == 0) -#error At least one example has to be selected using y value in Makefile. -#elif (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE > 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. #endif - return ret; + return example_main(); } diff --git a/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.c b/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.c index 89631806203..109aa70d26d 100644 --- a/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.c +++ b/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.c @@ -43,7 +43,7 @@ struct max_uart_init_param adxl355_uart_extra_ip = { .flow = UART_FLOW_DIS }; -#ifdef IIO_TRIGGER_EXAMPLE +#ifdef GPIO_DRDY_PORT_NUM /* Initialization for Sync pin GPIO. */ struct no_os_gpio_init_param adxl355_gpio_drdy_ip = { .port = GPIO_DRDY_PORT_NUM, @@ -52,11 +52,11 @@ struct no_os_gpio_init_param adxl355_gpio_drdy_ip = { .platform_ops = GPIO_OPS, .extra = GPIO_EXTRA }; +#endif struct max_gpio_init_param adxl355_gpio_extra_ip = { .vssel = MXC_GPIO_VSSEL_VDDIOH, }; -#endif struct max_spi_init_param adxl355_spi_extra_ip = { .num_slaves = 1, diff --git a/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.h b/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.h index 2f3014114ad..7f5df11f1a2 100644 --- a/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.h +++ b/projects/eval-adxl355-pmdz/src/platform/maxim/parameters.h @@ -84,7 +84,6 @@ extern struct max_uart_init_param adxl355_uart_extra_ip; extern struct max_spi_init_param adxl355_spi_extra_ip; -#ifdef IIO_TRIGGER_EXAMPLE #define GPIO_OPS &max_gpio_ops #if (TARGET_NUM == 78000) @@ -108,8 +107,6 @@ Has to be adapted accordingly if another pin is used. #define GPIO_DRDY_PORT_NUM 0 #define NVIC_GPIO_IRQ GPIO0_IRQn #define GPIO_IRQ_ID 0 -#else -#error IIO_TRIGGER_EXAMPLE is currently supported only on max32655 and max 78000 targets. #endif #define GPIO_EXTRA &adxl355_gpio_extra_ip @@ -123,6 +120,5 @@ extern struct no_os_gpio_init_param adxl355_gpio_drdy_ip; #define GPIO_IRQ_EXTRA &adxl355_gpio_extra_ip extern struct max_gpio_init_param adxl355_gpio_extra_ip; -#endif #endif /* __PARAMETERS_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/platform/pico/main.c b/projects/eval-adxl355-pmdz/src/platform/pico/main.c index 8a5ceb33bec..83b00cfb7d8 100644 --- a/projects/eval-adxl355-pmdz/src/platform/pico/main.c +++ b/projects/eval-adxl355-pmdz/src/platform/pico/main.c @@ -34,21 +34,11 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif - -#ifdef IIO_TRIGGER_EXAMPLE -#include "iio_trigger_example.h" -#endif - -#ifdef DUMMY_EXAMPLE -#include "dummy_example.h" -#endif +extern int example_main(); /***************************************************************************//** * @brief Main function execution for pico platform. @@ -57,33 +47,7 @@ *******************************************************************************/ int main() { - int ret = -EINVAL; adxl355_ip.comm_init.spi_init = adxl355_spi_ip; -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - -#ifdef IIO_TRIGGER_EXAMPLE - ret = iio_trigger_example_main(); -#endif - -#ifdef DUMMY_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adxl355_uart_ip); - if (ret) - return ret; - - ret = dummy_example_main(); -#endif - -#if (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE == 0) -#error At least one example has to be selected using y value in Makefile. -#elif (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE > 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif - - return ret; + return example_main(); } diff --git a/projects/eval-adxl355-pmdz/src/platform/pico/parameters.h b/projects/eval-adxl355-pmdz/src/platform/pico/parameters.h index c27cda3d8db..afe307bbada 100644 --- a/projects/eval-adxl355-pmdz/src/platform/pico/parameters.h +++ b/projects/eval-adxl355-pmdz/src/platform/pico/parameters.h @@ -73,13 +73,11 @@ extern struct pico_uart_init_param adxl355_uart_extra_ip; #define GPIO_OPS &pico_gpio_ops #define GPIO_EXTRA NULL /* Not used for pico platform */ -#ifdef IIO_TRIGGER_EXAMPLE #define ADXL355_GPIO_TRIG_IRQ_ID GPIO_DRDY_PIN_NUM #define ADXL355_GPIO_CB_HANDLE NULL /* Not used in pico platform */ #define GPIO_IRQ_ID GPIO_DRDY_PIN_NUM #define GPIO_IRQ_OPS &pico_gpio_irq_ops #define GPIO_IRQ_EXTRA NULL /* Not used for pico platform */ -#endif #endif /* __PARAMETERS_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/platform/platform_includes.h b/projects/eval-adxl355-pmdz/src/platform/platform_includes.h deleted file mode 100644 index 105ebd3381d..00000000000 --- a/projects/eval-adxl355-pmdz/src/platform/platform_includes.h +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************//** - * @file platform_includes.h - * @brief Includes for used platforms used by eval-adxl355-pmdz project. - * @author RBolboac (ramona.bolboaca@analog.com) -******************************************************************************** - * Copyright 2022(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 __PLATFORM_INCLUDES_H__ -#define __PLATFORM_INCLUDES_H__ - -/******************************************************************************/ -/***************************** Include Files **********************************/ -/******************************************************************************/ -#ifdef STM32_PLATFORM -#include "stm32/parameters.h" -#endif - -#ifdef MAXIM_PLATFORM -#include "maxim/parameters.h" -#endif - -#ifdef PICO_PLATFORM -#include "pico/parameters.h" -#endif - -#ifdef ADUCM_PLATFORM -#include "aducm3029/parameters.h" -#endif - -#ifdef IIO_SUPPORT -#include "iio_app.h" -#endif - -#endif /* __PLATFORM_INCLUDES_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/platform/stm32/main.c b/projects/eval-adxl355-pmdz/src/platform/stm32/main.c index 4b8b6613a01..72cc1a6b135 100644 --- a/projects/eval-adxl355-pmdz/src/platform/stm32/main.c +++ b/projects/eval-adxl355-pmdz/src/platform/stm32/main.c @@ -34,25 +34,11 @@ /******************************************************************************/ /***************************** Include Files **********************************/ /******************************************************************************/ -#include "platform_includes.h" +#include "parameters.h" #include "common_data.h" #include "no_os_error.h" -#ifdef IIO_EXAMPLE -#include "iio_example.h" -#endif - -#ifdef IIO_TRIGGER_EXAMPLE -#include "iio_trigger_example.h" -#endif - -#ifdef DUMMY_EXAMPLE -#include "dummy_example.h" -#endif - -#ifdef IIO_LWIP_EXAMPLE -#include "iio_lwip_example.h" -#endif +extern int example_main(); /***************************************************************************//** * @brief Main function execution for STM32 platform. @@ -61,41 +47,10 @@ *******************************************************************************/ int main() { - int ret = -EINVAL; adxl355_spi_extra_ip.get_input_clock = HAL_RCC_GetPCLK1Freq; adxl355_ip.comm_init.spi_init = adxl355_spi_ip; stm32_init(); -#ifdef IIO_LWIP_EXAMPLE - ret = iio_lwip_example_main(); -#endif - -#ifdef IIO_EXAMPLE - ret = iio_example_main(); -#endif - -#ifdef IIO_TRIGGER_EXAMPLE - ret = iio_trigger_example_main(); -#endif - -#ifdef DUMMY_EXAMPLE - struct no_os_uart_desc *uart_desc; - - ret = no_os_uart_init(&uart_desc, &adxl355_uart_ip); - if (ret) - return ret; - - no_os_uart_stdio(uart_desc); - ret = dummy_example_main(); -#endif - -#if (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE + IIO_LWIP_EXAMPLE == 0) -#error At least one example has to be selected using y value in Makefile. -#elif (DUMMY_EXAMPLE + IIO_EXAMPLE + IIO_TRIGGER_EXAMPLE + IIO_LWIP_EXAMPLE > 1) -#error Selected example projects cannot be enabled at the same time. \ -Please enable only one example and rebuild the project. -#endif - - return ret; + return example_main(); } diff --git a/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.c b/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.c index 3ea72759024..86be5415a17 100644 --- a/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.c +++ b/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.c @@ -47,13 +47,10 @@ struct stm32_spi_init_param adxl355_spi_extra_ip = { .chip_select_port = SPI_CS_PORT, }; -#ifdef IIO_TRIGGER_EXAMPLE struct stm32_gpio_irq_init_param adxl355_gpio_irq_extra_ip = { .port_nb = 0, /* Port A */ }; -#endif -#ifdef IIO_LWIP_EXAMPLE struct stm32_gpio_init_param adin1110_reset_gpio_extra_ip = { .mode = GPIO_MODE_OUTPUT_OD, .speed = GPIO_SPEED_FREQ_VERY_HIGH, @@ -62,4 +59,3 @@ struct stm32_gpio_init_param adin1110_reset_gpio_extra_ip = { struct stm32_spi_init_param adin1110_spi_extra_ip = { .chip_select_port = ADIN1110_SPI_CS_PORT, }; -#endif diff --git a/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.h b/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.h index 02901bbec1d..9b6b98273a3 100644 --- a/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.h +++ b/projects/eval-adxl355-pmdz/src/platform/stm32/parameters.h @@ -49,7 +49,7 @@ /********************** Macros and Constants Definitions **********************/ /******************************************************************************/ -#ifdef IIO_LWIP_EXAMPLE +#ifdef NO_OS_LWIP_NETWORKING extern UART_HandleTypeDef huart1; #define UART_INSTANCE (&huart1) #define SPI_DEVICE_ID 3 @@ -81,7 +81,6 @@ extern UART_HandleTypeDef huart5; extern struct stm32_uart_init_param adxl355_uart_extra_ip; extern struct stm32_spi_init_param adxl355_spi_extra_ip; -#ifdef IIO_TRIGGER_EXAMPLE extern struct stm32_gpio_irq_init_param adxl355_gpio_irq_extra_ip; /* Setting for PortA Pin2 used for DATA_READY. Has to be adapted accordingly if another pin is used. @@ -92,9 +91,7 @@ extern struct stm32_gpio_irq_init_param adxl355_gpio_irq_extra_ip; #define GPIO_IRQ_ID 2 /* Pin 2 */ #define GPIO_IRQ_OPS &stm32_gpio_irq_ops #define GPIO_IRQ_EXTRA &adxl355_gpio_irq_extra_ip -#endif -#ifdef IIO_LWIP_EXAMPLE #define ADIN1110_GPIO_RESET_PORT 2 #define ADIN1110_GPIO_RESET_PIN 7 #define ADIN1110_SPI_DEVICE_ID 2 @@ -105,6 +102,5 @@ extern struct stm32_gpio_irq_init_param adxl355_gpio_irq_extra_ip; extern struct stm32_gpio_init_param adin1110_reset_gpio_extra_ip; extern struct stm32_spi_init_param adin1110_spi_extra_ip; -#endif #endif /* __PARAMETERS_H__ */ diff --git a/projects/eval-adxl355-pmdz/src/platform/stm32/platform_src.mk b/projects/eval-adxl355-pmdz/src/platform/stm32/platform_src.mk index ae711e77a48..c30a63d4ec0 100644 --- a/projects/eval-adxl355-pmdz/src/platform/stm32/platform_src.mk +++ b/projects/eval-adxl355-pmdz/src/platform/stm32/platform_src.mk @@ -1,3 +1,5 @@ +HARDWARE = sdp-ck1z.ioc + INCS += $(PLATFORM_DRIVERS)/stm32_delay.h \ $(PLATFORM_DRIVERS)/stm32_gpio.h \ $(PLATFORM_DRIVERS)/stm32_hal.h \ @@ -16,7 +18,3 @@ SRCS += $(PLATFORM_DRIVERS)/stm32_delay.c \ $(PLATFORM_DRIVERS)/stm32_gpio_irq.c \ $(PLATFORM_DRIVERS)/stm32_uart.c \ $(PLATFORM_DRIVERS)/stm32_uart_stdio.c - -ifdef IIO_LWIP_EXAMPLE -HARDWARE := adin1110ebz.ioc -endif