diff --git a/src/display/Display.cpp b/src/display/Display.cpp index 66bd818..d834ebc 100644 --- a/src/display/Display.cpp +++ b/src/display/Display.cpp @@ -138,8 +138,20 @@ void Display::print(char *value){ return; }; -void Display::println(char *value){ +void Display::flipOrientation(void){ + if(this->orientationFlipped){ + sendDisplayCMD(setComDirectionNormal); + sendDisplayCMD(setSegmentMap); + } else{ + sendDisplayCMD(setComDirectionFlipped); + sendDisplayCMD(setSegmentReMap); + } + this->orientationFlipped = !this->orientationFlipped; +} +void Display::println(char *value){ + this ->print(value); + this->print("\n"); }; void Display::print(int value){ diff --git a/src/display/Display.h b/src/display/Display.h index b2be961..a9d61ae 100644 --- a/src/display/Display.h +++ b/src/display/Display.h @@ -21,14 +21,55 @@ class Display{ uint8_t charsOnCurrLine = 0; //on which line are we currently printing uint8_t currLine = 0; + //flag that marks if the y-orientation is currently flipped + bool orientationFlipped = false; + /** + * @brief sends the passed cmd to the display, cmd_byte is added as prefix by the function + * + * @param cmd the byte instruction that shold by sent + */ void sendDisplayCMD(uint8_t cmd); + + /** + * @brief should be called whenever characters where printed to the display. + * Updates the data of the class to handle linebreaks correctly + * @param charAmount How many characters where added to the screen + */ void updateLine(uint charAmount); + public: + + /** + * @brief initializes the display datastructures and sents the required cmds to start the display. Should only be called once. + * @warning doesn't initalize the I²C bus itself, therefore wire.begin(1,2) must be called elsewhere, before this method. + */ void begin(void); + + /** + * @brief delets all content from the display, resets the linecounter, new print will start at the top left. + * Orientationflip is not resetted + */ void clear(void); + + /** + * @brief prints the passed string right behind the current displaycontent + * the sequence "\n" can be used to make a linebreak on the display + * + * @param value the string "xyz" that should be printed to the display + */ void print(char *value); + + /** + * @brief same as the print method, but after the string a line break is inserted + * + * @param value the string that should be printed + */ void println(char *value); void print(int value); + /** + * @brief flips the horizontal orientation of all content on the display + */ + void flipOrientation(void); }; diff --git a/src/infraredLight/InfraredLight.h b/src/infraredLight/InfraredLight.h index d13390f..f088bb9 100644 --- a/src/infraredLight/InfraredLight.h +++ b/src/infraredLight/InfraredLight.h @@ -26,7 +26,6 @@ class InfraredLED{ /** * @brief enables selected LED * - * @param led */ void turnOn(void); /**