Resource sharing on SPI

I have designed a board with 16 a/d channels and 8 d/a channels (12bit) with an Atmega328p processor. Both devices are on an SPI bus. It all works just fine.

I am now using Easy Schedular to run the tasks

My question is "by haveing separate task running at different intervals can the both access the SPI bus at the same time unintentionally".

I've done some reading RTOS and the term "gatekeeper" is used to prevent the case mentioned.

Would some code like this be required or are the separated tasks sufficent?

Be gentle I'm a hardware guy.

The 328p is not multi-threaded. Your tasks must run sequentially. So long as each function completes its work in a single call it will work fine.

An example of not working fine would be to open a file on an SD card for writing and then leaving it open after the function completes.

RTOS is basically useless for the AVR Arduinos as it takes up so much space there is not enough left to do more than a simple program. A simple program doesn't need an RTOS.

I am now using Easy Schedular to run the tasks

Post a link to that library!

thanks all