Added setCursor command
This commit is contained in:
parent
19dc5c00b4
commit
3ce7ba3bb8
|
@ -7,7 +7,7 @@ int main(void)
|
||||||
|
|
||||||
initScreen(&screen, HALF_BYTE_INTERFACE, TWO_LINES, FONT_5x7, CURSOR_ON | CURSOR_BLINK, LEFT_TO_RIGHT);
|
initScreen(&screen, HALF_BYTE_INTERFACE, TWO_LINES, FONT_5x7, CURSOR_ON | CURSOR_BLINK, LEFT_TO_RIGHT);
|
||||||
sendText(&screen, "スウェーデン");
|
sendText(&screen, "スウェーデン");
|
||||||
sendCommand(&screen, DDRAM_AD_SET | 0x40);
|
setCursor(&screen, 0, 1);
|
||||||
sendText(&screen, "オーストラリア");
|
sendText(&screen, "オーストラリア");
|
||||||
resetPins(&screen);
|
resetPins(&screen);
|
||||||
|
|
||||||
|
|
|
@ -125,11 +125,7 @@ void sendText(LCDScreen* screen, const char* text)
|
||||||
{
|
{
|
||||||
for(const char* c = text; *c != '\x00'; c++)
|
for(const char* c = text; *c != '\x00'; c++)
|
||||||
{
|
{
|
||||||
if(*c != '\xe3')
|
if(*c == '\xe3')
|
||||||
{
|
|
||||||
sendData(screen, *c);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
uint16_t symbol = ((uint16_t)(*(c + 1)) << 8) | ((uint16_t)(*(c + 2)));
|
uint16_t symbol = ((uint16_t)(*(c + 1)) << 8) | ((uint16_t)(*(c + 2)));
|
||||||
|
|
||||||
|
@ -230,6 +226,11 @@ void sendText(LCDScreen* screen, const char* text)
|
||||||
}
|
}
|
||||||
c += 2;
|
c += 2;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sendData(screen, *c);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,3 +245,8 @@ void sendChars(LCDScreen* screen, size_t len, ...)
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCursor(LCDScreen* screen, uint8_t x, uint8_t y)
|
||||||
|
{
|
||||||
|
sendCommand(screen, DDRAM_AD_SET | (y << 6) | x);
|
||||||
|
}
|
|
@ -151,4 +151,6 @@ extern void sendData(LCDScreen* screen, uint8_t data);
|
||||||
extern void sendText(LCDScreen* screen, const char* text);
|
extern void sendText(LCDScreen* screen, const char* text);
|
||||||
extern void sendChars(LCDScreen* screen, unsigned int len, ...);
|
extern void sendChars(LCDScreen* screen, unsigned int len, ...);
|
||||||
|
|
||||||
|
extern void setCursor(LCDScreen* screen, uint8_t x, uint8_t y);
|
||||||
|
|
||||||
#endif // RASPBERRY_LCD_H
|
#endif // RASPBERRY_LCD_H
|
Loading…
Reference in a new issue