MHVLib  20111011
An efficiency oriented runtime library for AVR microcontrollers
MHV_HardwareSerial Class Reference

#include <MHV_HardwareSerial.h>

Inheritance diagram for MHV_HardwareSerial:
MHV_Device_TX MHV_Device_RX

List of all members.

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 ()

Detailed Description

Definition at line 71 of file MHV_HardwareSerial.h.


Constructor & Destructor Documentation

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

Parameters:
rxBufferthe receive buffer
txBufferthe transmit buffer
ubrrA member of the MHV_USART_* macro
ucsraSee ubrr
ucsrbSee ubrr
udrSee ubrr
rxenSee ubrr
txenSee ubrr
rxcieSee ubrr
txcieSee ubrr
udreSee ubrr
u2xSee ubrr
baudthe baud rate

Definition at line 54 of file MHV_HardwareSerial.cpp.


Member Function Documentation

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

Returns:
true if the hardware is busy

Definition at line 266 of file MHV_HardwareSerial.cpp.

void MHV_HardwareSerial::busyWrite ( char  c)

Write a character

Parameters:
cthe 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

Parameters:
bufferthe 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

Parameters:
bufferthe buffer to write
lengththe 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

Parameters:
bufferthe 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

Parameters:
bufferthe buffer to write
lengththe length of the buffer

Definition at line 227 of file MHV_HardwareSerial.cpp.

bool MHV_HardwareSerial::canSendBusy ( )

Can we send something via busywrite

Returns:
true if we can send something

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

Parameters:
filethe filename
linethe line number
functionthe function name
formata 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

Parameters:
echoOntrue 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

Parameters:
baudthe 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.


The documentation for this class was generated from the following files: