Skip to content

feat: add HalDisplay and HalGPIO#522

Merged
daveallie merged 7 commits intocrosspoint-reader:masterfrom
ngxson:xsn/hal_display_gpio
Jan 27, 2026
Merged

feat: add HalDisplay and HalGPIO#522
daveallie merged 7 commits intocrosspoint-reader:masterfrom
ngxson:xsn/hal_display_gpio

Conversation

@ngxson
Copy link
Contributor

@ngxson ngxson commented Jan 23, 2026

Summary

Extracted some changes from #500 to make reviewing easier

This PR adds HAL (Hardware Abstraction Layer) for display and GPIO components, making it easier to write a stub or an emulated implementation of the hardware.

SD card HAL will be added via another PR, because it's a bit more tricky.


AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO

@daveallie
Copy link
Member

Is the idea here that a test-friendly non-X4 specific subclass of HalDisplay is made with relevant stubs to be used in local testing?

@ngxson
Copy link
Contributor Author

ngxson commented Jan 27, 2026

I'm not 100% what do you mean by "local testing", but yes the overall idea is that HalDisplay can be hardware-agnostic to facilitate testings.

I've experimented with an implementation that instead of sending frame buffer to the real display (aka via SPI), it sends to USB UART. I can then capture the frame buffer on my computer and display it. Here is the code if you want to have a look (quite hacky, but works well for now): https://github.com/ngxson/pluspoint-reader/blob/9558dc1251863bd9a951675e0550adc522bb793c/ngxson/hal/EInkDisplay.cpp#L76-L79

@daveallie
Copy link
Member

Yep, makes sense, I also saw you're working on some QEMU, all together, this'll be a good win for local emulation/testing. I've introduced a bunch of merge conflicts, but we can get this merged once they're resolved.

@daveallie
Copy link
Member

Ahh I see it's been benched

@ngxson
Copy link
Contributor Author

ngxson commented Jan 27, 2026

Yeah I opened this PR also for discussion. Since QEMU is far from being stable, the only option left here is to use a standalone esp32c3 for testing.

I can resolve these conflicts a bit later. But just want to discuss if the overall direction here is ok, and if there are any other ideas that can be useful for testings in general.

@ngxson
Copy link
Contributor Author

ngxson commented Jan 27, 2026

One idea that I've also been thinking about is to compile the whole firmware as an executable that can run directly on a PC without emulation, but that may require far more changes.

Currently, many functionalities depend on Arduino library, like wifi for example. Can be quite tricky to implement HAL for those

@daveallie
Copy link
Member

Yeah, I assume there'd need to be a lot of overridden linking and an outrageous amount of stubbing to get that to work. Regardless, I think this HAL implementation will help with working towards a simple unit test harness.

@ngxson
Copy link
Contributor Author

ngxson commented Jan 27, 2026

I resolved the merge conflicts & tested it. Most of the changes are just renaming though

