diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-12-08 15:07:52 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-12-08 15:07:52 +0100 |
commit | dcf84169ae75b11c1656d45dbc6c626d93da6a10 (patch) | |
tree | d78ad84e6aba1f5f13037e40141013f3a3061d54 /src/arch/msp430fr5969lp | |
parent | 56f2d90751f1c1b2db925da215a14721cf18d483 (diff) |
Add output support (broken on esp8266)
Diffstat (limited to 'src/arch/msp430fr5969lp')
-rw-r--r-- | src/arch/msp430fr5969lp/Makefile.inc | 1 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/driver/stdout.cc | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc index 04069ae..f4b96fe 100644 --- a/src/arch/msp430fr5969lp/Makefile.inc +++ b/src/arch/msp430fr5969lp/Makefile.inc @@ -11,6 +11,7 @@ CXX = /opt/msp430/ti/gcc/bin/msp430-elf-g++ OBJCOPY = /opt/msp430/ti/gcc/bin/msp430-elf-objcopy TARGETS += src/arch/msp430fr5969lp/arch.cc src/arch/msp430fr5969lp/driver/gpio.cc +TARGETS += src/arch/msp430fr5969lp/driver/stdout.cc OBJECTS = ${TARGETS:.cc=.o} 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; |