BV OLED: use pin number ordering in pinout
This commit is contained in:
parent
f840b5f075
commit
220b3b8880
|
@ -450,30 +450,31 @@ void busvoodoo_oled_text_pinout(const char* pins[10], bool io_connector)
|
|||
|
||||
for (uint8_t pin=0; pin<10; pin++) { // go through pin names
|
||||
if (NULL==pins[pin]) { // no text -> draw cross
|
||||
if (0==pin/5) {
|
||||
uint16_t column = 2+2+24*(4-pin/2)+2; // the start column to start drawing (from left)
|
||||
if (0==pin%2) {
|
||||
for (uint8_t col=0; col<20; col++) {
|
||||
uint32_t column = (1<<col)|(1<<(19-col)); // the two dots of the cross
|
||||
uint32_t cross = (1<<col)|(1<<(19-col)); // the two dots of the cross
|
||||
if (io_connector) {
|
||||
busvoodoo_oled_display[128*2+2+2+24*(pin%5)+2+col] |= column<<3;
|
||||
busvoodoo_oled_display[128*3+2+2+24*(pin%5)+2+col] |= column>>5;
|
||||
busvoodoo_oled_display[128*4+2+2+24*(pin%5)+2+col] |= column>>13;
|
||||
busvoodoo_oled_display[128*2+column+col] |= cross<<3;
|
||||
busvoodoo_oled_display[128*3+column+col] |= cross>>5;
|
||||
busvoodoo_oled_display[128*4+column+col] |= cross>>13;
|
||||
} else {
|
||||
busvoodoo_oled_display[128*2+2+2+24*(pin%5)+2+col] |= column<<1;
|
||||
busvoodoo_oled_display[128*3+2+2+24*(pin%5)+2+col] |= column>>7;
|
||||
busvoodoo_oled_display[128*4+2+2+24*(pin%5)+2+col] |= column>>15;
|
||||
busvoodoo_oled_display[128*2+column+col] |= cross<<1;
|
||||
busvoodoo_oled_display[128*3+column+col] |= cross>>7;
|
||||
busvoodoo_oled_display[128*4+column+col] |= cross>>15;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (uint8_t col=0; col<20; col++) {
|
||||
uint32_t column = (1<<col)|(1<<(19-col)); // the two dots of the cross
|
||||
uint32_t cross = (1<<col)|(1<<(19-col)); // the two dots of the cross
|
||||
if (io_connector) {
|
||||
busvoodoo_oled_display[128*5+2+2+24*(pin%5)+2+col] |= column<<1;
|
||||
busvoodoo_oled_display[128*6+2+2+24*(pin%5)+2+col] |= column>>7;
|
||||
busvoodoo_oled_display[128*7+2+2+24*(pin%5)+2+col] |= column>>15;
|
||||
busvoodoo_oled_display[128*5+column+col] |= cross<<1;
|
||||
busvoodoo_oled_display[128*6+column+col] |= cross>>7;
|
||||
busvoodoo_oled_display[128*7+column+col] |= cross>>15;
|
||||
} else {
|
||||
busvoodoo_oled_display[128*5+2+2+24*(pin%5)+2+col] |= column<<3;
|
||||
busvoodoo_oled_display[128*6+2+2+24*(pin%5)+2+col] |= column>>5;
|
||||
busvoodoo_oled_display[128*7+2+2+24*(pin%5)+2+col] |= column>>13;
|
||||
busvoodoo_oled_display[128*5+column+col] |= cross<<3;
|
||||
busvoodoo_oled_display[128*6+column+col] |= cross>>5;
|
||||
busvoodoo_oled_display[128*7+column+col] |= cross>>13;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -481,14 +482,14 @@ void busvoodoo_oled_text_pinout(const char* pins[10], bool io_connector)
|
|||
// leave blank
|
||||
} else if (strlen(pins[pin])<4) {
|
||||
// calculate start position (from the left) based on number of characters to put in 24 px box
|
||||
uint16_t column = 2+2+24*(pin%5)+(24-7*strlen(pins[pin])-strlen(pins[pin])-1)/2+1;
|
||||
uint16_t column = 2+2+24*(4-pin/2)+(24-7*strlen(pins[pin])-strlen(pins[pin])-1)/2+1;
|
||||
for (uint8_t i=0; i<strlen(pins[pin]); i++) {
|
||||
char c = ' '; // default character to draw
|
||||
if (pins[pin][i]>' ' && pins[pin][i]<' '+LENGTH(font_king10)) { // we have a glyph for this character
|
||||
c = pins[pin][i];
|
||||
}
|
||||
for (uint8_t col=0; col<LENGTH(font_king10[0]) && column<128; col++) { // go through glyph columns
|
||||
if (0==pin/5) {
|
||||
if (0==pin%2) {
|
||||
if (io_connector) {
|
||||
busvoodoo_oled_display[128*3+column] |= (font_king10[c-' '][col]>>0)<<0;
|
||||
busvoodoo_oled_display[128*4+column] |= (font_king10[c-' '][col]>>8)<<0;
|
||||
|
@ -510,14 +511,14 @@ void busvoodoo_oled_text_pinout(const char* pins[10], bool io_connector)
|
|||
column++; // insert space between glyphs
|
||||
}
|
||||
} else if (4==strlen(pins[pin])) {
|
||||
uint16_t column = 2+2+24*(pin%5); // start position on x-axis (for 4 characters on a 24 px box)
|
||||
uint16_t column = 2+2+24*(4-pin/2); // start position on x-axis (for 4 characters on a 24 px box)
|
||||
for (uint8_t i=0; i<strlen(pins[pin]); i++) {
|
||||
char c = ' '; // default character to draw
|
||||
if (pins[pin][i]>' ' && pins[pin][i]<' '+LENGTH(font_king8)) { // we have a glyph for this character
|
||||
c = pins[pin][i];
|
||||
}
|
||||
for (uint8_t col=0; col<LENGTH(font_king8[0]) && column<128; col++) { // go through glyph columns
|
||||
if (0==pin/5) {
|
||||
if (0==pin%2) {
|
||||
if (io_connector) {
|
||||
busvoodoo_oled_display[128*3+column] |= (font_king8[c-' '][col]>>0)<<1;
|
||||
busvoodoo_oled_display[128*4+column] |= (font_king8[c-' '][col]>>7)<<0;
|
||||
|
@ -539,7 +540,7 @@ void busvoodoo_oled_text_pinout(const char* pins[10], bool io_connector)
|
|||
column++; // insert space between glyphs
|
||||
}
|
||||
} else {
|
||||
uint16_t column = 2+2+24*(pin%5); // start position on x-axis (for 4 characters on a 24 px box)
|
||||
uint16_t column = 2+2+24*(4-pin/2); // start position on x-axis (for 4 characters on a 24 px box)
|
||||
for (uint8_t i=0; i<4; i++) { // go through 4 characters per line
|
||||
char c_top = ' '; // default character to draw on top line
|
||||
if (pins[pin][i]>' ' && pins[pin][i]<' '+LENGTH(font_king8)) { // we have a glyph for this character
|
||||
|
@ -550,7 +551,7 @@ void busvoodoo_oled_text_pinout(const char* pins[10], bool io_connector)
|
|||
c_bottom = pins[pin][4+i]; // get glyph to draw
|
||||
}
|
||||
for (uint8_t col=0; col<LENGTH(font_king8[0]) && column<128; col++) { // go through glyph columns
|
||||
if (0==pin/5) {
|
||||
if (0==pin%2) {
|
||||
if (io_connector) {
|
||||
busvoodoo_oled_display[128*2+column] |= (font_king8[c_top-' '][col]>>0)<<4;
|
||||
busvoodoo_oled_display[128*3+column] |= (font_king8[c_top-' '][col]>>4)<<0;
|
||||
|
|
Loading…
Reference in New Issue