Browse Source

Ferstigstellung der Funktionen: writeROW, writeXY, returnVersion

Tobias Müller 5 years ago
parent
commit
3350d0d33d
2 changed files with 547 additions and 409 deletions
  1. 305 326
      HSA_LCD_Shield.cpp
  2. 242 83
      HSA_LCD_Shield.h

+ 305 - 326
HSA_LCD_Shield.cpp

@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 // Programname: HSA_LCD_Shield - Code                                         //
-// Date: 23.04.2018                                                           //
+// Date: 16.11.2018                                                           //
 // Description: Code-File of the LCD-Shield, which was designed and built in  //
 //              the Modul "Elektronikdesign". In this file you can find the   //
 //              code of all functions mentioned in the Header-File of the     //
@@ -18,113 +18,60 @@
 #include "HSA_LCD_Shield.h"
 
 ////////////////////////////////////////////////////////////////////////////////
-////////////////////           Privat Functions             ////////////////////
+////////////////////          Protected Functions           ////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 
-////////////////////               Send Message             ////////////////////
+////////////////////           GPIO Configuration           ////////////////////
 
-void HSA_LCD_Shield::_sendMessage(byte* bytes, byte sizeBytes){
+bool HSA_LCD_Shield::__gpioConfig(void) {
 
-  // Small timeout before access the I²C-Bus
-  delayMicroseconds(DELAY_TRANS_US);
+  // Save Pin configuration, depending of LCD-Shield version
+  if(this->__version == LCD_VERSION_5) {
 
-  // Start I²C transmission
-  Wire.beginTransmission(this->__i2cAddress);
+    // Save Pin configuration for buttons
+    this->__buttonUp = BUTTON_UP_V5;
+    this->__buttonRight = BUTTON_RIGHT_V5;
+    this->__buttonDown = BUTTON_DOWN_V5;
+    this->__buttonLeft = BUTTON_LEFT_V5;
 
-  // Send an array of Bytes over I²C, depending of its size
-  for(byte i = 0x00; i < sizeBytes; i++) Wire.write(bytes[i]);
-
-  // Stop I²C transmission
-  Wire.endTransmission();
+    // Save Pin configuration for LEDs
+    this->__ledGreen = LED_GREEN_V5;
+    this->__ledRed = LED_RED_V5;
 
-  // Small timeout after access the I²C-Bus
-  delayMicroseconds(DELAY_TRANS_US);
-
-  // Exit function
-  return;
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////           Public Functions             ////////////////////
-////////////////////////////////////////////////////////////////////////////////
-
-////////////////////               Constructor              ////////////////////
-
-HSA_LCD_Shield::HSA_LCD_Shield(char address, const char config[0x05]) {
-  
-  // Save I²C-Address
-  this->__i2cAddress = address;
-
-  // Save the configuration of Buttons/LEDs
-  strcpy(this->__config,config);
-
-  // Exit Constructor
-  return;
-
-}
-
-HSA_LCD_Shield::HSA_LCD_Shield(char address) {
-
-  // Save I²C-Address
-  this->__i2cAddress = address;
-
-  // Save the configuration of Buttons/LEDs
-  strcpy(this->__config,CONFIG_L1B1);
+    // Save Pin configuration for LCD-Backlight
+    this->__lcdBacklight = LCD_BACKLIGHT_V5;
 
-  // Exit Constructor
-  return;
-
-}
-
-HSA_LCD_Shield::HSA_LCD_Shield(const char config[0x05]){
-
-  // Save I²C-Address
-  this->__i2cAddress = I2C_ADDRESS;
-
-  // Save the configuration of Buttons/LEDs
-  strcpy(this->__config,config);
-
-  // Exit Constructor
-  return;
-
-}
-
-HSA_LCD_Shield::HSA_LCD_Shield(){
-
-  // Save I²C-Address
-  this->__i2cAddress = I2C_ADDRESS;
-
-  // Save the configuration of Buttons/LEDs
-  strcpy(this->__config,CONFIG_L1B1);
-
-  // Exit Constructor
-  return;
+  }
 
-}
+  else if(this->__version == LCD_VERSION_6) {
 
-////////////////////             Deconstructor              ////////////////////
-
-HSA_LCD_Shield::~HSA_LCD_Shield(void) {
+    // Save Pin configuration for buttons
+    this->__buttonUp = BUTTON_UP_V6;
+    this->__buttonRight = BUTTON_RIGHT_V6;
+    this->__buttonDown = BUTTON_DOWN_V6;
+    this->__buttonLeft = BUTTON_LEFT_V6;
 
-  // Exit function
-  return;
+    // Save Pin configuration for LEDs
+    this->__ledGreen = LED_GREEN_V6;
+    this->__ledRed = LED_RED_V6;
 
-}
+    // Save Pin configuration for LCD-Backlight
+    this->__lcdBacklight = LCD_BACKLIGHT_V6;
 
-////////////////////          Start Configuration           ////////////////////
+  }
 
-bool HSA_LCD_Shield::begin(void) {
+  // If LCD-Shield version is unknown, exit function with error
+  else return false;
 
   // Check config-value and setup the LEDs, depending of config-value
   if(strcmp(this->__config,CONFIG_L1B0) == false || 
     strcmp(this->__config,CONFIG_L1B1) == false) {
     
     // Setup LEDs
-    pinMode(LED_GREEN,OUTPUT);
-    pinMode(LED_RED,OUTPUT);
-    digitalWrite(LED_GREEN,HIGH);
-    digitalWrite(LED_RED,HIGH);
+    pinMode(this->__ledGreen,OUTPUT);
+    pinMode(this->__ledRed,OUTPUT);
+    digitalWrite(this->__ledGreen,HIGH);
+    digitalWrite(this->__ledRed,HIGH);
 
     // Store the value "true", if LEDs are configured
     this->__leds = true;
@@ -142,10 +89,10 @@ bool HSA_LCD_Shield::begin(void) {
     strcmp(this->__config,CONFIG_L1B1) == false) {
     
     // Setup Buttons
-    pinMode(BUTTON_UP,INPUT);
-    pinMode(BUTTON_RIGHT,INPUT);
-    pinMode(BUTTON_DOWN,INPUT);
-    pinMode(BUTTON_LEFT,INPUT);
+    pinMode(this->__buttonUp,INPUT);
+    pinMode(this->__buttonRight,INPUT);
+    pinMode(this->__buttonDown,INPUT);
+    pinMode(this->__buttonLeft,INPUT);
 
     // Store the value "true", if buttons are configured
     this->__buttons = true;
@@ -158,23 +105,18 @@ bool HSA_LCD_Shield::begin(void) {
     
   }
 
-  // If config-value is unknown, quit configuration, otherwise configure I²C
+  // If config-value is unknown, quit configuration, otherwise configure Display
   if(strcmp(this->__config,CONFIG_L1B1) != false &&
     strcmp(this->__config,CONFIG_L0B1) != false &&
     strcmp(this->__config,CONFIG_L1B0) != false &&
-    strcmp(this->__config,CONFIG_L0B0) != false) {
-
-    // Store the value false for buttons and LEDs are not configured
-    this->__buttons = false;
-    this->__leds = false;
-
-    // If config-value unknown, exit function with negative feedback
-    return false;
+    strcmp(this->__config,CONFIG_L0B0) != false) return false;
 
-  }
   else {
 
-    // Initialize I²C
+    // Setup LCD-Backlight
+    pinMode(this->__lcdBacklight,OUTPUT);
+
+    // Initialize I²C as Master
     Wire.begin();
 
     // Define an array of Bytes for configure the Display
@@ -201,269 +143,262 @@ bool HSA_LCD_Shield::begin(void) {
   }
 }
 
-////////////////////             LCD-Backlight              ////////////////////
+////////////////////////////////////////////////////////////////////////////////
+////////////////////           Privat Functions             ////////////////////
+////////////////////////////////////////////////////////////////////////////////
 
-void HSA_LCD_Shield::lcdBacklight(bool value) {
+////////////////////               Send Message             ////////////////////
 
-  // Turning on/off LCD-Backlight
-  digitalWrite(LCD_BACKLIGHT,value);
+void HSA_LCD_Shield::_sendMessage(byte* bytes, byte sizeBytes) {
 
-  // Exit function
-  return;
+  // Small timeout before access the I²C-Bus
+  delayMicroseconds(DELAY_TRANS_US);
 
-}
+  // Start I²C transmission
+  Wire.beginTransmission(this->__i2cAddress);
 
-////////////////////             Clear Display              ////////////////////
+  // Send an array of Bytes over I²C, depending of its size
+  for(byte i = 0x00; i < sizeBytes; i++) Wire.write(bytes[i]);
 
-void HSA_LCD_Shield::clearDisplay(void) {
+  // Stop I²C transmission
+  Wire.endTransmission();
 
-  // Define an array of Bytes for clearing the Display
-  byte buffer[] = {CONTROL_BYTE_CB,
-                   LCD_PARA_CLR_DIS};
-  
-  // Send array of bytes
-  _sendMessage(buffer, sizeof(buffer));
+  // Small timeout after access the I²C-Bus
+  delayMicroseconds(DELAY_TRANS_US);
 
   // Exit function
   return;
 
 }
 
+////////////////////////////////////////////////////////////////////////////////
+////////////////////           Public Functions             ////////////////////
+////////////////////////////////////////////////////////////////////////////////
 
-////////////////////             Return Config              ////////////////////
+////////////////////               Constructor              ////////////////////
 
-char* HSA_LCD_Shield::returnConfig(void) {
+HSA_LCD_Shield::HSA_LCD_Shield(byte version, const char config[CONFIG_SIZE]) {
+  
+  // Save LCD-Shield version
+  this->__version = version;
 
-  // Exit function and return the configuration value
-  return this->__config;
+  // Save the configuration of Buttons/LEDs
+  strcpy(this->__config,config);
+
+  // Exit Constructor
+  return;
 
 }
 
-////////////////////            Return I²C-Address          ////////////////////
+HSA_LCD_Shield::HSA_LCD_Shield(byte version) {
 
-char HSA_LCD_Shield::returnAddress(void){
+  // Save LCD-Shield version
+  this->__version = version;
 
-  // Exit function and return the value of the I²C-Address
-  return this->__i2cAddress;
+  // Save the configuration of Buttons/LEDs
+  strcpy(this->__config,CONFIG_L1B1);
+
+  // Exit Constructor
+  return;
 
 }
 
-////////////////////               Control LEDs             ////////////////////
+HSA_LCD_Shield::HSA_LCD_Shield(const char config[CONFIG_SIZE]){
 
-void HSA_LCD_Shield::controlLed(char ledPin, bool state) {
+  // Save LCD-Shield version
+  this->__version = LCD_VERSION_6;
 
-  // Change state of a LED, if they are configured
-  if(this->__leds) digitalWrite(ledPin,!state);
+  // Save the configuration of Buttons/LEDs
+  strcpy(this->__config,config);
 
-  // Exit function
+  // Exit Constructor
   return;
 
 }
 
-////////////////////          Get the pressed Button        ////////////////////
-
-char HSA_LCD_Shield::getButton() {
-
-  // return 1, if only button "Up" is pressed and configured
-  if(digitalRead(BUTTON_UP) &&
-     !digitalRead(BUTTON_RIGHT) &&
-     !digitalRead(BUTTON_DOWN) &&
-     !digitalRead(BUTTON_LEFT) &&
-     this->__buttons)
-     return BUTTON_UP;
-  
-  // return 2, if only button "Right" is pressed and configured
-  if(!digitalRead(BUTTON_UP) &&
-     digitalRead(BUTTON_RIGHT) &&
-     !digitalRead(BUTTON_DOWN) &&
-     !digitalRead(BUTTON_LEFT) &&
-     this->__buttons)
-     return BUTTON_RIGHT;
+HSA_LCD_Shield::HSA_LCD_Shield(){
 
-  // return 3, if only button "Down" is pressed and configured
-  if(!digitalRead(BUTTON_UP) &&
-     !digitalRead(BUTTON_RIGHT) &&
-     digitalRead(BUTTON_DOWN) &&
-     !digitalRead(BUTTON_LEFT) &&
-     this->__buttons)
-     return BUTTON_DOWN;
+  // Save LCD-Shield version
+  this->__version = LCD_VERSION_6;
 
-  // return 4, if only button "Left" is pressed and configured
-  if(!digitalRead(BUTTON_UP) &&
-     !digitalRead(BUTTON_RIGHT) &&
-     !digitalRead(BUTTON_DOWN) &&
-     digitalRead(BUTTON_LEFT) &&
-     this->__buttons)
-     return BUTTON_LEFT;
+  // Save the configuration of Buttons/LEDs
+  strcpy(this->__config,CONFIG_L1B1);
 
-  // return false, if no button or more than one button is pressed
-  return false;
+  // Exit Constructor
+  return;
 
 }
 
-////////////////////                Write Row 1             ////////////////////
-
-void HSA_LCD_Shield::writeRow1(const char* bytes) {
-
-  // Define buffer for test Message
-  byte buffer[ARRAY_SIZE_ROW] = ""; 
+////////////////////             Deconstructor              ////////////////////
 
-  // Define variable to store a boolean value, if a control-byte was found
-  bool controlByte = false; 
+HSA_LCD_Shield::~HSA_LCD_Shield(void) {
 
-  // Create data-array with message and send the message at the end
-  for(byte i = 0x00; i <= ARRAY_SIZE_ROW; i++){
+  // Exit function
+  return;
 
-    // Set control-byte for changing parameter in the first iteration
-    if(i == 0x00) buffer[i] = CONTROL_BYTE_CB;
+}
 
-    // Change the cursor position to row 1 in the second iteration
-    if(i == 0x01) buffer[i] = LCD_PARA_DIS_ROW1;
+////////////////////          Start Configuration           ////////////////////
 
-    // Set control-byte for writing to the display in the third iteration
-    if(i == 0x02) buffer[i] = CONTROL_BYTE_DCB;
+bool HSA_LCD_Shield::begin(void) {
 
-    // Copy bytes into the buffer between iteration 2 to 13
-    if(i > 0x02 && i < ARRAY_SIZE_ROW) {
+  // Save standard I²C-Address of LC-Display
+  this->__i2cAddress = I2C_ADDRESS;
 
-      // If no control-byte was found, copy byte into buffer
-      if(!controlByte) {
+  // Configure GPIOs and exit
+  return __gpioConfig();
+  
+}
 
-        // Check byte for control-byte, if not, copy byte into buffer
-        if(isControl(bytes[i - 0x03])) controlByte = true;
-        else buffer[i] = bytes[i - 0x03];
+bool HSA_LCD_Shield::begin(byte address) {
 
-      }
+  // Save I²C-Address of LC-Display
+  this->__i2cAddress = address;
 
-      // If control-byte was found, fill message with free space
-      if(controlByte) {
-        
-        // Fill Buffer with free space
-        buffer[i] = FREE_SPACE;
+  // Configure GPIOs and exit
+  return __gpioConfig();
+  
+}
 
-      }
-    }
+////////////////////             LCD-Backlight              ////////////////////
 
-    // Send message in the last iteration
-    if(i == ARRAY_SIZE_ROW) _sendMessage(buffer,sizeof(buffer));
+void HSA_LCD_Shield::lcdBacklight(bool value) {
 
-  }
+  // Turning on/off LCD-Backlight
+  digitalWrite(this->__lcdBacklight,value);
 
   // Exit function
   return;
 
 }
 
-////////////////////                Write Row 2             ////////////////////
-
-void HSA_LCD_Shield::writeRow2(const char* bytes) {
+////////////////////             Clear Display              ////////////////////
 
-  // Define buffer for test Message
-  byte buffer[ARRAY_SIZE_ROW] = ""; 
+void HSA_LCD_Shield::clearDisplay(void) {
 
-  // Define variable to store a boolean value, if a control-byte was found
-  bool controlByte = false; 
+  // Define an array of Bytes for clearing the Display
+  byte buffer[] = {CONTROL_BYTE_CB,
+                   LCD_PARA_CLR_DIS};
+  
+  // Send array of bytes
+  _sendMessage(buffer, sizeof(buffer));
 
-  // Create data-array with message and send the message at the end
-  for(byte i = 0x00; i <= ARRAY_SIZE_ROW; i++){
+  // Exit function
+  return;
 
-    // Set control-byte for changing parameter in the first iteration
-    if(i == 0x00) buffer[i] = CONTROL_BYTE_CB;
+}
 
-    // Change the cursor position to row 2 in the second iteration
-    if(i == 0x01) buffer[i] = LCD_PARA_DIS_ROW2;
+///////////////////             Return Version              ////////////////////
 
-    // Set control-byte for writing to the display in the third iteration
-    if(i == 0x02) buffer[i] = CONTROL_BYTE_DCB;
+byte HSA_LCD_Shield::returnVersion(void) {
 
-    // Copy bytes into the buffer between iteration 2 to 13
-    if(i > 0x02 && i < ARRAY_SIZE_ROW) {
+  // Exit function and return the configured Version for the LCD-Shield
+  return this->__version;
 
-      // If no control-byte was found, copy byte into buffer
-      if(!controlByte) {
+}
 
-        // Check byte for control-byte, if not, copy byte into buffer
-        if(isControl(bytes[i - 0x03])) controlByte = true;
-        else buffer[i] = bytes[i - 0x03];
+////////////////////             Return Config              ////////////////////
 
-      }
+char* HSA_LCD_Shield::returnConfig(void) {
 
-      // If control-byte was found, fill message with free space
-      if(controlByte) {
-        
-        // Fill Buffer with free space
-        buffer[i] = FREE_SPACE;
+  // Exit function and return the configuration value
+  return this->__config;
 
-      }
-    }
+}
 
-    // Send message in the last iteration
-    if(i == ARRAY_SIZE_ROW) _sendMessage(buffer,sizeof(buffer));
+////////////////////            Return I²C-Address          ////////////////////
 
-  }
+byte HSA_LCD_Shield::returnAddress(void){
 
-  // Exit function
-  return;
+  // Exit function and return the value of the I²C-Address
+  return this->__i2cAddress;
 
 }
 
-////////////////////                Write Row 3             ////////////////////
-
-void HSA_LCD_Shield::writeRow3(const char* bytes) {
+////////////////////               Control LEDs             ////////////////////
 
-  // Define buffer for test Message
-  byte buffer[ARRAY_SIZE_ROW] = ""; 
+bool HSA_LCD_Shield::controlLED(char ledPin, bool state) {
 
-  // Define variable to store a boolean value, if a control-byte was found
-  bool controlByte = false; 
+  // Checks, whether LED-Pins are configured
+  if(this->__leds) {
 
-  // Create data-array with message and send the message at the end
-  for(byte i = 0x00; i <= ARRAY_SIZE_ROW; i++){
+    // Checks, whether LED-Color is known and control LED
+    if(ledPin == LED_GREEN) {
+      digitalWrite(this->__ledGreen,!state); 
+      return true;
+    }
 
-    // Set control-byte for changing parameter in the first iteration
-    if(i == 0x00) buffer[i] = CONTROL_BYTE_CB;
+    if(ledPin == LED_RED) {
+      digitalWrite(this->__ledRed,!state); 
+      return true; 
+    }
+  }
+  
+  // Exit function with error, if LED-Pins are not configured or LED-Color is 
+  // unknown
+  return false;
 
-    // Change the cursor position to row 3 in the second iteration
-    if(i == 0x01) buffer[i] = LCD_PARA_DIS_ROW3;
+}
 
-    // Set control-byte for writing to the display in the third iteration
-    if(i == 0x02) buffer[i] = CONTROL_BYTE_DCB;
+////////////////////               Get LED state            ////////////////////
 
-    // Copy bytes into the buffer between iteration 2 to 13
-    if(i > 0x02 && i < ARRAY_SIZE_ROW) {
+bool HSA_LCD_Shield::getLED(char ledPin) {
 
-      // If no control-byte was found, copy byte into buffer
-      if(!controlByte) {
+  // 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);
+  else return false;
 
-        // Check byte for control-byte
-        if(isControl(bytes[i - 0x03])) controlByte = true;
+}
 
-        // If not, copy byte into buffer
-        else buffer[i] = bytes[i - 0x03];
+////////////////////          Get the pressed Button        ////////////////////
 
-      }
+byte HSA_LCD_Shield::getButton() {
 
-      // If control-byte was found, fill message with free space
-      if(controlByte) {
-        
-        // Fill Buffer with free space
-        buffer[i] = FREE_SPACE;
+  // return 1, if only button "Up" is pressed and configured
+  if(digitalRead(this->__buttonUp) &&
+     !digitalRead(this->__buttonRight) &&
+     !digitalRead(this->__buttonDown) &&
+     !digitalRead(this->__buttonLeft) &&
+     this->__buttons)
+     return BUTTON_UP;
+  
+  // return 2, if only button "Right" is pressed and configured
+  if(!digitalRead(this->__buttonUp) &&
+     digitalRead(this->__buttonRight) &&
+     !digitalRead(this->__buttonDown) &&
+     !digitalRead(this->__buttonLeft) &&
+     this->__buttons)
+     return BUTTON_RIGHT;
 
-      }
-    }
+  // return 3, if only button "Down" is pressed and configured
+  if(!digitalRead(this->__buttonUp) &&
+     !digitalRead(this->__buttonRight) &&
+     digitalRead(this->__buttonDown) &&
+     !digitalRead(this->__buttonLeft) &&
+     this->__buttons)
+     return BUTTON_DOWN;
 
-    // Send message in the last iteration
-    if(i == ARRAY_SIZE_ROW) _sendMessage(buffer,sizeof(buffer));
+  // return 4, if only button "Left" is pressed and configured
+  if(!digitalRead(this->__buttonUp) &&
+     !digitalRead(this->__buttonRight) &&
+     !digitalRead(this->__buttonDown) &&
+     digitalRead(this->__buttonLeft) &&
+     this->__buttons)
+     return BUTTON_LEFT;
 
-  }
+  // return false, if no button or more than one button is pressed or
+  // buttons are not configured
+  return false;
 
-  // Exit function
-  return;
 }
 
-////////////////////                Write Row 4             ////////////////////
+////////////////////                 Write Row              ////////////////////
+
+bool HSA_LCD_Shield::writeRow(byte row, const char* text) {
 
-void HSA_LCD_Shield::writeRow4(const char* bytes) {
+  // If chosen Row does not exist, exit function with error
+  if(!(row >= 0x01 && row <= 0x04)) return false;
 
   // Define buffer for test Message
   byte buffer[ARRAY_SIZE_ROW] = ""; 
@@ -472,29 +407,31 @@ void HSA_LCD_Shield::writeRow4(const char* bytes) {
   bool controlByte = false; 
 
   // Create data-array with message and send the message at the end
-  for(byte i = 0x00; i <= ARRAY_SIZE_ROW; i++){
+  for(byte i = 0x00; i < ARRAY_SIZE_ROW; i++) {
 
     // Set control-byte for changing parameter in the first iteration
     if(i == 0x00) buffer[i] = CONTROL_BYTE_CB;
 
-    // Change the cursor position to row 4 in the second iteration
-    if(i == 0x01) buffer[i] = LCD_PARA_DIS_ROW4;
+    // Change the cursor position to row in the second iteration.
+    if(i == 0x01 && row == 0x01) buffer[i] = LCD_PARA_DIS_ROW1;
+    if(i == 0x01 && row == 0x02) buffer[i] = LCD_PARA_DIS_ROW2;
+    if(i == 0x01 && row == 0x03) buffer[i] = LCD_PARA_DIS_ROW3;
+    if(i == 0x01 && row == 0x04) buffer[i] = LCD_PARA_DIS_ROW4;
 
     // Set control-byte for writing to the display in the third iteration
     if(i == 0x02) buffer[i] = CONTROL_BYTE_DCB;
 
-    // Copy bytes into the buffer between iteration 2 to 13
+    // Copy text into the buffer between iteration 2 to 13
     if(i > 0x02 && i < ARRAY_SIZE_ROW) {
 
       // If no control-byte was found, copy byte into buffer
       if(!controlByte) {
 
         // Check byte for control-byte
-        if(isControl(bytes[i - 0x03])) controlByte = true;
+        if(isControl(text[i - 0x03])) controlByte = true;
 
         // if not, copy byte into buffer
-        else buffer[i] = bytes[i - 0x03];
-
+        else buffer[i] = text[i - 0x03];
       }
 
       // If control-byte was found, fill message with free space
@@ -502,25 +439,21 @@ void HSA_LCD_Shield::writeRow4(const char* bytes) {
         
         // Fill Buffer with free space
         buffer[i] = FREE_SPACE;
-
       }
     }
-
-    // Send message in the last iteration
-    if(i == ARRAY_SIZE_ROW) _sendMessage(buffer,sizeof(buffer));
-
   }
 
-  // Exit function
-  return;
+  // Send message 
+  _sendMessage(buffer,sizeof(buffer));
 
-}
+  // Exit function with success
+  return true;
 
-////////////////////                Write 4 Rows            ////////////////////
+}
 
-void HSA_LCD_Shield::write4Rows(const char* bytes) {
+bool HSA_LCD_Shield::writeRow(const char* text) {
 
-  // Define buffer for test Message
+    // Define buffer for test Message
   char buffer[ARRAY_SIZE_ROW] = ""; 
 
   // Define variable to store the actual row position
@@ -539,20 +472,20 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
     if(rowPosition == LCD_PARA_DIS_ROW1) {
 
       // If counted bytes has not reach max value, copy byte into buffer
-      if(countBytes < 0x0A) buffer[countBytes] = bytes[i];
+      if(countBytes < 0x0A) buffer[countBytes] = text[i];
 
       // Check, if copied byte was control-byte
-      if(isControl(bytes[i])) {
+      if(isControl(text[i])) {
         
         // Check if control-byte was \n or \r or end of string, 
         // set counted bytes to max value
-        if(bytes[i] == BACKSLASH_N || 
-           bytes[i] == BACKSLASH_R ||
-           bytes[i] == STRING_END) 
+        if(text[i] == BACKSLASH_N || 
+           text[i] == BACKSLASH_R ||
+           text[i] == STRING_END) 
            countBytes = 0x0A;
 
         // Check if control-byte was end of the string, deactivate row position
-        if(bytes[i] == STRING_END) rowPosition = false;
+        if(text[i] == STRING_END) rowPosition = false;
         
       }
 
@@ -566,15 +499,15 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
         countBytes = 0x00;
 
         // write first row
-        writeRow1(buffer);
+        writeRow(0x01, buffer);
 
         // If row position is deactivated
         if(rowPosition == false) {
 
           // clear following rows
-          writeRow2(&bytes[i]);
-          writeRow3(&bytes[i]);
-          writeRow4(&bytes[i]);
+          writeRow(0x02, &text[i]);
+          writeRow(0x03, &text[i]);
+          writeRow(0x04, &text[i]);
 
         }
         
@@ -591,20 +524,20 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
     if(rowPosition == LCD_PARA_DIS_ROW2) {
 
       // If counted bytes has not reach max value, copy byte into buffer
-      if(countBytes < 0x0A) buffer[countBytes] = bytes[i];
+      if(countBytes < 0x0A) buffer[countBytes] = text[i];
 
       // Check, if copied byte was control-byte
-      if(isControl(bytes[i])) {
+      if(isControl(text[i])) {
         
         // Check if control-byte was \n or \r or end of string, 
         // set counted bytes to max value
-        if(bytes[i] == BACKSLASH_N || 
-           bytes[i] == BACKSLASH_R ||
-           bytes[i] == STRING_END) 
+        if(text[i] == BACKSLASH_N || 
+           text[i] == BACKSLASH_R ||
+           text[i] == STRING_END) 
            countBytes = 0x0A;
 
         // Check if control-byte was end of the string, deactivate row position
-        if(bytes[i] == STRING_END) rowPosition = false;
+        if(text[i] == STRING_END) rowPosition = false;
         
       }
 
@@ -618,14 +551,14 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
         countBytes = 0x00;
 
         // write second row
-        writeRow2(buffer);
+        writeRow(0x02, buffer);
 
         // If row position is deactivated
         if(rowPosition == false) {
 
           // clear following rows
-          writeRow3(&bytes[i]);
-          writeRow4(&bytes[i]);
+          writeRow(0x03, &text[i]);
+          writeRow(0x04, &text[i]);
 
         }
         
@@ -642,20 +575,20 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
     if(rowPosition == LCD_PARA_DIS_ROW3) {
 
       // If counted bytes has not reach max value, copy byte into buffer
-      if(countBytes < 0x0A) buffer[countBytes] = bytes[i];
+      if(countBytes < 0x0A) buffer[countBytes] = text[i];
 
       // Check, if copied byte was control-byte
-      if(isControl(bytes[i])) {
+      if(isControl(text[i])) {
         
         // Check if control-byte was \n or \r or end of string, 
         // set counted bytes to max value
-        if(bytes[i] == BACKSLASH_N || 
-           bytes[i] == BACKSLASH_R ||
-           bytes[i] == STRING_END) 
+        if(text[i] == BACKSLASH_N || 
+           text[i] == BACKSLASH_R ||
+           text[i] == STRING_END) 
            countBytes = 0x0A;
 
         // Check if control-byte was end of the string, deactivate row position
-        if(bytes[i] == STRING_END) rowPosition = false;
+        if(text[i] == STRING_END) rowPosition = false;
         
       }
 
@@ -669,10 +602,10 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
         countBytes = 0x00;
 
         // write third row
-        writeRow3(buffer);
+        writeRow(0x03, buffer);
 
         // If row position is deactivated, clear following row
-        if(rowPosition == false) writeRow4(&bytes[i]);
+        if(rowPosition == false) writeRow(0x04, &text[i]);
 
         // Otherwise set row position the row 4
         else rowPosition = LCD_PARA_DIS_ROW4;
@@ -687,20 +620,20 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
     if(rowPosition == LCD_PARA_DIS_ROW4) {
 
       // If counted bytes has not reach max value, copy byte into buffer
-      if(countBytes < 0x0A) buffer[countBytes] = bytes[i];
+      if(countBytes < 0x0A) buffer[countBytes] = text[i];
 
       // Check, if copied byte was control-byte
-      if(isControl(bytes[i])) {
+      if(isControl(text[i])) {
         
         // Check if control-byte was \n or \r or end of string, 
         // set counted bytes to max value
-        if(bytes[i] == BACKSLASH_N || 
-           bytes[i] == BACKSLASH_R ||
-           bytes[i] == STRING_END) 
+        if(text[i] == BACKSLASH_N || 
+           text[i] == BACKSLASH_R ||
+           text[i] == STRING_END) 
            countBytes = 0x0A;
 
         // Check if control-byte was end of the string, deactivate row position
-        if(bytes[i] == STRING_END) rowPosition = false;
+        if(text[i] == STRING_END) rowPosition = false;
         
       }
 
@@ -714,7 +647,7 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
         countBytes = 0x00;
 
         // write fourth row
-        writeRow4(buffer);
+        writeRow(0x04, buffer);
 
         // If row position is not deactivated, deaktivate row position
         if(rowPosition != false) rowPosition = false;
@@ -727,6 +660,52 @@ void HSA_LCD_Shield::write4Rows(const char* bytes) {
   }
 
   // Exit function
-  return;
+  return true;
+
+}
+
+////////////////////             Write Position XY          ////////////////////
+
+bool HSA_LCD_Shield::writeXY(byte row, byte column, const char* text) {
+
+  // If chosen Row does not exist, exit function with error
+  if(!(row >= 0x01 && row <= 0x04)) return false;
+
+  // If chosen Column does not exist, exit function with error
+  if(!(column >= 0x01 && column <= 0x0A)) return false;
+
+  // create variable to store count of chars
+  byte count = 0x00;
+
+  // Count chars inside of text
+  for(byte i = 0x00; i < 0x0A && !isControl(text[i]); i++) count++;
+
+  // Define buffer for text Message
+  byte buffer[ARRAY_SIZE_ROW - (0x0A - count)] = ""; 
+
+  // Create data-array with message and send the message at the end
+  for(byte i = 0x00; i < sizeof(buffer); i++) {
+
+    // Set control-byte for changing parameter in the first iteration
+    if(i == 0x00) buffer[i] = CONTROL_BYTE_CB;
+
+    // Change the cursor position to row/column in the second iteration.
+    if(i == 0x01 && row == 0x01) buffer[i] = LCD_PARA_DIS_ROW1 | (column - 0x01);
+    if(i == 0x01 && row == 0x02) buffer[i] = LCD_PARA_DIS_ROW2 | (column - 0x01);
+    if(i == 0x01 && row == 0x03) buffer[i] = LCD_PARA_DIS_ROW3 | (column - 0x01);
+    if(i == 0x01 && row == 0x04) buffer[i] = LCD_PARA_DIS_ROW4 | (column - 0x01);
+
+    // Set control-byte for writing to the display
+     if(i == 0x02) buffer[i] = CONTROL_BYTE_DCB;
+
+    // Copy text into the buffer between iteration 2 to 13
+    if(i >= 0x03 && i < sizeof(buffer)) buffer[i] = text[i - 0x03];
+  }
+
+  // Send message 
+  _sendMessage(buffer,sizeof(buffer));
+
+  // Exit function with success
+  return true;
 
 }

+ 242 - 83
HSA_LCD_Shield.h

@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 // Programname: HSA_LCD_Shield - Header                                       //
-// Date: 23.04.2018                                                           //
+// Date: 16.11.2018                                                           //
 // Description: Header-File of the LCD-Shield, which was designed and built   //
 //              in the Modul "Elektronikdesign". In this file you can find    //
 //              the description of all functions of the class HSA_LCD_Shield. //
@@ -18,77 +18,98 @@
 #define HSA_LCD_SHIELD
 
 ////////////////////////////////////////////////////////////////////////////////
-////////////////////             Define Symbol              ////////////////////
+////////////////////             Privat Symbols             ////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 
-// I²C Addresse (Default)
-#ifndef I2C_ADDRESS
-#define I2C_ADDRESS 0x3C
-#endif
+////////////////////          Pin-Config Version 5          ////////////////////
 
 // Button Right
-#ifndef BUTTON_RIGHT
-#define BUTTON_RIGHT 0x02
+#ifndef BUTTON_RIGHT_V5
+#define BUTTON_RIGHT_V5 0x02
 #endif
 
 // Button Down
-#ifndef BUTTON_DOWN
-#define BUTTON_DOWN 0x03
+#ifndef BUTTON_DOWN_V5
+#define BUTTON_DOWN_V5 0x03
 #endif
 
 // Button Up
-#ifndef BUTTON_UP
-#define BUTTON_UP 0x04
+#ifndef BUTTON_UP_V5
+#define BUTTON_UP_V5 0x04
 #endif
 
 // Button Left
-#ifndef BUTTON_LEFT
-#define BUTTON_LEFT 0x05
+#ifndef BUTTON_LEFT_V5
+#define BUTTON_LEFT_V5 0x05
 #endif
 
 // LED Red
-#ifndef LED_RED
-#define LED_RED 0x06
+#ifndef LED_RED_V5
+#define LED_RED_V5 0x06
 #endif
 
 // LED Green
-#ifndef LED_GREEN
-#define LED_GREEN 0x07
+#ifndef LED_GREEN_V5
+#define LED_GREEN_V5 0x07
 #endif
 
 // LCD-Backlight
-#ifndef LCD_BACKLIGHT
-#define LCD_BACKLIGHT 0x08
+#ifndef LCD_BACKLIGHT_V5
+#define LCD_BACKLIGHT_V5 0x08
 #endif
 
-// Config: LEDs = On, Buttons = On (Default)
-#ifndef CONFIG_L1B1
-#define CONFIG_L1B1 "L1B1"
+////////////////////          Pin-Config Version 6          ////////////////////
+
+// Button Right
+#ifndef BUTTON_RIGHT_V6
+#define BUTTON_RIGHT_V6 0x02
 #endif
 
-// Config: LEDs = On, Buttons = Off
-#ifndef CONFIG_L1B0
-#define CONFIG_L1B0 "L1B0"
+// Button Down
+#ifndef BUTTON_DOWN_V6
+#define BUTTON_DOWN_V6 0x03
 #endif
 
-// Config: LEDs = Off, Buttons = On
-#ifndef CONFIG_L0B1
-#define CONFIG_L0B1 "L0B1"
+// Button Up
+#ifndef BUTTON_UP_V6
+#define BUTTON_UP_V6 0x05
 #endif
 
-// Config: LEDs = Off, Buttons = Off
-#ifndef CONFIG_L0B0
-#define CONFIG_L0B0 "L0B0"
+// Button Left
+#ifndef BUTTON_LEFT_V6
+#define BUTTON_LEFT_V6 0x06
 #endif
 
-// Control Byte: Continue Bit
+// LED Red
+#ifndef LED_RED_V6
+#define LED_RED_V6 0x07
+#endif
+
+// LED Green
+#ifndef LED_GREEN_V6
+#define LED_GREEN_V6 0x08
+#endif
+
+// LCD-Backlight
+#ifndef LCD_BACKLIGHT_V6
+#define LCD_BACKLIGHT_V6 0x09
+#endif
+
+////////////////////           Display Parameters           ////////////////////
+
+// Control Byte: No Bit set
+#ifndef CONTROL_BYTE
+#define CONTROL_BYTE 0x00        
+#endif
+
+// Control Byte: Continue Bit set
 #ifndef CONTROL_BYTE_CB
-#define CONTROL_BYTE_CB 0x80
+#define CONTROL_BYTE_CB 0x80        
 #endif
 
-// Control Byte: Data/Command Selection Bit
+// Control Byte: Data/Command Selection Bit set
 #ifndef CONTROL_BYTE_DCB
-#define CONTROL_BYTE_DCB 0x40
+#define CONTROL_BYTE_DCB 0x40       // write RAM Data
 #endif
 
 // LCD-Parameter: Function Set 1
@@ -143,7 +164,7 @@
 
 // LCD-Parameter: Display on/off Control
 #ifndef LCD_PARA_DIS_CON
-#define LCD_PARA_DIS_CON 0x0F     // Display on, Cursor on, Blink on
+#define LCD_PARA_DIS_CON 0x0C     // Display on, Cursor off, Blink off
 #endif
 
 // LCD-Parameter: Clear Display 
@@ -151,6 +172,11 @@
 #define LCD_PARA_CLR_DIS 0x01
 #endif
 
+// LCD-Parameter: ROM Selection
+#ifndef LCD_PARA_ROM_SEL
+#define LCD_PARA_ROM_SEL 0x72
+#endif
+
 // LCD-Parameter: Display Row 1 
 #ifndef LCD_PARA_DIS_ROW1
 #define LCD_PARA_DIS_ROW1 0x80
@@ -171,6 +197,8 @@
 #define LCD_PARA_DIS_ROW4 0xE0
 #endif
 
+////////////////////           ASCII-Char Symbols           ////////////////////
+
 // Free Space 
 #ifndef FREE_SPACE
 #define FREE_SPACE 0x20
@@ -191,6 +219,8 @@
 #define BACKSLASH_R 0x0D
 #endif
 
+////////////////////           Additional Symbols           ////////////////////
+
 // Delay before and after transmission in µs
 #ifndef DELAY_TRANS_US
 #define DELAY_TRANS_US 0x64
@@ -201,6 +231,88 @@
 #define ARRAY_SIZE_ROW 0x0D
 #endif
 
+// Const Char Size for Configuration
+#ifndef CONFIG_SIZE
+#define CONFIG_SIZE 0x05
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////             Public Symbols             ////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+////////////////////           Display Parameters           ////////////////////
+
+// I²C Addresse (Default)
+#ifndef I2C_ADDRESS
+#define I2C_ADDRESS 0x3C
+#endif
+
+////////////////////               Pin-Symbols              ////////////////////
+
+// Button Up
+#ifndef BUTTON_UP
+#define BUTTON_UP 0x01
+#endif
+
+// Button Right
+#ifndef BUTTON_RIGHT
+#define BUTTON_RIGHT 0x02
+#endif
+
+// Button Down
+#ifndef BUTTON_DOWN
+#define BUTTON_DOWN 0x03
+#endif
+
+// Button Left
+#ifndef BUTTON_LEFT
+#define BUTTON_LEFT 0x04
+#endif
+
+// LED Red
+#ifndef LED_RED
+#define LED_RED 0x05
+#endif
+
+// LED Green
+#ifndef LED_GREEN
+#define LED_GREEN 0x06
+#endif
+
+////////////////////        LCD-Shield Configurations       ////////////////////
+
+// Config: LEDs = On, Buttons = On (Default)
+#ifndef CONFIG_L1B1
+#define CONFIG_L1B1 "L1B1"
+#endif
+
+// Config: LEDs = On, Buttons = Off
+#ifndef CONFIG_L1B0
+#define CONFIG_L1B0 "L1B0"
+#endif
+
+// Config: LEDs = Off, Buttons = On
+#ifndef CONFIG_L0B1
+#define CONFIG_L0B1 "L0B1"
+#endif
+
+// Config: LEDs = Off, Buttons = Off
+#ifndef CONFIG_L0B0
+#define CONFIG_L0B0 "L0B0"
+#endif
+
+////////////////////             Version Symbols            ////////////////////
+
+// Version 5
+#ifndef LCD_VERSION_5
+#define LCD_VERSION_5 0x05
+#endif
+
+// Version 6
+#ifndef LCD_VERSION_6
+#define LCD_VERSION_6 0x06
+#endif
+
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////         Include Header-File            ////////////////////
 ////////////////////////////////////////////////////////////////////////////////
@@ -226,11 +338,33 @@ protected:
 
 ////////////////////          protected Variables           ////////////////////
 
-char __i2cAddress;  //! @brief Store the I²C-Address of the LC-Display
-char __config[0x05];//! @brief Store the Buttons/LEDs-Configuration
+byte __version;             //! @brief Store used LCD-Shield version
+byte __i2cAddress;          //! @brief Store the I²C-Address of the LC-Display
+char __config[CONFIG_SIZE]; //! @brief Store the Buttons/LEDs-Configuration
+
 bool __buttons;     //! @brief Store the value "true", if the buttons configured
 bool __leds;        //! @brief Store the value "true", if the LEDs configured
 
+byte __buttonUp;    //! @brief Store address of button up
+byte __buttonDown;  //! @brief Store address of button down
+byte __buttonRight; //! @brief Store address of button right
+byte __buttonLeft;  //! @brief Store adress of button left
+
+byte __ledGreen;    //! @brief Store address of LED green
+byte __ledRed;      //! @brief Store address of LED red
+
+byte __lcdBacklight;//! @brief Store address of LCD-Backlight
+
+////////////////////           GPIO Configuration           ////////////////////
+
+/**
+ * @brief Configure GPIOs, depending of LCD-Shield version
+ * 
+ * @return true Configuration is accepted
+ * @return false Configuration is not accepted, check construction
+ */
+bool __gpioConfig(void);
+
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////       Privat Functions/Variables       ////////////////////
 ////////////////////////////////////////////////////////////////////////////////
@@ -247,8 +381,6 @@ private:
  */
 void _sendMessage(byte* bytes, byte sizeBytes);
 
-////////////////////          protected Variables           ////////////////////
-
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////     Public Functions/Variables         ////////////////////
 ////////////////////////////////////////////////////////////////////////////////
@@ -258,31 +390,31 @@ public:
 ////////////////////               Constructor              ////////////////////
 
 /**
- * @brief Construct a new HSA_LCD_Shield object with default I²C-Address/Config
+ * @brief Construct a new HSA_LCD_Shield object with default Shield-ver./Config
  */
 HSA_LCD_Shield();
 
 /**
- * @brief Construct a new HSA_LCD_Shield object with different I²C-Address
+ * @brief Construct a new HSA_LCD_Shield object with different Shield version
  * 
- * @param address Address of the LC-Display  
+ * @param version Version of LCD-Shield
  */
-HSA_LCD_Shield(char address);
+HSA_LCD_Shield(byte version);
 
 /**
  * @brief Construct a new HSA_LCD_Shield object with different Config
  * 
  * @param config Configuration of Buttons and LEDs 
  */
-HSA_LCD_Shield(const char config[0x05]);
+HSA_LCD_Shield(const char config[CONFIG_SIZE]);
 
 /**
- * @brief Construct a new HSA_LCD_Shield object with different I²C-Address/Config
+ * @brief Construct a new HSA_LCD_Shield object with different Shield-ver./Config
  * 
- * @param address Address of the LC-Display  
+ * @param version Version of LCD-Shield
  * @param config Configuration of Buttons and LEDs 
  */
-HSA_LCD_Shield(char address,const char config[0x05]);
+HSA_LCD_Shield(byte version, const char config[CONFIG_SIZE]);
 
 ////////////////////             Deconstructor              ////////////////////
 
@@ -301,6 +433,16 @@ HSA_LCD_Shield(char address,const char config[0x05]);
  */
 bool begin(void);
 
+/**
+ * @brief Start Configuration of LC-Display and Buttons/LEDS
+ * 
+ * @param address I²C-Address of LC-Display
+ * 
+ * @return true Configuration is accepted
+ * @return false Configuration is not accepted, check construction
+ */
+bool begin(byte address);
+
 ////////////////////             LCD-Backlight              ////////////////////
 
 /**
@@ -317,6 +459,15 @@ void lcdBacklight(bool value);
  */
 void clearDisplay(void);
 
+///////////////////             Return Version              ////////////////////
+
+/**
+ * @brief Return the configured LCD-Shield version
+ * 
+ * @return byte Return the configured LCD-Shield version
+ */
+byte returnVersion(void);
+
 ////////////////////             Return Config              ////////////////////
 
 /**
@@ -331,9 +482,9 @@ char* returnConfig(void);
 /**
  * @brief Return the I²C-Address of the LC-Display
  * 
- * @return char Return the I²C-Address of the LC-Display
+ * @return byte Return the I²C-Address of the LC-Display
  */
-char returnAddress(void);
+byte returnAddress(void);
 
 ////////////////////               Control LEDs             ////////////////////
 
@@ -342,66 +493,74 @@ char returnAddress(void);
  * 
  * @param ledPin Pin-Number/Name of the LED
  * @param state State of the LED
+ * 
+ * @return true LED control success
+ * @return false LED control not success
+ */
+bool controlLED(char ledPin, bool state);
+
+////////////////////               Get LED state            ////////////////////
+
+/**
+ * @brief Function to get the state of a LED
+ * 
+ * @param ledPin Pin-Number/Name of the LED
+ * 
+ * @return false LED is off or LED is unknown
+ * @return true LED in on
  */
-void controlLed(char ledPin, bool state);
+bool getLED(char ledPin);
 
 ////////////////////          Get the pressed Button        ////////////////////
 
 /**
  * @brief Return the number of the button, which is pressed
  * 
- * @return char 0x00, if no or more than one button is pressed
+ * @return char 0x00, if no or more than one button is pressed or buttons are 
+ *              not configured
  * @return char 0x01, if only button "Up" is pressed
  * @return char 0x02, if only button "Right" is pressed
  * @return char 0x03, if only button "Down" is pressed
  * @return char 0x04, if only button "Left" is pressed
  */
-char getButton();
+byte getButton();
 
-////////////////////                Write Row 1             ////////////////////
+////////////////////                Write Row               ////////////////////
 
 /**
- * @brief Write words in the first row.
+ * @brief Write words over all rows.
  * 
- * @param bytes Array of bytes, which should be written to the first row.
- */
-void writeRow1(const char* bytes);
-
-////////////////////                Write Row 2             ////////////////////
-
-/**
- * @brief Write words in the second row.
+ * @param text Array of bytes, which should be written to the rows.
  * 
- * @param bytes Array of bytes, which should be written to the second row.
+ * @return false Write to Rows was not possible
+ * @return true Write to Rows was successful
  */
-void writeRow2(const char* bytes);
-
-////////////////////                Write Row 3             ////////////////////
+bool writeRow(const char* text);
 
 /**
- * @brief Write words in the third row.
+ * @brief Write words to a targeted row.
  * 
- * @param bytes Array of bytes, which should be written to the third row.
- */
-void writeRow3(const char* bytes);
-
-////////////////////                Write Row 4             ////////////////////
-
-/**
- * @brief Write words in the fourth row.
+ * @param row Choose the row to write
+ * @param text Array of bytes, which should be written to the targeted row.
  * 
- * @param bytes Array of bytes, which should be written to the fourth row.
+ * @return false Write to chosen Row was not possible
+ * @return true Write to chosen Row was successful
  */
-void writeRow4(const char* bytes);
+bool writeRow(byte row, const char* text);
 
-////////////////////                Write 4 Rows            ////////////////////
+////////////////////             Write Position XY          ////////////////////
 
 /**
- * @brief Write words to all four rows.
+ * @brief Write words to a targeted Position (row/column)
+ * 
+ * @param row Choose the row to write
+ * @param column Choose the column to write
+ * @param text Array of bytes, which should be written.
  * 
- * @param bytes Array of bytes, which should be written to the four rows.
+ * @return false Write to chosen Row/Column was not possible
+ * @return true Write to chosen Row/Column was successful
  */
-void write4Rows(const char* bytes);
+bool writeXY(byte row, byte column, const char* text);
 
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////             close Header               ////////////////////