Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
58884f5
fix missing comment after header guard trailers
mcendu Jan 15, 2025
21cde7c
fix missing stdint.h includes
mcendu Jan 15, 2025
ea0f538
move table definitions into source files
mcendu Jan 15, 2025
ae17fe4
fix missing Arduino.h include
mcendu Jan 15, 2025
771cd5c
fix formatting and silence various warnings
mcendu Jan 15, 2025
1b494e4
reformat entire codebase to LLVM coding guidelines
mcendu Jan 15, 2025
ef1770a
call into base class for katakana overrides
mcendu Jan 15, 2025
645a4cd
move large methods out of line
mcendu Jan 15, 2025
7187df9
improve library.properties doc
mcendu Jan 15, 2025
b242880
replace non-standard binary number literal with hex
mcendu Jan 15, 2025
1d47d45
fix dubious usage of increment operator
mcendu Jan 15, 2025
d3b6b26
drop avr compatibility
mcendu Jan 15, 2025
811673d
sort character tables and enable all characters
mcendu Jan 15, 2025
596587d
add pgmspace header
mcendu Jan 15, 2025
afb7832
convert ROMCharacterType tables to PROGMEM
mcendu Jan 15, 2025
188c2ad
convert kana diacritic table to PROGMEM
mcendu Jan 15, 2025
3f1a091
move CustomizedLanguage method implementations out of line
mcendu Jan 15, 2025
1978907
convert custom symbol tables to PROGMEM
mcendu Jan 15, 2025
92edb7c
move CGRAM character fallbacks out of line
mcendu Jan 15, 2025
38c181c
restore avr compatibility
mcendu Jan 15, 2025
fcbb655
delegate into base class for russian-latin getCharacter calls
mcendu Jan 15, 2025
16ee877
fix compiler warnings
mcendu Jan 15, 2025
4b94cdb
set longest word length for katakana to 10
mcendu Jan 16, 2025
5d95a66
sort rom maps in codepoint ascending order
mcendu Jan 16, 2025
bd3cbc2
binary search code mappings
mcendu Jan 16, 2025
0461702
use core-provided pgm macros instead
mcendu Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name=LiquidCrystal I2C Multilingual
version=2.0.2
author=Loc P. Le
maintainer=Loc P. Le <phuocloc@gmail.com>
sentence=For printing multilingual UTF8 strings (French, Russian, Vietnamese, Katakana, etc.) to LCD1602, LCD2004, etc. via I2C.
paragraph=Automatically move down and pause when printing long text. This is subclass of LiquidCrystal_I2C.
sentence=Display multilingual text on LCD text displays via I2C.
paragraph=Displays multilingual strings (French, Russian, Vietnamese, Katakana, etc.) encoded in UTF-8 on LCD text displays, e.g. LCD1602 and LCD2004, via I2C.
category=Display
url=https://github.com/locple/LCDI2C_Multilingual
architectures=avr,esp8266,esp32
Expand Down
23 changes: 23 additions & 0 deletions src/Custom/Symbols.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* SPDX-License-Identifier: MIT */

#include "Symbols.h"

PROGMEM const CustomCharacterType SymbolCustomLetters[SymbolCustomLetterNum] = {
{0x00B0,
{0b00000000, 0b01100000, 0b10010000, 0b10010000,
0b01100000}}, // ° (degreeF symbol)
{0x20AC,
{0b00101000, 0b01111100, 0b10101010, 0b10101010,
0b10000010}} // € (Euro sign)
};

uint8_t getAlternativeLetter(uint16_t c) {
switch (c) {
case 0x00B0: // degree symbol
return 0xDF;
case 0x20AC: // Euro sign
return 0x45;
default: // Input code point is not symbols!
return '*';
}
}
24 changes: 7 additions & 17 deletions src/Custom/Symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,24 @@
#ifndef Custom_Symbols_h
#define Custom_Symbols_h

#include "../base/LCDI2C_Types.h"
#include "../base/LCDI2C_Custom.h"
#include "../base/LCDI2C_Types.h"
#include <Arduino.h>

const uint8_t SymbolCustomLetterNum = 2;
// List of custom Unicode characters
CustomCharacterType SymbolCustomLetters [SymbolCustomLetterNum] = {
{0x00B0, {0b00000000,0b01100000,0b10010000,0b10010000,0b01100000}}, // ° (degree symbol)
{0x20AC, {0b00101000,0b01111100,0b10101010,0b10101010,0b10000010}} // € (Euro sign)
};
extern PROGMEM const CustomCharacterType
SymbolCustomLetters[SymbolCustomLetterNum];

class CustomizedSymbols : public CustomizedLanguage {
public:
CustomizedSymbols(LCDI2C_UTF8* lcd) : CustomizedLanguage(lcd) {
CustomizedSymbols(LCDI2C_UTF8 *lcd) : CustomizedLanguage(lcd) {
CustomLetterNum = SymbolCustomLetterNum;
CustomLetters = SymbolCustomLetters;
}

protected:
uint8_t getAlternativeLetter(uint16_t c) override {
switch (c) {
case 0x00B0: // degree symbol
return 0xDF;
case 0x20AC: // Euro sign
return 0x45;
default: // Input code point is not symbols!
return '*';
}
}
uint8_t getAlternativeLetter(uint16_t c) override;
};

#endif // Custom_Symbols_h
#endif // Custom_Symbols_h
Loading