Hello,
Trying to manage led wall and drawing digits on it.
Created some structs to manage pixel fonts.
// Fonts definition
typedef struct DigitRow {
unsigned row : 5;
unsigned : 0;
};
typedef struct DigitColumn {
unsigned column : 7;
unsigned : 0;
};
typedef struct {
byte height;
byte width;
union {
DigitRow row[7]; //Digit by row
DigitColumn column[5]; //Digit by column
};
}
Digit;
Digit pixelFont[] = {
{7, 5, B01110, B10001, B10001, B10001, B10001, B10001, B01110}, // Font[Ø] = '0'
...
{7, 1, B0, B0, B1, B0, B1, B0, B0}, // Font[10] = ':'
...
{7, 5, B01110, B10001, B10001, B11111, B10001, B10001, B10001}, // Font[17] = 'A'
...
{7, 3, B111, B010, B010, B010, B010, B010, B111} // Font[25] = 'I'
};
Got a lot of warnings ...
- ... 'typedef' was ignored in this declaration
- ... missing braces around initializer for 'Digit::'
- ... missing braces around initializer for 'DigitRow [7]'
- ... missing braces around initializer for 'DigitRow'
To draw a digit on the led wall, I try something like that ...
void drawChar (char digit, int x, int y, uint32_t aColor) {
for (byte i = 0; i < pixelFont[digit].width; i++) {
for (byte j = 0; j < pixelFont[digit].height; j++) {
strip.setPixelColor(width - i, height - j, (bitRead(pixelFont[0].row[j], i) == 1 ? aColor : black);
}
}
}
... and got an error :
error: no match for 'operator>>' in 'pixelFont[(((int)digit) + -0x000000030)].Digit::.Digit::::row[((int)j)] >> i'
whouuups ...!!!
How can/should I access to a bit in a row of a digit in pixelFont ?
Thanks for your help !!!
- JLD -