diff --git a/src/stm32/platform.c b/src/stm32/platform.c index 2a66080..4aff924 100644 --- a/src/stm32/platform.c +++ b/src/stm32/platform.c @@ -73,6 +73,7 @@ int platform_init(void) rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPDEN); + rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN); /* Setup GPIO ports */ gpio_clear(USB_PU_PORT, USB_PU_PIN); @@ -85,7 +86,7 @@ int platform_init(void) gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, - LED_RUN | LED_IDLE | LED_ERROR); + LED_UART | LED_IDLE_RUN | LED_ERROR); /* FIXME: This pin in intended to be input, but the TXS0108 fails * to release the device from reset if this floats. */ @@ -122,9 +123,7 @@ int platform_init(void) void sys_tick_handler(void) { if(running_status) - gpio_toggle(LED_PORT, LED_RUN); - else - gpio_clear(LED_PORT, LED_RUN); + gpio_toggle(LED_PORT, LED_IDLE_RUN); if(timeout_counter) timeout_counter--; diff --git a/src/stm32/platform.h b/src/stm32/platform.h index 242ea19..56e0b77 100644 --- a/src/stm32/platform.h +++ b/src/stm32/platform.h @@ -75,8 +75,8 @@ #define USB_VBUS_IRQ NVIC_EXTI15_10_IRQ #define LED_PORT GPIOB -#define LED_RUN GPIO2 -#define LED_IDLE GPIO10 +#define LED_UART GPIO2 +#define LED_IDLE_RUN GPIO10 #define LED_ERROR GPIO11 /* Interrupt priorities. Low numbers are high priority. @@ -105,7 +105,7 @@ extern const char *morse_msg; } while(0) #define SET_RUN_STATE(state) {running_status = (state);} -#define SET_IDLE_STATE(state) {gpio_set_val(LED_PORT, LED_IDLE, state);} +#define SET_IDLE_STATE(state) {gpio_set_val(LED_PORT, LED_IDLE_RUN, state);} #define SET_ERROR_STATE(state) {gpio_set_val(LED_PORT, LED_ERROR, state);} #define PLATFORM_SET_FATAL_ERROR_RECOVERY() {setjmp(fatal_error_jmpbuf);}