arduino-libraries / LiquidCrystal

Liquid Crystal Library for Arduino
http://arduino.cc/
253 stars 170 forks source link

Entry mode flags are confusing #68

Open iflyhigh opened 1 year ago

iflyhigh commented 1 year ago

Current implementation is confusing. Entry mode set command uses 2 bits - lowest one is for disabling (0) or enabling (1) display shift, and shift direction is specified by second bit (0 shifts right, 1 shifts left). Second bit itself is used to increment (1) or decrement (0) the DDRAM address (cursor position) when new character is put to DDRAM.

Suggesting the following naming:

// flags for display entry mode
#define LCD_ENTRYSHIFTDISABLE 0x00
#define LCD_ENTRYSHIFTENABLE 0x01
#define LCD_ENTRYDECREMENTADDRESS 0x00
#define LCD_ENTRYINCREMENTADDRESS 0x02
#define LCD_ENTRYRIGHTTOLEFT LCD_ENTRYDECREMENTADDRESS
#define LCD_ENTRYLEFTTORIGHT LCD_ENTRYINCREMENTADDRESS