altos: Allow ports to use type other than 'void *' for gpio block
authorKeith Packard <keithp@keithp.com>
Tue, 28 Mar 2023 04:25:43 +0000 (21:25 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 28 Mar 2023 04:25:43 +0000 (21:25 -0700)
LPC uses integers while everyone else has a struct for each gpio block.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_led.c
src/kernel/ao.h
src/lpc/ao_arch.h

index 009e9bc23e434cd8496cd5177eb62257c299c805..683d4aff7ea894ccb0ad1589f3df24332aa8a2c3 100644 (file)
@@ -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
index d714cecbd15e508c3705c0e6751ecae5db2bb475..b3f780f5c7609797c15c895e90b0fa965dcf1a44 100644 (file)
@@ -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
index eedac777a46fae6a010a09ba04aaba6098c5b231..59f3a7eee4983a94fee99c4bf19d716725010811 100644 (file)
@@ -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