openwch / arduino_core_ch32

Core library for CH32duino
266 stars 51 forks source link

SSD1306 for CH32V003j4m6 error ! #146

Open mindonne opened 2 months ago

mindonne commented 2 months ago

I use library library Adafruit SSD1306 version 2.5.10 for CH32V003j4m6 , when compiling : " fatal error: util/delay.h: no such file or directory #include <util/delay.h> "

maxint-rd commented 2 months ago

Seems like you found that the Adafruit SSD1306 library is not supporting the CH32 core (yet). In the code you can see this:

#if !defined(__ARM_ARCH) && !defined(ENERGIA) && !defined(ESP8266) && !defined(ESP32) && !defined(__arc__)
#include <util/delay.h>
#endif

The file util/delay.h is something specific for the Atmel Arduino core. It provides functions for milli- and microsecond delay. As you can see the Adafruit code doesn't include that file when compiling for various other cores.

You may get further in compiling this by adding !defined(CH32V00x) or !defined(ARDUINO_ARCH_CH32) into that #if, but you will likely find other issues. I have not yet tried to compile that Adafruit library myself but expect that more modifications are needed.

What is your project about? Are you just experimenting? In a CH32 project for a particular LCD display, I also wanted to ùse Adafruit GFX. The limited flash space of the CH32V003 required me to make a stripped version of the Adafruit GFX library. Maybe sometime in the future I may find time to attempt to make a CH32 compatible version of Adafruit SSD1306, like I did with Adafruit_SleepyDog, but currently I have other priorities.

BTW: Recently the @hathach added support for Adafruit qtpy ch32v203 board. In this post @ladyada commented that currently no support for other libraries is planned, but that PR's for CH32 support are welcome to be submitted.

mindonne commented 2 months ago

I just experimenting but library ssd1306 does not support for CH32v003j4m6 :(((

blopa1961 commented 1 month ago

Use the SSD1306ASCII library by Bill Greiman; it works with the CH32V003.