COSA
An Object-Oriented Platform for Arduino Programming
LCD Class Reference

#include <LCD.hh>

Inheritance diagram for LCD:
Inheritance graph
Collaboration diagram for LCD:
Collaboration graph

Classes

class  Device
 
class  IO
 
class  Keypad
 
class  Serial3W
 
class  SPI3W
 

Public Types

enum  Base {
  bcd = 0, bin = 2, oct = 8, dec = 10,
  hex = 16
}
 
enum  Mode { CR_MODE = 0, LF_MODE = 1, CRLF_MODE = 2 }
 
typedef IOStream &(* Manipulator) (IOStream &)
 

Public Member Functions

Devicedevice () const
 
Devicedevice (Device *dev)
 
str_P eol () const
 
void eol (str_P s)
 
str_P EOL () const
 
int8_t width (int8_t value)
 
uint8_t precision (uint8_t value)
 
void print (int value, Base base=dec)
 
void print (long int value, Base base=dec)
 
void print (unsigned int value, Base base=dec)
 
void print (unsigned long int value, Base base=dec)
 
void print (unsigned int value, uint8_t digits, Base base)
 
void print (unsigned long int value, uint8_t digits, Base base)
 
void print (double value, int8_t width, uint8_t prec)
 
void print (uint32_t src, const void *ptr, size_t size, Base base=dec, uint8_t max=16)
 
void print (const void *ptr, size_t size, Base base=dec, uint8_t max=16)
 
void print (void *ptr)
 
void print (const void *ptr)
 
void print (char c)
 
void print (const char *s)
 
void print (str_P s)
 
void print (IOStream::Device *buffer)
 
void println ()
 
void vprintf (str_P format, va_list args)
 
void printf (str_P format,...)
 
void flush ()
 
char * scan (char *s, size_t count)
 
char * readline (char *buf, size_t size, bool echo=true)
 
IOStreamoperator<< (Manipulator func)
 
IOStreamoperator<< (int n)
 
IOStreamoperator<< (long int n)
 
IOStreamoperator<< (double n)
 
IOStreamoperator<< (unsigned int n)
 
IOStreamoperator<< (unsigned long int n)
 
IOStreamoperator<< (void *ptr)
 
IOStreamoperator<< (const void *ptr)
 
IOStreamoperator<< (char c)
 
IOStreamoperator<< (char *s)
 
IOStreamoperator<< (const char *s)
 
IOStreamoperator<< (str_P s)
 
IOStreamoperator<< (IOStream &buffer)
 
IOStreamoperator<< (const iovec_t *vec)
 

Static Public Member Functions

static char * ultoa (unsigned long __val, char *__s, int base)
 
static char * ltoa (long __val, char *__s, int base)
 
static char * utoa (unsigned int __val, char *__s, int base)
 
static char * itoa (int __val, char *__s, int base)
 

Static Public Attributes

static const int EOF = -1
 
static const char CR []
 
static const char LF [] = "\r"
 
static const char CRLF [] = "\r\n"
 

Protected Member Functions

void print_prefix (Base base)
 

Protected Attributes

Devicem_dev
 Delegated device. More...
 
Base m_base
 Base for next output operator. More...
 
int8_t m_width
 Minimum width of output string. More...
 
uint8_t m_prec
 Number of digits after decimal sign. More...
 
str_P m_eols
 End of line string (program memory). More...
 

Static Protected Attributes

static const size_t BUF_MAX = sizeof(uint32_t) * CHARBITS + 1
 

Detailed Description

Common interface for LCD handlers; class LCD::Device as base for device drivers and class LCD::IO for device port abstraction with two predefined implementation classes; Serial3W and SPI3W. Serial3W uses OutputPins and SPI3W uses the SPI driver.

Definition at line 36 of file LCD.hh.

Member Typedef Documentation

typedef IOStream&(* IOStream::Manipulator) (IOStream &)
inherited

Stream manipulator function prototype. To allow implementation of base change and end of line.

Parameters
[in]iostream.
Returns
iostream.

Definition at line 538 of file IOStream.hh.

Member Enumeration Documentation

enum IOStream::Base
inherited

Base conversion.

Enumerator
bcd 
bin 
oct 
dec 
hex 

Definition at line 43 of file IOStream.hh.

