mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'ul/dev' into mntm-dev
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@@ -2,6 +2,9 @@
|
||||
- UL: Desktop: Option to prevent Auto Lock when connected to USB/RPC (by @Dmitry422)
|
||||
- Desktop settings will be reset, need to reconfigure
|
||||
- Keybinds will remain configured
|
||||
- UL: Power: Moved Charge Cap to Power Settings as Charge Limit option (by @Dmitry422)
|
||||
- No longer located in Momentum Settings
|
||||
- Value will be reset, needs to be reconfigured in Power Settings if it was enabled
|
||||
- OFW: JS: New `gui/widget` view, replaces old `widget` module (by @portasynthinca3)
|
||||
- Scripts using `widget` module will need to be updated
|
||||
- Check the `gui.js` example for reference usage
|
||||
@@ -12,12 +15,14 @@
|
||||
### Added:
|
||||
- Apps:
|
||||
- Games: Quadrastic (by @ivanbarsukov)
|
||||
- UL: Sub-GHz: Add ReversRB2/RB2M Protocol full support with add manually (by @xMasterX)
|
||||
- RFID:
|
||||
- OFW: EM4305 support (by @Astrrra)
|
||||
- OFW: Noralsy Format/Brand protocol (by @zinongli)
|
||||
- OFW: BadKB: Mouse control (by @jetrp1)
|
||||
- OFW: Infrared: Universal IR signal selection (by @portasynthinca3)
|
||||
- OFW: NFC: Disney Infinity KDF plugin (by @bettse)
|
||||
- UL: Input: Vibro on Button press option (by @Dmitry422)
|
||||
- Desktop:
|
||||
- UL: Option to prevent Auto Lock when connected to USB/RPC (by @Dmitry422)
|
||||
- OFW: Add the Showtime animation (by @Astrrra)
|
||||
@@ -29,6 +34,7 @@
|
||||
- OFW: SDK 0.3
|
||||
- Backport of missing features to new `gui/widget` (by @Willy-JL)
|
||||
- UART framing data/stop/parity bits options in `serial` module (by @portasynthinca3)
|
||||
- OFW: Alarm: Snooze, timeouts, and dismissing from the locked state (by @Astrrra)
|
||||
- OFW: Furi: UART framing mode selection, support for different data/stop/parity bits (by @portasynthinca3)
|
||||
- OFW: GUI: Widget elements for line, rect and circle with fill options (by @Willy-JL)
|
||||
|
||||
@@ -48,6 +54,7 @@
|
||||
- OFW: Added naming for DESFire cards + fix MF3ICD40 cards unable to be read (by @Demae)
|
||||
- OFW: FeliCa Protocol Expose Read Block API and Allow Specifying Service (by @zinongli)
|
||||
- OFW: Enable MFUL sync poller to be provided with passwords (by @GMMan)
|
||||
- UL: Power: Moved Charge Cap to Power Settings as Charge Limit option (by @Dmitry422)
|
||||
- Infrared:
|
||||
- OFW: Add Fujitsu ASTG12LVCC to AC Universal Remote (by @KereruA0i)
|
||||
- OFW: Increase max carrier limit to 1000000 (by @skotopes)
|
||||
@@ -57,10 +64,15 @@
|
||||
- OFW: Update heap4 implementation, enabled heap corruption detection (by @portasynthinca3)
|
||||
- OFW: Update mbedtls & expose AES to API (by @portasynthinca3)
|
||||
- OFW: Stdio API improvements, pipe stdout timeout (by @portasynthinca3)
|
||||
- OFW: Stricter constness for const data (by @hedger)
|
||||
|
||||
### Fixed:
|
||||
- Asset Packs: Fix level-up animations not being themed (by @Willy-JL)
|
||||
- About: Fix missing Prev. button when invoked from Device Info keybind (by @Willy-JL)
|
||||
- Sub-GHz:
|
||||
- UL: Fix Hollarm protocol with more verification (by @xMasterX)
|
||||
- UL: Fix GangQi protocol (by @DoberBit and @mishamyte)
|
||||
- UL: Came Atomo button hold simulation with full cycle to allow proper pairing with receiver (by @xMasterX)
|
||||
- OFW: NFC: ST25TB poller mode check (by @RebornedBrain)
|
||||
- RFID: Fix Detection Conflict Between Securakey and Noralsy Format (by @zinongli)
|
||||
- Furi:
|
||||
@@ -74,3 +86,4 @@
|
||||
|
||||
### Removed:
|
||||
- JS: Removed old `widget` module, replaced by new `gui/widget` view
|
||||
- MNTM: Removed Charge Cap option, replaced by Charge Limit in Power Settings
|
||||
|
||||
@@ -89,7 +89,7 @@ typedef struct {
|
||||
volatile SubGhzDeviceCC1101ExtState state;
|
||||
volatile SubGhzDeviceCC1101ExtRegulation regulation;
|
||||
const GpioPin* async_mirror_pin;
|
||||
FuriHalSpiBusHandle* spi_bus_handle;
|
||||
const FuriHalSpiBusHandle* spi_bus_handle;
|
||||
const GpioPin* g0_pin;
|
||||
SubGhzDeviceCC1101ExtAsyncTx async_tx;
|
||||
SubGhzDeviceCC1101ExtAsyncRx async_rx;
|
||||
|
||||
Submodule applications/external updated: dbfac79c88...8f612574f7
@@ -3771,7 +3771,7 @@ protocol: NECext
|
||||
address: D9 14 00 00
|
||||
command: 4F B0 00 00
|
||||
#
|
||||
name: Vol_down
|
||||
name: Vol_dn
|
||||
type: parsed
|
||||
protocol: NECext
|
||||
address: D9 14 00 00
|
||||
|
||||
@@ -1812,7 +1812,7 @@ protocol: NECext
|
||||
address: 86 6B 00 00
|
||||
command: 09 F6 00 00
|
||||
#
|
||||
name: Vol_down
|
||||
name: Vol_dn
|
||||
type: parsed
|
||||
protocol: NECext
|
||||
address: 4F 50 00 00
|
||||
|
||||
@@ -5,7 +5,6 @@ enum VarItemListIndex {
|
||||
VarItemListIndexDolphin,
|
||||
VarItemListIndexSpoof,
|
||||
VarItemListIndexVgm,
|
||||
VarItemListIndexChargeCap,
|
||||
VarItemListIndexShowMomentumIntro,
|
||||
};
|
||||
|
||||
@@ -14,22 +13,10 @@ void momentum_app_scene_misc_var_item_list_callback(void* context, uint32_t inde
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
|
||||
#define CHARGE_CAP_INTV 5
|
||||
static void momentum_app_scene_misc_charge_cap_changed(VariableItem* item) {
|
||||
MomentumApp* app = variable_item_get_context(item);
|
||||
char cap_str[6];
|
||||
uint32_t value = (variable_item_get_current_value_index(item) + 1) * CHARGE_CAP_INTV;
|
||||
snprintf(cap_str, sizeof(cap_str), "%lu%%", value);
|
||||
variable_item_set_current_value_text(item, cap_str);
|
||||
momentum_settings.charge_cap = value;
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
void momentum_app_scene_misc_on_enter(void* context) {
|
||||
MomentumApp* app = context;
|
||||
VariableItemList* var_item_list = app->var_item_list;
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
|
||||
item = variable_item_list_add(var_item_list, "Screen", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
@@ -43,18 +30,6 @@ void momentum_app_scene_misc_on_enter(void* context) {
|
||||
item = variable_item_list_add(var_item_list, "VGM Options", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
|
||||
char cap_str[6];
|
||||
value_index = momentum_settings.charge_cap / CHARGE_CAP_INTV;
|
||||
snprintf(cap_str, sizeof(cap_str), "%lu%%", (uint32_t)value_index * CHARGE_CAP_INTV);
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Charge Cap",
|
||||
100 / CHARGE_CAP_INTV,
|
||||
momentum_app_scene_misc_charge_cap_changed,
|
||||
app);
|
||||
variable_item_set_current_value_index(item, value_index - 1);
|
||||
variable_item_set_current_value_text(item, cap_str);
|
||||
|
||||
variable_item_list_add(var_item_list, "Show Momentum Intro", 0, NULL, app);
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
|
||||
@@ -130,6 +130,7 @@ typedef enum {
|
||||
SetTypeBETT_433,
|
||||
SetTypeGangQi_433,
|
||||
SetTypeHollarm_433,
|
||||
SetTypeReversRB2_433,
|
||||
SetTypeMarantec24_868,
|
||||
SetTypeLinear_300_00,
|
||||
// SetTypeNeroSketch, //Deleted in OFW
|
||||
|
||||
@@ -384,33 +384,14 @@ bool subghz_txrx_gen_secplus_v1_protocol(
|
||||
}
|
||||
|
||||
void subghz_txrx_gen_serial_gangqi(uint64_t* result_key) {
|
||||
uint64_t randkey;
|
||||
uint64_t only_required_bytes;
|
||||
uint16_t sum_of_3bytes;
|
||||
uint8_t xorbytes;
|
||||
uint64_t randkey = (uint64_t)rand();
|
||||
uint16_t serial = (uint16_t)((randkey) & 0xFFFF);
|
||||
uint8_t const_and_button = (uint8_t)(0xD0 | 0xD);
|
||||
uint8_t serial_high = (uint8_t)(serial >> 8);
|
||||
uint8_t serial_low = (uint8_t)(serial & 0xFF);
|
||||
uint8_t bytesum = (uint8_t)(0xC8 - serial_high - serial_low - const_and_button);
|
||||
|
||||
do {
|
||||
randkey = (uint64_t)rand();
|
||||
only_required_bytes = (randkey & 0x0FFFF0000) | 0x200000000;
|
||||
sum_of_3bytes = ((only_required_bytes >> 32) & 0xFF) +
|
||||
((only_required_bytes >> 24) & 0xFF) +
|
||||
((only_required_bytes >> 16) & 0xFF);
|
||||
xorbytes = ((only_required_bytes >> 32) & 0xFF) ^ ((only_required_bytes >> 24) & 0xFF) ^
|
||||
((only_required_bytes >> 16) & 0xFF);
|
||||
} while(
|
||||
!((((!(sum_of_3bytes & 0x3)) && ((0xB < sum_of_3bytes) && (sum_of_3bytes < 0x141))) &&
|
||||
((((only_required_bytes >> 32) & 0xFF) == 0x2) ||
|
||||
(((only_required_bytes >> 32) & 0xFF) == 0x3))) &&
|
||||
((((xorbytes == 0xBA) || (xorbytes == 0xE2)) ||
|
||||
((xorbytes == 0x3A) || (xorbytes == 0xF2))) ||
|
||||
(xorbytes == 0xB2))));
|
||||
|
||||
// Serial 01 button 01
|
||||
uint64_t new_key = only_required_bytes | (0b01 << 14) | (0xD << 10) | (0b01 << 8);
|
||||
|
||||
uint8_t crc = -0xD7 - ((new_key >> 32) & 0xFF) - ((new_key >> 24) & 0xFF) -
|
||||
((new_key >> 16) & 0xFF) - ((new_key >> 8) & 0xFF);
|
||||
|
||||
// Add crc sum to the end
|
||||
*result_key = (new_key | crc);
|
||||
// Add bytesum to the end
|
||||
// serial | const_and_button
|
||||
*result_key = (serial << 18) | (const_and_button << 10) | (bytesum << 2);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ static const char* submenu_names[SetTypeMAX] = {
|
||||
[SetTypePricenton433] = "Princeton 433MHz",
|
||||
[SetTypeGangQi_433] = "GangQi 433MHz",
|
||||
[SetTypeHollarm_433] = "Hollarm 433MHz",
|
||||
[SetTypeReversRB2_433] = "Revers RB2 433MHz",
|
||||
[SetTypeMarantec24_868] = "Marantec24 868MHz",
|
||||
[SetTypeBETT_433] = "BETT 433MHz",
|
||||
[SetTypeLinear_300_00] = "Linear 300MHz",
|
||||
@@ -337,6 +338,16 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
|
||||
.data.bits = 42,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeReversRB2_433:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
.mod = "AM650",
|
||||
.freq = 433920000,
|
||||
.data.name = SUBGHZ_PROTOCOL_REVERSRB2_NAME, // 64bits no buttons
|
||||
.data.key = (key & 0x00000FFFFFFFF000) | 0xFFFFF00000000000 | 0x0000000000000A00,
|
||||
.data.bits = 64,
|
||||
.data.te = 0};
|
||||
break;
|
||||
case SetTypeMarantec24_868:
|
||||
gen_info = (GenInfo){
|
||||
.type = GenData,
|
||||
|
||||
@@ -569,7 +569,7 @@ void cli_delete_command(Cli* cli, const char* name) {
|
||||
furi_string_free(name_str);
|
||||
}
|
||||
|
||||
void cli_session_open(Cli* cli, void* session) {
|
||||
void cli_session_open(Cli* cli, const void* session) {
|
||||
furi_check(cli);
|
||||
|
||||
furi_check(furi_mutex_acquire(cli->mutex, FuriWaitForever) == FuriStatusOk);
|
||||
|
||||
@@ -109,7 +109,7 @@ char cli_getc(Cli* cli);
|
||||
*/
|
||||
void cli_nl(Cli* cli);
|
||||
|
||||
void cli_session_open(Cli* cli, void* session);
|
||||
void cli_session_open(Cli* cli, const void* session);
|
||||
|
||||
void cli_session_close(Cli* cli);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ struct Cli {
|
||||
FuriSemaphore* idle_sem;
|
||||
FuriString* last_line;
|
||||
FuriString* line;
|
||||
CliSession* session;
|
||||
const CliSession* session;
|
||||
|
||||
size_t cursor_position;
|
||||
};
|
||||
|
||||
@@ -313,7 +313,7 @@ static bool cli_vcp_is_connected(void) {
|
||||
return vcp->connected;
|
||||
}
|
||||
|
||||
CliSession cli_vcp = {
|
||||
const CliSession cli_vcp = {
|
||||
cli_vcp_init,
|
||||
cli_vcp_deinit,
|
||||
cli_vcp_rx,
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
typedef struct CliSession CliSession;
|
||||
|
||||
extern CliSession cli_vcp;
|
||||
extern const CliSession cli_vcp;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ static void gui_redraw(Gui* gui) {
|
||||
|
||||
canvas_reset(gui->canvas);
|
||||
|
||||
if(gui->lockdown) {
|
||||
if(gui_is_lockdown(gui)) {
|
||||
gui_redraw_desktop(gui);
|
||||
bool need_attention =
|
||||
(gui_view_port_find_enabled(gui->layers[GuiLayerWindow]) != 0 ||
|
||||
@@ -339,7 +339,7 @@ static void gui_input(Gui* gui, InputEvent* input_event) {
|
||||
|
||||
ViewPort* view_port = NULL;
|
||||
|
||||
if(gui->lockdown) {
|
||||
if(gui_is_lockdown(gui)) {
|
||||
view_port = gui_view_port_find_enabled(gui->layers[GuiLayerDesktop]);
|
||||
} else {
|
||||
view_port = gui_view_port_find_enabled(gui->layers[GuiLayerFullscreen]);
|
||||
@@ -391,7 +391,7 @@ static void gui_ascii(Gui* gui, AsciiEvent* ascii_event) {
|
||||
|
||||
ViewPort* view_port = NULL;
|
||||
|
||||
if(gui->lockdown) {
|
||||
if(gui_is_lockdown(gui)) {
|
||||
view_port = gui_view_port_find_enabled(gui->layers[GuiLayerDesktop]);
|
||||
} else {
|
||||
view_port = gui_view_port_find_enabled(gui->layers[GuiLayerFullscreen]);
|
||||
@@ -579,6 +579,23 @@ void gui_set_lockdown(Gui* gui, bool lockdown) {
|
||||
gui_update(gui);
|
||||
}
|
||||
|
||||
void gui_set_lockdown_inhibit(Gui* gui, bool inhibit) {
|
||||
furi_check(gui);
|
||||
|
||||
gui_lock(gui);
|
||||
gui->lockdown_inhibit = inhibit;
|
||||
gui_unlock(gui);
|
||||
|
||||
// Request redraw
|
||||
gui_update(gui);
|
||||
}
|
||||
|
||||
bool gui_is_lockdown(const Gui* gui) {
|
||||
furi_check(gui);
|
||||
|
||||
return gui->lockdown && !gui->lockdown_inhibit;
|
||||
}
|
||||
|
||||
Canvas* gui_direct_draw_acquire(Gui* gui) {
|
||||
furi_check(gui);
|
||||
|
||||
|
||||
@@ -119,6 +119,23 @@ void gui_set_hide_statusbar(Gui* gui, bool hidden);
|
||||
*/
|
||||
void gui_set_lockdown(Gui* gui, bool lockdown);
|
||||
|
||||
/** Inhibit lockdown mode
|
||||
*
|
||||
* Lockdown mode can be inhibited by calling this function with inhibit set to true.
|
||||
* This is used to show information even when flipper is locked.
|
||||
*
|
||||
* @param gui Gui instance
|
||||
* @param inhibit true to inhibit lockdown mode
|
||||
*/
|
||||
void gui_set_lockdown_inhibit(Gui* gui, bool inhibit);
|
||||
|
||||
/** Check if Gui is in lockdown mode
|
||||
*
|
||||
* @param gui Gui instance
|
||||
* @return bool true if Gui is in lockdown mode
|
||||
*/
|
||||
bool gui_is_lockdown(const Gui* gui);
|
||||
|
||||
/** Acquire Direct Draw lock and get Canvas instance
|
||||
*
|
||||
* This method return Canvas instance for use in monopoly mode. Direct draw lock
|
||||
|
||||
@@ -52,6 +52,7 @@ struct Gui {
|
||||
|
||||
// Layers and Canvas
|
||||
bool lockdown;
|
||||
bool lockdown_inhibit;
|
||||
bool direct_draw;
|
||||
ViewPortArray_t layers[GuiLayerMAX];
|
||||
Canvas* canvas;
|
||||
|
||||
@@ -7,6 +7,7 @@ App(
|
||||
stack_size=1 * 1024,
|
||||
order=80,
|
||||
sdk_headers=["input.h"],
|
||||
provides=["input_settings"],
|
||||
)
|
||||
|
||||
App(
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
#include "input.h"
|
||||
|
||||
#include "input_settings.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <furi.h>
|
||||
#include <cli/cli.h>
|
||||
#include <furi_hal_gpio.h>
|
||||
#include <furi_hal_vibro.h>
|
||||
|
||||
#define INPUT_DEBOUNCE_TICKS_HALF (INPUT_DEBOUNCE_TICKS / 2)
|
||||
#define INPUT_PRESS_TICKS 150
|
||||
#define INPUT_LONG_PRESS_COUNTS 2
|
||||
#define INPUT_THREAD_FLAG_ISR 0x00000001
|
||||
|
||||
#define TAG "Input"
|
||||
|
||||
/** Input pin state */
|
||||
typedef struct {
|
||||
const InputPin* pin;
|
||||
@@ -89,6 +94,11 @@ int32_t input_srv(void* p) {
|
||||
furi_record_create(RECORD_INPUT_EVENTS, event_pubsub);
|
||||
furi_record_create(RECORD_ASCII_EVENTS, ascii_pubsub);
|
||||
|
||||
//define object input_settings, take memory load (or init) settings and create record for access to settings structure from outside
|
||||
InputSettings* settings = malloc(sizeof(InputSettings));
|
||||
input_settings_load(settings);
|
||||
furi_record_create(RECORD_INPUT_SETTINGS, settings);
|
||||
|
||||
#ifdef INPUT_DEBUG
|
||||
furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeOutputPushPull);
|
||||
#endif
|
||||
@@ -151,6 +161,12 @@ int32_t input_srv(void* p) {
|
||||
// Send Press/Release event
|
||||
event.type = pin_states[i].state ? InputTypePress : InputTypeRelease;
|
||||
furi_pubsub_publish(event_pubsub, &event);
|
||||
// do vibro if user setup vibro touch level in Settings-Input.
|
||||
if(settings->vibro_touch_level) {
|
||||
furi_hal_vibro_on(true);
|
||||
furi_delay_tick(settings->vibro_touch_level);
|
||||
furi_hal_vibro_on(false);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi_hal_resources.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
58
applications/services/input/input_settings.c
Normal file
58
applications/services/input/input_settings.c
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "input_settings.h"
|
||||
#include "input_settings_filename.h"
|
||||
|
||||
#include <saved_struct.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define TAG "InputSettings"
|
||||
|
||||
#define INPUT_SETTINGS_VER (1) // version nnumber
|
||||
|
||||
#define INPUT_SETTINGS_MAGIC (0x29)
|
||||
|
||||
void input_settings_load(InputSettings* settings) {
|
||||
furi_assert(settings);
|
||||
|
||||
bool success = false;
|
||||
|
||||
//a useless cycle do-while, may will be used in future with anoter condition
|
||||
do {
|
||||
// take version from settings file metadata, if cant then break and fill settings with 0 and save to settings file;
|
||||
uint8_t version;
|
||||
if(!saved_struct_get_metadata(INPUT_SETTINGS_PATH, NULL, &version, NULL)) break;
|
||||
|
||||
// if config actual version - load it directly
|
||||
if(version == INPUT_SETTINGS_VER) {
|
||||
success = saved_struct_load(
|
||||
INPUT_SETTINGS_PATH,
|
||||
settings,
|
||||
sizeof(InputSettings),
|
||||
INPUT_SETTINGS_MAGIC,
|
||||
INPUT_SETTINGS_VER);
|
||||
// if config previous version - load it and inicialize new settings
|
||||
}
|
||||
// in case of another config version we exit from useless cycle to next step
|
||||
} while(false);
|
||||
|
||||
// fill settings with 0 and save to settings file;
|
||||
if(!success) {
|
||||
FURI_LOG_W(TAG, "Failed to load file, using defaults");
|
||||
memset(settings, 0, sizeof(InputSettings));
|
||||
// input_settings_save(settings);
|
||||
}
|
||||
}
|
||||
|
||||
void input_settings_save(const InputSettings* settings) {
|
||||
furi_assert(settings);
|
||||
|
||||
const bool success = saved_struct_save(
|
||||
INPUT_SETTINGS_PATH,
|
||||
settings,
|
||||
sizeof(InputSettings),
|
||||
INPUT_SETTINGS_MAGIC,
|
||||
INPUT_SETTINGS_VER);
|
||||
|
||||
if(!success) {
|
||||
FURI_LOG_E(TAG, "Failed to save file");
|
||||
}
|
||||
}
|
||||
12
applications/services/input/input_settings.h
Normal file
12
applications/services/input/input_settings.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define RECORD_INPUT_SETTINGS "input_settings"
|
||||
|
||||
typedef struct {
|
||||
uint8_t vibro_touch_level;
|
||||
} InputSettings;
|
||||
|
||||
void input_settings_load(InputSettings* settings);
|
||||
void input_settings_save(const InputSettings* settings);
|
||||
3
applications/services/input/input_settings_filename.h
Normal file
3
applications/services/input/input_settings_filename.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define INPUT_SETTINGS_PATH INT_PATH(".input.settings")
|
||||
@@ -362,21 +362,6 @@ static void power_check_battery_level_change(Power* power) {
|
||||
}
|
||||
}
|
||||
|
||||
static void power_check_charge_cap(Power* power) {
|
||||
uint32_t cap = momentum_settings.charge_cap;
|
||||
if(power->info.charge >= cap && cap < 100) {
|
||||
if(!power->is_charge_capped) { // Suppress charging if charge reaches custom cap
|
||||
power->is_charge_capped = true;
|
||||
furi_hal_power_suppress_charge_enter();
|
||||
}
|
||||
} else {
|
||||
if(power->is_charge_capped) { // Start charging again if charge below custom cap
|
||||
power->is_charge_capped = false;
|
||||
furi_hal_power_suppress_charge_exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void power_handle_shutdown(Power* power) {
|
||||
furi_hal_power_off();
|
||||
// Notify user if USB is plugged
|
||||
@@ -568,6 +553,24 @@ static void power_message_callback(FuriEventLoopObject* object, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
static void power_charge_supress(Power* power) {
|
||||
// if charge_supress_percent selected (not OFF) and current charge level equal or higher than selected level
|
||||
// then we start supression if we not supress it before.
|
||||
if(power->settings.charge_supress_percent &&
|
||||
power->info.charge >= power->settings.charge_supress_percent) {
|
||||
if(!power->charge_is_supressed) {
|
||||
power->charge_is_supressed = true;
|
||||
furi_hal_power_suppress_charge_enter();
|
||||
}
|
||||
// disable supression if charge_supress_percent OFF but charge still supressed
|
||||
} else {
|
||||
if(power->charge_is_supressed) {
|
||||
power->charge_is_supressed = false;
|
||||
furi_hal_power_suppress_charge_exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void power_tick_callback(void* context) {
|
||||
furi_assert(context);
|
||||
Power* power = context;
|
||||
@@ -580,8 +583,8 @@ static void power_tick_callback(void* context) {
|
||||
power_check_charging_state(power);
|
||||
// Check and notify about battery level change
|
||||
power_check_battery_level_change(power);
|
||||
// Check charge cap, compare with user setting and (un)suppress charging
|
||||
power_check_charge_cap(power);
|
||||
// charge supress arm/disarm
|
||||
power_charge_supress(power);
|
||||
// Update battery view port
|
||||
view_port_enabled_set(
|
||||
power->battery_view_port, momentum_settings.battery_icon != BatteryIconOff);
|
||||
@@ -618,7 +621,7 @@ static void power_storage_callback(const void* message, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
// load inital settings from file for power service
|
||||
// loading and initializing power service settings
|
||||
static void power_init_settings(Power* power) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
furi_pubsub_subscribe(storage_get_pubsub(storage), power_storage_callback, power);
|
||||
@@ -631,6 +634,7 @@ static void power_init_settings(Power* power) {
|
||||
power_settings_load(&power->settings);
|
||||
power_settings_apply(power);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
power->charge_is_supressed = false;
|
||||
}
|
||||
|
||||
static Power* power_alloc(void) {
|
||||
@@ -644,7 +648,7 @@ static Power* power_alloc(void) {
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
// auto_poweroff
|
||||
//---define subscription to loader events message (info about started apps) and defina callback for this
|
||||
//---define subscription to loader events message (info about started apps) and define callback for this
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
furi_pubsub_subscribe(loader_get_pubsub(loader), power_loader_callback, power);
|
||||
power->input_events_pubsub = furi_record_open(RECORD_INPUT_EVENTS);
|
||||
@@ -688,7 +692,7 @@ int32_t power_srv(void* p) {
|
||||
|
||||
Power* power = power_alloc();
|
||||
|
||||
// load inital settings for power service
|
||||
// power service settings initialization
|
||||
power_init_settings(power);
|
||||
|
||||
power_update_info(power);
|
||||
|
||||
@@ -42,7 +42,7 @@ struct Power {
|
||||
PowerSettings settings;
|
||||
FuriTimer* auto_poweroff_timer;
|
||||
bool app_running;
|
||||
bool is_charge_capped;
|
||||
bool charge_is_supressed;
|
||||
FuriPubSub* input_events_pubsub;
|
||||
FuriPubSub* ascii_events_pubsub;
|
||||
FuriPubSubSubscription* input_events_subscription;
|
||||
|
||||
@@ -6,18 +6,53 @@
|
||||
|
||||
#define TAG "PowerSettings"
|
||||
|
||||
#define POWER_SETTINGS_VER (1)
|
||||
#define POWER_SETTINGS_VER_1 (1) // Previous version number
|
||||
#define POWER_SETTINGS_VER (2) // New version number
|
||||
|
||||
#define POWER_SETTINGS_MAGIC (0x21)
|
||||
|
||||
typedef struct {
|
||||
uint32_t auto_poweroff_delay_ms;
|
||||
} PowerSettingsPrevious;
|
||||
|
||||
void power_settings_load(PowerSettings* settings) {
|
||||
furi_assert(settings);
|
||||
|
||||
const bool success = saved_struct_load(
|
||||
POWER_SETTINGS_PATH,
|
||||
settings,
|
||||
sizeof(PowerSettings),
|
||||
POWER_SETTINGS_MAGIC,
|
||||
POWER_SETTINGS_VER);
|
||||
bool success = false;
|
||||
|
||||
do {
|
||||
uint8_t version;
|
||||
if(!saved_struct_get_metadata(POWER_SETTINGS_PATH, NULL, &version, NULL)) break;
|
||||
|
||||
// if config actual version - load it directly
|
||||
if(version == POWER_SETTINGS_VER) {
|
||||
success = saved_struct_load(
|
||||
POWER_SETTINGS_PATH,
|
||||
settings,
|
||||
sizeof(PowerSettings),
|
||||
POWER_SETTINGS_MAGIC,
|
||||
POWER_SETTINGS_VER);
|
||||
|
||||
// if config previous version - load it and manual set new settings to inital value
|
||||
} else if(version == POWER_SETTINGS_VER_1) {
|
||||
PowerSettingsPrevious* settings_previous = malloc(sizeof(PowerSettingsPrevious));
|
||||
|
||||
success = saved_struct_load(
|
||||
POWER_SETTINGS_PATH,
|
||||
settings_previous,
|
||||
sizeof(PowerSettingsPrevious),
|
||||
POWER_SETTINGS_MAGIC,
|
||||
POWER_SETTINGS_VER_1);
|
||||
// new settings initialization
|
||||
if(success) {
|
||||
settings->auto_poweroff_delay_ms = settings_previous->auto_poweroff_delay_ms;
|
||||
settings->charge_supress_percent = 0;
|
||||
}
|
||||
|
||||
free(settings_previous);
|
||||
}
|
||||
|
||||
} while(false);
|
||||
|
||||
if(!success) {
|
||||
FURI_LOG_W(TAG, "Failed to load file, using defaults");
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t auto_poweroff_delay_ms;
|
||||
uint8_t charge_supress_percent;
|
||||
} PowerSettings;
|
||||
|
||||
void power_settings_load(PowerSettings* settings);
|
||||
|
||||
@@ -11,9 +11,16 @@
|
||||
|
||||
#define TAG "ClockSettingsAlarm"
|
||||
|
||||
#define SNOOZE_MINUTES 9
|
||||
#define TIMEOUT_MINUTES 10
|
||||
|
||||
typedef struct {
|
||||
DateTime now;
|
||||
DateTime snooze_until;
|
||||
DateTime alarm_start;
|
||||
IconAnimation* icon;
|
||||
|
||||
bool is_snooze;
|
||||
} ClockSettingsAlramModel;
|
||||
|
||||
const NotificationSequence sequence_alarm = {
|
||||
@@ -47,12 +54,15 @@ static void clock_settings_alarm_draw_callback(Canvas* canvas, void* ctx) {
|
||||
ClockSettingsAlramModel* model = ctx;
|
||||
char buffer[64] = {};
|
||||
|
||||
// Clock icon
|
||||
canvas_draw_icon_animation(canvas, 5, 6, model->icon);
|
||||
|
||||
// Time
|
||||
canvas_set_font(canvas, FontBigNumbers);
|
||||
snprintf(buffer, sizeof(buffer), "%02u:%02u", model->now.hour, model->now.minute);
|
||||
canvas_draw_str(canvas, 58, 32, buffer);
|
||||
|
||||
// Date
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
snprintf(
|
||||
buffer,
|
||||
@@ -62,6 +72,11 @@ static void clock_settings_alarm_draw_callback(Canvas* canvas, void* ctx) {
|
||||
model->now.month,
|
||||
model->now.year);
|
||||
canvas_draw_str(canvas, 60, 44, buffer);
|
||||
|
||||
// Press Back to snooze
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_icon_ex(canvas, 5, 50, &I_Pin_back_arrow_10x8, 0);
|
||||
canvas_draw_str_aligned(canvas, 20, 50, AlignLeft, AlignTop, "Snooze");
|
||||
}
|
||||
|
||||
static void clock_settings_alarm_input_callback(InputEvent* input_event, void* ctx) {
|
||||
@@ -81,8 +96,10 @@ int32_t clock_settings_alarm(void* p) {
|
||||
|
||||
// View Model
|
||||
ClockSettingsAlramModel model;
|
||||
model.is_snooze = false;
|
||||
|
||||
furi_hal_rtc_get_datetime(&model.now);
|
||||
furi_hal_rtc_get_alarm(&model.alarm_start);
|
||||
model.icon = icon_animation_alloc(&A_Alarm_47x39);
|
||||
|
||||
// Alloc message queue
|
||||
@@ -95,6 +112,7 @@ int32_t clock_settings_alarm(void* p) {
|
||||
|
||||
// Register view port in GUI
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_set_lockdown_inhibit(gui, true);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
@@ -110,12 +128,43 @@ int32_t clock_settings_alarm(void* p) {
|
||||
while(running) {
|
||||
if(furi_message_queue_get(event_queue, &event, 2000) == FuriStatusOk) {
|
||||
if(event.type == InputTypePress) {
|
||||
running = false;
|
||||
// Snooze
|
||||
if(event.key == InputKeyBack) {
|
||||
furi_hal_rtc_get_datetime(&model.snooze_until);
|
||||
model.snooze_until.minute += SNOOZE_MINUTES;
|
||||
model.snooze_until.hour += model.snooze_until.minute / 60;
|
||||
model.snooze_until.minute %= 60;
|
||||
model.snooze_until.hour %= 24;
|
||||
|
||||
model.is_snooze = true;
|
||||
model.alarm_start = model.snooze_until; // For correct timeout behavior
|
||||
view_port_enabled_set(view_port, false);
|
||||
gui_set_lockdown_inhibit(gui, false);
|
||||
} else {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
} else if(model.is_snooze) {
|
||||
furi_hal_rtc_get_datetime(&model.now);
|
||||
if(datetime_datetime_to_timestamp(&model.now) >=
|
||||
datetime_datetime_to_timestamp(&model.snooze_until)) {
|
||||
view_port_enabled_set(view_port, true);
|
||||
gui_set_lockdown_inhibit(gui, true);
|
||||
|
||||
model.is_snooze = false;
|
||||
}
|
||||
} else {
|
||||
notification_message(notification, &sequence_alarm);
|
||||
furi_hal_rtc_get_datetime(&model.now);
|
||||
view_port_update(view_port);
|
||||
|
||||
// Stop the alarm if it has been ringing for more than TIMEOUT_MINUTES
|
||||
if((model.now.hour == model.alarm_start.hour &&
|
||||
model.now.minute >= model.alarm_start.minute + TIMEOUT_MINUTES) ||
|
||||
(model.now.hour == (model.alarm_start.hour + 1) % 24 &&
|
||||
model.now.minute < (model.alarm_start.minute + TIMEOUT_MINUTES) % 60)) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +174,7 @@ int32_t clock_settings_alarm(void* p) {
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
|
||||
view_port_enabled_set(view_port, false);
|
||||
gui_set_lockdown_inhibit(gui, false);
|
||||
gui_remove_view_port(gui, view_port);
|
||||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
|
||||
9
applications/settings/input_settings_app/application.fam
Normal file
9
applications/settings/input_settings_app/application.fam
Normal file
@@ -0,0 +1,9 @@
|
||||
App(
|
||||
appid="input_settings",
|
||||
name="Input",
|
||||
apptype=FlipperAppType.SETTINGS,
|
||||
entry_point="input_settings_app",
|
||||
requires=["input"],
|
||||
stack_size=1 * 1024,
|
||||
order=100,
|
||||
)
|
||||
107
applications/settings/input_settings_app/input_settings_app.c
Normal file
107
applications/settings/input_settings_app/input_settings_app.c
Normal file
@@ -0,0 +1,107 @@
|
||||
#include <stdint.h>
|
||||
#include "input_settings_app.h"
|
||||
|
||||
#define TAG "InputSettingsApp"
|
||||
|
||||
#define VIBRO_TOUCH_LEVEL_COUNT 10
|
||||
// vibro touch human readable levels
|
||||
const char* const vibro_touch_level_text[VIBRO_TOUCH_LEVEL_COUNT] = {
|
||||
"OFF",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
};
|
||||
// vibro touch levels tick valies delay
|
||||
const uint32_t vibro_touch_level_value[VIBRO_TOUCH_LEVEL_COUNT] =
|
||||
{0, 13, 16, 19, 21, 24, 27, 30, 33, 36};
|
||||
|
||||
static void input_settings_vibro_touch_level_changed(VariableItem* item) {
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, vibro_touch_level_text[index]);
|
||||
|
||||
//change settings to selected
|
||||
InputSettingsApp* app = variable_item_get_context(item);
|
||||
app->settings->vibro_touch_level = vibro_touch_level_value[index];
|
||||
|
||||
// use RECORD for acces to input service instance and set settings
|
||||
InputSettings* service_settings = furi_record_open(RECORD_INPUT_SETTINGS);
|
||||
service_settings->vibro_touch_level = vibro_touch_level_value[index];
|
||||
furi_record_close(RECORD_INPUT_SETTINGS);
|
||||
}
|
||||
|
||||
static uint32_t input_settings_app_exit(void* context) {
|
||||
UNUSED(context);
|
||||
return VIEW_NONE;
|
||||
}
|
||||
|
||||
InputSettingsApp* input_settings_app_alloc(void) {
|
||||
InputSettingsApp* app = malloc(sizeof(InputSettingsApp));
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
app->settings = malloc(sizeof(InputSettings));
|
||||
input_settings_load(app->settings);
|
||||
|
||||
app->variable_item_list = variable_item_list_alloc();
|
||||
View* view = variable_item_list_get_view(app->variable_item_list);
|
||||
view_set_previous_callback(view, input_settings_app_exit);
|
||||
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
|
||||
item = variable_item_list_add(
|
||||
app->variable_item_list,
|
||||
"Buttons Vibro",
|
||||
VIBRO_TOUCH_LEVEL_COUNT,
|
||||
input_settings_vibro_touch_level_changed,
|
||||
app);
|
||||
|
||||
value_index = value_index_uint32(
|
||||
app->settings->vibro_touch_level, vibro_touch_level_value, VIBRO_TOUCH_LEVEL_COUNT);
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, vibro_touch_level_text[value_index]);
|
||||
|
||||
// create and setup view and view dispatcher
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
|
||||
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
||||
view_dispatcher_add_view(app->view_dispatcher, InputSettingsViewVariableItemList, view);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, InputSettingsViewVariableItemList);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
void input_settings_app_free(InputSettingsApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
// Variable item list
|
||||
view_dispatcher_remove_view(app->view_dispatcher, InputSettingsViewVariableItemList);
|
||||
variable_item_list_free(app->variable_item_list);
|
||||
|
||||
// View dispatcher
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
// Records
|
||||
furi_record_close(RECORD_GUI);
|
||||
free(app->settings);
|
||||
free(app);
|
||||
}
|
||||
|
||||
// Enter point
|
||||
int32_t input_settings_app(void* p) {
|
||||
UNUSED(p);
|
||||
InputSettingsApp* app = input_settings_app_alloc();
|
||||
|
||||
view_dispatcher_run(app->view_dispatcher);
|
||||
|
||||
//save current settings;
|
||||
input_settings_save(app->settings);
|
||||
|
||||
input_settings_app_free(app);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <input/input_settings.h>
|
||||
#include <lib/toolbox/value_index.h>
|
||||
#include <furi_hal_vibro.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
// input_settings_app stucture
|
||||
typedef struct {
|
||||
Gui* gui;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
VariableItemList* variable_item_list;
|
||||
InputSettings* settings;
|
||||
} InputSettingsApp;
|
||||
|
||||
// list of menu views for view dispatcher
|
||||
typedef enum {
|
||||
InputSettingsViewVariableItemList,
|
||||
} InputSettingsView;
|
||||
@@ -0,0 +1,7 @@
|
||||
// Since settings app is external, it cannot access firmware functions
|
||||
// For simple utils like this, easier to include C code in app rather than exposing to API
|
||||
// Instead of copying the file, can (ab)use the preprocessor to insert the source code here
|
||||
// Then, we still use the Header from original code as if nothing happened
|
||||
|
||||
// input_settings_load(), input_settings_save()
|
||||
#include <applications/services/input/input_settings.c>
|
||||
@@ -40,6 +40,19 @@ const uint32_t auto_poweroff_delay_value[AUTO_POWEROFF_DELAY_COUNT] = {
|
||||
86400000,
|
||||
172800000};
|
||||
|
||||
#define CHARGE_SUPRESS_STEP 5
|
||||
|
||||
// change variable_item_list visible text and charge_supress_percent_settings when user change item in variable_item_list
|
||||
static void power_settings_scene_start_charge_supress_percent_changed(VariableItem* item) {
|
||||
PowerSettingsApp* app = variable_item_get_context(item);
|
||||
uint32_t value = (variable_item_get_current_value_index(item) + 1) * CHARGE_SUPRESS_STEP;
|
||||
char charge_supress_str[6];
|
||||
snprintf(charge_supress_str, sizeof(charge_supress_str), "%lu%%", value);
|
||||
|
||||
variable_item_set_current_value_text(item, charge_supress_str);
|
||||
app->settings.charge_supress_percent = value == 100 ? 0 : value;
|
||||
}
|
||||
|
||||
// change variable_item_list visible text and app_poweroff_delay_time_settings when user change item in variable_item_list
|
||||
static void power_settings_scene_start_auto_poweroff_delay_changed(VariableItem* item) {
|
||||
PowerSettingsApp* app = variable_item_get_context(item);
|
||||
@@ -50,6 +63,7 @@ static void power_settings_scene_start_auto_poweroff_delay_changed(VariableItem*
|
||||
}
|
||||
|
||||
static void power_settings_scene_start_submenu_callback(void* context, uint32_t index) {
|
||||
//show selected menu screen by index
|
||||
furi_assert(context);
|
||||
PowerSettingsApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
@@ -72,7 +86,7 @@ void power_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_list,
|
||||
"Auto PowerOff",
|
||||
AUTO_POWEROFF_DELAY_COUNT,
|
||||
power_settings_scene_start_auto_poweroff_delay_changed, //function for change visible item list value and app settings
|
||||
power_settings_scene_start_auto_poweroff_delay_changed,
|
||||
app);
|
||||
|
||||
value_index = value_index_uint32(
|
||||
@@ -82,13 +96,26 @@ void power_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, auto_poweroff_delay_text[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
variable_item_list,
|
||||
"Limit Charge",
|
||||
100 / CHARGE_SUPRESS_STEP,
|
||||
power_settings_scene_start_charge_supress_percent_changed,
|
||||
app);
|
||||
|
||||
uint8_t value =
|
||||
app->settings.charge_supress_percent == 0 ? 100 : app->settings.charge_supress_percent;
|
||||
value_index = (value / CHARGE_SUPRESS_STEP) - 1;
|
||||
char charge_supress_str[6];
|
||||
snprintf(charge_supress_str, sizeof(charge_supress_str), "%u%%", value);
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, charge_supress_str);
|
||||
|
||||
variable_item_list_set_selected_item(
|
||||
variable_item_list,
|
||||
scene_manager_get_scene_state(app->scene_manager, PowerSettingsAppSceneStart));
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
variable_item_list, power_settings_scene_start_submenu_callback, app);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, PowerSettingsAppViewVariableItemList);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,10 @@ Example:
|
||||
ID 1234:abcd Flipper Devices:Flipper Zero
|
||||
```
|
||||
|
||||
VID and PID are hex codes and are mandatory. Manufacturer and Product are text strings and are optional.
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> VID and PID are hex codes and are mandatory.
|
||||
> Manufacturer and Product are text strings and are optional.
|
||||
|
||||
## Mouse Commands
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct {
|
||||
|
||||
static bq25896_regs_t bq25896_regs;
|
||||
|
||||
bool bq25896_init(FuriHalI2cBusHandle* handle) {
|
||||
bool bq25896_init(const FuriHalI2cBusHandle* handle) {
|
||||
bool result = true;
|
||||
|
||||
bq25896_regs.r14.REG_RST = 1;
|
||||
@@ -78,19 +78,19 @@ bool bq25896_init(FuriHalI2cBusHandle* handle) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void bq25896_set_boost_lim(FuriHalI2cBusHandle* handle, BoostLim boost_lim) {
|
||||
void bq25896_set_boost_lim(const FuriHalI2cBusHandle* handle, BoostLim boost_lim) {
|
||||
bq25896_regs.r0A.BOOST_LIM = boost_lim;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x0A, *(uint8_t*)&bq25896_regs.r0A, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void bq25896_poweroff(FuriHalI2cBusHandle* handle) {
|
||||
void bq25896_poweroff(const FuriHalI2cBusHandle* handle) {
|
||||
bq25896_regs.r09.BATFET_DIS = 1;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x09, *(uint8_t*)&bq25896_regs.r09, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
ChrgStat bq25896_get_charge_status(FuriHalI2cBusHandle* handle) {
|
||||
ChrgStat bq25896_get_charge_status(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_mem(
|
||||
handle,
|
||||
BQ25896_ADDRESS,
|
||||
@@ -103,52 +103,52 @@ ChrgStat bq25896_get_charge_status(FuriHalI2cBusHandle* handle) {
|
||||
return bq25896_regs.r0B.CHRG_STAT;
|
||||
}
|
||||
|
||||
bool bq25896_is_charging(FuriHalI2cBusHandle* handle) {
|
||||
bool bq25896_is_charging(const FuriHalI2cBusHandle* handle) {
|
||||
// Include precharge, fast charging, and charging termination done as "charging"
|
||||
return bq25896_get_charge_status(handle) != ChrgStatNo;
|
||||
}
|
||||
|
||||
bool bq25896_is_charging_done(FuriHalI2cBusHandle* handle) {
|
||||
bool bq25896_is_charging_done(const FuriHalI2cBusHandle* handle) {
|
||||
return bq25896_get_charge_status(handle) == ChrgStatDone;
|
||||
}
|
||||
|
||||
void bq25896_enable_charging(FuriHalI2cBusHandle* handle) {
|
||||
void bq25896_enable_charging(const FuriHalI2cBusHandle* handle) {
|
||||
bq25896_regs.r03.CHG_CONFIG = 1;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x03, *(uint8_t*)&bq25896_regs.r03, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void bq25896_disable_charging(FuriHalI2cBusHandle* handle) {
|
||||
void bq25896_disable_charging(const FuriHalI2cBusHandle* handle) {
|
||||
bq25896_regs.r03.CHG_CONFIG = 0;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x03, *(uint8_t*)&bq25896_regs.r03, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void bq25896_enable_otg(FuriHalI2cBusHandle* handle) {
|
||||
void bq25896_enable_otg(const FuriHalI2cBusHandle* handle) {
|
||||
bq25896_regs.r03.OTG_CONFIG = 1;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x03, *(uint8_t*)&bq25896_regs.r03, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void bq25896_disable_otg(FuriHalI2cBusHandle* handle) {
|
||||
void bq25896_disable_otg(const FuriHalI2cBusHandle* handle) {
|
||||
bq25896_regs.r03.OTG_CONFIG = 0;
|
||||
furi_hal_i2c_write_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x03, *(uint8_t*)&bq25896_regs.r03, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
bool bq25896_is_otg_enabled(FuriHalI2cBusHandle* handle) {
|
||||
bool bq25896_is_otg_enabled(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x03, (uint8_t*)&bq25896_regs.r03, BQ25896_I2C_TIMEOUT);
|
||||
return bq25896_regs.r03.OTG_CONFIG;
|
||||
}
|
||||
|
||||
uint16_t bq25896_get_vreg_voltage(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq25896_get_vreg_voltage(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x06, (uint8_t*)&bq25896_regs.r06, BQ25896_I2C_TIMEOUT);
|
||||
return (uint16_t)bq25896_regs.r06.VREG * 16 + 3840;
|
||||
}
|
||||
|
||||
void bq25896_set_vreg_voltage(FuriHalI2cBusHandle* handle, uint16_t vreg_voltage) {
|
||||
void bq25896_set_vreg_voltage(const FuriHalI2cBusHandle* handle, uint16_t vreg_voltage) {
|
||||
if(vreg_voltage < 3840) {
|
||||
// Minimum valid value is 3840 mV
|
||||
vreg_voltage = 3840;
|
||||
@@ -166,13 +166,13 @@ void bq25896_set_vreg_voltage(FuriHalI2cBusHandle* handle, uint16_t vreg_voltage
|
||||
handle, BQ25896_ADDRESS, 0x06, *(uint8_t*)&bq25896_regs.r06, BQ25896_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
bool bq25896_check_otg_fault(FuriHalI2cBusHandle* handle) {
|
||||
bool bq25896_check_otg_fault(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x0C, (uint8_t*)&bq25896_regs.r0C, BQ25896_I2C_TIMEOUT);
|
||||
return bq25896_regs.r0C.BOOST_FAULT;
|
||||
}
|
||||
|
||||
uint16_t bq25896_get_vbus_voltage(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq25896_get_vbus_voltage(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x11, (uint8_t*)&bq25896_regs.r11, BQ25896_I2C_TIMEOUT);
|
||||
if(bq25896_regs.r11.VBUS_GD) {
|
||||
@@ -182,25 +182,25 @@ uint16_t bq25896_get_vbus_voltage(FuriHalI2cBusHandle* handle) {
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t bq25896_get_vsys_voltage(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq25896_get_vsys_voltage(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x0F, (uint8_t*)&bq25896_regs.r0F, BQ25896_I2C_TIMEOUT);
|
||||
return (uint16_t)bq25896_regs.r0F.SYSV * 20 + 2304;
|
||||
}
|
||||
|
||||
uint16_t bq25896_get_vbat_voltage(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq25896_get_vbat_voltage(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x0E, (uint8_t*)&bq25896_regs.r0E, BQ25896_I2C_TIMEOUT);
|
||||
return (uint16_t)bq25896_regs.r0E.BATV * 20 + 2304;
|
||||
}
|
||||
|
||||
uint16_t bq25896_get_vbat_current(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq25896_get_vbat_current(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x12, (uint8_t*)&bq25896_regs.r12, BQ25896_I2C_TIMEOUT);
|
||||
return (uint16_t)bq25896_regs.r12.ICHGR * 50;
|
||||
}
|
||||
|
||||
uint32_t bq25896_get_ntc_mpct(FuriHalI2cBusHandle* handle) {
|
||||
uint32_t bq25896_get_ntc_mpct(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_read_reg_8(
|
||||
handle, BQ25896_ADDRESS, 0x10, (uint8_t*)&bq25896_regs.r10, BQ25896_I2C_TIMEOUT);
|
||||
return (uint32_t)bq25896_regs.r10.TSPCT * 465 + 21000;
|
||||
|
||||
@@ -7,61 +7,61 @@
|
||||
#include <furi_hal_i2c.h>
|
||||
|
||||
/** Initialize Driver */
|
||||
bool bq25896_init(FuriHalI2cBusHandle* handle);
|
||||
bool bq25896_init(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Set boost lim*/
|
||||
void bq25896_set_boost_lim(FuriHalI2cBusHandle* handle, BoostLim boost_lim);
|
||||
void bq25896_set_boost_lim(const FuriHalI2cBusHandle* handle, BoostLim boost_lim);
|
||||
|
||||
/** Send device into shipping mode */
|
||||
void bq25896_poweroff(FuriHalI2cBusHandle* handle);
|
||||
void bq25896_poweroff(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get charging status */
|
||||
ChrgStat bq25896_get_charge_status(FuriHalI2cBusHandle* handle);
|
||||
ChrgStat bq25896_get_charge_status(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Is currently charging */
|
||||
bool bq25896_is_charging(FuriHalI2cBusHandle* handle);
|
||||
bool bq25896_is_charging(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Is charging completed while connected to charger */
|
||||
bool bq25896_is_charging_done(FuriHalI2cBusHandle* handle);
|
||||
bool bq25896_is_charging_done(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Enable charging */
|
||||
void bq25896_enable_charging(FuriHalI2cBusHandle* handle);
|
||||
void bq25896_enable_charging(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Disable charging */
|
||||
void bq25896_disable_charging(FuriHalI2cBusHandle* handle);
|
||||
void bq25896_disable_charging(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Enable otg */
|
||||
void bq25896_enable_otg(FuriHalI2cBusHandle* handle);
|
||||
void bq25896_enable_otg(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Disable otg */
|
||||
void bq25896_disable_otg(FuriHalI2cBusHandle* handle);
|
||||
void bq25896_disable_otg(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Is otg enabled */
|
||||
bool bq25896_is_otg_enabled(FuriHalI2cBusHandle* handle);
|
||||
bool bq25896_is_otg_enabled(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get VREG (charging limit) voltage in mV */
|
||||
uint16_t bq25896_get_vreg_voltage(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq25896_get_vreg_voltage(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Set VREG (charging limit) voltage in mV
|
||||
*
|
||||
* Valid range: 3840mV - 4208mV, in steps of 16mV
|
||||
*/
|
||||
void bq25896_set_vreg_voltage(FuriHalI2cBusHandle* handle, uint16_t vreg_voltage);
|
||||
void bq25896_set_vreg_voltage(const FuriHalI2cBusHandle* handle, uint16_t vreg_voltage);
|
||||
|
||||
/** Check OTG BOOST Fault status */
|
||||
bool bq25896_check_otg_fault(FuriHalI2cBusHandle* handle);
|
||||
bool bq25896_check_otg_fault(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get VBUS Voltage in mV */
|
||||
uint16_t bq25896_get_vbus_voltage(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq25896_get_vbus_voltage(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get VSYS Voltage in mV */
|
||||
uint16_t bq25896_get_vsys_voltage(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq25896_get_vsys_voltage(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get VBAT Voltage in mV */
|
||||
uint16_t bq25896_get_vbat_voltage(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq25896_get_vbat_voltage(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get VBAT current in mA */
|
||||
uint16_t bq25896_get_vbat_current(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq25896_get_vbat_current(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get NTC voltage in mpct of REGN */
|
||||
uint32_t bq25896_get_ntc_mpct(FuriHalI2cBusHandle* handle);
|
||||
uint32_t bq25896_get_ntc_mpct(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#endif
|
||||
|
||||
static inline bool bq27220_read_reg(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t address,
|
||||
uint8_t* buffer,
|
||||
size_t buffer_size) {
|
||||
@@ -52,7 +52,7 @@ static inline bool bq27220_read_reg(
|
||||
}
|
||||
|
||||
static inline bool bq27220_write(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t address,
|
||||
const uint8_t* buffer,
|
||||
size_t buffer_size) {
|
||||
@@ -60,11 +60,11 @@ static inline bool bq27220_write(
|
||||
handle, BQ27220_ADDRESS, address, buffer, buffer_size, BQ27220_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
static inline bool bq27220_control(FuriHalI2cBusHandle* handle, uint16_t control) {
|
||||
static inline bool bq27220_control(const FuriHalI2cBusHandle* handle, uint16_t control) {
|
||||
return bq27220_write(handle, CommandControl, (uint8_t*)&control, 2);
|
||||
}
|
||||
|
||||
static uint16_t bq27220_read_word(FuriHalI2cBusHandle* handle, uint8_t address) {
|
||||
static uint16_t bq27220_read_word(const FuriHalI2cBusHandle* handle, uint8_t address) {
|
||||
uint16_t buf = BQ27220_ERROR;
|
||||
|
||||
if(!bq27220_read_reg(handle, address, (uint8_t*)&buf, 2)) {
|
||||
@@ -83,7 +83,7 @@ static uint8_t bq27220_get_checksum(uint8_t* data, uint16_t len) {
|
||||
}
|
||||
|
||||
static bool bq27220_parameter_check(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint16_t address,
|
||||
uint32_t value,
|
||||
size_t size,
|
||||
@@ -163,7 +163,7 @@ static bool bq27220_parameter_check(
|
||||
}
|
||||
|
||||
static bool bq27220_data_memory_check(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
const BQ27220DMData* data_memory,
|
||||
bool update) {
|
||||
if(update) {
|
||||
@@ -268,7 +268,7 @@ static bool bq27220_data_memory_check(
|
||||
return result;
|
||||
}
|
||||
|
||||
bool bq27220_init(FuriHalI2cBusHandle* handle, const BQ27220DMData* data_memory) {
|
||||
bool bq27220_init(const FuriHalI2cBusHandle* handle, const BQ27220DMData* data_memory) {
|
||||
bool result = false;
|
||||
bool reset_and_provisioning_required = false;
|
||||
|
||||
@@ -365,7 +365,7 @@ bool bq27220_init(FuriHalI2cBusHandle* handle, const BQ27220DMData* data_memory)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool bq27220_reset(FuriHalI2cBusHandle* handle) {
|
||||
bool bq27220_reset(const FuriHalI2cBusHandle* handle) {
|
||||
bool result = false;
|
||||
do {
|
||||
if(!bq27220_control(handle, Control_RESET)) {
|
||||
@@ -396,7 +396,7 @@ bool bq27220_reset(FuriHalI2cBusHandle* handle) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool bq27220_seal(FuriHalI2cBusHandle* handle) {
|
||||
bool bq27220_seal(const FuriHalI2cBusHandle* handle) {
|
||||
Bq27220OperationStatus operation_status = {0};
|
||||
bool result = false;
|
||||
do {
|
||||
@@ -431,7 +431,7 @@ bool bq27220_seal(FuriHalI2cBusHandle* handle) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool bq27220_unseal(FuriHalI2cBusHandle* handle) {
|
||||
bool bq27220_unseal(const FuriHalI2cBusHandle* handle) {
|
||||
Bq27220OperationStatus operation_status = {0};
|
||||
bool result = false;
|
||||
do {
|
||||
@@ -465,7 +465,7 @@ bool bq27220_unseal(FuriHalI2cBusHandle* handle) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool bq27220_full_access(FuriHalI2cBusHandle* handle) {
|
||||
bool bq27220_full_access(const FuriHalI2cBusHandle* handle) {
|
||||
bool result = false;
|
||||
|
||||
do {
|
||||
@@ -518,29 +518,35 @@ bool bq27220_full_access(FuriHalI2cBusHandle* handle) {
|
||||
return result;
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_voltage(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_voltage(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandVoltage);
|
||||
}
|
||||
|
||||
int16_t bq27220_get_current(FuriHalI2cBusHandle* handle) {
|
||||
int16_t bq27220_get_current(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandCurrent);
|
||||
}
|
||||
|
||||
bool bq27220_get_control_status(FuriHalI2cBusHandle* handle, Bq27220ControlStatus* control_status) {
|
||||
bool bq27220_get_control_status(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220ControlStatus* control_status) {
|
||||
return bq27220_read_reg(handle, CommandControl, (uint8_t*)control_status, 2);
|
||||
}
|
||||
|
||||
bool bq27220_get_battery_status(FuriHalI2cBusHandle* handle, Bq27220BatteryStatus* battery_status) {
|
||||
bool bq27220_get_battery_status(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220BatteryStatus* battery_status) {
|
||||
return bq27220_read_reg(handle, CommandBatteryStatus, (uint8_t*)battery_status, 2);
|
||||
}
|
||||
|
||||
bool bq27220_get_operation_status(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220OperationStatus* operation_status) {
|
||||
return bq27220_read_reg(handle, CommandOperationStatus, (uint8_t*)operation_status, 2);
|
||||
}
|
||||
|
||||
bool bq27220_get_gauging_status(FuriHalI2cBusHandle* handle, Bq27220GaugingStatus* gauging_status) {
|
||||
bool bq27220_get_gauging_status(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220GaugingStatus* gauging_status) {
|
||||
// Request gauging data to be loaded to MAC
|
||||
if(!bq27220_control(handle, Control_GAUGING_STATUS)) {
|
||||
FURI_LOG_E(TAG, "DM SelectSubclass for read failed");
|
||||
@@ -552,26 +558,26 @@ bool bq27220_get_gauging_status(FuriHalI2cBusHandle* handle, Bq27220GaugingStatu
|
||||
return bq27220_read_reg(handle, CommandMACData, (uint8_t*)gauging_status, 2);
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_temperature(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_temperature(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandTemperature);
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_full_charge_capacity(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_full_charge_capacity(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandFullChargeCapacity);
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_design_capacity(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_design_capacity(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandDesignCapacity);
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_remaining_capacity(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_remaining_capacity(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandRemainingCapacity);
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_state_of_charge(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_state_of_charge(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandStateOfCharge);
|
||||
}
|
||||
|
||||
uint16_t bq27220_get_state_of_health(FuriHalI2cBusHandle* handle) {
|
||||
uint16_t bq27220_get_state_of_health(const FuriHalI2cBusHandle* handle) {
|
||||
return bq27220_read_word(handle, CommandStateOfHealth);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ typedef struct BQ27220DMData BQ27220DMData;
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_init(FuriHalI2cBusHandle* handle, const BQ27220DMData* data_memory);
|
||||
bool bq27220_init(const FuriHalI2cBusHandle* handle, const BQ27220DMData* data_memory);
|
||||
|
||||
/** Reset gauge
|
||||
*
|
||||
@@ -144,7 +144,7 @@ bool bq27220_init(FuriHalI2cBusHandle* handle, const BQ27220DMData* data_memory)
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_reset(FuriHalI2cBusHandle* handle);
|
||||
bool bq27220_reset(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Seal gauge access
|
||||
*
|
||||
@@ -152,7 +152,7 @@ bool bq27220_reset(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_seal(FuriHalI2cBusHandle* handle);
|
||||
bool bq27220_seal(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Unseal gauge access
|
||||
*
|
||||
@@ -160,7 +160,7 @@ bool bq27220_seal(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_unseal(FuriHalI2cBusHandle* handle);
|
||||
bool bq27220_unseal(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get full access
|
||||
*
|
||||
@@ -170,7 +170,7 @@ bool bq27220_unseal(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_full_access(FuriHalI2cBusHandle* handle);
|
||||
bool bq27220_full_access(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get battery voltage
|
||||
*
|
||||
@@ -178,7 +178,7 @@ bool bq27220_full_access(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return voltage in mV or BQ27220_ERROR
|
||||
*/
|
||||
uint16_t bq27220_get_voltage(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_voltage(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get current
|
||||
*
|
||||
@@ -186,7 +186,7 @@ uint16_t bq27220_get_voltage(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return current in mA or BQ27220_ERROR
|
||||
*/
|
||||
int16_t bq27220_get_current(FuriHalI2cBusHandle* handle);
|
||||
int16_t bq27220_get_current(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get control status
|
||||
*
|
||||
@@ -195,7 +195,9 @@ int16_t bq27220_get_current(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_get_control_status(FuriHalI2cBusHandle* handle, Bq27220ControlStatus* control_status);
|
||||
bool bq27220_get_control_status(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220ControlStatus* control_status);
|
||||
|
||||
/** Get battery status
|
||||
*
|
||||
@@ -204,7 +206,9 @@ bool bq27220_get_control_status(FuriHalI2cBusHandle* handle, Bq27220ControlStatu
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_get_battery_status(FuriHalI2cBusHandle* handle, Bq27220BatteryStatus* battery_status);
|
||||
bool bq27220_get_battery_status(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220BatteryStatus* battery_status);
|
||||
|
||||
/** Get operation status
|
||||
*
|
||||
@@ -214,7 +218,7 @@ bool bq27220_get_battery_status(FuriHalI2cBusHandle* handle, Bq27220BatteryStatu
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_get_operation_status(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220OperationStatus* operation_status);
|
||||
|
||||
/** Get gauging status
|
||||
@@ -224,7 +228,9 @@ bool bq27220_get_operation_status(
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool bq27220_get_gauging_status(FuriHalI2cBusHandle* handle, Bq27220GaugingStatus* gauging_status);
|
||||
bool bq27220_get_gauging_status(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
Bq27220GaugingStatus* gauging_status);
|
||||
|
||||
/** Get temperature
|
||||
*
|
||||
@@ -232,7 +238,7 @@ bool bq27220_get_gauging_status(FuriHalI2cBusHandle* handle, Bq27220GaugingStatu
|
||||
*
|
||||
* @return temperature in units of 0.1°K
|
||||
*/
|
||||
uint16_t bq27220_get_temperature(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_temperature(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get compensated full charge capacity
|
||||
*
|
||||
@@ -240,7 +246,7 @@ uint16_t bq27220_get_temperature(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return full charge capacity in mAh or BQ27220_ERROR
|
||||
*/
|
||||
uint16_t bq27220_get_full_charge_capacity(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_full_charge_capacity(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get design capacity
|
||||
*
|
||||
@@ -248,7 +254,7 @@ uint16_t bq27220_get_full_charge_capacity(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return design capacity in mAh or BQ27220_ERROR
|
||||
*/
|
||||
uint16_t bq27220_get_design_capacity(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_design_capacity(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get remaining capacity
|
||||
*
|
||||
@@ -256,7 +262,7 @@ uint16_t bq27220_get_design_capacity(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return remaining capacity in mAh or BQ27220_ERROR
|
||||
*/
|
||||
uint16_t bq27220_get_remaining_capacity(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_remaining_capacity(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get predicted remaining battery capacity
|
||||
*
|
||||
@@ -264,7 +270,7 @@ uint16_t bq27220_get_remaining_capacity(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return state of charge in percents or BQ27220_ERROR
|
||||
*/
|
||||
uint16_t bq27220_get_state_of_charge(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_state_of_charge(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Get ratio of full charge capacity over design capacity
|
||||
*
|
||||
@@ -272,4 +278,4 @@ uint16_t bq27220_get_state_of_charge(FuriHalI2cBusHandle* handle);
|
||||
*
|
||||
* @return state of health in percents or BQ27220_ERROR
|
||||
*/
|
||||
uint16_t bq27220_get_state_of_health(FuriHalI2cBusHandle* handle);
|
||||
uint16_t bq27220_get_state_of_health(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <string.h>
|
||||
#include <furi_hal_cortex.h>
|
||||
|
||||
static bool cc1101_spi_trx(FuriHalSpiBusHandle* handle, uint8_t* tx, uint8_t* rx, uint8_t size) {
|
||||
static bool
|
||||
cc1101_spi_trx(const FuriHalSpiBusHandle* handle, uint8_t* tx, uint8_t* rx, uint8_t size) {
|
||||
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(CC1101_TIMEOUT * 1000);
|
||||
|
||||
while(furi_hal_gpio_read(handle->miso)) {
|
||||
@@ -16,7 +17,7 @@ static bool cc1101_spi_trx(FuriHalSpiBusHandle* handle, uint8_t* tx, uint8_t* rx
|
||||
return true;
|
||||
}
|
||||
|
||||
CC1101Status cc1101_strobe(FuriHalSpiBusHandle* handle, uint8_t strobe) {
|
||||
CC1101Status cc1101_strobe(const FuriHalSpiBusHandle* handle, uint8_t strobe) {
|
||||
uint8_t tx[1] = {strobe};
|
||||
CC1101Status rx[1] = {0};
|
||||
rx[0].CHIP_RDYn = 1;
|
||||
@@ -27,7 +28,7 @@ CC1101Status cc1101_strobe(FuriHalSpiBusHandle* handle, uint8_t strobe) {
|
||||
return rx[0];
|
||||
}
|
||||
|
||||
CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data) {
|
||||
CC1101Status cc1101_write_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data) {
|
||||
uint8_t tx[2] = {reg, data};
|
||||
CC1101Status rx[2] = {0};
|
||||
rx[0].CHIP_RDYn = 1;
|
||||
@@ -39,7 +40,7 @@ CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
return rx[1];
|
||||
}
|
||||
|
||||
CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data) {
|
||||
CC1101Status cc1101_read_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data) {
|
||||
assert(sizeof(CC1101Status) == 1);
|
||||
uint8_t tx[2] = {reg | CC1101_READ, 0};
|
||||
CC1101Status rx[2] = {0};
|
||||
@@ -52,33 +53,36 @@ CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t*
|
||||
return rx[0];
|
||||
}
|
||||
|
||||
uint8_t cc1101_get_partnumber(FuriHalSpiBusHandle* handle) {
|
||||
uint8_t cc1101_get_partnumber(const FuriHalSpiBusHandle* handle) {
|
||||
uint8_t partnumber = 0;
|
||||
cc1101_read_reg(handle, CC1101_STATUS_PARTNUM | CC1101_BURST, &partnumber);
|
||||
return partnumber;
|
||||
}
|
||||
|
||||
uint8_t cc1101_get_version(FuriHalSpiBusHandle* handle) {
|
||||
uint8_t cc1101_get_version(const FuriHalSpiBusHandle* handle) {
|
||||
uint8_t version = 0;
|
||||
cc1101_read_reg(handle, CC1101_STATUS_VERSION | CC1101_BURST, &version);
|
||||
return version;
|
||||
}
|
||||
|
||||
uint8_t cc1101_get_rssi(FuriHalSpiBusHandle* handle) {
|
||||
uint8_t cc1101_get_rssi(const FuriHalSpiBusHandle* handle) {
|
||||
uint8_t rssi = 0;
|
||||
cc1101_read_reg(handle, CC1101_STATUS_RSSI | CC1101_BURST, &rssi);
|
||||
return rssi;
|
||||
}
|
||||
|
||||
CC1101Status cc1101_reset(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_reset(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SRES);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_get_status(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_get_status(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SNOP);
|
||||
}
|
||||
|
||||
bool cc1101_wait_status_state(FuriHalSpiBusHandle* handle, CC1101State state, uint32_t timeout_us) {
|
||||
bool cc1101_wait_status_state(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
CC1101State state,
|
||||
uint32_t timeout_us) {
|
||||
bool result = false;
|
||||
CC1101Status status = {0};
|
||||
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(timeout_us);
|
||||
@@ -92,35 +96,35 @@ bool cc1101_wait_status_state(FuriHalSpiBusHandle* handle, CC1101State state, ui
|
||||
return result;
|
||||
}
|
||||
|
||||
CC1101Status cc1101_shutdown(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_shutdown(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SPWD);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_calibrate(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_calibrate(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SCAL);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_switch_to_idle(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_switch_to_idle(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SIDLE);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_switch_to_rx(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_switch_to_rx(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SRX);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_switch_to_tx(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_switch_to_tx(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_STX);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_flush_rx(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_flush_rx(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SFRX);
|
||||
}
|
||||
|
||||
CC1101Status cc1101_flush_tx(FuriHalSpiBusHandle* handle) {
|
||||
CC1101Status cc1101_flush_tx(const FuriHalSpiBusHandle* handle) {
|
||||
return cc1101_strobe(handle, CC1101_STROBE_SFTX);
|
||||
}
|
||||
|
||||
uint32_t cc1101_set_frequency(FuriHalSpiBusHandle* handle, uint32_t value) {
|
||||
uint32_t cc1101_set_frequency(const FuriHalSpiBusHandle* handle, uint32_t value) {
|
||||
uint64_t real_value = (uint64_t)value * CC1101_FDIV / CC1101_QUARTZ;
|
||||
|
||||
// Sanity check
|
||||
@@ -135,7 +139,7 @@ uint32_t cc1101_set_frequency(FuriHalSpiBusHandle* handle, uint32_t value) {
|
||||
return (uint32_t)real_frequency;
|
||||
}
|
||||
|
||||
uint32_t cc1101_set_intermediate_frequency(FuriHalSpiBusHandle* handle, uint32_t value) {
|
||||
uint32_t cc1101_set_intermediate_frequency(const FuriHalSpiBusHandle* handle, uint32_t value) {
|
||||
uint64_t real_value = value * CC1101_IFDIV / CC1101_QUARTZ;
|
||||
assert((real_value & 0xFF) == real_value);
|
||||
|
||||
@@ -146,7 +150,7 @@ uint32_t cc1101_set_intermediate_frequency(FuriHalSpiBusHandle* handle, uint32_t
|
||||
return (uint32_t)real_frequency;
|
||||
}
|
||||
|
||||
void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]) {
|
||||
void cc1101_set_pa_table(const FuriHalSpiBusHandle* handle, const uint8_t value[8]) {
|
||||
uint8_t tx[9] = {CC1101_PATABLE | CC1101_BURST}; //-V1009
|
||||
CC1101Status rx[9] = {0};
|
||||
rx[0].CHIP_RDYn = 1;
|
||||
@@ -159,7 +163,7 @@ void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]) {
|
||||
assert((rx[0].CHIP_RDYn | rx[8].CHIP_RDYn) == 0);
|
||||
}
|
||||
|
||||
uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint8_t size) {
|
||||
uint8_t cc1101_write_fifo(const FuriHalSpiBusHandle* handle, const uint8_t* data, uint8_t size) {
|
||||
uint8_t buff_tx[64];
|
||||
uint8_t buff_rx[64];
|
||||
buff_tx[0] = CC1101_FIFO | CC1101_BURST;
|
||||
@@ -170,7 +174,7 @@ uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint
|
||||
return size;
|
||||
}
|
||||
|
||||
uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size) {
|
||||
uint8_t cc1101_read_fifo(const FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size) {
|
||||
uint8_t buff_trx[2];
|
||||
buff_trx[0] = CC1101_FIFO | CC1101_READ | CC1101_BURST;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ extern "C" {
|
||||
*
|
||||
* @return device status
|
||||
*/
|
||||
CC1101Status cc1101_strobe(FuriHalSpiBusHandle* handle, uint8_t strobe);
|
||||
CC1101Status cc1101_strobe(const FuriHalSpiBusHandle* handle, uint8_t strobe);
|
||||
|
||||
/** Write device register
|
||||
*
|
||||
@@ -29,7 +29,7 @@ CC1101Status cc1101_strobe(FuriHalSpiBusHandle* handle, uint8_t strobe);
|
||||
*
|
||||
* @return device status
|
||||
*/
|
||||
CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data);
|
||||
CC1101Status cc1101_write_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data);
|
||||
|
||||
/** Read device register
|
||||
*
|
||||
@@ -39,7 +39,7 @@ CC1101Status cc1101_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
*
|
||||
* @return device status
|
||||
*/
|
||||
CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data);
|
||||
CC1101Status cc1101_read_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data);
|
||||
|
||||
/* High level API */
|
||||
|
||||
@@ -49,7 +49,7 @@ CC1101Status cc1101_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t*
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_reset(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_reset(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Get status
|
||||
*
|
||||
@@ -57,7 +57,7 @@ CC1101Status cc1101_reset(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_get_status(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_get_status(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Wait specific chip state
|
||||
*
|
||||
@@ -67,7 +67,10 @@ CC1101Status cc1101_get_status(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool cc1101_wait_status_state(FuriHalSpiBusHandle* handle, CC1101State state, uint32_t timeout_us);
|
||||
bool cc1101_wait_status_state(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
CC1101State state,
|
||||
uint32_t timeout_us);
|
||||
|
||||
/** Enable shutdown mode
|
||||
*
|
||||
@@ -75,7 +78,7 @@ bool cc1101_wait_status_state(FuriHalSpiBusHandle* handle, CC1101State state, ui
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_shutdown(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_shutdown(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Get Partnumber
|
||||
*
|
||||
@@ -83,7 +86,7 @@ CC1101Status cc1101_shutdown(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return part number id
|
||||
*/
|
||||
uint8_t cc1101_get_partnumber(FuriHalSpiBusHandle* handle);
|
||||
uint8_t cc1101_get_partnumber(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Get Version
|
||||
*
|
||||
@@ -91,7 +94,7 @@ uint8_t cc1101_get_partnumber(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return version
|
||||
*/
|
||||
uint8_t cc1101_get_version(FuriHalSpiBusHandle* handle);
|
||||
uint8_t cc1101_get_version(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Get raw RSSI value
|
||||
*
|
||||
@@ -99,7 +102,7 @@ uint8_t cc1101_get_version(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return rssi value
|
||||
*/
|
||||
uint8_t cc1101_get_rssi(FuriHalSpiBusHandle* handle);
|
||||
uint8_t cc1101_get_rssi(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Calibrate oscillator
|
||||
*
|
||||
@@ -107,13 +110,13 @@ uint8_t cc1101_get_rssi(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_calibrate(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_calibrate(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Switch to idle
|
||||
*
|
||||
* @param handle - pointer to FuriHalSpiHandle
|
||||
*/
|
||||
CC1101Status cc1101_switch_to_idle(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_switch_to_idle(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Switch to RX
|
||||
*
|
||||
@@ -121,7 +124,7 @@ CC1101Status cc1101_switch_to_idle(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_switch_to_rx(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_switch_to_rx(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Switch to TX
|
||||
*
|
||||
@@ -129,7 +132,7 @@ CC1101Status cc1101_switch_to_rx(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_switch_to_tx(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_switch_to_tx(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Flush RX FIFO
|
||||
*
|
||||
@@ -137,13 +140,13 @@ CC1101Status cc1101_switch_to_tx(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return CC1101Status structure
|
||||
*/
|
||||
CC1101Status cc1101_flush_rx(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_flush_rx(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Flush TX FIFO
|
||||
*
|
||||
* @param handle - pointer to FuriHalSpiHandle
|
||||
*/
|
||||
CC1101Status cc1101_flush_tx(FuriHalSpiBusHandle* handle);
|
||||
CC1101Status cc1101_flush_tx(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Set Frequency
|
||||
*
|
||||
@@ -152,7 +155,7 @@ CC1101Status cc1101_flush_tx(FuriHalSpiBusHandle* handle);
|
||||
*
|
||||
* @return real frequency that were synthesized
|
||||
*/
|
||||
uint32_t cc1101_set_frequency(FuriHalSpiBusHandle* handle, uint32_t value);
|
||||
uint32_t cc1101_set_frequency(const FuriHalSpiBusHandle* handle, uint32_t value);
|
||||
|
||||
/** Set Intermediate Frequency
|
||||
*
|
||||
@@ -161,14 +164,14 @@ uint32_t cc1101_set_frequency(FuriHalSpiBusHandle* handle, uint32_t value);
|
||||
*
|
||||
* @return real inermediate frequency that were synthesized
|
||||
*/
|
||||
uint32_t cc1101_set_intermediate_frequency(FuriHalSpiBusHandle* handle, uint32_t value);
|
||||
uint32_t cc1101_set_intermediate_frequency(const FuriHalSpiBusHandle* handle, uint32_t value);
|
||||
|
||||
/** Set Power Amplifier level table, ramp
|
||||
*
|
||||
* @param handle - pointer to FuriHalSpiHandle
|
||||
* @param value - array of power level values
|
||||
*/
|
||||
void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]);
|
||||
void cc1101_set_pa_table(const FuriHalSpiBusHandle* handle, const uint8_t value[8]);
|
||||
|
||||
/** Write FIFO
|
||||
*
|
||||
@@ -178,7 +181,7 @@ void cc1101_set_pa_table(FuriHalSpiBusHandle* handle, const uint8_t value[8]);
|
||||
*
|
||||
* @return size, written bytes count
|
||||
*/
|
||||
uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint8_t size);
|
||||
uint8_t cc1101_write_fifo(const FuriHalSpiBusHandle* handle, const uint8_t* data, uint8_t size);
|
||||
|
||||
/** Read FIFO
|
||||
*
|
||||
@@ -188,7 +191,7 @@ uint8_t cc1101_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* data, uint
|
||||
*
|
||||
* @return size, read bytes count
|
||||
*/
|
||||
uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size);
|
||||
uint8_t cc1101_read_fifo(const FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "lp5562_reg.h"
|
||||
#include <furi_hal.h>
|
||||
|
||||
void lp5562_reset(FuriHalI2cBusHandle* handle) {
|
||||
void lp5562_reset(const FuriHalI2cBusHandle* handle) {
|
||||
Reg0D_Reset reg = {.value = 0xFF};
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x0D, *(uint8_t*)®, LP5562_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void lp5562_configure(FuriHalI2cBusHandle* handle) {
|
||||
void lp5562_configure(const FuriHalI2cBusHandle* handle) {
|
||||
Reg08_Config config = {.INT_CLK_EN = true, .PS_EN = true, .PWM_HF = true};
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x08, *(uint8_t*)&config, LP5562_I2C_TIMEOUT);
|
||||
|
||||
@@ -21,14 +21,17 @@ void lp5562_configure(FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x70, *(uint8_t*)&map, LP5562_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void lp5562_enable(FuriHalI2cBusHandle* handle) {
|
||||
void lp5562_enable(const FuriHalI2cBusHandle* handle) {
|
||||
Reg00_Enable reg = {.CHIP_EN = true, .LOG_EN = true};
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x00, *(uint8_t*)®, LP5562_I2C_TIMEOUT);
|
||||
//>488μs delay is required after writing to 0x00 register, otherwise program engine will not work
|
||||
furi_delay_us(500);
|
||||
}
|
||||
|
||||
void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value) {
|
||||
void lp5562_set_channel_current(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Channel channel,
|
||||
uint8_t value) {
|
||||
uint8_t reg_no;
|
||||
if(channel == LP5562ChannelRed) {
|
||||
reg_no = LP5562_CHANNEL_RED_CURRENT_REGISTER;
|
||||
@@ -44,7 +47,10 @@ void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel chann
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, reg_no, value, LP5562_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void lp5562_set_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value) {
|
||||
void lp5562_set_channel_value(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Channel channel,
|
||||
uint8_t value) {
|
||||
uint8_t reg_no;
|
||||
if(channel == LP5562ChannelRed) {
|
||||
reg_no = LP5562_CHANNEL_RED_VALUE_REGISTER;
|
||||
@@ -60,7 +66,7 @@ void lp5562_set_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, reg_no, value, LP5562_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
uint8_t lp5562_get_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel) {
|
||||
uint8_t lp5562_get_channel_value(const FuriHalI2cBusHandle* handle, LP5562Channel channel) {
|
||||
uint8_t reg_no;
|
||||
uint8_t value;
|
||||
if(channel == LP5562ChannelRed) {
|
||||
@@ -78,7 +84,10 @@ uint8_t lp5562_get_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel chan
|
||||
return value;
|
||||
}
|
||||
|
||||
void lp5562_set_channel_src(FuriHalI2cBusHandle* handle, LP5562Channel channel, LP5562Engine src) {
|
||||
void lp5562_set_channel_src(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Channel channel,
|
||||
LP5562Engine src) {
|
||||
uint8_t reg_val = 0;
|
||||
uint8_t bit_offset = 0;
|
||||
|
||||
@@ -107,7 +116,7 @@ void lp5562_set_channel_src(FuriHalI2cBusHandle* handle, LP5562Channel channel,
|
||||
}
|
||||
|
||||
void lp5562_execute_program(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Engine eng,
|
||||
LP5562Channel ch,
|
||||
uint16_t* program) {
|
||||
@@ -155,7 +164,7 @@ void lp5562_execute_program(
|
||||
furi_hal_i2c_write_reg_8(handle, LP5562_ADDRESS, 0x00, enable_reg, LP5562_I2C_TIMEOUT);
|
||||
}
|
||||
|
||||
void lp5562_stop_program(FuriHalI2cBusHandle* handle, LP5562Engine eng) {
|
||||
void lp5562_stop_program(const FuriHalI2cBusHandle* handle, LP5562Engine eng) {
|
||||
if((eng < LP5562Engine1) || (eng > LP5562Engine3)) return;
|
||||
uint8_t reg_val = 0;
|
||||
uint8_t bit_offset = 0;
|
||||
@@ -169,7 +178,7 @@ void lp5562_stop_program(FuriHalI2cBusHandle* handle, LP5562Engine eng) {
|
||||
}
|
||||
|
||||
void lp5562_execute_ramp(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Engine eng,
|
||||
LP5562Channel ch,
|
||||
uint8_t val_start,
|
||||
@@ -213,7 +222,7 @@ void lp5562_execute_ramp(
|
||||
}
|
||||
|
||||
void lp5562_execute_blink(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Engine eng,
|
||||
LP5562Channel ch,
|
||||
uint16_t on_time,
|
||||
|
||||
@@ -20,39 +20,48 @@ typedef enum {
|
||||
} LP5562Engine;
|
||||
|
||||
/** Initialize Driver */
|
||||
void lp5562_reset(FuriHalI2cBusHandle* handle);
|
||||
void lp5562_reset(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Configure Driver */
|
||||
void lp5562_configure(FuriHalI2cBusHandle* handle);
|
||||
void lp5562_configure(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Enable Driver */
|
||||
void lp5562_enable(FuriHalI2cBusHandle* handle);
|
||||
void lp5562_enable(const FuriHalI2cBusHandle* handle);
|
||||
|
||||
/** Set channel current */
|
||||
void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value);
|
||||
void lp5562_set_channel_current(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Channel channel,
|
||||
uint8_t value);
|
||||
|
||||
/** Set channel PWM value */
|
||||
void lp5562_set_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value);
|
||||
void lp5562_set_channel_value(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Channel channel,
|
||||
uint8_t value);
|
||||
|
||||
/** Get channel PWM value */
|
||||
uint8_t lp5562_get_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel);
|
||||
uint8_t lp5562_get_channel_value(const FuriHalI2cBusHandle* handle, LP5562Channel channel);
|
||||
|
||||
/** Set channel source */
|
||||
void lp5562_set_channel_src(FuriHalI2cBusHandle* handle, LP5562Channel channel, LP5562Engine src);
|
||||
void lp5562_set_channel_src(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Channel channel,
|
||||
LP5562Engine src);
|
||||
|
||||
/** Execute program sequence */
|
||||
void lp5562_execute_program(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Engine eng,
|
||||
LP5562Channel ch,
|
||||
uint16_t* program);
|
||||
|
||||
/** Stop program sequence */
|
||||
void lp5562_stop_program(FuriHalI2cBusHandle* handle, LP5562Engine eng);
|
||||
void lp5562_stop_program(const FuriHalI2cBusHandle* handle, LP5562Engine eng);
|
||||
|
||||
/** Execute ramp program sequence */
|
||||
void lp5562_execute_ramp(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Engine eng,
|
||||
LP5562Channel ch,
|
||||
uint8_t val_start,
|
||||
@@ -61,7 +70,7 @@ void lp5562_execute_ramp(
|
||||
|
||||
/** Start blink program sequence */
|
||||
void lp5562_execute_blink(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
LP5562Engine eng,
|
||||
LP5562Channel ch,
|
||||
uint16_t on_time,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
void st25r3916_mask_irq(FuriHalSpiBusHandle* handle, uint32_t mask) {
|
||||
void st25r3916_mask_irq(const FuriHalSpiBusHandle* handle, uint32_t mask) {
|
||||
furi_assert(handle);
|
||||
|
||||
uint8_t irq_mask_regs[4] = {
|
||||
@@ -14,7 +14,7 @@ void st25r3916_mask_irq(FuriHalSpiBusHandle* handle, uint32_t mask) {
|
||||
st25r3916_write_burst_regs(handle, ST25R3916_REG_IRQ_MASK_MAIN, irq_mask_regs, 4);
|
||||
}
|
||||
|
||||
uint32_t st25r3916_get_irq(FuriHalSpiBusHandle* handle) {
|
||||
uint32_t st25r3916_get_irq(const FuriHalSpiBusHandle* handle) {
|
||||
furi_assert(handle);
|
||||
|
||||
uint8_t irq_regs[4] = {};
|
||||
@@ -32,7 +32,7 @@ uint32_t st25r3916_get_irq(FuriHalSpiBusHandle* handle) {
|
||||
return irq;
|
||||
}
|
||||
|
||||
void st25r3916_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t bits) {
|
||||
void st25r3916_write_fifo(const FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t bits) {
|
||||
furi_assert(handle);
|
||||
furi_assert(buff);
|
||||
|
||||
@@ -45,7 +45,7 @@ void st25r3916_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size
|
||||
}
|
||||
|
||||
bool st25r3916_read_fifo(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* buff,
|
||||
size_t buff_size,
|
||||
size_t* buff_bits) {
|
||||
|
||||
@@ -75,7 +75,7 @@ extern "C" {
|
||||
* @param handle - pointer to FuriHalSpiBusHandle instance
|
||||
* @param mask - mask of interrupts to be disabled
|
||||
*/
|
||||
void st25r3916_mask_irq(FuriHalSpiBusHandle* handle, uint32_t mask);
|
||||
void st25r3916_mask_irq(const FuriHalSpiBusHandle* handle, uint32_t mask);
|
||||
|
||||
/** Get st25r3916 interrupts
|
||||
*
|
||||
@@ -83,7 +83,7 @@ void st25r3916_mask_irq(FuriHalSpiBusHandle* handle, uint32_t mask);
|
||||
*
|
||||
* @return received interrupts
|
||||
*/
|
||||
uint32_t st25r3916_get_irq(FuriHalSpiBusHandle* handle);
|
||||
uint32_t st25r3916_get_irq(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/** Write FIFO
|
||||
*
|
||||
@@ -91,7 +91,7 @@ uint32_t st25r3916_get_irq(FuriHalSpiBusHandle* handle);
|
||||
* @param buff - buffer to write to FIFO
|
||||
* @param bits - number of bits to write
|
||||
*/
|
||||
void st25r3916_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t bits);
|
||||
void st25r3916_write_fifo(const FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t bits);
|
||||
|
||||
/** Read FIFO
|
||||
*
|
||||
@@ -103,7 +103,7 @@ void st25r3916_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size
|
||||
* @return true if read success, false otherwise
|
||||
*/
|
||||
bool st25r3916_read_fifo(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* buff,
|
||||
size_t buff_size,
|
||||
size_t* buff_bits);
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
(ST25R3916_CMD_LEN + \
|
||||
ST25R3916_FIFO_DEPTH) /*!< ST25R3916 communication buffer: CMD + FIFO length */
|
||||
|
||||
static void st25r3916_reg_tx_byte(FuriHalSpiBusHandle* handle, uint8_t byte) {
|
||||
static void st25r3916_reg_tx_byte(const FuriHalSpiBusHandle* handle, uint8_t byte) {
|
||||
uint8_t val = byte;
|
||||
furi_hal_spi_bus_tx(handle, &val, 1, 5);
|
||||
}
|
||||
|
||||
void st25r3916_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val) {
|
||||
void st25r3916_read_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val) {
|
||||
furi_check(handle);
|
||||
st25r3916_read_burst_regs(handle, reg, val, 1);
|
||||
}
|
||||
|
||||
void st25r3916_read_burst_regs(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg_start,
|
||||
uint8_t* values,
|
||||
uint8_t length) {
|
||||
@@ -59,14 +59,14 @@ void st25r3916_read_burst_regs(
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val) {
|
||||
void st25r3916_write_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val) {
|
||||
furi_check(handle);
|
||||
uint8_t reg_val = val;
|
||||
st25r3916_write_burst_regs(handle, reg, ®_val, 1);
|
||||
}
|
||||
|
||||
void st25r3916_write_burst_regs(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg_start,
|
||||
const uint8_t* values,
|
||||
uint8_t length) {
|
||||
@@ -86,7 +86,10 @@ void st25r3916_write_burst_regs(
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_reg_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t length) {
|
||||
void st25r3916_reg_write_fifo(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* buff,
|
||||
size_t length) {
|
||||
furi_check(handle);
|
||||
furi_check(buff);
|
||||
furi_check(length);
|
||||
@@ -98,7 +101,7 @@ void st25r3916_reg_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff,
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_reg_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) {
|
||||
void st25r3916_reg_read_fifo(const FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) {
|
||||
furi_check(handle);
|
||||
furi_check(buff);
|
||||
furi_check(length);
|
||||
@@ -110,7 +113,10 @@ void st25r3916_reg_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_write_pta_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, size_t length) {
|
||||
void st25r3916_write_pta_mem(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* values,
|
||||
size_t length) {
|
||||
furi_check(handle);
|
||||
furi_check(values);
|
||||
furi_check(length);
|
||||
@@ -122,7 +128,7 @@ void st25r3916_write_pta_mem(FuriHalSpiBusHandle* handle, const uint8_t* values,
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_read_pta_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) {
|
||||
void st25r3916_read_pta_mem(const FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) {
|
||||
furi_check(handle);
|
||||
furi_check(buff);
|
||||
furi_check(length);
|
||||
@@ -136,7 +142,10 @@ void st25r3916_read_pta_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t l
|
||||
memcpy(buff, tmp_buff + 1, length);
|
||||
}
|
||||
|
||||
void st25r3916_write_ptf_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, size_t length) {
|
||||
void st25r3916_write_ptf_mem(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* values,
|
||||
size_t length) {
|
||||
furi_check(handle);
|
||||
furi_check(values);
|
||||
|
||||
@@ -146,7 +155,7 @@ void st25r3916_write_ptf_mem(FuriHalSpiBusHandle* handle, const uint8_t* values,
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_write_pttsn_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) {
|
||||
void st25r3916_write_pttsn_mem(const FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) {
|
||||
furi_check(handle);
|
||||
furi_check(buff);
|
||||
|
||||
@@ -156,7 +165,7 @@ void st25r3916_write_pttsn_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_direct_cmd(FuriHalSpiBusHandle* handle, uint8_t cmd) {
|
||||
void st25r3916_direct_cmd(const FuriHalSpiBusHandle* handle, uint8_t cmd) {
|
||||
furi_check(handle);
|
||||
|
||||
furi_hal_gpio_write(handle->cs, false);
|
||||
@@ -164,7 +173,7 @@ void st25r3916_direct_cmd(FuriHalSpiBusHandle* handle, uint8_t cmd) {
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_read_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val) {
|
||||
void st25r3916_read_test_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val) {
|
||||
furi_check(handle);
|
||||
|
||||
furi_hal_gpio_write(handle->cs, false);
|
||||
@@ -174,7 +183,7 @@ void st25r3916_read_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t*
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_write_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val) {
|
||||
void st25r3916_write_test_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val) {
|
||||
furi_check(handle);
|
||||
|
||||
furi_hal_gpio_write(handle->cs, false);
|
||||
@@ -184,7 +193,7 @@ void st25r3916_write_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
furi_hal_gpio_write(handle->cs, true);
|
||||
}
|
||||
|
||||
void st25r3916_clear_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t clr_mask) {
|
||||
void st25r3916_clear_reg_bits(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t clr_mask) {
|
||||
furi_check(handle);
|
||||
|
||||
uint8_t reg_val = 0;
|
||||
@@ -195,7 +204,7 @@ void st25r3916_clear_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
void st25r3916_set_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t set_mask) {
|
||||
void st25r3916_set_reg_bits(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t set_mask) {
|
||||
furi_check(handle);
|
||||
|
||||
uint8_t reg_val = 0;
|
||||
@@ -207,7 +216,7 @@ void st25r3916_set_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t se
|
||||
}
|
||||
|
||||
void st25r3916_change_reg_bits(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg,
|
||||
uint8_t mask,
|
||||
uint8_t value) {
|
||||
@@ -217,7 +226,7 @@ void st25r3916_change_reg_bits(
|
||||
}
|
||||
|
||||
void st25r3916_modify_reg(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg,
|
||||
uint8_t clr_mask,
|
||||
uint8_t set_mask) {
|
||||
@@ -233,7 +242,7 @@ void st25r3916_modify_reg(
|
||||
}
|
||||
|
||||
void st25r3916_change_test_reg_bits(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg,
|
||||
uint8_t mask,
|
||||
uint8_t value) {
|
||||
@@ -248,7 +257,7 @@ void st25r3916_change_test_reg_bits(
|
||||
}
|
||||
}
|
||||
|
||||
bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t val) {
|
||||
bool st25r3916_check_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t val) {
|
||||
furi_check(handle);
|
||||
|
||||
uint8_t reg_val = 0;
|
||||
|
||||
@@ -967,7 +967,7 @@ extern "C" {
|
||||
* @param reg - register address
|
||||
* @param val - pointer to the variable to store the read value
|
||||
*/
|
||||
void st25r3916_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val);
|
||||
void st25r3916_read_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val);
|
||||
|
||||
/** Read multiple registers
|
||||
*
|
||||
@@ -977,7 +977,7 @@ void st25r3916_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val);
|
||||
* @param length - number of registers to read
|
||||
*/
|
||||
void st25r3916_read_burst_regs(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg_start,
|
||||
uint8_t* values,
|
||||
uint8_t length);
|
||||
@@ -988,7 +988,7 @@ void st25r3916_read_burst_regs(
|
||||
* @param reg - register address
|
||||
* @param val - value to write
|
||||
*/
|
||||
void st25r3916_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val);
|
||||
void st25r3916_write_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val);
|
||||
|
||||
/** Write multiple registers
|
||||
*
|
||||
@@ -998,7 +998,7 @@ void st25r3916_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val);
|
||||
* @param length - number of registers to write
|
||||
*/
|
||||
void st25r3916_write_burst_regs(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg_start,
|
||||
const uint8_t* values,
|
||||
uint8_t length);
|
||||
@@ -1009,7 +1009,10 @@ void st25r3916_write_burst_regs(
|
||||
* @param buff - buffer to write to FIFO
|
||||
* @param length - number of bytes to write
|
||||
*/
|
||||
void st25r3916_reg_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t length);
|
||||
void st25r3916_reg_write_fifo(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* buff,
|
||||
size_t length);
|
||||
|
||||
/** Read fifo register
|
||||
*
|
||||
@@ -1017,7 +1020,7 @@ void st25r3916_reg_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff,
|
||||
* @param buff - buffer to store the read values
|
||||
* @param length - number of bytes to read
|
||||
*/
|
||||
void st25r3916_reg_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length);
|
||||
void st25r3916_reg_read_fifo(const FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length);
|
||||
|
||||
/** Write PTA memory register
|
||||
*
|
||||
@@ -1025,7 +1028,10 @@ void st25r3916_reg_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t
|
||||
* @param values - pointer to buffer to write
|
||||
* @param length - number of bytes to write
|
||||
*/
|
||||
void st25r3916_write_pta_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, size_t length);
|
||||
void st25r3916_write_pta_mem(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* values,
|
||||
size_t length);
|
||||
|
||||
/** Read PTA memory register
|
||||
*
|
||||
@@ -1033,7 +1039,7 @@ void st25r3916_write_pta_mem(FuriHalSpiBusHandle* handle, const uint8_t* values,
|
||||
* @param values - buffer to store the read values
|
||||
* @param length - number of bytes to read
|
||||
*/
|
||||
void st25r3916_read_pta_mem(FuriHalSpiBusHandle* handle, uint8_t* values, size_t length);
|
||||
void st25r3916_read_pta_mem(const FuriHalSpiBusHandle* handle, uint8_t* values, size_t length);
|
||||
|
||||
/** Write PTF memory register
|
||||
*
|
||||
@@ -1041,7 +1047,10 @@ void st25r3916_read_pta_mem(FuriHalSpiBusHandle* handle, uint8_t* values, size_t
|
||||
* @param values - pointer to buffer to write
|
||||
* @param length - number of bytes to write
|
||||
*/
|
||||
void st25r3916_write_ptf_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, size_t length);
|
||||
void st25r3916_write_ptf_mem(
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* values,
|
||||
size_t length);
|
||||
|
||||
/** Read PTTSN memory register
|
||||
*
|
||||
@@ -1049,21 +1058,21 @@ void st25r3916_write_ptf_mem(FuriHalSpiBusHandle* handle, const uint8_t* values,
|
||||
* @param values - pointer to buffer to write
|
||||
* @param length - number of bytes to write
|
||||
*/
|
||||
void st25r3916_write_pttsn_mem(FuriHalSpiBusHandle* handle, uint8_t* values, size_t length);
|
||||
void st25r3916_write_pttsn_mem(const FuriHalSpiBusHandle* handle, uint8_t* values, size_t length);
|
||||
|
||||
/** Send Direct command
|
||||
*
|
||||
* @param handle - pointer to FuriHalSpiBusHandle instance
|
||||
* @param cmd - direct command
|
||||
*/
|
||||
void st25r3916_direct_cmd(FuriHalSpiBusHandle* handle, uint8_t cmd);
|
||||
void st25r3916_direct_cmd(const FuriHalSpiBusHandle* handle, uint8_t cmd);
|
||||
|
||||
/** Read test register
|
||||
* @param handle - pointer to FuriHalSpiBusHandle instance
|
||||
* @param reg - register address
|
||||
* @param val - pointer to the variable to store the read value
|
||||
*/
|
||||
void st25r3916_read_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val);
|
||||
void st25r3916_read_test_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val);
|
||||
|
||||
/** Write test register
|
||||
*
|
||||
@@ -1071,7 +1080,7 @@ void st25r3916_read_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t*
|
||||
* @param reg - register address
|
||||
* @param val - value to write
|
||||
*/
|
||||
void st25r3916_write_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val);
|
||||
void st25r3916_write_test_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val);
|
||||
|
||||
/** Clear register bits
|
||||
*
|
||||
@@ -1079,7 +1088,7 @@ void st25r3916_write_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
* @param reg - register address
|
||||
* @param clr_mask - bit mask to clear
|
||||
*/
|
||||
void st25r3916_clear_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t clr_mask);
|
||||
void st25r3916_clear_reg_bits(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t clr_mask);
|
||||
|
||||
/** Set register bits
|
||||
*
|
||||
@@ -1087,7 +1096,7 @@ void st25r3916_clear_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t
|
||||
* @param reg - register address
|
||||
* @param set_mask - bit mask to set
|
||||
*/
|
||||
void st25r3916_set_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t set_mask);
|
||||
void st25r3916_set_reg_bits(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t set_mask);
|
||||
|
||||
/** Change register bits
|
||||
*
|
||||
@@ -1097,7 +1106,7 @@ void st25r3916_set_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t se
|
||||
* @param value - new register value to write
|
||||
*/
|
||||
void st25r3916_change_reg_bits(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg,
|
||||
uint8_t mask,
|
||||
uint8_t value);
|
||||
@@ -1110,7 +1119,7 @@ void st25r3916_change_reg_bits(
|
||||
* @param set_mask - bit mask to set
|
||||
*/
|
||||
void st25r3916_modify_reg(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg,
|
||||
uint8_t clr_mask,
|
||||
uint8_t set_mask);
|
||||
@@ -1123,7 +1132,7 @@ void st25r3916_modify_reg(
|
||||
* @param value - new register value to write
|
||||
*/
|
||||
void st25r3916_change_test_reg_bits(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t reg,
|
||||
uint8_t mask,
|
||||
uint8_t value);
|
||||
@@ -1137,7 +1146,7 @@ void st25r3916_change_test_reg_bits(
|
||||
*
|
||||
* @return true if register value matches the expected value, false otherwise
|
||||
*/
|
||||
bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t val);
|
||||
bool st25r3916_check_reg(const FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "protocol_ds1420.h"
|
||||
#include "protocol_ds_generic.h"
|
||||
|
||||
const iButtonProtocolDallasBase* ibutton_protocols_dallas[] = {
|
||||
const iButtonProtocolDallasBase* const ibutton_protocols_dallas[] = {
|
||||
[iButtonProtocolDS1990] = &ibutton_protocol_ds1990,
|
||||
[iButtonProtocolDS1992] = &ibutton_protocol_ds1992,
|
||||
[iButtonProtocolDS1996] = &ibutton_protocol_ds1996,
|
||||
|
||||
@@ -15,4 +15,4 @@ typedef enum {
|
||||
iButtonProtocolDSMax,
|
||||
} iButtonProtocolDallas;
|
||||
|
||||
extern const iButtonProtocolDallasBase* ibutton_protocols_dallas[];
|
||||
extern const iButtonProtocolDallasBase* const ibutton_protocols_dallas[];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "protocol_cyfral.h"
|
||||
#include "protocol_metakom.h"
|
||||
|
||||
const ProtocolBase* ibutton_protocols_misc[] = {
|
||||
const ProtocolBase* const ibutton_protocols_misc[] = {
|
||||
[iButtonProtocolMiscCyfral] = &ibutton_protocol_misc_cyfral,
|
||||
[iButtonProtocolMiscMetakom] = &ibutton_protocol_misc_metakom,
|
||||
/* Add new misc protocols here */
|
||||
|
||||
@@ -8,4 +8,4 @@ typedef enum {
|
||||
iButtonProtocolMiscMax,
|
||||
} iButtonProtocolMisc;
|
||||
|
||||
extern const ProtocolBase* ibutton_protocols_misc[];
|
||||
extern const ProtocolBase* const ibutton_protocols_misc[];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "dallas/protocol_group_dallas.h"
|
||||
#include "misc/protocol_group_misc.h"
|
||||
|
||||
const iButtonProtocolGroupBase* ibutton_protocol_groups[] = {
|
||||
const iButtonProtocolGroupBase* const ibutton_protocol_groups[] = {
|
||||
[iButtonProtocolGroupDallas] = &ibutton_protocol_group_dallas,
|
||||
[iButtonProtocolGroupMisc] = &ibutton_protocol_group_misc,
|
||||
};
|
||||
|
||||
@@ -8,4 +8,4 @@ typedef enum {
|
||||
iButtonProtocolGroupMax
|
||||
} iButtonProtocolGroup;
|
||||
|
||||
extern const iButtonProtocolGroupBase* ibutton_protocol_groups[];
|
||||
extern const iButtonProtocolGroupBase* const ibutton_protocol_groups[];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "protocol_noralsy.h"
|
||||
#include "protocol_insta_fob.h"
|
||||
|
||||
const ProtocolBase* lfrfid_protocols[] = {
|
||||
const ProtocolBase* const lfrfid_protocols[] = {
|
||||
[LFRFIDProtocolEM4100] = &protocol_em4100,
|
||||
[LFRFIDProtocolEM4100_32] = &protocol_em4100_32,
|
||||
[LFRFIDProtocolEM4100_16] = &protocol_em4100_16,
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef enum {
|
||||
LFRFIDProtocolMax,
|
||||
} LFRFIDProtocol;
|
||||
|
||||
extern const ProtocolBase* lfrfid_protocols[];
|
||||
extern const ProtocolBase* const lfrfid_protocols[];
|
||||
|
||||
typedef enum {
|
||||
LFRFIDWriteTypeT5577,
|
||||
|
||||
@@ -21,7 +21,7 @@ typedef struct {
|
||||
uint8_t chk;
|
||||
} ProtocolNexwatchMagic;
|
||||
|
||||
ProtocolNexwatchMagic magic_items[] = {
|
||||
static ProtocolNexwatchMagic magic_items[] = {
|
||||
{0xBE, "Quadrakey", 0},
|
||||
{0x88, "Nexkey", 0},
|
||||
{0x86, "Honeywell", 0}};
|
||||
|
||||
@@ -47,7 +47,7 @@ static int ptest(struct pstate* p) {
|
||||
return tok;
|
||||
}
|
||||
|
||||
static int s_unary_ops[] = {
|
||||
static const int s_unary_ops[] = {
|
||||
TOK_NOT,
|
||||
TOK_TILDA,
|
||||
TOK_PLUS_PLUS,
|
||||
@@ -56,10 +56,10 @@ static int s_unary_ops[] = {
|
||||
TOK_MINUS,
|
||||
TOK_PLUS,
|
||||
TOK_EOF};
|
||||
static int s_comparison_ops[] = {TOK_LT, TOK_LE, TOK_GT, TOK_GE, TOK_EOF};
|
||||
static int s_postfix_ops[] = {TOK_PLUS_PLUS, TOK_MINUS_MINUS, TOK_EOF};
|
||||
static int s_equality_ops[] = {TOK_EQ, TOK_NE, TOK_EQ_EQ, TOK_NE_NE, TOK_EOF};
|
||||
static int s_assign_ops[] = {
|
||||
static const int s_comparison_ops[] = {TOK_LT, TOK_LE, TOK_GT, TOK_GE, TOK_EOF};
|
||||
static const int s_postfix_ops[] = {TOK_PLUS_PLUS, TOK_MINUS_MINUS, TOK_EOF};
|
||||
static const int s_equality_ops[] = {TOK_EQ, TOK_NE, TOK_EQ_EQ, TOK_NE_NE, TOK_EOF};
|
||||
static const int s_assign_ops[] = {
|
||||
TOK_ASSIGN,
|
||||
TOK_PLUS_ASSIGN,
|
||||
TOK_MINUS_ASSIGN,
|
||||
@@ -74,7 +74,7 @@ static int s_assign_ops[] = {
|
||||
TOK_OR_ASSIGN,
|
||||
TOK_EOF};
|
||||
|
||||
static int findtok(int* toks, int tok) {
|
||||
static int findtok(int const* toks, int tok) {
|
||||
int i = 0;
|
||||
while(tok != toks[i] && toks[i] != TOK_EOF)
|
||||
i++;
|
||||
|
||||
@@ -35,7 +35,6 @@ MomentumSettings momentum_settings = {
|
||||
.dark_mode = false, // OFF
|
||||
.rgb_backlight = false, // OFF
|
||||
.butthurt_timer = 21600, // 6 H
|
||||
.charge_cap = 100, // 100%
|
||||
.spi_cc1101_handle = SpiDefault, // &furi_hal_spi_bus_handle_external
|
||||
.spi_nrf24_handle = SpiDefault, // &furi_hal_spi_bus_handle_external
|
||||
.uart_esp_channel = FuriHalSerialIdUsart, // pin 13,14
|
||||
@@ -106,7 +105,6 @@ static const struct {
|
||||
{setting_bool(dark_mode)},
|
||||
{setting_bool(rgb_backlight)},
|
||||
{setting_uint(butthurt_timer, 0, 172800)},
|
||||
{setting_uint(charge_cap, 5, 100)},
|
||||
{setting_enum(spi_cc1101_handle, SpiCount)},
|
||||
{setting_enum(spi_nrf24_handle, SpiCount)},
|
||||
{setting_enum(uart_esp_channel, FuriHalSerialIdMax)},
|
||||
|
||||
@@ -92,7 +92,6 @@ typedef struct {
|
||||
bool dark_mode;
|
||||
bool rgb_backlight;
|
||||
uint32_t butthurt_timer;
|
||||
uint32_t charge_cap;
|
||||
SpiHandle spi_cc1101_handle;
|
||||
SpiHandle spi_nrf24_handle;
|
||||
FuriHalSerialId uart_esp_channel;
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef struct {
|
||||
uint8_t cmd_start_byte;
|
||||
size_t cmd_len_bits;
|
||||
size_t command_num;
|
||||
MfClassicListenerCommandHandler* handler;
|
||||
const MfClassicListenerCommandHandler* handler;
|
||||
} MfClassicListenerCmd;
|
||||
|
||||
static void mf_classic_listener_prepare_emulation(MfClassicListener* instance) {
|
||||
@@ -441,42 +441,42 @@ static MfClassicListenerCommand
|
||||
return command;
|
||||
}
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_halt_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_halt_handlers[] = {
|
||||
mf_classic_listener_halt_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_auth_key_a_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_auth_key_a_handlers[] = {
|
||||
mf_classic_listener_auth_key_a_handler,
|
||||
mf_classic_listener_auth_second_part_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_auth_key_b_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_auth_key_b_handlers[] = {
|
||||
mf_classic_listener_auth_key_b_handler,
|
||||
mf_classic_listener_auth_second_part_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_read_block_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_read_block_handlers[] = {
|
||||
mf_classic_listener_read_block_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_write_block_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_write_block_handlers[] = {
|
||||
mf_classic_listener_write_block_first_part_handler,
|
||||
mf_classic_listener_write_block_second_part_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_value_dec_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_value_dec_handlers[] = {
|
||||
mf_classic_listener_value_dec_handler,
|
||||
mf_classic_listener_value_data_receive_handler,
|
||||
mf_classic_listener_value_transfer_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_value_inc_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_value_inc_handlers[] = {
|
||||
mf_classic_listener_value_inc_handler,
|
||||
mf_classic_listener_value_data_receive_handler,
|
||||
mf_classic_listener_value_transfer_handler,
|
||||
};
|
||||
|
||||
static MfClassicListenerCommandHandler mf_classic_listener_value_restore_handlers[] = {
|
||||
static const MfClassicListenerCommandHandler mf_classic_listener_value_restore_handlers[] = {
|
||||
mf_classic_listener_value_restore_handler,
|
||||
mf_classic_listener_value_data_receive_handler,
|
||||
mf_classic_listener_value_transfer_handler,
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* When implementing a new protocol, add its implementation
|
||||
* here under its own index defined in nfc_protocol.h.
|
||||
*/
|
||||
const NfcDeviceBase* nfc_devices[NfcProtocolNum] = {
|
||||
const NfcDeviceBase* const nfc_devices[NfcProtocolNum] = {
|
||||
[NfcProtocolIso14443_3a] = &nfc_device_iso14443_3a,
|
||||
[NfcProtocolIso14443_3b] = &nfc_device_iso14443_3b,
|
||||
[NfcProtocolIso14443_4a] = &nfc_device_iso14443_4a,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const NfcDeviceBase* nfc_devices[];
|
||||
extern const NfcDeviceBase* const nfc_devices[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <nfc/protocols/slix/slix_listener_defs.h>
|
||||
#include <nfc/protocols/felica/felica_listener_defs.h>
|
||||
|
||||
const NfcListenerBase* nfc_listeners_api[NfcProtocolNum] = {
|
||||
const NfcListenerBase* const nfc_listeners_api[NfcProtocolNum] = {
|
||||
[NfcProtocolIso14443_3a] = &nfc_listener_iso14443_3a,
|
||||
[NfcProtocolIso14443_3b] = NULL,
|
||||
[NfcProtocolIso14443_4a] = &nfc_listener_iso14443_4a,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const NfcListenerBase* nfc_listeners_api[NfcProtocolNum];
|
||||
extern const NfcListenerBase* const nfc_listeners_api[NfcProtocolNum];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <nfc/protocols/slix/slix_poller_defs.h>
|
||||
#include <nfc/protocols/st25tb/st25tb_poller_defs.h>
|
||||
|
||||
const NfcPollerBase* nfc_pollers_api[NfcProtocolNum] = {
|
||||
const NfcPollerBase* const nfc_pollers_api[NfcProtocolNum] = {
|
||||
[NfcProtocolIso14443_3a] = &nfc_poller_iso14443_3a,
|
||||
[NfcProtocolIso14443_3b] = &nfc_poller_iso14443_3b,
|
||||
[NfcProtocolIso14443_4a] = &nfc_poller_iso14443_4a,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const NfcPollerBase* nfc_pollers_api[NfcProtocolNum];
|
||||
extern const NfcPollerBase* const nfc_pollers_api[NfcProtocolNum];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -220,8 +220,10 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_came_atomo_const.te_long * 60);
|
||||
|
||||
// Btn counter 0x0 - 0x7F
|
||||
pack[0] = 0;
|
||||
for(uint8_t i = 0; i < 8; i++) {
|
||||
pack[0] = (instance->generic.data_2 >> 56);
|
||||
//pack[0] = (instance->generic.data_2 >> 56);
|
||||
pack[1] = (instance->generic.cnt >> 8);
|
||||
pack[2] = (instance->generic.cnt & 0xFF);
|
||||
pack[3] = ((instance->generic.data_2 >> 32) & 0xFF);
|
||||
@@ -230,11 +232,42 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
|
||||
pack[6] = ((instance->generic.data_2 >> 8) & 0xFF);
|
||||
pack[7] = (btn << 4);
|
||||
|
||||
if(pack[0] == 0x7F) {
|
||||
/* if(pack[0] == 0x7F) {
|
||||
pack[0] = 0;
|
||||
} else {
|
||||
pack[0] += (i + 1);
|
||||
}
|
||||
*/
|
||||
switch(i) {
|
||||
case 0:
|
||||
pack[0] = 10; // 0A
|
||||
break;
|
||||
case 1:
|
||||
pack[0] = 30;
|
||||
break;
|
||||
case 2:
|
||||
pack[0] = 125; // 7D
|
||||
break;
|
||||
case 3:
|
||||
pack[0] = 126; // 7E
|
||||
break;
|
||||
case 4:
|
||||
pack[0] = 127; // 7F
|
||||
break;
|
||||
case 5:
|
||||
pack[0] = 0; // 00
|
||||
break;
|
||||
case 6:
|
||||
pack[0] = 1; // 01
|
||||
break;
|
||||
case 7:
|
||||
pack[0] = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 10 50 125 126 127 0 1 2
|
||||
|
||||
atomo_encrypt(pack);
|
||||
uint32_t hi = pack[0] << 24 | pack[1] << 16 | pack[2] << 8 | pack[3];
|
||||
@@ -523,7 +556,8 @@ static void subghz_protocol_came_atomo_remote_controller(SubGhzBlockGeneric* ins
|
||||
* 0x931dfb16c0b1 ^ 0xXXXXXXXXXXXXXXXX = 0xEF3ED0F7D9EF
|
||||
* 0xEF3 ED0F7D9E F => 0xEF3 - CNT, 0xED0F7D9E - SN, 0xF - key
|
||||
*
|
||||
* ***Eng1n33r ver. (actual)***
|
||||
* ***Actual***
|
||||
* Button hold-cycle counter (8-bit, from 0 to 0x7F) should DO full cycle or half cycle keeping values like zero
|
||||
* 0x1FF08D9924984115 - received data
|
||||
* 0x00F7266DB67BEEA0 - inverted data
|
||||
* 0x0501FD0000A08300 - decrypted data,
|
||||
@@ -722,7 +756,7 @@ void subghz_protocol_decoder_came_atomo_get_string(void* context, FuriString* ou
|
||||
"%s %db\r\n"
|
||||
"Key:%08lX%08lX\r\n"
|
||||
"Sn:0x%08lX Btn:%01X\r\n"
|
||||
"Pcl_Cnt:0x%04lX\r\n"
|
||||
"Cnt:0x%04lX\r\n"
|
||||
"Btn_Cnt:0x%02X",
|
||||
|
||||
instance->generic.protocol_name,
|
||||
|
||||
@@ -170,13 +170,14 @@ static void subghz_protocol_encoder_gangqi_get_upload(SubGhzProtocolEncoderGangQ
|
||||
// Generate new key using custom or default button
|
||||
instance->generic.btn = subghz_protocol_gangqi_get_btn_code();
|
||||
|
||||
uint64_t new_key = (instance->generic.data >> 14) << 14 | (instance->generic.btn << 10) |
|
||||
(0b01 << 8);
|
||||
uint16_t serial = (uint16_t)((instance->generic.data >> 18) & 0xFFFF);
|
||||
uint8_t const_and_button = (uint8_t)(0xD0 | instance->generic.btn);
|
||||
uint8_t serial_high = (uint8_t)(serial >> 8);
|
||||
uint8_t serial_low = (uint8_t)(serial & 0xFF);
|
||||
uint8_t bytesum = (uint8_t)(0xC8 - serial_high - serial_low - const_and_button);
|
||||
|
||||
uint8_t crc = -0xD7 - ((new_key >> 32) & 0xFF) - ((new_key >> 24) & 0xFF) -
|
||||
((new_key >> 16) & 0xFF) - ((new_key >> 8) & 0xFF);
|
||||
|
||||
instance->generic.data = (new_key | crc);
|
||||
instance->generic.data = (instance->generic.data >> 14) << 14 | (instance->generic.btn << 10) |
|
||||
(bytesum << 2);
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
@@ -232,41 +233,12 @@ static void subghz_protocol_gangqi_remote_controller(SubGhzBlockGeneric* instanc
|
||||
subghz_custom_btn_set_max(3);
|
||||
|
||||
// GangQi Decoder
|
||||
// 09.2024 - @xMasterX (MMX)
|
||||
// 09.2024 - @xMasterX (MMX) (last update - bytesum calculation at 02.2025)
|
||||
// Thanks @Skorpionm for support!
|
||||
// Thanks @Drone1950 and @mishamyte (who spent 2 weeks on this) for making this work properly
|
||||
|
||||
//// 4D=F8=171=229 byte sum should be always the same
|
||||
// Button
|
||||
// Serial || BBBB || CRC (byte sum) with overflow and starting point 0xD7
|
||||
//034AAB75BC = 00110100101010101011 01 1101 01 101111 00 // A (0xD)
|
||||
//034AAB79B8 = 00110100101010101011 01 1110 01 101110 00 // B (0xE)
|
||||
//034AAB6DC4 = 00110100101010101011 01 1011 01 110001 00 // C (0xB)
|
||||
//034AAB5DD4 = 00110100101010101011 01 0111 01 110101 00 // D (0x7)
|
||||
//034AAB55DC = 00110100101010101011 01 0101 01 110111 00 // Settings (0x5)
|
||||
//034AAB51E0 = 00110100101010101011 01 0100 01 111000 00 // A (0x4)
|
||||
//034AAB49E8 = 00110100101010101011 01 0010 01 111010 00 // C (0x2)
|
||||
//034AAB59D8 = 00110100101010101011 01 0110 01 110110 00 // D (0x6)
|
||||
//034AAB45EC = 00110100101010101011 01 0001 01 111011 00 // Settings exit (0x1)
|
||||
//
|
||||
// Serial 3 bytes should meet requirements see validation example at subghz_protocol_decoder_gangqi_get_string
|
||||
//
|
||||
// Code for finding start byte for crc sum
|
||||
//
|
||||
//uint64_t test = 0x034AAB79B8; //B8
|
||||
//for(size_t byte = 0; byte < 0xFF; ++byte) {
|
||||
// uint8_t crc_res = -byte - ((test >> 32) & 0xFF) - ((test >> 24) & 0xFF) -
|
||||
// ((test >> 16) & 0xFF) - ((test >> 8) & 0xFF);
|
||||
// if(crc_res == 0xB8) {
|
||||
// uint64_t test2 = 0x034AAB6DC4; //C4
|
||||
// uint8_t crc_res2 = -byte - ((test2 >> 32) & 0xFF) - ((test2 >> 24) & 0xFF) -
|
||||
// ((test2 >> 16) & 0xFF) - ((test2 >> 8) & 0xFF);
|
||||
// if(crc_res2 == 0xC4) {
|
||||
// printf("Start byte for CRC = %02lX / CRC = %02X \n", byte, crc_res);
|
||||
//
|
||||
// printf("Testing second parcel CRC = %02X", crc_res2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Example of correct bytesum calculation
|
||||
// 0xC8 - serial_high - serial_low - constant_and_button
|
||||
}
|
||||
|
||||
SubGhzProtocolStatus
|
||||
@@ -485,23 +457,29 @@ void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output
|
||||
// Parse serial
|
||||
subghz_protocol_gangqi_remote_controller(&instance->generic);
|
||||
|
||||
// Get CRC
|
||||
uint8_t crc = -0xD7 - ((instance->generic.data >> 32) & 0xFF) -
|
||||
((instance->generic.data >> 24) & 0xFF) -
|
||||
((instance->generic.data >> 16) & 0xFF) - ((instance->generic.data >> 8) & 0xFF);
|
||||
// Get byte sum
|
||||
uint16_t serial = (uint16_t)((instance->generic.data >> 18) & 0xFFFF);
|
||||
uint8_t const_and_button = (uint8_t)(0xD0 | instance->generic.btn);
|
||||
uint8_t serial_high = (uint8_t)(serial >> 8);
|
||||
uint8_t serial_low = (uint8_t)(serial & 0xFF);
|
||||
// Type 1 is what original remotes use, type 2 is "backdoor" sum that receiver accepts too
|
||||
uint8_t sum_type1 = (uint8_t)(0xC8 - serial_high - serial_low - const_and_button);
|
||||
uint8_t sum_type2 = (uint8_t)(0x02 + serial_high + serial_low + const_and_button);
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
"Key: 0x%X%08lX\r\n"
|
||||
"Serial: 0x%05lX CRC: 0x%02X\r\n"
|
||||
"Serial: 0x%05lX\r\n"
|
||||
"Sum: 0x%02X Sum2: 0x%02X\r\n"
|
||||
"Btn: 0x%01X - %s\r\n",
|
||||
instance->generic.protocol_name,
|
||||
instance->generic.data_count_bit,
|
||||
(uint8_t)(instance->generic.data >> 32),
|
||||
(uint32_t)(instance->generic.data & 0xFFFFFFFF),
|
||||
instance->generic.serial,
|
||||
crc,
|
||||
sum_type1,
|
||||
sum_type2,
|
||||
instance->generic.btn,
|
||||
subghz_protocol_gangqi_get_button_name(instance->generic.btn));
|
||||
}
|
||||
|
||||
@@ -171,10 +171,10 @@ static void subghz_protocol_encoder_hollarm_get_upload(SubGhzProtocolEncoderHoll
|
||||
|
||||
uint64_t new_key = (instance->generic.data >> 12) << 12 | (instance->generic.btn << 8);
|
||||
|
||||
uint8_t crc = ((new_key >> 32) & 0xFF) + ((new_key >> 24) & 0xFF) + ((new_key >> 16) & 0xFF) +
|
||||
((new_key >> 8) & 0xFF);
|
||||
uint8_t bytesum = ((new_key >> 32) & 0xFF) + ((new_key >> 24) & 0xFF) +
|
||||
((new_key >> 16) & 0xFF) + ((new_key >> 8) & 0xFF);
|
||||
|
||||
instance->generic.data = (new_key | crc);
|
||||
instance->generic.data = (new_key | bytesum);
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
@@ -235,7 +235,7 @@ static void subghz_protocol_hollarm_remote_controller(SubGhzBlockGeneric* instan
|
||||
// F0B9342401 = 01 8bit Sum
|
||||
// F0B9342805 = 05 8bit Sum
|
||||
|
||||
// Serial (moved 2bit to right) | Btn | 8b CRC (previous 4 bytes sum)
|
||||
// Serial (moved 2bit to right) | Btn | 8b previous 4 bytes sum
|
||||
// 00001111000010111001001101000010 0010 11111111 btn = (0x2)
|
||||
// 00001111000010111001001101000010 0001 11111110 btn = (0x1)
|
||||
// 00001111000010111001001101000010 0100 00000001 btn = (0x4)
|
||||
@@ -378,6 +378,21 @@ void subghz_protocol_decoder_hollarm_feed(void* context, bool level, volatile ui
|
||||
// Saving with 2bit to the right offset for proper parsing
|
||||
instance->generic.data = (instance->decoder.decode_data >> 2);
|
||||
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
|
||||
|
||||
uint8_t bytesum = ((instance->generic.data >> 32) & 0xFF) +
|
||||
((instance->generic.data >> 24) & 0xFF) +
|
||||
((instance->generic.data >> 16) & 0xFF) +
|
||||
((instance->generic.data >> 8) & 0xFF);
|
||||
|
||||
if(bytesum != (instance->generic.data & 0xFF)) {
|
||||
// Check if the key is valid by verifying the sum
|
||||
instance->generic.data = 0;
|
||||
instance->generic.data_count_bit = 0;
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
instance->decoder.parser_step = HollarmDecoderStepReset;
|
||||
break;
|
||||
}
|
||||
if(instance->base.callback)
|
||||
instance->base.callback(&instance->base, instance->base.context);
|
||||
}
|
||||
@@ -449,23 +464,23 @@ void subghz_protocol_decoder_hollarm_get_string(void* context, FuriString* outpu
|
||||
|
||||
// Parse serial
|
||||
subghz_protocol_hollarm_remote_controller(&instance->generic);
|
||||
// Get CRC
|
||||
uint8_t crc = ((instance->generic.data >> 32) & 0xFF) +
|
||||
((instance->generic.data >> 24) & 0xFF) +
|
||||
((instance->generic.data >> 16) & 0xFF) + ((instance->generic.data >> 8) & 0xFF);
|
||||
// Get byte sum
|
||||
uint8_t bytesum =
|
||||
((instance->generic.data >> 32) & 0xFF) + ((instance->generic.data >> 24) & 0xFF) +
|
||||
((instance->generic.data >> 16) & 0xFF) + ((instance->generic.data >> 8) & 0xFF);
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
"Key: 0x%02lX%08lX\r\n"
|
||||
"Serial: 0x%06lX CRC: %02X\r\n"
|
||||
"Serial: 0x%06lX Sum: %02X\r\n"
|
||||
"Btn: 0x%01X - %s\r\n",
|
||||
instance->generic.protocol_name,
|
||||
instance->generic.data_count_bit,
|
||||
(uint32_t)(instance->generic.data >> 32),
|
||||
(uint32_t)instance->generic.data,
|
||||
instance->generic.serial,
|
||||
crc,
|
||||
bytesum,
|
||||
instance->generic.btn,
|
||||
subghz_protocol_hollarm_get_button_name(instance->generic.btn));
|
||||
}
|
||||
|
||||
@@ -216,6 +216,9 @@ void subghz_protocol_decoder_marantec24_feed(void* context, bool level, volatile
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderMarantec24* instance = context;
|
||||
|
||||
// Marantec24 Decoder
|
||||
// 2024 - @xMasterX (MMX)
|
||||
|
||||
// Key samples
|
||||
// 101011000000010111001000 = AC05C8
|
||||
// 101011000000010111000100 = AC05C4
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "protocol_items.h" // IWYU pragma: keep
|
||||
|
||||
const SubGhzProtocol* subghz_protocol_registry_items[] = {
|
||||
const SubGhzProtocol* const subghz_protocol_registry_items[] = {
|
||||
&subghz_protocol_gate_tx,
|
||||
&subghz_protocol_keeloq,
|
||||
&subghz_protocol_star_line,
|
||||
@@ -80,6 +80,7 @@ const SubGhzProtocol* subghz_protocol_registry_items[] = {
|
||||
&subghz_protocol_marantec24,
|
||||
&subghz_protocol_hollarm,
|
||||
&subghz_protocol_hay21,
|
||||
&subghz_protocol_revers_rb2,
|
||||
};
|
||||
|
||||
const SubGhzProtocolRegistry subghz_protocol_registry = {
|
||||
|
||||
@@ -81,3 +81,4 @@
|
||||
#include "marantec24.h"
|
||||
#include "hollarm.h"
|
||||
#include "hay21.h"
|
||||
#include "revers_rb2.h"
|
||||
|
||||
408
lib/subghz/protocols/revers_rb2.c
Normal file
408
lib/subghz/protocols/revers_rb2.c
Normal file
@@ -0,0 +1,408 @@
|
||||
#include "revers_rb2.h"
|
||||
#include <lib/toolbox/manchester_decoder.h>
|
||||
#include <lib/toolbox/manchester_encoder.h>
|
||||
#include "../blocks/const.h"
|
||||
#include "../blocks/decoder.h"
|
||||
#include "../blocks/encoder.h"
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#define TAG "SubGhzProtocolRevers_RB2"
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_revers_rb2_const = {
|
||||
.te_short = 250,
|
||||
.te_long = 500,
|
||||
.te_delta = 160,
|
||||
.min_count_bit_for_found = 64,
|
||||
};
|
||||
|
||||
struct SubGhzProtocolDecoderRevers_RB2 {
|
||||
SubGhzProtocolDecoderBase base;
|
||||
|
||||
SubGhzBlockDecoder decoder;
|
||||
SubGhzBlockGeneric generic;
|
||||
ManchesterState manchester_saved_state;
|
||||
uint16_t header_count;
|
||||
};
|
||||
|
||||
struct SubGhzProtocolEncoderRevers_RB2 {
|
||||
SubGhzProtocolEncoderBase base;
|
||||
|
||||
SubGhzProtocolBlockEncoder encoder;
|
||||
SubGhzBlockGeneric generic;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
Revers_RB2DecoderStepReset = 0,
|
||||
Revers_RB2DecoderStepHeader,
|
||||
Revers_RB2DecoderStepDecoderData,
|
||||
} Revers_RB2DecoderStep;
|
||||
|
||||
const SubGhzProtocolDecoder subghz_protocol_revers_rb2_decoder = {
|
||||
.alloc = subghz_protocol_decoder_revers_rb2_alloc,
|
||||
.free = subghz_protocol_decoder_revers_rb2_free,
|
||||
|
||||
.feed = subghz_protocol_decoder_revers_rb2_feed,
|
||||
.reset = subghz_protocol_decoder_revers_rb2_reset,
|
||||
|
||||
.get_hash_data = subghz_protocol_decoder_revers_rb2_get_hash_data,
|
||||
.serialize = subghz_protocol_decoder_revers_rb2_serialize,
|
||||
.deserialize = subghz_protocol_decoder_revers_rb2_deserialize,
|
||||
.get_string = subghz_protocol_decoder_revers_rb2_get_string,
|
||||
};
|
||||
|
||||
const SubGhzProtocolEncoder subghz_protocol_revers_rb2_encoder = {
|
||||
.alloc = subghz_protocol_encoder_revers_rb2_alloc,
|
||||
.free = subghz_protocol_encoder_revers_rb2_free,
|
||||
|
||||
.deserialize = subghz_protocol_encoder_revers_rb2_deserialize,
|
||||
.stop = subghz_protocol_encoder_revers_rb2_stop,
|
||||
.yield = subghz_protocol_encoder_revers_rb2_yield,
|
||||
};
|
||||
|
||||
const SubGhzProtocol subghz_protocol_revers_rb2 = {
|
||||
.name = SUBGHZ_PROTOCOL_REVERSRB2_NAME,
|
||||
.type = SubGhzProtocolTypeStatic,
|
||||
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
|
||||
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
|
||||
|
||||
.decoder = &subghz_protocol_revers_rb2_decoder,
|
||||
.encoder = &subghz_protocol_revers_rb2_encoder,
|
||||
};
|
||||
|
||||
void* subghz_protocol_encoder_revers_rb2_alloc(SubGhzEnvironment* environment) {
|
||||
UNUSED(environment);
|
||||
SubGhzProtocolEncoderRevers_RB2* instance = malloc(sizeof(SubGhzProtocolEncoderRevers_RB2));
|
||||
|
||||
instance->base.protocol = &subghz_protocol_revers_rb2;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
|
||||
instance->encoder.repeat = 10;
|
||||
instance->encoder.size_upload = 256;
|
||||
instance->encoder.upload = malloc(instance->encoder.size_upload * sizeof(LevelDuration));
|
||||
instance->encoder.is_running = false;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void subghz_protocol_encoder_revers_rb2_free(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolEncoderRevers_RB2* instance = context;
|
||||
free(instance->encoder.upload);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
static LevelDuration
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(ManchesterEncoderResult result) {
|
||||
LevelDuration data = {.duration = 0, .level = 0};
|
||||
switch(result) {
|
||||
case ManchesterEncoderResultShortLow:
|
||||
data.duration = subghz_protocol_revers_rb2_const.te_short;
|
||||
data.level = false;
|
||||
break;
|
||||
case ManchesterEncoderResultLongLow:
|
||||
data.duration = subghz_protocol_revers_rb2_const.te_long;
|
||||
data.level = false;
|
||||
break;
|
||||
case ManchesterEncoderResultLongHigh:
|
||||
data.duration = subghz_protocol_revers_rb2_const.te_long;
|
||||
data.level = true;
|
||||
break;
|
||||
case ManchesterEncoderResultShortHigh:
|
||||
data.duration = subghz_protocol_revers_rb2_const.te_short;
|
||||
data.level = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
furi_crash("SubGhz: ManchesterEncoderResult is incorrect.");
|
||||
break;
|
||||
}
|
||||
return level_duration_make(data.level, data.duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generating an upload from data.
|
||||
* @param instance Pointer to a SubGhzProtocolEncoderRevers_RB2 instance
|
||||
*/
|
||||
static void
|
||||
subghz_protocol_encoder_revers_rb2_get_upload(SubGhzProtocolEncoderRevers_RB2* instance) {
|
||||
furi_assert(instance);
|
||||
size_t index = 0;
|
||||
|
||||
ManchesterEncoderState enc_state;
|
||||
manchester_encoder_reset(&enc_state);
|
||||
ManchesterEncoderResult result;
|
||||
|
||||
for(uint8_t i = instance->generic.data_count_bit; i > 0; i--) {
|
||||
if(!manchester_encoder_advance(
|
||||
&enc_state, bit_read(instance->generic.data, i - 1), &result)) {
|
||||
instance->encoder.upload[index++] =
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(result);
|
||||
manchester_encoder_advance(
|
||||
&enc_state, bit_read(instance->generic.data, i - 1), &result);
|
||||
}
|
||||
instance->encoder.upload[index++] =
|
||||
subghz_protocol_encoder_revers_rb2_add_duration_to_upload(result);
|
||||
}
|
||||
instance->encoder.upload[index] = subghz_protocol_encoder_revers_rb2_add_duration_to_upload(
|
||||
manchester_encoder_finish(&enc_state));
|
||||
if(level_duration_get_level(instance->encoder.upload[index])) {
|
||||
index++;
|
||||
}
|
||||
instance->encoder.upload[index++] = level_duration_make(false, (uint32_t)320);
|
||||
instance->encoder.size_upload = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analysis of received data
|
||||
* @param instance Pointer to a SubGhzBlockGeneric* instance
|
||||
*/
|
||||
static void subghz_protocol_revers_rb2_remote_controller(SubGhzBlockGeneric* instance) {
|
||||
// Revers RB2 / RB2M Decoder
|
||||
// 02.2025 - @xMasterX (MMX)
|
||||
instance->serial = (((instance->data << 16) >> 16) >> 10);
|
||||
}
|
||||
|
||||
SubGhzProtocolStatus
|
||||
subghz_protocol_encoder_revers_rb2_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolEncoderRevers_RB2* instance = context;
|
||||
SubGhzProtocolStatus ret = SubGhzProtocolStatusError;
|
||||
do {
|
||||
ret = subghz_block_generic_deserialize_check_count_bit(
|
||||
&instance->generic,
|
||||
flipper_format,
|
||||
subghz_protocol_revers_rb2_const.min_count_bit_for_found);
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
//optional parameter parameter
|
||||
flipper_format_read_uint32(
|
||||
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
|
||||
|
||||
subghz_protocol_revers_rb2_remote_controller(&instance->generic);
|
||||
subghz_protocol_encoder_revers_rb2_get_upload(instance);
|
||||
instance->encoder.is_running = true;
|
||||
} while(false);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void subghz_protocol_encoder_revers_rb2_stop(void* context) {
|
||||
SubGhzProtocolEncoderRevers_RB2* instance = context;
|
||||
instance->encoder.is_running = false;
|
||||
}
|
||||
|
||||
LevelDuration subghz_protocol_encoder_revers_rb2_yield(void* context) {
|
||||
SubGhzProtocolEncoderRevers_RB2* instance = context;
|
||||
|
||||
if(instance->encoder.repeat == 0 || !instance->encoder.is_running) {
|
||||
instance->encoder.is_running = false;
|
||||
return level_duration_reset();
|
||||
}
|
||||
|
||||
LevelDuration ret = instance->encoder.upload[instance->encoder.front];
|
||||
|
||||
if(++instance->encoder.front == instance->encoder.size_upload) {
|
||||
instance->encoder.repeat--;
|
||||
instance->encoder.front = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void* subghz_protocol_decoder_revers_rb2_alloc(SubGhzEnvironment* environment) {
|
||||
UNUSED(environment);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = malloc(sizeof(SubGhzProtocolDecoderRevers_RB2));
|
||||
instance->base.protocol = &subghz_protocol_revers_rb2;
|
||||
instance->generic.protocol_name = instance->base.protocol->name;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_revers_rb2_free(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
free(instance);
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_revers_rb2_reset(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
manchester_advance(
|
||||
instance->manchester_saved_state,
|
||||
ManchesterEventReset,
|
||||
&instance->manchester_saved_state,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_revers_rb2_addbit(void* context, bool data) {
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
instance->decoder.decode_data = (instance->decoder.decode_data << 1) | data;
|
||||
instance->decoder.decode_count_bit++;
|
||||
|
||||
if(instance->decoder.decode_count_bit >= 65) {
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(instance->decoder.decode_count_bit <
|
||||
subghz_protocol_revers_rb2_const.min_count_bit_for_found) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Revers RB2 / RB2M Decoder
|
||||
// 02.2025 - @xMasterX (MMX)
|
||||
|
||||
uint16_t preamble = (instance->decoder.decode_data >> 48) & 0xFF;
|
||||
uint16_t stop_code = (instance->decoder.decode_data & 0x3FF);
|
||||
|
||||
if(preamble == 0xFF && stop_code == 0x200) {
|
||||
//Found header and stop code
|
||||
instance->generic.data = instance->decoder.decode_data;
|
||||
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
|
||||
|
||||
if(instance->base.callback)
|
||||
instance->base.callback(&instance->base, instance->base.context);
|
||||
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
manchester_advance(
|
||||
instance->manchester_saved_state,
|
||||
ManchesterEventReset,
|
||||
&instance->manchester_saved_state,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_revers_rb2_feed(void* context, bool level, volatile uint32_t duration) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
ManchesterEvent event = ManchesterEventReset;
|
||||
|
||||
switch(instance->decoder.parser_step) {
|
||||
case Revers_RB2DecoderStepReset:
|
||||
if((!level) &&
|
||||
(DURATION_DIFF(duration, 600) < subghz_protocol_revers_rb2_const.te_delta)) {
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepHeader;
|
||||
instance->decoder.decode_data = 0;
|
||||
instance->decoder.decode_count_bit = 0;
|
||||
manchester_advance(
|
||||
instance->manchester_saved_state,
|
||||
ManchesterEventReset,
|
||||
&instance->manchester_saved_state,
|
||||
NULL);
|
||||
}
|
||||
break;
|
||||
case Revers_RB2DecoderStepHeader:
|
||||
if(!level) {
|
||||
if(DURATION_DIFF(duration, subghz_protocol_revers_rb2_const.te_short) <
|
||||
subghz_protocol_revers_rb2_const.te_delta) {
|
||||
if(instance->decoder.te_last == 1) {
|
||||
instance->header_count++;
|
||||
}
|
||||
instance->decoder.te_last = level;
|
||||
} else {
|
||||
instance->header_count = 0;
|
||||
instance->decoder.te_last = 0;
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepReset;
|
||||
}
|
||||
} else {
|
||||
if(DURATION_DIFF(duration, subghz_protocol_revers_rb2_const.te_short) <
|
||||
subghz_protocol_revers_rb2_const.te_delta) {
|
||||
if(instance->decoder.te_last == 0) {
|
||||
instance->header_count++;
|
||||
}
|
||||
instance->decoder.te_last = level;
|
||||
} else {
|
||||
instance->header_count = 0;
|
||||
instance->decoder.te_last = 0;
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepReset;
|
||||
}
|
||||
}
|
||||
|
||||
if(instance->header_count == 4) {
|
||||
instance->header_count = 0;
|
||||
instance->decoder.decode_data = 0xF;
|
||||
instance->decoder.decode_count_bit = 4;
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepDecoderData;
|
||||
}
|
||||
break;
|
||||
case Revers_RB2DecoderStepDecoderData:
|
||||
if(!level) {
|
||||
if(DURATION_DIFF(duration, subghz_protocol_revers_rb2_const.te_short) <
|
||||
subghz_protocol_revers_rb2_const.te_delta) {
|
||||
event = ManchesterEventShortLow;
|
||||
} else if(
|
||||
DURATION_DIFF(duration, subghz_protocol_revers_rb2_const.te_long) <
|
||||
subghz_protocol_revers_rb2_const.te_delta) {
|
||||
event = ManchesterEventLongLow;
|
||||
} else {
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepReset;
|
||||
}
|
||||
} else {
|
||||
if(DURATION_DIFF(duration, subghz_protocol_revers_rb2_const.te_short) <
|
||||
subghz_protocol_revers_rb2_const.te_delta) {
|
||||
event = ManchesterEventShortHigh;
|
||||
} else if(
|
||||
DURATION_DIFF(duration, subghz_protocol_revers_rb2_const.te_long) <
|
||||
subghz_protocol_revers_rb2_const.te_delta) {
|
||||
event = ManchesterEventLongHigh;
|
||||
} else {
|
||||
instance->decoder.parser_step = Revers_RB2DecoderStepReset;
|
||||
}
|
||||
}
|
||||
if(event != ManchesterEventReset) {
|
||||
bool data;
|
||||
bool data_ok = manchester_advance(
|
||||
instance->manchester_saved_state, event, &instance->manchester_saved_state, &data);
|
||||
|
||||
if(data_ok) {
|
||||
subghz_protocol_decoder_revers_rb2_addbit(instance, data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t subghz_protocol_decoder_revers_rb2_get_hash_data(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
return subghz_protocol_blocks_get_hash_data(
|
||||
&instance->decoder, (instance->decoder.decode_count_bit / 8) + 1);
|
||||
}
|
||||
|
||||
SubGhzProtocolStatus subghz_protocol_decoder_revers_rb2_serialize(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
SubGhzRadioPreset* preset) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
return subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||
}
|
||||
|
||||
SubGhzProtocolStatus
|
||||
subghz_protocol_decoder_revers_rb2_deserialize(void* context, FlipperFormat* flipper_format) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
return subghz_block_generic_deserialize_check_count_bit(
|
||||
&instance->generic,
|
||||
flipper_format,
|
||||
subghz_protocol_revers_rb2_const.min_count_bit_for_found);
|
||||
}
|
||||
|
||||
void subghz_protocol_decoder_revers_rb2_get_string(void* context, FuriString* output) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolDecoderRevers_RB2* instance = context;
|
||||
subghz_protocol_revers_rb2_remote_controller(&instance->generic);
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"%s %db\r\n"
|
||||
"Key:%lX%08lX\r\n"
|
||||
"Sn:0x%08lX \r\n",
|
||||
instance->generic.protocol_name,
|
||||
instance->generic.data_count_bit,
|
||||
(uint32_t)(instance->generic.data >> 32),
|
||||
(uint32_t)(instance->generic.data & 0xFFFFFFFF),
|
||||
instance->generic.serial);
|
||||
}
|
||||
109
lib/subghz/protocols/revers_rb2.h
Normal file
109
lib/subghz/protocols/revers_rb2.h
Normal file
@@ -0,0 +1,109 @@
|
||||
#pragma once
|
||||
|
||||
#include "base.h"
|
||||
|
||||
#define SUBGHZ_PROTOCOL_REVERSRB2_NAME "Revers_RB2"
|
||||
|
||||
typedef struct SubGhzProtocolDecoderRevers_RB2 SubGhzProtocolDecoderRevers_RB2;
|
||||
typedef struct SubGhzProtocolEncoderRevers_RB2 SubGhzProtocolEncoderRevers_RB2;
|
||||
|
||||
extern const SubGhzProtocolDecoder subghz_protocol_revers_rb2_decoder;
|
||||
extern const SubGhzProtocolEncoder subghz_protocol_revers_rb2_encoder;
|
||||
extern const SubGhzProtocol subghz_protocol_revers_rb2;
|
||||
|
||||
/**
|
||||
* Allocate SubGhzProtocolEncoderRevers_RB2.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
* @return SubGhzProtocolEncoderRevers_RB2* pointer to a SubGhzProtocolEncoderRevers_RB2 instance
|
||||
*/
|
||||
void* subghz_protocol_encoder_revers_rb2_alloc(SubGhzEnvironment* environment);
|
||||
|
||||
/**
|
||||
* Free SubGhzProtocolEncoderRevers_RB2.
|
||||
* @param context Pointer to a SubGhzProtocolEncoderRevers_RB2 instance
|
||||
*/
|
||||
void subghz_protocol_encoder_revers_rb2_free(void* context);
|
||||
|
||||
/**
|
||||
* Deserialize and generating an upload to send.
|
||||
* @param context Pointer to a SubGhzProtocolEncoderRevers_RB2 instance
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
* @return status
|
||||
*/
|
||||
SubGhzProtocolStatus
|
||||
subghz_protocol_encoder_revers_rb2_deserialize(void* context, FlipperFormat* flipper_format);
|
||||
|
||||
/**
|
||||
* Forced transmission stop.
|
||||
* @param context Pointer to a SubGhzProtocolEncoderRevers_RB2 instance
|
||||
*/
|
||||
void subghz_protocol_encoder_revers_rb2_stop(void* context);
|
||||
|
||||
/**
|
||||
* Getting the level and duration of the upload to be loaded into DMA.
|
||||
* @param context Pointer to a SubGhzProtocolEncoderRevers_RB2 instance
|
||||
* @return LevelDuration
|
||||
*/
|
||||
LevelDuration subghz_protocol_encoder_revers_rb2_yield(void* context);
|
||||
|
||||
/**
|
||||
* Allocate SubGhzProtocolDecoderRevers_RB2.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
* @return SubGhzProtocolDecoderRevers_RB2* pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
*/
|
||||
void* subghz_protocol_decoder_revers_rb2_alloc(SubGhzEnvironment* environment);
|
||||
|
||||
/**
|
||||
* Free SubGhzProtocolDecoderRevers_RB2.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
*/
|
||||
void subghz_protocol_decoder_revers_rb2_free(void* context);
|
||||
|
||||
/**
|
||||
* Reset decoder SubGhzProtocolDecoderRevers_RB2.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
*/
|
||||
void subghz_protocol_decoder_revers_rb2_reset(void* context);
|
||||
|
||||
/**
|
||||
* Parse a raw sequence of levels and durations received from the air.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
* @param level Signal level true-high false-low
|
||||
* @param duration Duration of this level in, us
|
||||
*/
|
||||
void subghz_protocol_decoder_revers_rb2_feed(void* context, bool level, uint32_t duration);
|
||||
|
||||
/**
|
||||
* Getting the hash sum of the last randomly received parcel.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
* @return hash Hash sum
|
||||
*/
|
||||
uint8_t subghz_protocol_decoder_revers_rb2_get_hash_data(void* context);
|
||||
|
||||
/**
|
||||
* Serialize data SubGhzProtocolDecoderRevers_RB2.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
* @param preset The modulation on which the signal was received, SubGhzRadioPreset
|
||||
* @return status
|
||||
*/
|
||||
SubGhzProtocolStatus subghz_protocol_decoder_revers_rb2_serialize(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
SubGhzRadioPreset* preset);
|
||||
|
||||
/**
|
||||
* Deserialize data SubGhzProtocolDecoderRevers_RB2.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
* @return status
|
||||
*/
|
||||
SubGhzProtocolStatus
|
||||
subghz_protocol_decoder_revers_rb2_deserialize(void* context, FlipperFormat* flipper_format);
|
||||
|
||||
/**
|
||||
* Getting a textual representation of the received data.
|
||||
* @param context Pointer to a SubGhzProtocolDecoderRevers_RB2 instance
|
||||
* @param output Resulting text
|
||||
*/
|
||||
void subghz_protocol_decoder_revers_rb2_get_string(void* context, FuriString* output);
|
||||
@@ -12,7 +12,7 @@ typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry;
|
||||
typedef struct SubGhzProtocol SubGhzProtocol;
|
||||
|
||||
struct SubGhzProtocolRegistry {
|
||||
const SubGhzProtocol** items;
|
||||
const SubGhzProtocol* const* items;
|
||||
const size_t size;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#include "protocol_dict.h"
|
||||
|
||||
struct ProtocolDict {
|
||||
const ProtocolBase** base;
|
||||
const ProtocolBase* const* base;
|
||||
size_t count;
|
||||
void* data[];
|
||||
};
|
||||
|
||||
ProtocolDict* protocol_dict_alloc(const ProtocolBase** protocols, size_t count) {
|
||||
ProtocolDict* protocol_dict_alloc(const ProtocolBase* const* protocols, size_t count) {
|
||||
furi_check(protocols);
|
||||
|
||||
ProtocolDict* dict = malloc(sizeof(ProtocolDict) + (sizeof(void*) * count));
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef int32_t ProtocolId;
|
||||
#define PROTOCOL_NO (-1)
|
||||
#define PROTOCOL_ALL_FEATURES (0xFFFFFFFF)
|
||||
|
||||
ProtocolDict* protocol_dict_alloc(const ProtocolBase** protocols, size_t protocol_count);
|
||||
ProtocolDict* protocol_dict_alloc(const ProtocolBase* const* protocols, size_t protocol_count);
|
||||
|
||||
void protocol_dict_free(ProtocolDict* dict);
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ def stringify_descr(type_descr):
|
||||
# Hack
|
||||
if isinstance(type_descr.ptr_to, FunctionType):
|
||||
return stringify_descr(type_descr.ptr_to)
|
||||
return f"{stringify_descr(type_descr.ptr_to)}*"
|
||||
return f"{stringify_descr(type_descr.ptr_to)}*{' const' if type_descr.const else ''}"
|
||||
elif isinstance(type_descr, Type):
|
||||
return (
|
||||
f"{'const ' if type_descr.const else ''}"
|
||||
|
||||
@@ -785,7 +785,7 @@ Function,+,cli_print_usage,void,"const char*, const char*, const char*"
|
||||
Function,+,cli_read,size_t,"Cli*, uint8_t*, size_t"
|
||||
Function,+,cli_read_timeout,size_t,"Cli*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,cli_session_close,void,Cli*
|
||||
Function,+,cli_session_open,void,"Cli*, void*"
|
||||
Function,+,cli_session_open,void,"Cli*, const void*"
|
||||
Function,+,cli_write,void,"Cli*, const uint8_t*, size_t"
|
||||
Function,+,composite_api_resolver_add,void,"CompositeApiResolver*, const ElfApiInterface*"
|
||||
Function,+,composite_api_resolver_alloc,CompositeApiResolver*,
|
||||
@@ -1287,23 +1287,23 @@ Function,+,furi_hal_hid_u2f_get_request,uint32_t,uint8_t*
|
||||
Function,+,furi_hal_hid_u2f_is_connected,_Bool,
|
||||
Function,+,furi_hal_hid_u2f_send_response,void,"uint8_t*, uint8_t"
|
||||
Function,+,furi_hal_hid_u2f_set_callback,void,"HidU2fCallback, void*"
|
||||
Function,+,furi_hal_i2c_acquire,void,FuriHalI2cBusHandle*
|
||||
Function,+,furi_hal_i2c_acquire,void,const FuriHalI2cBusHandle*
|
||||
Function,-,furi_hal_i2c_deinit_early,void,
|
||||
Function,-,furi_hal_i2c_init,void,
|
||||
Function,-,furi_hal_i2c_init_early,void,
|
||||
Function,+,furi_hal_i2c_is_device_ready,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_mem,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_16,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_8,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_release,void,FuriHalI2cBusHandle*
|
||||
Function,+,furi_hal_i2c_rx,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_rx_ext,_Bool,"FuriHalI2cBusHandle*, uint16_t, _Bool, uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_trx,_Bool,"FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx,_Bool,"FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx_ext,_Bool,"FuriHalI2cBusHandle*, uint16_t, _Bool, const uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_mem,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_16,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_8,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_is_device_ready,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_mem,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_16,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_8,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_release,void,const FuriHalI2cBusHandle*
|
||||
Function,+,furi_hal_i2c_rx,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_rx_ext,_Bool,"const FuriHalI2cBusHandle*, uint16_t, _Bool, uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_trx,_Bool,"const FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx,_Bool,"const FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx_ext,_Bool,"const FuriHalI2cBusHandle*, uint16_t, _Bool, const uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_mem,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_16,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_8,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_info_get,void,"PropertyValueCallback, char, void*"
|
||||
Function,+,furi_hal_info_get_api_version,void,"uint16_t*, uint16_t*"
|
||||
Function,-,furi_hal_init,void,
|
||||
@@ -1470,20 +1470,20 @@ Function,+,furi_hal_speaker_release,void,
|
||||
Function,+,furi_hal_speaker_set_volume,void,float
|
||||
Function,+,furi_hal_speaker_start,void,"float, float"
|
||||
Function,+,furi_hal_speaker_stop,void,
|
||||
Function,+,furi_hal_spi_acquire,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_acquire,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_deinit,void,FuriHalSpiBus*
|
||||
Function,+,furi_hal_spi_bus_handle_deinit,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_handle_init,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_handle_deinit,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_handle_init,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_init,void,FuriHalSpiBus*
|
||||
Function,+,furi_hal_spi_bus_rx,_Bool,"FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx,_Bool,"FuriHalSpiBusHandle*, const uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx_dma,_Bool,"FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_tx,_Bool,"FuriHalSpiBusHandle*, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_rx,_Bool,"const FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx,_Bool,"const FuriHalSpiBusHandle*, const uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx_dma,_Bool,"const FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_tx,_Bool,"const FuriHalSpiBusHandle*, const uint8_t*, size_t, uint32_t"
|
||||
Function,-,furi_hal_spi_config_deinit_early,void,
|
||||
Function,-,furi_hal_spi_config_init,void,
|
||||
Function,-,furi_hal_spi_config_init_early,void,
|
||||
Function,-,furi_hal_spi_dma_init,void,
|
||||
Function,+,furi_hal_spi_release,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_release,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_switch,void,void*
|
||||
Function,+,furi_hal_usb_ccid_insert_smartcard,void,
|
||||
Function,+,furi_hal_usb_ccid_remove_smartcard,void,
|
||||
@@ -1496,7 +1496,7 @@ Function,+,furi_hal_usb_is_locked,_Bool,
|
||||
Function,+,furi_hal_usb_lock,void,
|
||||
Function,+,furi_hal_usb_reinit,void,
|
||||
Function,+,furi_hal_usb_set_config,_Bool,"FuriHalUsbInterface*, void*"
|
||||
Function,-,furi_hal_usb_set_state_callback,void,"FuriHalUsbStateCallback, void*"
|
||||
Function,+,furi_hal_usb_set_state_callback,void,"FuriHalUsbStateCallback, void*"
|
||||
Function,+,furi_hal_usb_unlock,void,
|
||||
Function,+,furi_hal_version_do_i_belong_here,_Bool,
|
||||
Function,+,furi_hal_version_get_ble_local_device_name_ptr,const char*,
|
||||
@@ -1734,16 +1734,18 @@ Function,-,getchar,int,
|
||||
Function,-,getchar_unlocked,int,
|
||||
Function,-,getenv,char*,const char*
|
||||
Function,-,gets,char*,char*
|
||||
Function,-,getsubopt,int,"char**, char**, char**"
|
||||
Function,-,getsubopt,int,"char**, char* const*, char**"
|
||||
Function,-,getw,int,FILE*
|
||||
Function,+,gui_add_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
|
||||
Function,+,gui_add_view_port,void,"Gui*, ViewPort*, GuiLayer"
|
||||
Function,+,gui_direct_draw_acquire,Canvas*,Gui*
|
||||
Function,+,gui_direct_draw_release,void,Gui*
|
||||
Function,+,gui_get_framebuffer_size,size_t,const Gui*
|
||||
Function,+,gui_is_lockdown,_Bool,const Gui*
|
||||
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
|
||||
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_set_lockdown,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_lockdown_inhibit,void,"Gui*, _Bool"
|
||||
Function,-,gui_view_port_send_to_back,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_view_port_send_to_front,void,"Gui*, ViewPort*"
|
||||
Function,-,hci_send_req,int,"hci_request*, uint8_t"
|
||||
@@ -2362,19 +2364,19 @@ Function,-,pow,double,"double, double"
|
||||
Function,-,pow10,double,double
|
||||
Function,-,pow10f,float,float
|
||||
Function,+,power_enable_low_battery_level_notification,void,"Power*, _Bool"
|
||||
Function,+,power_enable_otg,void,"Power*, _Bool"
|
||||
Function,+,power_get_info,void,"Power*, PowerInfo*"
|
||||
Function,+,power_get_pubsub,FuriPubSub*,Power*
|
||||
Function,+,power_is_battery_healthy,_Bool,Power*
|
||||
Function,+,power_is_otg_enabled,_Bool,Power*
|
||||
Function,+,power_off,void,Power*
|
||||
Function,+,power_reboot,void,"Power*, PowerBootMode"
|
||||
Function,+,power_enable_otg,void,"Power*, _Bool"
|
||||
Function,+,powf,float,"float, float"
|
||||
Function,-,powl,long double,"long double, long double"
|
||||
Function,+,pretty_format_bytes_hex_canonical,void,"FuriString*, size_t, const char*, const uint8_t*, size_t"
|
||||
Function,-,printf,int,"const char*, ..."
|
||||
Function,+,property_value_out,void,"PropertyValueContext*, const char*, unsigned int, ..."
|
||||
Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase**, size_t"
|
||||
Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase* const*, size_t"
|
||||
Function,+,protocol_dict_decoders_feed,ProtocolId,"ProtocolDict*, _Bool, uint32_t"
|
||||
Function,+,protocol_dict_decoders_feed_by_feature,ProtocolId,"ProtocolDict*, uint32_t, _Bool, uint32_t"
|
||||
Function,+,protocol_dict_decoders_feed_by_id,ProtocolId,"ProtocolDict*, size_t, _Bool, uint32_t"
|
||||
@@ -2537,29 +2539,29 @@ Function,+,srand,void,unsigned
|
||||
Function,-,srand48,void,long
|
||||
Function,-,srandom,void,unsigned
|
||||
Function,+,sscanf,int,"const char*, const char*, ..."
|
||||
Function,+,st25r3916_change_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_change_test_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_check_reg,_Bool,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_clear_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_direct_cmd,void,"FuriHalSpiBusHandle*, uint8_t"
|
||||
Function,+,st25r3916_get_irq,uint32_t,FuriHalSpiBusHandle*
|
||||
Function,+,st25r3916_mask_irq,void,"FuriHalSpiBusHandle*, uint32_t"
|
||||
Function,+,st25r3916_modify_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_read_burst_regs,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_read_fifo,_Bool,"FuriHalSpiBusHandle*, uint8_t*, size_t, size_t*"
|
||||
Function,+,st25r3916_read_pta_mem,void,"FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_read_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_read_test_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_reg_read_fifo,void,"FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_reg_write_fifo,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_set_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_burst_regs,void,"FuriHalSpiBusHandle*, uint8_t, const uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_write_fifo,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pta_mem,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_ptf_mem,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pttsn_mem,void,"FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_test_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_change_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_change_test_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_check_reg,_Bool,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_clear_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_direct_cmd,void,"const FuriHalSpiBusHandle*, uint8_t"
|
||||
Function,+,st25r3916_get_irq,uint32_t,const FuriHalSpiBusHandle*
|
||||
Function,+,st25r3916_mask_irq,void,"const FuriHalSpiBusHandle*, uint32_t"
|
||||
Function,+,st25r3916_modify_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_read_burst_regs,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_read_fifo,_Bool,"const FuriHalSpiBusHandle*, uint8_t*, size_t, size_t*"
|
||||
Function,+,st25r3916_read_pta_mem,void,"const FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_read_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_read_test_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_reg_read_fifo,void,"const FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_reg_write_fifo,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_set_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_burst_regs,void,"const FuriHalSpiBusHandle*, uint8_t, const uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_write_fifo,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pta_mem,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_ptf_mem,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pttsn_mem,void,"const FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_test_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,storage_common_copy,FS_Error,"Storage*, const char*, const char*"
|
||||
Function,+,storage_common_equivalent_path,_Bool,"Storage*, const char*, const char*"
|
||||
Function,+,storage_common_exists,_Bool,"Storage*, const char*"
|
||||
@@ -2933,22 +2935,22 @@ Variable,-,__stdio_exit_handler,void (*)(),
|
||||
Variable,+,_ctype_,const char[],
|
||||
Variable,+,_impure_data,_reent,
|
||||
Variable,+,_impure_ptr,_reent*,
|
||||
Variable,-,_sys_errlist,const char*[],
|
||||
Variable,-,_sys_errlist,const char* const[],
|
||||
Variable,-,_sys_nerr,int,
|
||||
Variable,-,ble_profile_hid,const FuriHalBleProfileTemplate*,
|
||||
Variable,-,ble_profile_serial,const FuriHalBleProfileTemplate*,
|
||||
Variable,+,cli_vcp,CliSession,
|
||||
Variable,+,ble_profile_serial,const FuriHalBleProfileTemplate* const,
|
||||
Variable,+,cli_vcp,const CliSession,
|
||||
Variable,+,compress_config_heatshrink_default,const CompressConfigHeatshrink,
|
||||
Variable,+,firmware_api_interface,const ElfApiInterface*,
|
||||
Variable,+,firmware_api_interface,const ElfApiInterface* const,
|
||||
Variable,+,furi_hal_i2c_bus_external,FuriHalI2cBus,
|
||||
Variable,+,furi_hal_i2c_bus_power,FuriHalI2cBus,
|
||||
Variable,+,furi_hal_i2c_handle_external,FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_i2c_handle_power,FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_i2c_handle_external,const FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_i2c_handle_power,const FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_d,FuriHalSpiBus,
|
||||
Variable,+,furi_hal_spi_bus_handle_display,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_external,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_fast,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_slow,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_display,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_external,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_fast,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_slow,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_r,FuriHalSpiBus,
|
||||
Variable,+,furi_hal_spi_preset_1edge_low_16m,const LL_SPI_InitTypeDef,
|
||||
Variable,+,furi_hal_spi_preset_1edge_low_2m,const LL_SPI_InitTypeDef,
|
||||
|
||||
|
@@ -143,7 +143,7 @@ FuriHalSpiBus furi_hal_spi_bus_d = {
|
||||
/* SPI Bus Handles */
|
||||
|
||||
inline static void furi_hal_spi_bus_r_handle_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event,
|
||||
const LL_SPI_InitTypeDef* preset) {
|
||||
if(event == FuriHalSpiBusHandleEventInit) {
|
||||
@@ -189,7 +189,7 @@ inline static void furi_hal_spi_bus_r_handle_event_callback(
|
||||
}
|
||||
|
||||
inline static void furi_hal_spi_bus_nfc_handle_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event,
|
||||
const LL_SPI_InitTypeDef* preset) {
|
||||
if(event == FuriHalSpiBusHandleEventInit) {
|
||||
@@ -255,12 +255,12 @@ inline static void furi_hal_spi_bus_nfc_handle_event_callback(
|
||||
}
|
||||
|
||||
static void furi_hal_spi_bus_handle_external_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event) {
|
||||
furi_hal_spi_bus_r_handle_event_callback(handle, event, &furi_hal_spi_preset_1edge_low_2m);
|
||||
}
|
||||
|
||||
FuriHalSpiBusHandle furi_hal_spi_bus_handle_external = {
|
||||
const FuriHalSpiBusHandle furi_hal_spi_bus_handle_external = {
|
||||
.bus = &furi_hal_spi_bus_r,
|
||||
.callback = furi_hal_spi_bus_handle_external_event_callback,
|
||||
.miso = &gpio_ext_pa6,
|
||||
@@ -270,7 +270,7 @@ FuriHalSpiBusHandle furi_hal_spi_bus_handle_external = {
|
||||
};
|
||||
|
||||
inline static void furi_hal_spi_bus_d_handle_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event,
|
||||
const LL_SPI_InitTypeDef* preset) {
|
||||
if(event == FuriHalSpiBusHandleEventInit) {
|
||||
@@ -311,12 +311,12 @@ inline static void furi_hal_spi_bus_d_handle_event_callback(
|
||||
}
|
||||
|
||||
static void furi_hal_spi_bus_handle_display_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event) {
|
||||
furi_hal_spi_bus_d_handle_event_callback(handle, event, &furi_hal_spi_preset_1edge_low_4m);
|
||||
}
|
||||
|
||||
FuriHalSpiBusHandle furi_hal_spi_bus_handle_display = {
|
||||
const FuriHalSpiBusHandle furi_hal_spi_bus_handle_display = {
|
||||
.bus = &furi_hal_spi_bus_d,
|
||||
.callback = furi_hal_spi_bus_handle_display_event_callback,
|
||||
.miso = &gpio_spi_d_miso,
|
||||
@@ -326,12 +326,12 @@ FuriHalSpiBusHandle furi_hal_spi_bus_handle_display = {
|
||||
};
|
||||
|
||||
static void furi_hal_spi_bus_handle_sd_fast_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event) {
|
||||
furi_hal_spi_bus_d_handle_event_callback(handle, event, &furi_hal_spi_preset_1edge_low_16m);
|
||||
}
|
||||
|
||||
FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_fast = {
|
||||
const FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_fast = {
|
||||
.bus = &furi_hal_spi_bus_d,
|
||||
.callback = furi_hal_spi_bus_handle_sd_fast_event_callback,
|
||||
.miso = &gpio_spi_d_miso,
|
||||
@@ -341,12 +341,12 @@ FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_fast = {
|
||||
};
|
||||
|
||||
static void furi_hal_spi_bus_handle_sd_slow_event_callback(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
FuriHalSpiBusHandleEvent event) {
|
||||
furi_hal_spi_bus_d_handle_event_callback(handle, event, &furi_hal_spi_preset_1edge_low_2m);
|
||||
}
|
||||
|
||||
FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_slow = {
|
||||
const FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_slow = {
|
||||
.bus = &furi_hal_spi_bus_d,
|
||||
.callback = furi_hal_spi_bus_handle_sd_slow_event_callback,
|
||||
.miso = &gpio_spi_d_miso,
|
||||
|
||||
@@ -39,16 +39,16 @@ extern FuriHalSpiBus furi_hal_spi_bus_d;
|
||||
* Bus pins are floating on inactive state, CS high after initialization
|
||||
*
|
||||
*/
|
||||
extern FuriHalSpiBusHandle furi_hal_spi_bus_handle_external;
|
||||
extern const FuriHalSpiBusHandle furi_hal_spi_bus_handle_external;
|
||||
|
||||
/** ST7567(Display) on `furi_hal_spi_bus_d` */
|
||||
extern FuriHalSpiBusHandle furi_hal_spi_bus_handle_display;
|
||||
extern const FuriHalSpiBusHandle furi_hal_spi_bus_handle_display;
|
||||
|
||||
/** SdCard in fast mode on `furi_hal_spi_bus_d` */
|
||||
extern FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_fast;
|
||||
extern const FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_fast;
|
||||
|
||||
/** SdCard in slow mode on `furi_hal_spi_bus_d` */
|
||||
extern FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_slow;
|
||||
extern const FuriHalSpiBusHandle furi_hal_spi_bus_handle_sd_slow;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -882,7 +882,7 @@ Function,+,cli_print_usage,void,"const char*, const char*, const char*"
|
||||
Function,+,cli_read,size_t,"Cli*, uint8_t*, size_t"
|
||||
Function,+,cli_read_timeout,size_t,"Cli*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,cli_session_close,void,Cli*
|
||||
Function,+,cli_session_open,void,"Cli*, void*"
|
||||
Function,+,cli_session_open,void,"Cli*, const void*"
|
||||
Function,+,cli_write,void,"Cli*, const uint8_t*, size_t"
|
||||
Function,+,composite_api_resolver_add,void,"CompositeApiResolver*, const ElfApiInterface*"
|
||||
Function,+,composite_api_resolver_alloc,CompositeApiResolver*,
|
||||
@@ -1097,7 +1097,7 @@ Function,+,felica_get_uid,const uint8_t*,"const FelicaData*, size_t*"
|
||||
Function,+,felica_is_equal,_Bool,"const FelicaData*, const FelicaData*"
|
||||
Function,+,felica_load,_Bool,"FelicaData*, FlipperFormat*, uint32_t"
|
||||
Function,+,felica_poller_activate,FelicaError,"FelicaPoller*, FelicaData*"
|
||||
Function,+,felica_poller_read_blocks,FelicaError,"FelicaPoller*, const uint8_t, const uint8_t*, uint16_t, FelicaPollerReadCommandResponse**"
|
||||
Function,+,felica_poller_read_blocks,FelicaError,"FelicaPoller*, const uint8_t, const uint8_t* const, uint16_t, FelicaPollerReadCommandResponse** const"
|
||||
Function,+,felica_poller_sync_read,FelicaError,"Nfc*, FelicaData*, const FelicaCardKey*"
|
||||
Function,+,felica_reset,void,FelicaData*
|
||||
Function,+,felica_save,_Bool,"const FelicaData*, FlipperFormat*"
|
||||
@@ -1452,23 +1452,23 @@ Function,+,furi_hal_hid_u2f_get_request,uint32_t,uint8_t*
|
||||
Function,+,furi_hal_hid_u2f_is_connected,_Bool,
|
||||
Function,+,furi_hal_hid_u2f_send_response,void,"uint8_t*, uint8_t"
|
||||
Function,+,furi_hal_hid_u2f_set_callback,void,"HidU2fCallback, void*"
|
||||
Function,+,furi_hal_i2c_acquire,void,FuriHalI2cBusHandle*
|
||||
Function,+,furi_hal_i2c_acquire,void,const FuriHalI2cBusHandle*
|
||||
Function,-,furi_hal_i2c_deinit_early,void,
|
||||
Function,-,furi_hal_i2c_init,void,
|
||||
Function,-,furi_hal_i2c_init_early,void,
|
||||
Function,+,furi_hal_i2c_is_device_ready,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_mem,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_16,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_8,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_release,void,FuriHalI2cBusHandle*
|
||||
Function,+,furi_hal_i2c_rx,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_rx_ext,_Bool,"FuriHalI2cBusHandle*, uint16_t, _Bool, uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_trx,_Bool,"FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx,_Bool,"FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx_ext,_Bool,"FuriHalI2cBusHandle*, uint16_t, _Bool, const uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_mem,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_16,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_8,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_is_device_ready,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_mem,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_16,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_read_reg_8,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, uint32_t"
|
||||
Function,+,furi_hal_i2c_release,void,const FuriHalI2cBusHandle*
|
||||
Function,+,furi_hal_i2c_rx,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_rx_ext,_Bool,"const FuriHalI2cBusHandle*, uint16_t, _Bool, uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_trx,_Bool,"const FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx,_Bool,"const FuriHalI2cBusHandle*, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_tx_ext,_Bool,"const FuriHalI2cBusHandle*, uint16_t, _Bool, const uint8_t*, size_t, FuriHalI2cBegin, FuriHalI2cEnd, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_mem,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_16,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t"
|
||||
Function,+,furi_hal_i2c_write_reg_8,_Bool,"const FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t"
|
||||
Function,+,furi_hal_ibutton_emulate_set_next,void,uint32_t
|
||||
Function,+,furi_hal_ibutton_emulate_start,void,"uint32_t, FuriHalIbuttonEmulateCallback, void*"
|
||||
Function,+,furi_hal_ibutton_emulate_stop,void,
|
||||
@@ -1716,20 +1716,20 @@ Function,+,furi_hal_speaker_release,void,
|
||||
Function,+,furi_hal_speaker_set_volume,void,float
|
||||
Function,+,furi_hal_speaker_start,void,"float, float"
|
||||
Function,+,furi_hal_speaker_stop,void,
|
||||
Function,+,furi_hal_spi_acquire,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_acquire,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_deinit,void,FuriHalSpiBus*
|
||||
Function,+,furi_hal_spi_bus_handle_deinit,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_handle_init,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_handle_deinit,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_handle_init,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_bus_init,void,FuriHalSpiBus*
|
||||
Function,+,furi_hal_spi_bus_rx,_Bool,"FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx,_Bool,"FuriHalSpiBusHandle*, const uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx_dma,_Bool,"FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_tx,_Bool,"FuriHalSpiBusHandle*, const uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_rx,_Bool,"const FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx,_Bool,"const FuriHalSpiBusHandle*, const uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_trx_dma,_Bool,"const FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t"
|
||||
Function,+,furi_hal_spi_bus_tx,_Bool,"const FuriHalSpiBusHandle*, const uint8_t*, size_t, uint32_t"
|
||||
Function,-,furi_hal_spi_config_deinit_early,void,
|
||||
Function,-,furi_hal_spi_config_init,void,
|
||||
Function,-,furi_hal_spi_config_init_early,void,
|
||||
Function,-,furi_hal_spi_dma_init,void,
|
||||
Function,+,furi_hal_spi_release,void,FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_spi_release,void,const FuriHalSpiBusHandle*
|
||||
Function,+,furi_hal_subghz_check_tx,SubGhzTx,uint32_t
|
||||
Function,-,furi_hal_subghz_dump_state,void,
|
||||
Function,+,furi_hal_subghz_flush_rx,void,
|
||||
@@ -1776,7 +1776,7 @@ Function,+,furi_hal_usb_is_locked,_Bool,
|
||||
Function,+,furi_hal_usb_lock,void,
|
||||
Function,+,furi_hal_usb_reinit,void,
|
||||
Function,+,furi_hal_usb_set_config,_Bool,"FuriHalUsbInterface*, void*"
|
||||
Function,-,furi_hal_usb_set_state_callback,void,"FuriHalUsbStateCallback, void*"
|
||||
Function,+,furi_hal_usb_set_state_callback,void,"FuriHalUsbStateCallback, void*"
|
||||
Function,+,furi_hal_usb_unlock,void,
|
||||
Function,+,furi_hal_version_do_i_belong_here,_Bool,
|
||||
Function,+,furi_hal_version_get_ble_local_device_name_ptr,const char*,
|
||||
@@ -2020,17 +2020,19 @@ Function,-,getchar,int,
|
||||
Function,-,getchar_unlocked,int,
|
||||
Function,-,getenv,char*,const char*
|
||||
Function,-,gets,char*,char*
|
||||
Function,-,getsubopt,int,"char**, char**, char**"
|
||||
Function,-,getsubopt,int,"char**, char* const*, char**"
|
||||
Function,-,getw,int,FILE*
|
||||
Function,+,gui_add_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
|
||||
Function,+,gui_add_view_port,void,"Gui*, ViewPort*, GuiLayer"
|
||||
Function,+,gui_direct_draw_acquire,Canvas*,Gui*
|
||||
Function,+,gui_direct_draw_release,void,Gui*
|
||||
Function,+,gui_get_framebuffer_size,size_t,const Gui*
|
||||
Function,+,gui_is_lockdown,_Bool,const Gui*
|
||||
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
|
||||
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_set_hide_statusbar,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_lockdown,void,"Gui*, _Bool"
|
||||
Function,+,gui_set_lockdown_inhibit,void,"Gui*, _Bool"
|
||||
Function,-,gui_view_port_send_to_back,void,"Gui*, ViewPort*"
|
||||
Function,+,gui_view_port_send_to_front,void,"Gui*, ViewPort*"
|
||||
Function,-,hci_send_req,int,"hci_request*, uint8_t"
|
||||
@@ -2729,7 +2731,7 @@ Function,+,mf_ultralight_3des_decrypt,void,"mbedtls_des3_context*, const uint8_t
|
||||
Function,+,mf_ultralight_3des_encrypt,void,"mbedtls_des3_context*, const uint8_t*, const uint8_t*, const uint8_t*, const uint8_t, uint8_t*"
|
||||
Function,+,mf_ultralight_3des_get_key,const uint8_t*,const MfUltralightData*
|
||||
Function,+,mf_ultralight_3des_key_valid,_Bool,const MfUltralightData*
|
||||
Function,+,mf_ultralight_3des_shift_data,void,uint8_t*
|
||||
Function,+,mf_ultralight_3des_shift_data,void,uint8_t* const
|
||||
Function,+,mf_ultralight_alloc,MfUltralightData*,
|
||||
Function,+,mf_ultralight_copy,void,"MfUltralightData*, const MfUltralightData*"
|
||||
Function,+,mf_ultralight_detect_protocol,_Bool,const Iso14443_3aData*
|
||||
@@ -3091,7 +3093,7 @@ Function,+,pretty_format_bytes_hex_canonical,void,"FuriString*, size_t, const ch
|
||||
Function,-,printf,int,"const char*, ..."
|
||||
Function,+,process_favorite_launch,_Bool,char**
|
||||
Function,+,property_value_out,void,"PropertyValueContext*, const char*, unsigned int, ..."
|
||||
Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase**, size_t"
|
||||
Function,+,protocol_dict_alloc,ProtocolDict*,"const ProtocolBase* const*, size_t"
|
||||
Function,+,protocol_dict_decoders_feed,ProtocolId,"ProtocolDict*, _Bool, uint32_t"
|
||||
Function,+,protocol_dict_decoders_feed_by_feature,ProtocolId,"ProtocolDict*, uint32_t, _Bool, uint32_t"
|
||||
Function,+,protocol_dict_decoders_feed_by_id,ProtocolId,"ProtocolDict*, size_t, _Bool, uint32_t"
|
||||
@@ -3297,29 +3299,29 @@ Function,+,srand,void,unsigned
|
||||
Function,-,srand48,void,long
|
||||
Function,-,srandom,void,unsigned
|
||||
Function,+,sscanf,int,"const char*, const char*, ..."
|
||||
Function,+,st25r3916_change_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_change_test_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_check_reg,_Bool,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_clear_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_direct_cmd,void,"FuriHalSpiBusHandle*, uint8_t"
|
||||
Function,+,st25r3916_get_irq,uint32_t,FuriHalSpiBusHandle*
|
||||
Function,+,st25r3916_mask_irq,void,"FuriHalSpiBusHandle*, uint32_t"
|
||||
Function,+,st25r3916_modify_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_read_burst_regs,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_read_fifo,_Bool,"FuriHalSpiBusHandle*, uint8_t*, size_t, size_t*"
|
||||
Function,+,st25r3916_read_pta_mem,void,"FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_read_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_read_test_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_reg_read_fifo,void,"FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_reg_write_fifo,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_set_reg_bits,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_burst_regs,void,"FuriHalSpiBusHandle*, uint8_t, const uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_write_fifo,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pta_mem,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_ptf_mem,void,"FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pttsn_mem,void,"FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_test_reg,void,"FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_change_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_change_test_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_check_reg,_Bool,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_clear_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_direct_cmd,void,"const FuriHalSpiBusHandle*, uint8_t"
|
||||
Function,+,st25r3916_get_irq,uint32_t,const FuriHalSpiBusHandle*
|
||||
Function,+,st25r3916_mask_irq,void,"const FuriHalSpiBusHandle*, uint32_t"
|
||||
Function,+,st25r3916_modify_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_read_burst_regs,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_read_fifo,_Bool,"const FuriHalSpiBusHandle*, uint8_t*, size_t, size_t*"
|
||||
Function,+,st25r3916_read_pta_mem,void,"const FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_read_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_read_test_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t*"
|
||||
Function,+,st25r3916_reg_read_fifo,void,"const FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_reg_write_fifo,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_set_reg_bits,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_burst_regs,void,"const FuriHalSpiBusHandle*, uint8_t, const uint8_t*, uint8_t"
|
||||
Function,+,st25r3916_write_fifo,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pta_mem,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_ptf_mem,void,"const FuriHalSpiBusHandle*, const uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_pttsn_mem,void,"const FuriHalSpiBusHandle*, uint8_t*, size_t"
|
||||
Function,+,st25r3916_write_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25r3916_write_test_reg,void,"const FuriHalSpiBusHandle*, uint8_t, uint8_t"
|
||||
Function,+,st25tb_alloc,St25tbData*,
|
||||
Function,+,st25tb_copy,void,"St25tbData*, const St25tbData*"
|
||||
Function,+,st25tb_free,void,St25tbData*
|
||||
@@ -4227,25 +4229,25 @@ Variable,-,__stdio_exit_handler,void (*)(),
|
||||
Variable,+,_ctype_,const char[],
|
||||
Variable,+,_impure_data,_reent,
|
||||
Variable,+,_impure_ptr,_reent*,
|
||||
Variable,-,_sys_errlist,const char*[],
|
||||
Variable,-,_sys_errlist,const char* const[],
|
||||
Variable,-,_sys_nerr,int,
|
||||
Variable,-,ble_profile_hid,const FuriHalBleProfileTemplate*,
|
||||
Variable,-,ble_profile_serial,const FuriHalBleProfileTemplate*,
|
||||
Variable,+,cli_vcp,CliSession,
|
||||
Variable,+,ble_profile_serial,const FuriHalBleProfileTemplate* const,
|
||||
Variable,+,cli_vcp,const CliSession,
|
||||
Variable,+,compress_config_heatshrink_default,const CompressConfigHeatshrink,
|
||||
Variable,+,firmware_api_interface,const ElfApiInterface*,
|
||||
Variable,+,firmware_api_interface,const ElfApiInterface* const,
|
||||
Variable,+,furi_hal_i2c_bus_external,FuriHalI2cBus,
|
||||
Variable,+,furi_hal_i2c_bus_power,FuriHalI2cBus,
|
||||
Variable,+,furi_hal_i2c_handle_external,FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_i2c_handle_power,FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_i2c_handle_external,const FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_i2c_handle_power,const FuriHalI2cBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_d,FuriHalSpiBus,
|
||||
Variable,+,furi_hal_spi_bus_handle_display,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_external,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_external_extra,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_nfc,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_fast,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_slow,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_subghz,FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_display,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_external,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_external_extra,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_nfc,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_fast,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_sd_slow,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_handle_subghz,const FuriHalSpiBusHandle,
|
||||
Variable,+,furi_hal_spi_bus_r,FuriHalSpiBus,
|
||||
Variable,+,furi_hal_spi_preset_1edge_low_16m,const LL_SPI_InitTypeDef,
|
||||
Variable,+,furi_hal_spi_preset_1edge_low_2m,const LL_SPI_InitTypeDef,
|
||||
@@ -4303,7 +4305,7 @@ Variable,+,gpio_usb_dp,const GpioPin,
|
||||
Variable,+,gpio_vibro,const GpioPin,
|
||||
Variable,+,input_pins,const InputPin[],
|
||||
Variable,+,input_pins_count,const size_t,
|
||||
Variable,+,lfrfid_protocols,const ProtocolBase*[],
|
||||
Variable,+,lfrfid_protocols,const ProtocolBase* const[],
|
||||
Variable,+,message_blink_set_color_blue,const NotificationMessage,
|
||||
Variable,+,message_blink_set_color_cyan,const NotificationMessage,
|
||||
Variable,+,message_blink_set_color_green,const NotificationMessage,
|
||||
|
||||
|
@@ -46,7 +46,7 @@ static void ble_profile_serial_stop(FuriHalBleProfileBase* profile) {
|
||||
// Up to 45 ms
|
||||
#define CONNECTION_INTERVAL_MAX (0x24)
|
||||
|
||||
static GapConfig serial_template_config = {
|
||||
static const GapConfig serial_template_config = {
|
||||
.adv_service_uuid = 0x3080,
|
||||
.appearance_char = 0x8600,
|
||||
.bonding_mode = true,
|
||||
@@ -80,7 +80,7 @@ static const FuriHalBleProfileTemplate profile_callbacks = {
|
||||
.get_gap_config = ble_profile_serial_get_config,
|
||||
};
|
||||
|
||||
const FuriHalBleProfileTemplate* ble_profile_serial = &profile_callbacks;
|
||||
const FuriHalBleProfileTemplate* const ble_profile_serial = &profile_callbacks;
|
||||
|
||||
void ble_profile_serial_set_event_callback(
|
||||
FuriHalBleProfileBase* profile,
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef enum {
|
||||
typedef SerialServiceEventCallback FuriHalBtSerialCallback;
|
||||
|
||||
/** Serial profile descriptor */
|
||||
extern const FuriHalBleProfileTemplate* ble_profile_serial;
|
||||
extern const FuriHalBleProfileTemplate* const ble_profile_serial;
|
||||
|
||||
/** Send data through BLE
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@ static DRESULT driver_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
|
||||
static DRESULT driver_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
|
||||
static DRESULT driver_ioctl(BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
Diskio_drvTypeDef sd_fatfs_driver = {
|
||||
const Diskio_drvTypeDef sd_fatfs_driver = {
|
||||
driver_initialize,
|
||||
driver_status,
|
||||
driver_read,
|
||||
|
||||
@@ -6,7 +6,7 @@ extern "C" {
|
||||
|
||||
#include "fatfs/ff_gen_drv.h"
|
||||
|
||||
extern Diskio_drvTypeDef sd_fatfs_driver;
|
||||
extern const Diskio_drvTypeDef sd_fatfs_driver;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void furi_hal_i2c_init(void) {
|
||||
FURI_LOG_I(TAG, "Init OK");
|
||||
}
|
||||
|
||||
void furi_hal_i2c_acquire(FuriHalI2cBusHandle* handle) {
|
||||
void furi_hal_i2c_acquire(const FuriHalI2cBusHandle* handle) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
// Lock bus access
|
||||
handle->bus->callback(handle->bus, FuriHalI2cBusEventLock);
|
||||
@@ -36,7 +36,7 @@ void furi_hal_i2c_acquire(FuriHalI2cBusHandle* handle) {
|
||||
handle->callback(handle, FuriHalI2cBusHandleEventActivate);
|
||||
}
|
||||
|
||||
void furi_hal_i2c_release(FuriHalI2cBusHandle* handle) {
|
||||
void furi_hal_i2c_release(const FuriHalI2cBusHandle* handle) {
|
||||
// Ensure that current handle is our handle
|
||||
furi_check(handle->bus->current_handle == handle);
|
||||
// Deactivate handle
|
||||
@@ -196,7 +196,7 @@ static bool furi_hal_i2c_transaction(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_rx_ext(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint16_t address,
|
||||
bool ten_bit,
|
||||
uint8_t* data,
|
||||
@@ -213,7 +213,7 @@ bool furi_hal_i2c_rx_ext(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_tx_ext(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint16_t address,
|
||||
bool ten_bit,
|
||||
const uint8_t* data,
|
||||
@@ -230,7 +230,7 @@ bool furi_hal_i2c_tx_ext(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_tx(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t address,
|
||||
const uint8_t* data,
|
||||
size_t size,
|
||||
@@ -242,7 +242,7 @@ bool furi_hal_i2c_tx(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_rx(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t address,
|
||||
uint8_t* data,
|
||||
size_t size,
|
||||
@@ -254,7 +254,7 @@ bool furi_hal_i2c_rx(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_trx(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t address,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_size,
|
||||
@@ -281,7 +281,10 @@ bool furi_hal_i2c_trx(
|
||||
timeout);
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_is_device_ready(FuriHalI2cBusHandle* handle, uint8_t i2c_addr, uint32_t timeout) {
|
||||
bool furi_hal_i2c_is_device_ready(
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint32_t timeout) {
|
||||
furi_check(handle);
|
||||
furi_check(handle->bus->current_handle == handle);
|
||||
furi_check(timeout > 0);
|
||||
@@ -314,7 +317,7 @@ bool furi_hal_i2c_is_device_ready(FuriHalI2cBusHandle* handle, uint8_t i2c_addr,
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_read_reg_8(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint8_t reg_addr,
|
||||
uint8_t* data,
|
||||
@@ -325,7 +328,7 @@ bool furi_hal_i2c_read_reg_8(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_read_reg_16(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint8_t reg_addr,
|
||||
uint16_t* data,
|
||||
@@ -340,7 +343,7 @@ bool furi_hal_i2c_read_reg_16(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_read_mem(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint8_t mem_addr,
|
||||
uint8_t* data,
|
||||
@@ -352,7 +355,7 @@ bool furi_hal_i2c_read_mem(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_write_reg_8(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint8_t reg_addr,
|
||||
uint8_t data,
|
||||
@@ -368,7 +371,7 @@ bool furi_hal_i2c_write_reg_8(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_write_reg_16(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint8_t reg_addr,
|
||||
uint16_t data,
|
||||
@@ -385,7 +388,7 @@ bool furi_hal_i2c_write_reg_16(
|
||||
}
|
||||
|
||||
bool furi_hal_i2c_write_mem(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
uint8_t i2c_addr,
|
||||
uint8_t mem_addr,
|
||||
const uint8_t* data,
|
||||
|
||||
@@ -74,7 +74,7 @@ FuriHalI2cBus furi_hal_i2c_bus_external = {
|
||||
};
|
||||
|
||||
void furi_hal_i2c_bus_handle_power_event(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
FuriHalI2cBusHandleEvent event) {
|
||||
if(event == FuriHalI2cBusHandleEventActivate) {
|
||||
furi_hal_gpio_init_ex(
|
||||
@@ -120,13 +120,13 @@ void furi_hal_i2c_bus_handle_power_event(
|
||||
}
|
||||
}
|
||||
|
||||
FuriHalI2cBusHandle furi_hal_i2c_handle_power = {
|
||||
const FuriHalI2cBusHandle furi_hal_i2c_handle_power = {
|
||||
.bus = &furi_hal_i2c_bus_power,
|
||||
.callback = furi_hal_i2c_bus_handle_power_event,
|
||||
};
|
||||
|
||||
void furi_hal_i2c_bus_handle_external_event(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
FuriHalI2cBusHandleEvent event) {
|
||||
if(event == FuriHalI2cBusHandleEventActivate) {
|
||||
furi_hal_gpio_init_ex(
|
||||
@@ -160,7 +160,7 @@ void furi_hal_i2c_bus_handle_external_event(
|
||||
}
|
||||
}
|
||||
|
||||
FuriHalI2cBusHandle furi_hal_i2c_handle_external = {
|
||||
const FuriHalI2cBusHandle furi_hal_i2c_handle_external = {
|
||||
.bus = &furi_hal_i2c_bus_external,
|
||||
.callback = furi_hal_i2c_bus_handle_external_event,
|
||||
};
|
||||
|
||||
@@ -17,14 +17,14 @@ extern FuriHalI2cBus furi_hal_i2c_bus_external;
|
||||
* Pins: PA9(SCL) / PA10(SDA), float on release
|
||||
* Params: 400khz
|
||||
*/
|
||||
extern FuriHalI2cBusHandle furi_hal_i2c_handle_power;
|
||||
extern const FuriHalI2cBusHandle furi_hal_i2c_handle_power;
|
||||
|
||||
/** Handle for external i2c bus
|
||||
* Bus: furi_hal_i2c_bus_external
|
||||
* Pins: PC0(SCL) / PC1(SDA), float on release
|
||||
* Params: 100khz
|
||||
*/
|
||||
extern FuriHalI2cBusHandle furi_hal_i2c_handle_external;
|
||||
extern const FuriHalI2cBusHandle furi_hal_i2c_handle_external;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef void (*FuriHalI2cBusEventCallback)(FuriHalI2cBus* bus, FuriHalI2cBusEven
|
||||
/** FuriHal i2c bus */
|
||||
struct FuriHalI2cBus {
|
||||
I2C_TypeDef* i2c;
|
||||
FuriHalI2cBusHandle* current_handle;
|
||||
const FuriHalI2cBusHandle* current_handle;
|
||||
FuriHalI2cBusEventCallback callback;
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef enum {
|
||||
|
||||
/** FuriHal i2c handle event callback */
|
||||
typedef void (*FuriHalI2cBusHandleEventCallback)(
|
||||
FuriHalI2cBusHandle* handle,
|
||||
const FuriHalI2cBusHandle* handle,
|
||||
FuriHalI2cBusHandleEvent event);
|
||||
|
||||
/** FuriHal i2c handle */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#define TAG "FuriHalNfc"
|
||||
|
||||
const FuriHalNfcTechBase* furi_hal_nfc_tech[FuriHalNfcTechNum] = {
|
||||
const FuriHalNfcTechBase* const furi_hal_nfc_tech[FuriHalNfcTechNum] = {
|
||||
[FuriHalNfcTechIso14443a] = &furi_hal_nfc_iso14443a,
|
||||
[FuriHalNfcTechIso14443b] = &furi_hal_nfc_iso14443b,
|
||||
[FuriHalNfcTechIso15693] = &furi_hal_nfc_iso15693,
|
||||
@@ -18,7 +18,7 @@ const FuriHalNfcTechBase* furi_hal_nfc_tech[FuriHalNfcTechNum] = {
|
||||
|
||||
FuriHalNfc furi_hal_nfc;
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_turn_on_osc(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_turn_on_osc(const FuriHalSpiBusHandle* handle) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
furi_hal_nfc_event_start();
|
||||
|
||||
@@ -53,7 +53,7 @@ FuriHalNfcError furi_hal_nfc_is_hal_ready(void) {
|
||||
error = furi_hal_nfc_acquire();
|
||||
if(error != FuriHalNfcErrorNone) break;
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
uint8_t chip_id = 0;
|
||||
st25r3916_read_reg(handle, ST25R3916_REG_IC_IDENTITY, &chip_id);
|
||||
if((chip_id & ST25R3916_REG_IC_IDENTITY_ic_type_mask) !=
|
||||
@@ -83,7 +83,7 @@ FuriHalNfcError furi_hal_nfc_init(void) {
|
||||
furi_hal_nfc_low_power_mode_start();
|
||||
}
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
// Set default state
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_SET_DEFAULT);
|
||||
// Increase IO driver strength of MISO and IRQ
|
||||
@@ -282,7 +282,7 @@ FuriHalNfcError furi_hal_nfc_release(void) {
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_low_power_mode_start(void) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_STOP);
|
||||
st25r3916_clear_reg_bits(
|
||||
@@ -300,7 +300,7 @@ FuriHalNfcError furi_hal_nfc_low_power_mode_start(void) {
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_low_power_mode_stop(void) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
do {
|
||||
furi_hal_nfc_init_gpio_isr();
|
||||
@@ -318,7 +318,7 @@ FuriHalNfcError furi_hal_nfc_low_power_mode_stop(void) {
|
||||
return error;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_poller_init_common(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_poller_init_common(const FuriHalSpiBusHandle* handle) {
|
||||
// Disable wake up
|
||||
st25r3916_clear_reg_bits(handle, ST25R3916_REG_OP_CONTROL, ST25R3916_REG_OP_CONTROL_wu);
|
||||
// Enable correlator
|
||||
@@ -339,7 +339,7 @@ static FuriHalNfcError furi_hal_nfc_poller_init_common(FuriHalSpiBusHandle* hand
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_listener_init_common(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_listener_init_common(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
// No common listener configuration
|
||||
return FuriHalNfcErrorNone;
|
||||
@@ -349,7 +349,7 @@ FuriHalNfcError furi_hal_nfc_set_mode(FuriHalNfcMode mode, FuriHalNfcTech tech)
|
||||
furi_check(mode < FuriHalNfcModeNum);
|
||||
furi_check(tech < FuriHalNfcTechNum);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
|
||||
@@ -375,7 +375,7 @@ FuriHalNfcError furi_hal_nfc_set_mode(FuriHalNfcMode mode, FuriHalNfcTech tech)
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_reset_mode(void) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_STOP);
|
||||
|
||||
@@ -415,7 +415,7 @@ FuriHalNfcError furi_hal_nfc_reset_mode(void) {
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_field_detect_start(void) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_write_reg(
|
||||
handle,
|
||||
@@ -429,7 +429,7 @@ FuriHalNfcError furi_hal_nfc_field_detect_start(void) {
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_field_detect_stop(void) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_clear_reg_bits(
|
||||
handle,
|
||||
@@ -441,7 +441,7 @@ FuriHalNfcError furi_hal_nfc_field_detect_stop(void) {
|
||||
|
||||
bool furi_hal_nfc_field_is_present(void) {
|
||||
bool is_present = false;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
if(st25r3916_check_reg(
|
||||
handle,
|
||||
@@ -456,7 +456,7 @@ bool furi_hal_nfc_field_is_present(void) {
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_poller_field_on(void) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
if(!st25r3916_check_reg(
|
||||
handle,
|
||||
@@ -476,7 +476,7 @@ FuriHalNfcError furi_hal_nfc_poller_field_on(void) {
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_poller_tx_common(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits) {
|
||||
furi_check(tx_data);
|
||||
@@ -508,7 +508,7 @@ FuriHalNfcError furi_hal_nfc_poller_tx_common(
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_common_fifo_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits) {
|
||||
FuriHalNfcError err = FuriHalNfcErrorNone;
|
||||
@@ -523,7 +523,7 @@ FuriHalNfcError furi_hal_nfc_common_fifo_tx(
|
||||
FuriHalNfcError furi_hal_nfc_poller_tx(const uint8_t* tx_data, size_t tx_bits) {
|
||||
furi_check(furi_hal_nfc.mode == FuriHalNfcModePoller);
|
||||
furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum);
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
return furi_hal_nfc_tech[furi_hal_nfc.tech]->poller.tx(handle, tx_data, tx_bits);
|
||||
}
|
||||
@@ -531,7 +531,7 @@ FuriHalNfcError furi_hal_nfc_poller_tx(const uint8_t* tx_data, size_t tx_bits) {
|
||||
FuriHalNfcError furi_hal_nfc_poller_rx(uint8_t* rx_data, size_t rx_data_size, size_t* rx_bits) {
|
||||
furi_check(furi_hal_nfc.mode == FuriHalNfcModePoller);
|
||||
furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum);
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
return furi_hal_nfc_tech[furi_hal_nfc.tech]->poller.rx(handle, rx_data, rx_data_size, rx_bits);
|
||||
}
|
||||
@@ -556,12 +556,12 @@ FuriHalNfcError furi_hal_nfc_listener_tx(const uint8_t* tx_data, size_t tx_bits)
|
||||
furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener);
|
||||
furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.tx(handle, tx_data, tx_bits);
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_common_fifo_rx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* rx_data,
|
||||
size_t rx_data_size,
|
||||
size_t* rx_bits) {
|
||||
@@ -581,13 +581,13 @@ FuriHalNfcError furi_hal_nfc_listener_rx(uint8_t* rx_data, size_t rx_data_size,
|
||||
furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener);
|
||||
furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.rx(
|
||||
handle, rx_data, rx_data_size, rx_bits);
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_trx_reset(void) {
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_STOP);
|
||||
|
||||
@@ -598,7 +598,7 @@ FuriHalNfcError furi_hal_nfc_listener_sleep(void) {
|
||||
furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener);
|
||||
furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.sleep(handle);
|
||||
}
|
||||
@@ -607,13 +607,13 @@ FuriHalNfcError furi_hal_nfc_listener_idle(void) {
|
||||
furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener);
|
||||
furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.idle(handle);
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_listener_enable_rx(void) {
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_UNMASK_RECEIVE_DATA);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ FuriHalNfcEvent furi_hal_nfc_wait_event_common(uint32_t timeout_ms) {
|
||||
if(event_flag != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(event_flag & FuriHalNfcEventInternalTypeIrq) {
|
||||
furi_thread_flags_clear(FuriHalNfcEventInternalTypeIrq);
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
uint32_t irq = furi_hal_nfc_get_irq(handle);
|
||||
if(irq & ST25R3916_IRQ_MASK_OSC) {
|
||||
event |= FuriHalNfcEventOscOn;
|
||||
@@ -101,7 +101,7 @@ FuriHalNfcEvent furi_hal_nfc_wait_event_common(uint32_t timeout_ms) {
|
||||
}
|
||||
|
||||
bool furi_hal_nfc_event_wait_for_specific_irq(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint32_t mask,
|
||||
uint32_t timeout_ms) {
|
||||
furi_check(furi_hal_nfc_event);
|
||||
|
||||
@@ -18,7 +18,7 @@ typedef struct {
|
||||
} FuriHalFelicaPtMemory;
|
||||
#pragma pack(pop)
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_felica_poller_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_felica_poller_init(const FuriHalSpiBusHandle* handle) {
|
||||
// Enable Felica mode, AM modulation
|
||||
st25r3916_change_reg_bits(
|
||||
handle,
|
||||
@@ -61,13 +61,13 @@ static FuriHalNfcError furi_hal_nfc_felica_poller_init(FuriHalSpiBusHandle* hand
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_felica_poller_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_felica_poller_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_felica_listener_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_felica_listener_init(const FuriHalSpiBusHandle* handle) {
|
||||
furi_assert(handle);
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_SET_DEFAULT);
|
||||
st25r3916_write_reg(
|
||||
@@ -141,7 +141,7 @@ static FuriHalNfcError furi_hal_nfc_felica_listener_init(FuriHalSpiBusHandle* ha
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_felica_listener_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_felica_listener_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
@@ -154,19 +154,19 @@ static FuriHalNfcEvent furi_hal_nfc_felica_listener_wait_event(uint32_t timeout_
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_felica_listener_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits) {
|
||||
furi_hal_nfc_common_fifo_tx(handle, tx_data, tx_bits);
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_felica_listener_sleep(FuriHalSpiBusHandle* handle) {
|
||||
FuriHalNfcError furi_hal_nfc_felica_listener_sleep(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_felica_listener_idle(FuriHalSpiBusHandle* handle) {
|
||||
FuriHalNfcError furi_hal_nfc_felica_listener_idle(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ FuriHalNfcError furi_hal_nfc_felica_listener_set_sensf_res_data(
|
||||
furi_check(idm_len == FURI_HAL_FELICA_IDM_PMM_LENGTH);
|
||||
furi_check(pmm_len == FURI_HAL_FELICA_IDM_PMM_LENGTH);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
// Write PT Memory
|
||||
FuriHalFelicaPtMemory pt;
|
||||
pt.system_code = sys_code;
|
||||
|
||||
@@ -104,7 +104,7 @@ void furi_hal_nfc_timers_deinit(void);
|
||||
* @param[in,out] handle pointer to the SPI handle associated with the NFC chip.
|
||||
* @returns bitmask of zero or more occurred interrupts.
|
||||
*/
|
||||
uint32_t furi_hal_nfc_get_irq(FuriHalSpiBusHandle* handle);
|
||||
uint32_t furi_hal_nfc_get_irq(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/**
|
||||
* @brief Wait until a specified type of interrupt occurs.
|
||||
@@ -115,7 +115,7 @@ uint32_t furi_hal_nfc_get_irq(FuriHalSpiBusHandle* handle);
|
||||
* @returns true if specified interrupt(s) have occured within timeout, false otherwise.
|
||||
*/
|
||||
bool furi_hal_nfc_event_wait_for_specific_irq(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint32_t mask,
|
||||
uint32_t timeout_ms);
|
||||
|
||||
@@ -137,7 +137,7 @@ FuriHalNfcEvent furi_hal_nfc_wait_event_common(uint32_t timeout_ms);
|
||||
* @param[in,out] handle pointer to the SPI handle associated with the NFC chip.
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
FuriHalNfcError furi_hal_nfc_common_listener_rx_start(FuriHalSpiBusHandle* handle);
|
||||
FuriHalNfcError furi_hal_nfc_common_listener_rx_start(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/**
|
||||
* @brief Transmit data using on-chip FIFO.
|
||||
@@ -150,7 +150,7 @@ FuriHalNfcError furi_hal_nfc_common_listener_rx_start(FuriHalSpiBusHandle* handl
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
FuriHalNfcError furi_hal_nfc_common_fifo_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits);
|
||||
|
||||
@@ -166,7 +166,7 @@ FuriHalNfcError furi_hal_nfc_common_fifo_tx(
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
FuriHalNfcError furi_hal_nfc_common_fifo_rx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* rx_data,
|
||||
size_t rx_data_size,
|
||||
size_t* rx_bits);
|
||||
@@ -182,7 +182,7 @@ FuriHalNfcError furi_hal_nfc_common_fifo_rx(
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
FuriHalNfcError furi_hal_nfc_poller_tx_common(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ static void furi_hal_nfc_int_callback(void* context) {
|
||||
furi_hal_nfc_event_set(FuriHalNfcEventInternalTypeIrq);
|
||||
}
|
||||
|
||||
uint32_t furi_hal_nfc_get_irq(FuriHalSpiBusHandle* handle) {
|
||||
uint32_t furi_hal_nfc_get_irq(const FuriHalSpiBusHandle* handle) {
|
||||
uint32_t irq = 0;
|
||||
while(furi_hal_gpio_read_port_pin(gpio_nfc_irq_rfid_pull.port, gpio_nfc_irq_rfid_pull.pin)) {
|
||||
irq |= st25r3916_get_irq(handle);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
static Iso14443_3aSignal* iso14443_3a_signal = NULL;
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_common_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_common_init(const FuriHalSpiBusHandle* handle) {
|
||||
// Common NFC-A settings, 106 kbps
|
||||
|
||||
// 1st stage zero = 600kHz, 3rd stage zero = 200 kHz
|
||||
@@ -40,7 +40,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443a_common_init(FuriHalSpiBusHandle* h
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_poller_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_poller_init(const FuriHalSpiBusHandle* handle) {
|
||||
// Enable ISO14443A mode, OOK modulation
|
||||
st25r3916_change_reg_bits(
|
||||
handle,
|
||||
@@ -57,7 +57,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443a_poller_init(FuriHalSpiBusHandle* h
|
||||
return furi_hal_nfc_iso14443a_common_init(handle);
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_poller_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_poller_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
st25r3916_change_reg_bits(
|
||||
handle,
|
||||
ST25R3916_REG_ISO14443A_NFC,
|
||||
@@ -67,7 +67,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443a_poller_deinit(FuriHalSpiBusHandle*
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_listener_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_listener_init(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(iso14443_3a_signal == NULL);
|
||||
iso14443_3a_signal = iso14443_3a_signal_alloc(&gpio_spi_r_mosi);
|
||||
|
||||
@@ -105,7 +105,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443a_listener_init(FuriHalSpiBusHandle*
|
||||
return furi_hal_nfc_iso14443a_common_init(handle);
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_listener_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443a_listener_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
|
||||
if(iso14443_3a_signal) {
|
||||
@@ -118,7 +118,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443a_listener_deinit(FuriHalSpiBusHandl
|
||||
|
||||
static FuriHalNfcEvent furi_hal_nfc_iso14443_3a_listener_wait_event(uint32_t timeout_ms) {
|
||||
FuriHalNfcEvent event = furi_hal_nfc_wait_event_common(timeout_ms);
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
if(event & FuriHalNfcEventListenerActive) {
|
||||
st25r3916_set_reg_bits(
|
||||
@@ -131,7 +131,7 @@ static FuriHalNfcEvent furi_hal_nfc_iso14443_3a_listener_wait_event(uint32_t tim
|
||||
FuriHalNfcError furi_hal_nfc_iso14443a_poller_trx_short_frame(FuriHalNfcaShortFrame frame) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
// Disable crc check
|
||||
st25r3916_set_reg_bits(handle, ST25R3916_REG_AUX, ST25R3916_REG_AUX_no_crc_rx);
|
||||
@@ -185,7 +185,7 @@ FuriHalNfcError
|
||||
furi_check(tx_data);
|
||||
|
||||
FuriHalNfcError err = FuriHalNfcErrorNone;
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
// Prepare tx
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_CLEAR_FIFO);
|
||||
@@ -220,7 +220,7 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_set_col_res_data(
|
||||
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
// Set 4 or 7 bytes UID
|
||||
if(uid_len == 4) {
|
||||
@@ -255,7 +255,7 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_set_col_res_data(
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_iso4443a_listener_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits) {
|
||||
FuriHalNfcError error = FuriHalNfcErrorNone;
|
||||
@@ -284,7 +284,7 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_tx_custom_parity(
|
||||
|
||||
furi_check(iso14443_3a_signal);
|
||||
|
||||
FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
const FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc;
|
||||
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_TRANSPARENT_MODE);
|
||||
// Reconfigure gpio for Transparent mode
|
||||
@@ -303,7 +303,7 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_tx_custom_parity(
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_iso14443_3a_listener_sleep(FuriHalSpiBusHandle* handle) {
|
||||
FuriHalNfcError furi_hal_nfc_iso14443_3a_listener_sleep(const FuriHalSpiBusHandle* handle) {
|
||||
// Enable auto collision resolution
|
||||
st25r3916_clear_reg_bits(
|
||||
handle, ST25R3916_REG_PASSIVE_TARGET, ST25R3916_REG_PASSIVE_TARGET_d_106_ac_a);
|
||||
@@ -313,7 +313,7 @@ FuriHalNfcError furi_hal_nfc_iso14443_3a_listener_sleep(FuriHalSpiBusHandle* han
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_iso14443_3a_listener_idle(FuriHalSpiBusHandle* handle) {
|
||||
FuriHalNfcError furi_hal_nfc_iso14443_3a_listener_idle(const FuriHalSpiBusHandle* handle) {
|
||||
// Enable auto collision resolution
|
||||
st25r3916_clear_reg_bits(
|
||||
handle, ST25R3916_REG_PASSIVE_TARGET, ST25R3916_REG_PASSIVE_TARGET_d_106_ac_a);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "furi_hal_nfc_i.h"
|
||||
#include "furi_hal_nfc_tech_i.h"
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443b_common_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443b_common_init(const FuriHalSpiBusHandle* handle) {
|
||||
// Common NFC-B settings, 106kbps
|
||||
|
||||
// 1st stage zero = 60kHz, 3rd stage zero = 200 kHz
|
||||
@@ -40,7 +40,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443b_common_init(FuriHalSpiBusHandle* h
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443b_poller_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443b_poller_init(const FuriHalSpiBusHandle* handle) {
|
||||
// Enable ISO14443B mode, AM modulation
|
||||
st25r3916_change_reg_bits(
|
||||
handle,
|
||||
@@ -84,7 +84,7 @@ static FuriHalNfcError furi_hal_nfc_iso14443b_poller_init(FuriHalSpiBusHandle* h
|
||||
return furi_hal_nfc_iso14443b_common_init(handle);
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443b_poller_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso14443b_poller_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ static void furi_hal_nfc_iso15693_poller_free(FuriHalNfcIso15693Poller* instance
|
||||
free(instance);
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_common_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_common_init(const FuriHalSpiBusHandle* handle) {
|
||||
// Common NFC-V settings, 26.48 kbps
|
||||
|
||||
// 1st stage zero = 12 kHz, 3rd stage zero = 80 kHz, low-pass = 600 kHz
|
||||
@@ -112,7 +112,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_common_init(FuriHalSpiBusHandle* ha
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_poller_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_poller_init(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(furi_hal_nfc_iso15693_poller == NULL);
|
||||
|
||||
furi_hal_nfc_iso15693_poller = furi_hal_nfc_iso15693_poller_alloc();
|
||||
@@ -141,7 +141,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_poller_init(FuriHalSpiBusHandle* ha
|
||||
return furi_hal_nfc_iso15693_common_init(handle);
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_poller_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_poller_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
furi_check(furi_hal_nfc_iso15693_poller);
|
||||
|
||||
@@ -238,7 +238,7 @@ static FuriHalNfcError iso15693_3_poller_decode_frame(
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_poller_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits) {
|
||||
FuriHalNfcIso15693Poller* instance = furi_hal_nfc_iso15693_poller;
|
||||
@@ -252,7 +252,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_poller_tx(
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_poller_rx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* rx_data,
|
||||
size_t rx_data_size,
|
||||
size_t* rx_bits) {
|
||||
@@ -284,14 +284,16 @@ static FuriHalNfcError furi_hal_nfc_iso15693_poller_rx(
|
||||
return error;
|
||||
}
|
||||
|
||||
static void furi_hal_nfc_iso15693_listener_transparent_mode_enter(FuriHalSpiBusHandle* handle) {
|
||||
static void
|
||||
furi_hal_nfc_iso15693_listener_transparent_mode_enter(const FuriHalSpiBusHandle* handle) {
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_TRANSPARENT_MODE);
|
||||
|
||||
furi_hal_spi_bus_handle_deinit(handle);
|
||||
furi_hal_nfc_deinit_gpio_isr();
|
||||
}
|
||||
|
||||
static void furi_hal_nfc_iso15693_listener_transparent_mode_exit(FuriHalSpiBusHandle* handle) {
|
||||
static void
|
||||
furi_hal_nfc_iso15693_listener_transparent_mode_exit(const FuriHalSpiBusHandle* handle) {
|
||||
// Configure gpio back to SPI and exit transparent mode
|
||||
furi_hal_nfc_init_gpio_isr();
|
||||
furi_hal_spi_bus_handle_init(handle);
|
||||
@@ -299,7 +301,7 @@ static void furi_hal_nfc_iso15693_listener_transparent_mode_exit(FuriHalSpiBusHa
|
||||
st25r3916_direct_cmd(handle, ST25R3916_CMD_UNMASK_RECEIVE_DATA);
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_listener_init(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_listener_init(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(furi_hal_nfc_iso15693_listener == NULL);
|
||||
|
||||
furi_hal_nfc_iso15693_listener = furi_hal_nfc_iso15693_listener_alloc();
|
||||
@@ -328,7 +330,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_listener_init(FuriHalSpiBusHandle*
|
||||
return error;
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_listener_deinit(FuriHalSpiBusHandle* handle) {
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_listener_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(furi_hal_nfc_iso15693_listener);
|
||||
|
||||
furi_hal_nfc_iso15693_listener_transparent_mode_exit(handle);
|
||||
@@ -387,7 +389,7 @@ static FuriHalNfcEvent furi_hal_nfc_iso15693_wait_event(uint32_t timeout_ms) {
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_listener_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_data,
|
||||
size_t tx_bits) {
|
||||
UNUSED(handle);
|
||||
@@ -407,7 +409,7 @@ FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof(void) {
|
||||
}
|
||||
|
||||
static FuriHalNfcError furi_hal_nfc_iso15693_listener_rx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* rx_data,
|
||||
size_t rx_data_size,
|
||||
size_t* rx_bits) {
|
||||
@@ -425,7 +427,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_listener_rx(
|
||||
return FuriHalNfcErrorNone;
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_iso15693_listener_sleep(FuriHalSpiBusHandle* handle) {
|
||||
FuriHalNfcError furi_hal_nfc_iso15693_listener_sleep(const FuriHalSpiBusHandle* handle) {
|
||||
UNUSED(handle);
|
||||
|
||||
return FuriHalNfcErrorNone;
|
||||
|
||||
@@ -25,7 +25,7 @@ extern "C" {
|
||||
* @param[in,out] handle pointer to the NFC chip SPI handle.
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
typedef FuriHalNfcError (*FuriHalNfcChipConfig)(FuriHalSpiBusHandle* handle);
|
||||
typedef FuriHalNfcError (*FuriHalNfcChipConfig)(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/**
|
||||
* @brief Transmit data using technology-specific framing and timings.
|
||||
@@ -36,7 +36,7 @@ typedef FuriHalNfcError (*FuriHalNfcChipConfig)(FuriHalSpiBusHandle* handle);
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
typedef FuriHalNfcError (
|
||||
*FuriHalNfcTx)(FuriHalSpiBusHandle* handle, const uint8_t* tx_data, size_t tx_bits);
|
||||
*FuriHalNfcTx)(const FuriHalSpiBusHandle* handle, const uint8_t* tx_data, size_t tx_bits);
|
||||
|
||||
/**
|
||||
* @brief Receive data using technology-specific framing and timings.
|
||||
@@ -48,7 +48,7 @@ typedef FuriHalNfcError (
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
typedef FuriHalNfcError (*FuriHalNfcRx)(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* rx_data,
|
||||
size_t rx_data_size,
|
||||
size_t* rx_bits);
|
||||
@@ -69,7 +69,7 @@ typedef FuriHalNfcEvent (*FuriHalNfcWaitEvent)(uint32_t timeout_ms);
|
||||
* @param[in,out] handle pointer to the NFC chip SPI handle.
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
typedef FuriHalNfcError (*FuriHalNfcSleep)(FuriHalSpiBusHandle* handle);
|
||||
typedef FuriHalNfcError (*FuriHalNfcSleep)(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/**
|
||||
* @brief Go to idle in listener mode.
|
||||
@@ -79,7 +79,7 @@ typedef FuriHalNfcError (*FuriHalNfcSleep)(FuriHalSpiBusHandle* handle);
|
||||
* @param[in,out] handle pointer to the NFC chip SPI handle.
|
||||
* @returns FuriHalNfcErrorNone on success, any other error code on failure.
|
||||
*/
|
||||
typedef FuriHalNfcError (*FuriHalNfcIdle)(FuriHalSpiBusHandle* handle);
|
||||
typedef FuriHalNfcError (*FuriHalNfcIdle)(const FuriHalSpiBusHandle* handle);
|
||||
|
||||
/**
|
||||
* @brief Technology-specific compenstaion values for pollers.
|
||||
@@ -160,7 +160,7 @@ extern const FuriHalNfcTechBase furi_hal_nfc_felica;
|
||||
* This variable is defined in furi_hal_nfc.c. It will need to be modified
|
||||
* in case when a new technology is to be added.
|
||||
*/
|
||||
extern const FuriHalNfcTechBase* furi_hal_nfc_tech[];
|
||||
extern const FuriHalNfcTechBase* const furi_hal_nfc_tech[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ typedef struct {
|
||||
} SD_CardInfo;
|
||||
|
||||
/** Pointer to currently used SPI Handle */
|
||||
FuriHalSpiBusHandle* furi_hal_sd_spi_handle = NULL;
|
||||
const FuriHalSpiBusHandle* furi_hal_sd_spi_handle = NULL;
|
||||
|
||||
static inline void sd_spi_select_card(void) {
|
||||
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, false);
|
||||
|
||||
@@ -38,17 +38,17 @@ void furi_hal_spi_bus_deinit(FuriHalSpiBus* bus) {
|
||||
bus->callback(bus, FuriHalSpiBusEventDeinit);
|
||||
}
|
||||
|
||||
void furi_hal_spi_bus_handle_init(FuriHalSpiBusHandle* handle) {
|
||||
void furi_hal_spi_bus_handle_init(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(handle);
|
||||
handle->callback(handle, FuriHalSpiBusHandleEventInit);
|
||||
}
|
||||
|
||||
void furi_hal_spi_bus_handle_deinit(FuriHalSpiBusHandle* handle) {
|
||||
void furi_hal_spi_bus_handle_deinit(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(handle);
|
||||
handle->callback(handle, FuriHalSpiBusHandleEventDeinit);
|
||||
}
|
||||
|
||||
void furi_hal_spi_acquire(FuriHalSpiBusHandle* handle) {
|
||||
void furi_hal_spi_acquire(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(handle);
|
||||
|
||||
furi_hal_power_insomnia_enter();
|
||||
@@ -62,7 +62,7 @@ void furi_hal_spi_acquire(FuriHalSpiBusHandle* handle) {
|
||||
handle->callback(handle, FuriHalSpiBusHandleEventActivate);
|
||||
}
|
||||
|
||||
void furi_hal_spi_release(FuriHalSpiBusHandle* handle) {
|
||||
void furi_hal_spi_release(const FuriHalSpiBusHandle* handle) {
|
||||
furi_check(handle);
|
||||
furi_check(handle->bus->current_handle == handle);
|
||||
|
||||
@@ -77,7 +77,7 @@ void furi_hal_spi_release(FuriHalSpiBusHandle* handle) {
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
static void furi_hal_spi_bus_end_txrx(FuriHalSpiBusHandle* handle, uint32_t timeout) {
|
||||
static void furi_hal_spi_bus_end_txrx(const FuriHalSpiBusHandle* handle, uint32_t timeout) {
|
||||
UNUSED(timeout); // FIXME
|
||||
while(LL_SPI_GetTxFIFOLevel(handle->bus->spi) != LL_SPI_TX_FIFO_EMPTY)
|
||||
;
|
||||
@@ -89,7 +89,7 @@ static void furi_hal_spi_bus_end_txrx(FuriHalSpiBusHandle* handle, uint32_t time
|
||||
}
|
||||
|
||||
bool furi_hal_spi_bus_rx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* buffer,
|
||||
size_t size,
|
||||
uint32_t timeout) {
|
||||
@@ -102,7 +102,7 @@ bool furi_hal_spi_bus_rx(
|
||||
}
|
||||
|
||||
bool furi_hal_spi_bus_tx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* buffer,
|
||||
size_t size,
|
||||
uint32_t timeout) {
|
||||
@@ -128,7 +128,7 @@ bool furi_hal_spi_bus_tx(
|
||||
}
|
||||
|
||||
bool furi_hal_spi_bus_trx(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
const uint8_t* tx_buffer,
|
||||
uint8_t* rx_buffer,
|
||||
size_t size,
|
||||
@@ -192,7 +192,7 @@ static void spi_dma_isr(void* context) {
|
||||
}
|
||||
|
||||
bool furi_hal_spi_bus_trx_dma(
|
||||
FuriHalSpiBusHandle* handle,
|
||||
const FuriHalSpiBusHandle* handle,
|
||||
uint8_t* tx_buffer,
|
||||
uint8_t* rx_buffer,
|
||||
size_t size,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user