Support both 5x8 and 5x10 fonts
Added LCD_FONT in lcdLib.h which is the bitmask to enable 5x8 or 5x10 font when doing the function set instruction (in the definition of initLCD). LCD_FONT_5x8 or LCD_FONT_5x10 should be defined to enable the intended font. One always needs to be defined. Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
parent
7678470c3e
commit
c52292c802
4
lcdLib.c
4
lcdLib.c
|
@ -320,11 +320,11 @@ void initLCD(void) {
|
||||||
#if defined (FOUR_BIT_MODE)
|
#if defined (FOUR_BIT_MODE)
|
||||||
// Function Set (4-bit interface; 2 lines with 5x7 dot character font)
|
// Function Set (4-bit interface; 2 lines with 5x7 dot character font)
|
||||||
writeLCDDBusNibble_(CMD_INIT_FOUR_BIT);
|
writeLCDDBusNibble_(CMD_INIT_FOUR_BIT);
|
||||||
writeLCDInstr_(CMD_INIT_FOUR_BIT | (1 << INSTR_FUNC_SET_N));
|
writeLCDInstr_(CMD_INIT_FOUR_BIT | (1 << INSTR_FUNC_SET_N) | LCD_FONT);
|
||||||
#else
|
#else
|
||||||
// Function set (8-bit interface; 2 lines with 5x7 dot character font)
|
// Function set (8-bit interface; 2 lines with 5x7 dot character font)
|
||||||
// RS=RW=0, DBUS=b00111000,0x38
|
// RS=RW=0, DBUS=b00111000,0x38
|
||||||
writeLCDInstr_(INSTR_FUNC_SET | (1 << INSTR_FUNC_SET_DL) | (1 << INSTR_FUNC_SET_N));
|
writeLCDInstr_(INSTR_FUNC_SET | (1 << INSTR_FUNC_SET_DL) | (1 << INSTR_FUNC_SET_N) | LCD_FONT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BF now can be checked */
|
/* BF now can be checked */
|
||||||
|
|
12
lcdLib.h
12
lcdLib.h
|
@ -214,6 +214,18 @@ void initLCDByInternalReset(void);
|
||||||
#define LCD_CHARACTERS_PER_SCREEN (LCD_CHARACTERS_PER_LINE * LCD_NUMBER_OF_LINES)
|
#define LCD_CHARACTERS_PER_SCREEN (LCD_CHARACTERS_PER_LINE * LCD_NUMBER_OF_LINES)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(LCD_FONT_5x8) &&\
|
||||||
|
!defined(LCD_FONT_5x10)
|
||||||
|
#error "All modes require LCD_FONT_5x8 or LCD_FONT_5x10 to be defined."
|
||||||
|
#elif defined(LCD_FONT_5x8) && \
|
||||||
|
defined(LCD_FONT_5x10)
|
||||||
|
#error "LCD_FONT_5x8 and LCD_FONT_5x10 are mutually exclusive. Choose one."
|
||||||
|
#elif defined(LCD_FONT_5x8)
|
||||||
|
#define LCD_FONT 0
|
||||||
|
#elif defined(LCD_FONT_5x10)
|
||||||
|
#define LCD_FONT (1 << INSTR_FUNC_SET_F)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined (LCD_RS) || \
|
#if !defined (LCD_RS) || \
|
||||||
!defined (LCD_RS_PORT) || \
|
!defined (LCD_RS_PORT) || \
|
||||||
!defined (LCD_RS_DDR) || \
|
!defined (LCD_RS_DDR) || \
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
0x14, \
|
0x14, \
|
||||||
0x54 ///< Memory locations for each physical line ordered 1 to LCD_NUMBER_OF_LINES
|
0x54 ///< Memory locations for each physical line ordered 1 to LCD_NUMBER_OF_LINES
|
||||||
|
|
||||||
|
/* Which font to use (can only leave one uncommented) */
|
||||||
|
#define LCD_FONT_5x8
|
||||||
|
//#define LCD_FONT_5x10
|
||||||
|
|
||||||
/* Support ANSI escapes; comment to disable */
|
/* Support ANSI escapes; comment to disable */
|
||||||
#define LCD_ANSI_ESCAPE_ENABLE
|
#define LCD_ANSI_ESCAPE_ENABLE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue