Merge pull request #54 from jruys/master

Moved HD44780 RGB backlight logic control to .h file
This commit is contained in:
Jonathan Naylor 2016-05-06 23:48:26 +01:00
commit 6685a6e000
2 changed files with 26 additions and 25 deletions

View file

@ -107,44 +107,44 @@ void CHD44780::adafruitLCDColour(ADAFRUIT_COLOUR colour)
{ {
switch (colour) { switch (colour) {
case AC_OFF: case AC_OFF:
::digitalWrite(AF_RED, HIGH); ::digitalWrite(AF_RED, AF_OFF);
::digitalWrite(AF_GREEN, HIGH); ::digitalWrite(AF_GREEN, AF_OFF);
::digitalWrite(AF_BLUE, HIGH); ::digitalWrite(AF_BLUE, AF_OFF);
break; break;
case AC_WHITE: case AC_WHITE:
::digitalWrite(AF_RED, LOW); ::digitalWrite(AF_RED, AF_ON);
::digitalWrite(AF_GREEN, LOW); ::digitalWrite(AF_GREEN, AF_ON);
::digitalWrite(AF_BLUE, LOW); ::digitalWrite(AF_BLUE, AF_ON);
break; break;
case AC_RED: case AC_RED:
::digitalWrite(AF_RED, LOW); ::digitalWrite(AF_RED, AF_ON);
::digitalWrite(AF_GREEN, HIGH); ::digitalWrite(AF_GREEN, AF_OFF);
::digitalWrite(AF_BLUE, HIGH); ::digitalWrite(AF_BLUE, AF_OFF);
break; break;
case AC_GREEN: case AC_GREEN:
::digitalWrite(AF_RED, HIGH); ::digitalWrite(AF_RED, AF_OFF);
::digitalWrite(AF_GREEN, LOW); ::digitalWrite(AF_GREEN, AF_ON);
::digitalWrite(AF_BLUE, HIGH); ::digitalWrite(AF_BLUE, AF_OFF);
break; break;
case AC_BLUE: case AC_BLUE:
::digitalWrite(AF_RED, HIGH); ::digitalWrite(AF_RED, AF_OFF);
::digitalWrite(AF_GREEN, HIGH); ::digitalWrite(AF_GREEN, AF_OFF);
::digitalWrite(AF_BLUE, LOW); ::digitalWrite(AF_BLUE, AF_ON);
break; break;
case AC_PURPLE: case AC_PURPLE:
::digitalWrite(AF_RED, LOW); ::digitalWrite(AF_RED, AF_ON);
::digitalWrite(AF_GREEN, HIGH); ::digitalWrite(AF_GREEN, AF_OFF);
::digitalWrite(AF_BLUE, LOW); ::digitalWrite(AF_BLUE, AF_ON);
break; break;
case AC_YELLOW: case AC_YELLOW:
::digitalWrite(AF_RED, LOW); ::digitalWrite(AF_RED, AF_ON);
::digitalWrite(AF_GREEN, LOW); ::digitalWrite(AF_GREEN, AF_ON);
::digitalWrite(AF_BLUE, HIGH); ::digitalWrite(AF_BLUE, AF_OFF);
break; break;
case AC_ICE: case AC_ICE:
::digitalWrite(AF_RED, HIGH); ::digitalWrite(AF_RED, AF_OFF);
::digitalWrite(AF_GREEN, LOW); ::digitalWrite(AF_GREEN, AF_ON);
::digitalWrite(AF_BLUE, LOW); ::digitalWrite(AF_BLUE, AF_ON);
break; break;
default: default:
break; break;

View file

@ -44,7 +44,8 @@ enum ADAFRUIT_COLOUR {
#define AF_GREEN (AF_BASE + 7) #define AF_GREEN (AF_BASE + 7)
#define AF_BLUE (AF_BASE + 8) #define AF_BLUE (AF_BASE + 8)
#define AF_RW (AF_BASE + 14) #define AF_RW (AF_BASE + 14)
#define AF_RW (AF_BASE + 14) #define AF_ON LOW
#define AF_OFF HIGH
#define MCP23017 0x20 #define MCP23017 0x20
#endif #endif