slightly cleaner?
This commit is contained in:
@@ -90,17 +90,16 @@ void LCDDisplay::clearBuf() {
|
||||
|
||||
/* hyper optimized buffer flush command, writes whole disp with a single write */
|
||||
void LCDDisplay::flushBuf() {
|
||||
char writebuf[168]; // 4x40 chars + 2x4 setcursor commands
|
||||
uint8_t setDisp[] = {254, 71, 1}; // skeleton set cursor command
|
||||
uint8_t writebuf[168]; // 4x40 chars + 2x4 setcursor commands
|
||||
uint8_t setDisp[] = {254, 71, 1, 1}; // setr cursor to char 1, line 1
|
||||
|
||||
std::memcpy(&writebuf[0], setDisp, 3); // copy template set cursor command
|
||||
writebuf[3] = 1; // actual set cursor param, set to 1st row
|
||||
std::memcpy(&writebuf[4], linebuf[0], 40); // copy 1st line
|
||||
std::memcpy(&writebuf[44], linebuf[1], 40); // copy 2nd line
|
||||
std::memcpy(&writebuf[84], setDisp, 3); // copy template set cursor command
|
||||
writebuf[87] = 3; // set cursor to 3rd line
|
||||
std::memcpy(&writebuf[88], linebuf[2], 40); // copy 3rd line
|
||||
std::memcpy(&writebuf[128], linebuf[3], 40); // copy 4th line
|
||||
std::memcpy(&writebuf[0], setDisp, 4); // copy set cursor command
|
||||
std::memcpy(&writebuf[4], linebuf[0], 40); // copy 1st line
|
||||
std::memcpy(&writebuf[44], linebuf[1], 40); // copy 2nd line
|
||||
std::memcpy(&writebuf[84], setDisp, 3); // copy set cursor command but skip the line byte
|
||||
writebuf[87] = 3; // set cursor to 3rd line
|
||||
std::memcpy(&writebuf[88], linebuf[2], 40); // copy 3rd line
|
||||
std::memcpy(&writebuf[128], linebuf[3], 40); // copy 4th line
|
||||
|
||||
write(_lcd, writebuf, 168);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user