I am creating a system (nRF52 SDK11.0.0 s132) that will get a data ready interrupt on a GPIO (configured via GPIOTE with a handler) from a sensor every 4ms. The sensor has an SPI slave interface for reading the data. The handler will either set a flag for that will trigger an SPI data read in the main superloop, use the scheduler to trigger an SPI data read, or trigger an SPI data read directly.
After a number of samples, a data processing function will be run on these samples that takes 10ms to run (a double buffer scheme will be used). Hence the data processing function needs to run in a lower priority context than the data reads, otherwise I will miss samples.
Can I use the scheduler in this scheme, and if so, how do I set the priorities of the data read versus the algorithm tasks? If not, what's the simplest (and robust) way to do this without RTOS?