Skip to content
Jakob Krantz edited this page Sep 3, 2024 · 5 revisions

How to use Apps on the watch

It´s possible to change the function set of the watch by adding, removing or creating apps. The firmware contains a set of predefined apps which can be used by default.

How to enable / disable default apps

Each app can be enabled / disabled via ZSWatch -> Applications in Kconfig. Please note that specific apps do have specific requirements to get used.

image

How to write custom apps

I recommend watching this part of my presentation at Zephyr Developer Summit where I build a sample app.

Check out the sample application for the general app design. The main idea is each app have an <app_name>_app.c file which registers the app, chooses icon and drives the logic for the app. Then there should be one or more files named for example <app_name>_ui.c containing pure LVGL code with no dependencies to Zephyr or the watch software. The idea is that this UI code should be runnable in a LVGL simulator to speed up development of UI, however right now that's not set up yet. The <app_name>_app.c will do all logic and call functions in <app_name>_ui.c to update the UI accordingly.

Each application needs to have a way to close itself, for example a button, and then through callback tell the application_manager.c to close the app:

When user clicks an app in the app picker:

  • application_manager.c deletes it's UI elements and calls the application_start_fn.
  • <app_name>_app.c will do necessary init and then call the <app_name>_ui.c to draw the app UI.
  • User can now navigate arund and the application and do whatever.

When user for example presses a close button in the application:

  • Typically a callback from the UI code in <app_name>_ui.c will call <app_name>_app.c to tell that user requested to close the app. <app_name>_app.c will notify application_manager.c that it want to close itself. application_manager.c will then call <app_name>_app.c application_stop_fn and <app_name>_app.c will tell UI to close then do necessary de-init and return.
  • application_manager.c will now draw the app picker again.

The application manager can also at any time close a running application by calling it's application_stop_fn.

Clone this wiki locally