This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Updating a display from events

I built my project on ble_app_uart peripheral example from SDK 12.2 and have added a display (Sharp LS044Q7DH01) using nRF52 as a SPI master to communicate. I think I have DMA enabled but I am not sure (...)

This is the first time i make a driver and a framework for a display so please bear with me :-)

I use a display buffer on the MCU and a function pointers to print to different parts of the display with different text sizes, cursor location etc.

Different events are to change different things on the display but I notice if I have several events getting triggered very close to each other, sometimes the "rest" of the string to be printed in a subframe on the display has been placed elsewhere. E.g. a measurement value has been placed where the name of a person should be. This indicates to me that the process of printing one string to the display has been interrupted by another event that is to print another string on a different part on the display, a typical real-time problem.

I have used (nested) critical section for some parts of the display driver, but I would prefer to have a mutex dedicated to the display.

I updated my program to only push the display buffer to the display at the end of the main loop instead of using it inside events, so hopefully it's a bit better.

  • Is there any mutex like functionality or implementation I can use without implementing a RTOS?

I was thinking about a "inverted" one shot timer that allows me to only update display if it's not been updated within the last 20 ms as a possible solution but it seems suboptimal..

Edit; updated question with regards to Daniel Wang's comment

Related