Use the same LED for run/idle. Reserve spare LED for UART.

Enable AFIO to fix EXTI for USB VBUS detect.
This commit is contained in:
Gareth McMullin 2012-06-10 14:53:31 +12:00
parent c35d0b29b3
commit eabd4654f9
2 changed files with 6 additions and 7 deletions

View File

@ -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_IOPAEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN); 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_IOPDEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
/* Setup GPIO ports */ /* Setup GPIO ports */
gpio_clear(USB_PU_PORT, USB_PU_PIN); 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_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, 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 /* FIXME: This pin in intended to be input, but the TXS0108 fails
* to release the device from reset if this floats. */ * to release the device from reset if this floats. */
@ -122,9 +123,7 @@ int platform_init(void)
void sys_tick_handler(void) void sys_tick_handler(void)
{ {
if(running_status) if(running_status)
gpio_toggle(LED_PORT, LED_RUN); gpio_toggle(LED_PORT, LED_IDLE_RUN);
else
gpio_clear(LED_PORT, LED_RUN);
if(timeout_counter) if(timeout_counter)
timeout_counter--; timeout_counter--;

View File

@ -75,8 +75,8 @@
#define USB_VBUS_IRQ NVIC_EXTI15_10_IRQ #define USB_VBUS_IRQ NVIC_EXTI15_10_IRQ
#define LED_PORT GPIOB #define LED_PORT GPIOB
#define LED_RUN GPIO2 #define LED_UART GPIO2
#define LED_IDLE GPIO10 #define LED_IDLE_RUN GPIO10
#define LED_ERROR GPIO11 #define LED_ERROR GPIO11
/* Interrupt priorities. Low numbers are high priority. /* Interrupt priorities. Low numbers are high priority.
@ -105,7 +105,7 @@ extern const char *morse_msg;
} while(0) } while(0)
#define SET_RUN_STATE(state) {running_status = (state);} #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 SET_ERROR_STATE(state) {gpio_set_val(LED_PORT, LED_ERROR, state);}
#define PLATFORM_SET_FATAL_ERROR_RECOVERY() {setjmp(fatal_error_jmpbuf);} #define PLATFORM_SET_FATAL_ERROR_RECOVERY() {setjmp(fatal_error_jmpbuf);}