diff options
| author | William D. Jones <[email protected]> | 2019-01-10 10:14:01 -0500 |
|---|---|---|
| committer | William D. Jones <[email protected]> | 2019-01-10 10:24:45 -0500 |
| commit | 75fda7d638f306ffc758aaaa1c56590ade6465f7 (patch) | |
| tree | 20f373be27381011b4356f79e040731083d8863f /hw | |
| parent | b367baeaf1d64930654f136a2409f1322fc73ab2 (diff) | |
cdc_msc_hid: Ensure example compiles again- add missing prototypes,
fix incorrect prototypes, clean up.
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c b/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c index 248d90d82..8c47e2a3c 100644 --- a/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c +++ b/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c @@ -47,17 +47,6 @@ //--------------------------------------------------------------------+ #define LED_STATE_ON 1 -static void board_led_init(uint32_t led_id) { - uint8_t port_index = led_id / 16; - uint8_t pin_index = led_id % 16; - - RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN << port_index; - - GPIO_TypeDef * gpio = ((GPIO_TypeDef *) (GPIOA_BASE + (GPIOB_BASE - GPIOA_BASE) * port_index)); - - gpio->MODER = 0x01 << (pin_index * 2); -} - void board_init(void) { @@ -68,7 +57,8 @@ void board_init(void) #endif // Init the LED on PD14 - board_led_init(BOARD_LED0); + RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; + GPIOD->MODER = GPIO_MODER_MODE14_0; // USB Clock init @@ -78,17 +68,13 @@ void board_init(void) -void board_led_control(uint32_t led_id, bool state) +void board_led_control(bool state) { - uint8_t port_index = led_id / 16; - uint8_t pin_index = led_id % 16; - - GPIO_TypeDef * gpio = ((GPIO_TypeDef *) (GPIOA_BASE + (GPIOB_BASE - GPIOA_BASE) * port_index)); - uint32_t value = 1 << pin_index; if (!state) { - value <<= 16; + GPIOD->BSRR = GPIO_BSRR_BR14; + } else { + GPIOD->BSRR = GPIO_BSRR_BS14; } - gpio->BSRR = value; } |
