RUI: custom firmware diagram

Hi Fomi, Nero,

I’m trying to build a custom firmware based on the RUI API.

In the examples provided at https://github.com/RAKWireless/Products_practice_based_on_RUI I saw we can hook our own code in user_app.c and app_task.c

Could you please describe the behavior of the program:

  • is the function main() is the entry point and called only once?
  • what does exactly rui_init()?
  • what does exactly rui_running()?
  • what calls the function app_task() in the app_task.c file?
  • can we put the app_task() function code in the file user_app.c to share variables scope?

Thank you very much guys!

OK,
Q1: main() is the entry point and called once.
Q2: rui_init() does initialization of board including all sensors and services. You should put your init code below it.
Q3: rui_running() runs some basic funtions including at part, watchdog, expecially the app_task.
Q4: app_task is a 2G task of cellular to send data to server via tcp, but it should coordinate with at command, you should config your net server infomation via at.
Q5: If you want to develop you own app, I advise that creat your file and call it in main. We supply some timer API for users to add own task and the RTOS will be added later

Thank you Nero,

In the main() function of the example, it’s written to call rui_device_sleep(1) before rui_running(). But the app_task.c will also call rui_device_sleep(1) after processing.


Can you confirm that we should not call rui_device_sleep(1) before rui_running()?
Or did I misunderstood something please?

Nero:
We supply some timer API for users to add own task and the RTOS will be added later

What do you mean by RTOS, your own RTOS? like a fork of FreeRTOS?

Thanks

After call rui_device_sleep(1), the board will be sleep soon. The app_task need go to sleep after finish work. But the main is the loop. So wherever you put your code before rui_running or after, you code will run in the end.

As for the RTOS, we are developing the RUI 4.0. It will be a big upgrate for users and more easy just like Arduino. Of course, it will include freertos.

1 Like

Alright, thank you! Looking forward the new RUI 4.0!