summaryrefslogtreecommitdiff
path: root/src/arch/msp430fr5969lp/driver/stdout.cc
blob: 321785bd4ca7bf09f4e486a490e620d26fd45afb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;