Merge branch 'ofw_dev' into dev p1

This commit is contained in:
MX
2024-03-10 23:35:44 +03:00
parent 4e7f25a539
commit 58cd56a439
73 changed files with 958 additions and 229 deletions
@@ -1,6 +1,6 @@
/**
* @file furi_hal_subghz.h
* SubGhz HAL API
* @file cc1101_ext.h
* @brief External CC1101 transceiver access API.
*/
#pragma once
@@ -1,7 +1,11 @@
# Apps Assets folder Example
# Apps Assets folder Example {#example_app_assets}
This example shows how to use the Apps Assets folder to store data that is not part of the application itself, but is required for its operation, and that data is provided with the application.
## Source code
Source code for this example can be found [here](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/examples/example_apps_assets).
## What is the Apps Assets Folder?
The **Apps Assets** folder is a folder where external applications unpack their assets.
@@ -1,3 +1,7 @@
/**
* @file example_apps_assets.c
* @brief Application assets example.
*/
#include <furi.h>
#include <storage/storage.h>
#include <toolbox/stream/stream.h>
@@ -1,7 +1,11 @@
# Apps Data folder Example
# Apps Data folder Example {#example_app_data}
This example demonstrates how to utilize the Apps Data folder to store data that is not part of the app itself, such as user data, configuration files, and so forth.
## Source code
Source code for this example can be found [here](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/examples/example_apps_data).
## What is the Apps Data Folder?
The **Apps Data** folder is a folder used to store data for external apps that are not part of the main firmware.
@@ -1,3 +1,7 @@
/**
* @file example_apps_data.c
* @brief Application data example.
*/
#include <furi.h>
#include <storage/storage.h>
@@ -1,3 +1,7 @@
/**
* @file ble_beacon_app.h
* @brief BLE beacon example.
*/
#pragma once
#include "extra_beacon.h"
@@ -1,3 +1,7 @@
/**
* @file example_custom_font.c
* @brief Custom font example.
*/
#include <furi.h>
#include <furi_hal.h>
+15 -4
View File
@@ -1,11 +1,21 @@
# Application icons
# Application icons {#example_app_images}
## Source code
Source code for this example can be found [here](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/examples/example_images).
## General principle
To use icons, do the following:
* add a line to the application manifest: `fap_icon_assets="folder"`, where `folder` points to the folder where your icons are located
* add `#include "application_id_icons.h"` to the application code, where `application_id` is the appid from the manifest
* every icon in the folder will be available as a `I_icon_name` variable, where `icon_name` is the name of the icon file without the extension
* Add a line to the application manifest: `fap_icon_assets="folder"`, where `folder` points to the folder where your icons are located
* Add `#include "application_id_icons.h"` to the application code, where `application_id` is the appid from the manifest
* Every icon in the folder will be available as a `I_icon_name` variable, where `icon_name` is the name of the icon file without the extension
## Example
We have an application with the following manifest:
```
App(
appid="example_images",
@@ -17,6 +27,7 @@ App(
So the icons are in the `images` folder and will be available in the generated `example_images_icons.h` file.
The example code is located in `example_images_main.c` and contains the following line:
```
#include "example_images_icons.h"
```
@@ -1,3 +1,7 @@
/**
* @file example_images.c
* @brief Custom images example.
*/
#include <furi.h>
#include <furi_hal.h>
@@ -1,5 +1,7 @@
/*
* An example of a plugin host application.
/**
* @file example_plugins.c
* @brief Plugin host application example.
*
* Loads a single plugin and calls its methods.
*/
@@ -1,5 +1,7 @@
/*
* An example of an advanced plugin host application.
/**
* @file example_plugins_multi.c
* @brief Advanced plugin host application example.
*
* It uses PluginManager to load all plugins from a directory
*/
@@ -1,4 +1,9 @@
/* A simple plugin implementing example_plugins application's plugin interface */
/**
* @file plugin1.c
* @brief Plugin example 1.
*
* A simple plugin implementing example_plugins application's plugin interface
*/
#include "plugin_interface.h"
@@ -1,4 +1,9 @@
/* Second plugin implementing example_plugins application's plugin interface */
/**
* @file plugin2.c
* @brief Plugin example 2.
*
* Second plugin implementing example_plugins application's plugin interface
*/
#include "plugin_interface.h"
@@ -1,7 +1,11 @@
/**
* @file plugin_interface.h
* @brief Example plugin interface.
*
* Common interface between a plugin and host application
*/
#pragma once
/* Common interface between a plugin and host application */
#define PLUGIN_APP_ID "example_plugins"
#define PLUGIN_API_VERSION 1
@@ -1,9 +1,12 @@
#pragma once
/*
/**
* @file app_api.h
* @brief Application API example.
*
* This file contains an API that is internally implemented by the application
* It is also exposed to plugins to allow them to use the application's API.
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
@@ -1,4 +1,7 @@
/*
/**
* @file plugin1.c
* @brief Plugin example 1.
*
* This plugin uses both firmware's API interface and private application headers.
* It can be loaded by a plugin manager that uses CompoundApiInterface,
* which combines both interfaces.
@@ -1,4 +1,7 @@
/*
/**
* @file plugin2.c
* @brief Plugin example 2.
*
* This plugin uses both firmware's API interface and private application headers.
* It can be loaded by a plugin manager that uses CompoundApiInterface,
* which combines both interfaces.
@@ -1,7 +1,11 @@
/**
* @file plugin_interface.h
* @brief Example plugin interface.
*
* Common interface between a plugin and host application
*/
#pragma once
/* Common interface between a plugin and host application */
#define PLUGIN_APP_ID "example_plugins_advanced"
#define PLUGIN_API_VERSION 1
@@ -1,8 +1,14 @@
# 1-Wire Thermometer
# 1-Wire Thermometer {#example_thermo}
This example application demonstrates the use of the 1-Wire library with a DS18B20 thermometer.
It also covers basic GUI, input handling, threads and localisation.
## Source code
Source code for this example can be found [here](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/examples/example_thermo).
## Electrical connections
Before launching the application, connect the sensor to Flipper's external GPIO according to the table below:
| DS18B20 | Flipper |
| :-----: | :-----: |
@@ -15,12 +21,14 @@ Before launching the application, connect the sensor to Flipper's external GPIO
*NOTE 2*: For any other pin than 17, connect an external 4.7k pull-up resistor to pin 9.
## Launching the application
In order to launch this demo, follow the steps below:
1. Make sure your Flipper has an SD card installed.
2. Connect your Flipper to the computer via a USB cable.
3. Run `./fbt launch APPSRC=example_thermo` in your terminal emulator of choice.
## Changing the data pin
It is possible to use other GPIO pin as a 1-Wire data pin. In order to change it, set the `THERMO_GPIO_PIN` macro to any of the options listed below:
```c
@@ -1,4 +1,7 @@
/*
/**
* @file example_thermo.c
* @brief 1-Wire thermometer example.
*
* This file contains an example application that reads and displays
* the temperature from a DS18B20 1-wire thermometer.
*
@@ -73,14 +73,14 @@ static const MfClassicKeyPair troika_4k_keys[] = {
{.a = 0x7A38E3511A38, .b = 0xAB16584C972A}, //30
{.a = 0x7545DF809202, .b = 0xECF751084A80}, //31
{.a = 0x5125974CD391, .b = 0xD3EAFB5DF46D}, //32
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //33
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //34
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //35
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //36
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //37
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //38
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //39
{.a = 0xFFFFFFFFFFFF, .b = 0xFFFFFFFFFFFF}, //40
{.a = 0x7A86AA203788, .b = 0xE41242278CA2}, //33
{.a = 0xAFCEF64C9913, .b = 0x9DB96DCA4324}, //34
{.a = 0x04EAA462F70B, .b = 0xAC17B93E2FAE}, //35
{.a = 0xE734C210F27E, .b = 0x29BA8C3E9FDA}, //36
{.a = 0xD5524F591EED, .b = 0x5DAF42861B4D}, //37
{.a = 0xE4821A377B75, .b = 0xE8709E486465}, //38
{.a = 0x518DC6EEA089, .b = 0x97C64AC98CA4}, //39
{.a = 0xBB52F8CCE07F, .b = 0x6B6119752C70}, //40
};
static bool troika_get_card_config(TroikaCardConfig* config, MfClassicType type) {
-1
View File
@@ -248,7 +248,6 @@ void canvas_draw_bitmap(
* @param x x coordinate
* @param y y coordinate
* @param icon Icon instance
* @param flip IconFlip
* @param rotation IconRotation
*/
void canvas_draw_icon_ex(
+1 -1
View File
@@ -107,7 +107,7 @@ CanvasOrientation canvas_get_orientation(const Canvas* canvas);
/** Draw a u8g2 bitmap
*
* @param canvas Canvas instance
* @param u8g2 u8g2 instance
* @param x x coordinate
* @param y y coordinate
* @param width width
+1 -2
View File
@@ -188,8 +188,7 @@ void elements_bubble(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_
* @param canvas Canvas instance
* @param x left x coordinates
* @param y top y coordinate
* @param width bubble width
* @param height bubble height
* @param text text to display
* @param horizontal horizontal aligning
* @param vertical aligning
*/
@@ -114,7 +114,6 @@ void dialog_ex_set_text(
* @param x x position
* @param y y position
* @param icon The icon
* @param name icon to be shown
*/
void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* icon);
@@ -108,7 +108,6 @@ bool scene_manager_handle_back_event(SceneManager* scene_manager);
* Calls Scene event handler with Tick event parameter
*
* @param scene_manager SceneManager instance
* @return true if event was consumed, false otherwise
*/
void scene_manager_handle_tick_event(SceneManager* scene_manager);
+10 -10
View File
@@ -34,44 +34,44 @@ typedef enum {
typedef struct View View;
/** View Draw callback
* @param canvas, pointer to canvas
* @param view_model, pointer to context
* @param canvas pointer to canvas
* @param model pointer to model
* @warning called from GUI thread
*/
typedef void (*ViewDrawCallback)(Canvas* canvas, void* model);
/** View Input callback
* @param event, pointer to input event data
* @param context, pointer to context
* @param event pointer to input event data
* @param context pointer to context
* @return true if event handled, false if event ignored
* @warning called from GUI thread
*/
typedef bool (*ViewInputCallback)(InputEvent* event, void* context);
/** View Custom callback
* @param event, number of custom event
* @param context, pointer to context
* @param event number of custom event
* @param context pointer to context
* @return true if event handled, false if event ignored
*/
typedef bool (*ViewCustomCallback)(uint32_t event, void* context);
/** View navigation callback
* @param context, pointer to context
* @param context pointer to context
* @return next view id
* @warning called from GUI thread
*/
typedef uint32_t (*ViewNavigationCallback)(void* context);
/** View callback
* @param context, pointer to context
* @param context pointer to context
* @warning called from GUI thread
*/
typedef void (*ViewCallback)(void* context);
/** View Update Callback Called upon model change, need to be propagated to GUI
* throw ViewPort update
* @param view, pointer to view
* @param context, pointer to context
* @param view pointer to view
* @param context pointer to context
* @warning called from GUI thread
*/
typedef void (*ViewUpdateCallback)(View* view, void* context);
+2 -2
View File
@@ -44,7 +44,7 @@ View* view_stack_get_view(ViewStack* view_stack);
* Adds View on top of ViewStack.
*
* @param view_stack instance
* @view view view to add
* @param view view to add
*/
void view_stack_add_view(ViewStack* view_stack, View* view);
@@ -52,7 +52,7 @@ void view_stack_add_view(ViewStack* view_stack, View* view);
* If no View to remove found - ignore.
*
* @param view_stack instance
* @view view view to remove
* @param view view to remove
*/
void view_stack_remove_view(ViewStack* view_stack, View* view);
+3 -3
View File
@@ -339,7 +339,7 @@ FS_Error storage_common_merge(Storage* storage, const char* old_path, const char
* @brief Create a directory.
*
* @param storage pointer to a storage API instance.
* @param fs_path pointer to a zero-terminated string containing the directory path.
* @param path pointer to a zero-terminated string containing the directory path.
* @return FSE_OK if the directory has been successfully created, any other error code on failure.
*/
FS_Error storage_common_mkdir(Storage* storage, const char* path);
@@ -366,7 +366,6 @@ FS_Error storage_common_fs_info(
*
* @param storage pointer to a storage API instance.
* @param path pointer to a zero-terminated string containing the path in question.
* @return true if the path was successfully resolved, false otherwise.
*/
void storage_common_resolve_path_and_ensure_app_directory(Storage* storage, FuriString* path);
@@ -526,7 +525,8 @@ FS_Error storage_int_backup(Storage* storage, const char* dstname);
* @param converter pointer to a filename conversion function (may be NULL).
* @return FSE_OK if the storage was successfully restored, any other error code on failure.
*/
FS_Error storage_int_restore(Storage* api, const char* dstname, Storage_name_converter converter);
FS_Error
storage_int_restore(Storage* storage, const char* dstname, Storage_name_converter converter);
/***************** Simplified Functions ******************/
@@ -2,8 +2,8 @@
#include "storage.h"
#include <toolbox/tar/tar_archive.h>
FS_Error storage_int_backup(Storage* api, const char* dstname) {
TarArchive* archive = tar_archive_alloc(api);
FS_Error storage_int_backup(Storage* storage, const char* dstname) {
TarArchive* archive = tar_archive_alloc(storage);
bool success = tar_archive_open(archive, dstname, TAR_OPEN_MODE_WRITE) &&
tar_archive_add_dir(archive, STORAGE_INT_PATH_PREFIX, "") &&
tar_archive_finalize(archive);
@@ -11,8 +11,9 @@ FS_Error storage_int_backup(Storage* api, const char* dstname) {
return success ? FSE_OK : FSE_INTERNAL;
}
FS_Error storage_int_restore(Storage* api, const char* srcname, Storage_name_converter converter) {
TarArchive* archive = tar_archive_alloc(api);
FS_Error
storage_int_restore(Storage* storage, const char* srcname, Storage_name_converter converter) {
TarArchive* archive = tar_archive_alloc(storage);
bool success = tar_archive_open(archive, srcname, TAR_OPEN_MODE_READ) &&
tar_archive_unpack_to(archive, STORAGE_INT_PATH_PREFIX, converter);
tar_archive_free(archive);