Make the CC2538 UART driver more configurable
* We can now very easily switch between UART0 and UART1 through a define * We can also configure the UART RX and TX port/pin through defines
This commit is contained in:
parent
1f76b7d0f9
commit
6c6013b898
4 changed files with 91 additions and 37 deletions
|
@ -38,6 +38,7 @@
|
|||
*/
|
||||
#include "contiki.h"
|
||||
#include "reg.h"
|
||||
#include "uart.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -71,12 +72,22 @@ void usb_isr(void);
|
|||
#define usb_isr default_handler
|
||||
#endif
|
||||
|
||||
/* Likewise for the UART ISR */
|
||||
/* Likewise for the UART[01] ISRs */
|
||||
#if UART_CONF_ENABLE
|
||||
void uart_isr(void);
|
||||
|
||||
#if UART_BASE==UART_1_BASE
|
||||
#define uart0_isr default_handler
|
||||
#define uart1_isr uart_isr
|
||||
#else
|
||||
#define uart_isr default_handler
|
||||
#define uart0_isr uart_isr
|
||||
#define uart1_isr default_handler
|
||||
#endif
|
||||
|
||||
#else /* UART_CONF_ENABLE */
|
||||
#define uart0_isr default_handler
|
||||
#define uart1_isr default_handler
|
||||
#endif /* UART_CONF_ENABLE */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Allocate stack space */
|
||||
static unsigned long stack[512];
|
||||
|
@ -123,8 +134,8 @@ void(*const vectors[])(void) =
|
|||
gpio_port_c_isr, /* 18 GPIO Port C */
|
||||
gpio_port_d_isr, /* 19 GPIO Port D */
|
||||
0, /* 20 none */
|
||||
uart_isr, /* 21 UART0 Rx and Tx */
|
||||
default_handler, /* 22 UART1 Rx and Tx */
|
||||
uart0_isr, /* 21 UART0 Rx and Tx */
|
||||
uart1_isr, /* 22 UART1 Rx and Tx */
|
||||
default_handler, /* 23 SSI0 Rx and Tx */
|
||||
default_handler, /* 24 I2C Master and Slave */
|
||||
0, /* 25 Reserved */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue