I'm working on a project where power saving is a critical issue and I need some help with the power mode (sleep).
Here is a short description of the project structure:
Save an image form the camera each second to the SD card
Save value from ADC each second to the SD card
Save as much power as possible
After init, I have three interrupts and three tasks:
Tick (timer) – for the OS (FreeRtos)
Call the xPortSysTickHandler
DMA transfer for the camera
Start camera task
ADC complete for the ADC
Start ADC task
Disable the DCMI
Set a flag to indicate that there is a new frame
Set a flag to indicate that there is a new value
Check the flags to find out if there is any data to save (flags from the two above tasks).
Is so, save to file and readable DCMI and ADC
Set a delay for the background task (vTaskDelay)
The go to sleep
This is how the background task looks like:
//check for new data from the camera or ADC
//set a small delay for this task
Everything works fine but I'm not sure about the sleep mode.
Is this the way to use __WFI() function?
Is there a better way to handle power consumption?