From e7aa6caf0e20cfba3c856ab32d2d037f6d948857 Mon Sep 17 00:00:00 2001 From: aanper Date: Wed, 26 Aug 2020 08:59:27 +0300 Subject: [PATCH] move examples to folder, separate page --- wiki/_Sidebar.md | 4 +++ .../Blink-app.md} | 29 +---------------- wiki/fw/Application-examples.md | 32 +++++++++++++++++++ wiki/fw/Firmware.md | 1 + 4 files changed, 38 insertions(+), 28 deletions(-) rename wiki/{devlog/FURI_and_examples.md => examples/Blink-app.md} (67%) create mode 100644 wiki/fw/Application-examples.md diff --git a/wiki/_Sidebar.md b/wiki/_Sidebar.md index b32ba0e9..878614f3 100644 --- a/wiki/_Sidebar.md +++ b/wiki/_Sidebar.md @@ -14,6 +14,10 @@ _please, do not edit wiki directly in web-interface. Read [contrubution guide](C * [Timers](Timers) * [UI](UI) +# [Examples](Application-examples) + +* [Blink](Blink-app) + # Hardware * [Hardware-specification](Hardware-specification) diff --git a/wiki/devlog/FURI_and_examples.md b/wiki/examples/Blink-app.md similarity index 67% rename from wiki/devlog/FURI_and_examples.md rename to wiki/examples/Blink-app.md index 8e4f8f72..f5b0fe6e 100644 --- a/wiki/devlog/FURI_and_examples.md +++ b/wiki/examples/Blink-app.md @@ -1,32 +1,5 @@ -One of the most important component of Flipper Core is [FURI](FURI) (Flipper Universal Registry Implementation). It helps control the applications flow, make dynamic linking and interaction between applications. - -In fact, FURI is just wrapper around RTOS thread management and mutexes, and callback management. - -In this article we create few application, interact between apps, use OS functions and interact with HAL. - -# Simple Blink app - First, let's create a simple led blinking application. -## General agreements - -Flipper application is just a function: - -```C -void application_name(void* p) { - // Setup - - while(1) { - // Loop - } -} -``` - -1. `void* p` is arbitrary pointer that may be used for pass parameters to application at launch (like argc/argv in POSIX). -2. Application must never attempt to return or exit from their implementing function. -3. Avoid long cycles without any "waits" or "blocking" like `delay` or `xQueueReceive`, otherwise your app will blocking overall Flipper work. -4. Do not create static variables inside function or global variables. Use only local variables. We plan to add virual in-RAM filesystem to save any persistent data. - ## Preparing for launch We will use integrated LED. Look at the schematic: @@ -104,7 +77,7 @@ Run: `docker-compose exec dev target_lo/build/target_lo`. -Зырим как светодиод пытается мигать. +Linux version has no LED or GPIO, but we can see debug messages how state of GPIO is changing: ![](https://github.com/Flipper-Zero/flipperzero-firmware-community/raw/master/wiki_static/application_examples/example_blink.gif) diff --git a/wiki/fw/Application-examples.md b/wiki/fw/Application-examples.md new file mode 100644 index 00000000..63a90e98 --- /dev/null +++ b/wiki/fw/Application-examples.md @@ -0,0 +1,32 @@ +One of the most important component of Flipper Core is [FURI](FURI) (Flipper Universal Registry Implementation). It helps control the applications flow, make dynamic linking and interaction between applications. + +In fact, FURI is just wrapper around RTOS thread management and mutexes, and callback management. + +In this article we create few application, interact between apps, use OS functions and interact with HAL. + +# Simple Blink app + +First, let's create a simple led blinking application. + +## General agreements + +Flipper application is just a function: + +```C +void application_name(void* p) { + // Setup + + while(1) { + // Loop + } +} +``` + +1. `void* p` is arbitrary pointer that may be used for pass parameters to application at launch (like argc/argv in POSIX). +2. Application must never attempt to return or exit from their implementing function. +3. Avoid long cycles without any "waits" or "blocking" like `delay` or `xQueueReceive`, otherwise your app will blocking overall Flipper work. +4. Do not create static variables inside function or global variables. Use only local variables. We plan to add virual in-RAM filesystem to save any persistent data. + +# Application examples + +**[Blink](Blink-app)** diff --git a/wiki/fw/Firmware.md b/wiki/fw/Firmware.md index 05099494..e9f22427 100644 --- a/wiki/fw/Firmware.md +++ b/wiki/fw/Firmware.md @@ -147,6 +147,7 @@ You can run firmware locally (with HAL stub). * `docker-compose exec dev make -C target_lo` for build * `docker-compose exec dev target_lo/build/target_lo` for run +* `docker-compose exec dev make -C target_lo test` for running tests ## Build in IDE