@daveallie daveallie merged commit da4d3b5 into crosspoint-reader:master Jan 27, 2026
1 check passed
jdk2pq added a commit to jdk2pq/crosspoint-reader that referenced this pull request Jan 28, 2026
* master: (33 commits)
  feat: add HalDisplay and HalGPIO (crosspoint-reader#522)
  feat: Display epub metadata on Recents (crosspoint-reader#511)
  chore: Cut release 0.16.0
  fix: Correctly render italics on image alt placeholders (crosspoint-reader#569)
  chore: .gitignore: add compile_commands.json & .cache (crosspoint-reader#568)
  fix: Render keyboard entry over multiple lines (crosspoint-reader#567)
  fix: missing front layout in mapLabels() (crosspoint-reader#564)
  refactor: Re-work for OTA feature (crosspoint-reader#509)
  perf: optimize large EPUB indexing from O(n^2) to O(n) (crosspoint-reader#458)
  feat: Add Spanish hyphenation support (crosspoint-reader#558)
  feat: Add support to B&W filters to image covers (crosspoint-reader#476)
  feat(ux): page turning on button pressed if long-press chapter skip is disabled (crosspoint-reader#451)
  feat: Add status bar option "Full w/ Progress Bar" (crosspoint-reader#438)
  fix: Validate settings on read. (crosspoint-reader#492)
  fix: rotate origin in drawImage (crosspoint-reader#557)
  feat: Extract author from XTC/XTCH files (crosspoint-reader#563)
  fix: add txt books to recent tab (crosspoint-reader#526)
  docs: add font generation commands to builtin font headers (crosspoint-reader#547)
  docs: Update README with supported languages for EPUB  (crosspoint-reader#530)
  fix: Fix KOReader document md5 calculation for binary matching progress sync (crosspoint-reader#529)
  ...
aBER0724 pushed a commit to aBER0724/crosspoint-reader-cjk that referenced this pull request Feb 1, 2026
Synced from upstream/master (da4d3b5):
- feat: Add HalDisplay and HalGPIO (crosspoint-reader#522)
- feat: Display epub metadata on Recents (crosspoint-reader#511)
- feat: Add Spanish hyphenation support (crosspoint-reader#558)
- fix: Render keyboard entry over multiple lines (crosspoint-reader#567)
- fix: missing front layout in mapLabels() (crosspoint-reader#564)
- perf: optimize large EPUB indexing from O(n^2) to O(n) (crosspoint-reader#458)
- chore: .gitignore: add compile_commands.json & .cache (crosspoint-reader#568)

Files synced:
- lib/hal/ (new)
- lib/Epub/ (hyphenation, metadata cache, parsers)
- lib/ZipFile/
- src/MappedInputManager.*
- src/activities/home/MyLibraryActivity.*
- src/activities/util/

Skipped conflicting files:
- lib/GfxRenderer/ (has CJK changes)
- src/activities/reader/ (has dark mode changes)
- src/main.cpp (has I18n changes)
@ngxson ngxson mentioned this pull request Feb 1, 2026
Jessica765 pushed a commit to Jessica765/crosspoint-reader that referenced this pull request Feb 3, 2026
## Summary

Extracted some changes from
crosspoint-reader#500 to make
reviewing easier

This PR adds HAL (Hardware Abstraction Layer) for display and GPIO
components, making it easier to write a stub or an emulated
implementation of the hardware.

SD card HAL will be added via another PR, because it's a bit more
tricky.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? **NO**
daveallie pushed a commit that referenced this pull request Feb 8, 2026
## Summary

Continue my changes to introduce the HAL infrastructure from
#522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Feb 8, 2026
## Summary

Continue my changes to introduce the HAL infrastructure from
crosspoint-reader#522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Feb 8, 2026
## Summary

Continue my changes to introduce the HAL infrastructure from
crosspoint-reader#522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
lukestein pushed a commit to lukestein/crosspoint-reader that referenced this pull request Feb 8, 2026
## Summary

Continue my changes to introduce the HAL infrastructure from
crosspoint-reader#522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
Marma92 pushed a commit to Marma92/crosspoint-reader that referenced this pull request Feb 10, 2026
## Summary

Continue my changes to introduce the HAL infrastructure from
crosspoint-reader#522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
Unintendedsideeffects pushed a commit to Unintendedsideeffects/crosspoint-reader that referenced this pull request Feb 17, 2026
## Summary

Extracted some changes from
crosspoint-reader#500 to make
reviewing easier

This PR adds HAL (Hardware Abstraction Layer) for display and GPIO
components, making it easier to write a stub or an emulated
implementation of the hardware.

SD card HAL will be added via another PR, because it's a bit more
tricky.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? **NO**
Unintendedsideeffects pushed a commit to Unintendedsideeffects/crosspoint-reader that referenced this pull request Feb 17, 2026
## Summary

Continue my changes to introduce the HAL infrastructure from
crosspoint-reader#522

This PR touches quite a lot of files, but most of them are just name
changing. It should not have any impacts to the end behavior.

## Additional Context

My plan is to firstly add this small shim layer, which sounds useless at
first, but then I'll implement an emulated driver which can be helpful
for testing and for development.

Currently, on my fork, I'm using a FS driver that allow "mounting" a
local directory from my computer to the device, much like the `-v` mount
option on docker. This allows me to quickly reset `.crosspoint`
directory if anything goes wrong. I plan to upstream this feature when
this PR get merged.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? NO
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