Hotboards_SpiLcd.cpp - Library for write and control and lcd with spi interfaces and the ST7032 controller. Base on Arduino's Liquid Cristal library
Dependents: Hotboards_SpiLcd-Hello_World Hotboards_SpiLcd-Writing_In_Diferent_Rows Hotboards_SpiLcd_Scrolling_Text Hotboards_SpiLcd_AutoScroll ... more
Diff: Hotboards_SpiLcd.h
- Revision:
- 2:9673849ef2e9
- Parent:
- 1:b777b6147d99
- Child:
- 3:e16488b64ef7
--- a/Hotboards_SpiLcd.h Fri Jan 29 01:08:33 2016 +0000 +++ b/Hotboards_SpiLcd.h Sat Feb 27 20:02:57 2016 +0000 @@ -59,34 +59,130 @@ #define HT_SPILCD_NORMINST 0x00 +/** Hotboards_SpiLcd class. + * Used to control lcd with spi serial interface + * + * Example: + * @code + * #include "mbed.h" + * #include "Hotboards_SpiLcd.h" + * + * Hotboards_SpiLcd lcd( PB_5, NC, PB_3 ); // mosi, miso, sclk + * + * int main( void ) + * { + * lcd.init( ); + * lcd.printf( "Hola mundo" ); + * } + * @endcode + */ class Hotboards_SpiLcd : public Stream { public: + /** Create Hotboards_SpiLcd instance + */ Hotboards_SpiLcd( SPI &spi, PinName cs, PinName rs, PinName rst ); + + /** send commands to initialize internal lcd controller + */ void init( void ); + + /** Clears the LCD screen and positions the cursor in the upper-left corner. + */ void clear( void ); + + /** Positions the cursor in the upper-left of the LCD. That is, use that location + * in outputting subsequent text to the display. To also clear the display, use + * the clear() function instead + */ void home( void ); + /** Turns off the LCD display, without losing the text currently shown on it. + */ void noDisplay( void ); + + /** Turns on the LCD display, after it's been turned off with noDisplay(). + * This will restore the text (and cursor) that was on the display. + */ void display( void ); + + /** Turns off the blinking LCD cursor. + */ void noBlink( void ); + + /** Display the blinking LCD cursor. If used in combination with the cursor() function, + * the result will depend on the particular display. + */ void blink( void ); + + /** Hides the LCD cursor. + */ void noCursor( void ); + + /** Display the LCD cursor: an underscore (line) at the position to which the + * next character will be written. + */ void cursor( void ); + + /** Scrolls the contents of the display (text and cursor) one space to the left. + */ void scrollDisplayLeft( void ); + + /** Scrolls the contents of the display (text and cursor) one space to the right. + */ void scrollDisplayRight( void ); + + /** Set the direction for text written to the LCD to left-to-right, the default. + * This means that subsequent characters written to the display will go from left to right, + * but does not affect previously-output text. + */ void leftToRight( void ); + + /** Set the direction for text written to the LCD to right-to-left (the default is left-to-right). + * This means that subsequent characters written to the display will go from right to left, + * but does not affect previously-output text. + */ void rightToLeft( void ); + + /** Turns on automatic scrolling of the LCD. This causes each character + * output to the display to push previous characters over by one space. + * If the current text direction is left-to-right (the default), + * the display scrolls to the left; if the current direction is right-to-left, + * the display scrolls to the right. This has the effect of outputting + * each new character to the same location on the LCD. + */ void autoscroll( void ); + + /** Turns off automatic scrolling of the LCD. + */ void noAutoscroll( void ); //void setRowOffsets( int row1, int row2 ); + //void createChar( uint8_t, uint8_t[] ); - void setCursor( uint8_t, uint8_t ); + + /** Position the LCD cursor; that is, set the location at which subsequent + * text written to the LCD will be displayed. + * + * @param col: the column at which to position the cursor (with 0 being the first column) + * @param row: the row at which to position the cursor (with 0 being the first row) + */ + void setCursor( uint8_t col, uint8_t row ); + + /** Write a character to the LCD. + * @data: the character to write to the display + */ void command( uint8_t ); #if DOXYGEN_ONLY - int putc(int c); + /** Write a character to the LCD. + * @param c: character to display + */ + int putc(int c); + + /** Write a formatted string of characters to the LCD. + * @param format: formatted string + */ int printf(const char* format, ...); #endif