displaying on SSD1306, 128x64 pixels OLED
Diff: Display.cpp
- Revision:
- 8:5972683a7190
- Parent:
- 7:7b225c565fe6
- Child:
- 9:d15f84b277f3
--- a/Display.cpp Mon Feb 24 14:34:14 2020 +0000 +++ b/Display.cpp Mon Feb 24 18:31:22 2020 +0000 @@ -1,45 +1,100 @@ #include "MicroBit.h" #include "Display.h" +/** + * When constructed from MicroBit's MicroBitDisplay of a not yet initialized + * MicroBit object - that must be done before using the Display instance. + */ Display::Display(MicroBitDisplay & uDpl) : uDisplay(uDpl) { clearStick(); } + +/** + * clears the display and is buffer + */ void Display::clear() { uDisplay.image.clear(); clearStick(); } +/** + * the stick is a binary representaion of the led display + * @param size in range [0,24] + */ void Display::setStick(uint8_t length) { curLength = length; paintStick(&Display::lessCurLength); } +/** + * Set a single dot + * + * @param position in [0,24] for showing that single dot. + */ void Display::setFlag(uint8_t position) { showbit = position; paintStick(&Display::orPoint); } +/** + * Puts a bitpattern in a row + * + * @param rowNr in [0,4] for selected row + * @param rowContent in [0,31] to be shown binary + */ void Display::toRow(uint8_t rowNr, uint8_t rowContent) { this->rowNr=rowNr; showbit=rowContent; paintStick(&Display::bitplot); } +/** + * 25 bits showed in display as a whole. + * + * @param allBits contains the 25 bit to be showed + */ void Display::toRows(uint32_t bits25) { showbit=bits25; paintStick(&Display::simplePlot); } +/** + * Vertdecimal is intended for showing a single number in [00000,99999], + * vertical read from top to bottom. + * + * @param r0 bottom row - row 0 + * @param r1 row 1 + * @param r2 row 2 + * @param r3 row 3 + * @param r4 top row - row 4 + */ void Display::vertDecimal(uint8_t r0,uint8_t r1,uint8_t r2,uint8_t r3,uint8_t r4) { vertDecimal(r0,r1,r2,r3,r4,false); } +/** + * Vertdecimal is intended for showing a single number in [00000,99999], + * vertical read from top to bottom. + * + * @param r0 bottom row - row 0 + * @param r1 row 1 + * @param r2 row 2 + * @param r3 row 3 + * @param r4 top row - row 4 + * @param leftDotOn turns left dot on. leftdot is not used to represent a digit in base 10 numbers. + */ void Display::vertDecimal(uint8_t r0,uint8_t r1,uint8_t r2,uint8_t r3,uint8_t r4, bool b15On) { Ledrows lr(r0,r1,r2,r3,r4,b15On); showbit = lr.all; paintStick(&Display::simplePlot); } +/** +* binary Clock, hours in top rows (4 for multiplum of 10, 3 for remainer) +* minuts in bottom rows (1 for multiplum of 10, 0 for remainer) +* +* @param minuts of the day +*/ void Display::vertClock(uint16_t minuts) { uint8_t hours = minuts/60; minuts -= 60*hours; @@ -48,6 +103,12 @@ vertDecimal(minuts-10*m1,m1,16,hours-10*h1,h1,false); } +/** +* binary Clock, hours in top rows (4) +* minuts in rows 3 and 2 (3 for multiplum of 10, 2 for remainer) +* seconds in rows 1 and 0 (1 for multiplum of 10, 0 for remainer) +* @param second of the day +*/ void Display::vertSecClock(uint32_t seconds) { uint8_t hours = seconds/3600; uint8_t minuts = (seconds - 3600*hours)/60;