v.0.1.1 rm fontHeight_NxM
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -6,23 +6,27 @@
|
||||
|
||||
LedMatrix matrix;
|
||||
|
||||
#ifdef USE_FONT_5x7
|
||||
const uint8_t _fontWidthPixel = 5;
|
||||
#elifdef USE_FONT_8x8
|
||||
const uint8_t _fontWidthPixel = 8;
|
||||
#elifdef USE_FONT_16x16
|
||||
const uint8_t _fontWidthPixel = 16;
|
||||
#endif
|
||||
|
||||
void printCharMatrixSimple(char c)
|
||||
{
|
||||
matrix.drawText(58, 56, &c, CRGB::YellowGreen);
|
||||
matrix.show();
|
||||
|
||||
#ifdef USE_FONT_5x7
|
||||
const vector<uint8_t> &fontData_ = getFontChar_5x7(c);
|
||||
const u_int8_t font_height = fontHeight_5x7();
|
||||
const u_int8_t font_height = 7;
|
||||
#elifdef USE_FONT_8x8
|
||||
const vector<uint8_t> &fontData_ = getFontChar_8x8(c);
|
||||
const u_int8_t font_height = fontHeight_8x8();
|
||||
const u_int8_t font_height = 8;
|
||||
#elifdef USE_FONT_16x16
|
||||
const vector<uint16_t> &fontData_ = getFontChar_16x16(c);
|
||||
const u_int8_t font_height = fontHeight_16x16();
|
||||
const u_int8_t font_height = 16;
|
||||
#endif
|
||||
const auto *fontData = fontData_.data();
|
||||
const u_int8_t char_width_pixel = 5;
|
||||
|
||||
Serial.print("<");
|
||||
Serial.print(c);
|
||||
@@ -33,9 +37,9 @@ void printCharMatrixSimple(char c)
|
||||
{
|
||||
uint16_t line = fontData[row];
|
||||
|
||||
for (int col = 0; col < char_width_pixel; col++)
|
||||
for (int col = 0; col < _fontWidthPixel; col++)
|
||||
{
|
||||
if (line & (1 << ((char_width_pixel - 1) - col)))
|
||||
if (line & (1 << ((_fontWidthPixel - 1) - col)))
|
||||
{
|
||||
mtrx += "•";
|
||||
}
|
||||
@@ -47,6 +51,9 @@ void printCharMatrixSimple(char c)
|
||||
mtrx += "\n\r";
|
||||
}
|
||||
Serial.println(mtrx);
|
||||
|
||||
matrix.drawText(64 - font_height - 1, 64 - _fontWidthPixel - 1, &c, CRGB::YellowGreen);
|
||||
matrix.show();
|
||||
}
|
||||
|
||||
void playWithBlinkLed()
|
||||
|
||||
Reference in New Issue
Block a user