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.
TextLCD_Serial.cpp
00001 // Copyright (c) 2010 mwaddilove 00002 // Released under the MIT License: http://mbed.org/license/mit 00003 00004 #include "TextLCD_Serial.h" 00005 00006 //! Constructor 00007 TextLCD_Serial::TextLCD_Serial(PinName tx, PinName rx, char const * name /*= NULL*/) 00008 : _lcd(tx, rx) 00009 { 00010 _lcd.baud(9600); 00011 } 00012 00013 00014 void TextLCD_Serial::character(int column, int row, int c) 00015 { 00016 setLCDCursor(column, row); 00017 00018 writeData(c); 00019 } 00020 00021 00022 //! Set the LCD's cursor position 00023 void TextLCD_Serial::setLCDCursor(int const column, int const row) 00024 { 00025 unsigned char const positionCode = Codes::Position | ((row & 0x1) << 6) | (column % 0x3F); 00026 00027 writeCommand(positionCode); 00028 } 00029 00030 /** Clear the screen and locate to 0,0 */ 00031 void TextLCD_Serial::cls() 00032 { 00033 writeCommand(Codes::Clear); 00034 00035 locate(0,0); 00036 } 00037 00038 00039 //! write a byte to _lcd 00040 void TextLCD_Serial::writeByte(int const value) 00041 { 00042 _lcd.putc(value); 00043 } 00044 00045 00046 //!Send a command 00047 void TextLCD_Serial::writeCommand(int const command) 00048 { 00049 writeByte(Codes::Command); 00050 writeByte(command); 00051 } 00052 00053 00054 //! write a regular char. 00055 void TextLCD_Serial::writeData(int const data) 00056 { 00057 writeByte(data); 00058 }
Generated on Wed Jul 13 2022 11:46:45 by
1.7.2