summaryrefslogtreecommitdiff
path: root/src/arch/msp430fr5969lp/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/msp430fr5969lp/driver')
-rw-r--r--src/arch/msp430fr5969lp/driver/stdout.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/arch/msp430fr5969lp/driver/stdout.cc b/src/arch/msp430fr5969lp/driver/stdout.cc
new file mode 100644
index 0000000..321785b
--- /dev/null
+++ b/src/arch/msp430fr5969lp/driver/stdout.cc
@@ -0,0 +1,33 @@
+#include "driver/stdout.h"
+#include <msp430.h>
+
+void StandardOutput::setup()
+{
+ UCA0CTLW0 |= UCSWRST;
+ UCA0CTLW0 = UCSWRST | UCSSEL__SMCLK;
+ UCA0MCTLW = UCOS16 | (10<<5) | 0xF700;
+ UCA0BR0 = 8;
+
+ UCA0IRCTL = 0;
+ UCA0ABCTL = 0;
+
+ P2SEL0 &= ~(BIT0 | BIT1);
+ P2SEL1 |= BIT0 | BIT1;
+ P2DIR |= BIT0;
+
+ UCA0CTLW0 &= ~UCSWRST;
+
+ //UCA0IE |= UCRXIE;
+}
+
+void StandardOutput::put(char c)
+{
+ while (!(UCA0IFG & UCTXIFG));
+ UCA0TXBUF = c;
+
+ if (c == '\n') {
+ put('\r');
+ }
+}
+
+StandardOutput kout;