From 98c0daabed4b083cbe27f3de557c968393d722bf Mon Sep 17 00:00:00 2001 From: tkl Date: Thu, 18 Aug 2016 21:33:09 +0200 Subject: [PATCH] added new gpio controls to board file --- .../include/stm32f4-discovery.h | 109 +++++++++++++++--- 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/include/stm32f4-discovery.h b/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/include/stm32f4-discovery.h index 62b487a..9860cb4 100755 --- a/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/include/stm32f4-discovery.h +++ b/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/include/stm32f4-discovery.h @@ -26,30 +26,113 @@ #include "stm32f4_gpio.h" #include "driver.h" -#if 0 -// GPIO_D12 -static const GPIO_InitTypeDef port_cfg_d12 = { - .Pin = GPIO_PIN_12, +// GPIO_C0 +static const GPIO_InitTypeDef port_cfg_c0 = { + .Pin = GPIO_PIN_0, .Mode = GPIO_MODE_OUTPUT_PP, .Speed = GPIO_SPEED_FREQ_HIGH, .Pull = GPIO_PULLUP, }; -static const struct stm32f4_gpio stm32_f4_gpio_d12 = { - .port = GPIOD, - .pin = &port_cfg_d12, +static const struct stm32f4_gpio stm32_f4_gpio_c0 = { + .port = GPIOC, + .pin = &port_cfg_c0, }; -static const struct gpio __gpio_d12 = { - (void*)&stm32_f4_gpio_d12, +static const struct gpio __gpio_c0 = { + (void*)&stm32_f4_gpio_c0, &gpio_fp }; -static const struct driver gpio_d12 = { - DRIVER_TYPE_GPIO, - &__gpio_d12, -}; +#ifdef TEST_APP +static const struct driver gpio_c0 = { +#else +const struct driver gpio_c0 = { #endif + DRIVER_TYPE_GPIO, + &__gpio_c0, +}; + +// GPIO_C1 +static const GPIO_InitTypeDef port_cfg_c1 = { + .Pin = GPIO_PIN_1, + .Mode = GPIO_MODE_OUTPUT_PP, + .Speed = GPIO_SPEED_FREQ_HIGH, + .Pull = GPIO_PULLUP, +}; + +static const struct stm32f4_gpio stm32_f4_gpio_c1 = { + .port = GPIOC, + .pin = &port_cfg_c1, +}; + +static const struct gpio __gpio_c1 = { + (void*)&stm32_f4_gpio_c1, + &gpio_fp +}; + +#ifdef TEST_APP +static const struct driver gpio_c1 = { +#else +const struct driver gpio_c1 = { +#endif + DRIVER_TYPE_GPIO, + &__gpio_c0, +}; + +// GPIO_C2 +static const GPIO_InitTypeDef port_cfg_c2 = { + .Pin = GPIO_PIN_2, + .Mode = GPIO_MODE_OUTPUT_PP, + .Speed = GPIO_SPEED_FREQ_HIGH, + .Pull = GPIO_PULLUP, +}; + +static const struct stm32f4_gpio stm32_f4_gpio_c2 = { + .port = GPIOC, + .pin = &port_cfg_c0, +}; + +static const struct gpio __gpio_c2 = { + (void*)&stm32_f4_gpio_c2, + &gpio_fp +}; + +#ifdef TEST_APP +static const struct driver gpio_c2 = { +#else +const struct driver gpio_c2 = { +#endif + DRIVER_TYPE_GPIO, + &__gpio_c2, +}; + +// GPIO_C3 +static const GPIO_InitTypeDef port_cfg_c3 = { + .Pin = GPIO_PIN_3, + .Mode = GPIO_MODE_OUTPUT_PP, + .Speed = GPIO_SPEED_FREQ_HIGH, + .Pull = GPIO_PULLUP, +}; + +static const struct stm32f4_gpio stm32_f4_gpio_c3 = { + .port = GPIOC, + .pin = &port_cfg_c3, +}; + +static const struct gpio __gpio_c3 = { + (void*)&stm32_f4_gpio_c3, + &gpio_fp +}; + +#ifdef TEST_APP +static const struct driver gpio_c3 = { +#else +const struct driver gpio_c3 = { +#endif + DRIVER_TYPE_GPIO, + &__gpio_c3, +}; // SYSTEM TICK static const enum stm32_sys_tick_time_base stm23_sys_tick_time_base =