Fix markdown format with autoformatter (#1284)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Apps
|
||||
|
||||
This page will teach you:
|
||||
|
||||
- what screens and apps are in InfiniTime
|
||||
- how to implement your own app
|
||||
|
||||
@@ -14,6 +16,7 @@ Apps are responsible for everything drawn on the screen when they are running.
|
||||
By default, apps only do something (as in a function is executed) when they are created or when a touch event is detected.
|
||||
|
||||
## Interface
|
||||
|
||||
Every app class has to be inside the namespace `Pinetime::Applications::Screens` and inherit from `Screen`.
|
||||
The constructor should have at least one parameter `DisplayApp* app`, which it needs for the constructor of its parent class Screen.
|
||||
Other parameters should be references to controllers that the app needs.
|
||||
@@ -24,10 +27,12 @@ it does not need to override any of these functions, as LVGL can also handle tou
|
||||
If you have any doubts, you can always look at how the other apps function for reference.
|
||||
|
||||
### Continuous updating
|
||||
|
||||
If your app needs to be updated continuously, you can do so by overriding the `Refresh()` function in your class
|
||||
and calling `lv_task_create` inside the constructor.
|
||||
|
||||
An example call could look like this:
|
||||
|
||||
```cpp
|
||||
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
|
||||
```
|
||||
@@ -37,9 +42,11 @@ Remember to delete the task again using `lv_task_del`.
|
||||
The function `RefreshTaskCallback` is inherited from `Screen` and just calls your `Refresh` function.
|
||||
|
||||
## Creating your own app
|
||||
|
||||
A minimal app could look like this:
|
||||
|
||||
MyApp.h:
|
||||
|
||||
```cpp
|
||||
#pragma once
|
||||
|
||||
@@ -60,6 +67,7 @@ namespace Pinetime {
|
||||
```
|
||||
|
||||
MyApp.cpp:
|
||||
|
||||
```cpp
|
||||
#include "displayapp/screens/MyApp.h"
|
||||
#include "displayapp/DisplayApp.h"
|
||||
@@ -77,6 +85,7 @@ MyApp::~MyApp() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
}
|
||||
```
|
||||
|
||||
Both of these files should be in [displayapp/screens/](/src/displayapp/screens/)
|
||||
or [displayapp/screens/settings/](/src/displayapp/screens/settings/) if it's a setting app.
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
# Introduction to the code
|
||||
|
||||
This page is meant to guide you through the source code, so you can find the relevant files for what you're working on.
|
||||
|
||||
## FreeRTOS
|
||||
|
||||
Infinitime is based on FreeRTOS, a real-time operating system.
|
||||
FreeRTOS provides several quality of life abstractions (for example easy software timers)
|
||||
and most importantly supports multiple tasks.
|
||||
@@ -12,6 +14,7 @@ The task scheduler is responsible for giving every task enough cpu time.
|
||||
As there is only one core on the SoC of the PineTime, real concurrency is impossible and the scheduler has to swap tasks in and out to emulate it.
|
||||
|
||||
### Tasks
|
||||
|
||||
Tasks are created by calling `xTaskCreate` and passing a function with the signature `void functionName(void*)`.
|
||||
For more info on task creation see the [FreeRTOS Documentation](https://www.freertos.org/a00125.html).
|
||||
In our case, main calls `systemTask.Start()`, which creates the **"MAIN" task**.
|
||||
@@ -29,6 +32,7 @@ it will need instead of just typing in a large-ish number.
|
||||
You can use `configMINIMAL_STACK_SIZE` which is currently set to 120 words.
|
||||
|
||||
## Controllers
|
||||
|
||||
Controllers in InfiniTime are singleton objects that can provide access to certain resources to apps.
|
||||
Some of them interface with drivers, others are the driver for the resource.
|
||||
The resources provided don't have to be hardware-based.
|
||||
@@ -37,7 +41,9 @@ Some controllers can be passed by reference to apps that need access to the reso
|
||||
They reside in [components/](/src/components/) inside their own subfolder.
|
||||
|
||||
## Apps
|
||||
|
||||
For more detail see the [Apps page](./Apps.md)
|
||||
|
||||
## Bluetooth
|
||||
|
||||
Header files with short documentation for the functions are inside [libs/mynewt-nimble/nimble/host/include/host/](/src/libs/mynewt-nimble/nimble/host/include/host/).
|
||||
|
Reference in New Issue
Block a user