-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add Display HAL class to use LovyanGFX or Arduino GFX or M5GFX or TFT_eSPI #2048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
|
|
||
| void tft_sprite::fillScreen(uint32_t color) { TFT_eSprite::fillSprite(color); } | ||
|
|
||
| void tft_sprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color) { | ||
| TFT_eSprite::fillRect(x, y, w, h, color); | ||
| } | ||
|
|
||
| void tft_sprite::fillCircle(int32_t x, int32_t y, int32_t r, uint32_t color) { | ||
| TFT_eSprite::fillCircle(x, y, r, color); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if my solution with implementing it on library side was a mistake.
I think cleaner solution will be to put all code with mutexes in our HAL.
That way we would not modify all libraries that we are including, so we don't have to fork and maintain them.
And when we find that other device (speaker or sensor) that is using the same bus/peripheral and using them simultaneously with display is causing panic and reboots, we can share mutexes between them easily.
So like this:
| void tft_sprite::fillScreen(uint32_t color) { TFT_eSprite::fillSprite(color); } | |
| void tft_sprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color) { | |
| TFT_eSprite::fillRect(x, y, w, h, color); | |
| } | |
| void tft_sprite::fillCircle(int32_t x, int32_t y, int32_t r, uint32_t color) { | |
| TFT_eSprite::fillCircle(x, y, r, color); | |
| } | |
| static SemaphoreHandle_t tftMutex; | |
| void tft_sprite::fillScreen(uint32_t color) { | |
| xSemaphoreTakeRecursive(tftMutex, portMAX_DELAY); | |
| TFT_eSprite::fillSprite(color); | |
| xSemaphoreGiveRecursive(tftMutex); | |
| } | |
| void tft_sprite::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color) { | |
| xSemaphoreTakeRecursive(tftMutex, portMAX_DELAY); | |
| TFT_eSprite::fillRect(x, y, w, h, color); | |
| xSemaphoreGiveRecursive(tftMutex); | |
| } | |
| void tft_sprite::fillCircle(int32_t x, int32_t y, int32_t r, uint32_t color) { | |
| xSemaphoreTakeRecursive(tftMutex, portMAX_DELAY); | |
| TFT_eSprite::fillCircle(x, y, r, color); | |
| xSemaphoreGiveRecursive(tftMutex); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! I'll do it on Monday!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! I'll do it on Monday!
Still need to add MUTEX to these other libraries