rotate display by 180 degrees
This commit is contained in:
parent
f68c66f356
commit
93fc49f8b7
|
@ -62,6 +62,9 @@ private:
|
|||
|
||||
uint8_t col[COLUMNBYTES]; //column drivers and shift registers on annax pcb
|
||||
|
||||
bool rowdata_msbfirst;
|
||||
bool column_reversed;
|
||||
|
||||
|
||||
public:
|
||||
Flipdot();
|
||||
|
@ -79,6 +82,8 @@ public:
|
|||
|
||||
void shiftDataRow();
|
||||
void shiftDataColumn();
|
||||
|
||||
void setDisplayMirror(bool x, bool y);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
#ifndef FONTS_H
|
||||
#define FONTS_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
const uint8_t font_width=6;
|
||||
uint8_t font_spacing=1;
|
||||
|
||||
const uint8_t font_offset=33;
|
||||
const uint8_t font_minecraftia[94][font_width]= {
|
||||
{95,0,0,0,0,0}, // 33 !
|
||||
{3,0,3,0,0,0}, // 34 "
|
||||
{20,127,20,127,20,0}, // 35 #
|
||||
{36,42,107,42,18,0}, // 36 $
|
||||
{67,48,8,6,97,0}, // 37 %
|
||||
{48,74,93,50,72,0}, // 38 &
|
||||
{3,0,0,0,0,0}, // 39 '
|
||||
{28,34,65,65,0,0}, // 40 (
|
||||
{65,65,34,28,0,0}, // 41 )
|
||||
{5,2,2,5,0,0}, // 42 *
|
||||
{16,16,124,16,16,0}, // 43 +
|
||||
{224,0,0,0,0,0}, // 44 ,
|
||||
{16,16,16,16,16,0}, // 45 -
|
||||
{96,0,0,0,0,0}, // 46 .
|
||||
{64,48,8,6,1,0}, // 47 /
|
||||
{62,81,73,69,62,0}, // 48 0
|
||||
{64,66,127,64,64,0}, // 49 1
|
||||
{98,81,73,73,70,0}, // 50 2
|
||||
{34,65,73,73,54,0}, // 51 3
|
||||
{24,20,18,17,127,0}, // 52 4
|
||||
{39,69,69,69,57,0}, // 53 5
|
||||
{60,74,73,73,48,0}, // 54 6
|
||||
{3,1,113,9,7,0}, // 55 7
|
||||
{54,73,73,73,54,0}, // 56 8
|
||||
{6,73,73,41,30,0}, // 57 9
|
||||
{102,0,0,0,0,0}, // 58 :
|
||||
{230,0,0,0,0,0}, // 59 ;
|
||||
{8,20,34,65,0,0}, // 60 <
|
||||
{36,36,36,36,36,0}, // 61 =
|
||||
{65,34,20,8,0,0}, // 62 >
|
||||
{2,1,81,9,6,0}, // 63 ?
|
||||
{62,65,93,93,81,94}, // 64 @
|
||||
{126,5,5,5,126,0}, // 65 A
|
||||
{127,69,69,69,58,0}, // 66 B
|
||||
{62,65,65,65,34,0}, // 67 C
|
||||
{127,65,65,65,62,0}, // 68 D
|
||||
{127,69,69,65,65,0}, // 69 E
|
||||
{127,5,5,1,1,0}, // 70 F
|
||||
{62,65,69,69,61,0}, // 71 G
|
||||
{127,4,4,4,127,0}, // 72 H
|
||||
{65,127,65,0,0,0}, // 73 I
|
||||
{32,64,64,64,63,0}, // 74 J
|
||||
{127,4,4,10,113,0}, // 75 K
|
||||
{127,64,64,64,64,0}, // 76 L
|
||||
{127,2,4,2,127,0}, // 77 M
|
||||
{127,2,4,8,127,0}, // 78 N
|
||||
{62,65,65,65,62,0}, // 79 O
|
||||
{127,5,5,5,2,0}, // 80 P
|
||||
{62,65,65,33,94,0}, // 81 Q
|
||||
{127,5,5,5,122,0}, // 82 R
|
||||
{34,69,69,69,57,0}, // 83 S
|
||||
{1,1,127,1,1,0}, // 84 T
|
||||
{63,64,64,64,63,0}, // 85 U
|
||||
{15,48,64,48,15,0}, // 86 V
|
||||
{127,32,16,32,127,0}, // 87 W
|
||||
{113,10,4,10,113,0}, // 88 X
|
||||
{1,2,124,2,1,0}, // 89 Y
|
||||
{97,81,73,69,67,0}, // 90 Z
|
||||
{127,65,65,0,0,0}, // 91 [
|
||||
{1,6,8,48,64,0}, // 92 Backslash
|
||||
{65,65,127,0,0,0}, // 93 ]
|
||||
{4,2,1,2,4,0}, // 94 ^
|
||||
{128,128,128,128,128,0}, // 95 _
|
||||
{0,1,0,0,0,0}, // 96 `
|
||||
{32,84,84,84,120,0}, // 97 a
|
||||
{127,72,68,68,56,0}, // 98 b
|
||||
{56,68,68,68,40,0}, // 99 c
|
||||
{56,68,68,72,127,0}, // 100 d
|
||||
{56,84,84,84,88,0}, // 101 e
|
||||
{4,126,5,5,0,0}, // 102 f
|
||||
{152,164,164,164,124,0}, // 103 g
|
||||
{127,8,4,4,120,0}, // 104 h
|
||||
{125,0,0,0,0,0}, // 105 i
|
||||
{96,128,128,128,125,0}, // 106 j
|
||||
{127,16,40,68,0,0}, // 107 k
|
||||
{63,64,0,0,0,0}, // 108 l
|
||||
{124,4,24,4,120,0}, // 109 m
|
||||
{124,4,4,4,120,0}, // 110 n
|
||||
{56,68,68,68,56,0}, // 111 o
|
||||
{252,40,36,36,24,0}, // 112 p
|
||||
{24,36,36,40,252,0}, // 113 q
|
||||
{124,8,4,4,8,0}, // 114 r
|
||||
{72,84,84,84,36,0}, // 115 s
|
||||
{2,63,66,0,0,0}, // 116 t
|
||||
{60,64,64,64,124,0}, // 117 u
|
||||
{28,32,64,32,28,0}, // 118 v
|
||||
{60,64,112,64,124,0}, // 119 w
|
||||
{68,40,16,40,68,0}, // 120 x
|
||||
{156,160,160,160,124,0}, // 121 y
|
||||
{68,100,84,76,68,0}, // 122 z
|
||||
{8,54,65,65,0,0}, // 123 {
|
||||
{255,0,0,0,0,0}, // 124 |
|
||||
{65,65,54,8,0,0}, // 125 }
|
||||
{2,1,1,2,2,1}, // 126 ~
|
||||
};
|
||||
|
||||
#endif
|
|
@ -77,10 +77,13 @@ public:
|
|||
|
||||
void redraw();
|
||||
|
||||
void setDisplayMirror(bool x, bool y);
|
||||
|
||||
|
||||
|
||||
unsigned long updateDuration; //for statistics and debugging. time it took for one update (max)
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -61,6 +61,9 @@ void Flipdot::selectColumnSet(uint8_t selcolumn) {
|
|||
selectColumn(selcolumn, false);
|
||||
}
|
||||
void Flipdot::selectColumn(uint8_t selcolumn, bool clear) {
|
||||
if (column_reversed) {
|
||||
selcolumn=COLUMNBYTES*4-1-1 - selcolumn; //COLUMNBYTES*4-1 = COLUMNS
|
||||
}
|
||||
//set shift registers for columns to select one column to positive voltage
|
||||
uint8_t sc_bit=3-(selcolumn%4); //each two shift registers control four columns
|
||||
uint8_t sc_byte=selcolumn/4;
|
||||
|
@ -145,8 +148,13 @@ void Flipdot::shiftDataRow() { //send out all data to shift registers
|
|||
|
||||
//select Rows via shift registers on own controller board
|
||||
//LSBFIRST= LSB is QH, bit 8 is QA. //upper byte
|
||||
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, MSBFIRST, row>>8); //MSBFIRST= LSB is QH, bit 8 is QA
|
||||
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, MSBFIRST, row&0xff); //lower byte
|
||||
if (rowdata_msbfirst) {
|
||||
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, LSBFIRST, row&0xff); //lower byte
|
||||
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, LSBFIRST, row>>8); //MSBFIRST= LSB is QH, bit 8 is QA
|
||||
}else{
|
||||
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, MSBFIRST, row>>8); //MSBFIRST= LSB is QH, bit 8 is QA
|
||||
shiftOutSlow(PIN_SR_DATA, PIN_SR_CLK, MSBFIRST, row&0xff); //lower byte
|
||||
}
|
||||
digitalWrite(PIN_SR_LATCH, HIGH);
|
||||
delayMicroseconds(MICROS_SHIFT_LATCH);
|
||||
digitalWrite(PIN_SR_LATCH, LOW);
|
||||
|
@ -175,4 +183,9 @@ void Flipdot::setRow(uint16_t _row){
|
|||
|
||||
uint16_t Flipdot::getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
void Flipdot::setDisplayMirror(bool x, bool y){
|
||||
rowdata_msbfirst=y; //false=not mirrored (connector at top)
|
||||
column_reversed=x;
|
||||
}
|
|
@ -69,7 +69,7 @@ void Image::addBuffer_text(String text,uint8_t xoffset, uint8_t yoffset)
|
|||
backBuffer[bufferxpos]|= addBuffer;
|
||||
Serial.print("Buffer at "); Serial.print(bufferxpos); Serial.print(" add ");Serial.print(addBuffer,2); Serial.print(" result="); Serial.println(backBuffer[bufferxpos],2);
|
||||
|
||||
bufferxpos++;
|
||||
bufferxpos++;
|
||||
}
|
||||
bufferxpos-= emptycolumncounter-font_spacing; //remove trailing empty columns except one
|
||||
}
|
||||
|
@ -825,4 +825,9 @@ void Image::loop_drawClearTest() {
|
|||
void Image::redraw() {
|
||||
flag_redraw=true;
|
||||
flag_updating=true;
|
||||
}
|
||||
|
||||
|
||||
void Image::setDisplayMirror(bool x, bool y){
|
||||
flipdot.setDisplayMirror(x,y);
|
||||
}
|
|
@ -42,9 +42,9 @@ String error; //used to buffer error messages to be send via mqtt
|
|||
|
||||
void setup() {
|
||||
flip.init();
|
||||
flip.setDisplayMirror(true,true); //true,true=mirror both axis (rotate 180deg)
|
||||
|
||||
Serial.begin(115200);
|
||||
flip.setBuffer_solid(0);
|
||||
|
||||
//Setup Homie
|
||||
Homie_setFirmware("flipdot", "0.1.0");
|
||||
|
|
Loading…
Reference in New Issue