-
-
Notifications
You must be signed in to change notification settings - Fork 138
Description
This library needs minor changes to work with Teensy. But these edits aren't Teensy-specific and probably will help with other modern boards. Problem was reported on this forum thread:
https://forum.pjrc.com/threads/67585-util-delay-h-no-such-file?p=328244&viewfull=1#post328244
Here is a first attempt to fix:
master...PaulStoffregen:ssd1306:master
Quick summary of these changes:
- Default config in ssd1306_hal/arduino/io.h enables AVR-specific features. Just checking
#if defined(__AVR__)allows non-AVR hardware to work by default. - ssd1306_hal/arduino/platform.cpp attempts to include Wire1.h, which doesn't exist on many platforms. Adding a
__has_includecheck solves this. - ssd1306_platform_i2cInit() doesn't handle boards with 3 or 4 I2C ports. Simple to add.
- ssd1306_platform_i2cInit() defaults to last port on boards with 2+ I2C ports, when busID is -1. Reorder if-else to default to main Wire port.
- ssd1306_platform_i2cInit() unhandled cases leave a NULL pointer, which later crashes when used. Add fallback test to default to main Wire port.
Confirmed working with Teensy 3.0 and Teensy 4.1 using ssd1306_demo example.
I hope you will consider merging some form of these minor edits, so Teensy boards can work. Other non-AVR boards will very likely also benefit from these edits.
I could send a pull request if you would like. I can also arrange to send you Teensy 4.0 and Teensy 4.1 hardware for future development and testing.

