39 #include "dev/uart0.h"
40 #include "dev/watchdog.h"
41 #include "isr_compat.h"
43 static int (*uart0_input_handler)(
unsigned char c);
45 static volatile uint8_t transmitting;
51 return (UCA0STAT & UCBUSY) | transmitting;
55 uart0_set_input(
int (*input)(
unsigned char c))
57 uart0_input_handler = input;
61 uart0_writeb(
unsigned char c)
65 while((UCA0STAT & UCBUSY));
82 ubr = (MSP430_CPU_SPEED / ubr);
84 UCA0BR1 = (ubr >> 8) & 0xff;
102 ISR(USCI_A0, uart0_rx_interrupt)
106 ENERGEST_ON(ENERGEST_TYPE_IRQ);
108 if(UCA0STAT & UCRXERR) {
112 if(uart0_input_handler !=
NULL) {
113 if(uart0_input_handler(c)) {
119 ENERGEST_OFF(ENERGEST_TYPE_IRQ);
void uart0_init(unsigned long ubr)
Initalize the RS232 port.
#define NULL
The null pointer.
Header file for the energy estimation mechanism
void watchdog_periodic(void)
Writes the WDT clear sequence.