mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
Merge remote-tracking branch 'OFW/dev' into dev
This commit is contained in:
commit
e74e6cdd02
45 changed files with 492 additions and 439 deletions
4
.sublime-project
vendored
4
.sublime-project
vendored
|
@ -10,10 +10,8 @@
|
|||
"clangd": {
|
||||
"enabled": true,
|
||||
"initializationOptions": {
|
||||
// Use with toolchain version 39+
|
||||
// Set `"binary": "custom",` option in LSP-clangd config to use toolchain clangd
|
||||
// "custom_command": ["toolchain/current/bin/clangd"],
|
||||
|
||||
"custom_command": ["toolchain/current/bin/clangd"],
|
||||
"clangd.compile-commands-dir": "build/latest",
|
||||
"clangd.header-insertion": "never",
|
||||
"clangd.query-driver": "**/arm-none-eabi-*",
|
||||
|
|
2
.vscode/example/settings.json.tmpl
vendored
2
.vscode/example/settings.json.tmpl
vendored
|
@ -12,7 +12,7 @@
|
|||
"SConstruct": "python",
|
||||
"*.fam": "python"
|
||||
},
|
||||
// "clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@",
|
||||
"clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@",
|
||||
"clangd.arguments": [
|
||||
"--query-driver=**/arm-none-eabi-*",
|
||||
"--compile-commands-dir=${workspaceFolder}/build/latest",
|
||||
|
|
|
@ -143,7 +143,7 @@ void ibutton_cli_write(Cli* cli, FuriString* args) {
|
|||
}
|
||||
|
||||
if(!(ibutton_protocols_get_features(protocols, ibutton_key_get_protocol_id(key)) &
|
||||
iButtonProtocolFeatureWriteBlank)) {
|
||||
iButtonProtocolFeatureWriteId)) {
|
||||
ibutton_cli_print_usage();
|
||||
break;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void ibutton_cli_write(Cli* cli, FuriString* args) {
|
|||
ibutton_cli_print_key(protocols, key);
|
||||
printf("Press Ctrl+C to abort\r\n");
|
||||
|
||||
ibutton_worker_write_blank_start(worker, key);
|
||||
ibutton_worker_write_id_start(worker, key);
|
||||
while(true) {
|
||||
uint32_t flags = furi_event_flag_wait(
|
||||
write_context.event, EVENT_FLAG_IBUTTON_COMPLETE, FuriFlagWaitAny, 100);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
typedef enum {
|
||||
iButtonWriteModeInvalid,
|
||||
iButtonWriteModeBlank,
|
||||
iButtonWriteModeId,
|
||||
iButtonWriteModeCopy,
|
||||
} iButtonWriteMode;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ typedef enum {
|
|||
SubmenuIndexSave,
|
||||
SubmenuIndexEmulate,
|
||||
SubmenuIndexViewData,
|
||||
SubmenuIndexWriteBlank,
|
||||
SubmenuIndexWriteId,
|
||||
SubmenuIndexWriteCopy,
|
||||
} SubmenuIndex;
|
||||
|
||||
|
@ -30,11 +30,11 @@ void ibutton_scene_read_key_menu_on_enter(void* context) {
|
|||
ibutton_scene_read_key_menu_submenu_callback,
|
||||
ibutton);
|
||||
|
||||
if(features & iButtonProtocolFeatureWriteBlank) {
|
||||
if(features & iButtonProtocolFeatureWriteId) {
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Write ID",
|
||||
SubmenuIndexWriteBlank,
|
||||
SubmenuIndexWriteId,
|
||||
ibutton_scene_read_key_menu_submenu_callback,
|
||||
ibutton);
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ bool ibutton_scene_read_key_menu_on_event(void* context, SceneManagerEvent event
|
|||
dolphin_deed(DolphinDeedIbuttonEmulate);
|
||||
} else if(event.event == SubmenuIndexViewData) {
|
||||
scene_manager_next_scene(scene_manager, iButtonSceneViewData);
|
||||
} else if(event.event == SubmenuIndexWriteBlank) {
|
||||
ibutton->write_mode = iButtonWriteModeBlank;
|
||||
} else if(event.event == SubmenuIndexWriteId) {
|
||||
ibutton->write_mode = iButtonWriteModeId;
|
||||
scene_manager_next_scene(scene_manager, iButtonSceneWrite);
|
||||
} else if(event.event == SubmenuIndexWriteCopy) {
|
||||
ibutton->write_mode = iButtonWriteModeCopy;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexEmulate,
|
||||
SubmenuIndexWriteBlank,
|
||||
SubmenuIndexWriteId,
|
||||
SubmenuIndexWriteCopy,
|
||||
SubmenuIndexEdit,
|
||||
SubmenuIndexRename,
|
||||
|
@ -20,9 +20,9 @@ void ibutton_scene_saved_key_menu_on_enter(void* context) {
|
|||
|
||||
submenu_add_item(submenu, "Emulate", SubmenuIndexEmulate, ibutton_submenu_callback, ibutton);
|
||||
|
||||
if(features & iButtonProtocolFeatureWriteBlank) {
|
||||
if(features & iButtonProtocolFeatureWriteId) {
|
||||
submenu_add_item(
|
||||
submenu, "Write ID", SubmenuIndexWriteBlank, ibutton_submenu_callback, ibutton);
|
||||
submenu, "Write ID", SubmenuIndexWriteId, ibutton_submenu_callback, ibutton);
|
||||
}
|
||||
|
||||
if(features & iButtonProtocolFeatureWriteCopy) {
|
||||
|
@ -55,8 +55,8 @@ bool ibutton_scene_saved_key_menu_on_event(void* context, SceneManagerEvent even
|
|||
if(event.event == SubmenuIndexEmulate) {
|
||||
scene_manager_next_scene(scene_manager, iButtonSceneEmulate);
|
||||
dolphin_deed(DolphinDeedIbuttonEmulate);
|
||||
} else if(event.event == SubmenuIndexWriteBlank) {
|
||||
ibutton->write_mode = iButtonWriteModeBlank;
|
||||
} else if(event.event == SubmenuIndexWriteId) {
|
||||
ibutton->write_mode = iButtonWriteModeId;
|
||||
scene_manager_next_scene(scene_manager, iButtonSceneWrite);
|
||||
} else if(event.event == SubmenuIndexWriteCopy) {
|
||||
ibutton->write_mode = iButtonWriteModeCopy;
|
||||
|
|
|
@ -51,9 +51,9 @@ void ibutton_scene_write_on_enter(void* context) {
|
|||
|
||||
ibutton_worker_write_set_callback(worker, ibutton_scene_write_callback, ibutton);
|
||||
|
||||
if(ibutton->write_mode == iButtonWriteModeBlank) {
|
||||
if(ibutton->write_mode == iButtonWriteModeId) {
|
||||
furi_string_set(tmp, "Writing ID");
|
||||
ibutton_worker_write_blank_start(worker, key);
|
||||
ibutton_worker_write_id_start(worker, key);
|
||||
|
||||
} else if(ibutton->write_mode == iButtonWriteModeCopy) {
|
||||
furi_string_set(tmp, "Full Writing");
|
||||
|
|
|
@ -270,7 +270,7 @@ void cli_command_sysctl_heap_track(Cli* cli, FuriString* args, void* context) {
|
|||
} else if(!furi_string_cmp(args, "main")) {
|
||||
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeMain);
|
||||
printf("Heap tracking enabled for application main thread");
|
||||
#if FURI_DEBUG
|
||||
#ifdef FURI_DEBUG
|
||||
} else if(!furi_string_cmp(args, "tree")) {
|
||||
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeTree);
|
||||
printf("Heap tracking enabled for application main and child threads");
|
||||
|
@ -289,7 +289,7 @@ void cli_command_sysctl_print_usage(void) {
|
|||
printf("Cmd list:\r\n");
|
||||
|
||||
printf("\tdebug <0|1>\t - Enable or disable system debug\r\n");
|
||||
#if FURI_DEBUG
|
||||
#ifdef FURI_DEBUG
|
||||
printf("\theap_track <none|main|tree|all>\t - Set heap allocation tracking mode\r\n");
|
||||
#else
|
||||
printf("\theap_track <none|main>\t - Set heap allocation tracking mode\r\n");
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include <projdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <furi.h>
|
||||
|
||||
#include <gui/elements.h>
|
||||
#include <gui/icon.h>
|
||||
#include <gui/view.h>
|
||||
|
||||
#include <assets_icons.h>
|
||||
|
||||
#include <desktop/desktop_settings.h>
|
||||
#include "../desktop_i.h"
|
||||
#include "desktop_view_locked.h"
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
#include <furi.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <projdefs.h>
|
||||
#include <input/input.h>
|
||||
|
||||
#include <gui/canvas.h>
|
||||
#include <gui/view.h>
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static void power_off_draw_callback(Canvas* canvas, void* _model) {
|
|||
elements_button_center(canvas, "OK");
|
||||
elements_button_right(canvas, "Hide");
|
||||
} else {
|
||||
snprintf(buff, sizeof(buff), "Charge me!\nDont't forget!");
|
||||
snprintf(buff, sizeof(buff), "Charge me!\nDon't forget!");
|
||||
elements_multiline_text_aligned(canvas, 70, 23, AlignLeft, AlignTop, buff);
|
||||
|
||||
canvas_draw_str_aligned(canvas, 64, 60, AlignCenter, AlignBottom, "Hold a second...");
|
||||
|
|
|
@ -228,7 +228,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) {
|
|||
}
|
||||
}
|
||||
|
||||
#if SRV_RPC_DEBUG
|
||||
#ifdef SRV_RPC_DEBUG
|
||||
rpc_debug_print_data("INPUT", buf, bytes_received);
|
||||
#endif
|
||||
|
||||
|
@ -268,7 +268,7 @@ static int32_t rpc_session_worker(void* context) {
|
|||
bool message_decode_failed = false;
|
||||
|
||||
if(pb_decode_ex(&istream, &PB_Main_msg, session->decoded_message, PB_DECODE_DELIMITED)) {
|
||||
#if SRV_RPC_DEBUG
|
||||
#ifdef SRV_RPC_DEBUG
|
||||
FURI_LOG_I(TAG, "INPUT:");
|
||||
rpc_debug_print_message(session->decoded_message);
|
||||
#endif
|
||||
|
@ -452,7 +452,7 @@ void rpc_send(RpcSession* session, PB_Main* message) {
|
|||
|
||||
pb_ostream_t ostream = PB_OSTREAM_SIZING;
|
||||
|
||||
#if SRV_RPC_DEBUG
|
||||
#ifdef SRV_RPC_DEBUG
|
||||
FURI_LOG_I(TAG, "OUTPUT:");
|
||||
rpc_debug_print_message(message);
|
||||
#endif
|
||||
|
@ -465,7 +465,7 @@ void rpc_send(RpcSession* session, PB_Main* message) {
|
|||
|
||||
pb_encode_ex(&ostream, &PB_Main_msg, message, PB_ENCODE_DELIMITED);
|
||||
|
||||
#if SRV_RPC_DEBUG
|
||||
#ifdef SRV_RPC_DEBUG
|
||||
rpc_debug_print_data("OUTPUT", buffer, ostream.bytes_written);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ static void debug_changed(VariableItem* item) {
|
|||
const char* const heap_trace_mode_text[] = {
|
||||
"None",
|
||||
"Main",
|
||||
#if FURI_DEBUG
|
||||
#ifdef FURI_DEBUG
|
||||
"Tree",
|
||||
"All",
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ const char* const heap_trace_mode_text[] = {
|
|||
const uint32_t heap_trace_mode_value[] = {
|
||||
FuriHalRtcHeapTrackModeNone,
|
||||
FuriHalRtcHeapTrackModeMain,
|
||||
#if FURI_DEBUG
|
||||
#ifdef FURI_DEBUG
|
||||
FuriHalRtcHeapTrackModeTree,
|
||||
FuriHalRtcHeapTrackModeAll,
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,13 +15,6 @@ void furi_run(void) {
|
|||
furi_check(!furi_kernel_is_irq_or_masked());
|
||||
furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED);
|
||||
|
||||
#if(__ARM_ARCH_7A__ == 0U)
|
||||
/* Service Call interrupt might be configured before kernel start */
|
||||
/* and when its priority is lower or equal to BASEPRI, svc instruction */
|
||||
/* causes a Hard Fault. */
|
||||
NVIC_SetPriority(SVCall_IRQn, 0U);
|
||||
#endif
|
||||
|
||||
/* Start the kernel scheduler */
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "core/check.h"
|
||||
#include "core/common_defines.h"
|
||||
#include "core/check.h"
|
||||
#include "core/event_loop.h"
|
||||
#include "core/event_loop_timer.h"
|
||||
#include "core/event_flag.h"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if BITS_BIG_ENDIAN == 1
|
||||
#error Bit structures defined in this file is not portable to BE
|
||||
#if defined(BITS_BIG_ENDIAN) && BITS_BIG_ENDIAN == 1
|
||||
#error Bit structures defined in this file are not portable to BE
|
||||
#endif
|
||||
|
||||
#define BQ25896_ADDRESS 0xD6
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#if BITS_BIG_ENDIAN == 1
|
||||
#error Bit structures defined in this file is not portable to BE
|
||||
#if defined(BITS_BIG_ENDIAN) && BITS_BIG_ENDIAN == 1
|
||||
#error Bit structures defined in this file are not portable to BE
|
||||
#endif
|
||||
|
||||
#define LP5562_ADDRESS 0x60
|
||||
|
|
|
@ -160,7 +160,7 @@ bool ibutton_protocols_read(iButtonProtocols* protocols, iButtonKey* key) {
|
|||
return id != iButtonProtocolIdInvalid;
|
||||
}
|
||||
|
||||
bool ibutton_protocols_write_blank(iButtonProtocols* protocols, iButtonKey* key) {
|
||||
bool ibutton_protocols_write_id(iButtonProtocols* protocols, iButtonKey* key) {
|
||||
furi_check(protocols);
|
||||
furi_check(key);
|
||||
|
||||
|
@ -168,7 +168,7 @@ bool ibutton_protocols_write_blank(iButtonProtocols* protocols, iButtonKey* key)
|
|||
iButtonProtocolData* data = ibutton_key_get_protocol_data(key);
|
||||
|
||||
GET_PROTOCOL_GROUP(id);
|
||||
return GROUP_BASE->write_blank(GROUP_DATA, data, PROTOCOL_ID);
|
||||
return GROUP_BASE->write_id(GROUP_DATA, data, PROTOCOL_ID);
|
||||
}
|
||||
|
||||
bool ibutton_protocols_write_copy(iButtonProtocols* protocols, iButtonKey* key) {
|
||||
|
|
|
@ -88,7 +88,7 @@ bool ibutton_protocols_read(iButtonProtocols* protocols, iButtonKey* key);
|
|||
* @param [in] key pointer to the key to be written
|
||||
* @return true on success, false on failure
|
||||
*/
|
||||
bool ibutton_protocols_write_blank(iButtonProtocols* protocols, iButtonKey* key);
|
||||
bool ibutton_protocols_write_id(iButtonProtocols* protocols, iButtonKey* key);
|
||||
|
||||
/**
|
||||
* Write the key to another one of the same type
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef enum {
|
|||
iButtonMessageEnd,
|
||||
iButtonMessageStop,
|
||||
iButtonMessageRead,
|
||||
iButtonMessageWriteBlank,
|
||||
iButtonMessageWriteId,
|
||||
iButtonMessageWriteCopy,
|
||||
iButtonMessageEmulate,
|
||||
iButtonMessageNotifyEmulate,
|
||||
|
@ -78,11 +78,11 @@ void ibutton_worker_read_start(iButtonWorker* worker, iButtonKey* key) {
|
|||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void ibutton_worker_write_blank_start(iButtonWorker* worker, iButtonKey* key) {
|
||||
void ibutton_worker_write_id_start(iButtonWorker* worker, iButtonKey* key) {
|
||||
furi_check(worker);
|
||||
furi_check(key);
|
||||
|
||||
iButtonMessage message = {.type = iButtonMessageWriteBlank, .data.key = key};
|
||||
iButtonMessage message = {.type = iButtonMessageWriteId, .data.key = key};
|
||||
|
||||
furi_check(
|
||||
furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk);
|
||||
|
@ -185,9 +185,9 @@ static int32_t ibutton_worker_thread(void* thread_context) {
|
|||
ibutton_worker_set_key_p(worker, message.data.key);
|
||||
ibutton_worker_switch_mode(worker, iButtonWorkerModeRead);
|
||||
break;
|
||||
case iButtonMessageWriteBlank:
|
||||
case iButtonMessageWriteId:
|
||||
ibutton_worker_set_key_p(worker, message.data.key);
|
||||
ibutton_worker_switch_mode(worker, iButtonWorkerModeWriteBlank);
|
||||
ibutton_worker_switch_mode(worker, iButtonWorkerModeWriteId);
|
||||
break;
|
||||
case iButtonMessageWriteCopy:
|
||||
ibutton_worker_set_key_p(worker, message.data.key);
|
||||
|
|
|
@ -84,7 +84,7 @@ void ibutton_worker_write_set_callback(
|
|||
* @param worker
|
||||
* @param key
|
||||
*/
|
||||
void ibutton_worker_write_blank_start(iButtonWorker* worker, iButtonKey* key);
|
||||
void ibutton_worker_write_id_start(iButtonWorker* worker, iButtonKey* key);
|
||||
|
||||
/**
|
||||
* Start write copy mode
|
||||
|
|
|
@ -25,7 +25,7 @@ typedef struct {
|
|||
typedef enum {
|
||||
iButtonWorkerModeIdle,
|
||||
iButtonWorkerModeRead,
|
||||
iButtonWorkerModeWriteBlank,
|
||||
iButtonWorkerModeWriteId,
|
||||
iButtonWorkerModeWriteCopy,
|
||||
iButtonWorkerModeEmulate,
|
||||
} iButtonWorkerMode;
|
||||
|
|
|
@ -20,7 +20,7 @@ static void ibutton_worker_mode_read_tick(iButtonWorker* worker);
|
|||
static void ibutton_worker_mode_read_stop(iButtonWorker* worker);
|
||||
|
||||
static void ibutton_worker_mode_write_common_start(iButtonWorker* worker);
|
||||
static void ibutton_worker_mode_write_blank_tick(iButtonWorker* worker);
|
||||
static void ibutton_worker_mode_write_id_tick(iButtonWorker* worker);
|
||||
static void ibutton_worker_mode_write_copy_tick(iButtonWorker* worker);
|
||||
static void ibutton_worker_mode_write_common_stop(iButtonWorker* worker);
|
||||
|
||||
|
@ -40,7 +40,7 @@ const iButtonWorkerModeType ibutton_worker_modes[] = {
|
|||
{
|
||||
.quant = 1000,
|
||||
.start = ibutton_worker_mode_write_common_start,
|
||||
.tick = ibutton_worker_mode_write_blank_tick,
|
||||
.tick = ibutton_worker_mode_write_id_tick,
|
||||
.stop = ibutton_worker_mode_write_common_stop,
|
||||
},
|
||||
{
|
||||
|
@ -123,10 +123,10 @@ void ibutton_worker_mode_write_common_start(iButtonWorker* worker) { //-V524
|
|||
furi_hal_power_enable_otg();
|
||||
}
|
||||
|
||||
void ibutton_worker_mode_write_blank_tick(iButtonWorker* worker) {
|
||||
void ibutton_worker_mode_write_id_tick(iButtonWorker* worker) {
|
||||
furi_assert(worker->key);
|
||||
|
||||
const bool success = ibutton_protocols_write_blank(worker->protocols, worker->key);
|
||||
const bool success = ibutton_protocols_write_id(worker->protocols, worker->key);
|
||||
// TODO FL-3527: pass a proper result to the callback
|
||||
const iButtonWorkerWriteResult result = success ? iButtonWorkerWriteOK :
|
||||
iButtonWorkerWriteNoDetect;
|
||||
|
|
|
@ -25,7 +25,7 @@ typedef struct {
|
|||
const char* name;
|
||||
|
||||
iButtonProtocolDallasReadWriteFunc read;
|
||||
iButtonProtocolDallasReadWriteFunc write_blank;
|
||||
iButtonProtocolDallasReadWriteFunc write_id;
|
||||
iButtonProtocolDallasReadWriteFunc write_copy;
|
||||
iButtonProtocolDallasEmulateFunc emulate;
|
||||
iButtonProtocolDallasSaveFunc save;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "dallas_common.h"
|
||||
|
||||
#include "../blanks/tm2004.h"
|
||||
|
||||
#define DS1971_FAMILY_CODE 0x14U
|
||||
#define DS1971_FAMILY_NAME "DS1971"
|
||||
|
||||
|
@ -31,6 +33,7 @@ typedef struct {
|
|||
} DS1971ProtocolData;
|
||||
|
||||
static bool dallas_ds1971_read(OneWireHost*, void*);
|
||||
static bool dallas_ds1971_write_id(OneWireHost*, iButtonProtocolData*);
|
||||
static bool dallas_ds1971_write_copy(OneWireHost*, iButtonProtocolData*);
|
||||
static void dallas_ds1971_emulate(OneWireSlave*, iButtonProtocolData*);
|
||||
static bool dallas_ds1971_load(FlipperFormat*, uint32_t, iButtonProtocolData*);
|
||||
|
@ -48,13 +51,14 @@ static bool ds1971_emulate_read_mem(OneWireSlave* bus, const uint8_t* data, size
|
|||
|
||||
const iButtonProtocolDallasBase ibutton_protocol_ds1971 = {
|
||||
.family_code = DS1971_FAMILY_CODE,
|
||||
.features = iButtonProtocolFeatureExtData | iButtonProtocolFeatureWriteCopy,
|
||||
.features = iButtonProtocolFeatureExtData | iButtonProtocolFeatureWriteId |
|
||||
iButtonProtocolFeatureWriteCopy,
|
||||
.data_size = sizeof(DS1971ProtocolData),
|
||||
.manufacturer = DALLAS_COMMON_MANUFACTURER_NAME,
|
||||
.name = DS1971_FAMILY_NAME,
|
||||
|
||||
.read = dallas_ds1971_read,
|
||||
.write_blank = NULL, // TODO FL-3531: Implement writing to blank
|
||||
.write_id = dallas_ds1971_write_id,
|
||||
.write_copy = dallas_ds1971_write_copy,
|
||||
.emulate = dallas_ds1971_emulate,
|
||||
.save = dallas_ds1971_save,
|
||||
|
@ -74,6 +78,11 @@ bool dallas_ds1971_read(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
|||
dallas_ds1971_read_mem(host, 0, data->eeprom_data, DS1971_EEPROM_DATA_SIZE);
|
||||
}
|
||||
|
||||
bool dallas_ds1971_write_id(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DS1971ProtocolData* data = protocol_data;
|
||||
return tm2004_write(host, data->rom_data.bytes, sizeof(DallasCommonRomData));
|
||||
}
|
||||
|
||||
bool dallas_ds1971_write_copy(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DS1971ProtocolData* data = protocol_data;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ typedef struct {
|
|||
} DS1990ProtocolData;
|
||||
|
||||
static bool dallas_ds1990_read(OneWireHost*, iButtonProtocolData*);
|
||||
static bool dallas_ds1990_write_blank(OneWireHost*, iButtonProtocolData*);
|
||||
static bool dallas_ds1990_write_id(OneWireHost*, iButtonProtocolData*);
|
||||
static void dallas_ds1990_emulate(OneWireSlave*, iButtonProtocolData*);
|
||||
static bool dallas_ds1990_load(FlipperFormat*, uint32_t, iButtonProtocolData*);
|
||||
static bool dallas_ds1990_save(FlipperFormat*, const iButtonProtocolData*);
|
||||
|
@ -36,13 +36,13 @@ static void dallas_ds1990_apply_edits(iButtonProtocolData*);
|
|||
|
||||
const iButtonProtocolDallasBase ibutton_protocol_ds1990 = {
|
||||
.family_code = DS1990_FAMILY_CODE,
|
||||
.features = iButtonProtocolFeatureWriteBlank,
|
||||
.features = iButtonProtocolFeatureWriteId,
|
||||
.data_size = sizeof(DS1990ProtocolData),
|
||||
.manufacturer = DALLAS_COMMON_MANUFACTURER_NAME,
|
||||
.name = DS1990_FAMILY_NAME,
|
||||
|
||||
.read = dallas_ds1990_read,
|
||||
.write_blank = dallas_ds1990_write_blank,
|
||||
.write_id = dallas_ds1990_write_id,
|
||||
.write_copy = NULL, /* No data to write a copy */
|
||||
.emulate = dallas_ds1990_emulate,
|
||||
.save = dallas_ds1990_save,
|
||||
|
@ -61,7 +61,7 @@ bool dallas_ds1990_read(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
|||
return onewire_host_reset(host) && dallas_common_read_rom(host, &data->rom_data);
|
||||
}
|
||||
|
||||
bool dallas_ds1990_write_blank(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
bool dallas_ds1990_write_id(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DS1990ProtocolData* data = protocol_data;
|
||||
|
||||
return rw1990_write_v1(host, data->rom_data.bytes, sizeof(DallasCommonRomData)) ||
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef struct {
|
|||
} DS1992ProtocolData;
|
||||
|
||||
static bool dallas_ds1992_read(OneWireHost*, void*);
|
||||
static bool dallas_ds1992_write_blank(OneWireHost*, iButtonProtocolData*);
|
||||
static bool dallas_ds1992_write_id(OneWireHost*, iButtonProtocolData*);
|
||||
static bool dallas_ds1992_write_copy(OneWireHost*, iButtonProtocolData*);
|
||||
static void dallas_ds1992_emulate(OneWireSlave*, iButtonProtocolData*);
|
||||
static bool dallas_ds1992_load(FlipperFormat*, uint32_t, iButtonProtocolData*);
|
||||
|
@ -46,14 +46,14 @@ static void dallas_ds1992_apply_edits(iButtonProtocolData*);
|
|||
|
||||
const iButtonProtocolDallasBase ibutton_protocol_ds1992 = {
|
||||
.family_code = DS1992_FAMILY_CODE,
|
||||
.features = iButtonProtocolFeatureExtData | iButtonProtocolFeatureWriteBlank |
|
||||
.features = iButtonProtocolFeatureExtData | iButtonProtocolFeatureWriteId |
|
||||
iButtonProtocolFeatureWriteCopy,
|
||||
.data_size = sizeof(DS1992ProtocolData),
|
||||
.manufacturer = DALLAS_COMMON_MANUFACTURER_NAME,
|
||||
.name = DS1992_FAMILY_NAME,
|
||||
|
||||
.read = dallas_ds1992_read,
|
||||
.write_blank = dallas_ds1992_write_blank,
|
||||
.write_id = dallas_ds1992_write_id,
|
||||
.write_copy = dallas_ds1992_write_copy,
|
||||
.emulate = dallas_ds1992_emulate,
|
||||
.save = dallas_ds1992_save,
|
||||
|
@ -73,10 +73,9 @@ bool dallas_ds1992_read(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
|||
dallas_common_read_mem(host, 0, data->sram_data, DS1992_SRAM_DATA_SIZE);
|
||||
}
|
||||
|
||||
bool dallas_ds1992_write_blank(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
bool dallas_ds1992_write_id(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DS1992ProtocolData* data = protocol_data;
|
||||
// TODO FL-3532: Make this work, currently broken
|
||||
return tm2004_write(host, (uint8_t*)data, sizeof(DallasCommonRomData) + DS1992_SRAM_DATA_SIZE);
|
||||
return tm2004_write(host, data->rom_data.bytes, sizeof(DallasCommonRomData));
|
||||
}
|
||||
|
||||
bool dallas_ds1992_write_copy(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "dallas_common.h"
|
||||
|
||||
#include "../blanks/tm2004.h"
|
||||
|
||||
#define DS1996_FAMILY_CODE 0x0CU
|
||||
#define DS1996_FAMILY_NAME "DS1996"
|
||||
|
||||
|
@ -29,6 +31,7 @@ typedef struct {
|
|||
} DS1996ProtocolData;
|
||||
|
||||
static bool dallas_ds1996_read(OneWireHost*, void*);
|
||||
static bool dallas_ds1996_write_id(OneWireHost*, iButtonProtocolData*);
|
||||
static bool dallas_ds1996_write_copy(OneWireHost*, iButtonProtocolData*);
|
||||
static void dallas_ds1996_emulate(OneWireSlave*, iButtonProtocolData*);
|
||||
static bool dallas_ds1996_load(FlipperFormat*, uint32_t, iButtonProtocolData*);
|
||||
|
@ -43,13 +46,14 @@ static void dallas_ds1996_apply_edits(iButtonProtocolData*);
|
|||
|
||||
const iButtonProtocolDallasBase ibutton_protocol_ds1996 = {
|
||||
.family_code = DS1996_FAMILY_CODE,
|
||||
.features = iButtonProtocolFeatureExtData | iButtonProtocolFeatureWriteCopy,
|
||||
.features = iButtonProtocolFeatureExtData | iButtonProtocolFeatureWriteId |
|
||||
iButtonProtocolFeatureWriteCopy,
|
||||
.data_size = sizeof(DS1996ProtocolData),
|
||||
.manufacturer = DALLAS_COMMON_MANUFACTURER_NAME,
|
||||
.name = DS1996_FAMILY_NAME,
|
||||
|
||||
.read = dallas_ds1996_read,
|
||||
.write_blank = NULL, /* Data too big for known blanks */
|
||||
.write_id = dallas_ds1996_write_id,
|
||||
.write_copy = dallas_ds1996_write_copy,
|
||||
.emulate = dallas_ds1996_emulate,
|
||||
.save = dallas_ds1996_save,
|
||||
|
@ -83,6 +87,11 @@ bool dallas_ds1996_read(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
|||
return success;
|
||||
}
|
||||
|
||||
bool dallas_ds1996_write_id(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DS1996ProtocolData* data = protocol_data;
|
||||
return tm2004_write(host, data->rom_data.bytes, sizeof(DallasCommonRomData));
|
||||
}
|
||||
|
||||
bool dallas_ds1996_write_copy(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DS1996ProtocolData* data = protocol_data;
|
||||
bool success = false;
|
||||
|
|
|
@ -20,7 +20,7 @@ typedef struct {
|
|||
} DallasGenericProtocolData;
|
||||
|
||||
static bool ds_generic_read(OneWireHost*, iButtonProtocolData*);
|
||||
static bool ds_generic_write_blank(OneWireHost*, iButtonProtocolData*);
|
||||
static bool ds_generic_write_id(OneWireHost*, iButtonProtocolData*);
|
||||
static void ds_generic_emulate(OneWireSlave*, iButtonProtocolData*);
|
||||
static bool ds_generic_load(FlipperFormat*, uint32_t, iButtonProtocolData*);
|
||||
static bool ds_generic_save(FlipperFormat*, const iButtonProtocolData*);
|
||||
|
@ -33,13 +33,13 @@ static void ds_generic_apply_edits(iButtonProtocolData*);
|
|||
|
||||
const iButtonProtocolDallasBase ibutton_protocol_ds_generic = {
|
||||
.family_code = DALLAS_GENERIC_FAMILY_CODE,
|
||||
.features = iButtonProtocolFeatureWriteBlank,
|
||||
.features = iButtonProtocolFeatureWriteId,
|
||||
.data_size = sizeof(DallasGenericProtocolData),
|
||||
.manufacturer = DALLAS_COMMON_MANUFACTURER_NAME,
|
||||
.name = DALLAS_GENERIC_FAMILY_NAME,
|
||||
|
||||
.read = ds_generic_read,
|
||||
.write_blank = ds_generic_write_blank,
|
||||
.write_id = ds_generic_write_id,
|
||||
.write_copy = NULL, /* No data to write a copy */
|
||||
.emulate = ds_generic_emulate,
|
||||
.save = ds_generic_save,
|
||||
|
@ -58,7 +58,7 @@ bool ds_generic_read(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
|||
return onewire_host_reset(host) && dallas_common_read_rom(host, &data->rom_data);
|
||||
}
|
||||
|
||||
bool ds_generic_write_blank(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
bool ds_generic_write_id(OneWireHost* host, iButtonProtocolData* protocol_data) {
|
||||
DallasGenericProtocolData* data = protocol_data;
|
||||
return tm2004_write(host, data->rom_data.bytes, sizeof(DallasCommonRomData));
|
||||
}
|
||||
|
|
|
@ -133,13 +133,13 @@ static bool ibutton_protocol_group_dallas_read(
|
|||
return success;
|
||||
}
|
||||
|
||||
static bool ibutton_protocol_group_dallas_write_blank(
|
||||
static bool ibutton_protocol_group_dallas_write_id(
|
||||
iButtonProtocolGroupDallas* group,
|
||||
iButtonProtocolData* data,
|
||||
iButtonProtocolLocalId id) {
|
||||
furi_assert(id < iButtonProtocolDSMax);
|
||||
const iButtonProtocolDallasBase* protocol = ibutton_protocols_dallas[id];
|
||||
furi_assert(protocol->features & iButtonProtocolFeatureWriteBlank);
|
||||
furi_assert(protocol->features & iButtonProtocolFeatureWriteId);
|
||||
|
||||
OneWireHost* host = group->host;
|
||||
|
||||
|
@ -148,7 +148,7 @@ static bool ibutton_protocol_group_dallas_write_blank(
|
|||
|
||||
FURI_CRITICAL_ENTER();
|
||||
|
||||
const bool success = protocol->write_blank(host, data);
|
||||
const bool success = protocol->write_id(host, data);
|
||||
onewire_host_stop(host);
|
||||
|
||||
FURI_CRITICAL_EXIT();
|
||||
|
@ -307,7 +307,7 @@ const iButtonProtocolGroupBase ibutton_protocol_group_dallas = {
|
|||
.get_name = (iButtonProtocolGroupGetStringFunc)ibutton_protocol_group_dallas_get_name,
|
||||
|
||||
.read = (iButtonProtocolGroupReadFunc)ibutton_protocol_group_dallas_read,
|
||||
.write_blank = (iButtonProtocolGroupWriteFunc)ibutton_protocol_group_dallas_write_blank,
|
||||
.write_id = (iButtonProtocolGroupWriteFunc)ibutton_protocol_group_dallas_write_id,
|
||||
.write_copy = (iButtonProtocolGroupWriteFunc)ibutton_protocol_group_dallas_write_copy,
|
||||
|
||||
.emulate_start = (iButtonProtocolGroupApplyFunc)ibutton_protocol_group_dallas_emulate_start,
|
||||
|
|
|
@ -284,7 +284,7 @@ const iButtonProtocolGroupBase ibutton_protocol_group_misc = {
|
|||
.get_name = (iButtonProtocolGroupGetStringFunc)ibutton_protocol_group_misc_get_name,
|
||||
|
||||
.read = (iButtonProtocolGroupReadFunc)ibutton_protocol_group_misc_read,
|
||||
.write_blank = NULL,
|
||||
.write_id = NULL,
|
||||
.write_copy = NULL,
|
||||
|
||||
.emulate_start = (iButtonProtocolGroupApplyFunc)ibutton_protocol_group_misc_emulate_start,
|
||||
|
|
|
@ -11,7 +11,7 @@ enum {
|
|||
|
||||
typedef enum {
|
||||
iButtonProtocolFeatureExtData = (1U << 0),
|
||||
iButtonProtocolFeatureWriteBlank = (1U << 1),
|
||||
iButtonProtocolFeatureWriteId = (1U << 1),
|
||||
iButtonProtocolFeatureWriteCopy = (1U << 2),
|
||||
} iButtonProtocolFeature;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef struct {
|
|||
iButtonProtocolGroupGetStringFunc get_name;
|
||||
|
||||
iButtonProtocolGroupReadFunc read;
|
||||
iButtonProtocolGroupWriteFunc write_blank;
|
||||
iButtonProtocolGroupWriteFunc write_id;
|
||||
iButtonProtocolGroupWriteFunc write_copy;
|
||||
|
||||
iButtonProtocolGroupApplyFunc emulate_start;
|
||||
|
|
|
@ -19,8 +19,11 @@
|
|||
static int v_sprintf_s(char* buf, size_t size, const char* fmt, ...) {
|
||||
size_t n;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
n = c_vsnprintf(buf, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if(n > size) {
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ if not ["%FBT_NOENV%"] == [""] (
|
|||
exit /b 0
|
||||
)
|
||||
|
||||
set "FLIPPER_TOOLCHAIN_VERSION=38"
|
||||
set "FLIPPER_TOOLCHAIN_VERSION=39"
|
||||
|
||||
if ["%FBT_TOOLCHAIN_PATH%"] == [""] (
|
||||
set "FBT_TOOLCHAIN_PATH=%FBT_ROOT%"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# public variables
|
||||
DEFAULT_SCRIPT_PATH="$(pwd -P)";
|
||||
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"38"}";
|
||||
FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"39"}";
|
||||
|
||||
if [ -z ${FBT_TOOLCHAIN_PATH+x} ] ; then
|
||||
FBT_TOOLCHAIN_PATH_WAS_SET=0;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"[python]": {
|
||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||
},
|
||||
// "clangd.path": "@UFBT_TOOLCHAIN_CLANGD@",
|
||||
"clangd.path": "@UFBT_TOOLCHAIN_CLANGD@",
|
||||
"clangd.arguments": [
|
||||
"--query-driver=**/arm-none-eabi-*",
|
||||
"--compile-commands-dir=${workspaceFolder}/.vscode",
|
||||
|
|
|
@ -28,6 +28,7 @@ ENV.AppendUnique(
|
|||
"-Wno-address-of-packed-member",
|
||||
"-Wredundant-decls",
|
||||
"-Wdouble-promotion",
|
||||
"-Wundef",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fsingle-precision-constant",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,69.0,,
|
||||
Version,+,70.0,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
|
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,69.0,,
|
||||
Version,+,70.0,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||
|
@ -1991,7 +1991,7 @@ Function,+,ibutton_protocols_render_data,void,"iButtonProtocols*, const iButtonK
|
|||
Function,+,ibutton_protocols_render_error,void,"iButtonProtocols*, const iButtonKey*, FuriString*"
|
||||
Function,+,ibutton_protocols_render_uid,void,"iButtonProtocols*, const iButtonKey*, FuriString*"
|
||||
Function,+,ibutton_protocols_save,_Bool,"iButtonProtocols*, const iButtonKey*, const char*"
|
||||
Function,+,ibutton_protocols_write_blank,_Bool,"iButtonProtocols*, iButtonKey*"
|
||||
Function,+,ibutton_protocols_write_id,_Bool,"iButtonProtocols*, iButtonKey*"
|
||||
Function,+,ibutton_protocols_write_copy,_Bool,"iButtonProtocols*, iButtonKey*"
|
||||
Function,+,ibutton_worker_alloc,iButtonWorker*,iButtonProtocols*
|
||||
Function,+,ibutton_worker_emulate_set_callback,void,"iButtonWorker*, iButtonWorkerEmulateCallback, void*"
|
||||
|
@ -2002,7 +2002,7 @@ Function,+,ibutton_worker_read_start,void,"iButtonWorker*, iButtonKey*"
|
|||
Function,+,ibutton_worker_start_thread,void,iButtonWorker*
|
||||
Function,+,ibutton_worker_stop,void,iButtonWorker*
|
||||
Function,+,ibutton_worker_stop_thread,void,iButtonWorker*
|
||||
Function,+,ibutton_worker_write_blank_start,void,"iButtonWorker*, iButtonKey*"
|
||||
Function,+,ibutton_worker_write_id_start,void,"iButtonWorker*, iButtonKey*"
|
||||
Function,+,ibutton_worker_write_copy_start,void,"iButtonWorker*, iButtonKey*"
|
||||
Function,+,ibutton_worker_write_set_callback,void,"iButtonWorker*, iButtonWorkerWriteCallback, void*"
|
||||
Function,+,icon_animation_alloc,IconAnimation*,const Icon*
|
||||
|
|
|
|
@ -194,3 +194,7 @@
|
|||
255 /**< Set to 255 with the memory manager and the mailbox */
|
||||
|
||||
#define TL_BLE_EVENT_FRAME_SIZE (TL_EVT_HDR_SIZE + CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE)
|
||||
|
||||
/* Various defines for compatibility with -Wundef - thanks, ST */
|
||||
#define CFG_DEBUG_TRACE_FULL 0
|
||||
#define CFG_DEBUG_TRACE_LIGHT 0
|
||||
|
|
|
@ -9,3 +9,15 @@
|
|||
#define BLE_CFG_SVC_MAX_NBR_CB 0
|
||||
|
||||
#define BLE_CFG_CLT_MAX_NBR_CB 0
|
||||
|
||||
/* Various defines for compatibility with -Wundef - thanks, ST */
|
||||
#define BLE_CFG_BLS_INTERMEDIATE_CUFF_PRESSURE 0
|
||||
#define BLE_CFG_BLS_TIME_STAMP_FLAG 0
|
||||
#define BLE_CFG_BLS_PULSE_RATE_FLAG 0
|
||||
#define BLE_CFG_BLS_USER_ID_FLAG 0
|
||||
#define BLE_CFG_BLS_MEASUREMENT_STATUS_FLAG 0
|
||||
#define BLE_CFG_HRS_ENERGY_EXPENDED_INFO_FLAG 0
|
||||
#define BLE_CFG_HRS_ENERGY_RR_INTERVAL_FLAG 0
|
||||
#define BLE_CFG_HTS_MEASUREMENT_INTERVAL 0
|
||||
#define BLE_CFG_HTS_TIME_STAMP_FLAG 0
|
||||
#define BLE_CFG_HTS_TEMPERATURE_TYPE_VALUE_STATIC 0
|
||||
|
|
|
@ -120,6 +120,7 @@ void furi_hal_interrupt_init(void) {
|
|||
TAMP_STAMP_LSECSS_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));
|
||||
NVIC_EnableIRQ(TAMP_STAMP_LSECSS_IRQn);
|
||||
|
||||
NVIC_SetPriority(SVCall_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));
|
||||
NVIC_SetPriority(PendSV_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0));
|
||||
|
||||
NVIC_SetPriority(FPU_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 15, 0));
|
||||
|
|
|
@ -17,11 +17,13 @@
|
|||
#define configUSE_PREEMPTION 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ (SystemCoreClock)
|
||||
#define configTICK_RATE_HZ_RAW 1000
|
||||
#define configTICK_RATE_HZ ((TickType_t)configTICK_RATE_HZ_RAW)
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configMAX_PRIORITIES (32)
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||
|
||||
|
@ -34,7 +36,6 @@
|
|||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
|
|
Loading…
Reference in a new issue