MHVLib
20111011
An efficiency oriented runtime library for AVR microcontrollers
|
#include <MHV_HardwareSerial.h>
Public Member Functions | |
MHV_HardwareSerial (MHV_RingBuffer *rxBuffer, MHV_RingBuffer *txBuffer, volatile uint16_t *ubrr, volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *udr, uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t txcie, uint8_t udre, uint8_t u2x, unsigned long baud) | |
void | setSpeed (unsigned long baud) |
void | end () |
void | busyWrite (char c) |
void | busyWrite (const char *buffer) |
void | busyWrite (const char *buffer, uint16_t length) |
void | busyWrite_P (PGM_P buffer) |
void | busyWrite_P (PGM_P buffer, uint16_t length) |
bool | canSendBusy () |
void | rx () |
void | tx () |
void | echo (bool echoOn) |
bool | busy () |
void | debug (const char *file, int line, const char *function, PGM_P format,...) |
Protected Member Functions | |
void | runTxBuffers () |
Definition at line 71 of file MHV_HardwareSerial.h.
MHV_HardwareSerial::MHV_HardwareSerial | ( | MHV_RingBuffer * | rxBuffer, |
MHV_RingBuffer * | txBuffer, | ||
volatile uint16_t * | ubrr, | ||
volatile uint8_t * | ucsra, | ||
volatile uint8_t * | ucsrb, | ||
volatile uint8_t * | udr, | ||
uint8_t | rxen, | ||
uint8_t | txen, | ||
uint8_t | rxcie, | ||
uint8_t | txcie, | ||
uint8_t | udre, | ||
uint8_t | u2x, | ||
unsigned long | baud | ||
) |
Constructor
rxBuffer | the receive buffer |
txBuffer | the transmit buffer |
ubrr | A member of the MHV_USART_* macro |
ucsra | See ubrr |
ucsrb | See ubrr |
udr | See ubrr |
rxen | See ubrr |
txen | See ubrr |
rxcie | See ubrr |
txcie | See ubrr |
udre | See ubrr |
u2x | See ubrr |
baud | the baud rate |
Definition at line 54 of file MHV_HardwareSerial.cpp.
bool MHV_HardwareSerial::busy | ( | void | ) |
Check if the hardware is busy - note that this should not be used to determine if you can actually write - use canSend instead
Definition at line 266 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::busyWrite | ( | char | c | ) |
Write a character
c | the character to write |
Definition at line 173 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::busyWrite | ( | const char * | buffer | ) |
Write a null terminated string to the serial port
buffer | the string to write |
Definition at line 209 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::busyWrite | ( | const char * | buffer, |
uint16_t | length | ||
) |
Write a buffer
buffer | the buffer to write |
length | the length of the buffer |
Definition at line 246 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::busyWrite_P | ( | PGM_P | buffer | ) |
Write a null terminated progmem string
buffer | the string to write |
Definition at line 187 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::busyWrite_P | ( | PGM_P | buffer, |
uint16_t | length | ||
) |
Write a buffer from PROGMEM
buffer | the buffer to write |
length | the length of the buffer |
Definition at line 227 of file MHV_HardwareSerial.cpp.
bool MHV_HardwareSerial::canSendBusy | ( | ) |
Can we send something via busywrite
Definition at line 164 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::debug | ( | const char * | file, |
int | line, | ||
const char * | function, | ||
PGM_P | format, | ||
... | |||
) |
Print a debug message
file | the filename |
line | the line number |
function | the function name |
format | a printf format |
... | the printf parms |
Definition at line 278 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::echo | ( | bool | echoOn | ) |
Enable echoing data received by us back to the sender (useful for terminal interaction
echoOn | true to enable echo |
Definition at line 155 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::end | ( | ) |
Halt the serial port
Definition at line 145 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::runTxBuffers | ( | ) | [protected, virtual] |
Start sending async data
Implements MHV_Device_TX.
Definition at line 106 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::rx | ( | ) |
RX interrupt handler
Definition at line 78 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::setSpeed | ( | unsigned long | baud | ) |
Configure the serial port for a specific baud rate
baud | the baud rate to set |
Definition at line 126 of file MHV_HardwareSerial.cpp.
void MHV_HardwareSerial::tx | ( | ) |
TX interrupt handler
Definition at line 90 of file MHV_HardwareSerial.cpp.