summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rwxr-xr-xmain.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/main.c b/main.c
index d964e83..8f1dc5b 100755
--- a/main.c
+++ b/main.c
@@ -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();