diff options
author | Perry Hung <iperry@gmail.com> | 2011-03-21 02:32:39 -0400 |
---|---|---|
committer | Perry Hung <iperry@gmail.com> | 2011-03-21 02:32:39 -0400 |
commit | 1591fc9e3f851327c16bbcb88e6abee1706f9cfc (patch) | |
tree | 7b29a49be01d13772a2975cacf2a2699bc307cad | |
parent | ef0936df9b58a0589e68a460a7c963d05f9a1759 (diff) | |
download | librambutan-1591fc9e3f851327c16bbcb88e6abee1706f9cfc.tar.gz librambutan-1591fc9e3f851327c16bbcb88e6abee1706f9cfc.zip |
modify gpio interface to expose gpio dev structs
-rw-r--r-- | libmaple/gpio.c | 37 | ||||
-rw-r--r-- | libmaple/gpio.h | 28 |
2 files changed, 29 insertions, 36 deletions
diff --git a/libmaple/gpio.c b/libmaple/gpio.c index b08be12..18b856b 100644 --- a/libmaple/gpio.c +++ b/libmaple/gpio.c @@ -33,55 +33,48 @@ * GPIO devices */ -static gpio_dev gpioa = { +gpio_dev gpioa = { .regs = GPIOA_BASE, .clk_id = RCC_GPIOA }; -/** GPIO port A device. */ -gpio_dev *GPIOA = &gpioa; +gpio_dev* const GPIOA = &gpioa; -static gpio_dev gpiob = { +gpio_dev gpiob = { .regs = GPIOB_BASE, .clk_id = RCC_GPIOB }; -/** GPIO port B device. */ -gpio_dev *GPIOB = &gpiob; +gpio_dev* const GPIOB = &gpiob; -static gpio_dev gpioc = { +gpio_dev gpioc = { .regs = GPIOC_BASE, .clk_id = RCC_GPIOC }; -/** GPIO port C device. */ -gpio_dev *GPIOC = &gpioc; +gpio_dev* const GPIOC = &gpioc; -static gpio_dev gpiod = { +gpio_dev gpiod = { .regs = GPIOD_BASE, .clk_id = RCC_GPIOD }; -/** GPIO port D device. */ -gpio_dev *GPIOD = &gpiod; +gpio_dev* const GPIOD = &gpiod; -#ifdef STM32_HIGH_ -static gpio_dev gpioe = { +#ifdef STM32_HIGH_DENSITY +gpio_dev gpioe = { .regs = GPIOE_BASE, .clk_id = RCC_GPIOE }; -/** GPIO port E device. */ -gpio_dev *GPIOE = &gpioe; +gpio_dev* const GPIOE = &gpioe; -static gpio_dev gpiof = { +gpio_dev gpiof = { .regs = GPIOF_BASE, .clk_id = RCC_GPIOF }; -/** GPIO port F device. */ -gpio_dev *GPIOF = &gpiof; +gpio_dev* const GPIOF = &gpiof; -static gpio_dev gpiog = { +gpio_dev gpiog = { .regs = GPIOG_BASE, .clk_id = RCC_GPIOG }; -/** GPIO port G device. */ -gpio_dev *GPIOG = &gpiog; +gpio_dev* const GPIOG = &gpiog; #endif /* diff --git a/libmaple/gpio.h b/libmaple/gpio.h index 48dbc00..a8a4985 100644 --- a/libmaple/gpio.h +++ b/libmaple/gpio.h @@ -62,21 +62,21 @@ typedef struct gpio_dev { rcc_clk_id clk_id; ///< RCC clock information } gpio_dev; -/** GPIO port A device */ -extern gpio_dev *GPIOA; -/** GPIO port B device */ -extern gpio_dev *GPIOB; -/** GPIO port C device */ -extern gpio_dev *GPIOC; -/** GPIO port D device */ -extern gpio_dev *GPIOD; +extern gpio_dev gpioa; +extern gpio_dev* const GPIOA; +extern gpio_dev gpiob; +extern gpio_dev* const GPIOB; +extern gpio_dev gpioc; +extern gpio_dev* const GPIOC; +extern gpio_dev gpiod; +extern gpio_dev* const GPIOD; #ifdef STM32_HIGH_DENSITY -/** GPIO port E device */ -extern gpio_dev *GPIOE; -/** GPIO port F device */ -extern gpio_dev *GPIOF; -/** GPIO port G device */ -extern gpio_dev *GPIOG; +extern gpio_dev gpioe; +extern gpio_dev* const GPIOE; +extern gpio_dev gpiof; +extern gpio_dev* const GPIOF; +extern gpio_dev gpiog; +extern gpio_dev* const GPIOG; #endif /** GPIO port A register map base pointer */ |