|
@@ -225,7 +225,7 @@ HSA_LCD_Shield::HSA_LCD_Shield(const char config[CONFIG_SIZE]){
|
|
|
|
|
|
}
|
|
|
|
|
|
-HSA_LCD_Shield::HSA_LCD_Shield(){
|
|
|
+HSA_LCD_Shield::HSA_LCD_Shield(void){
|
|
|
|
|
|
// Save LCD-Shield version
|
|
|
this->__version = LCD_VERSION_6;
|
|
@@ -254,8 +254,11 @@ HSA_LCD_Shield::~HSA_LCD_Shield(void) {
|
|
|
|
|
|
bool HSA_LCD_Shield::begin(void) {
|
|
|
|
|
|
- // Configure GPIOs and exit
|
|
|
- return __gpioConfig();
|
|
|
+ // Configure GPIOs
|
|
|
+ this->__lcd = __gpioConfig();
|
|
|
+
|
|
|
+ // Exit function
|
|
|
+ return this->__lcd;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -264,26 +267,35 @@ bool HSA_LCD_Shield::begin(byte address) {
|
|
|
// Save I²C-Address of LC-Display
|
|
|
this->__i2cAddress = address;
|
|
|
|
|
|
- // Configure GPIOs and exit
|
|
|
- return __gpioConfig();
|
|
|
+ // Configure GPIOs
|
|
|
+ this->__lcd = __gpioConfig();
|
|
|
+
|
|
|
+ // Exit function
|
|
|
+ return this->__lcd;
|
|
|
|
|
|
}
|
|
|
|
|
|
//////////////////// LCD-Backlight ////////////////////
|
|
|
|
|
|
-void HSA_LCD_Shield::lcdBacklight(bool value) {
|
|
|
+bool HSA_LCD_Shield::lcdBacklight(bool value) {
|
|
|
+
|
|
|
+ // check, whether LCD is configured
|
|
|
+ if(this->__lcd == false) return false;
|
|
|
|
|
|
// Turning on/off LCD-Backlight
|
|
|
digitalWrite(this->__lcdBacklight,value);
|
|
|
|
|
|
// Exit function
|
|
|
- return;
|
|
|
+ return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
//////////////////// Clear Display ////////////////////
|
|
|
|
|
|
-void HSA_LCD_Shield::clearDisplay(void) {
|
|
|
+bool HSA_LCD_Shield::clearDisplay(void) {
|
|
|
+
|
|
|
+ // check, whether LCD is configured
|
|
|
+ if(this->__lcd == false) return false;
|
|
|
|
|
|
// Define an array of Bytes for clearing the Display
|
|
|
byte buffer[] = {CONTROL_BYTE_CB,
|
|
@@ -293,7 +305,7 @@ void HSA_LCD_Shield::clearDisplay(void) {
|
|
|
_sendMessage(buffer, sizeof(buffer));
|
|
|
|
|
|
// Exit function
|
|
|
- return;
|
|
|
+ return true;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -354,8 +366,10 @@ bool HSA_LCD_Shield::controlLED(byte ledPin, bool state) {
|
|
|
bool HSA_LCD_Shield::getLED(byte ledPin) {
|
|
|
|
|
|
// Exit function and return the value of chosen LED
|
|
|
- if(ledPin == LED_GREEN) return !digitalRead(this->__ledGreen);
|
|
|
- else if(ledPin == LED_RED) return !digitalRead(this->__ledRed);
|
|
|
+ if(ledPin == LED_GREEN && this->__leds)
|
|
|
+ return !digitalRead(this->__ledGreen);
|
|
|
+ else if(ledPin == LED_RED && this->__leds)
|
|
|
+ return !digitalRead(this->__ledRed);
|
|
|
else return false;
|
|
|
|
|
|
}
|
|
@@ -406,6 +420,9 @@ byte HSA_LCD_Shield::getButton() {
|
|
|
|
|
|
bool HSA_LCD_Shield::writeRow(byte row, const char* text) {
|
|
|
|
|
|
+ // check, whether LCD is configured
|
|
|
+ if(this->__lcd == false) return false;
|
|
|
+
|
|
|
// If chosen Row does not exist, exit function with error
|
|
|
if(!(row >= 0x01 && row <= 0x04)) return false;
|
|
|
|
|
@@ -462,7 +479,10 @@ bool HSA_LCD_Shield::writeRow(byte row, const char* text) {
|
|
|
|
|
|
bool HSA_LCD_Shield::writeRow(const char* text) {
|
|
|
|
|
|
- // Define buffer for test Message
|
|
|
+ // check, whether LCD is configured
|
|
|
+ if(this->__lcd == false) return false;
|
|
|
+
|
|
|
+ // Define buffer for test Message
|
|
|
char buffer[ARRAY_SIZE_ROW] = "";
|
|
|
|
|
|
// Define variable to store the actual row position
|
|
@@ -677,6 +697,9 @@ bool HSA_LCD_Shield::writeRow(const char* text) {
|
|
|
|
|
|
bool HSA_LCD_Shield::writeXY(byte row, byte column, const char* text) {
|
|
|
|
|
|
+ // check, whether LCD is configured
|
|
|
+ if(this->__lcd == false) return false;
|
|
|
+
|
|
|
// If chosen Row does not exist, exit function with error
|
|
|
if(!(row >= 0x01 && row <= 0x04)) return false;
|
|
|
|