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;

posted @ 2021-08-08 19:45  qsBye  阅读(1234)  评论(0编辑  收藏  举报