Skip to content

Commit

Permalink
projects/adp1050: use the new example infrastructure
Browse files Browse the repository at this point in the history
Make the necessary changes to use the new example infrastructure.

Signed-off-by: Darius Berghe <[email protected]>
  • Loading branch information
buha committed Jan 23, 2025
1 parent 49a6149 commit 7fd64a7
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 204 deletions.
6 changes: 3 additions & 3 deletions projects/adp1050/Makefile
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions projects/adp1050/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------------
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions projects/adp1050/builds.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
13 changes: 0 additions & 13 deletions projects/adp1050/src.mk
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
11 changes: 9 additions & 2 deletions projects/adp1050/src/examples/basic/basic_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
* 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"
#include "no_os_util.h"
#include "no_os_pwm.h"
#include "adp1050.h"

int basic_example_main()
int example_main()
{
int ret;

Expand All @@ -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;
Expand Down
38 changes: 0 additions & 38 deletions projects/adp1050/src/examples/basic/basic_example.h

This file was deleted.

28 changes: 0 additions & 28 deletions projects/adp1050/src/examples/examples_src.mk

This file was deleted.

3 changes: 1 addition & 2 deletions projects/adp1050/src/examples/iio_example/iio_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
38 changes: 0 additions & 38 deletions projects/adp1050/src/examples/iio_example/iio_example.h

This file was deleted.

3 changes: 3 additions & 0 deletions projects/adp1050/src/examples/iio_example/iio_example.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IIOD = y
SRCS += $(DRIVERS)/power/adp1050/iio_adp1050.c
INCS += $(DRIVERS)/power/adp1050/iio_adp1050.h
34 changes: 2 additions & 32 deletions projects/adp1050/src/platform/maxim/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,9 @@
#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();
}
2 changes: 0 additions & 2 deletions projects/adp1050/src/platform/maxim/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 0 additions & 40 deletions projects/adp1050/src/platform/platform_includes.h

This file was deleted.

0 comments on commit 7fd64a7

Please sign in to comment.