# esp32驅動SSD1351(中景園OLED)


方案一:Arduino esp32

經過一番折騰,終於運行了。
參考:Arduino
image

方案二:esp-idf

分支一:使用esp官方spi庫
報錯

` > Executing task: cmake --build . <

[1/5] Performing build step for 'bootloader'
ninja: no work to do.
[2/3] Linking CXX executable spi_master.elf
FAILED: spi_master.elf省略
-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: esp-idf/freertos/libfreertos.a(port_common.c.obj)😦.literal.main_task+0x10): undefined reference to 'app_main'
/Users/workspace/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld: esp-idf/freertos/libfreertos.a(port_common.c.obj): in function 'main_task':
/Users/workspace/esp/esp-idf/components/freertos/port/port_common.c:122: undefined reference to 'app_main'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
終端進程已終止,退出代碼: 1
For the ESP-IDF framework, the main() function needs to be named app_main()
查了esp官方文檔,需要main文件夾及component文件,參考官方example


分支二:軟件模擬spi
spi要用到的管腳:cs,dc,scl,sda
把uint8_t拆分成8個位,分別對管腳使能0/1

偽代碼for(i=0;i<8;i++)                            //傳送8bit數據              { if(dat&0x80)                          SDIN = 1;}                    else                         {SDIN = 0;}                    SCLK = 0;                    dat = dat << 1;                    SCLK = 1;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM