2021-04-21 04:49 AM
Hello,
I am working on a Cortex M4 and I'd like to add some power-saving features to my program and figured I'd need to detect user activity. For this reason, I'd like to
Furthermore, I created a dedicated "charging screen" (basically only an animated battery filling up some bars in a loop) from which I want to go to power-saving mode even when a user touches the screen in order to charge faster.
So, my questions are:
Thanks in advance.
Solved! Go to Solution.
2021-04-21 06:10 AM
sampleTouch() is called from the pre-compiled TouchGFX library code, see attached stack trace. You could try adding a flag to TouchController that sets itself on a touch event and clears when read. Read that flag from the Model::tick() function and if too many ticks pass without the flag being set, send whatever signals you need to send to the backend to start the powerdown process, e.g. through an RTOS queue. I don't have experience with low power modes so I can't speak any further on it, good luck.
2021-04-21 05:43 AM
Simply timing you need place to model tick
and reset on any UI place .
Dim is based on your type of design.
When in sleep you do nothing then simply after timeout suspend rtos and stop mcu. (after LCD off)
Wakeup is more complicated , but basic method is make wathdog reset after wakeup and start sw as on power on...
2021-04-21 06:01 AM
> Simply timing you need place to model tick
How does the model know whether or not a valid touch was sampled? As far as I could see, the model doesn't know about the TouchController. Could you point me to where it could get sampled touches?
> and reset on any UI place .
Do you mean on any ...Presenter::activate()? If so, I have controls (e.g. sliders) that do not necessarily change screens when controlled. So, I think if a user uses these controls, the presenter couldn't reset the timer. Besides, I would like to have "aimless screen tapping" (not controlling any buttons or sliders) as a means to keep the display awake.
> Dim is based on your type of design.
Dimming in general isn't an issue, I use PWM to control the screen's brightness.
> When in sleep you do nothing then simply after timeout suspend rtos and stop mcu. (after LCD off)
>Wakeup is more complicated , but basic method is make wathdog reset after wakeup and start sw as on power on...
As "clean reset" seems difficult, I wanted to try and just reduce the clock for this, not necessarily suspend the OS. The clock is currently running at 168MHz, and I thought that waiting for an interrupt of a single HW button and not displaying anything on screen should be possible with quite a bit less.
2021-04-21 06:10 AM
sampleTouch() is called from the pre-compiled TouchGFX library code, see attached stack trace. You could try adding a flag to TouchController that sets itself on a touch event and clears when read. Read that flag from the Model::tick() function and if too many ticks pass without the flag being set, send whatever signals you need to send to the backend to start the powerdown process, e.g. through an RTOS queue. I don't have experience with low power modes so I can't speak any further on it, good luck.
2021-04-21 06:19 AM
model tick only increment global timeout and when is bigger as limit suspend all as you need, model dont need info about touch, here only timo++ and if
when you use only touch as source of UI events then in I2C driver for touch receive place timo=0 8)