Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Hotboards_SpiLcd-Hello_World Hotboards_SpiLcd-Writing_In_Diferent_Rows Hotboards_SpiLcd_Scrolling_Text Hotboards_SpiLcd_AutoScroll ... more
Hotboards_SpiLcd Class Reference
Hotboards_SpiLcd class. More...
#include <Hotboards_SpiLcd.h>
Public Member Functions | |
| Hotboards_SpiLcd (SPI &spi, PinName cs, PinName rs, PinName rst) | |
| Create Hotboards_SpiLcd instance. | |
| void | init (void) |
| Send commands to initialize internal lcd controller. | |
| void | clear (void) |
| Clears the LCD screen and positions the cursor in the upper-left corner. | |
| void | home (void) |
| Positions the cursor in the upper-left of the LCD. | |
| void | noDisplay (void) |
| Turns off the LCD display, without losing the text currently shown on it. | |
| void | display (void) |
| Turns on the LCD display, after it's been turned off with noDisplay(). | |
| void | noBlink (void) |
| Turns off the blinking LCD cursor. | |
| void | blink (void) |
| Display the blinking LCD cursor. | |
| void | noCursor (void) |
| Hides the LCD cursor. | |
| void | cursor (void) |
| Display the LCD cursor: an underscore (line) at the position to which the next character will be written. | |
| void | scrollDisplayLeft (void) |
| Scrolls the contents of the display (text and cursor) one space to the left. | |
| void | scrollDisplayRight (void) |
| Scrolls the contents of the display (text and cursor) one space to the right. | |
| void | leftToRight (void) |
| Set the direction for text written to the LCD to left-to-right, the default. | |
| void | rightToLeft (void) |
| Set the direction for text written to the LCD to right-to-left (the default is left-to-right). | |
| void | autoscroll (void) |
| Turns on automatic scrolling of the LCD. | |
| void | noAutoscroll (void) |
| Turns off automatic scrolling of the LCD. | |
| void | setCursor (uint8_t col, uint8_t row) |
| Position the LCD cursor; that is, set the location at which subsequent text written to the LCD will be displayed. | |
| void | command (uint8_t) |
| Send a command to the LCD. | |
| int | putc (int c) |
| Write a character to the LCD. | |
| int | printf (const char *format,...) |
| Write a formatted string of characters to the LCD. | |
Detailed Description
Hotboards_SpiLcd class.
Used to control lcd with spi serial interface
Example:
#include "mbed.h" #include "Hotboards_SpiLcd.h" 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 ) { lcd.init( ); lcd.printf( "Hola mundo" ); }
Definition at line 80 of file Hotboards_SpiLcd.h.
Constructor & Destructor Documentation
| Hotboards_SpiLcd | ( | SPI & | spi, |
| PinName | cs, | ||
| PinName | rs, | ||
| PinName | rst | ||
| ) |
Create Hotboards_SpiLcd instance.
- Parameters:
-
spi spi peripheral to be use to control the lcd cs pin to control the chip select signal rs pin to control the data/command signal rst pin to control the reset signal
Example:
// 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
Definition at line 18 of file Hotboards_SpiLcd.cpp.
Member Function Documentation
| void autoscroll | ( | 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.
Example:
lcd.autoscroll();
Definition at line 148 of file Hotboards_SpiLcd.cpp.
| void blink | ( | void | ) |
Display the blinking LCD cursor.
If used in combination with the cursor() function, the result will depend on the particular display.
Example:
lcd.blink();
Definition at line 99 of file Hotboards_SpiLcd.cpp.
| void clear | ( | void | ) |
Clears the LCD screen and positions the cursor in the upper-left corner.
Example:
lcd.clear();
Definition at line 64 of file Hotboards_SpiLcd.cpp.
| void command | ( | uint8_t | value ) |
Send a command to the LCD.
: cmd command to send
Example:
// clear screen command
lcd.command( 0x30 );
Definition at line 178 of file Hotboards_SpiLcd.cpp.
| void cursor | ( | void | ) |
Display the LCD cursor: an underscore (line) at the position to which the next character will be written.
Example:
lcd.cursor();
Definition at line 114 of file Hotboards_SpiLcd.cpp.
| void display | ( | 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:
lcd.display();
Definition at line 85 of file Hotboards_SpiLcd.cpp.
| void home | ( | 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:
lcd.home();
Definition at line 71 of file Hotboards_SpiLcd.cpp.
| void init | ( | void | ) |
Send commands to initialize internal lcd controller.
Example:
// After create the instance we init
lcd.begin();
Definition at line 27 of file Hotboards_SpiLcd.cpp.
| void leftToRight | ( | 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:
lcd.leftToRight();
Definition at line 134 of file Hotboards_SpiLcd.cpp.
| void noAutoscroll | ( | void | ) |
Turns off automatic scrolling of the LCD.
Example:
lcd.noAutoscroll();
Definition at line 155 of file Hotboards_SpiLcd.cpp.
| void noBlink | ( | void | ) |
Turns off the blinking LCD cursor.
Example:
lcd.noBlink();
Definition at line 92 of file Hotboards_SpiLcd.cpp.
| void noCursor | ( | void | ) |
| void noDisplay | ( | void | ) |
Turns off the LCD display, without losing the text currently shown on it.
Example:
lcd.noDisplay();
Definition at line 78 of file Hotboards_SpiLcd.cpp.
| int printf | ( | const char * | format, |
| ... | |||
| ) |
Write a formatted string of characters to the LCD.
- Parameters:
-
format,: formatted string
Example:
lcd.printf( "number %d: ", 34 );
| int putc | ( | int | c ) |
Write a character to the LCD.
- Parameters:
-
c,: character to display
Example:
lcd.putc();
| void rightToLeft | ( | 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:
lcd.rightToLeft();
Definition at line 141 of file Hotboards_SpiLcd.cpp.
| void scrollDisplayLeft | ( | void | ) |
Scrolls the contents of the display (text and cursor) one space to the left.
Example:
lcd.scrollDisplayLeft();
Definition at line 122 of file Hotboards_SpiLcd.cpp.
| void scrollDisplayRight | ( | void | ) |
Scrolls the contents of the display (text and cursor) one space to the right.
Example:
lcd.scrollDisplayRight();
Definition at line 128 of file Hotboards_SpiLcd.cpp.
| void setCursor | ( | uint8_t | col, |
| uint8_t | row | ||
| ) |
Position the LCD cursor; that is, set the location at which subsequent text written to the LCD will be displayed.
- Parameters:
-
col,: the column at which to position the cursor (with 0 being the first column) row,: the row at which to position the cursor (with 0 being the first row)
Example:
lcd.setCursor( 3, 1 );
Definition at line 162 of file Hotboards_SpiLcd.cpp.
Generated on Fri Jul 15 2022 20:44:00 by
1.7.2
Hotboards SpiLcd.