enum IOStream::Mode
inherited

End of line modes.

Enumerator
CR_MODE 
LF_MODE 
CRLF_MODE 

Definition at line 54 of file IOStream.hh.

Member Function Documentation

Device* IOStream::device ( ) const
inlineinherited

Get current device.

Returns
device.

Definition at line 265 of file IOStream.hh.

Device* IOStream::device ( Device dev)
inlineinherited

Set io stream device.

Parameters
[in]devstream device.
Returns
previous device.

Definition at line 275 of file IOStream.hh.

str_P IOStream::eol ( ) const
inlineinherited

Get io stream end of line string.

Returns
string for end of line.

Definition at line 286 of file IOStream.hh.

str_P IOStream::EOL ( ) const
inlineinherited

Get io stream end of line string.

Returns
string for end of line.

Definition at line 295 of file IOStream.hh.

void IOStream::eol ( str_P  s)
inlineinherited

Set io stream end of line string.

Parameters
[in]sstring for end of line.

Definition at line 304 of file IOStream.hh.

void IOStream::flush ( )
inlineinherited

Flush contents of iostream to stream.

Definition at line 504 of file IOStream.hh.

char * IOStream::itoa ( int  __val,
char *  __s,
int  base 
)
staticinherited

Definition at line 144 of file IOStream_dtoa.cpp.

char * IOStream::ltoa ( long  __val,
char *  __s,
int  base 
)
staticinherited

Definition at line 129 of file IOStream_dtoa.cpp.

IOStream& IOStream::operator<< ( Manipulator  func)
inlineinherited

Output operator for stream manipulator. Apply function.

Parameters
[in]funciostream manipulator.
Returns
iostream.

Definition at line 545 of file IOStream.hh.

IOStream& IOStream::operator<< ( int  n)
inlineinherited

Print integer as string in the current base to stream. Reset base to decimal.

Parameters
[in]nvalue to print.
Returns
iostream.

Definition at line 556 of file IOStream.hh.

IOStream& IOStream::operator<< ( long int  n)
inlineinherited

Print long integer as string in the current base to stream. Reset base to decimal.

Parameters
[in]nvalue to print.
Returns
iostream.

Definition at line 569 of file IOStream.hh.

IOStream& IOStream::operator<< ( double  n)
inlineinherited

Print double as string with the current field min width and number of decimals. Reset base to decimal.

Parameters
[in]nvalue to print.
Returns
iostream.

Definition at line 583 of file IOStream.hh.

IOStream& IOStream::operator<< ( unsigned int  n)
inlineinherited

Print unsigned integer as string in the current base to stream. Reset base to decimal.

Parameters
[in]nvalue to print.
Returns
iostream.

Definition at line 596 of file IOStream.hh.

IOStream& IOStream::operator<< ( unsigned long int  n)
inlineinherited

Print unsigned long integer as string in the current base to stream. Reset base to decimal.

Parameters
[in]nvalue to print.
Returns
iostream.

Definition at line 609 of file IOStream.hh.

IOStream& IOStream::operator<< ( void *  ptr)
inlineinherited

Print pointer as a hexadecimal number string to stream.

Parameters
[in]ptrpointer to print.
Returns
iostream.

Definition at line 621 of file IOStream.hh.

IOStream& IOStream::operator<< ( const void *  ptr)
inlineinherited

Print program memory pointer as a hexadecimal number string to stream.

Parameters
[in]ptrprogram memory pointer to print.
Returns
iostream.

Definition at line 634 of file IOStream.hh.

IOStream& IOStream::operator<< ( char  c)
inlineinherited

Print character to stream.

Parameters
[in]ccharacter to print.
Returns
iostream.

Definition at line 646 of file IOStream.hh.

IOStream& IOStream::operator<< ( char *  s)
inlineinherited

Print null terminated string to stream.

Parameters
[in]sstring to print.
Returns
iostream.

Definition at line 657 of file IOStream.hh.

IOStream& IOStream::operator<< ( const char *  s)
inlineinherited

Print null terminated string in program memory to stream.

Parameters
[in]sstring in program memory to print.
Returns
iostream.

Definition at line 668 of file IOStream.hh.

IOStream& IOStream::operator<< ( str_P  s)
inlineinherited

Print null terminated string in program memory to stream.

