mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 13:09:49 +04:00
Merge branch 'fz-dev' into dev
This commit is contained in:
@@ -231,7 +231,30 @@ void nfc_show_loading_popup(void* context, bool show) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool nfc_is_hal_ready() {
|
||||||
|
if(!furi_hal_nfc_is_init()) {
|
||||||
|
// No connection to the chip, show an error screen
|
||||||
|
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||||
|
DialogMessage* message = dialog_message_alloc();
|
||||||
|
dialog_message_set_text(
|
||||||
|
message,
|
||||||
|
"Error!\nNFC chip failed to start\n\n\nSend a photo of this to:\nsupport@flipperzero.one",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
AlignLeft,
|
||||||
|
AlignTop);
|
||||||
|
dialog_message_show(dialogs, message);
|
||||||
|
dialog_message_free(message);
|
||||||
|
furi_record_close(RECORD_DIALOGS);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t nfc_app(void* p) {
|
int32_t nfc_app(void* p) {
|
||||||
|
if(!nfc_is_hal_ready()) return 0;
|
||||||
|
|
||||||
Nfc* nfc = nfc_alloc();
|
Nfc* nfc = nfc_alloc();
|
||||||
char* args = p;
|
char* args = p;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <nfc/scenes/nfc_scene.h>
|
#include <nfc/scenes/nfc_scene.h>
|
||||||
#include <nfc/helpers/nfc_custom_event.h>
|
#include <nfc/helpers/nfc_custom_event.h>
|
||||||
|
|
||||||
|
#include <dialogs/dialogs.h>
|
||||||
|
|
||||||
#include "rpc/rpc_app.h"
|
#include "rpc/rpc_app.h"
|
||||||
|
|
||||||
#define NFC_TEXT_STORE_SIZE 128
|
#define NFC_TEXT_STORE_SIZE 128
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
App(
|
App(
|
||||||
appid="picopass",
|
appid="picopass",
|
||||||
name="PicoPass Reader",
|
name="PicoPass Reader",
|
||||||
apptype=FlipperAppType.PLUGIN,
|
apptype=FlipperAppType.EXTERNAL,
|
||||||
entry_point="picopass_app",
|
entry_point="picopass_app",
|
||||||
requires=[
|
requires=[
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
# Flipper Application Manifests (.fam)
|
# Flipper Application Manifests (.fam)
|
||||||
|
|
||||||
All components of Flipper Zero firmware — services, user applications, system settings — are developed independently. Each component has a build system manifest file, named `application.fam`, defining basic properties of a components and its relations to other parts of the system.
|
All components of Flipper Zero firmware — services, user applications, system settings — are developed independently. Each component has a build system manifest file, named `application.fam`, which defines basic properties of that component and its relations to other parts of the system.
|
||||||
|
|
||||||
When building firmware, **`fbt`** collects all application manifests, processes their dependencies and builds only those components that are utilized in current build configuration. See [fbt docs](./fbt.md#firmware-application-set) for details on build configurations.
|
When building firmware, **`fbt`** collects all application manifests and processes their dependencies. Then it builds only those components that are referenced in the current build configuration. See [fbt docs](./fbt.md#firmware-application-set) for details on build configurations.
|
||||||
|
|
||||||
## Application definition
|
## Application definition
|
||||||
|
|
||||||
Properties of a firmware component are declared in a form of a Python code snippet, forming a call to App() function with various parameters.
|
Properties of a firmware component are declared in a form of a Python code snippet, forming a call to App() function with various parameters.
|
||||||
|
|
||||||
Only 2 parameters are mandatoty: ***appid*** and ***apptype***, others are optional and may be meaningful only for certain application types.
|
Only 2 parameters are mandatory: ***appid*** and ***apptype***, others are optional and may only be meaningful for certain application types.
|
||||||
|
|
||||||
### Keys
|
### Parameters
|
||||||
|
|
||||||
* **appid**: string, application id within the build system. Used for specifying which applications to include in build configuration and to resolve dependencies and conflicts.
|
* **appid**: string, application id within the build system. Used for specifying which applications to include in build configuration and to resolve dependencies and conflicts.
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ Only 2 parameters are mandatoty: ***appid*** and ***apptype***, others are optio
|
|||||||
| SERVICE | System service, created at early startup |
|
| SERVICE | System service, created at early startup |
|
||||||
| SYSTEM | Application not being shown in any menus. Can be started by other apps or from CLI |
|
| SYSTEM | Application not being shown in any menus. Can be started by other apps or from CLI |
|
||||||
| APP | Regular application for main menu |
|
| APP | Regular application for main menu |
|
||||||
| PLUGIN | Application to be built as .fap plugin |
|
| PLUGIN | Application to be built as a part of firmware an to be placed in Plugins menu |
|
||||||
| DEBUG | Application only visible in Debug menu with debug mode enabled |
|
| DEBUG | Application only visible in Debug menu with debug mode enabled |
|
||||||
| ARCHIVE | One and only Archive app |
|
| ARCHIVE | One and only Archive app |
|
||||||
| SETTINGS | Application to be placed in System settings menu |
|
| SETTINGS | Application to be placed in System settings menu |
|
||||||
@@ -29,25 +29,28 @@ Only 2 parameters are mandatoty: ***appid*** and ***apptype***, others are optio
|
|||||||
| EXTERNAL | Application to be built as .fap plugin |
|
| EXTERNAL | Application to be built as .fap plugin |
|
||||||
| METAPACKAGE | Does not define any code to be run, used for declaring dependencies and application bundles |
|
| METAPACKAGE | Does not define any code to be run, used for declaring dependencies and application bundles |
|
||||||
|
|
||||||
* **name**: Name to show in menus.
|
* **name**: Name that is displayed in menus.
|
||||||
* **entry_point**: C function to be used as applicaiton's entry point.
|
* **entry_point**: C function to be used as application's entry point.
|
||||||
* **flags**: Internal flags for system apps. Do not use.
|
* **flags**: Internal flags for system apps. Do not use.
|
||||||
* **cdefines**: C preprocessor definitions to declare globally for other apps when current application is included in active build configuration.
|
* **cdefines**: C preprocessor definitions to declare globally for other apps when current application is included in active build configuration.
|
||||||
* **requires**: List of application IDs to also include in build configuration, when current application is referenced in list of applications to build.
|
* **requires**: List of application IDs to also include in build configuration, when current application is referenced in list of applications to build.
|
||||||
* **conflicts**: List of application IDs that current application conflicts with. If any of them is found in constructed application list, **`fbt`** will abort firmware build process.
|
* **conflicts**: List of application IDs that current application conflicts with. If any of them is found in constructed application list, **`fbt`** will abort firmware build process.
|
||||||
* **provides**: Functionally identical to ***requires*** field.
|
* **provides**: Functionally identical to ***requires*** field.
|
||||||
* **stack_size**: Stack size, in bytes, to allocate for application on its startup. Note that allocating a stack too small for app to run will cause system crash due to stack overflow, and allocating too much stack will reduce usable heap memory size for app to process data. *Note: you can use `ps` and `free` CLI commands to profile you app's memory usage.*
|
* **stack_size**: Stack size, in bytes, to allocate for application on its startup. Note that allocating a stack that is too small for an app to run will cause system crash due to stack overflow, and allocating too much stack space will reduce usable heap memory size for apps to process data. *Note: you can use `ps` and `free` CLI commands to profile your app's memory usage.*
|
||||||
* **icon**: Animated icon name from built-in assets to be used when building app as a part of firmware.
|
* **icon**: Animated icon name from built-in assets to be used when building app as a part of firmware.
|
||||||
* **order**: Order of an application within its group when sorting entries in it. The lower the order is, the closer to the start of the list the items is located. Used for ordering startup hooks and menu entries.
|
* **order**: Order of an application within its group when sorting entries in it. The lower the order is, the closer to the start of the list the item is placed. *Used for ordering startup hooks and menu entries.*
|
||||||
* **sdk_headers**: List of C header files from this app's code to include in API definitions for external applicaions.
|
* **sdk_headers**: List of C header files from this app's code to include in API definitions for external applications.
|
||||||
|
|
||||||
The following parameters are used only for [FAPs](./AppsOnSDCard.md):
|
The following parameters are used only for [FAPs](./AppsOnSDCard.md):
|
||||||
|
|
||||||
* **sources**: list of file name masks, used for gathering sources within app folder. Default value of ["\*.c\*"] includes C and CPP source files.
|
* **sources**: list of file name masks, used for gathering sources within app folder. Default value of ["\*.c\*"] includes C and CPP source files.
|
||||||
* **version**: string, 2 numbers in form of "x.y": application version to be embedded within .fap file.
|
* **fap_version**: string, 2 numbers in form of "x.y": application version to be embedded within .fap file.
|
||||||
* **fap_icon**: name of .png file, 1-bit color depth, 10x10px, to be embedded within .fap file.
|
* **fap_icon**: name of a .png file, 1-bit color depth, 10x10px, to be embedded within .fap file.
|
||||||
* **fap_libs**: list of extra libraries to link application against. Provides access to extra functions that are not exported as a part of main firmware at expense of increased .fap file size and RAM consumption.
|
* **fap_libs**: list of extra libraries to link application against. Provides access to extra functions that are not exported as a part of main firmware at expense of increased .fap file size and RAM consumption.
|
||||||
* **fap_category**: string, may be empty. App subcategory, also works as path of FAP within apps folder in the file system.
|
* **fap_category**: string, may be empty. App subcategory, also works as path of FAP within apps folder in the file system.
|
||||||
|
* **fap_description**: string, may be empty. Short application descriotion.
|
||||||
|
* **fap_author**: string, may be empty. Application's author.
|
||||||
|
* **fap_weburl**: string, may be empty. Application's homepage.
|
||||||
|
|
||||||
|
|
||||||
## .fam file contents
|
## .fam file contents
|
||||||
@@ -76,4 +79,4 @@ App(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
For more examples, see application.fam files for basic firmware components.
|
For more examples, see .fam files from various firmware parts.
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ FIRMWARE_APPS = {
|
|||||||
"system_apps",
|
"system_apps",
|
||||||
# Settings
|
# Settings
|
||||||
"settings_apps",
|
"settings_apps",
|
||||||
# Plugins
|
# Stock plugins - no longer built into fw, now they're .faps
|
||||||
|
# Yet you can still build them as a part of fw
|
||||||
# "basic_plugins",
|
# "basic_plugins",
|
||||||
# Debug
|
# Debug
|
||||||
# "debug_apps",
|
# "debug_apps",
|
||||||
|
|||||||
@@ -1116,6 +1116,7 @@ Function,+,furi_hal_nfc_field_off,void,
|
|||||||
Function,+,furi_hal_nfc_field_on,void,
|
Function,+,furi_hal_nfc_field_on,void,
|
||||||
Function,-,furi_hal_nfc_init,void,
|
Function,-,furi_hal_nfc_init,void,
|
||||||
Function,+,furi_hal_nfc_is_busy,_Bool,
|
Function,+,furi_hal_nfc_is_busy,_Bool,
|
||||||
|
Function,+,furi_hal_nfc_is_init,_Bool,
|
||||||
Function,+,furi_hal_nfc_listen,_Bool,"uint8_t*, uint8_t, uint8_t*, uint8_t, _Bool, uint32_t"
|
Function,+,furi_hal_nfc_listen,_Bool,"uint8_t*, uint8_t, uint8_t*, uint8_t, _Bool, uint32_t"
|
||||||
Function,+,furi_hal_nfc_listen_rx,_Bool,"FuriHalNfcTxRxContext*, uint32_t"
|
Function,+,furi_hal_nfc_listen_rx,_Bool,"FuriHalNfcTxRxContext*, uint32_t"
|
||||||
Function,+,furi_hal_nfc_listen_sleep,void,
|
Function,+,furi_hal_nfc_listen_sleep,void,
|
||||||
|
|||||||
|
@@ -39,6 +39,10 @@ bool furi_hal_nfc_is_busy() {
|
|||||||
return rfalNfcGetState() != RFAL_NFC_STATE_IDLE;
|
return rfalNfcGetState() != RFAL_NFC_STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool furi_hal_nfc_is_init() {
|
||||||
|
return rfalNfcGetState() != RFAL_NFC_STATE_NOTINIT;
|
||||||
|
}
|
||||||
|
|
||||||
void furi_hal_nfc_field_on() {
|
void furi_hal_nfc_field_on() {
|
||||||
furi_hal_nfc_exit_sleep();
|
furi_hal_nfc_exit_sleep();
|
||||||
st25r3916TxRxOn();
|
st25r3916TxRxOn();
|
||||||
|
|||||||
@@ -107,6 +107,12 @@ void furi_hal_nfc_init();
|
|||||||
*/
|
*/
|
||||||
bool furi_hal_nfc_is_busy();
|
bool furi_hal_nfc_is_busy();
|
||||||
|
|
||||||
|
/** Check if nfc is initialized
|
||||||
|
*
|
||||||
|
* @return true if initialized
|
||||||
|
*/
|
||||||
|
bool furi_hal_nfc_is_init();
|
||||||
|
|
||||||
/** NFC field on
|
/** NFC field on
|
||||||
*/
|
*/
|
||||||
void furi_hal_nfc_field_on();
|
void furi_hal_nfc_field_on();
|
||||||
|
|||||||
@@ -63,7 +63,10 @@ def build_app_as_external(env, appdef):
|
|||||||
extapps["dist"][appdef.appid] = (appdef.fap_category, compact_elf)
|
extapps["dist"][appdef.appid] = (appdef.fap_category, compact_elf)
|
||||||
|
|
||||||
|
|
||||||
apps_to_build_as_faps = [FlipperAppType.PLUGIN, FlipperAppType.EXTERNAL]
|
apps_to_build_as_faps = [
|
||||||
|
FlipperAppType.PLUGIN,
|
||||||
|
FlipperAppType.EXTERNAL,
|
||||||
|
]
|
||||||
if appenv["DEBUG_TOOLS"]:
|
if appenv["DEBUG_TOOLS"]:
|
||||||
apps_to_build_as_faps.append(FlipperAppType.DEBUG)
|
apps_to_build_as_faps.append(FlipperAppType.DEBUG)
|
||||||
|
|
||||||
|
|||||||
@@ -36,11 +36,16 @@ class FlipperApplication:
|
|||||||
icon: Optional[str] = None
|
icon: Optional[str] = None
|
||||||
order: int = 0
|
order: int = 0
|
||||||
sdk_headers: List[str] = field(default_factory=list)
|
sdk_headers: List[str] = field(default_factory=list)
|
||||||
version: Tuple[int] = field(default_factory=lambda: (0, 0))
|
# .fap-specific
|
||||||
sources: List[str] = field(default_factory=lambda: ["*.c*"])
|
sources: List[str] = field(default_factory=lambda: ["*.c*"])
|
||||||
|
fap_version: Tuple[int] = field(default_factory=lambda: (0, 0))
|
||||||
fap_icon: Optional[str] = None
|
fap_icon: Optional[str] = None
|
||||||
fap_libs: List[str] = field(default_factory=list)
|
fap_libs: List[str] = field(default_factory=list)
|
||||||
fap_category: str = ""
|
fap_category: str = ""
|
||||||
|
fap_description: str = ""
|
||||||
|
fap_author: str = ""
|
||||||
|
fap_weburl: str = ""
|
||||||
|
# Internally used by fbt
|
||||||
_appdir: Optional[object] = None
|
_appdir: Optional[object] = None
|
||||||
_apppath: Optional[str] = None
|
_apppath: Optional[str] = None
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ def assemble_manifest_data(
|
|||||||
)
|
)
|
||||||
image_data = image.data
|
image_data = image.data
|
||||||
|
|
||||||
app_version_as_int = ((app_manifest.version[0] & 0xFFFF) << 16) | (
|
app_version_as_int = ((app_manifest.fap_version[0] & 0xFFFF) << 16) | (
|
||||||
app_manifest.version[1] & 0xFFFF
|
app_manifest.fap_version[1] & 0xFFFF
|
||||||
)
|
)
|
||||||
|
|
||||||
data = ElfManifestBaseHeader(
|
data = ElfManifestBaseHeader(
|
||||||
|
|||||||
Reference in New Issue
Block a user