feat: add HalDisplay and HalGPIO#522
Conversation
|
Is the idea here that a test-friendly non-X4 specific subclass of |
|
I'm not 100% what do you mean by "local testing", but yes the overall idea is that 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 |
|
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. |
|
Ahh I see it's been benched |
|
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. |
|
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 |
|
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. |
|
I resolved the merge conflicts & tested it. Most of the changes are just renaming though |
* 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) ...
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)
## 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**
## 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
## 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
## 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
## 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
## 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
## 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**
## 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
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