Skip to content

Runtime eink driver selection for pico to support GDEY042T81#11

Open
tahnok wants to merge 5 commits intojoeycastillo:mainfrom
tahnok:upstream-pico-screen-support
Open

Runtime eink driver selection for pico to support GDEY042T81#11
tahnok wants to merge 5 commits intojoeycastillo:mainfrom
tahnok:upstream-pico-screen-support

Conversation

@tahnok
Copy link

@tahnok tahnok commented Dec 23, 2025

This PR adds support for both old IL0398 and new GDEY042T81/SSD1683 e-paper displays on the Raspberry Pi Pico platform, with automatic hardware-based display detection.

A substantial amount of this code was written using Claude Code

Display Detection

The firmware automatically detects which display is connected by exploiting a key difference in busy pin polarity:

  • IL0398: busy pin is HIGH when ready (LOW = busy)
  • SSD1683: busy pin is LOW when ready (HIGH = busy)

After a hardware reset, the detectDisplayType() function reads the busy pin state to determine which display is connected. No user configuration is required.

Key Changes

  • Created OpenBook_EPD base class to provide common interface for both display drivers
  • Modified OpenBookDevice to support runtime display driver selection
  • Added detectDisplayType() function that probes the hardware via busy pin polarity
  • Both display drivers now compile for all platforms
  • Updated all references from compile-time OPEN_BOOK_EPD macro to runtime OpenBook_EPD* pointer

Benefits

  • Users can now use the newer SSD1683 display on Pico hardware
  • Zero configuration required - display type is auto-detected
  • No firmware recompilation needed to switch displays
  • Maintains backward compatibility with existing IL0398 hardware

Fallback Behavior

If no busy pin is connected, the code falls back to platform defaults:

  • Pico: IL0398 (original display)
  • ESP32: SSD1683 (new display)

claude and others added 5 commits December 23, 2025 11:52
This commit adds support for both IL0398 and SSD1683 e-paper displays
on the Raspberry Pi Pico platform, with automatic display detection via
an SD card configuration file.

Key changes:
- Created OpenBook_EPD base class to provide common interface for both
  display drivers (IL0398 and SSD1683)
- Modified OpenBookDevice to support runtime display driver selection
  instead of compile-time selection
- Added configuration file loader that reads /openbook.cfg from SD card
- Config file format: "display=IL0398" or "display=SSD1683"
- Falls back to platform defaults if config file not found:
  * Pico defaults to IL0398 (original display)
  * ESP32 defaults to SSD1683 (new display)
- Both display drivers now compile for all platforms
- Updated all references from compile-time OPEN_BOOK_EPD macro to
  runtime OpenBook_EPD* pointer
- Added openbook.cfg.example with documentation

Benefits:
- Users can now use the newer SSD1683 display on Pico hardware
- No firmware recompilation needed to switch displays
- Maintains backward compatibility with existing hardware
- Simple, user-friendly configuration via SD card

Files modified:
- src/components/display/OpenBook_EPD.h: Added base class
- src/components/display/OpenBook_IL0398.h: Inherit from OpenBook_EPD
- src/components/display/OpenBook_SSD1683.h: Inherit from OpenBook_EPD
- src/components/hardware/OpenBookDevice.{h,cpp}: Runtime driver selection
- src/app/OpenBookTasks.cpp: Updated display type references
- src/main.cpp: Updated display type reference
- openbook.cfg.example: Configuration file documentation
The previous commit introduced OpenBook_EPD as a base class, but the
constructors in OpenBook_IL0398 and OpenBook_SSD1683 were still trying
to initialize Adafruit_EPD directly instead of OpenBook_EPD.

This caused compilation errors because Adafruit_EPD is no longer a
direct base class - it's now inherited through OpenBook_EPD.

Changes:
- Updated both constructors in OpenBook_IL0398.cpp to call OpenBook_EPD
- Updated both constructors in OpenBook_SSD1683.cpp to call OpenBook_EPD

This fixes the CI build errors.
Added missing getDisplayMode() implementation for OpenBook_IL0398 and
OpenBook_SSD1683. These methods were declared in the headers and marked
as pure virtual in the OpenBook_EPD base class, but were not implemented
in the .cpp files, causing linker errors.

Both implementations return the currentDisplayMode member variable that
tracks the current display refresh mode.

This fixes the CI linker errors:
- undefined reference to `OpenBook_IL0398::getDisplayMode()'
- undefined reference to `OpenBook_SSD1683::getDisplayMode()'
The previous approach of reading display type from an SD card config file
had a timing issue on Pico: the display was initialized before the SD card
was ready.

This commit replaces the config file approach with automatic hardware
detection based on busy pin polarity differences between the two displays:
- IL0398: busy pin is HIGH when ready (LOW = busy)
- SSD1683: busy pin is LOW when ready (HIGH = busy)

After a hardware reset, the detection code reads the busy pin state to
determine which display is connected. This eliminates the need for any
user configuration.

Changes:
- Replace loadDisplayConfig() with detectDisplayType()
- Remove openbook.cfg.example (no longer needed)
- Detection falls back to platform defaults if no busy pin

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants