Added macros for special characters

This commit is contained in:
Lauchmelder23§ 2020-11-20 00:32:33 +00:00
parent fe98697ca4
commit 8babe57528
4 changed files with 113 additions and 8 deletions

View file

@ -6,8 +6,9 @@ int main(void)
configurePins(&screen, 7, 9, 8, 0, 0, 0, 0, 21, 22, 23, 24);
initScreen(&screen, HALF_BYTE_INTERFACE, TWO_LINES, FONT_5x7, CURSOR_ON | CURSOR_BLINK, LEFT_TO_RIGHT);
sendData(&screen, JAPANESE_QUOTE_START);
sendData(&screen, JAPANESE_QUOTE_END);
sendChars(&screen, 4,
JAPANESE_KATAKANA_TO, JAPANESE_DAKUTEN, JAPANESE_KATAKANA_I, JAPANESE_KATAKANA_TSU
);
resetPins(&screen);
return 0;

Binary file not shown.

View file

@ -2,6 +2,7 @@
#include <wiringPi.h>
#include <stdio.h>
#include <stdarg.h>
void waitMs(uint32_t ms)
{
@ -124,4 +125,15 @@ void sendText(LCDScreen* screen, const char* text)
{
for(const char* c = text; *c != '\x00'; c++)
sendData(screen, *c);
}
void sendChars(LCDScreen* screen, size_t len, ...)
{
va_list args;
va_start(args, len);
for(size_t i = 0; i < len; i++)
sendData(screen, (uint8_t)va_arg(args, int));
va_end(args);
}

View file

@ -32,12 +32,103 @@
#define FONT_5x7 0b00000
// Special characters supported by the LCD
#define YEN_CURRENCY 0b01011100
#define ARROW_RIGHT 0b01111110
#define ARROW_LEFT 0b01111111
#define JAPANESE_PERIOD 0b10100001
#define JAPANESE_QUOTE_START 0b10100010
#define JAPANESE_QUOTE_END 0b10100011
#define CURRENCY_YEN 0b01011100
#define ARROW_RIGHT 0b01111110
#define ARROW_LEFT 0b01111111
#define JAPANESE_PERIOD 0b10100001
#define JAPANESE_QUOTE_START 0b10100010
#define JAPANESE_QUOTE_END 0b10100011
#define JAPANESE_COMMA 0b10100100
#define JAPANESE_INTERPUNCT 0b10100101
#define JAPANESE_KATAKANA_WO 0b10100110
#define JAPANESE_KATAKANA_CHIISAI_A 0b10100111
#define JAPANESE_KATAKANA_CHIISAI_I 0b10101000
#define JAPANESE_KATAKANA_CHIISAI_U 0b10101001
#define JAPANESE_KATAKANA_CHIISAI_E 0b10101010
#define JAPANESE_KATAKANA_CHIISAI_O 0b10101011
#define JAPANESE_KATAKANA_CHIISAI_YA 0b10101100
#define JAPANESE_KATAKANA_CHIISAI_YU 0b10101101
#define JAPANESE_KATAKANA_CHIISAI_YO 0b10101110
#define JAPANESE_KATAKANA_CHIISAI_TSU 0b10101111
#define JAPANESE_CHOONPU 0b10110000
#define JAPANESE_KATAKANA_A 0b10110001
#define JAPANESE_KATAKANA_I 0b10110010
#define JAPANESE_KATAKANA_U 0b10110011
#define JAPANESE_KATAKANA_E 0b10110100
#define JAPANESE_KATAKANA_O 0b10110101
#define JAPANESE_KATAKANA_KA 0b10110110
#define JAPANESE_KATAKANA_KI 0b10110111
#define JAPANESE_KATAKANA_KU 0b10111000
#define JAPANESE_KATAKANA_KE 0b10111001
#define JAPANESE_KATAKANA_KO 0b10111010
#define JAPANESE_KATAKANA_SA 0b10111011
#define JAPANESE_KATAKANA_SHI 0b10111100
#define JAPANESE_KATAKANA_SU 0b10111101
#define JAPANESE_KATAKANA_SE 0b10111110
#define JAPANESE_KATAKANA_SO 0b10111111
#define JAPANESE_KATAKANA_TA 0b11000000
#define JAPANESE_KATAKANA_CHI 0b11000001
#define JAPANESE_KATAKANA_TSU 0b11000010
#define JAPANESE_KATAKANA_TE 0b11000011
#define JAPANESE_KATAKANA_TO 0b11000100
#define JAPANESE_KATAKANA_NA 0b11000101
#define JAPANESE_KATAKANA_NI 0b11000110
#define JAPANESE_KATAKANA_NU 0b11000111
#define JAPANESE_KATAKANA_NE 0b11001000
#define JAPANESE_KATAKANA_NO 0b11001001
#define JAPANESE_KATAKANA_HA 0b11001010
#define JAPANESE_KATAKANA_HI 0b11001011
#define JAPANESE_KATAKANA_FU 0b11001100
#define JAPANESE_KATAKANA_HE 0b11001101
#define JAPANESE_KATAKANA_HO 0b11001110
#define JAPANESE_KATAKANA_MA 0b11001111
#define JAPANESE_KATAKANA_MI 0b11010000
#define JAPANESE_KATAKANA_MU 0b11010001
#define JAPANESE_KATAKANA_ME 0b11010010
#define JAPANESE_KATAKANA_MO 0b11010011
#define JAPANESE_KATAKANA_YA 0b11010100
#define JAPANESE_KATAKANA_YU 0b11010101
#define JAPANESE_KATAKANA_YO 0b11010110
#define JAPANESE_KATAKANA_RA 0b11010111
#define JAPANESE_KATAKANA_RI 0b11011000
#define JAPANESE_KATAKANA_RU 0b11011001
#define JAPANESE_KATAKANA_RE 0b11011010
#define JAPANESE_KATAKANA_RO 0b11011011
#define JAPANESE_KATAKANA_WA 0b11011100
#define JAPANESE_KATAKANA_N 0b11011101
#define JAPANESE_DAKUTEN 0b11011110
#define JAPANESE_HANDAKUTEN 0b11011111
#define MATH_ALPHA 0b11100000
#define UMLAUT_A 0b11100001
#define MATH_BETA 0b11100010
#define MATH_EPSILON 0b11100011
#define MATH_MU 0b11100100
#define MATH_SIGMA 0b11100101
#define MATH_RHO 0b11100110
#define MATH_G 0b11100111
#define MATH_SQRT 0b11101000
#define MATH_RECIPROCAL 0b11101001
#define MATH_J 0b11101010
#define MATH_ASTERISK 0b11101011
#define CURRENCY_CENT 0b11101100
#define CURRENCY_UNKNOWN 0b11101101
#define TILDE_N 0b11101110
#define UMLAUT_O 0b11101111
#define MATH_P 0b11110000
#define MATH_Q 0b11110001
#define MATH_THETA 0b11110010
#define MATH_INF 0b11110011
#define MATH_OMEGA 0b11110100
#define UMLAUT_U 0b11110101
#define MATH_SUM 0b11110110
#define MATH_PI 0b11110111
#define MATH_ABS_X 0b11111000
#define MATH_Y 0b11111001
#define JAPANESE_KANJI_SEN 0b11111010
#define JAPANESE_KANJI_MAN 0b11111011
#define JAPANESE_KANJI_YEN 0b11111100
#define MATH_DIVISION 0b11111101
#define CURSOR 0b11111111
#include <stdint.h>
@ -58,5 +149,6 @@ extern void resetPins(LCDScreen* screen);
extern void sendCommand(LCDScreen* screen, uint8_t command);
extern void sendData(LCDScreen* screen, uint8_t data);
extern void sendText(LCDScreen* screen, const char* text);
extern void sendChars(LCDScreen* screen, unsigned int len, ...);
#endif // RASPBERRY_LCD_H