From 5d35a59eb1090023e122ed2cbb42506993b73c8e Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Mon, 26 Sep 2016 18:10:35 +0200 Subject: [PATCH] Re-organise code --- include/drivers/gpio.h | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/include/drivers/gpio.h b/include/drivers/gpio.h index 143607c..c1d4f49 100644 --- a/include/drivers/gpio.h +++ b/include/drivers/gpio.h @@ -69,11 +69,13 @@ struct lpc_gpio #define LPC_GPIO_REGS(x) ((struct lpc_gpio *) (LPC_GPIO_BASE)) - /***************************************************************************** */ /* Public access to GPIO setup */ +#define GPIO_DIR_IN 0 +#define GPIO_DIR_OUT 1 + enum gpio_interrupt_senses { EDGES_BOTH = 0, EDGE_FALLING, @@ -82,24 +84,11 @@ enum gpio_interrupt_senses { LEVEL_LOW, }; -#define GPIO_DIR_IN 0 -#define GPIO_DIR_OUT 1 - -/* GPIO Interrupts */ -/* Add a callback on a GPIO interrupt. - * This call will configure the GPIO (call to config_pio()), set it as input and - * activate the interrupt on the given 'sense' event. use the gpio_interrupt_senses - * enum for 'sense' values. - * The callback will receive the irq number as argument. - * Returns the interrupt number if OK, or a negative value in case of error. - */ -int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense); -void remove_gpio_callback(unsigned int irq); - /* GPIO Activation */ void gpio_on(void); + void gpio_off(void); #define gpio_dir_in(gpio) \ @@ -150,6 +139,21 @@ void config_gpio(const struct pio* gpio, uint32_t mode, uint8_t dir, uint8_t ini +/* GPIO Interrupts */ +/* Add a callback on a GPIO interrupt. + * This call will configure the GPIO (call to config_pio()), set it as input and + * activate the interrupt on the given 'sense' event. use the gpio_interrupt_senses + * enum for 'sense' values. + * The callback will receive the irq number as argument. + * Returns the interrupt number if OK, or a negative value in case of error. + */ +int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense); + +void remove_gpio_callback(unsigned int irq); + + + + /***************************************************************************** */ /* Pin interrupts and patern interrupts */ /***************************************************************************** */ -- 2.43.0