From 4d9874c473887a4f43ba14ac855a2db00a740d2d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 27 Mar 2023 21:25:43 -0700 Subject: [PATCH] altos: Allow ports to use type other than 'void *' for gpio block LPC uses integers while everyone else has a struct for each gpio block. Signed-off-by: Keith Packard --- src/drivers/ao_led.c | 2 +- src/kernel/ao.h | 5 +++++ src/lpc/ao_arch.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/drivers/ao_led.c b/src/drivers/ao_led.c index 009e9bc2..683d4aff 100644 --- a/src/drivers/ao_led.c +++ b/src/drivers/ao_led.c @@ -19,7 +19,7 @@ #include "ao.h" static const struct { - void *port; + ao_gpio_t port; uint8_t pin; } ao_leds[] = { #ifdef LED_0_PORT diff --git a/src/kernel/ao.h b/src/kernel/ao.h index d714cecb..b3f780f5 100644 --- a/src/kernel/ao.h +++ b/src/kernel/ao.h @@ -40,6 +40,11 @@ extern char ao_getchar(void); #define HAS_TASK 1 #endif +#ifndef AO_GPIO_TYPE +#define AO_GPIO_TYPE void * +#endif + +typedef AO_GPIO_TYPE ao_gpio_t; typedef AO_PORT_TYPE ao_port_t; #ifndef AO_TICK_TYPE diff --git a/src/lpc/ao_arch.h b/src/lpc/ao_arch.h index eedac777..59f3a7ee 100644 --- a/src/lpc/ao_arch.h +++ b/src/lpc/ao_arch.h @@ -29,6 +29,7 @@ #define AO_STACK_SIZE 512 #endif +#define AO_GPIO_TYPE uint8_t #define AO_PORT_TYPE uint32_t #define AO_LED_TYPE AO_PORT_TYPE -- 2.30.2