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
Revision 3:e16488b64ef7, committed 2016-03-05
- Comitter:
- Hotboards
- Date:
- Sat Mar 05 19:17:23 2016 +0000
- Parent:
- 2:9673849ef2e9
- Commit message:
- update docs
Changed in this revision
| Hotboards_SpiLcd.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Hotboards_SpiLcd.h Sat Feb 27 20:02:57 2016 +0000
+++ b/Hotboards_SpiLcd.h Sat Mar 05 19:17:23 2016 +0000
@@ -67,7 +67,8 @@
* #include "mbed.h"
* #include "Hotboards_SpiLcd.h"
*
- * Hotboards_SpiLcd lcd( PB_5, NC, PB_3 ); // mosi, miso, sclk
+ * SPI device( PB_5, NC, PB_3 ); // mosi, miso, sclk
+ * Hotboards_SpiLcd lcd( device, PC_0, PC_1, PC_2 ); //spi, cs, rs, rst
*
* int main( void )
* {
@@ -81,67 +82,145 @@
public:
/** Create Hotboards_SpiLcd instance
- */
+ * @param spi spi peripheral to be use to control the lcd
+ * @param cs pin to control the chip select signal
+ * @param rs pin to control the data/command signal
+ * @param rst pin to control the reset signal
+ *
+ * Example:
+ * @code
+ * // we need to init an spi peripheral first
+ * SPI device( PB_5, NC, PB_3 ); // mosi, miso, sclk
+ * // then we can create the instance
+ * Hotboards_SpiLcd lcd( device, PC_0, PC_1, PC_2 ); //spi, cs, rs, rst
+ * @endcode
+ */
Hotboards_SpiLcd( SPI &spi, PinName cs, PinName rs, PinName rst );
- /** send commands to initialize internal lcd controller
+ /** Send commands to initialize internal lcd controller
+ *
+ * Example:
+ * @code
+ * // After create the instance we init
+ * lcd.begin();
+ * @endcode
*/
void init( void );
/** Clears the LCD screen and positions the cursor in the upper-left corner.
+ *
+ * Example:
+ * @code
+ * lcd.clear();
+ * @endcode
*/
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
+ *
+ * Example:
+ * @code
+ * lcd.home();
+ * @endcode
*/
void home( void );
/** Turns off the LCD display, without losing the text currently shown on it.
+ *
+ * Example:
+ * @code
+ * lcd.noDisplay();
+ * @endcode
*/
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.
+ *
+ * Example:
+ * @code
+ * lcd.display();
+ * @endcode
*/
void display( void );
/** Turns off the blinking LCD cursor.
+ *
+ * Example:
+ * @code
+ * lcd.noBlink();
+ * @endcode
*/
void noBlink( void );
/** Display the blinking LCD cursor. If used in combination with the cursor() function,
* the result will depend on the particular display.
+ *
+ * Example:
+ * @code
+ * lcd.blink();
+ * @endcode
*/
void blink( void );
/** Hides the LCD cursor.
+ *
+ * Example:
+ * @code
+ * lcd.noCursor();
+ * @endcode
*/
void noCursor( void );
/** Display the LCD cursor: an underscore (line) at the position to which the
* next character will be written.
+ *
+ * Example:
+ * @code
+ * lcd.cursor();
+ * @endcode
*/
void cursor( void );
/** Scrolls the contents of the display (text and cursor) one space to the left.
+ *
+ * Example:
+ * @code
+ * lcd.scrollDisplayLeft();
+ * @endcode
*/
void scrollDisplayLeft( void );
/** Scrolls the contents of the display (text and cursor) one space to the right.
+ *
+ * Example:
+ * @code
+ * lcd.scrollDisplayRight();
+ * @endcode
*/
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.
+ *
+ * Example:
+ * @code
+ * lcd.leftToRight();
+ * @endcode
*/
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.
+ *
+ * Example:
+ * @code
+ * lcd.rightToLeft();
+ * @endcode
*/
void rightToLeft( void );
@@ -151,10 +230,20 @@
* 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.
+ *
+ * Example:
+ * @code
+ * lcd.autoscroll();
+ * @endcode
*/
void autoscroll( void );
/** Turns off automatic scrolling of the LCD.
+ *
+ * Example:
+ * @code
+ * lcd.noAutoscroll();
+ * @endcode
*/
void noAutoscroll( void );
@@ -164,25 +253,45 @@
/** 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)
+ *
+ * Example:
+ * @code
+ * lcd.setCursor( 3, 1 );
+ * @endcode
*/
void setCursor( uint8_t col, uint8_t row );
- /** Write a character to the LCD.
- * @data: the character to write to the display
+ /** Send a command to the LCD.
+ * @data: cmd command to send
+ *
+ * Example:
+ * @code
+ * // clear screen command
+ * lcd.command( 0x30 );
+ * @endcode
*/
void command( uint8_t );
#if DOXYGEN_ONLY
/** Write a character to the LCD.
* @param c: character to display
+ *
+ * Example:
+ * @code
+ * lcd.putc();
+ * @endcode
*/
int putc(int c);
/** Write a formatted string of characters to the LCD.
- * @param format: formatted string
- */
+ * @param format: formatted string
+ *
+ * Example:
+ * @code
+ * lcd.printf( "number %d: ", 34 );
+ * @endcode
+ */
int printf(const char* format, ...);
#endif
Hotboards SpiLcd.