#include "usart2.h"
#include "config.h"
Functions | |
void | USART0_init (uint16_t baudval) |
Initialise USART0 and set baud rate. | |
void | USART1_init (uint16_t baudval) |
Initialise USART1 and set baud rate. | |
void | USART0_transmit (uint8_t data) |
void | USART1_transmit (uint8_t data) |
void | USART0_transmit_string (const unsigned char *data) |
Transmit a string via USART0 at currently set baud rate. | |
void | USART1_transmit_string (const unsigned char *data) |
Transmit a string via USART1 at currently set baud rate. | |
void | USART0_transmit_uint8 (uint8_t val) |
Transmit an 8 bit unsigned integer via USART0 at currently set baud rate. | |
void | USART0_transmit_int8 (int8_t val) |
Transmit an 8 bit signed integer via USART0 at currently set baud rate. | |
void | USART0_transmit_uint16 (uint16_t val) |
Transmit a 16 bit unsigned integer via USART0 at currently set baud rate. | |
void | USART0_transmit_int16 (int16_t val) |
Transmit a 16 bit signed integer via USART0 at currently set baud rate. | |
void | USART1_transmit_uint8 (uint8_t val) |
Transmit an 8 bit unsigned integer via USART1 at currently set baud rate. | |
void | USART1_transmit_int8 (int8_t val) |
Transmit an 8 bit signed integer via USART1 at currently set baud rate. | |
void | USART1_transmit_uint16 (uint16_t val) |
Transmit a 16 bit unsigned integer via USART1 at currently set baud rate. | |
void | USART1_transmit_int16 (int16_t val) |
Transmit a 16 bit signed integer via USART1 at currently set baud rate. | |
void | USART0_transmit_bin (uint8_t val) |
Transmit an 8 bit unsigned integer as eight ASCII characters 0 or 1 via USART0. | |
void | USART1_transmit_bin (uint8_t val) |
Transmit an 8 bit unsigned integer as eight ASCII characters 0 or 1 via USART1. | |
void | USART0_transmit_nibble (uint8_t nibble) |
Transmit the lowest 4 bits of an 8 bit unsigned integer as a single ASCII character 0-9 or A-F on USART0. | |
void | USART1_transmit_nibble (uint8_t nibble) |
Transmit the lowest 4 bits of an 8 bit unsigned integer as a single ASCII character 0-9 or A-F on USART1. | |
void | USART0_transmit_hex (uint8_t val) |
void | USART1_transmit_hex (uint8_t val) |
uint8_t | USART0_receive (void) |
Receive an 8 bit value from USART0 by polling. | |
uint8_t | USART1_receive (void) |
Receive an 8 bit value from USART1 by polling. | |
void | USART0_flush (void) |
Repeatedly receive and discard values received by the USART0 until the input buffer empties. | |
void | USART1_flush (void) |
Repeatedly receive and discard values received by the USART1 until the input buffer empties. | |
void | usart0_out_iso_time (uint8_t *time_store) |
Output a time value in ISO format to USART0, from data stored in memory. | |
void | usart1_out_iso_time (uint8_t *time_store) |
Output a time value in ISO format to USART1, from data stored in memory. |
void USART0_flush | ( | void | ) |
Repeatedly receive and discard values received by the USART0 until the input buffer empties.
Uses polling.
Note that in the event of continuous input, this function may never complete.
void USART0_init | ( | uint16_t | baudval | ) | [inline] |
Initialise USART0 and set baud rate.
baudval | Value to put in UBRR0 to selectbaud rate. |
The baudval parameter will depend on the CPU clock frequency see the tables in the microcontroller documentation for suitable values
Clears any existing transmissions, turns off double speed, enables transmitter and receiver.
Note that this initialisation DOESN'T enable the interrupts Rx complete and Tx Complete
void usart0_out_iso_time | ( | uint8_t * | time_store | ) |
Output a time value in ISO format to USART0, from data stored in memory.
time_store | Pointer to 7 BCD values representing in order seconds,minutes,hours,day,month,day of week(ignored),year. |
15:23:00 on 3rd April 2010 would be "2010-04-03 15:23:00"
Uses polling. Calls USART_transmit and USART_transmit_hex
uint8_t USART0_receive | ( | void | ) |
Receive an 8 bit value from USART0 by polling.
void USART0_transmit | ( | uint8_t | data | ) |
void USART0_transmit_bin | ( | uint8_t | val | ) |
Transmit an 8 bit unsigned integer as eight ASCII characters 0 or 1 via USART0.
val | Value to transmit. |
Doesn't interrupt any existing transmit already in progress.
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART0_transmit_hex | ( | uint8_t | val | ) |
void USART0_transmit_int16 | ( | int16_t | val | ) |
Transmit a 16 bit signed integer via USART0 at currently set baud rate.
val | value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART0_transmit_int8 | ( | int8_t | val | ) |
Transmit an 8 bit signed integer via USART0 at currently set baud rate.
val | Value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART0_transmit_nibble | ( | uint8_t | nibble | ) |
Transmit the lowest 4 bits of an 8 bit unsigned integer as a single ASCII character 0-9 or A-F on USART0.
nibble | Value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART0_transmit_string | ( | const unsigned char * | data | ) |
Transmit a string via USART0 at currently set baud rate.
data | Pointer to start of string. |
void USART0_transmit_uint16 | ( | uint16_t | val | ) |
Transmit a 16 bit unsigned integer via USART0 at currently set baud rate.
val | Value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART0_transmit_uint8 | ( | uint8_t | val | ) |
Transmit an 8 bit unsigned integer via USART0 at currently set baud rate.
val | Character to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART1_flush | ( | void | ) |
Repeatedly receive and discard values received by the USART1 until the input buffer empties.
Uses polling.
Note that in the event of continuous input, this function may never complete.
void USART1_init | ( | uint16_t | baudval | ) | [inline] |
Initialise USART1 and set baud rate.
baudval | Value to put in UBRR1 to selectbaud rate. |
The baudval parameter will depend on the CPU clock frequency see the tables in the microcontroller documentation for suitable values
Clears any existing transmissions, turns off double speed, enables transmitter and receiver.
Note that this initialisation DOESN'T enable the interrupts Rx complete and Tx Complete
void usart1_out_iso_time | ( | uint8_t * | time_store | ) |
Output a time value in ISO format to USART1, from data stored in memory.
time_store | Pointer to 7 BCD values representing in order seconds,minutes,hours,day,month,day of week(ignored),year. |
15:23:00 on 3rd April 2010 would be "2010-04-03 15:23:00"
Uses polling. Calls USART_transmit and USART_transmit_hex
uint8_t USART1_receive | ( | void | ) |
Receive an 8 bit value from USART1 by polling.
void USART1_transmit | ( | uint8_t | data | ) |
void USART1_transmit_bin | ( | uint8_t | val | ) |
Transmit an 8 bit unsigned integer as eight ASCII characters 0 or 1 via USART1.
val | Value to transmit. |
Doesn't interrupt any existing transmit already in progress.
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART1_transmit_hex | ( | uint8_t | val | ) |
void USART1_transmit_int16 | ( | int16_t | val | ) |
Transmit a 16 bit signed integer via USART1 at currently set baud rate.
val | value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART1_transmit_int8 | ( | int8_t | val | ) |
Transmit an 8 bit signed integer via USART1 at currently set baud rate.
val | Value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART1_transmit_nibble | ( | uint8_t | nibble | ) |
Transmit the lowest 4 bits of an 8 bit unsigned integer as a single ASCII character 0-9 or A-F on USART1.
nibble | Value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART1_transmit_string | ( | const unsigned char * | data | ) |
Transmit a string via USART1 at currently set baud rate.
data | Pointer to start of string. |
Uses polling, so waits for transmit buffer to be empty
void USART1_transmit_uint16 | ( | uint16_t | val | ) |
Transmit a 16 bit unsigned integer via USART1 at currently set baud rate.
val | Value to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters
void USART1_transmit_uint8 | ( | uint8_t | val | ) |
Transmit an 8 bit unsigned integer via USART1 at currently set baud rate.
val | Character to transmit. |
Uses polling, so waits for transmit buffer to be empty before appending new characters