ああ、PROGMEM、ポインタ、ポインタへのポインタ、ポインタのアドレス...頭がおかしくなります。
問題のフォントのデータ配列があります
const uint8_t dejaVuSans9ptBitmaps[] =
{
/* @0 ' ' (5 pixels wide) */
0x00, /* */
0x00, /* */
...
PROGMEMを追加しました
const uint8_t dejaVuSans9ptBitmaps[] PROGMEM =
これは、そのような別の構造で参照されます。
const FONT_INFO dejaVuSans9ptFontInfo = {
13,
' ',
'~',
dejaVuSans9ptDescriptors,
dejaVuSans9ptBitmaps,
};
構造は次のように定義されます。
typedef struct {
const uint8_t height;
const uint8_t startChar;
const uint8_t endChar;
const FONT_CHAR_INFO* charInfo;
const uint8_t* data;
} FONT_INFO;
これをに変更する必要があると仮定して正しいですか。
typedef struct {
const uint8_t height;
const uint8_t startChar;
const uint8_t endChar;
const FONT_CHAR_INFO* charInfo;
const PGM_P data;
} FONT_INFO;
私がそうするとき、それはそれを不平を言います
warning: pointer targets in initialization differ in signedness
FONT_INFO変数のこの特定の行。
const FONT_INFO dejaVuSans9ptFontInfo = {
13,
' ',
'~',
dejaVuSans9ptDescriptors,
--> dejaVuSans9ptBitmaps, <--
};
次に、関数を使用して描画されます。
void drawString(uint16_t x, uint16_t y, uint16_t color, const FONT_INFO *fontInfo, char *str) {
...
drawCharBitmap(currentX, y, color, &fontInfo->data[charOffset], charWidth, fontInfo->height);
...
最終的にグリフを描画します。
void drawCharBitmap(const uint16_t xPixel, const uint16_t yPixel, uint16_t color, const uint8_t *glyph, uint8_t cols, uint8_t rows) {
...
if (glyph[indexIntoGlyph] & (0X80)) drawPixel(currentX, currentY, color);
...
私は頭を抱えています:/誰かが私にいくつかの方向性を与えることができますか?PGM_Pやpgm_read_byteなどを使用しようとして何時間も費やして無駄になりました-私はいつも画面にゴミが表示されます。
私を救ってください!