From dcf84169ae75b11c1656d45dbc6c626d93da6a10 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 8 Dec 2017 15:07:52 +0100 Subject: Add output support (broken on esp8266) --- src/arch/msp430fr5969lp/driver/stdout.cc | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/arch/msp430fr5969lp/driver/stdout.cc (limited to 'src/arch/msp430fr5969lp/driver') 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 + +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; -- cgit v1.2.3