diff --git a/.sublime-project b/.sublime-project index da2ef41a1..0ae007b34 100644 --- a/.sublime-project +++ b/.sublime-project @@ -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-*", diff --git a/.vscode/example/settings.json.tmpl b/.vscode/example/settings.json.tmpl index 5e0da6897..5e5b5dcf4 100644 --- a/.vscode/example/settings.json.tmpl +++ b/.vscode/example/settings.json.tmpl @@ -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", diff --git a/applications/main/ibutton/ibutton_cli.c b/applications/main/ibutton/ibutton_cli.c index 12e237e8a..dcac8f963 100644 --- a/applications/main/ibutton/ibutton_cli.c +++ b/applications/main/ibutton/ibutton_cli.c @@ -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); diff --git a/applications/main/ibutton/ibutton_i.h b/applications/main/ibutton/ibutton_i.h index d355a4ea5..454837e97 100644 --- a/applications/main/ibutton/ibutton_i.h +++ b/applications/main/ibutton/ibutton_i.h @@ -36,7 +36,7 @@ typedef enum { iButtonWriteModeInvalid, - iButtonWriteModeBlank, + iButtonWriteModeId, iButtonWriteModeCopy, } iButtonWriteMode; diff --git a/applications/main/ibutton/scenes/ibutton_scene_read_key_menu.c b/applications/main/ibutton/scenes/ibutton_scene_read_key_menu.c index 890e0a284..94ad4b69e 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_read_key_menu.c +++ b/applications/main/ibutton/scenes/ibutton_scene_read_key_menu.c @@ -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; diff --git a/applications/main/ibutton/scenes/ibutton_scene_saved_key_menu.c b/applications/main/ibutton/scenes/ibutton_scene_saved_key_menu.c index 668b79ae3..6727c5458 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_saved_key_menu.c +++ b/applications/main/ibutton/scenes/ibutton_scene_saved_key_menu.c @@ -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; diff --git a/applications/main/ibutton/scenes/ibutton_scene_write.c b/applications/main/ibutton/scenes/ibutton_scene_write.c index 0fc073fda..4525eae7b 100644 --- a/applications/main/ibutton/scenes/ibutton_scene_write.c +++ b/applications/main/ibutton/scenes/ibutton_scene_write.c @@ -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"); diff --git a/applications/services/cli/cli_commands.c b/applications/services/cli/cli_commands.c index 1604f4389..8fe5643af 100644 --- a/applications/services/cli/cli_commands.c +++ b/applications/services/cli/cli_commands.c @@ -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 \t - Set heap allocation tracking mode\r\n"); #else printf("\theap_track \t - Set heap allocation tracking mode\r\n"); diff --git a/applications/services/desktop/views/desktop_view_locked.c b/applications/services/desktop/views/desktop_view_locked.c index 74b020f45..2fb89b27e 100644 --- a/applications/services/desktop/views/desktop_view_locked.c +++ b/applications/services/desktop/views/desktop_view_locked.c @@ -1,12 +1,11 @@ -#include -#include #include + #include #include #include + #include -#include #include "../desktop_i.h" #include "desktop_view_locked.h" diff --git a/applications/services/desktop/views/desktop_view_pin_timeout.c b/applications/services/desktop/views/desktop_view_pin_timeout.c index 2811ba7d2..d7e5507a7 100644 --- a/applications/services/desktop/views/desktop_view_pin_timeout.c +++ b/applications/services/desktop/views/desktop_view_pin_timeout.c @@ -1,9 +1,5 @@ - #include -#include -#include -#include -#include + #include #include diff --git a/applications/services/power/power_service/views/power_off.c b/applications/services/power/power_service/views/power_off.c index 4da374b31..dbc233dde 100644 --- a/applications/services/power/power_service/views/power_off.c +++ b/applications/services/power/power_service/views/power_off.c @@ -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..."); diff --git a/applications/services/rpc/rpc.c b/applications/services/rpc/rpc.c index c2aa3e27c..d5cef52f0 100644 --- a/applications/services/rpc/rpc.c +++ b/applications/services/rpc/rpc.c @@ -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 diff --git a/applications/settings/system/system_settings.c b/applications/settings/system/system_settings.c index 29fe0cd48..8adb3f418 100644 --- a/applications/settings/system/system_settings.c +++ b/applications/settings/system/system_settings.c @@ -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 diff --git a/furi/core/string.h b/furi/core/string.h index bcdf9336c..2bfb60e49 100644 --- a/furi/core/string.h +++ b/furi/core/string.h @@ -1,7 +1,10 @@ -/** +/** Furi string container + * + * And various method to manipulate strings + * * @file string.h - * Furi string primitive */ + #pragma once #include @@ -14,66 +17,72 @@ extern "C" { #endif -/** - * @brief Furi string failure constant. - */ +/** Furi string failure constant. */ #define FURI_STRING_FAILURE ((size_t) - 1) -/** - * @brief Furi string primitive. - */ +/** Furi string primitive. */ typedef struct FuriString FuriString; //--------------------------------------------------------------------------- // Constructors //--------------------------------------------------------------------------- -/** - * @brief Allocate new FuriString. - * @return FuriString* +/** Allocate new FuriString. + * + * @return pointer to the instance of FuriString */ FuriString* furi_string_alloc(void); -/** - * @brief Allocate new FuriString and set it to string. +/** Allocate new FuriString and set it to string. + * * Allocate & Set the string a to the string. - * @param source - * @return FuriString* + * + * @param source The source FuriString instance + * + * @return pointer to the new instance of FuriString */ FuriString* furi_string_alloc_set(const FuriString* source); -/** - * @brief Allocate new FuriString and set it to C string. +/** Allocate new FuriString and set it to C string. + * * Allocate & Set the string a to the C string. - * @param cstr_source - * @return FuriString* + * + * @param cstr_source The C-string instance + * + * @return pointer to the new instance of FuriString */ FuriString* furi_string_alloc_set_str(const char cstr_source[]); -/** - * @brief Allocate new FuriString and printf to it. +/** Allocate new FuriString and printf to it. + * * Initialize and set a string to the given formatted value. - * @param format - * @param ... - * @return FuriString* + * + * @param format The printf format + * @param[in] ... args to format + * + * @return pointer to the new instance of FuriString */ FuriString* furi_string_alloc_printf(const char format[], ...) _ATTRIBUTE((__format__(__printf__, 1, 2))); -/** - * @brief Allocate new FuriString and printf to it. +/** Allocate new FuriString and printf to it. + * * Initialize and set a string to the given formatted value. - * @param format - * @param args - * @return FuriString* + * + * @param format The printf format + * @param args The format arguments + * + * @return pointer to the new instance of FuriString */ FuriString* furi_string_alloc_vprintf(const char format[], va_list args); -/** - * @brief Allocate new FuriString and move source string content to it. +/** Allocate new FuriString and move source string content to it. + * * Allocate the string, set it to the other one, and destroy the other one. - * @param source - * @return FuriString* + * + * @param source The source FuriString instance + * + * @return pointer to the new instance of FuriString */ FuriString* furi_string_alloc_move(FuriString* source); @@ -81,9 +90,9 @@ FuriString* furi_string_alloc_move(FuriString* source); // Destructors //--------------------------------------------------------------------------- -/** - * @brief Free FuriString. - * @param string +/** Free FuriString. + * + * @param string The FuriString instance to free */ void furi_string_free(FuriString* string); @@ -91,55 +100,63 @@ void furi_string_free(FuriString* string); // String memory management //--------------------------------------------------------------------------- -/** - * @brief Reserve memory for string. - * Modify the string capacity to be able to handle at least 'alloc' characters (including final null char). - * @param string - * @param size +/** Reserve memory for string. + * + * Modify the string capacity to be able to handle at least 'alloc' characters + * (including final null char). + * + * @param string The FuriString instance + * @param size The size to reserve */ void furi_string_reserve(FuriString* string, size_t size); -/** - * @brief Reset string. +/** Reset string. + * * Make the string empty. - * @param string + * + * @param string The FuriString instance */ void furi_string_reset(FuriString* string); -/** - * @brief Swap two strings. +/** Swap two strings. + * * Swap the two strings string_1 and string_2. - * @param string_1 - * @param string_2 + * + * @param string_1 The FuriString instance 1 + * @param string_2 The FuriString instance 2 */ void furi_string_swap(FuriString* string_1, FuriString* string_2); -/** - * @brief Move string_2 content to string_1. +/** Move string_2 content to string_1. + * * Set the string to the other one, and destroy the other one. - * @param string_1 - * @param string_2 + * + * @param string_1 The FuriString instance 1 + * @param string_2 The FuriString instance 2 */ void furi_string_move(FuriString* string_1, FuriString* string_2); -/** - * @brief Compute a hash for the string. - * @param string - * @return size_t +/** Compute a hash for the string. + * + * @param string The FuriString instance + * + * @return hash value */ size_t furi_string_hash(const FuriString* string); -/** - * @brief Get string size (usually length, but not for UTF-8) - * @param string - * @return size_t +/** Get string size (usually length, but not for UTF-8) + * + * @param string The FuriString instance + * + * @return size of the string */ size_t furi_string_size(const FuriString* string); -/** - * @brief Check that string is empty or not - * @param string - * @return bool +/** Check that string is empty or not + * + * @param string The FuriString instance + * + * @return true if empty otherwise false */ bool furi_string_empty(const FuriString* string); @@ -147,19 +164,22 @@ bool furi_string_empty(const FuriString* string); // Getters //--------------------------------------------------------------------------- -/** - * @brief Get the character at the given index. +/** Get the character at the given index. + * * Return the selected character of the string. - * @param string - * @param index - * @return char + * + * @param string The FuriString instance + * @param index The index + * + * @return character at index */ char furi_string_get_char(const FuriString* string, size_t index); -/** - * @brief Return the string view a classic C string. - * @param string - * @return const char* +/** Return the string view a classic C string. + * + * @param string The FuriString instance + * + * @return const C-string, usable till first container change */ const char* furi_string_get_cstr(const FuriString* string); @@ -167,63 +187,67 @@ const char* furi_string_get_cstr(const FuriString* string); // Setters //--------------------------------------------------------------------------- -/** - * @brief Set the string to the other string. +/** Set the string to the other string. + * * Set the string to the source string. - * @param string - * @param source + * + * @param string The FuriString instance + * @param source The source */ void furi_string_set(FuriString* string, FuriString* source); -/** - * @brief Set the string to the other C string. +/** Set the string to the other C string. + * * Set the string to the source C string. - * @param string - * @param source + * + * @param string The FuriString instance + * @param source The source */ void furi_string_set_str(FuriString* string, const char source[]); -/** - * @brief Set the string to the n first characters of the C string. - * @param string - * @param source - * @param length +/** Set the string to the n first characters of the C string. + * + * @param string The FuriString instance + * @param source The source + * @param length The length */ void furi_string_set_strn(FuriString* string, const char source[], size_t length); -/** - * @brief Set the character at the given index. - * @param string - * @param index - * @param c +/** Set the character at the given index. + * + * @param string The FuriString instance + * @param index The index + * @param c The character */ void furi_string_set_char(FuriString* string, size_t index, const char c); -/** - * @brief Set the string to the n first characters of other one. - * @param string - * @param source - * @param offset - * @param length +/** Set the string to the n first characters of other one. + * + * @param string The FuriString instance + * @param source The source + * @param offset The offset + * @param length The length */ void furi_string_set_n(FuriString* string, const FuriString* source, size_t offset, size_t length); -/** - * @brief Format in the string the given printf format - * @param string - * @param format - * @param ... - * @return int +/** Format in the string the given printf format + * + * @param string The string + * @param format The format + * @param[in] ... The args + * + * @return number of characters printed or negative value on error */ int furi_string_printf(FuriString* string, const char format[], ...) _ATTRIBUTE((__format__(__printf__, 2, 3))); -/** - * @brief Format in the string the given printf format - * @param string - * @param format - * @param args - * @return int +/** Format in the string the given printf format + * + * @param string The FuriString instance + * @param format The format + * @param args The arguments + * + * @return number of characters printed or negative value on error */ int furi_string_vprintf(FuriString* string, const char format[], va_list args); @@ -231,45 +255,49 @@ int furi_string_vprintf(FuriString* string, const char format[], va_list args); // Appending //--------------------------------------------------------------------------- -/** - * @brief Append a character to the string. - * @param string - * @param c +/** Append a character to the string. + * + * @param string The FuriString instance + * @param c The character */ void furi_string_push_back(FuriString* string, char c); -/** - * @brief Append a string to the string. +/** Append a string to the string. + * * Concatenate the string with the other string. - * @param string_1 - * @param string_2 + * + * @param string_1 The string 1 + * @param string_2 The string 2 */ void furi_string_cat(FuriString* string_1, const FuriString* string_2); -/** - * @brief Append a C string to the string. +/** Append a C string to the string. + * * Concatenate the string with the C string. - * @param string_1 - * @param cstring_2 + * + * @param string_1 The string 1 + * @param cstring_2 The cstring 2 */ void furi_string_cat_str(FuriString* string_1, const char cstring_2[]); -/** - * @brief Append to the string the formatted string of the given printf format. - * @param string - * @param format - * @param ... - * @return int +/** Append to the string the formatted string of the given printf format. + * + * @param string The string + * @param format The format + * @param[in] ... The args + * + * @return number of characters printed or negative value on error */ int furi_string_cat_printf(FuriString* string, const char format[], ...) _ATTRIBUTE((__format__(__printf__, 2, 3))); -/** - * @brief Append to the string the formatted string of the given printf format. - * @param string - * @param format - * @param args - * @return int +/** Append to the string the formatted string of the given printf format. + * + * @param string The FuriString instance + * @param format The format + * @param args The arguments + * + * @return number of characters printed or negative value on error */ int furi_string_cat_vprintf(FuriString* string, const char format[], va_list args); @@ -277,37 +305,45 @@ int furi_string_cat_vprintf(FuriString* string, const char format[], va_list arg // Comparators //--------------------------------------------------------------------------- -/** - * @brief Compare two strings and return the sort order. - * @param string_1 - * @param string_2 - * @return int +/** Compare two strings and return the sort order. + * + * @param string_1 The string 1 + * @param string_2 The string 2 + * + * @return zero if equal */ int furi_string_cmp(const FuriString* string_1, const FuriString* string_2); -/** - * @brief Compare string with C string and return the sort order. - * @param string_1 - * @param cstring_2 - * @return int +/** Compare string with C string and return the sort order. + * + * @param string_1 The string 1 + * @param cstring_2 The cstring 2 + * + * @return zero if equal */ int furi_string_cmp_str(const FuriString* string_1, const char cstring_2[]); -/** - * @brief Compare two strings (case insensitive according to the current locale) and return the sort order. +/** Compare two strings (case insensitive according to the current locale) and + * return the sort order. + * * Note: doesn't work with UTF-8 strings. - * @param string_1 - * @param string_2 - * @return int + * + * @param string_1 The string 1 + * @param string_2 The string 2 + * + * @return zero if equal */ int furi_string_cmpi(const FuriString* string_1, const FuriString* string_2); -/** - * @brief Compare string with C string (case insensitive according to the current locale) and return the sort order. +/** Compare string with C string (case insensitive according to the current + * locale) and return the sort order. + * * Note: doesn't work with UTF-8 strings. - * @param string_1 - * @param cstring_2 - * @return int + * + * @param string_1 The string 1 + * @param cstring_2 The cstring 2 + * + * @return zero if equal */ int furi_string_cmpi_str(const FuriString* string_1, const char cstring_2[]); @@ -315,46 +351,47 @@ int furi_string_cmpi_str(const FuriString* string_1, const char cstring_2[]); // Search //--------------------------------------------------------------------------- -/** - * @brief Search the first occurrence of the needle in the string from the position start. - * Return STRING_FAILURE if not found. - * By default, start is zero. - * @param string - * @param needle - * @param start - * @return size_t +/** Search the first occurrence of the needle in the string from the position + * start. + * + * @param string The FuriString instance + * @param needle The needle + * @param start The start (By default, start is zero) + * + * @return position or FURI_STRING_FAILURE if not found */ size_t furi_string_search(const FuriString* string, const FuriString* needle, size_t start); -/** - * @brief Search the first occurrence of the needle in the string from the position start. - * Return STRING_FAILURE if not found. - * @param string - * @param needle - * @param start - * @return size_t +/** Search the first occurrence of the needle in the string from the position + * start. + * + * @param string The FuriString instance + * @param needle The needle + * @param start The start (By default, start is zero) + * + * @return position or FURI_STRING_FAILURE if not found */ size_t furi_string_search_str(const FuriString* string, const char needle[], size_t start); -/** - * @brief Search for the position of the character c from the position start (include) in the string. - * Return STRING_FAILURE if not found. - * By default, start is zero. - * @param string - * @param c - * @param start - * @return size_t +/** Search for the position of the character c from the position start (include) + * in the string. + * + * @param string The FuriString instance + * @param c The character + * @param start The start (By default, start is zero) + * + * @return position or FURI_STRING_FAILURE if not found */ size_t furi_string_search_char(const FuriString* string, char c, size_t start); -/** - * @brief Reverse search for the position of the character c from the position start (include) in the string. - * Return STRING_FAILURE if not found. - * By default, start is zero. - * @param string - * @param c - * @param start - * @return size_t +/** Reverse search for the position of the character c from the position start + * (include) in the string. + * + * @param string The FuriString instance + * @param c The character + * @param start The start (By default, start is zero) + * + * @return position or FURI_STRING_FAILURE if not found */ size_t furi_string_search_rchar(const FuriString* string, char c, size_t start); @@ -362,19 +399,21 @@ size_t furi_string_search_rchar(const FuriString* string, char c, size_t start); // Equality //--------------------------------------------------------------------------- -/** - * @brief Test if two strings are equal. - * @param string_1 - * @param string_2 - * @return bool +/** Test if two strings are equal. + * + * @param string_1 The string 1 + * @param string_2 The string 2 + * + * @return true if equal false otherwise */ bool furi_string_equal(const FuriString* string_1, const FuriString* string_2); -/** - * @brief Test if the string is equal to the C string. - * @param string_1 - * @param cstring_2 - * @return bool +/** Test if the string is equal to the C string. + * + * @param string_1 The string 1 + * @param cstring_2 The cstring 2 + * + * @return true if equal false otherwise */ bool furi_string_equal_str(const FuriString* string_1, const char cstring_2[]); @@ -382,37 +421,38 @@ bool furi_string_equal_str(const FuriString* string_1, const char cstring_2[]); // Replace //--------------------------------------------------------------------------- -/** - * @brief Replace in the string the sub-string at position 'pos' for 'len' bytes into the C string 'replace'. - * @param string - * @param pos - * @param len - * @param replace +/** Replace in the string the sub-string at position 'pos' for 'len' bytes into + * the C string 'replace'. + * + * @param string The string + * @param pos The position + * @param len The length + * @param replace The replace */ void furi_string_replace_at(FuriString* string, size_t pos, size_t len, const char replace[]); -/** - * @brief Replace a string 'needle' to string 'replace' in a string from 'start' position. - * By default, start is zero. - * Return STRING_FAILURE if 'needle' not found or replace position. - * @param string - * @param needle - * @param replace - * @param start - * @return size_t +/** Replace a string 'needle' to string 'replace' in a string from 'start' + * position. + * + * @param string The string + * @param needle The needle + * @param replace The replace + * @param start The start (By default, start is zero) + * + * @return Return FURI_STRING_FAILURE if 'needle' not found or replace position. */ size_t furi_string_replace(FuriString* string, FuriString* needle, FuriString* replace, size_t start); -/** - * @brief Replace a C string 'needle' to C string 'replace' in a string from 'start' position. - * By default, start is zero. - * Return STRING_FAILURE if 'needle' not found or replace position. - * @param string - * @param needle - * @param replace - * @param start - * @return size_t +/** Replace a C string 'needle' to C string 'replace' in a string from 'start' + * position. + * + * @param string The string + * @param needle The needle + * @param replace The replace + * @param start The start (By default, start is zero) + * + * @return Return FURI_STRING_FAILURE if 'needle' not found or replace position. */ size_t furi_string_replace_str( FuriString* string, @@ -420,22 +460,22 @@ size_t furi_string_replace_str( const char replace[], size_t start); -/** - * @brief Replace all occurrences of 'needle' string into 'replace' string. - * @param string - * @param needle - * @param replace +/** Replace all occurrences of 'needle' string into 'replace' string. + * + * @param string The string + * @param needle The needle + * @param replace The replace */ void furi_string_replace_all( FuriString* string, const FuriString* needle, const FuriString* replace); -/** - * @brief Replace all occurrences of 'needle' C string into 'replace' C string. - * @param string - * @param needle - * @param replace +/** Replace all occurrences of 'needle' C string into 'replace' C string. + * + * @param string The string + * @param needle The needle + * @param replace The replace */ void furi_string_replace_all_str(FuriString* string, const char needle[], const char replace[]); @@ -443,35 +483,39 @@ void furi_string_replace_all_str(FuriString* string, const char needle[], const // Start / End tests //--------------------------------------------------------------------------- -/** - * @brief Test if the string starts with the given string. - * @param string - * @param start - * @return bool +/** Test if the string starts with the given string. + * + * @param string The FuriString instance + * @param start The FuriString instance + * + * @return true if string starts with */ bool furi_string_start_with(const FuriString* string, const FuriString* start); -/** - * @brief Test if the string starts with the given C string. - * @param string - * @param start - * @return bool +/** Test if the string starts with the given C string. + * + * @param string The FuriString instance + * @param start The start + * + * @return true if string starts with */ bool furi_string_start_with_str(const FuriString* string, const char start[]); -/** - * @brief Test if the string ends with the given string. - * @param string - * @param end - * @return bool +/** Test if the string ends with the given string. + * + * @param string The FuriString instance + * @param end The end + * + * @return true if string ends with */ bool furi_string_end_with(const FuriString* string, const FuriString* end); -/** - * @brief Test if the string ends with the given C string. - * @param string - * @param end - * @return bool +/** Test if the string ends with the given C string. + * + * @param string The FuriString instance + * @param end The end + * + * @return true if string ends with */ bool furi_string_end_with_str(const FuriString* string, const char end[]); @@ -479,33 +523,34 @@ bool furi_string_end_with_str(const FuriString* string, const char end[]); // Trim //--------------------------------------------------------------------------- -/** - * @brief Trim the string left to the first 'index' bytes. - * @param string - * @param index +/** Trim the string left to the first 'index' bytes. + * + * @param string The FuriString instance + * @param index The index */ void furi_string_left(FuriString* string, size_t index); -/** - * @brief Trim the string right from the 'index' position to the last position. - * @param string - * @param index +/** Trim the string right from the 'index' position to the last position. + * + * @param string The FuriString instance + * @param index The index */ void furi_string_right(FuriString* string, size_t index); -/** - * @brief Trim the string from position index to size bytes. +/** Trim the string from position index to size bytes. + * * See also furi_string_set_n. - * @param string - * @param index - * @param size + * + * @param string The FuriString instance + * @param index The index + * @param size The size */ void furi_string_mid(FuriString* string, size_t index, size_t size); -/** - * @brief Trim a string from the given set of characters (default is " \n\r\t"). - * @param string - * @param chars +/** Trim a string from the given set of characters (default is " \n\r\t"). + * + * @param string The FuriString instance + * @param chars The characters */ void furi_string_trim(FuriString* string, const char chars[]); @@ -513,28 +558,25 @@ void furi_string_trim(FuriString* string, const char chars[]); // UTF8 //--------------------------------------------------------------------------- -/** - * @brief An unicode value. - */ +/** An unicode value */ typedef unsigned int FuriStringUnicodeValue; -/** - * @brief Compute the length in UTF8 characters in the string. - * @param string - * @return size_t +/** Compute the length in UTF8 characters in the string. + * + * @param string The FuriString instance + * + * @return strings size */ size_t furi_string_utf8_length(FuriString* string); -/** - * @brief Push unicode into string, encoding it in UTF8. - * @param string - * @param unicode +/** Push unicode into string, encoding it in UTF8. + * + * @param string The string + * @param unicode The unicode */ void furi_string_utf8_push(FuriString* string, FuriStringUnicodeValue unicode); -/** - * @brief State of the UTF8 decoding machine state. - */ +/** State of the UTF8 decoding machine state */ typedef enum { FuriStringUTF8StateStarting, FuriStringUTF8StateDecoding1, @@ -543,14 +585,16 @@ typedef enum { FuriStringUTF8StateError } FuriStringUTF8State; -/** - * @brief Main generic UTF8 decoder. - * It takes a character, and the previous state and the previous value of the unicode value. - * It updates the state and the decoded unicode value. - * A decoded unicode encoded value is valid only when the state is FuriStringUTF8StateStarting. - * @param c - * @param state - * @param unicode +/** Main generic UTF8 decoder + * + * It takes a character, and the previous state and the previous value of the + * unicode value. It updates the state and the decoded unicode value. A decoded + * unicode encoded value is valid only when the state is + * FuriStringUTF8StateStarting. + * + * @param c The character + * @param state The state + * @param unicode The unicode */ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnicodeValue* unicode); @@ -565,76 +609,68 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico * func1 is the string function / func2 is the str function. */ -/** - * @brief Select for 1 argument - */ +/** Select for 1 argument */ #define FURI_STRING_SELECT1(func1, func2, a) \ _Generic((a), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \ a) -/** - * @brief Select for 2 arguments - */ +/** Select for 2 arguments */ #define FURI_STRING_SELECT2(func1, func2, a, b) \ _Generic((b), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \ a, b) -/** - * @brief Select for 3 arguments - */ +/** Select for 3 arguments */ #define FURI_STRING_SELECT3(func1, func2, a, b, c) \ _Generic((b), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \ a, b, c) -/** - * @brief Select for 4 arguments - */ +/** Select for 4 arguments */ #define FURI_STRING_SELECT4(func1, func2, a, b, c, d) \ _Generic((b), char*: func2, const char*: func2, FuriString*: func1, const FuriString*: func1)( \ a, b, c, d) -/** - * @brief Allocate new FuriString and set it content to string (or C string). +/** Allocate new FuriString and set it content to string (or C string). + * * ([c]string) */ #define furi_string_alloc_set(a) \ FURI_STRING_SELECT1(furi_string_alloc_set, furi_string_alloc_set_str, a) -/** - * @brief Set the string content to string (or C string). +/** Set the string content to string (or C string). + * * (string, [c]string) */ #define furi_string_set(a, b) FURI_STRING_SELECT2(furi_string_set, furi_string_set_str, a, b) -/** - * @brief Compare string with string (or C string) and return the sort order. +/** Compare string with string (or C string) and return the sort order. + * * Note: doesn't work with UTF-8 strings. * (string, [c]string) */ #define furi_string_cmp(a, b) FURI_STRING_SELECT2(furi_string_cmp, furi_string_cmp_str, a, b) -/** - * @brief Compare string with string (or C string) (case insensitive according to the current locale) and return the sort order. +/** Compare string with string (or C string) (case insensitive according to the current locale) and return the sort order. + * * Note: doesn't work with UTF-8 strings. * (string, [c]string) */ #define furi_string_cmpi(a, b) FURI_STRING_SELECT2(furi_string_cmpi, furi_string_cmpi_str, a, b) -/** - * @brief Test if the string is equal to the string (or C string). +/** Test if the string is equal to the string (or C string). + * * (string, [c]string) */ #define furi_string_equal(a, b) FURI_STRING_SELECT2(furi_string_equal, furi_string_equal_str, a, b) -/** - * @brief Replace all occurrences of string into string (or C string to another C string) in a string. +/** Replace all occurrences of string into string (or C string to another C string) in a string. + * * (string, [c]string, [c]string) */ #define furi_string_replace_all(a, b, c) \ FURI_STRING_SELECT3(furi_string_replace_all, furi_string_replace_all_str, a, b, c) -/** - * @brief Search for a string (or C string) in a string +/** Search for a string (or C string) in a string + * * (string, [c]string[, start=0]) */ #define furi_string_search(...) \ @@ -643,52 +679,52 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico furi_string_search, \ furi_string_search_str, \ M_DEFAULT_ARGS(3, (0), __VA_ARGS__)) -/** - * @brief Search for a C string in a string +/** Search for a C string in a string + * * (string, cstring[, start=0]) */ #define furi_string_search_str(...) furi_string_search_str(M_DEFAULT_ARGS(3, (0), __VA_ARGS__)) -/** - * @brief Test if the string starts with the given string (or C string). +/** Test if the string starts with the given string (or C string). + * * (string, [c]string) */ #define furi_string_start_with(a, b) \ FURI_STRING_SELECT2(furi_string_start_with, furi_string_start_with_str, a, b) -/** - * @brief Test if the string ends with the given string (or C string). +/** Test if the string ends with the given string (or C string). + * * (string, [c]string) */ #define furi_string_end_with(a, b) \ FURI_STRING_SELECT2(furi_string_end_with, furi_string_end_with_str, a, b) -/** - * @brief Append a string (or C string) to the string. +/** Append a string (or C string) to the string. + * * (string, [c]string) */ #define furi_string_cat(a, b) FURI_STRING_SELECT2(furi_string_cat, furi_string_cat_str, a, b) -/** - * @brief Trim a string from the given set of characters (default is " \n\r\t"). +/** Trim a string from the given set of characters (default is " \n\r\t"). + * * (string[, set=" \n\r\t"]) */ #define furi_string_trim(...) furi_string_trim(M_DEFAULT_ARGS(2, (" \n\r\t"), __VA_ARGS__)) -/** - * @brief Search for a character in a string. +/** Search for a character in a string. + * * (string, character[, start=0]) */ #define furi_string_search_char(...) furi_string_search_char(M_DEFAULT_ARGS(3, (0), __VA_ARGS__)) -/** - * @brief Reverse Search for a character in a string. +/** Reverse Search for a character in a string. + * * (string, character[, start=0]) */ #define furi_string_search_rchar(...) furi_string_search_rchar(M_DEFAULT_ARGS(3, (0), __VA_ARGS__)) -/** - * @brief Replace a string to another string (or C string to another C string) in a string. +/** Replace a string to another string (or C string to another C string) in a string. + * * (string, [c]string, [c]string[, start=0]) */ #define furi_string_replace(...) \ @@ -698,30 +734,22 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico furi_string_replace_str, \ M_DEFAULT_ARGS(4, (0), __VA_ARGS__)) -/** - * @brief Replace a C string to another C string in a string. +/** Replace a C string to another C string in a string. + * * (string, cstring, cstring[, start=0]) */ #define furi_string_replace_str(...) furi_string_replace_str(M_DEFAULT_ARGS(4, (0), __VA_ARGS__)) -/** - * @brief INIT OPLIST for FuriString. - */ +/** INIT OPLIST for FuriString */ #define F_STR_INIT(a) ((a) = furi_string_alloc()) -/** - * @brief INIT SET OPLIST for FuriString. - */ +/** INIT SET OPLIST for FuriString */ #define F_STR_INIT_SET(a, b) ((a) = furi_string_alloc_set(b)) -/** - * @brief INIT MOVE OPLIST for FuriString. - */ +/** INIT MOVE OPLIST for FuriString */ #define F_STR_INIT_MOVE(a, b) ((a) = furi_string_alloc_move(b)) -/** - * @brief OPLIST for FuriString. - */ +/** OPLIST for FuriString */ #define FURI_STRING_OPLIST \ (INIT(F_STR_INIT), \ INIT_SET(F_STR_INIT_SET), \ diff --git a/furi/furi.c b/furi/furi.c index dca674da5..f4e64ee09 100644 --- a/furi/furi.c +++ b/furi/furi.c @@ -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(); } diff --git a/furi/furi.h b/furi/furi.h index 80ee30457..d75debe98 100644 --- a/furi/furi.h +++ b/furi/furi.h @@ -2,8 +2,8 @@ #include -#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" diff --git a/lib/drivers/bq25896_reg.h b/lib/drivers/bq25896_reg.h index 23d094003..baadf6df2 100644 --- a/lib/drivers/bq25896_reg.h +++ b/lib/drivers/bq25896_reg.h @@ -3,8 +3,8 @@ #include #include -#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 diff --git a/lib/drivers/lp5562_reg.h b/lib/drivers/lp5562_reg.h index 9103e5395..a901cbada 100644 --- a/lib/drivers/lp5562_reg.h +++ b/lib/drivers/lp5562_reg.h @@ -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 diff --git a/lib/ibutton/ibutton_protocols.c b/lib/ibutton/ibutton_protocols.c index ecd5f9a0d..7955b0673 100644 --- a/lib/ibutton/ibutton_protocols.c +++ b/lib/ibutton/ibutton_protocols.c @@ -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) { diff --git a/lib/ibutton/ibutton_protocols.h b/lib/ibutton/ibutton_protocols.h index dd2afbd6e..b0c542352 100644 --- a/lib/ibutton/ibutton_protocols.h +++ b/lib/ibutton/ibutton_protocols.h @@ -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 diff --git a/lib/ibutton/ibutton_worker.c b/lib/ibutton/ibutton_worker.c index 2874f120f..ea6febd12 100644 --- a/lib/ibutton/ibutton_worker.c +++ b/lib/ibutton/ibutton_worker.c @@ -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); diff --git a/lib/ibutton/ibutton_worker.h b/lib/ibutton/ibutton_worker.h index 2a12a3194..6abacc3b6 100644 --- a/lib/ibutton/ibutton_worker.h +++ b/lib/ibutton/ibutton_worker.h @@ -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 diff --git a/lib/ibutton/ibutton_worker_i.h b/lib/ibutton/ibutton_worker_i.h index 5f259a38a..2b910bad8 100644 --- a/lib/ibutton/ibutton_worker_i.h +++ b/lib/ibutton/ibutton_worker_i.h @@ -25,7 +25,7 @@ typedef struct { typedef enum { iButtonWorkerModeIdle, iButtonWorkerModeRead, - iButtonWorkerModeWriteBlank, + iButtonWorkerModeWriteId, iButtonWorkerModeWriteCopy, iButtonWorkerModeEmulate, } iButtonWorkerMode; diff --git a/lib/ibutton/ibutton_worker_modes.c b/lib/ibutton/ibutton_worker_modes.c index 83e207de9..5900b10a2 100644 --- a/lib/ibutton/ibutton_worker_modes.c +++ b/lib/ibutton/ibutton_worker_modes.c @@ -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; diff --git a/lib/ibutton/protocols/dallas/protocol_dallas_base.h b/lib/ibutton/protocols/dallas/protocol_dallas_base.h index 05620329f..66eb42f15 100644 --- a/lib/ibutton/protocols/dallas/protocol_dallas_base.h +++ b/lib/ibutton/protocols/dallas/protocol_dallas_base.h @@ -25,7 +25,7 @@ typedef struct { const char* name; iButtonProtocolDallasReadWriteFunc read; - iButtonProtocolDallasReadWriteFunc write_blank; + iButtonProtocolDallasReadWriteFunc write_id; iButtonProtocolDallasReadWriteFunc write_copy; iButtonProtocolDallasEmulateFunc emulate; iButtonProtocolDallasSaveFunc save; diff --git a/lib/ibutton/protocols/dallas/protocol_ds1971.c b/lib/ibutton/protocols/dallas/protocol_ds1971.c index 64920f6ac..3a9e98641 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1971.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1971.c @@ -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; diff --git a/lib/ibutton/protocols/dallas/protocol_ds1990.c b/lib/ibutton/protocols/dallas/protocol_ds1990.c index 67e7545f4..5ed2171c6 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1990.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1990.c @@ -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)) || diff --git a/lib/ibutton/protocols/dallas/protocol_ds1992.c b/lib/ibutton/protocols/dallas/protocol_ds1992.c index 0b6cd4fca..05ea9a15c 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1992.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1992.c @@ -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) { diff --git a/lib/ibutton/protocols/dallas/protocol_ds1996.c b/lib/ibutton/protocols/dallas/protocol_ds1996.c index d78a303f8..12c91b001 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1996.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1996.c @@ -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; diff --git a/lib/ibutton/protocols/dallas/protocol_ds_generic.c b/lib/ibutton/protocols/dallas/protocol_ds_generic.c index 101db1dbe..128f20970 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds_generic.c +++ b/lib/ibutton/protocols/dallas/protocol_ds_generic.c @@ -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)); } diff --git a/lib/ibutton/protocols/dallas/protocol_group_dallas.c b/lib/ibutton/protocols/dallas/protocol_group_dallas.c index 7dad75669..634c9ab89 100644 --- a/lib/ibutton/protocols/dallas/protocol_group_dallas.c +++ b/lib/ibutton/protocols/dallas/protocol_group_dallas.c @@ -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, diff --git a/lib/ibutton/protocols/misc/protocol_group_misc.c b/lib/ibutton/protocols/misc/protocol_group_misc.c index ddbbf6bd8..95f34829a 100644 --- a/lib/ibutton/protocols/misc/protocol_group_misc.c +++ b/lib/ibutton/protocols/misc/protocol_group_misc.c @@ -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, diff --git a/lib/ibutton/protocols/protocol_common.h b/lib/ibutton/protocols/protocol_common.h index 5383158e4..52fa1589b 100644 --- a/lib/ibutton/protocols/protocol_common.h +++ b/lib/ibutton/protocols/protocol_common.h @@ -11,7 +11,7 @@ enum { typedef enum { iButtonProtocolFeatureExtData = (1U << 0), - iButtonProtocolFeatureWriteBlank = (1U << 1), + iButtonProtocolFeatureWriteId = (1U << 1), iButtonProtocolFeatureWriteCopy = (1U << 2), } iButtonProtocolFeature; diff --git a/lib/ibutton/protocols/protocol_group_base.h b/lib/ibutton/protocols/protocol_group_base.h index ef57fe0bc..bbd53e31e 100644 --- a/lib/ibutton/protocols/protocol_group_base.h +++ b/lib/ibutton/protocols/protocol_group_base.h @@ -84,7 +84,7 @@ typedef struct { iButtonProtocolGroupGetStringFunc get_name; iButtonProtocolGroupReadFunc read; - iButtonProtocolGroupWriteFunc write_blank; + iButtonProtocolGroupWriteFunc write_id; iButtonProtocolGroupWriteFunc write_copy; iButtonProtocolGroupApplyFunc emulate_start; diff --git a/lib/mjs/mjs_array.c b/lib/mjs/mjs_array.c index c74487d65..9230436e8 100644 --- a/lib/mjs/mjs_array.c +++ b/lib/mjs/mjs_array.c @@ -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; } diff --git a/scripts/toolchain/fbtenv.cmd b/scripts/toolchain/fbtenv.cmd index c0a3cd870..182ba9bb1 100644 --- a/scripts/toolchain/fbtenv.cmd +++ b/scripts/toolchain/fbtenv.cmd @@ -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%" diff --git a/scripts/toolchain/fbtenv.sh b/scripts/toolchain/fbtenv.sh index ed3d653d5..03df24ffd 100755 --- a/scripts/toolchain/fbtenv.sh +++ b/scripts/toolchain/fbtenv.sh @@ -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; diff --git a/scripts/ufbt/project_template/.vscode/settings.json b/scripts/ufbt/project_template/.vscode/settings.json index b93ad82f1..d304752a9 100644 --- a/scripts/ufbt/project_template/.vscode/settings.json +++ b/scripts/ufbt/project_template/.vscode/settings.json @@ -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", diff --git a/site_scons/cc.scons b/site_scons/cc.scons index 603ec621c..c5d99b896 100644 --- a/site_scons/cc.scons +++ b/site_scons/cc.scons @@ -28,6 +28,7 @@ ENV.AppendUnique( "-Wno-address-of-packed-member", "-Wredundant-decls", "-Wdouble-promotion", + "-Wundef", "-fdata-sections", "-ffunction-sections", "-fsingle-precision-constant", diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 7e254ce40..d2a145de5 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -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,, diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 6002ccbee..a34c3db0c 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -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* diff --git a/targets/f7/ble_glue/app_conf.h b/targets/f7/ble_glue/app_conf.h index 43be8129d..9ceb747c1 100644 --- a/targets/f7/ble_glue/app_conf.h +++ b/targets/f7/ble_glue/app_conf.h @@ -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 diff --git a/targets/f7/ble_glue/ble_conf.h b/targets/f7/ble_glue/ble_conf.h index 4c523a707..c34c54de6 100644 --- a/targets/f7/ble_glue/ble_conf.h +++ b/targets/f7/ble_glue/ble_conf.h @@ -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 diff --git a/targets/f7/furi_hal/furi_hal_interrupt.c b/targets/f7/furi_hal/furi_hal_interrupt.c index 35c40c259..cf10c8d33 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.c +++ b/targets/f7/furi_hal/furi_hal_interrupt.c @@ -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)); diff --git a/targets/f7/inc/FreeRTOSConfig.h b/targets/f7/inc/FreeRTOSConfig.h index 62310511d..2948faef9 100644 --- a/targets/f7/inc/FreeRTOSConfig.h +++ b/targets/f7/inc/FreeRTOSConfig.h @@ -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