EV Logger
A MSP430 based datalogger for an electric vehicle
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
UART

Macros

#define SPI_SIMO   BIT1
 
#define SPI_SOMI   BIT2
 
#define SPI_CLK   BIT3
 
#define SD_CS   BIT7
 
#define SPI_SEL   P4SEL
 
#define SPI_DIR   P4DIR
 
#define SPI_OUT   P4OUT
 
#define SPI_REN   P4REN
 
#define SD_CS_SEL   P3SEL
 
#define SD_CS_OUT   P3OUT
 
#define SD_CS_DIR   P3DIR
 
#define UART_BUF_LEN   50
 Length of the temporary buffer we will use for containing strings to be written out over the UART. More...
 

Functions

void uart_init (void)
 Set up the UCSI for UART operation at 9600 baud. More...
 
static void _uart_tx (char *string)
 Takes a char pointer, transmit data over the UART until we find a null character. More...
 
void uart_debug (char *string)
 Send a CRLF terminated string to the debug output (to avoid storing the terminators in RAM all the time). More...
 

Detailed Description

Macro Definition Documentation

#define UART_BUF_LEN   50

Length of the temporary buffer we will use for containing strings to be written out over the UART.

This should be set to at least the maximum length of any string to be transmitted, doing otherwise will cause a buffer overflow and undefined behaviour, even system crashes.

Function Documentation

static void _uart_tx ( char *  string)
static

Takes a char pointer, transmit data over the UART until we find a null character.

Parameters
stringA char pointer to the string to transmit
Todo:
This should time out instead of busy-wait forever.
void uart_debug ( char *  string)

Send a CRLF terminated string to the debug output (to avoid storing the terminators in RAM all the time).

Parameters
stringA char pointer to the string to transmit.
void uart_init ( void  )

Set up the UCSI for UART operation at 9600 baud.

The baud rate generator is currently hard coded for 25MHz SMCLK.

Todo:
Fix this to calculate BRR values from F_CPU.