diff options
author | bnewbold <bnewbold@robocracy.org> | 2010-09-01 00:02:36 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2010-09-01 00:02:36 -0400 |
commit | d6a32991684b7bfd8b91e3358dee4ca3fc887021 (patch) | |
tree | 535ebe6501bda800363c5f4debccf532d289bc1e /libmaple/util.c | |
parent | 9c9d6c153154981fdedbe3f9ed4a1fb61e2b7776 (diff) | |
parent | 0ccec95446d4c7f3ea47a46d267c791fb22bb8d4 (diff) | |
download | librambutan-d6a32991684b7bfd8b91e3358dee4ca3fc887021.tar.gz librambutan-d6a32991684b7bfd8b91e3358dee4ca3fc887021.zip |
Various fixes, working with Maple
Diffstat (limited to 'libmaple/util.c')
-rw-r--r-- | libmaple/util.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/libmaple/util.c b/libmaple/util.c index 36173ee..a747948 100644 --- a/libmaple/util.c +++ b/libmaple/util.c @@ -36,13 +36,6 @@ #include "adc.h" #include "timers.h" -#define ERROR_LED_PORT GPIOA_BASE -#define ERROR_LED_PIN 5 -#define ERROR_USART_NUM 2 -#define ERROR_USART_BAUD 9600 -#define ERROR_TX_PIN 2 -#define ERROR_TX_PORT GPIOA_BASE - /* Error assert + fade */ void _fail(const char* file, int line, const char* exp) { int32 slope = 1; @@ -51,7 +44,7 @@ void _fail(const char* file, int line, const char* exp) { uint32 i = 0; /* Turn off interrupts */ - nvic_disable_interrupts(); + nvic_irq_disable_all(); /* Turn off timers */ timer_disable_all(); @@ -60,9 +53,7 @@ void _fail(const char* file, int line, const char* exp) { adc_disable(); /* Turn off all usarts */ - usart_disable(1); - usart_disable(2); - usart_disable(3); + usart_disable_all(); /* Initialize the error usart */ gpio_set_mode(ERROR_TX_PORT, ERROR_TX_PIN, GPIO_MODE_AF_OUTPUT_PP); @@ -76,13 +67,14 @@ void _fail(const char* file, int line, const char* exp) { usart_putstr(ERROR_USART_NUM, ": "); usart_putudec(ERROR_USART_NUM, line); usart_putc(ERROR_USART_NUM, '\n'); - + usart_putc(ERROR_USART_NUM, '\r'); + /* Turn on the error LED */ gpio_set_mode(ERROR_LED_PORT, ERROR_LED_PIN, GPIO_MODE_OUTPUT_PP); /* Turn the USB interrupt back on so the bootloader keeps on functioning */ - nvic_enable_interrupt(NVIC_INT_USBHP); - nvic_enable_interrupt(NVIC_INT_USBLP); + nvic_irq_enable(NVIC_INT_USBHP); + nvic_irq_enable(NVIC_INT_USBLP); /* Error fade */ while (1) { |