Parameters
[in]sstring in program memory to print.
Returns
iostream.

Definition at line 679 of file IOStream.hh.

IOStream& IOStream::operator<< ( IOStream buffer)
inlineinherited

Print contents of iobuffer to stream.

Parameters
[in]bufferinput/output buffer.
Returns
iostream.

Definition at line 690 of file IOStream.hh.

IOStream& IOStream::operator<< ( const iovec_t vec)
inlineinherited

Print contents of iovector to stream.

Parameters
[in]veciovector.
Returns
iostream.

Definition at line 701 of file IOStream.hh.

uint8_t IOStream::precision ( uint8_t  value)
inlineinherited

Set number of digits after decimal point for double numbers.

Parameters
[in]valueprecision.
Returns
previous precision.

Definition at line 327 of file IOStream.hh.

void IOStream::print ( int  value,
Base  base = dec 
)
inherited

Print integer as string with given base to stream.

Parameters
[in]valueto print.
[in]baseto represent value in (default 10).

Definition at line 46 of file IOStream.cpp.

void IOStream::print ( long int  value,
Base  base = dec 
)
inherited

Print long integer 32-bit value in given base torace stream.

Parameters
[in]valueto print.
[in]baseto represent value in (default 10).

Definition at line 65 of file IOStream.cpp.

void IOStream::print ( unsigned int  value,
Base  base = dec 
)
inherited

Print unsigned integer as string with given base to stream.

Parameters
[in]valueto print.
[in]baseto represent value in (default 10).

Definition at line 73 of file IOStream.cpp.

void IOStream::print ( unsigned long int  value,
Base  base = dec 
)
inherited

Print unsigned long integer 32-bit value in given base to stream.

Parameters
[in]valueto print.
[in]baseto represent value in (default 10).

Definition at line 81 of file IOStream.cpp.

void IOStream::print ( unsigned int  value,
uint8_t  digits,
Base  base 
)
inherited

Print unsigned integer as string with given base to stream.

Parameters
[in]valueto print.
[in]digitsto print.
[in]baseto represent value in.

Definition at line 89 of file IOStream.cpp.

void IOStream::print ( unsigned long int  value,
uint8_t  digits,
Base  base 
)
inherited

Print unsigned long integer 32-bit value in given base to stream.

Parameters
[in]valueto print.
[in]digitsto print.
[in]baseto represent value in.

Definition at line 99 of file IOStream.cpp.

void IOStream::print ( double  value,
int8_t  width,
uint8_t  prec 
)
inherited

Print double with the minimum field width of the output string (including the '.' and the possible sign for negative values) is given in width, and prec determines the number of digits after the decimal sign. width is signed value, negative for left adjustment.

Parameters
[in]valueto print.
[in]widthminimum field width.
[in]precnumber of digits.

Definition at line 109 of file IOStream.cpp.

void IOStream::print ( uint32_t  src,
const void *  ptr,
size_t  size,
Base  base = dec,
uint8_t  max = 16 
)
inherited

Print buffer contents in given base to stream.

Parameters
[in]srcaddress prefix.
[in]ptrpointer to data memory.
[in]sizenumber of bytes.
[in]baseto represent value in (default 10).
[in]maxnumber of numbers per line (default 16).

Definition at line 136 of file IOStream.cpp.

void IOStream::print ( const void *  ptr,
size_t  size,
Base  base = dec,
uint8_t  max = 16 
)
inlineinherited

Print buffer contents in given base to stream.

Parameters
[in]ptrpointer to data memory.
[in]sizenumber of bytes.
[in]baseto represent value in (default 10).
[in]maxnumber of numbers per line (default 16).

Definition at line 408 of file IOStream.hh.

void IOStream::print ( void *  ptr)
inlineinherited

Print pointer as a hexadecimal number to stream.

Parameters
[in]ptrpointer to data memory.

Definition at line 418 of file IOStream.hh.

void IOStream::print ( const void *  ptr)
inlineinherited

Print pointer to program memory as a hexadecimal number to stream.

Parameters
[in]ptrpointer to program memory.

Definition at line 428 of file IOStream.hh.

void IOStream::print ( char  c)
inlineinherited

Print character to stream.

Parameters
[in]ccharacter to print.

Definition at line 437 of file IOStream.hh.

