diff options
Diffstat (limited to 'main.c')
-rwxr-xr-x | main.c | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -25,6 +25,8 @@ #include <io430.h> #include <intrinsics.h> +#include <stdio.h> + #include "def.h" #include "hardware.h" @@ -90,12 +92,35 @@ static void SerialInit(void) // Configure port for UART access // Pin 25 as UCA0TXD // Pin 26 as UCA0RXD - P3SEL |= 0x60; + P3SEL |= 0x30; UCA0CTL1_bit.UCSWRST = 0; } +static void ll_putchar(unsigned char c) +{ + while (!IFG2_bit.UCA0TXIFG); + UCA0TXBUF = c; +} + + +size_t __write(int handle, const unsigned char * buffer, size_t size) +{ + size_t nChars = 0; + + if (buffer == 0) + return 0; + + for (; size != 0; --size) { + ll_putchar(*buffer++); + ++nChars; + } + + return nChars; +} + + int main(void) { u16 state, resetState; @@ -106,6 +131,7 @@ int main(void) InitPorts(); GlobalInit(); + SerialInit(); __enable_interrupt(); |