0

私はArduino mega 2560をプログラミングしています。そして、tft LCDを購入しました。そのためにSDカードを使用して、写真を載せることができます。

このライブラリをダウンロードしましたが、エラーが発生しました。

C:\Arduino\libraries\pff\pff.cpp: 関数 'FRESULT pf_read(void*, short unsigned int, short unsigned int*)' 内:
C:\Arduino\libraries\pff\pff.cpp:585: エラー: 'void*' から 'unsigned char*' への変換が無効です

問題はここにあります:

pff.cpp:

 FRESULT pf_read (
    void* buff,     /* Pointer to the read buffer (NULL:Forward data to the stream)*/
    WORD btr,       /* Number of bytes to read */
    WORD* br        /* Pointer to number of bytes read */
)

pff.h:

FRESULT pf_read (void*, WORD, WORD*);           /* Read data from the open file */

.c ファイルにすると、次のようなエラーがさらに表示されます。

tft_menu.cpp.o: 関数 `open_root_dir()' 内:
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:594: 「pf_opendir(_DIR_*, char const*)」への未定義の参照
tft_menu.cpp.o: 関数 `mount_sd()' 内:
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:583:「disk_initialize()」への未定義の参照
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:585: 「pf_mount(_FATFS_*)」への未定義の参照
tft_menu.cpp.o: 関数 `bitmap_show(char*)' 内:
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:472: 「pf_open(char const*)」への未定義の参照
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:476: 「pf_read(void*, unsigned short, unsigned short*)」への未定義の参照
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:518: 「pf_read(void*, unsigned short, unsigned short*)」への未定義の参照
tft_menu.cpp.o: 関数 `show_bitmap()' 内:
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:603:「pf_readdir(_DIR_*, _FILINFO_*)」への未定義の参照

cppとしてコンパイルする必要があると思います。

編集:

cppとして保存する必要があることがわかりました。プログラムでは、icktoofayの状態を記述する必要があります

その後、いくつかエラーが発生したので、上記のように585行目に行き、変更しました

BYTE *rbuff = バフ;

の中へ

BYTE rbuff = (unsigned char ) buff;

そして、「リソースが見つかりませんでした」というエラーを取り除くために mcc.h を追加する必要があることがわかりました。

そして今、これらのエラーが発生しています:

C:\libraries\mmc/mmc.h: In function 'void init_spi()':
C:\libraries\mmc/mmc.h:21: error: 'PORTL' was not declared in this scope
C:\libraries\mmc/mmc.h:21: error: 'PORTL0' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB2' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB1' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'DDRB' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'PORTB0' was not declared in this scope
C:\libraries\mmc/mmc.h:25: error: 'DDRL' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPCR' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPE' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'MSTR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPSR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPI2X' was not declared in this scope

#include TFT_ARDUINO_MEGA.h を mcc.h の上に追加しようとしましたが、まだ運がありません

4

1 に答える 1

1

C ファイルとしてコンパイルしますが、それを使用するファイルには次pff.hのように含めます。

extern "C" {
#include <pff.h>
}
于 2012-01-02T03:03:40.387 に答える