void IOStream::print ( const char *  s)
inlineinherited

Print string in data memory to stream.

Parameters
[in]spointer to data memory string.

Definition at line 447 of file IOStream.hh.

void IOStream::print ( str_P  s)
inlineinherited

Print string in program memory to stream. Use macro PSTR() to generate a string constants in program memory.

Parameters
[in]spointer to program memory string.

Definition at line 458 of file IOStream.hh.

void IOStream::print ( IOStream::Device buffer)
inherited

Print contents of iostream to stream.

Parameters
[in]bufferinput/output buffer.

Definition at line 117 of file IOStream.cpp.

void IOStream::print_prefix ( Base  base)
protectedinherited

Print number prefix for non decimal base.

Parameters
[in]baserepresentation.

Definition at line 125 of file IOStream.cpp.

void IOStream::printf ( str_P  format,
  ... 
)
inlineinherited

Formated print with variable argument list. The format string should be in program memory. Use the macro PSTR().

Parameters
[in]formatstring in program memory.
[in]...variable argument list.

Definition at line 487 of file IOStream.hh.

void IOStream::println ( )
inlineinherited

Print end of line to stream.

Definition at line 467 of file IOStream.hh.

char * IOStream::readline ( char *  buf,
size_t  size,
bool  echo = true 
)
inherited

Read line into the given buffer. Characters received from the device is appended to the end of the string until end of line is received. The buffer pointer is returned with a complete line has been received otherwise NULL. The function will append until the given size of reached.

Parameters
[in]bufbuffer for received line.
[in]sizeof buffer.
[in]echocharacter mode (Default true).
Returns
NULL or pointer to buffer when line received.

Definition at line 262 of file IOStream.cpp.

char * IOStream::scan ( char *  s,
size_t  count 
)
inherited

Scan next token from the input stream. Returns pointer to string or NULL if not stream is empty.

Parameters
[in]sstring buffer to read into.
[in]countmax number of bytes to read.
Returns
string pointer or NULL.

Definition at line 224 of file IOStream.cpp.

char * IOStream::ultoa ( unsigned long  __val,
char *  __s,
int  base 
)
staticinherited

Definition at line 51 of file IOStream_dtoa.cpp.

char * IOStream::utoa ( unsigned int  __val,
char *  __s,
int  base 
)
staticinherited

Definition at line 138 of file IOStream_dtoa.cpp.

void IOStream::vprintf ( str_P  format,
va_list  args 
)
inherited

Format print with variable argument list. The format string should be in program memory. Use the macro PSTR().

Parameters
[in]formatstring in program memory.
[in]argsvariable argument list.

Definition at line 163 of file IOStream.cpp.

int8_t IOStream::width ( int8_t  value)
inlineinherited

Set minimum width for double numbers. The width is signed value, negative for left adjustment.

Parameters
[in]valuewidth.
Returns
previous width.

Definition at line 315 of file IOStream.hh.

Member Data Documentation

const size_t IOStream::BUF_MAX = sizeof(uint32_t) * CHARBITS + 1
staticprotectedinherited

Maximum size of required buffer for string conversion.

Definition at line 730 of file IOStream.hh.

const char IOStream::CR[]
staticinherited

End Of Line character sequences

Definition at line 36 of file IOStream.hh.

const char IOStream::CRLF = "\r\n"
staticinherited

Definition at line 38 of file IOStream.hh.

const int IOStream::EOF = -1
staticinherited

End Of File, returned when device operations fails (empty or full).

Definition at line 33 of file IOStream.hh.

const char IOStream::LF = "\r"
staticinherited

Definition at line 37 of file IOStream.hh.

Base IOStream::m_base
protectedinherited

Base for next output operator.

Definition at line 724 of file IOStream.hh.

Device* IOStream::m_dev
protectedinherited

Delegated device.

Definition at line 723 of file IOStream.hh.

str_P IOStream::m_eols
protectedinherited

End of line string (program memory).

Definition at line 727 of file IOStream.hh.

uint8_t IOStream::m_prec
protectedinherited

Number of digits after decimal sign.

Definition at line 726 of file IOStream.hh.

int8_t IOStream::m_width
protectedinherited

Minimum width of output string.

Definition at line 725 of file IOStream.hh.


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