syouichi imamori / Mbed OS MulticopterQuadX

Dependencies:   IAP

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SerialLcd.cpp Source File

SerialLcd.cpp

00001 #include "mbed.h"
00002 #include "SerialLcd.h"
00003 void wait(float);
00004 
00005 SerialLcd::SerialLcd(PinName TX,PinName RX): _lcd(TX,RX)
00006 {   
00007 //    LCD_contrast = 60; 
00008 }
00009 
00010 int SerialLcd::write(const char* value) {
00011     size_t len = strlen(value);
00012     return _lcd.write(value,len);
00013 }
00014 
00015 int SerialLcd::_putc(int value) {
00016     const uint8_t buf = value;
00017     _lcd.write(&buf,1);
00018     return value;
00019 }
00020 
00021 int SerialLcd::_getc() {
00022     return -1;
00023 }
00024 
00025 void SerialLcd::cls()
00026 {
00027     char buf[2];
00028     buf[0] = 0xFE;
00029     buf[1] = 0x01;
00030     _lcd.write(buf,2);
00031     wait(0.01);
00032 }
00033 
00034 void SerialLcd::locate(int clm,int row)
00035 {
00036     char buf[2];
00037     buf[0] = 0xFE;
00038     buf[1] = 0x80 + (row * 0x40) + clm ;
00039     _lcd.write(buf,2);
00040     wait(0.01);
00041 }
00042 ;