Basic RTOS for education/learning

Hi,

I am new to photon boards and recently ordered the inventor’s kit from Sparkfun. I want to get a very simple project up and running, but want to make use of RTOS concepts. A basic “home-made” RTOS.

Is it possible to do the following

main()
{
    /*init  SW structures*/

    /*init comms - setup wifi*/

    /*init hw (gpios, I2C, etc)*/

    /*if all OK, run the loop*/

    /*loop - just to give an idea, not really while loop here*/
    while(1)
    {
          /*read peripherals - based on interrupts/timers*/
         
         /*process*/
    
        /*post to web*/
    }    
}

Can I use the firmware libraries to do this? Where can I get access to main?
I have worked on similar projects with smaller micro controllers boards but this is the first time with a wifi.

FYI: I want to develop in C and have setup XCode as development platform.

Thank you.

Well, the firmware already contains all the things you mention: an RTOS (although not a home-made one :smile:), a main function that sets up the hardware and runs a process loop.

Here’s the main function.

If you want to use it for a simple project, follow the getting started guide.

If you want to tinker with the low-level software to learn, you’ll need to install the toolchain to compile the firmware to your computer (see other posts on the forum about local toolchain), and recompile the firmware from GitHub