From 1a8f6dbed84271baff06ca75c806ae9c875d39ed Mon Sep 17 00:00:00 2001 From: hedger Date: Mon, 15 Jul 2024 04:56:21 +0300 Subject: [PATCH 1/3] toolchain: v38; clangd as default language server (#3774) * libs: removed cxxheaderparser submodule, expecting one from toolchain * toolchain: v38 * vscode: now using clangd from toolchain * vscode: clangd path in config is now generated by fbt * vscode, fbt: improved clangd path generation * fbt: fixed LANG_SERVER handling; switched to clangd as default * vscode: removed deprecated options from config * ufbt: project template: updated clang-format, added clangd config * ufbt: now using clangd as default language server * ufbt: now using clangd as default language server --- .gitignore | 3 - .gitmodules | 3 - .../{settings.json => settings.json.tmpl} | 8 +- SConstruct | 17 ++- lib/cxxheaderparser | 1 - scripts/fbt/sdk/collector.py | 10 +- scripts/toolchain/fbtenv.cmd | 2 +- scripts/toolchain/fbtenv.sh | 2 +- scripts/ufbt/SConstruct | 3 + scripts/ufbt/project_template/.clang-format | 126 +++++++++++++----- scripts/ufbt/project_template/.clangd | 17 +++ scripts/ufbt/project_template/.gitignore | 1 + .../project_template/.vscode/extensions.json | 3 +- .../project_template/.vscode/settings.json | 11 +- site_scons/commandline.scons | 2 +- site_scons/site_init.py | 1 - 16 files changed, 142 insertions(+), 68 deletions(-) rename .vscode/example/{settings.json => settings.json.tmpl} (72%) delete mode 160000 lib/cxxheaderparser create mode 100644 scripts/ufbt/project_template/.clangd diff --git a/.gitignore b/.gitignore index 56c836338..c97ba8da9 100644 --- a/.gitignore +++ b/.gitignore @@ -44,9 +44,6 @@ Brewfile.lock.json .sconsign.dblite -# Visual Studio Code -/.vscode - # bundle output /dist diff --git a/.gitmodules b/.gitmodules index c4c68a6a7..038bb57e6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,9 +23,6 @@ [submodule "lib/mbedtls"] path = lib/mbedtls url = https://github.com/Mbed-TLS/mbedtls.git -[submodule "lib/cxxheaderparser"] - path = lib/cxxheaderparser - url = https://github.com/robotpy/cxxheaderparser.git [submodule "lib/heatshrink"] path = lib/heatshrink url = https://github.com/flipperdevices/heatshrink.git diff --git a/.vscode/example/settings.json b/.vscode/example/settings.json.tmpl similarity index 72% rename from .vscode/example/settings.json rename to .vscode/example/settings.json.tmpl index 9afabf926..5e5b5dcf4 100644 --- a/.vscode/example/settings.json +++ b/.vscode/example/settings.json.tmpl @@ -1,11 +1,7 @@ { - "C_Cpp.default.cStandard": "gnu23", - "C_Cpp.default.cppStandard": "c++20", - "python.formatting.provider": "black", "workbench.tree.indent": 12, "cortex-debug.enableTelemetry": false, "cortex-debug.variableUseNaturalFormat": true, - "cortex-debug.showRTOS": true, "cortex-debug.armToolchainPath": "${workspaceFolder}/toolchain/current/bin", "cortex-debug.openocdPath": "${workspaceFolder}/toolchain/current/bin/openocd", "cortex-debug.gdbPath": "${workspaceFolder}/toolchain/current/bin/arm-none-eabi-gdb-py3", @@ -16,9 +12,9 @@ "SConstruct": "python", "*.fam": "python" }, + "clangd.path": "${workspaceFolder}/toolchain/current/bin/clangd@FBT_PLATFORM_EXECUTABLE_EXT@", "clangd.arguments": [ - // We might be able to tighten this a bit more to only include the correct toolchain. - "--query-driver=**", + "--query-driver=**/arm-none-eabi-*", "--compile-commands-dir=${workspaceFolder}/build/latest", "--clang-tidy", "--header-insertion=never" diff --git a/SConstruct b/SConstruct index 532c37b7f..89a337cd5 100644 --- a/SConstruct +++ b/SConstruct @@ -43,10 +43,10 @@ distenv = coreenv.Clone( "blackmagic", "jflash", "doxygen", + "textfile", ], ENV=os.environ, UPDATE_BUNDLE_DIR="dist/${DIST_DIR}/f${TARGET_HW}-update-${DIST_SUFFIX}", - VSCODE_LANG_SERVER=ARGUMENTS.get("LANG_SERVER", "cpptools"), ) firmware_env = distenv.AddFwProject( @@ -403,14 +403,23 @@ distenv.PhonyTarget( ) # Prepare vscode environment -VSCODE_LANG_SERVER = cmd_environment["LANG_SERVER"] vscode_dist = distenv.Install( "#.vscode", [ - distenv.Glob("#.vscode/example/*.json"), - distenv.Glob(f"#.vscode/example/{VSCODE_LANG_SERVER}/*.json"), + distenv.Glob("#.vscode/example/*.json", exclude="*.tmpl"), + distenv.Glob("#.vscode/example/${LANG_SERVER}/*.json"), ], ) +for template_file in distenv.Glob("#.vscode/example/*.tmpl"): + vscode_dist.append( + distenv.Substfile( + distenv.Dir("#.vscode").File(template_file.name.replace(".tmpl", "")), + template_file, + SUBST_DICT={ + "@FBT_PLATFORM_EXECUTABLE_EXT@": ".exe" if os.name == "nt" else "" + }, + ) + ) distenv.Precious(vscode_dist) distenv.NoClean(vscode_dist) distenv.Alias("vscode_dist", (vscode_dist, firmware_env["FW_CDB"])) diff --git a/lib/cxxheaderparser b/lib/cxxheaderparser deleted file mode 160000 index ba4222560..000000000 --- a/lib/cxxheaderparser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ba4222560fc1040670b1a917d5d357198e8ec5d6 diff --git a/scripts/fbt/sdk/collector.py b/scripts/fbt/sdk/collector.py index 1dd3bc4eb..5615f105e 100644 --- a/scripts/fbt/sdk/collector.py +++ b/scripts/fbt/sdk/collector.py @@ -38,7 +38,6 @@ from cxxheaderparser.types import ( from cxxheaderparser.parserstate import ( State, - EmptyBlockState, ClassBlockState, ExternBlockState, NamespaceBlockState, @@ -180,12 +179,6 @@ class SdkCxxVisitor: def on_include(self, state: State, filename: str) -> None: pass - def on_empty_block_start(self, state: EmptyBlockState) -> None: - pass - - def on_empty_block_end(self, state: EmptyBlockState) -> None: - pass - def on_extern_block_start(self, state: ExternBlockState) -> None: pass @@ -230,3 +223,6 @@ class SdkCxxVisitor: def on_class_end(self, state: ClassBlockState) -> None: pass + + def on_parse_start(self, state: NamespaceBlockState) -> None: + pass diff --git a/scripts/toolchain/fbtenv.cmd b/scripts/toolchain/fbtenv.cmd index 635affdd4..c0a3cd870 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=37" +set "FLIPPER_TOOLCHAIN_VERSION=38" if ["%FBT_TOOLCHAIN_PATH%"] == [""] ( set "FBT_TOOLCHAIN_PATH=%FBT_ROOT%" diff --git a/scripts/toolchain/fbtenv.sh b/scripts/toolchain/fbtenv.sh index 1093d8d2d..156fabcca 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:-"37"}"; +FBT_TOOLCHAIN_VERSION="${FBT_TOOLCHAIN_VERSION:-"38"}"; if [ -z ${FBT_TOOLCHAIN_PATH+x} ] ; then FBT_TOOLCHAIN_PATH_WAS_SET=0; diff --git a/scripts/ufbt/SConstruct b/scripts/ufbt/SConstruct index 26b1046ee..18c4d1cac 100644 --- a/scripts/ufbt/SConstruct +++ b/scripts/ufbt/SConstruct @@ -403,6 +403,9 @@ for template_file in project_template_dir.Dir(".vscode").glob("*"): "@UFBT_FIRMWARE_ELF@": PosixPathWrapper.fix_path( dist_env["FW_ELF"].abspath ), + "@UFBT_TOOLCHAIN_CLANGD@": PosixPathWrapper.fix_path( + dist_env.WhereIs("clangd") + ), }, ) ) diff --git a/scripts/ufbt/project_template/.clang-format b/scripts/ufbt/project_template/.clang-format index 4b76f7fa4..ad3484ba0 100644 --- a/scripts/ufbt/project_template/.clang-format +++ b/scripts/ufbt/project_template/.clang-format @@ -3,22 +3,55 @@ Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: AlwaysBreak AlignArrayOfStructures: None -AlignConsecutiveMacros: None -AlignConsecutiveAssignments: None -AlignConsecutiveBitFields: None -AlignConsecutiveDeclarations: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseColons: false AlignEscapedNewlines: Left AlignOperands: Align -AlignTrailingComments: false +AlignTrailingComments: + Kind: Never + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false -AllowShortEnumsOnASingleLine: true +AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: WithoutElse -AllowShortLoopsOnASingleLine: true +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false @@ -27,17 +60,18 @@ AttributeMacros: - __capability BinPackArguments: false BinPackParameters: false +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false AfterClass: false AfterControlStatement: Never AfterEnum: false + AfterExternBlock: false AfterFunction: false AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false AfterUnion: false - AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false @@ -46,33 +80,29 @@ BraceWrapping: SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: true -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeComma +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave BreakAfterJavaFieldAnnotations: false +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: false +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeColon BreakStringLiterals: false ColumnLimit: 99 CommentPragmas: '^ IWYU pragma:' -QualifierAlignment: Leave CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false -PackConstructorInitializers: BinPack -BasedOnStyle: '' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -AllowAllConstructorInitializersOnNextLine: true FixNamespaceComments: false ForEachMacros: - foreach @@ -97,19 +127,30 @@ IncludeCategories: IncludeIsMainRegex: '(Test)?$' IncludeIsMainSourceRegex: '' IndentAccessModifiers: false -IndentCaseLabels: false IndentCaseBlocks: false +IndentCaseLabels: false +IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: None -IndentExternBlock: AfterExternBlock -IndentRequires: false +IndentRequiresClause: false IndentWidth: 4 IndentWrappedFunctionNames: true +InsertBraces: false +InsertNewlineAtEOF: false InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -119,34 +160,44 @@ ObjCBlockIndentWidth: 4 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack PenaltyBreakAssignment: 10 PenaltyBreakBeforeFirstCallParameter: 30 PenaltyBreakComment: 10 PenaltyBreakFirstLessLess: 0 PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 PenaltyBreakString: 10 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 100 -PenaltyReturnTypeOnItsOwnLine: 60 PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Left PPIndentWidth: -1 +QualifierAlignment: Leave ReferenceAlignment: Pointer ReflowComments: false RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope SeparateDefinitionBlocks: Leave ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false SortIncludes: Never SortJavaStaticImport: Before -SortUsingDeclarations: false +SortUsingDeclarations: Never SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: Never SpaceBeforeParensOptions: AfterControlStatements: false @@ -155,23 +206,26 @@ SpaceBeforeParensOptions: AfterFunctionDeclarationName: false AfterIfMacros: false AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false BeforeNonEmptyParentheses: false -SpaceAroundPointerQualifiers: Default SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: Never -SpacesInConditionalStatement: false SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: -1 -SpacesInParentheses: false +SpacesInParens: Never +SpacesInParensOptions: + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both Standard: c++03 StatementAttributeLikeMacros: - Q_EMIT @@ -179,8 +233,8 @@ StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 4 -UseCRLF: false UseTab: Never +VerilogBreakBetweenInstancePorts: true WhitespaceSensitiveMacros: - STRINGIZE - PP_STRINGIZE diff --git a/scripts/ufbt/project_template/.clangd b/scripts/ufbt/project_template/.clangd new file mode 100644 index 000000000..12e13751d --- /dev/null +++ b/scripts/ufbt/project_template/.clangd @@ -0,0 +1,17 @@ +CompileFlags: + Add: + - -Wno-unknown-warning-option + - -Wno-format + Remove: + - -mword-relocations + +Diagnostics: + ClangTidy: + FastCheckFilter: None + +--- + +If: + PathMatch: .*\.h +Diagnostics: + UnusedIncludes: None diff --git a/scripts/ufbt/project_template/.gitignore b/scripts/ufbt/project_template/.gitignore index 81a8981f7..dd6a4750d 100644 --- a/scripts/ufbt/project_template/.gitignore +++ b/scripts/ufbt/project_template/.gitignore @@ -1,6 +1,7 @@ dist/* .vscode .clang-format +.clangd .editorconfig .env .ufbt diff --git a/scripts/ufbt/project_template/.vscode/extensions.json b/scripts/ufbt/project_template/.vscode/extensions.json index 9daefb430..dc92d3bbd 100644 --- a/scripts/ufbt/project_template/.vscode/extensions.json +++ b/scripts/ufbt/project_template/.vscode/extensions.json @@ -8,7 +8,7 @@ // List of extensions which should be recommended for users of this workspace. "recommendations": [ "ms-python.black-formatter", - "ms-vscode.cpptools", + "llvm-vs-code-extensions.vscode-clangd", "amiralizadeh9480.cpp-helper", "marus25.cortex-debug", "zxh404.vscode-proto3", @@ -18,6 +18,7 @@ // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [ "twxs.cmake", + "ms-vscode.cpptools", "ms-vscode.cmake-tools" ] } \ No newline at end of file diff --git a/scripts/ufbt/project_template/.vscode/settings.json b/scripts/ufbt/project_template/.vscode/settings.json index ce5210f5f..d304752a9 100644 --- a/scripts/ufbt/project_template/.vscode/settings.json +++ b/scripts/ufbt/project_template/.vscode/settings.json @@ -5,7 +5,6 @@ { "cortex-debug.enableTelemetry": false, "cortex-debug.variableUseNaturalFormat": false, - "cortex-debug.showRTOS": true, "cortex-debug.armToolchainPath": "@UFBT_TOOLCHAIN_ARM_TOOLCHAIN_DIR@", "cortex-debug.openocdPath": "@UFBT_TOOLCHAIN_OPENOCD@", "cortex-debug.gdbPath": "@UFBT_TOOLCHAIN_GDB_PY@", @@ -16,9 +15,15 @@ "SConstruct": "python", "*.fam": "python" }, - "cortex-debug.registerUseNaturalFormat": false, "python.analysis.typeCheckingMode": "off", "[python]": { "editor.defaultFormatter": "ms-python.black-formatter" - } + }, + "clangd.path": "@UFBT_TOOLCHAIN_CLANGD@", + "clangd.arguments": [ + "--query-driver=**/arm-none-eabi-*", + "--compile-commands-dir=${workspaceFolder}/.vscode", + "--clang-tidy", + "--header-insertion=never" + ] } \ No newline at end of file diff --git a/site_scons/commandline.scons b/site_scons/commandline.scons index 3ea5dcd6b..3eb9c9ff7 100644 --- a/site_scons/commandline.scons +++ b/site_scons/commandline.scons @@ -263,7 +263,7 @@ vars.AddVariables( EnumVariable( "LANG_SERVER", help="Language server type for vscode_dist.", - default="cpptools", + default="clangd", allowed_values=[ "cpptools", "clangd", diff --git a/site_scons/site_init.py b/site_scons/site_init.py index b763a3a7c..5b297e80e 100644 --- a/site_scons/site_init.py +++ b/site_scons/site_init.py @@ -6,7 +6,6 @@ import atexit from ansi.color import fg, fx sys.path.insert(0, os.path.join(os.getcwd(), "scripts")) -sys.path.insert(0, os.path.join(os.getcwd(), "lib/cxxheaderparser")) def bf_to_str(bf): From a5e89315ae2f16a5800078d52e7aae957542888f Mon Sep 17 00:00:00 2001 From: hedger Date: Mon, 15 Jul 2024 07:32:45 +0300 Subject: [PATCH 2/3] scripts: runfap: fixed starting apps with spaces in path (#3782) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- scripts/runfap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runfap.py b/scripts/runfap.py index b4b5989aa..a85d1e91a 100755 --- a/scripts/runfap.py +++ b/scripts/runfap.py @@ -88,7 +88,7 @@ class Main(App): return 4 self.logger.info(f"Launching app: {startup_command}") - storage.send_and_wait_eol(f"loader open {startup_command}\r") + storage.send_and_wait_eol(f'loader open "{startup_command}"\r') if len(result := storage.read.until(storage.CLI_EOL)): self.logger.error(f"Unexpected response: {result.decode('ascii')}") From ffa3996a5e0e0a3e79dda61b79ca6abbb39b7773 Mon Sep 17 00:00:00 2001 From: hedger Date: Mon, 15 Jul 2024 07:38:49 +0300 Subject: [PATCH 3/3] [FL-3867] Code formatting update (#3765) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * clang-format: AllowShortEnumsOnASingleLine: false * clang-format: InsertNewlineAtEOF: true * clang-format: Standard: c++20 * clang-format: AlignConsecutiveBitFields * clang-format: AlignConsecutiveMacros * clang-format: RemoveParentheses: ReturnStatement * clang-format: RemoveSemicolon: true * Restored RemoveParentheses: Leave, retained general changes for it * formatting: fixed logging TAGs * Formatting update for dev Co-authored-by: あく --- .clang-format | 21 +- .../battery_test_app/views/battery_info.c | 6 +- .../debug/bt_debug_app/views/bt_test.c | 2 +- .../debug/ccid_test/iso7816_callbacks.h | 2 +- .../debug/ccid_test/iso7816_response.c | 2 +- .../debug/ccid_test/iso7816_response.h | 12 +- .../debug/ccid_test/iso7816_t0_apdu.c | 2 +- .../debug/ccid_test/iso7816_t0_apdu.h | 4 +- .../debug/expansion_test/expansion_test.c | 4 +- .../scenes/file_browser_scene_browser.c | 2 +- .../debug/lfrfid_debug/lfrfid_debug.c | 2 +- .../debug/speaker_debug/speaker_debug.c | 1 + .../subghz_test/helpers/subghz_test_types.h | 4 +- .../debug/subghz_test/protocol/math.c | 2 +- .../debug/subghz_test/protocol/math.h | 2 +- .../protocol/princeton_for_testing.c | 10 +- applications/debug/uart_echo/uart_echo.c | 7 +- applications/debug/unit_tests/test_runner.c | 2 +- applications/debug/unit_tests/test_runner.h | 2 +- .../debug/unit_tests/tests/bt/bt_test.c | 2 +- .../unit_tests/tests/compress/compress_test.c | 4 +- .../tests/expansion/expansion_test.c | 4 +- .../flipper_format/flipper_format_test.c | 2 +- .../tests/furi_hal/furi_hal_tests.c | 10 +- .../unit_tests/tests/infrared/infrared_test.c | 2 +- .../tests/lfrfid/lfrfid_protocols.c | 20 +- applications/debug/unit_tests/tests/minunit.h | 6 +- .../debug/unit_tests/tests/nfc/nfc_test.c | 2 +- .../debug/unit_tests/tests/rpc/rpc_test.c | 21 +- .../unit_tests/tests/storage/storage_test.c | 2 +- .../unit_tests/tests/subghz/subghz_test.c | 13 +- .../debug/unit_tests/tests/test_api.h | 2 +- applications/debug/usb_mouse/usb_mouse.c | 2 +- .../drivers/subghz/cc1101_ext/cc1101_ext.c | 11 +- .../cc1101_ext/cc1101_ext_interconnect.c | 2 +- .../example_ble_beacon/ble_beacon_app.c | 2 +- .../example_plugins/plugin_interface.h | 2 +- .../app_api_interface.h | 2 +- .../app_api_table_i.h | 2 +- .../plugin_interface.h | 2 +- .../examples/example_thermo/example_thermo.c | 10 +- .../main/archive/helpers/archive_browser.c | 2 +- .../main/archive/helpers/archive_browser.h | 6 +- .../main/archive/helpers/archive_favorites.h | 2 +- .../archive/scenes/archive_scene_browser.c | 2 +- .../archive/scenes/archive_scene_delete.c | 2 +- .../archive/scenes/archive_scene_rename.c | 2 +- .../main/archive/views/archive_browser_view.c | 2 +- .../main/archive/views/archive_browser_view.h | 8 +- applications/main/bad_usb/bad_usb_app.c | 6 +- applications/main/bad_usb/bad_usb_app_i.h | 8 +- .../main/bad_usb/helpers/bad_usb_hid.c | 2 +- .../main/bad_usb/helpers/ducky_script.c | 9 +- .../bad_usb/helpers/ducky_script_commands.c | 3 +- .../main/bad_usb/helpers/ducky_script_i.h | 8 +- applications/main/gpio/usb_uart_bridge.c | 6 +- applications/main/ibutton/ibutton_cli.c | 6 +- applications/main/ibutton/ibutton_i.h | 4 +- applications/main/infrared/infrared_app.c | 6 +- applications/main/infrared/infrared_app_i.h | 10 +- applications/main/infrared/infrared_cli.c | 8 +- applications/main/infrared/infrared_remote.c | 2 +- applications/main/infrared/infrared_signal.c | 10 +- .../main/infrared/views/infrared_move_view.c | 8 +- applications/main/lfrfid/lfrfid_cli.c | 2 +- applications/main/lfrfid/lfrfid_i.h | 10 +- .../main/nfc/api/gallagher/gallagher_util.c | 2 +- .../main/nfc/api/gallagher/gallagher_util.h | 2 +- .../nfc/api/mosgortrans/mosgortrans_util.h | 2 +- applications/main/nfc/helpers/felica_auth.c | 2 +- .../main/nfc/helpers/mf_classic_key_cache.c | 2 +- applications/main/nfc/helpers/mf_user_dict.c | 2 +- .../main/nfc/helpers/nfc_supported_cards.c | 2 +- .../protocol_support/felica/felica_render.h | 2 +- .../protocol_support/mf_plus/mf_plus.c | 2 +- .../protocol_support/mf_plus/mf_plus.h | 2 +- .../mf_ultralight/mf_ultralight_render.h | 2 +- .../protocol_support/nfc_protocol_support.h | 2 +- .../nfc_protocol_support_unlock_helper.c | 2 +- .../nfc_protocol_support_unlock_helper.h | 2 +- applications/main/nfc/nfc_app_i.h | 16 +- .../nfc/plugins/supported_cards/gallagher.c | 2 +- .../main/nfc/plugins/supported_cards/hi.c | 5 +- .../nfc/plugins/supported_cards/microel.c | 3 +- .../main/nfc/plugins/supported_cards/mizip.c | 5 +- .../main/nfc/plugins/supported_cards/opal.c | 22 +- .../main/nfc/plugins/supported_cards/troika.c | 2 +- .../main/nfc/plugins/supported_cards/umarsh.c | 2 +- .../nfc/plugins/supported_cards/washcity.c | 2 +- .../nfc_scene_mf_classic_detect_reader.c | 2 +- ...ene_mf_classic_update_initial_wrong_card.c | 2 +- ...cene_mf_classic_write_initial_wrong_card.c | 2 +- .../nfc_scene_mf_ultralight_wrong_card.c | 2 +- applications/main/onewire/onewire_cli.c | 2 +- .../main/subghz/helpers/subghz_chat.c | 1 + .../subghz/helpers/subghz_threshold_rssi.c | 1 + .../main/subghz/helpers/subghz_txrx.c | 17 +- .../main/subghz/helpers/subghz_txrx.h | 2 +- .../helpers/subghz_txrx_create_protocol_key.h | 2 +- .../subghz/scenes/subghz_scene_read_raw.c | 3 +- applications/main/subghz/subghz_cli.c | 2 +- applications/main/subghz/subghz_history.c | 3 +- applications/main/subghz/subghz_i.c | 2 +- applications/main/subghz/views/receiver.c | 8 +- .../subghz/views/subghz_frequency_analyzer.c | 3 +- .../main/subghz/views/subghz_read_raw.c | 4 +- applications/main/u2f/u2f.c | 19 +- applications/main/u2f/u2f_data.c | 20 +- applications/main/u2f/u2f_hid.c | 29 +- applications/services/bt/bt_service/bt.c | 4 +- .../services/bt/bt_service/bt_keys_storage.c | 2 +- applications/services/bt/bt_settings.c | 4 +- applications/services/bt/bt_settings.h | 2 +- applications/services/cli/cli.c | 2 +- applications/services/cli/cli_commands.c | 2 +- applications/services/cli/cli_i.h | 2 +- applications/services/crypto/crypto_cli.c | 2 +- .../desktop/animations/animation_manager.c | 24 +- .../desktop/animations/animation_storage.c | 7 +- applications/services/desktop/desktop_i.h | 2 +- .../services/desktop/desktop_settings.h | 8 +- .../services/desktop/helpers/slideshow.c | 2 +- .../desktop/scenes/desktop_scene_config.h | 2 +- .../services/desktop/scenes/desktop_scene_i.h | 2 +- .../desktop/scenes/desktop_scene_locked.c | 2 +- .../desktop/scenes/desktop_scene_pin_input.c | 2 +- .../desktop/views/desktop_view_locked.c | 8 +- .../desktop/views/desktop_view_pin_input.c | 4 +- .../desktop/views/desktop_view_slideshow.c | 4 +- applications/services/dolphin/dolphin.c | 16 +- .../services/dolphin/helpers/dolphin_state.c | 12 +- .../services/expansion/expansion_settings.c | 4 +- .../services/expansion/expansion_worker.c | 2 +- applications/services/gui/elements.h | 6 +- applications/services/gui/gui_i.h | 20 +- .../services/gui/modules/button_menu.c | 8 +- .../services/gui/modules/button_panel.c | 2 +- .../services/gui/modules/file_browser.c | 8 +- .../gui/modules/file_browser_worker.c | 12 +- applications/services/gui/modules/menu.c | 2 +- applications/services/gui/modules/text_box.c | 8 +- .../services/gui/modules/text_input.c | 6 +- .../modules/widget_elements/widget_element.h | 2 +- .../widget_elements/widget_element_i.h | 2 +- applications/services/input/input.c | 6 +- applications/services/input/input.h | 4 +- .../loader/firmware_api/firmware_api.cpp | 2 +- applications/services/loader/loader.c | 1 + applications/services/loader/loader.h | 2 +- .../services/loader/loader_applications.c | 2 +- .../services/loader/loader_applications.h | 2 +- applications/services/loader/loader_menu.c | 4 +- applications/services/loader/loader_menu.h | 2 +- applications/services/locale/locale.c | 2 +- .../services/notification/notification_app.c | 19 +- .../services/notification/notification_app.h | 4 +- .../notification/notification_app_api.c | 8 +- .../services/power/power_service/power.c | 3 +- applications/services/rpc/rpc.c | 2 +- applications/services/rpc/rpc_desktop.c | 2 +- applications/services/rpc/rpc_i.h | 2 +- applications/services/rpc/rpc_property.c | 2 +- .../services/storage/filesystem_api.c | 4 +- applications/services/storage/storage.c | 2 +- applications/services/storage/storage.h | 16 +- applications/services/storage/storage_cli.c | 8 +- .../services/storage/storage_external_api.c | 16 +- applications/services/storage/storage_glue.h | 7 +- applications/services/storage/storage_i.h | 2 +- .../services/storage/storages/storage_ext.c | 18 +- .../services/storage/storages/storage_int.c | 25 +- .../scenes/desktop_settings_scene_config.h | 2 +- .../scenes/desktop_settings_scene_favorite.c | 14 +- .../scenes/desktop_settings_scene_i.h | 6 +- .../scenes/desktop_settings_scene_pin_auth.c | 4 +- .../scenes/desktop_settings_scene_pin_menu.c | 4 +- .../scenes/desktop_settings_scene_pin_setup.c | 6 +- .../desktop_settings_scene_quick_apps_menu.c | 2 +- .../settings/dolphin_passport/passport.c | 2 +- .../power_settings_app/power_settings_app.h | 5 +- .../power_settings_app/views/battery_info.c | 6 +- .../scenes/storage_settings_scene_benchmark.c | 6 +- applications/system/hid_app/views.h | 2 +- .../system/hid_app/views/hid_keyboard.c | 12 +- applications/system/hid_app/views/hid_mouse.h | 2 +- .../system/hid_app/views/hid_mouse_clicker.c | 1 + .../system/hid_app/views/hid_mouse_jiggler.h | 2 +- applications/system/js_app/js_modules.c | 2 +- applications/system/js_app/js_modules.h | 2 +- .../system/js_app/modules/js_badusb.c | 2 +- applications/system/js_app/modules/js_math.c | 4 +- .../system/js_app/modules/js_notification.c | 2 +- .../system/js_app/modules/js_serial.c | 7 +- .../system/js_app/modules/js_textbox.c | 2 +- .../js_app/plugin_api/app_api_interface.h | 2 +- .../system/js_app/plugin_api/js_plugin_api.h | 2 +- .../system/js_app/views/console_view.c | 8 +- .../storage_move_to_sd/storage_move_to_sd.c | 2 +- .../system/updater/util/update_task.h | 2 +- .../system/updater/util/update_task_i.h | 2 +- .../updater/util/update_task_worker_flasher.c | 10 +- furi/core/check.h | 2 +- furi/core/core_defines.h | 2 +- furi/core/critical.c | 2 +- furi/core/event_flag.c | 2 +- furi/core/kernel.c | 12 +- furi/core/log.h | 12 +- furi/core/memmgr.c | 2 +- furi/core/memmgr_heap.c | 2 +- furi/core/message_queue.c | 4 +- furi/core/stream_buffer.c | 18 +- furi/core/thread.c | 4 +- furi/core/thread_list.c | 2 +- lib/app-scened-template/record_controller.hpp | 2 +- lib/app-scened-template/typeindex_no_rtti.hpp | 3 +- lib/app-scened-template/view_controller.hpp | 2 +- lib/bit_lib/bit_lib.c | 2 +- lib/datetime/datetime.c | 8 +- lib/digital_signal/digital_sequence.c | 2 +- lib/digital_signal/digital_signal_i.h | 2 +- .../presets/nfc/iso14443_3a_signal.c | 8 +- .../presets/nfc/iso15693_signal.c | 12 +- lib/drivers/bq25896_reg.h | 156 +- lib/drivers/bq27220.h | 46 +- lib/drivers/bq27220_data_memory.h | 22 +- lib/drivers/bq27220_reg.h | 122 +- lib/drivers/cc1101.c | 2 +- lib/drivers/cc1101_regs.h | 118 +- lib/drivers/lp5562_reg.h | 42 +- lib/drivers/st25r3916.h | 2 +- lib/drivers/st25r3916_reg.c | 2 +- lib/drivers/st25r3916_reg.h | 1264 ++++++++--------- lib/flipper_format/flipper_format_stream.c | 6 +- lib/ibutton/ibutton_protocols.c | 4 +- lib/ibutton/protocols/blanks/rw1990.c | 8 +- lib/ibutton/protocols/blanks/tm2004.c | 8 +- lib/ibutton/protocols/dallas/dallas_common.c | 8 +- lib/ibutton/protocols/dallas/dallas_common.h | 14 +- .../protocols/dallas/protocol_ds1971.c | 6 +- .../protocols/dallas/protocol_ds1992.c | 6 +- .../protocols/dallas/protocol_ds1996.c | 6 +- lib/ibutton/protocols/misc/protocol_cyfral.c | 10 +- lib/ibutton/protocols/misc/protocol_metakom.c | 10 +- lib/infrared/encoder_decoder/infrared.h | 2 +- .../kaseikyo/infrared_protocol_kaseikyo_i.h | 32 +- .../nec/infrared_protocol_nec_i.h | 30 +- .../pioneer/infrared_protocol_pioneer_i.h | 26 +- .../rc5/infrared_protocol_rc5_i.h | 16 +- .../rc6/infrared_protocol_rc6_i.h | 16 +- .../rca/infrared_protocol_rca_i.h | 28 +- .../samsung/infrared_protocol_samsung_i.h | 32 +- .../sirc/infrared_protocol_sirc_i.h | 26 +- lib/infrared/worker/infrared_worker.c | 10 +- lib/lfrfid/lfrfid_dict_file.c | 2 +- lib/lfrfid/lfrfid_dict_file.h | 2 +- lib/lfrfid/lfrfid_raw_file.c | 6 +- lib/lfrfid/lfrfid_raw_worker.c | 4 +- lib/lfrfid/lfrfid_raw_worker.h | 2 +- lib/lfrfid/lfrfid_worker.c | 2 +- lib/lfrfid/lfrfid_worker_modes.c | 14 +- lib/lfrfid/protocols/protocol_awid.c | 28 +- lib/lfrfid/protocols/protocol_awid.h | 2 +- lib/lfrfid/protocols/protocol_electra.c | 44 +- lib/lfrfid/protocols/protocol_electra.h | 2 +- lib/lfrfid/protocols/protocol_em4100.c | 40 +- lib/lfrfid/protocols/protocol_fdx_a.c | 30 +- lib/lfrfid/protocols/protocol_fdx_a.h | 2 +- lib/lfrfid/protocols/protocol_fdx_b.c | 38 +- lib/lfrfid/protocols/protocol_fdx_b.h | 2 +- lib/lfrfid/protocols/protocol_gallagher.c | 34 +- lib/lfrfid/protocols/protocol_gallagher.h | 2 +- lib/lfrfid/protocols/protocol_h10301.c | 28 +- lib/lfrfid/protocols/protocol_h10301.h | 2 +- .../protocols/protocol_hid_ex_generic.c | 28 +- .../protocols/protocol_hid_ex_generic.h | 2 +- lib/lfrfid/protocols/protocol_hid_generic.c | 30 +- lib/lfrfid/protocols/protocol_hid_generic.h | 2 +- lib/lfrfid/protocols/protocol_idteck.c | 24 +- lib/lfrfid/protocols/protocol_indala26.c | 22 +- lib/lfrfid/protocols/protocol_io_prox_xsf.c | 22 +- lib/lfrfid/protocols/protocol_jablotron.c | 34 +- lib/lfrfid/protocols/protocol_jablotron.h | 2 +- lib/lfrfid/protocols/protocol_keri.c | 24 +- lib/lfrfid/protocols/protocol_nexwatch.c | 26 +- lib/lfrfid/protocols/protocol_pac_stanley.c | 12 +- lib/lfrfid/protocols/protocol_pac_stanley.h | 2 +- lib/lfrfid/protocols/protocol_paradox.c | 30 +- lib/lfrfid/protocols/protocol_paradox.h | 2 +- lib/lfrfid/protocols/protocol_pyramid.c | 28 +- lib/lfrfid/protocols/protocol_securakey.c | 37 +- lib/lfrfid/protocols/protocol_securakey.h | 2 +- lib/lfrfid/protocols/protocol_viking.c | 38 +- lib/lfrfid/tools/fsk_ocs.c | 2 +- lib/lfrfid/tools/fsk_osc.h | 2 +- lib/lfrfid/tools/t5577.c | 8 +- lib/lfrfid/tools/t5577.h | 58 +- lib/lfrfid/tools/varint_pair.h | 2 +- lib/music_worker/music_worker.c | 6 +- lib/nfc/helpers/crypto1.c | 2 +- lib/nfc/helpers/felica_crc.c | 2 +- lib/nfc/helpers/iso13239_crc.c | 6 +- lib/nfc/helpers/iso14443_4_layer.c | 2 +- lib/nfc/helpers/iso14443_crc.c | 2 +- lib/nfc/helpers/nfc_util.c | 4 +- lib/nfc/nfc_common.h | 6 +- lib/nfc/nfc_device.c | 4 +- lib/nfc/protocols/felica/felica.c | 8 +- lib/nfc/protocols/felica/felica.h | 52 +- lib/nfc/protocols/felica/felica_listener.c | 6 +- lib/nfc/protocols/felica/felica_listener.h | 2 +- lib/nfc/protocols/felica/felica_listener_i.c | 41 +- lib/nfc/protocols/felica/felica_listener_i.h | 4 +- lib/nfc/protocols/felica/felica_poller_i.h | 2 +- lib/nfc/protocols/felica/felica_poller_sync.c | 2 +- lib/nfc/protocols/iso14443_3a/iso14443_3a.c | 6 +- lib/nfc/protocols/iso14443_3a/iso14443_3a.h | 12 +- .../iso14443_3a/iso14443_3a_listener_i.c | 2 +- .../iso14443_3a/iso14443_3a_poller_i.h | 2 +- .../iso14443_3a/iso14443_3a_poller_sync.c | 2 +- lib/nfc/protocols/iso14443_3b/iso14443_3b.c | 4 +- lib/nfc/protocols/iso14443_3b/iso14443_3b_i.h | 28 +- lib/nfc/protocols/iso14443_4a/iso14443_4a.c | 10 +- lib/nfc/protocols/iso14443_4a/iso14443_4a_i.h | 14 +- .../iso14443_4a/iso14443_4a_poller_i.c | 8 +- lib/nfc/protocols/iso14443_4b/iso14443_4b.c | 2 +- lib/nfc/protocols/iso15693_3/iso15693_3.c | 22 +- lib/nfc/protocols/iso15693_3/iso15693_3.h | 86 +- lib/nfc/protocols/mf_classic/mf_classic.c | 38 +- lib/nfc/protocols/mf_classic/mf_classic.h | 32 +- lib/nfc/protocols/mf_desfire/mf_desfire.h | 26 +- lib/nfc/protocols/mf_desfire/mf_desfire_i.c | 38 +- lib/nfc/protocols/mf_desfire/mf_desfire_i.h | 44 +- .../protocols/mf_desfire/mf_desfire_poller.c | 2 +- lib/nfc/protocols/mf_plus/mf_plus.c | 2 +- lib/nfc/protocols/mf_plus/mf_plus.h | 4 +- lib/nfc/protocols/mf_plus/mf_plus_i.c | 4 +- lib/nfc/protocols/mf_plus/mf_plus_poller.c | 4 +- lib/nfc/protocols/mf_plus/mf_plus_poller.h | 2 +- .../protocols/mf_ultralight/mf_ultralight.c | 22 +- .../protocols/mf_ultralight/mf_ultralight.h | 76 +- .../mf_ultralight/mf_ultralight_listener.c | 2 +- .../mf_ultralight/mf_ultralight_listener_i.c | 18 +- .../mf_ultralight/mf_ultralight_poller_i.h | 2 +- lib/nfc/protocols/slix/slix.c | 34 +- lib/nfc/protocols/slix/slix.h | 38 +- lib/nfc/protocols/slix/slix_i.h | 48 +- lib/nfc/protocols/st25tb/st25tb.c | 6 +- lib/nfc/protocols/st25tb/st25tb.h | 8 +- lib/nfc/protocols/st25tb/st25tb_poller_sync.c | 2 +- lib/nfc/protocols/st25tb/st25tb_poller_sync.h | 2 +- lib/one_wire/one_wire_slave.c | 4 +- lib/print/printf_tiny.c | 16 +- lib/print/wrappers.c | 2 +- lib/print/wrappers.h | 2 +- lib/pulse_reader/pulse_reader.h | 4 +- .../parsers/iso15693/iso15693_parser.c | 4 +- lib/signal_reader/signal_reader.c | 8 +- lib/subghz/blocks/const.h | 2 +- lib/subghz/blocks/decoder.h | 2 +- lib/subghz/blocks/encoder.h | 2 +- lib/subghz/blocks/generic.c | 2 +- lib/subghz/blocks/generic.h | 2 +- lib/subghz/blocks/math.c | 2 +- lib/subghz/blocks/math.h | 2 +- lib/subghz/devices/cc1101_configs.h | 2 +- lib/subghz/devices/types.h | 2 +- lib/subghz/environment.c | 2 +- lib/subghz/protocols/bin_raw.c | 14 +- lib/subghz/protocols/came.c | 15 +- lib/subghz/protocols/chamberlain_code.c | 4 +- lib/subghz/protocols/clemsa.c | 11 +- lib/subghz/protocols/doitrand.c | 4 +- lib/subghz/protocols/gate_tx.c | 4 +- lib/subghz/protocols/holtek.c | 4 +- lib/subghz/protocols/keeloq.c | 4 +- lib/subghz/protocols/keeloq_common.h | 10 +- lib/subghz/protocols/linear.c | 4 +- lib/subghz/protocols/mastercode.c | 14 +- lib/subghz/protocols/nice_flor_s.c | 2 +- lib/subghz/protocols/phoenix_v2.c | 4 +- lib/subghz/protocols/power_smart.c | 3 +- lib/subghz/protocols/princeton.c | 1 + lib/subghz/protocols/raw.c | 1 + lib/subghz/protocols/secplus_v1.c | 14 +- lib/subghz/protocols/secplus_v2.c | 6 +- lib/subghz/subghz_keystore.c | 4 +- lib/subghz/subghz_setting.c | 4 +- lib/subghz/subghz_tx_rx_worker.c | 2 +- lib/subghz/subghz_worker.c | 2 +- lib/subghz/types.h | 16 +- lib/toolbox/buffer_stream.c | 2 +- lib/toolbox/dir_walk.h | 2 +- lib/toolbox/hex.c | 4 +- lib/toolbox/level_duration.h | 16 +- lib/toolbox/m_cstr_dup.h | 6 +- lib/toolbox/md5_calc.c | 2 +- lib/toolbox/name_generator.h | 2 +- lib/toolbox/pretty_format.h | 2 +- lib/toolbox/profiler.h | 2 +- lib/toolbox/protocols/protocol.h | 2 +- lib/toolbox/protocols/protocol_dict.c | 2 +- lib/toolbox/protocols/protocol_dict.h | 2 +- lib/toolbox/pulse_joiner.c | 2 +- lib/toolbox/pulse_joiner.h | 2 +- lib/toolbox/stream/stream.c | 2 +- lib/toolbox/stream/string_stream.c | 2 +- lib/toolbox/tar/tar_archive.c | 26 +- lib/toolbox/varint.h | 2 +- lib/u8g2/u8g2.h | 440 +++--- lib/u8g2/u8g2_glue.c | 32 +- lib/u8g2/u8x8.h | 144 +- lib/update_util/dfu_file.c | 4 +- lib/update_util/resources/manifest.h | 2 +- lib/update_util/update_manifest.c | 22 +- lib/update_util/update_manifest.h | 2 +- lib/update_util/update_operation.c | 2 +- lib/update_util/update_operation.h | 4 +- .../f18/furi_hal/furi_hal_version_device.c | 2 +- targets/f7/ble_glue/app_conf.h | 12 +- targets/f7/ble_glue/app_debug.c | 8 +- targets/f7/ble_glue/ble_event_thread.c | 4 +- targets/f7/ble_glue/ble_glue.c | 2 +- targets/f7/ble_glue/compiler.h | 12 +- targets/f7/ble_glue/extra_beacon.c | 2 +- targets/f7/ble_glue/furi_ble/gatt.h | 4 +- targets/f7/ble_glue/gap.c | 2 +- targets/f7/ble_glue/hsem_map.h | 2 +- .../f7/ble_glue/services/battery_service.c | 6 +- targets/f7/ble_glue/services/serial_service.h | 2 +- targets/f7/ble_glue/tl_dbg_conf.h | 2 +- targets/f7/fatfs/fatfs.h | 2 +- targets/f7/fatfs/ffconf.h | 12 +- targets/f7/fatfs/sector_cache.c | 4 +- targets/f7/fatfs/user_diskio.h | 2 +- targets/f7/furi_hal/furi_hal_bus.c | 6 +- targets/f7/furi_hal/furi_hal_clock.c | 6 +- targets/f7/furi_hal/furi_hal_crypto.c | 36 +- targets/f7/furi_hal/furi_hal_debug.c | 2 +- targets/f7/furi_hal/furi_hal_flash.c | 20 +- targets/f7/furi_hal/furi_hal_flash.h | 4 +- targets/f7/furi_hal/furi_hal_gpio.c | 6 +- targets/f7/furi_hal/furi_hal_ibutton.c | 3 +- targets/f7/furi_hal/furi_hal_idle_timer.h | 2 +- targets/f7/furi_hal/furi_hal_infrared.c | 20 +- targets/f7/furi_hal/furi_hal_interrupt.c | 2 +- targets/f7/furi_hal/furi_hal_light.c | 4 +- targets/f7/furi_hal/furi_hal_memory.c | 4 +- targets/f7/furi_hal/furi_hal_mpu.c | 2 +- targets/f7/furi_hal/furi_hal_nfc.c | 2 +- targets/f7/furi_hal/furi_hal_nfc_iso15693.c | 14 +- targets/f7/furi_hal/furi_hal_os.c | 8 +- targets/f7/furi_hal/furi_hal_random.c | 4 +- targets/f7/furi_hal/furi_hal_resources.h | 112 +- targets/f7/furi_hal/furi_hal_rfid.c | 45 +- targets/f7/furi_hal/furi_hal_rtc.c | 16 +- targets/f7/furi_hal/furi_hal_sd.c | 76 +- targets/f7/furi_hal/furi_hal_serial.c | 4 +- targets/f7/furi_hal/furi_hal_speaker.c | 6 +- targets/f7/furi_hal/furi_hal_spi.c | 10 +- targets/f7/furi_hal/furi_hal_subghz.c | 10 +- targets/f7/furi_hal/furi_hal_subghz.h | 2 +- targets/f7/furi_hal/furi_hal_usb_ccid.c | 8 +- targets/f7/furi_hal/furi_hal_usb_cdc.c | 2 +- targets/f7/furi_hal/furi_hal_usb_u2f.c | 10 +- targets/f7/furi_hal/furi_hal_version.c | 2 +- targets/f7/furi_hal/furi_hal_version_device.c | 2 +- targets/f7/inc/FreeRTOSConfig.h | 84 +- targets/f7/inc/furi_config.h | 2 +- targets/f7/inc/stm32.h | 10 +- targets/f7/platform_specific/math_wrapper.h | 2 +- targets/furi_hal_include/furi_hal_bt.h | 2 +- targets/furi_hal_include/furi_hal_crypto.h | 4 +- targets/furi_hal_include/furi_hal_memory.h | 2 +- targets/furi_hal_include/furi_hal_usb_hid.h | 4 +- targets/furi_hal_include/furi_hal_version.h | 4 +- 475 files changed, 3187 insertions(+), 3159 deletions(-) diff --git a/.clang-format b/.clang-format index ad3484ba0..c42068920 100644 --- a/.clang-format +++ b/.clang-format @@ -11,9 +11,9 @@ AlignConsecutiveAssignments: AlignFunctionPointers: false PadOperators: true AlignConsecutiveBitFields: - Enabled: false - AcrossEmptyLines: false - AcrossComments: false + Enabled: true + AcrossEmptyLines: true + AcrossComments: true AlignCompound: false AlignFunctionPointers: false PadOperators: true @@ -25,10 +25,10 @@ AlignConsecutiveDeclarations: AlignFunctionPointers: false PadOperators: true AlignConsecutiveMacros: - Enabled: false + Enabled: true AcrossEmptyLines: false - AcrossComments: false - AlignCompound: false + AcrossComments: true + AlignCompound: true AlignFunctionPointers: false PadOperators: true AlignConsecutiveShortCaseStatements: @@ -47,7 +47,7 @@ AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortCompoundRequirementOnASingleLine: true -AllowShortEnumsOnASingleLine: true +AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLambdasOnASingleLine: All @@ -108,6 +108,7 @@ ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH + - M_EACH IfMacros: - KJ_IF_MAYBE IncludeBlocks: Preserve @@ -136,7 +137,7 @@ IndentRequiresClause: false IndentWidth: 4 IndentWrappedFunctionNames: true InsertBraces: false -InsertNewlineAtEOF: false +InsertNewlineAtEOF: true InsertTrailingCommas: None IntegerLiteralSeparator: Binary: 0 @@ -179,7 +180,7 @@ ReferenceAlignment: Pointer ReflowComments: false RemoveBracesLLVM: false RemoveParentheses: Leave -RemoveSemicolon: false +RemoveSemicolon: true RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope SeparateDefinitionBlocks: Leave @@ -226,7 +227,7 @@ SpacesInParensOptions: InEmptyParentheses: false Other: false SpacesInSquareBrackets: false -Standard: c++03 +Standard: c++20 StatementAttributeLikeMacros: - Q_EMIT StatementMacros: diff --git a/applications/debug/battery_test_app/views/battery_info.c b/applications/debug/battery_test_app/views/battery_info.c index 5c5a3bd45..8e53cc6fb 100644 --- a/applications/debug/battery_test_app/views/battery_info.c +++ b/applications/debug/battery_test_app/views/battery_info.c @@ -3,7 +3,7 @@ #include #include -#define LOW_CHARGE_THRESHOLD 10 +#define LOW_CHARGE_THRESHOLD 10 #define HIGH_DRAIN_CURRENT_THRESHOLD 100 struct BatteryInfo { @@ -17,7 +17,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val) canvas_draw_box(canvas, x - 4, y + 16, 24, 6); canvas_set_color(canvas, ColorBlack); canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val); -}; +} static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) { char emote[20] = {}; @@ -85,7 +85,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) { canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote); canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header); canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value); -}; +} static void battery_info_draw_callback(Canvas* canvas, void* context) { furi_assert(context); diff --git a/applications/debug/bt_debug_app/views/bt_test.c b/applications/debug/bt_debug_app/views/bt_test.c index c59c7f09a..58b65e194 100644 --- a/applications/debug/bt_debug_app/views/bt_test.c +++ b/applications/debug/bt_debug_app/views/bt_test.c @@ -39,7 +39,7 @@ typedef struct { } BtTestModel; #define BT_TEST_START_MESSAGE "Ok - Start" -#define BT_TEST_STOP_MESSAGE "Ok - Stop" +#define BT_TEST_STOP_MESSAGE "Ok - Stop" static void bt_test_process_up(BtTest* bt_test); static void bt_test_process_down(BtTest* bt_test); diff --git a/applications/debug/ccid_test/iso7816_callbacks.h b/applications/debug/ccid_test/iso7816_callbacks.h index 7288b021a..6b408c7f5 100644 --- a/applications/debug/ccid_test/iso7816_callbacks.h +++ b/applications/debug/ccid_test/iso7816_callbacks.h @@ -18,4 +18,4 @@ void iso7816_xfr_datablock_callback( const uint8_t* dataBlock, uint32_t dataBlockLen, uint8_t* responseDataBlock, - uint32_t* responseDataBlockLen); \ No newline at end of file + uint32_t* responseDataBlockLen); diff --git a/applications/debug/ccid_test/iso7816_response.c b/applications/debug/ccid_test/iso7816_response.c index 3a65486b6..e22275618 100644 --- a/applications/debug/ccid_test/iso7816_response.c +++ b/applications/debug/ccid_test/iso7816_response.c @@ -5,4 +5,4 @@ void iso7816_set_response(ISO7816_Response_APDU* responseAPDU, uint16_t responseCode) { responseAPDU->SW1 = (responseCode >> (8 * 1)) & 0xff; responseAPDU->SW2 = (responseCode >> (8 * 0)) & 0xff; -} \ No newline at end of file +} diff --git a/applications/debug/ccid_test/iso7816_response.h b/applications/debug/ccid_test/iso7816_response.h index 7c2e74257..cb328d095 100644 --- a/applications/debug/ccid_test/iso7816_response.h +++ b/applications/debug/ccid_test/iso7816_response.h @@ -2,11 +2,11 @@ #define ISO7816_RESPONSE_OK 0x9000 -#define ISO7816_RESPONSE_WRONG_LENGTH 0x6700 -#define ISO7816_RESPONSE_WRONG_PARAMETERS_P1_P2 0x6A00 -#define ISO7816_RESPONSE_WRONG_LE 0x6C00 +#define ISO7816_RESPONSE_WRONG_LENGTH 0x6700 +#define ISO7816_RESPONSE_WRONG_PARAMETERS_P1_P2 0x6A00 +#define ISO7816_RESPONSE_WRONG_LE 0x6C00 #define ISO7816_RESPONSE_INSTRUCTION_NOT_SUPPORTED 0x6D00 -#define ISO7816_RESPONSE_CLASS_NOT_SUPPORTED 0x6E00 -#define ISO7816_RESPONSE_INTERNAL_EXCEPTION 0x6F00 +#define ISO7816_RESPONSE_CLASS_NOT_SUPPORTED 0x6E00 +#define ISO7816_RESPONSE_INTERNAL_EXCEPTION 0x6F00 -void iso7816_set_response(ISO7816_Response_APDU* responseAPDU, uint16_t responseCode); \ No newline at end of file +void iso7816_set_response(ISO7816_Response_APDU* responseAPDU, uint16_t responseCode); diff --git a/applications/debug/ccid_test/iso7816_t0_apdu.c b/applications/debug/ccid_test/iso7816_t0_apdu.c index 916983229..3de5555f4 100644 --- a/applications/debug/ccid_test/iso7816_t0_apdu.c +++ b/applications/debug/ccid_test/iso7816_t0_apdu.c @@ -81,4 +81,4 @@ void iso7816_write_response_apdu( responseDataBufferIndex++; *readerToPcDataBlockLen = responseDataBufferIndex; -} \ No newline at end of file +} diff --git a/applications/debug/ccid_test/iso7816_t0_apdu.h b/applications/debug/ccid_test/iso7816_t0_apdu.h index 3b3450909..50eb476a9 100644 --- a/applications/debug/ccid_test/iso7816_t0_apdu.h +++ b/applications/debug/ccid_test/iso7816_t0_apdu.h @@ -4,8 +4,8 @@ #include "iso7816_atr.h" #include "core/common_defines.h" -#define ISO7816_READ_COMMAND_APDU_OK 0 -#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LE 1 +#define ISO7816_READ_COMMAND_APDU_OK 0 +#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LE 1 #define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LENGTH 2 typedef struct { diff --git a/applications/debug/expansion_test/expansion_test.c b/applications/debug/expansion_test/expansion_test.c index fc7fb1894..e3bcf4e9c 100644 --- a/applications/debug/expansion_test/expansion_test.c +++ b/applications/debug/expansion_test/expansion_test.c @@ -40,11 +40,11 @@ #define TAG "ExpansionTest" -#define TEST_DIR_PATH EXT_PATH(TAG) +#define TEST_DIR_PATH EXT_PATH(TAG) #define TEST_FILE_NAME "test.txt" #define TEST_FILE_PATH EXT_PATH(TAG "/" TEST_FILE_NAME) -#define HOST_SERIAL_ID (FuriHalSerialIdLpuart) +#define HOST_SERIAL_ID (FuriHalSerialIdLpuart) #define MODULE_SERIAL_ID (FuriHalSerialIdUsart) #define RECEIVE_BUFFER_SIZE (sizeof(ExpansionFrame) + sizeof(ExpansionFrameChecksum)) diff --git a/applications/debug/file_browser_test/scenes/file_browser_scene_browser.c b/applications/debug/file_browser_test/scenes/file_browser_scene_browser.c index 0bf70e9c6..6bce58078 100644 --- a/applications/debug/file_browser_test/scenes/file_browser_scene_browser.c +++ b/applications/debug/file_browser_test/scenes/file_browser_scene_browser.c @@ -2,7 +2,7 @@ #include #define DEFAULT_PATH "/" -#define EXTENSION "*" +#define EXTENSION "*" bool file_browser_scene_browser_on_event(void* context, SceneManagerEvent event) { UNUSED(context); diff --git a/applications/debug/lfrfid_debug/lfrfid_debug.c b/applications/debug/lfrfid_debug/lfrfid_debug.c index 8776f8b7a..13c0b299f 100644 --- a/applications/debug/lfrfid_debug/lfrfid_debug.c +++ b/applications/debug/lfrfid_debug/lfrfid_debug.c @@ -78,4 +78,4 @@ int32_t lfrfid_debug_app(void* p) { lfrfid_debug_free(app); return 0; -} \ No newline at end of file +} diff --git a/applications/debug/speaker_debug/speaker_debug.c b/applications/debug/speaker_debug/speaker_debug.c index 82a6fbc77..3f685ab30 100644 --- a/applications/debug/speaker_debug/speaker_debug.c +++ b/applications/debug/speaker_debug/speaker_debug.c @@ -5,6 +5,7 @@ #include #define TAG "SpeakerDebug" + #define CLI_COMMAND "speaker_debug" typedef enum { diff --git a/applications/debug/subghz_test/helpers/subghz_test_types.h b/applications/debug/subghz_test/helpers/subghz_test_types.h index 03be6459e..91411bd8d 100644 --- a/applications/debug/subghz_test/helpers/subghz_test_types.h +++ b/applications/debug/subghz_test/helpers/subghz_test_types.h @@ -4,8 +4,8 @@ #include #define SUBGHZ_TEST_VERSION_APP "0.1" -#define SUBGHZ_TEST_DEVELOPED "SkorP" -#define SUBGHZ_TEST_GITHUB "https://github.com/flipperdevices/flipperzero-firmware" +#define SUBGHZ_TEST_DEVELOPED "SkorP" +#define SUBGHZ_TEST_GITHUB "https://github.com/flipperdevices/flipperzero-firmware" typedef enum { SubGhzTestViewVariableItemList, diff --git a/applications/debug/subghz_test/protocol/math.c b/applications/debug/subghz_test/protocol/math.c index 24202ad1c..226bb3e74 100644 --- a/applications/debug/subghz_test/protocol/math.c +++ b/applications/debug/subghz_test/protocol/math.c @@ -241,4 +241,4 @@ uint8_t subghz_protocol_blocks_xor_bytes(uint8_t const message[], size_t size) { result ^= message[i]; } return result; -} \ No newline at end of file +} diff --git a/applications/debug/subghz_test/protocol/math.h b/applications/debug/subghz_test/protocol/math.h index dcea3da5f..bee1bf733 100644 --- a/applications/debug/subghz_test/protocol/math.h +++ b/applications/debug/subghz_test/protocol/math.h @@ -16,7 +16,7 @@ (value) &= ~(_one << (bit)); \ }) #define bit_write(value, bit, bitvalue) (bitvalue ? bit_set(value, bit) : bit_clear(value, bit)) -#define DURATION_DIFF(x, y) (((x) < (y)) ? ((y) - (x)) : ((x) - (y))) +#define DURATION_DIFF(x, y) (((x) < (y)) ? ((y) - (x)) : ((x) - (y))) #ifdef __cplusplus extern "C" { diff --git a/applications/debug/subghz_test/protocol/princeton_for_testing.c b/applications/debug/subghz_test/protocol/princeton_for_testing.c index 70f323937..acd4bf56a 100644 --- a/applications/debug/subghz_test/protocol/princeton_for_testing.c +++ b/applications/debug/subghz_test/protocol/princeton_for_testing.c @@ -9,13 +9,13 @@ * */ -#define SUBGHZ_PT_SHORT 300 -#define SUBGHZ_PT_LONG (SUBGHZ_PT_SHORT * 3) -#define SUBGHZ_PT_GUARD (SUBGHZ_PT_SHORT * 30) +#define SUBGHZ_PT_SHORT 300 +#define SUBGHZ_PT_LONG (SUBGHZ_PT_SHORT * 3) +#define SUBGHZ_PT_GUARD (SUBGHZ_PT_SHORT * 30) #define SUBGHZ_PT_COUNT_KEY_433 9 -#define SUBGHZ_PT_TIMEOUT_433 900 +#define SUBGHZ_PT_TIMEOUT_433 900 #define SUBGHZ_PT_COUNT_KEY_868 9 -#define SUBGHZ_PT_TIMEOUT_868 14000 +#define SUBGHZ_PT_TIMEOUT_868 14000 #define TAG "SubGhzProtocolPrinceton" diff --git a/applications/debug/uart_echo/uart_echo.c b/applications/debug/uart_echo/uart_echo.c index 2d38089d4..595a13ac5 100644 --- a/applications/debug/uart_echo/uart_echo.c +++ b/applications/debug/uart_echo/uart_echo.c @@ -9,9 +9,10 @@ #include #include -#define LINES_ON_SCREEN 6 -#define COLUMNS_ON_SCREEN 21 #define TAG "UartEcho" + +#define LINES_ON_SCREEN 6 +#define COLUMNS_ON_SCREEN 21 #define DEFAULT_BAUD_RATE 230400 typedef struct UartDumpModel UartDumpModel; @@ -147,7 +148,7 @@ static void uart_echo_push_to_list(UartDumpModel* model, const char data) { bool new_string_needed = false; if(furi_string_size(model->list[model->line]->text) >= COLUMNS_ON_SCREEN) { new_string_needed = true; - } else if((data == '\n' || data == '\r')) { + } else if(data == '\n' || data == '\r') { // pack line breaks if(model->last_char != '\n' && model->last_char != '\r') { new_string_needed = true; diff --git a/applications/debug/unit_tests/test_runner.c b/applications/debug/unit_tests/test_runner.c index 517a4fd24..de29e91b3 100644 --- a/applications/debug/unit_tests/test_runner.c +++ b/applications/debug/unit_tests/test_runner.c @@ -72,7 +72,7 @@ void test_runner_free(TestRunner* instance) { free(instance); } -#define TEST_RUNNER_TMP_DIR EXT_PATH(".tmp") +#define TEST_RUNNER_TMP_DIR EXT_PATH(".tmp") #define TEST_RUNNER_TMP_UNIT_TESTS_DIR TEST_RUNNER_TMP_DIR "/unit_tests" static bool test_runner_run_plugin(TestRunner* instance, const char* path) { diff --git a/applications/debug/unit_tests/test_runner.h b/applications/debug/unit_tests/test_runner.h index 024799ebe..43aba8bb1 100644 --- a/applications/debug/unit_tests/test_runner.h +++ b/applications/debug/unit_tests/test_runner.h @@ -9,4 +9,4 @@ TestRunner* test_runner_alloc(Cli* cli, FuriString* args); void test_runner_free(TestRunner* isntance); -void test_runner_run(TestRunner* isntance); \ No newline at end of file +void test_runner_run(TestRunner* isntance); diff --git a/applications/debug/unit_tests/tests/bt/bt_test.c b/applications/debug/unit_tests/tests/bt/bt_test.c index b65a35bf5..a0f189fdb 100644 --- a/applications/debug/unit_tests/tests/bt/bt_test.c +++ b/applications/debug/unit_tests/tests/bt/bt_test.c @@ -6,7 +6,7 @@ #include #define BT_TEST_KEY_STORAGE_FILE_PATH EXT_PATH("unit_tests/bt_test.keys") -#define BT_TEST_NVM_RAM_BUFF_SIZE (507 * 4) // The same as in ble NVM storage +#define BT_TEST_NVM_RAM_BUFF_SIZE (507 * 4) // The same as in ble NVM storage typedef struct { Storage* storage; diff --git a/applications/debug/unit_tests/tests/compress/compress_test.c b/applications/debug/unit_tests/tests/compress/compress_test.c index 0f2bd7a03..8ff774bdf 100644 --- a/applications/debug/unit_tests/tests/compress/compress_test.c +++ b/applications/debug/unit_tests/tests/compress/compress_test.c @@ -173,7 +173,7 @@ It was compressed with heatshrink using the following command: `python3 -m heatshrink2 compress -w 9 -l 4 hsstream.out.bin hsstream.in.bin` */ -#define HSSTREAM_IN COMPRESS_UNIT_TESTS_PATH("hsstream.in.bin") +#define HSSTREAM_IN COMPRESS_UNIT_TESTS_PATH("hsstream.in.bin") #define HSSTREAM_OUT COMPRESS_UNIT_TESTS_PATH("hsstream.out.bin") static void compress_test_heatshrink_stream() { @@ -239,7 +239,7 @@ static void compress_test_heatshrink_stream() { furi_record_close(RECORD_STORAGE); } -#define HS_TAR_PATH COMPRESS_UNIT_TESTS_PATH("test.ths") +#define HS_TAR_PATH COMPRESS_UNIT_TESTS_PATH("test.ths") #define HS_TAR_EXTRACT_PATH COMPRESS_UNIT_TESTS_PATH("tar_out") static bool file_counter(const char* name, bool is_dir, void* context) { diff --git a/applications/debug/unit_tests/tests/expansion/expansion_test.c b/applications/debug/unit_tests/tests/expansion/expansion_test.c index ea4fea28c..73d3ff079 100644 --- a/applications/debug/unit_tests/tests/expansion/expansion_test.c +++ b/applications/debug/unit_tests/tests/expansion/expansion_test.c @@ -5,8 +5,8 @@ #include -#define EXPANSION_TEST_GARBAGE_MAGIC (0xB19AF) -#define EXPANSION_TEST_GARBAGE_BUF_SIZE (0x100U) +#define EXPANSION_TEST_GARBAGE_MAGIC (0xB19AF) +#define EXPANSION_TEST_GARBAGE_BUF_SIZE (0x100U) #define EXPANSION_TEST_GARBAGE_ITERATIONS (100U) MU_TEST(test_expansion_encoded_size) { diff --git a/applications/debug/unit_tests/tests/flipper_format/flipper_format_test.c b/applications/debug/unit_tests/tests/flipper_format/flipper_format_test.c index d26acf577..888a66444 100644 --- a/applications/debug/unit_tests/tests/flipper_format/flipper_format_test.c +++ b/applications/debug/unit_tests/tests/flipper_format/flipper_format_test.c @@ -5,7 +5,7 @@ #include "../test.h" // IWYU pragma: keep #define TEST_DIR_NAME EXT_PATH(".tmp/unit_tests/ff") -#define TEST_DIR TEST_DIR_NAME "/" +#define TEST_DIR TEST_DIR_NAME "/" static const char* test_filetype = "Flipper File test"; static const uint32_t test_version = 666; diff --git a/applications/debug/unit_tests/tests/furi_hal/furi_hal_tests.c b/applications/debug/unit_tests/tests/furi_hal/furi_hal_tests.c index a2af1d1b9..aaaa031e4 100644 --- a/applications/debug/unit_tests/tests/furi_hal/furi_hal_tests.c +++ b/applications/debug/unit_tests/tests/furi_hal/furi_hal_tests.c @@ -5,11 +5,11 @@ #include #include "../test.h" // IWYU pragma: keep -#define DATA_SIZE 4 -#define EEPROM_ADDRESS 0b10101000 -#define EEPROM_ADDRESS_HIGH (EEPROM_ADDRESS | 0b10) -#define EEPROM_SIZE 512 -#define EEPROM_PAGE_SIZE 16 +#define DATA_SIZE 4 +#define EEPROM_ADDRESS 0b10101000 +#define EEPROM_ADDRESS_HIGH (EEPROM_ADDRESS | 0b10) +#define EEPROM_SIZE 512 +#define EEPROM_PAGE_SIZE 16 #define EEPROM_WRITE_DELAY_MS 6 static void furi_hal_i2c_int_setup(void) { diff --git a/applications/debug/unit_tests/tests/infrared/infrared_test.c b/applications/debug/unit_tests/tests/infrared/infrared_test.c index cf6a13220..e64b630b2 100644 --- a/applications/debug/unit_tests/tests/infrared/infrared_test.c +++ b/applications/debug/unit_tests/tests/infrared/infrared_test.c @@ -4,7 +4,7 @@ #include #include "../test.h" // IWYU pragma: keep -#define IR_TEST_FILES_DIR EXT_PATH("unit_tests/infrared/") +#define IR_TEST_FILES_DIR EXT_PATH("unit_tests/infrared/") #define IR_TEST_FILE_PREFIX "test_" #define IR_TEST_FILE_SUFFIX ".irtest" diff --git a/applications/debug/unit_tests/tests/lfrfid/lfrfid_protocols.c b/applications/debug/unit_tests/tests/lfrfid/lfrfid_protocols.c index 56ff64c09..032fe115e 100644 --- a/applications/debug/unit_tests/tests/lfrfid/lfrfid_protocols.c +++ b/applications/debug/unit_tests/tests/lfrfid/lfrfid_protocols.c @@ -6,8 +6,8 @@ #define LF_RFID_READ_TIMING_MULTIPLIER 8 -#define EM_TEST_DATA {0x58, 0x00, 0x85, 0x64, 0x02} -#define EM_TEST_DATA_SIZE 5 +#define EM_TEST_DATA {0x58, 0x00, 0x85, 0x64, 0x02} +#define EM_TEST_DATA_SIZE 5 #define EM_TEST_EMULATION_TIMINGS_COUNT (64 * 2) const int8_t em_test_timings[EM_TEST_EMULATION_TIMINGS_COUNT] = { @@ -20,8 +20,8 @@ const int8_t em_test_timings[EM_TEST_EMULATION_TIMINGS_COUNT] = { -32, 32, 32, -32, -32, 32, -32, 32, -32, 32, -32, 32, -32, 32, }; -#define HID10301_TEST_DATA {0x8D, 0x48, 0xA8} -#define HID10301_TEST_DATA_SIZE 3 +#define HID10301_TEST_DATA {0x8D, 0x48, 0xA8} +#define HID10301_TEST_DATA_SIZE 3 #define HID10301_TEST_EMULATION_TIMINGS_COUNT (541 * 2) const int8_t hid10301_test_timings[HID10301_TEST_EMULATION_TIMINGS_COUNT] = { @@ -69,8 +69,8 @@ const int8_t hid10301_test_timings[HID10301_TEST_EMULATION_TIMINGS_COUNT] = { 5, -5, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, 4, -4, }; -#define IOPROX_XSF_TEST_DATA {0x65, 0x01, 0x05, 0x39} -#define IOPROX_XSF_TEST_DATA_SIZE 4 +#define IOPROX_XSF_TEST_DATA {0x65, 0x01, 0x05, 0x39} +#define IOPROX_XSF_TEST_DATA_SIZE 4 #define IOPROX_XSF_TEST_EMULATION_TIMINGS_COUNT (468 * 2) const int8_t ioprox_xsf_test_timings[IOPROX_XSF_TEST_EMULATION_TIMINGS_COUNT] = { @@ -113,8 +113,8 @@ const int8_t ioprox_xsf_test_timings[IOPROX_XSF_TEST_EMULATION_TIMINGS_COUNT] = }; #define INDALA26_EMULATION_TIMINGS_COUNT (1024 * 2) -#define INDALA26_TEST_DATA {0x3B, 0x73, 0x64, 0xA8} -#define INDALA26_TEST_DATA_SIZE 4 +#define INDALA26_TEST_DATA {0x3B, 0x73, 0x64, 0xA8} +#define INDALA26_TEST_DATA_SIZE 4 const int8_t indala26_test_timings[INDALA26_EMULATION_TIMINGS_COUNT] = { 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, @@ -205,8 +205,8 @@ const int8_t indala26_test_timings[INDALA26_EMULATION_TIMINGS_COUNT] = { -1, 1, -1, 1, -1, 1, -1, 1, }; -#define FDXB_TEST_DATA {0x44, 0x88, 0x23, 0xF2, 0x5A, 0x6F, 0x00, 0x01, 0x00, 0x00, 0x00} -#define FDXB_TEST_DATA_SIZE 11 +#define FDXB_TEST_DATA {0x44, 0x88, 0x23, 0xF2, 0x5A, 0x6F, 0x00, 0x01, 0x00, 0x00, 0x00} +#define FDXB_TEST_DATA_SIZE 11 #define FDXB_TEST_EMULATION_TIMINGS_COUNT (206) const int8_t fdxb_test_timings[FDXB_TEST_EMULATION_TIMINGS_COUNT] = { diff --git a/applications/debug/unit_tests/tests/minunit.h b/applications/debug/unit_tests/tests/minunit.h index 083db5a9a..9310cfc9c 100644 --- a/applications/debug/unit_tests/tests/minunit.h +++ b/applications/debug/unit_tests/tests/minunit.h @@ -71,7 +71,7 @@ extern "C" { /* Maximum length of last message */ #define MINUNIT_MESSAGE_LEN 1024 /* Accuracy with which floats are compared */ -#define MINUNIT_EPSILON 1E-12 +#define MINUNIT_EPSILON 1E-12 #include "minunit_vars_ex.h" @@ -84,9 +84,9 @@ void minunit_print_fail(const char* error); void minunit_printf_warning(const char* format, ...); /* Definitions */ -#define MU_TEST(method_name) static void method_name(void) +#define MU_TEST(method_name) static void method_name(void) #define MU_TEST_1(method_name, arg_1) static void method_name(arg_1) -#define MU_TEST_SUITE(suite_name) static void suite_name(void) +#define MU_TEST_SUITE(suite_name) static void suite_name(void) #define MU__SAFE_BLOCK(block) \ do { \ diff --git a/applications/debug/unit_tests/tests/nfc/nfc_test.c b/applications/debug/unit_tests/tests/nfc/nfc_test.c index 5f172d0b5..0898ac8ed 100644 --- a/applications/debug/unit_tests/tests/nfc/nfc_test.c +++ b/applications/debug/unit_tests/tests/nfc/nfc_test.c @@ -30,7 +30,7 @@ #define TAG "NfcTest" -#define NFC_TEST_NFC_DEV_PATH EXT_PATH("unit_tests/nfc/nfc_device_test.nfc") +#define NFC_TEST_NFC_DEV_PATH EXT_PATH("unit_tests/nfc/nfc_device_test.nfc") #define NFC_APP_MF_CLASSIC_DICT_UNIT_TEST_PATH EXT_PATH("unit_tests/mf_dict.nfc") #define NFC_TEST_FLAG_WORKER_DONE (1) diff --git a/applications/debug/unit_tests/tests/rpc/rpc_test.c b/applications/debug/unit_tests/tests/rpc/rpc_test.c index f5b9e762d..63ea706ed 100644 --- a/applications/debug/unit_tests/tests/rpc/rpc_test.c +++ b/applications/debug/unit_tests/tests/rpc/rpc_test.c @@ -43,14 +43,15 @@ typedef struct { static RpcSessionContext rpc_session[TEST_RPC_SESSIONS]; #define TAG "UnitTestsRpc" -#define MAX_RECEIVE_OUTPUT_TIMEOUT 3000 -#define MAX_NAME_LENGTH 255 -#define MAX_DATA_SIZE 512u // have to be exact as in rpc_storage.c -#define TEST_DIR_NAME EXT_PATH(".tmp/unit_tests/rpc") -#define TEST_DIR TEST_DIR_NAME "/" -#define MD5SUM_SIZE 16 -#define PING_REQUEST 0 +#define MAX_RECEIVE_OUTPUT_TIMEOUT 3000 +#define MAX_NAME_LENGTH 255 +#define MAX_DATA_SIZE 512u // have to be exact as in rpc_storage.c +#define TEST_DIR_NAME EXT_PATH(".tmp/unit_tests/rpc") +#define TEST_DIR TEST_DIR_NAME "/" +#define MD5SUM_SIZE 16 + +#define PING_REQUEST 0 #define PING_RESPONSE 1 #define WRITE_REQUEST 0 #define READ_RESPONSE 1 @@ -554,7 +555,7 @@ static bool test_rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_ time_left = MAX(time_left, 0); bytes_received = furi_stream_buffer_receive(session_context->output_stream, buf, count, time_left); - return (count == bytes_received); + return count == bytes_received; } static void @@ -971,7 +972,7 @@ MU_TEST(test_storage_info) { } #define TEST_DIR_STAT_NAME TEST_DIR "stat_dir" -#define TEST_DIR_STAT TEST_DIR_STAT_NAME "/" +#define TEST_DIR_STAT TEST_DIR_STAT_NAME "/" MU_TEST(test_storage_stat) { test_create_dir(TEST_DIR_STAT_NAME); test_create_file(TEST_DIR_STAT "empty.txt", 0); @@ -1212,7 +1213,7 @@ static void test_storage_delete_run( } #define TEST_DIR_RMRF_NAME TEST_DIR "rmrf_test" -#define TEST_DIR_RMRF TEST_DIR_RMRF_NAME "/" +#define TEST_DIR_RMRF TEST_DIR_RMRF_NAME "/" MU_TEST(test_storage_delete_recursive) { test_create_dir(TEST_DIR_RMRF_NAME); diff --git a/applications/debug/unit_tests/tests/storage/storage_test.c b/applications/debug/unit_tests/tests/storage/storage_test.c index 65a25cf49..f317fbf68 100644 --- a/applications/debug/unit_tests/tests/storage/storage_test.c +++ b/applications/debug/unit_tests/tests/storage/storage_test.c @@ -9,7 +9,7 @@ #define UNIT_TESTS_PATH(path) EXT_PATH("unit_tests/" path) #define STORAGE_LOCKED_FILE EXT_PATH("locked_file.test") -#define STORAGE_LOCKED_DIR STORAGE_INT_PATH_PREFIX +#define STORAGE_LOCKED_DIR STORAGE_INT_PATH_PREFIX #define STORAGE_TEST_DIR UNIT_TESTS_PATH("test_dir") diff --git a/applications/debug/unit_tests/tests/subghz/subghz_test.c b/applications/debug/unit_tests/tests/subghz/subghz_test.c index 6a4129359..90e6d429b 100644 --- a/applications/debug/unit_tests/tests/subghz/subghz_test.c +++ b/applications/debug/unit_tests/tests/subghz/subghz_test.c @@ -11,13 +11,14 @@ #include #define TAG "SubGhzTest" -#define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes") -#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo") -#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s") -#define ALUTECH_AT_4N_DIR_NAME EXT_PATH("subghz/assets/alutech_at_4n") -#define TEST_RANDOM_DIR_NAME EXT_PATH("unit_tests/subghz/test_random_raw.sub") + +#define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes") +#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo") +#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s") +#define ALUTECH_AT_4N_DIR_NAME EXT_PATH("subghz/assets/alutech_at_4n") +#define TEST_RANDOM_DIR_NAME EXT_PATH("unit_tests/subghz/test_random_raw.sub") #define TEST_RANDOM_COUNT_PARSE 329 -#define TEST_TIMEOUT 10000 +#define TEST_TIMEOUT 10000 static SubGhzEnvironment* environment_handler; static SubGhzReceiver* receiver_handler; diff --git a/applications/debug/unit_tests/tests/test_api.h b/applications/debug/unit_tests/tests/test_api.h index 55b9f7885..fc2c7479c 100644 --- a/applications/debug/unit_tests/tests/test_api.h +++ b/applications/debug/unit_tests/tests/test_api.h @@ -2,7 +2,7 @@ #include -#define APPID "UnitTest" +#define APPID "UnitTest" #define API_VERSION (0u) typedef struct { diff --git a/applications/debug/usb_mouse/usb_mouse.c b/applications/debug/usb_mouse/usb_mouse.c index 2b7710451..e322a58ae 100644 --- a/applications/debug/usb_mouse/usb_mouse.c +++ b/applications/debug/usb_mouse/usb_mouse.c @@ -4,7 +4,7 @@ #include #define MOUSE_MOVE_SHORT 5 -#define MOUSE_MOVE_LONG 20 +#define MOUSE_MOVE_LONG 20 typedef enum { EventTypeInput, diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c index 429a4b3a4..ae3556396 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c @@ -21,11 +21,11 @@ #define SUBGHZ_DEVICE_CC1101_EXT_TX_GPIO (&gpio_ext_pb2) /* DMA Channels definition */ -#define SUBGHZ_DEVICE_CC1101_EXT_DMA (DMA2) +#define SUBGHZ_DEVICE_CC1101_EXT_DMA (DMA2) #define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_CHANNEL (LL_DMA_CHANNEL_3) #define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH4_CHANNEL (LL_DMA_CHANNEL_4) #define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH5_CHANNEL (LL_DMA_CHANNEL_5) -#define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_IRQ (FuriHalInterruptIdDma2Ch3) +#define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_IRQ (FuriHalInterruptIdDma2Ch3) #define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_DEF \ SUBGHZ_DEVICE_CC1101_EXT_DMA, SUBGHZ_DEVICE_CC1101_EXT_DMA_CH3_CHANNEL #define SUBGHZ_DEVICE_CC1101_EXT_DMA_CH4_DEF \ @@ -365,7 +365,7 @@ bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void) { cc1101_read_reg( subghz_device_cc1101_ext->spi_bus_handle, CC1101_STATUS_LQI | CC1101_BURST, data); furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); - if(((data[0] >> 7) & 0x01)) { + if((data[0] >> 7) & 0x01) { return true; } else { return false; @@ -826,9 +826,8 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb } bool subghz_device_cc1101_ext_is_async_tx_complete(void) { - return ( - (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) && - (LL_TIM_GetAutoReload(TIM17) == 0)); + return (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) && + (LL_TIM_GetAutoReload(TIM17) == 0); } void subghz_device_cc1101_ext_stop_async_tx(void) { diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c index 68f2b8aff..eef92dbe8 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c @@ -107,4 +107,4 @@ static const FlipperAppPluginDescriptor subghz_device_cc1101_ext_descriptor = { const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep(void) { return &subghz_device_cc1101_ext_descriptor; -} \ No newline at end of file +} diff --git a/applications/examples/example_ble_beacon/ble_beacon_app.c b/applications/examples/example_ble_beacon/ble_beacon_app.c index af2133602..faa3feb91 100644 --- a/applications/examples/example_ble_beacon/ble_beacon_app.c +++ b/applications/examples/example_ble_beacon/ble_beacon_app.c @@ -5,7 +5,7 @@ #include -#define TAG "ble_beacon_app" +#define TAG "BleBeaconApp" static bool ble_beacon_app_custom_event_callback(void* context, uint32_t event) { furi_assert(context); diff --git a/applications/examples/example_plugins/plugin_interface.h b/applications/examples/example_plugins/plugin_interface.h index fadb9089f..50c26ba7a 100644 --- a/applications/examples/example_plugins/plugin_interface.h +++ b/applications/examples/example_plugins/plugin_interface.h @@ -6,7 +6,7 @@ */ #pragma once -#define PLUGIN_APP_ID "example_plugins" +#define PLUGIN_APP_ID "example_plugins" #define PLUGIN_API_VERSION 1 typedef struct { diff --git a/applications/examples/example_plugins_advanced/app_api_interface.h b/applications/examples/example_plugins_advanced/app_api_interface.h index d0db44c4a..be4f78930 100644 --- a/applications/examples/example_plugins_advanced/app_api_interface.h +++ b/applications/examples/example_plugins_advanced/app_api_interface.h @@ -6,4 +6,4 @@ * Resolver interface with private application's symbols. * Implementation is contained in app_api_table.c */ -extern const ElfApiInterface* const application_api_interface; \ No newline at end of file +extern const ElfApiInterface* const application_api_interface; diff --git a/applications/examples/example_plugins_advanced/app_api_table_i.h b/applications/examples/example_plugins_advanced/app_api_table_i.h index 17cc8be5f..1abd85cd4 100644 --- a/applications/examples/example_plugins_advanced/app_api_table_i.h +++ b/applications/examples/example_plugins_advanced/app_api_table_i.h @@ -10,4 +10,4 @@ static constexpr auto app_api_table = sort(create_array_t( API_METHOD(app_api_accumulator_get, uint32_t, ()), API_METHOD(app_api_accumulator_add, void, (uint32_t)), API_METHOD(app_api_accumulator_sub, void, (uint32_t)), - API_METHOD(app_api_accumulator_mul, void, (uint32_t)))); \ No newline at end of file + API_METHOD(app_api_accumulator_mul, void, (uint32_t)))); diff --git a/applications/examples/example_plugins_advanced/plugin_interface.h b/applications/examples/example_plugins_advanced/plugin_interface.h index 4cef7567b..721e7c646 100644 --- a/applications/examples/example_plugins_advanced/plugin_interface.h +++ b/applications/examples/example_plugins_advanced/plugin_interface.h @@ -6,7 +6,7 @@ */ #pragma once -#define PLUGIN_APP_ID "example_plugins_advanced" +#define PLUGIN_APP_ID "example_plugins_advanced" #define PLUGIN_API_VERSION 1 typedef struct { diff --git a/applications/examples/example_thermo/example_thermo.c b/applications/examples/example_thermo/example_thermo.c index dafe56886..895f05ce7 100644 --- a/applications/examples/example_thermo/example_thermo.c +++ b/applications/examples/example_thermo/example_thermo.c @@ -25,15 +25,15 @@ #include #define UPDATE_PERIOD_MS 1000UL -#define TEXT_STORE_SIZE 64U +#define TEXT_STORE_SIZE 64U -#define DS18B20_CMD_SKIP_ROM 0xccU -#define DS18B20_CMD_CONVERT 0x44U +#define DS18B20_CMD_SKIP_ROM 0xccU +#define DS18B20_CMD_CONVERT 0x44U #define DS18B20_CMD_READ_SCRATCHPAD 0xbeU -#define DS18B20_CFG_RESOLUTION_POS 5U +#define DS18B20_CFG_RESOLUTION_POS 5U #define DS18B20_CFG_RESOLUTION_MASK 0x03U -#define DS18B20_DECIMAL_PART_MASK 0x0fU +#define DS18B20_DECIMAL_PART_MASK 0x0fU #define DS18B20_SIGN_MASK 0xf0U diff --git a/applications/main/archive/helpers/archive_browser.c b/applications/main/archive/helpers/archive_browser.c index ea9cdbdc3..c34c505a2 100644 --- a/applications/main/archive/helpers/archive_browser.c +++ b/applications/main/archive/helpers/archive_browser.c @@ -360,7 +360,7 @@ bool archive_is_home(ArchiveBrowserView* browser) { } const char* default_path = archive_get_default_path(archive_get_tab(browser)); - return (furi_string_cmp_str(browser->path, default_path) == 0); + return furi_string_cmp_str(browser->path, default_path) == 0; } const char* archive_get_name(ArchiveBrowserView* browser) { diff --git a/applications/main/archive/helpers/archive_browser.h b/applications/main/archive/helpers/archive_browser.h index 0a977b647..02cf8d708 100644 --- a/applications/main/archive/helpers/archive_browser.h +++ b/applications/main/archive/helpers/archive_browser.h @@ -3,8 +3,8 @@ #include "../archive_i.h" #include -#define TAB_RIGHT InputKeyRight // Default tab switch direction -#define TAB_DEFAULT ArchiveTabFavorites // Start tab +#define TAB_RIGHT InputKeyRight // Default tab switch direction +#define TAB_DEFAULT ArchiveTabFavorites // Start tab #define FILE_LIST_BUF_LEN 50 static const char* tab_default_paths[] = { @@ -62,7 +62,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) { } inline bool archive_is_known_app(ArchiveFileTypeEnum type) { - return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown); + return type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown; } bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx); diff --git a/applications/main/archive/helpers/archive_favorites.h b/applications/main/archive/helpers/archive_favorites.h index db8943378..64ffcdd7b 100644 --- a/applications/main/archive/helpers/archive_favorites.h +++ b/applications/main/archive/helpers/archive_favorites.h @@ -2,7 +2,7 @@ #include -#define ARCHIVE_FAV_PATH ANY_PATH("favorites.txt") +#define ARCHIVE_FAV_PATH ANY_PATH("favorites.txt") #define ARCHIVE_FAV_TEMP_PATH ANY_PATH("favorites.tmp") uint16_t archive_favorites_count(void* context); diff --git a/applications/main/archive/scenes/archive_scene_browser.c b/applications/main/archive/scenes/archive_scene_browser.c index c08deb60a..d09595037 100644 --- a/applications/main/archive/scenes/archive_scene_browser.c +++ b/applications/main/archive/scenes/archive_scene_browser.c @@ -8,7 +8,7 @@ #define TAG "ArchiveSceneBrowser" -#define SCENE_STATE_DEFAULT (0) +#define SCENE_STATE_DEFAULT (0) #define SCENE_STATE_NEED_REFRESH (1) static const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) { diff --git a/applications/main/archive/scenes/archive_scene_delete.c b/applications/main/archive/scenes/archive_scene_delete.c index cbeb4824d..e12941970 100644 --- a/applications/main/archive/scenes/archive_scene_delete.c +++ b/applications/main/archive/scenes/archive_scene_delete.c @@ -5,7 +5,7 @@ #include "toolbox/path.h" #define SCENE_DELETE_CUSTOM_EVENT (0UL) -#define MAX_TEXT_INPUT_LEN 22 +#define MAX_TEXT_INPUT_LEN 22 void archive_scene_delete_widget_callback(GuiButtonType result, InputType type, void* context) { furi_assert(context); diff --git a/applications/main/archive/scenes/archive_scene_rename.c b/applications/main/archive/scenes/archive_scene_rename.c index 7b6552dfb..dd6ba0a6e 100644 --- a/applications/main/archive/scenes/archive_scene_rename.c +++ b/applications/main/archive/scenes/archive_scene_rename.c @@ -6,7 +6,7 @@ #include "toolbox/path.h" #define SCENE_RENAME_CUSTOM_EVENT (0UL) -#define MAX_TEXT_INPUT_LEN 22 +#define MAX_TEXT_INPUT_LEN 22 void archive_scene_rename_text_input_callback(void* context) { ArchiveApp* archive = (ArchiveApp*)context; diff --git a/applications/main/archive/views/archive_browser_view.c b/applications/main/archive/views/archive_browser_view.c index de06b9684..9e0918373 100644 --- a/applications/main/archive/views/archive_browser_view.c +++ b/applications/main/archive/views/archive_browser_view.c @@ -5,7 +5,7 @@ #include "../helpers/archive_browser.h" #define SCROLL_INTERVAL (333) -#define SCROLL_DELAY (2) +#define SCROLL_DELAY (2) static const char* ArchiveTabNames[] = { [ArchiveTabFavorites] = "Favorites", diff --git a/applications/main/archive/views/archive_browser_view.h b/applications/main/archive/views/archive_browser_view.h index 5fbdaf973..e7b8ee40f 100644 --- a/applications/main/archive/views/archive_browser_view.h +++ b/applications/main/archive/views/archive_browser_view.h @@ -11,12 +11,12 @@ #include #include -#define MAX_LEN_PX 110 +#define MAX_LEN_PX 110 #define MAX_NAME_LEN 255 -#define MAX_EXT_LEN 6 +#define MAX_EXT_LEN 6 #define FRAME_HEIGHT 12 -#define MENU_ITEMS 4u -#define MOVE_OFFSET 5u +#define MENU_ITEMS 4u +#define MOVE_OFFSET 5u typedef enum { ArchiveTabFavorites, diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_usb/bad_usb_app.c index 0cf7f1924..0f10d60d8 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_usb/bad_usb_app.c @@ -5,9 +5,9 @@ #include #include -#define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/.badusb.settings" -#define BAD_USB_SETTINGS_FILE_TYPE "Flipper BadUSB Settings File" -#define BAD_USB_SETTINGS_VERSION 1 +#define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/.badusb.settings" +#define BAD_USB_SETTINGS_FILE_TYPE "Flipper BadUSB Settings File" +#define BAD_USB_SETTINGS_VERSION 1 #define BAD_USB_SETTINGS_DEFAULT_LAYOUT BAD_USB_APP_PATH_LAYOUT_FOLDER "/en-US.kl" static bool bad_usb_app_custom_event_callback(void* context, uint32_t event) { diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h index c12f9ac75..34b3db15c 100644 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ b/applications/main/bad_usb/bad_usb_app_i.h @@ -16,10 +16,10 @@ #include "views/bad_usb_view.h" #include -#define BAD_USB_APP_BASE_FOLDER ANY_PATH("badusb") +#define BAD_USB_APP_BASE_FOLDER ANY_PATH("badusb") #define BAD_USB_APP_PATH_LAYOUT_FOLDER BAD_USB_APP_BASE_FOLDER "/assets/layouts" -#define BAD_USB_APP_SCRIPT_EXTENSION ".txt" -#define BAD_USB_APP_LAYOUT_EXTENSION ".kl" +#define BAD_USB_APP_SCRIPT_EXTENSION ".txt" +#define BAD_USB_APP_LAYOUT_EXTENSION ".kl" typedef enum { BadUsbAppErrorNoFiles, @@ -49,4 +49,4 @@ typedef enum { BadUsbAppViewError, BadUsbAppViewWork, BadUsbAppViewConfig, -} BadUsbAppView; \ No newline at end of file +} BadUsbAppView; diff --git a/applications/main/bad_usb/helpers/bad_usb_hid.c b/applications/main/bad_usb/helpers/bad_usb_hid.c index 289e3ae8c..5d7076314 100644 --- a/applications/main/bad_usb/helpers/bad_usb_hid.c +++ b/applications/main/bad_usb/helpers/bad_usb_hid.c @@ -223,4 +223,4 @@ void bad_usb_hid_ble_remove_pairing(void) { furi_check(bt_profile_restore_default(bt)); furi_record_close(RECORD_BT); -} \ No newline at end of file +} diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index 077b1c37b..2ee66955c 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -9,6 +9,7 @@ #include #define TAG "BadUsb" + #define WORKER_TAG TAG "Worker" #define BADUSB_ASCII_TO_KEY(script, x) \ @@ -46,7 +47,7 @@ uint32_t ducky_get_command_len(const char* line) { } bool ducky_is_line_end(const char chr) { - return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); + return (chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n'); } uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept_chars) { @@ -56,7 +57,7 @@ uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept } if((accept_chars) && (strlen(param) > 0)) { - return (BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF); + return BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF; } return 0; } @@ -305,7 +306,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur - 1U); return SCRIPT_STATE_ERROR; } else { - return (delay_val + bad_usb->defdelay); + return delay_val + bad_usb->defdelay; } } @@ -344,7 +345,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur); return SCRIPT_STATE_ERROR; } else { - return (delay_val + bad_usb->defdelay); + return delay_val + bad_usb->defdelay; } } else { furi_string_push_back(bad_usb->line, bad_usb->file_buf[i]); diff --git a/applications/main/bad_usb/helpers/ducky_script_commands.c b/applications/main/bad_usb/helpers/ducky_script_commands.c index 7f9a48fb2..79dcdd531 100644 --- a/applications/main/bad_usb/helpers/ducky_script_commands.c +++ b/applications/main/bad_usb/helpers/ducky_script_commands.c @@ -216,6 +216,7 @@ static const DuckyCmd ducky_commands[] = { }; #define TAG "BadUsb" + #define WORKER_TAG TAG "Worker" int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) { @@ -231,7 +232,7 @@ int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) { if(ducky_commands[i].callback == NULL) { return 0; } else { - return ((ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param)); + return (ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param); } } } diff --git a/applications/main/bad_usb/helpers/ducky_script_i.h b/applications/main/bad_usb/helpers/ducky_script_i.h index bbafdccb6..464c8a72b 100644 --- a/applications/main/bad_usb/helpers/ducky_script_i.h +++ b/applications/main/bad_usb/helpers/ducky_script_i.h @@ -9,10 +9,10 @@ extern "C" { #include "ducky_script.h" #include "bad_usb_hid.h" -#define SCRIPT_STATE_ERROR (-1) -#define SCRIPT_STATE_END (-2) -#define SCRIPT_STATE_NEXT_LINE (-3) -#define SCRIPT_STATE_CMD_UNKNOWN (-4) +#define SCRIPT_STATE_ERROR (-1) +#define SCRIPT_STATE_END (-2) +#define SCRIPT_STATE_NEXT_LINE (-3) +#define SCRIPT_STATE_CMD_UNKNOWN (-4) #define SCRIPT_STATE_STRING_START (-5) #define SCRIPT_STATE_WAIT_FOR_BTN (-6) diff --git a/applications/main/gpio/usb_uart_bridge.c b/applications/main/gpio/usb_uart_bridge.c index 8dff09cb8..f6e68b109 100644 --- a/applications/main/gpio/usb_uart_bridge.c +++ b/applications/main/gpio/usb_uart_bridge.c @@ -10,11 +10,11 @@ #include #include -#define USB_CDC_PKT_LEN CDC_DATA_SZ +#define USB_CDC_PKT_LEN CDC_DATA_SZ #define USB_UART_RX_BUF_SIZE (USB_CDC_PKT_LEN * 5) -#define USB_CDC_BIT_DTR (1 << 0) -#define USB_CDC_BIT_RTS (1 << 1) +#define USB_CDC_BIT_DTR (1 << 0) +#define USB_CDC_BIT_RTS (1 << 1) #define USB_USART_DE_RE_PIN &gpio_ext_pa4 static const GpioPin* flow_pins[][2] = { diff --git a/applications/main/ibutton/ibutton_cli.c b/applications/main/ibutton/ibutton_cli.c index 98ef30801..cf6442c06 100644 --- a/applications/main/ibutton/ibutton_cli.c +++ b/applications/main/ibutton/ibutton_cli.c @@ -31,7 +31,7 @@ static void ibutton_cli_print_usage(void) { printf("\tCyfral (2 bytes key_data)\r\n"); printf("\tMetakom (4 bytes key_data), must contain correct parity\r\n"); printf("\t are hex-formatted\r\n"); -}; +} static bool ibutton_cli_parse_key(iButtonProtocols* protocols, iButtonKey* key, FuriString* args) { bool result = false; @@ -124,7 +124,7 @@ static void ibutton_cli_read(Cli* cli) { ibutton_protocols_free(protocols); furi_event_flag_free(event); -}; +} typedef struct { FuriEventFlag* event; @@ -226,7 +226,7 @@ void ibutton_cli_emulate(Cli* cli, FuriString* args) { ibutton_key_free(key); ibutton_worker_free(worker); ibutton_protocols_free(protocols); -}; +} void ibutton_cli(Cli* cli, FuriString* args, void* context) { UNUSED(cli); diff --git a/applications/main/ibutton/ibutton_i.h b/applications/main/ibutton/ibutton_i.h index c6a35f888..d355a4ea5 100644 --- a/applications/main/ibutton/ibutton_i.h +++ b/applications/main/ibutton/ibutton_i.h @@ -28,8 +28,8 @@ #include "ibutton_custom_event.h" #include "scenes/ibutton_scene.h" -#define IBUTTON_APP_FOLDER ANY_PATH("ibutton") -#define IBUTTON_APP_FILENAME_PREFIX "iBtn" +#define IBUTTON_APP_FOLDER ANY_PATH("ibutton") +#define IBUTTON_APP_FILENAME_PREFIX "iBtn" #define IBUTTON_APP_FILENAME_EXTENSION ".ibtn" #define IBUTTON_KEY_NAME_SIZE 22 diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 93311716a..c6e4bca02 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -10,11 +10,11 @@ #define TAG "InfraredApp" #define INFRARED_TX_MIN_INTERVAL_MS (50U) -#define INFRARED_TASK_STACK_SIZE (2048UL) +#define INFRARED_TASK_STACK_SIZE (2048UL) -#define INFRARED_SETTINGS_PATH INT_PATH(".infrared.settings") +#define INFRARED_SETTINGS_PATH INT_PATH(".infrared.settings") #define INFRARED_SETTINGS_VERSION (1) -#define INFRARED_SETTINGS_MAGIC (0x1F) +#define INFRARED_SETTINGS_MAGIC (0x1F) typedef struct { FuriHalInfraredTxPin tx_pin; diff --git a/applications/main/infrared/infrared_app_i.h b/applications/main/infrared/infrared_app_i.h index 1635fa0dc..d353b2503 100644 --- a/applications/main/infrared/infrared_app_i.h +++ b/applications/main/infrared/infrared_app_i.h @@ -39,18 +39,18 @@ #include "views/infrared_debug_view.h" #include "views/infrared_move_view.h" -#define INFRARED_FILE_NAME_SIZE 100 -#define INFRARED_TEXT_STORE_NUM 2 +#define INFRARED_FILE_NAME_SIZE 100 +#define INFRARED_TEXT_STORE_NUM 2 #define INFRARED_TEXT_STORE_SIZE 128 #define INFRARED_MAX_BUTTON_NAME_LENGTH 22 #define INFRARED_MAX_REMOTE_NAME_LENGTH 22 -#define INFRARED_APP_FOLDER ANY_PATH("infrared") +#define INFRARED_APP_FOLDER ANY_PATH("infrared") #define INFRARED_APP_EXTENSION ".ir" #define INFRARED_DEFAULT_REMOTE_NAME "Remote" -#define INFRARED_LOG_TAG "InfraredApp" +#define INFRARED_LOG_TAG "InfraredApp" /** * @brief Enumeration of invalid remote button indices. @@ -86,7 +86,7 @@ typedef struct { bool is_transmitting; /**< Whether a signal is currently being transmitted. */ bool is_otg_enabled; /**< Whether OTG power (external 5V) is enabled. */ InfraredEditTarget edit_target : 8; /**< Selected editing target (a remote or a button). */ - InfraredEditMode edit_mode : 8; /**< Selected editing operation (rename or delete). */ + InfraredEditMode edit_mode : 8; /**< Selected editing operation (rename or delete). */ int32_t current_button_index; /**< Selected button index (move destination). */ int32_t prev_button_index; /**< Previous button index (move source). */ uint32_t last_transmit_time; /**< Lat time a signal was transmitted. */ diff --git a/applications/main/infrared/infrared_cli.c b/applications/main/infrared/infrared_cli.c index 123fe78d5..169f0c63d 100644 --- a/applications/main/infrared/infrared_cli.c +++ b/applications/main/infrared/infrared_cli.c @@ -10,10 +10,10 @@ #include "infrared_signal.h" #include "infrared_brute_force.h" -#define INFRARED_CLI_BUF_SIZE (10U) -#define INFRARED_CLI_FILE_NAME_SIZE (256U) -#define INFRARED_FILE_EXTENSION ".ir" -#define INFRARED_ASSETS_FOLDER EXT_PATH("infrared/assets") +#define INFRARED_CLI_BUF_SIZE (10U) +#define INFRARED_CLI_FILE_NAME_SIZE (256U) +#define INFRARED_FILE_EXTENSION ".ir" +#define INFRARED_ASSETS_FOLDER EXT_PATH("infrared/assets") #define INFRARED_BRUTE_FORCE_DUMMY_INDEX 0 DICT_DEF2(dict_signals, FuriString*, FURI_STRING_OPLIST, int, M_DEFAULT_OPLIST) diff --git a/applications/main/infrared/infrared_remote.c b/applications/main/infrared/infrared_remote.c index c574d75c7..11bbf197b 100644 --- a/applications/main/infrared/infrared_remote.c +++ b/applications/main/infrared/infrared_remote.c @@ -8,7 +8,7 @@ #define TAG "InfraredRemote" -#define INFRARED_FILE_HEADER "IR signals file" +#define INFRARED_FILE_HEADER "IR signals file" #define INFRARED_FILE_VERSION (1) ARRAY_DEF(StringArray, const char*, M_CSTR_DUP_OPLIST); //-V575 diff --git a/applications/main/infrared/infrared_signal.c b/applications/main/infrared/infrared_signal.c index 8902fc04c..a4cb28bf0 100644 --- a/applications/main/infrared/infrared_signal.c +++ b/applications/main/infrared/infrared_signal.c @@ -13,18 +13,18 @@ #define INFRARED_SIGNAL_TYPE_KEY "type" // Type key values -#define INFRARED_SIGNAL_TYPE_RAW "raw" +#define INFRARED_SIGNAL_TYPE_RAW "raw" #define INFRARED_SIGNAL_TYPE_PARSED "parsed" // Raw signal keys -#define INFRARED_SIGNAL_DATA_KEY "data" -#define INFRARED_SIGNAL_FREQUENCY_KEY "frequency" +#define INFRARED_SIGNAL_DATA_KEY "data" +#define INFRARED_SIGNAL_FREQUENCY_KEY "frequency" #define INFRARED_SIGNAL_DUTY_CYCLE_KEY "duty_cycle" // Parsed signal keys #define INFRARED_SIGNAL_PROTOCOL_KEY "protocol" -#define INFRARED_SIGNAL_ADDRESS_KEY "address" -#define INFRARED_SIGNAL_COMMAND_KEY "command" +#define INFRARED_SIGNAL_ADDRESS_KEY "address" +#define INFRARED_SIGNAL_COMMAND_KEY "command" struct InfraredSignal { bool is_raw; diff --git a/applications/main/infrared/views/infrared_move_view.c b/applications/main/infrared/views/infrared_move_view.c index 5635d8a74..f3fc6dde1 100644 --- a/applications/main/infrared/views/infrared_move_view.c +++ b/applications/main/infrared/views/infrared_move_view.c @@ -7,9 +7,9 @@ #include -#define LIST_ITEMS 4U -#define LIST_LINE_H 13U -#define HEADER_H 12U +#define LIST_ITEMS 4U +#define LIST_LINE_H 13U +#define HEADER_H 12U #define MOVE_X_OFFSET 5U struct InfraredMoveView { @@ -98,7 +98,7 @@ static bool infrared_move_view_input_callback(InputEvent* event, void* context) bool consumed = false; - if(((event->type == InputTypeShort || event->type == InputTypeRepeat)) && + if((event->type == InputTypeShort || event->type == InputTypeRepeat) && ((event->key == InputKeyUp) || (event->key == InputKeyDown))) { with_view_model( move_view->view, diff --git a/applications/main/lfrfid/lfrfid_cli.c b/applications/main/lfrfid/lfrfid_cli.c index 2101670fa..a25032d6a 100644 --- a/applications/main/lfrfid/lfrfid_cli.c +++ b/applications/main/lfrfid/lfrfid_cli.c @@ -32,7 +32,7 @@ static void lfrfid_cli_print_usage(void) { "rfid raw_emulate - emulate raw data (not very useful, but helps debug protocols)\r\n"); printf( "rfid raw_analyze - outputs raw data to the cli and tries to decode it (useful for protocol development)\r\n"); -}; +} typedef struct { ProtocolId protocol; diff --git a/applications/main/lfrfid/lfrfid_i.h b/applications/main/lfrfid/lfrfid_i.h index 706231545..b1f82d026 100644 --- a/applications/main/lfrfid/lfrfid_i.h +++ b/applications/main/lfrfid/lfrfid_i.h @@ -35,13 +35,13 @@ #include -#define LFRFID_KEY_NAME_SIZE 22 +#define LFRFID_KEY_NAME_SIZE 22 #define LFRFID_TEXT_STORE_SIZE 40 -#define LFRFID_APP_FOLDER ANY_PATH("lfrfid") -#define LFRFID_SD_FOLDER EXT_PATH("lfrfid") -#define LFRFID_APP_FILENAME_PREFIX "RFID" -#define LFRFID_APP_FILENAME_EXTENSION ".rfid" +#define LFRFID_APP_FOLDER ANY_PATH("lfrfid") +#define LFRFID_SD_FOLDER EXT_PATH("lfrfid") +#define LFRFID_APP_FILENAME_PREFIX "RFID" +#define LFRFID_APP_FILENAME_EXTENSION ".rfid" #define LFRFID_APP_SHADOW_FILENAME_EXTENSION ".shd" #define LFRFID_APP_RAW_ASK_EXTENSION ".ask.raw" diff --git a/applications/main/nfc/api/gallagher/gallagher_util.c b/applications/main/nfc/api/gallagher/gallagher_util.c index caa3650e7..8217d0383 100644 --- a/applications/main/nfc/api/gallagher/gallagher_util.c +++ b/applications/main/nfc/api/gallagher/gallagher_util.c @@ -56,4 +56,4 @@ void gallagher_deobfuscate_and_parse_credential( ((uint32_t)cardholder_data_deobfuscated[2] << 3) + (((uint32_t)cardholder_data_deobfuscated[3] >> 5) & 0x07); credential->issue = cardholder_data_deobfuscated[7] & 0x0F; -} \ No newline at end of file +} diff --git a/applications/main/nfc/api/gallagher/gallagher_util.h b/applications/main/nfc/api/gallagher/gallagher_util.h index 79e098389..eeff5ae08 100644 --- a/applications/main/nfc/api/gallagher/gallagher_util.h +++ b/applications/main/nfc/api/gallagher/gallagher_util.h @@ -30,4 +30,4 @@ void gallagher_deobfuscate_and_parse_credential( #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/main/nfc/api/mosgortrans/mosgortrans_util.h b/applications/main/nfc/api/mosgortrans/mosgortrans_util.h index e5da8ddeb..2dc469c45 100644 --- a/applications/main/nfc/api/mosgortrans/mosgortrans_util.h +++ b/applications/main/nfc/api/mosgortrans/mosgortrans_util.h @@ -14,4 +14,4 @@ bool mosgortrans_parse_transport_block(const MfClassicBlock* block, FuriString* #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/main/nfc/helpers/felica_auth.c b/applications/main/nfc/helpers/felica_auth.c index a8cd0929b..6e2cf786a 100644 --- a/applications/main/nfc/helpers/felica_auth.c +++ b/applications/main/nfc/helpers/felica_auth.c @@ -18,4 +18,4 @@ void felica_auth_reset(FelicaAuthenticationContext* instance) { instance->skip_auth = true; instance->auth_status.external = 0; instance->auth_status.internal = 0; -} \ No newline at end of file +} diff --git a/applications/main/nfc/helpers/mf_classic_key_cache.c b/applications/main/nfc/helpers/mf_classic_key_cache.c index 2c1141e9c..1b945660c 100644 --- a/applications/main/nfc/helpers/mf_classic_key_cache.c +++ b/applications/main/nfc/helpers/mf_classic_key_cache.c @@ -3,7 +3,7 @@ #include #include -#define NFC_APP_KEYS_EXTENSION ".keys" +#define NFC_APP_KEYS_EXTENSION ".keys" #define NFC_APP_KEY_CACHE_FOLDER "/ext/nfc/.cache" static const char* mf_classic_key_cache_file_header = "Flipper NFC keys"; diff --git a/applications/main/nfc/helpers/mf_user_dict.c b/applications/main/nfc/helpers/mf_user_dict.c index 9410c8537..70b111472 100644 --- a/applications/main/nfc/helpers/mf_user_dict.c +++ b/applications/main/nfc/helpers/mf_user_dict.c @@ -4,7 +4,7 @@ #include #include -#define NFC_APP_FOLDER ANY_PATH("nfc") +#define NFC_APP_FOLDER ANY_PATH("nfc") #define NFC_APP_MF_CLASSIC_DICT_USER_PATH (NFC_APP_FOLDER "/assets/mf_classic_dict_user.nfc") struct MfUserDict { diff --git a/applications/main/nfc/helpers/nfc_supported_cards.c b/applications/main/nfc/helpers/nfc_supported_cards.c index d2950b584..6513eef5f 100644 --- a/applications/main/nfc/helpers/nfc_supported_cards.c +++ b/applications/main/nfc/helpers/nfc_supported_cards.c @@ -14,7 +14,7 @@ #define TAG "NfcSupportedCards" -#define NFC_SUPPORTED_CARDS_PLUGINS_PATH APP_DATA_PATH("plugins") +#define NFC_SUPPORTED_CARDS_PLUGINS_PATH APP_DATA_PATH("plugins") #define NFC_SUPPORTED_CARDS_PLUGIN_SUFFIX "_parser.fal" typedef enum { diff --git a/applications/main/nfc/helpers/protocol_support/felica/felica_render.h b/applications/main/nfc/helpers/protocol_support/felica/felica_render.h index 3d32e8d14..48bea4433 100644 --- a/applications/main/nfc/helpers/protocol_support/felica/felica_render.h +++ b/applications/main/nfc/helpers/protocol_support/felica/felica_render.h @@ -19,4 +19,4 @@ void nfc_render_felica_dump(const FelicaData* data, FuriString* str); void nfc_render_felica_idm( const FelicaData* data, NfcProtocolFormatType format_type, - FuriString* str); \ No newline at end of file + FuriString* str); diff --git a/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.c b/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.c index eb2299cb5..c7b36e21e 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.c +++ b/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.c @@ -120,4 +120,4 @@ const NfcProtocolSupportBase nfc_protocol_support_mf_plus = { .on_enter = nfc_scene_emulate_on_enter_mf_plus, .on_event = nfc_protocol_support_common_on_event_empty, }, -}; \ No newline at end of file +}; diff --git a/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.h b/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.h index 7f2e63dd1..049e46e64 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.h +++ b/applications/main/nfc/helpers/protocol_support/mf_plus/mf_plus.h @@ -2,4 +2,4 @@ #include "../nfc_protocol_support_base.h" -extern const NfcProtocolSupportBase nfc_protocol_support_mf_plus; \ No newline at end of file +extern const NfcProtocolSupportBase nfc_protocol_support_mf_plus; diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.h b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.h index 5b15bb591..eddae0bca 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.h +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.h @@ -11,4 +11,4 @@ void nfc_render_mf_ultralight_info( void nfc_render_mf_ultralight_dump(const MfUltralightData* data, FuriString* str); -void nfc_render_mf_ultralight_pwd_pack(const MfUltralightData* data, FuriString* str); \ No newline at end of file +void nfc_render_mf_ultralight_pwd_pack(const MfUltralightData* data, FuriString* str); diff --git a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.h b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.h index 855642c62..d3efc3a41 100644 --- a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.h +++ b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.h @@ -113,4 +113,4 @@ bool nfc_protocol_support_on_event( */ void nfc_protocol_support_on_exit(NfcProtocolSupportScene scene, void* context); -bool nfc_protocol_support_has_feature(NfcProtocol protocol, NfcProtocolFeature feature); \ No newline at end of file +bool nfc_protocol_support_has_feature(NfcProtocol protocol, NfcProtocolFeature feature); diff --git a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.c b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.c index 598cf7a7e..8cfb26a53 100644 --- a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.c +++ b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.c @@ -35,4 +35,4 @@ void nfc_unlock_helper_card_detected_handler(NfcApp* instance) { scene_manager_set_scene_state( instance->scene_manager, NfcSceneRead, NfcSceneReadMenuStateCardFound); nfc_scene_read_setup_view(instance); -} \ No newline at end of file +} diff --git a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.h b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.h index 65da33240..34f52496b 100644 --- a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.h +++ b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support_unlock_helper.h @@ -6,4 +6,4 @@ typedef enum { } NfcSceneUnlockReadState; void nfc_unlock_helper_setup_from_state(NfcApp* instance); -void nfc_unlock_helper_card_detected_handler(NfcApp* instance); \ No newline at end of file +void nfc_unlock_helper_card_detected_handler(NfcApp* instance); diff --git a/applications/main/nfc/nfc_app_i.h b/applications/main/nfc/nfc_app_i.h index 64f7fc6e7..c91ef33df 100644 --- a/applications/main/nfc/nfc_app_i.h +++ b/applications/main/nfc/nfc_app_i.h @@ -61,19 +61,19 @@ #include #include -#define NFC_NAME_SIZE 22 -#define NFC_TEXT_STORE_SIZE 128 +#define NFC_NAME_SIZE 22 +#define NFC_TEXT_STORE_SIZE 128 #define NFC_BYTE_INPUT_STORE_SIZE 10 -#define NFC_LOG_SIZE_MAX (1024) -#define NFC_APP_FOLDER ANY_PATH("nfc") -#define NFC_APP_EXTENSION ".nfc" -#define NFC_APP_SHADOW_EXTENSION ".shd" -#define NFC_APP_FILENAME_PREFIX "NFC" +#define NFC_LOG_SIZE_MAX (1024) +#define NFC_APP_FOLDER ANY_PATH("nfc") +#define NFC_APP_EXTENSION ".nfc" +#define NFC_APP_SHADOW_EXTENSION ".shd" +#define NFC_APP_FILENAME_PREFIX "NFC" #define NFC_APP_MFKEY32_LOGS_FILE_NAME ".mfkey32.log" #define NFC_APP_MFKEY32_LOGS_FILE_PATH (NFC_APP_FOLDER "/" NFC_APP_MFKEY32_LOGS_FILE_NAME) -#define NFC_APP_MF_CLASSIC_DICT_USER_PATH (NFC_APP_FOLDER "/assets/mf_classic_dict_user.nfc") +#define NFC_APP_MF_CLASSIC_DICT_USER_PATH (NFC_APP_FOLDER "/assets/mf_classic_dict_user.nfc") #define NFC_APP_MF_CLASSIC_DICT_SYSTEM_PATH (NFC_APP_FOLDER "/assets/mf_classic_dict.nfc") typedef enum { diff --git a/applications/main/nfc/plugins/supported_cards/gallagher.c b/applications/main/nfc/plugins/supported_cards/gallagher.c index 84ac335a4..e88a85f2b 100644 --- a/applications/main/nfc/plugins/supported_cards/gallagher.c +++ b/applications/main/nfc/plugins/supported_cards/gallagher.c @@ -85,4 +85,4 @@ static const FlipperAppPluginDescriptor gallagher_plugin_descriptor = { /* Plugin entry point */ const FlipperAppPluginDescriptor* gallagher_plugin_ep(void) { return &gallagher_plugin_descriptor; -} \ No newline at end of file +} diff --git a/applications/main/nfc/plugins/supported_cards/hi.c b/applications/main/nfc/plugins/supported_cards/hi.c index f24c1c11a..a26d22650 100644 --- a/applications/main/nfc/plugins/supported_cards/hi.c +++ b/applications/main/nfc/plugins/supported_cards/hi.c @@ -5,9 +5,10 @@ #include #define TAG "HI!" -#define KEY_LENGTH 6 + +#define KEY_LENGTH 6 #define HI_KEY_TO_GEN 5 -#define UID_LENGTH 7 +#define UID_LENGTH 7 typedef struct { uint64_t a; diff --git a/applications/main/nfc/plugins/supported_cards/microel.c b/applications/main/nfc/plugins/supported_cards/microel.c index fa3be7235..18d08f533 100644 --- a/applications/main/nfc/plugins/supported_cards/microel.c +++ b/applications/main/nfc/plugins/supported_cards/microel.c @@ -5,6 +5,7 @@ #include #define TAG "Microel" + #define KEY_LENGTH 6 #define UID_LENGTH 4 @@ -227,4 +228,4 @@ static const FlipperAppPluginDescriptor microel_plugin_descriptor = { /* Plugin entry point - must return a pointer to const descriptor */ const FlipperAppPluginDescriptor* microel_plugin_ep(void) { return µel_plugin_descriptor; -} \ No newline at end of file +} diff --git a/applications/main/nfc/plugins/supported_cards/mizip.c b/applications/main/nfc/plugins/supported_cards/mizip.c index 0fd1a8f4a..c29c5f908 100644 --- a/applications/main/nfc/plugins/supported_cards/mizip.c +++ b/applications/main/nfc/plugins/supported_cards/mizip.c @@ -5,9 +5,10 @@ #include #define TAG "MiZIP" -#define KEY_LENGTH 6 + +#define KEY_LENGTH 6 #define MIZIP_KEY_TO_GEN 5 -#define UID_LENGTH 4 +#define UID_LENGTH 4 typedef struct { uint64_t a; diff --git a/applications/main/nfc/plugins/supported_cards/opal.c b/applications/main/nfc/plugins/supported_cards/opal.c index db9a1784c..b499e4978 100644 --- a/applications/main/nfc/plugins/supported_cards/opal.c +++ b/applications/main/nfc/plugins/supported_cards/opal.c @@ -62,18 +62,18 @@ static const char* opal_usages[14] = { // Opal file 0x7 structure. Assumes a little-endian CPU. typedef struct FURI_PACKED { - uint32_t serial : 32; - uint8_t check_digit : 4; - bool blocked : 1; - uint16_t txn_number : 16; - int32_t balance : 21; - uint16_t days : 15; - uint16_t minutes : 11; - uint8_t mode : 3; - uint16_t usage : 4; - bool auto_topup : 1; + uint32_t serial : 32; + uint8_t check_digit : 4; + bool blocked : 1; + uint16_t txn_number : 16; + int32_t balance : 21; + uint16_t days : 15; + uint16_t minutes : 11; + uint8_t mode : 3; + uint16_t usage : 4; + bool auto_topup : 1; uint8_t weekly_journeys : 4; - uint16_t checksum : 16; + uint16_t checksum : 16; } OpalFile; static_assert(sizeof(OpalFile) == 16, "OpalFile"); diff --git a/applications/main/nfc/plugins/supported_cards/troika.c b/applications/main/nfc/plugins/supported_cards/troika.c index de9a47fac..0c93fa59a 100644 --- a/applications/main/nfc/plugins/supported_cards/troika.c +++ b/applications/main/nfc/plugins/supported_cards/troika.c @@ -260,4 +260,4 @@ static const FlipperAppPluginDescriptor troika_plugin_descriptor = { /* Plugin entry point - must return a pointer to const descriptor */ const FlipperAppPluginDescriptor* troika_plugin_ep(void) { return &troika_plugin_descriptor; -} \ No newline at end of file +} diff --git a/applications/main/nfc/plugins/supported_cards/umarsh.c b/applications/main/nfc/plugins/supported_cards/umarsh.c index fd0b09680..298e201d8 100644 --- a/applications/main/nfc/plugins/supported_cards/umarsh.c +++ b/applications/main/nfc/plugins/supported_cards/umarsh.c @@ -40,7 +40,7 @@ bool parse_datetime(uint16_t date, DateTime* result) { result->year = 2000 + (date >> 9); result->month = date >> 5 & 0x0F; result->day = date & 0x1F; - return (date != 0); + return date != 0; } static bool umarsh_parse(const NfcDevice* device, FuriString* parsed_data) { diff --git a/applications/main/nfc/plugins/supported_cards/washcity.c b/applications/main/nfc/plugins/supported_cards/washcity.c index 6a8c8c28b..737e57341 100644 --- a/applications/main/nfc/plugins/supported_cards/washcity.c +++ b/applications/main/nfc/plugins/supported_cards/washcity.c @@ -194,4 +194,4 @@ static const FlipperAppPluginDescriptor washcity_plugin_descriptor = { /* Plugin entry point - must return a pointer to const descriptor */ const FlipperAppPluginDescriptor* washcity_plugin_ep(void) { return &washcity_plugin_descriptor; -} \ No newline at end of file +} diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_detect_reader.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_detect_reader.c index e2d3e6d72..176b014e9 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_detect_reader.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_detect_reader.c @@ -4,7 +4,7 @@ #define NXP_MANUFACTURER_ID (0x04) -#define NFC_SCENE_DETECT_READER_PAIR_NONCES_MAX (10U) +#define NFC_SCENE_DETECT_READER_PAIR_NONCES_MAX (10U) #define NFC_SCENE_DETECT_READER_WAIT_NONCES_TIMEOUT_MS (1000) static const NotificationSequence sequence_detect_reader = { diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial_wrong_card.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial_wrong_card.c index c2c36c74f..f3aefb781 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial_wrong_card.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial_wrong_card.c @@ -55,4 +55,4 @@ void nfc_scene_mf_classic_update_initial_wrong_card_on_exit(void* context) { NfcApp* instance = context; widget_reset(instance->widget); -} \ No newline at end of file +} diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c index 3f92ebfd3..3d49b3cac 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c @@ -54,4 +54,4 @@ void nfc_scene_mf_classic_write_initial_wrong_card_on_exit(void* context) { NfcApp* instance = context; widget_reset(instance->widget); -} \ No newline at end of file +} diff --git a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_wrong_card.c b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_wrong_card.c index 0ca765db7..bc34a45b4 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_wrong_card.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_wrong_card.c @@ -55,4 +55,4 @@ void nfc_scene_mf_ultralight_wrong_card_on_exit(void* context) { NfcApp* instance = context; widget_reset(instance->widget); -} \ No newline at end of file +} diff --git a/applications/main/onewire/onewire_cli.c b/applications/main/onewire/onewire_cli.c index 19e584217..af3d4e803 100644 --- a/applications/main/onewire/onewire_cli.c +++ b/applications/main/onewire/onewire_cli.c @@ -21,7 +21,7 @@ void onewire_on_system_start(void) { static void onewire_cli_print_usage(void) { printf("Usage:\r\n"); printf("onewire search\r\n"); -}; +} static void onewire_cli_search(Cli* cli) { UNUSED(cli); diff --git a/applications/main/subghz/helpers/subghz_chat.c b/applications/main/subghz/helpers/subghz_chat.c index bbe219fd2..9945b69c8 100644 --- a/applications/main/subghz/helpers/subghz_chat.c +++ b/applications/main/subghz/helpers/subghz_chat.c @@ -2,6 +2,7 @@ #include #define TAG "SubGhzChat" + #define SUBGHZ_CHAT_WORKER_TIMEOUT_BETWEEN_MESSAGES 500 struct SubGhzChatWorker { diff --git a/applications/main/subghz/helpers/subghz_threshold_rssi.c b/applications/main/subghz/helpers/subghz_threshold_rssi.c index f9906b513..188ded35e 100644 --- a/applications/main/subghz/helpers/subghz_threshold_rssi.c +++ b/applications/main/subghz/helpers/subghz_threshold_rssi.c @@ -3,6 +3,7 @@ #include #define TAG "SubGhzThresholdRssi" + #define THRESHOLD_RSSI_LOW_COUNT 10 struct SubGhzThresholdRssi { diff --git a/applications/main/subghz/helpers/subghz_txrx.c b/applications/main/subghz/helpers/subghz_txrx.c index d14be4768..e3a0c6057 100644 --- a/applications/main/subghz/helpers/subghz_txrx.c +++ b/applications/main/subghz/helpers/subghz_txrx.c @@ -508,22 +508,19 @@ SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) { bool subghz_txrx_protocol_is_serializable(SubGhzTxRx* instance) { furi_assert(instance); - return ( - (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) == - SubGhzProtocolFlag_Save); + return (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) == + SubGhzProtocolFlag_Save; } bool subghz_txrx_protocol_is_transmittable(SubGhzTxRx* instance, bool check_type) { furi_assert(instance); const SubGhzProtocol* protocol = instance->decoder_result->protocol; if(check_type) { - return ( - ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && - protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic); + return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && + protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic; } - return ( - ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && - protocol->encoder->deserialize); + return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && + protocol->encoder->deserialize; } void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) { @@ -609,4 +606,4 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance) { bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency) { furi_assert(instance); return subghz_devices_is_frequency_valid(instance->radio_device, frequency); -} \ No newline at end of file +} diff --git a/applications/main/subghz/helpers/subghz_txrx.h b/applications/main/subghz/helpers/subghz_txrx.h index a16625f8b..b2ca44ee7 100644 --- a/applications/main/subghz/helpers/subghz_txrx.h +++ b/applications/main/subghz/helpers/subghz_txrx.h @@ -333,4 +333,4 @@ const char* subghz_txrx_radio_device_get_name(SubGhzTxRx* instance); * @param instance Pointer to a SubGhzTxRx * @return bool True if the frequency is valid */ -bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency); \ No newline at end of file +bool subghz_txrx_radio_device_is_frequecy_valid(SubGhzTxRx* instance, uint32_t frequency); diff --git a/applications/main/subghz/helpers/subghz_txrx_create_protocol_key.h b/applications/main/subghz/helpers/subghz_txrx_create_protocol_key.h index edc6e5415..89a52f235 100644 --- a/applications/main/subghz/helpers/subghz_txrx_create_protocol_key.h +++ b/applications/main/subghz/helpers/subghz_txrx_create_protocol_key.h @@ -93,4 +93,4 @@ SubGhzProtocolStatus subghz_txrx_gen_secplus_v2_protocol( SubGhzProtocolStatus subghz_txrx_gen_secplus_v1_protocol( SubGhzTxRx* instance, const char* name_preset, - uint32_t frequency); \ No newline at end of file + uint32_t frequency); diff --git a/applications/main/subghz/scenes/subghz_scene_read_raw.c b/applications/main/subghz/scenes/subghz_scene_read_raw.c index b12c94681..449a799f0 100644 --- a/applications/main/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_read_raw.c @@ -4,9 +4,10 @@ #include #include -#define RAW_FILE_NAME "Raw_signal_" #define TAG "SubGhzSceneReadRaw" +#define RAW_FILE_NAME "Raw_signal_" + bool subghz_scene_read_raw_update_filename(SubGhz* subghz) { bool ret = false; //set the path to read the file diff --git a/applications/main/subghz/subghz_cli.c b/applications/main/subghz/subghz_cli.c index b96a22db6..b6d3bf5c4 100644 --- a/applications/main/subghz/subghz_cli.c +++ b/applications/main/subghz/subghz_cli.c @@ -1203,7 +1203,7 @@ static bool subghz_on_system_start_istream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) { File* file = istream->state; size_t ret = storage_file_read(file, buf, count); - return (count == ret); + return count == ret; } static bool subghz_on_system_start_istream_decode_band( diff --git a/applications/main/subghz/subghz_history.c b/applications/main/subghz/subghz_history.c index e6c93e05c..85e59ae07 100644 --- a/applications/main/subghz/subghz_history.c +++ b/applications/main/subghz/subghz_history.c @@ -4,8 +4,9 @@ #include -#define SUBGHZ_HISTORY_MAX 50 +#define SUBGHZ_HISTORY_MAX 50 #define SUBGHZ_HISTORY_FREE_HEAP 20480 + #define TAG "SubGhzHistory" typedef struct { diff --git a/applications/main/subghz/subghz_i.c b/applications/main/subghz/subghz_i.c index 243ad101f..61544c5df 100644 --- a/applications/main/subghz/subghz_i.c +++ b/applications/main/subghz/subghz_i.c @@ -408,7 +408,7 @@ void subghz_unlock(SubGhz* subghz) { bool subghz_is_locked(SubGhz* subghz) { furi_assert(subghz); - return (subghz->lock == SubGhzLockOn); + return subghz->lock == SubGhzLockOn; } void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state) { diff --git a/applications/main/subghz/views/receiver.c b/applications/main/subghz/views/receiver.c index 39b5c78b9..ea74f8c6c 100644 --- a/applications/main/subghz/views/receiver.c +++ b/applications/main/subghz/views/receiver.c @@ -7,9 +7,9 @@ #include #define FRAME_HEIGHT 12 -#define MAX_LEN_PX 111 -#define MENU_ITEMS 4u -#define UNLOCK_CNT 3 +#define MAX_LEN_PX 111 +#define MENU_ITEMS 4u +#define UNLOCK_CNT 3 #define SUBGHZ_RAW_THRESHOLD_MIN -90.0f @@ -145,7 +145,7 @@ void subghz_view_receiver_add_item_to_menu( SubGhzReceiverMenuItemArray_push_raw(model->history->data); item_menu->item_str = furi_string_alloc_set(name); item_menu->type = type; - if((model->idx == model->history_item - 1)) { + if(model->idx == model->history_item - 1) { model->history_item++; model->idx++; } else { diff --git a/applications/main/subghz/views/subghz_frequency_analyzer.c b/applications/main/subghz/views/subghz_frequency_analyzer.c index b59426f02..8e66c56ed 100644 --- a/applications/main/subghz/views/subghz_frequency_analyzer.c +++ b/applications/main/subghz/views/subghz_frequency_analyzer.c @@ -46,8 +46,7 @@ typedef struct { } SubGhzFrequencyAnalyzerModel; static inline uint8_t rssi_sanitize(float rssi) { - return ( - !float_is_equal(rssi, 0.f) ? (uint8_t)(rssi - SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD) : 0); + return !float_is_equal(rssi, 0.f) ? (uint8_t)(rssi - SUBGHZ_FREQUENCY_ANALYZER_THRESHOLD) : 0; } void subghz_frequency_analyzer_set_callback( diff --git a/applications/main/subghz/views/subghz_read_raw.c b/applications/main/subghz/views/subghz_read_raw.c index 322c0d499..566581869 100644 --- a/applications/main/subghz/views/subghz_read_raw.c +++ b/applications/main/subghz/views/subghz_read_raw.c @@ -6,9 +6,11 @@ #include #include -#define SUBGHZ_READ_RAW_RSSI_HISTORY_SIZE 100 + #define TAG "SubGhzReadRaw" +#define SUBGHZ_READ_RAW_RSSI_HISTORY_SIZE 100 + struct SubGhzReadRAW { View* view; SubGhzReadRAWCallback callback; diff --git a/applications/main/u2f/u2f.c b/applications/main/u2f/u2f.c index b61cfa15d..6a37769a8 100644 --- a/applications/main/u2f/u2f.c +++ b/applications/main/u2f/u2f.c @@ -12,13 +12,14 @@ #include #define TAG "U2f" + #define WORKER_TAG TAG "Worker" #define MCHECK(expr) furi_check((expr) == 0) -#define U2F_CMD_REGISTER 0x01 +#define U2F_CMD_REGISTER 0x01 #define U2F_CMD_AUTHENTICATE 0x02 -#define U2F_CMD_VERSION 0x03 +#define U2F_CMD_VERSION 0x03 typedef enum { U2fCheckOnly = 0x07, // "check-only" - only check key handle, don't send auth response @@ -28,14 +29,14 @@ typedef enum { 0x08, // "dont-enforce-user-presence-and-sign" - send auth response even if user is missing } U2fAuthMode; -#define U2F_HASH_SIZE 32 -#define U2F_NONCE_SIZE 32 +#define U2F_HASH_SIZE 32 +#define U2F_NONCE_SIZE 32 #define U2F_CHALLENGE_SIZE 32 -#define U2F_APP_ID_SIZE 32 +#define U2F_APP_ID_SIZE 32 -#define U2F_EC_KEY_SIZE 32 +#define U2F_EC_KEY_SIZE 32 #define U2F_EC_BIGNUM_SIZE 32 -#define U2F_EC_POINT_SIZE 65 +#define U2F_EC_POINT_SIZE 65 typedef struct { uint8_t format; @@ -315,7 +316,7 @@ static uint16_t u2f_register(U2fData* U2F, uint8_t* buf) { uint8_t signature_len = u2f_der_encode_signature(resp->cert + cert_len, signature); memcpy(resp->cert + cert_len + signature_len, state_no_error, 2); - return (sizeof(U2fRegisterResp) + cert_len + signature_len + 2); + return sizeof(U2fRegisterResp) + cert_len + signature_len + 2; } static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) { @@ -410,7 +411,7 @@ static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) { if(U2F->callback != NULL) U2F->callback(U2fNotifyAuthSuccess, U2F->context); - return (sizeof(U2fAuthResp) + signature_len + 2); + return sizeof(U2fAuthResp) + signature_len + 2; } uint16_t u2f_msg_parse(U2fData* U2F, uint8_t* buf, uint16_t len) { diff --git a/applications/main/u2f/u2f_data.c b/applications/main/u2f/u2f_data.c index c6451757b..52c6b37d5 100644 --- a/applications/main/u2f/u2f_data.c +++ b/applications/main/u2f/u2f_data.c @@ -7,28 +7,28 @@ #define TAG "U2f" -#define U2F_DATA_FOLDER EXT_PATH("u2f/") -#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der" +#define U2F_DATA_FOLDER EXT_PATH("u2f/") +#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der" #define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f" -#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f" -#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f" +#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f" +#define U2F_CNT_FILE U2F_DATA_FOLDER "cnt.u2f" #define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_FACTORY 2 -#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE FURI_HAL_CRYPTO_ENCLAVE_UNIQUE_KEY_SLOT +#define U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE FURI_HAL_CRYPTO_ENCLAVE_UNIQUE_KEY_SLOT #define U2F_CERT_STOCK 0 // Stock certificate, private key is encrypted with factory key -#define U2F_CERT_USER 1 // User certificate, private key is encrypted with unique key +#define U2F_CERT_USER 1 // User certificate, private key is encrypted with unique key #define U2F_CERT_USER_UNENCRYPTED \ 2 // Unencrypted user certificate, will be encrypted after first load #define U2F_CERT_KEY_FILE_TYPE "Flipper U2F Certificate Key File" -#define U2F_CERT_KEY_VERSION 1 +#define U2F_CERT_KEY_VERSION 1 #define U2F_DEVICE_KEY_FILE_TYPE "Flipper U2F Device Key File" -#define U2F_DEVICE_KEY_VERSION 1 +#define U2F_DEVICE_KEY_VERSION 1 -#define U2F_COUNTER_FILE_TYPE "Flipper U2F Counter File" -#define U2F_COUNTER_VERSION 2 +#define U2F_COUNTER_FILE_TYPE "Flipper U2F Counter File" +#define U2F_COUNTER_VERSION 2 #define U2F_COUNTER_VERSION_OLD 1 #define U2F_COUNTER_CONTROL_VAL 0xAA5500FF diff --git a/applications/main/u2f/u2f_hid.c b/applications/main/u2f/u2f_hid.c index 83c8a575f..76d3d7cec 100644 --- a/applications/main/u2f/u2f_hid.c +++ b/applications/main/u2f/u2f_hid.c @@ -9,6 +9,7 @@ #include #define TAG "U2fHid" + #define WORKER_TAG TAG "Worker" #define U2F_HID_MAX_PAYLOAD_LEN ((HID_U2F_PACKET_LEN - 7) + 128 * (HID_U2F_PACKET_LEN - 5)) @@ -17,23 +18,23 @@ #define U2F_HID_TYPE_INIT 0x80 // Initial frame identifier #define U2F_HID_TYPE_CONT 0x00 // Continuation frame identifier -#define U2F_HID_PING (U2F_HID_TYPE_INIT | 0x01) // Echo data through local processor only -#define U2F_HID_MSG (U2F_HID_TYPE_INIT | 0x03) // Send U2F message frame -#define U2F_HID_LOCK (U2F_HID_TYPE_INIT | 0x04) // Send lock channel command -#define U2F_HID_INIT (U2F_HID_TYPE_INIT | 0x06) // Channel initialization -#define U2F_HID_WINK (U2F_HID_TYPE_INIT | 0x08) // Send device identification wink +#define U2F_HID_PING (U2F_HID_TYPE_INIT | 0x01) // Echo data through local processor only +#define U2F_HID_MSG (U2F_HID_TYPE_INIT | 0x03) // Send U2F message frame +#define U2F_HID_LOCK (U2F_HID_TYPE_INIT | 0x04) // Send lock channel command +#define U2F_HID_INIT (U2F_HID_TYPE_INIT | 0x06) // Channel initialization +#define U2F_HID_WINK (U2F_HID_TYPE_INIT | 0x08) // Send device identification wink #define U2F_HID_ERROR (U2F_HID_TYPE_INIT | 0x3f) // Error response -#define U2F_HID_ERR_NONE 0x00 // No error -#define U2F_HID_ERR_INVALID_CMD 0x01 // Invalid command -#define U2F_HID_ERR_INVALID_PAR 0x02 // Invalid parameter -#define U2F_HID_ERR_INVALID_LEN 0x03 // Invalid message length -#define U2F_HID_ERR_INVALID_SEQ 0x04 // Invalid message sequencing -#define U2F_HID_ERR_MSG_TIMEOUT 0x05 // Message has timed out -#define U2F_HID_ERR_CHANNEL_BUSY 0x06 // Channel busy +#define U2F_HID_ERR_NONE 0x00 // No error +#define U2F_HID_ERR_INVALID_CMD 0x01 // Invalid command +#define U2F_HID_ERR_INVALID_PAR 0x02 // Invalid parameter +#define U2F_HID_ERR_INVALID_LEN 0x03 // Invalid message length +#define U2F_HID_ERR_INVALID_SEQ 0x04 // Invalid message sequencing +#define U2F_HID_ERR_MSG_TIMEOUT 0x05 // Message has timed out +#define U2F_HID_ERR_CHANNEL_BUSY 0x06 // Channel busy #define U2F_HID_ERR_LOCK_REQUIRED 0x0a // Command requires channel lock -#define U2F_HID_ERR_SYNC_FAIL 0x0b // SYNC command failed -#define U2F_HID_ERR_OTHER 0x7f // Other unspecified error +#define U2F_HID_ERR_SYNC_FAIL 0x0b // SYNC command failed +#define U2F_HID_ERR_OTHER 0x7f // Other unspecified error #define U2F_HID_BROADCAST_CID 0xFFFFFFFF diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index 59eb86388..e3afceb70 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -11,9 +11,9 @@ #define TAG "BtSrv" -#define BT_RPC_EVENT_BUFF_SENT (1UL << 0) +#define BT_RPC_EVENT_BUFF_SENT (1UL << 0) #define BT_RPC_EVENT_DISCONNECTED (1UL << 1) -#define BT_RPC_EVENT_ALL (BT_RPC_EVENT_BUFF_SENT | BT_RPC_EVENT_DISCONNECTED) +#define BT_RPC_EVENT_ALL (BT_RPC_EVENT_BUFF_SENT | BT_RPC_EVENT_DISCONNECTED) #define ICON_SPACER 2 diff --git a/applications/services/bt/bt_service/bt_keys_storage.c b/applications/services/bt/bt_service/bt_keys_storage.c index cf06d663b..6392c2d67 100644 --- a/applications/services/bt/bt_service/bt_keys_storage.c +++ b/applications/services/bt/bt_service/bt_keys_storage.c @@ -6,7 +6,7 @@ #include #define BT_KEYS_STORAGE_VERSION (0) -#define BT_KEYS_STORAGE_MAGIC (0x18) +#define BT_KEYS_STORAGE_MAGIC (0x18) #define TAG "BtKeyStorage" diff --git a/applications/services/bt/bt_settings.c b/applications/services/bt/bt_settings.c index 8a505f9e3..3602cf497 100644 --- a/applications/services/bt/bt_settings.c +++ b/applications/services/bt/bt_settings.c @@ -4,9 +4,9 @@ #include #include -#define BT_SETTINGS_PATH INT_PATH(BT_SETTINGS_FILE_NAME) +#define BT_SETTINGS_PATH INT_PATH(BT_SETTINGS_FILE_NAME) #define BT_SETTINGS_VERSION (0) -#define BT_SETTINGS_MAGIC (0x19) +#define BT_SETTINGS_MAGIC (0x19) bool bt_settings_load(BtSettings* bt_settings) { furi_assert(bt_settings); diff --git a/applications/services/bt/bt_settings.h b/applications/services/bt/bt_settings.h index da43e1498..a4e76a12c 100644 --- a/applications/services/bt/bt_settings.h +++ b/applications/services/bt/bt_settings.h @@ -19,4 +19,4 @@ bool bt_settings_save(const BtSettings* bt_settings); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/cli/cli.c b/applications/services/cli/cli.c index 709d69768..0d8f52c04 100644 --- a/applications/services/cli/cli.c +++ b/applications/services/cli/cli.c @@ -75,7 +75,7 @@ size_t cli_read_timeout(Cli* cli, uint8_t* buffer, size_t size, uint32_t timeout bool cli_is_connected(Cli* cli) { furi_check(cli); if(cli->session != NULL) { - return (cli->session->is_connected()); + return cli->session->is_connected(); } return false; } diff --git a/applications/services/cli/cli_commands.c b/applications/services/cli/cli_commands.c index d6fa395c8..5a1b11d80 100644 --- a/applications/services/cli/cli_commands.c +++ b/applications/services/cli/cli_commands.c @@ -168,7 +168,7 @@ void cli_command_date(Cli* cli, FuriString* args, void* context) { } } -#define CLI_COMMAND_LOG_RING_SIZE 2048 +#define CLI_COMMAND_LOG_RING_SIZE 2048 #define CLI_COMMAND_LOG_BUFFER_SIZE 64 void cli_command_log_tx_callback(const uint8_t* buffer, size_t size, void* context) { diff --git a/applications/services/cli/cli_i.h b/applications/services/cli/cli_i.h index 8a82d9619..d4cac6e7d 100644 --- a/applications/services/cli/cli_i.h +++ b/applications/services/cli/cli_i.h @@ -64,4 +64,4 @@ void cli_stdout_callback(void* _cookie, const char* data, size_t size); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/crypto/crypto_cli.c b/applications/services/crypto/crypto_cli.c index e1ea83613..744fa7151 100644 --- a/applications/services/crypto/crypto_cli.c +++ b/applications/services/crypto/crypto_cli.c @@ -15,7 +15,7 @@ void crypto_cli_print_usage(void) { printf("\thas_key \t - Check if secure enclave has key in slot\r\n"); printf( "\tstore_key \t - Store key in secure enclave. !!! NON-REVERSABLE OPERATION - READ MANUAL FIRST !!!\r\n"); -}; +} void crypto_cli_encrypt(Cli* cli, FuriString* args) { int key_slot = 0; diff --git a/applications/services/desktop/animations/animation_manager.c b/applications/services/desktop/animations/animation_manager.c index f4e55adaa..8e04e7894 100644 --- a/applications/services/desktop/animations/animation_manager.c +++ b/applications/services/desktop/animations/animation_manager.c @@ -14,14 +14,14 @@ #define TAG "AnimationManager" -#define HARDCODED_ANIMATION_NAME "L1_Tv_128x47" -#define NO_SD_ANIMATION_NAME "L1_NoSd_128x49" +#define HARDCODED_ANIMATION_NAME "L1_Tv_128x47" +#define NO_SD_ANIMATION_NAME "L1_NoSd_128x49" #define BAD_BATTERY_ANIMATION_NAME "L1_BadBattery_128x47" -#define NO_DB_ANIMATION_NAME "L0_NoDb_128x51" -#define BAD_SD_ANIMATION_NAME "L0_SdBad_128x51" -#define SD_OK_ANIMATION_NAME "L0_SdOk_128x51" -#define URL_ANIMATION_NAME "L0_Url_128x51" +#define NO_DB_ANIMATION_NAME "L0_NoDb_128x51" +#define BAD_SD_ANIMATION_NAME "L0_SdBad_128x51" +#define SD_OK_ANIMATION_NAME "L0_SdOk_128x51" +#define URL_ANIMATION_NAME "L0_Url_128x51" #define NEW_MAIL_ANIMATION_NAME "L0_NewMail_128x51" typedef enum { @@ -47,13 +47,13 @@ struct AnimationManager { int32_t freezed_animation_time_left; ViewStack* view_stack; - bool dummy_mode : 1; - bool blocking_shown_url : 1; + bool dummy_mode : 1; + bool blocking_shown_url : 1; bool blocking_shown_sd_bad : 1; - bool blocking_shown_no_db : 1; - bool blocking_shown_sd_ok : 1; - bool levelup_pending : 1; - bool levelup_active : 1; + bool blocking_shown_no_db : 1; + bool blocking_shown_sd_ok : 1; + bool levelup_pending : 1; + bool levelup_active : 1; }; static StorageAnimation* diff --git a/applications/services/desktop/animations/animation_storage.c b/applications/services/desktop/animations/animation_storage.c index 1db61f1ab..9ee85727b 100644 --- a/applications/services/desktop/animations/animation_storage.c +++ b/applications/services/desktop/animations/animation_storage.c @@ -11,11 +11,12 @@ #include #include -#define ANIMATION_META_FILE "meta.txt" -#define ANIMATION_DIR EXT_PATH("dolphin") -#define ANIMATION_MANIFEST_FILE ANIMATION_DIR "/manifest.txt" #define TAG "AnimationStorage" +#define ANIMATION_META_FILE "meta.txt" +#define ANIMATION_DIR EXT_PATH("dolphin") +#define ANIMATION_MANIFEST_FILE ANIMATION_DIR "/manifest.txt" + static void animation_storage_free_bubbles(BubbleAnimation* animation); static void animation_storage_free_frames(BubbleAnimation* animation); static void animation_storage_free_animation(BubbleAnimation** storage_animation); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index 634f0ee00..4bcbb6585 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -84,7 +84,7 @@ struct Desktop { DesktopClock clock; bool in_transition : 1; - bool locked : 1; + bool locked : 1; FuriSemaphore* animation_semaphore; }; diff --git a/applications/services/desktop/desktop_settings.h b/applications/services/desktop/desktop_settings.h index 5cf9cc4c6..54be6aaa9 100644 --- a/applications/services/desktop/desktop_settings.h +++ b/applications/services/desktop/desktop_settings.h @@ -10,9 +10,9 @@ #define DESKTOP_SETTINGS_VER (10) -#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME) +#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME) #define DESKTOP_SETTINGS_MAGIC (0x17) -#define PIN_MAX_LENGTH 12 +#define PIN_MAX_LENGTH 12 #define DESKTOP_SETTINGS_RUN_PIN_SETUP_ARG "run_pin_setup" @@ -32,8 +32,8 @@ DESKTOP_SETTINGS_MAGIC, \ DESKTOP_SETTINGS_VER) -#define MAX_PIN_SIZE 10 -#define MIN_PIN_SIZE 4 +#define MAX_PIN_SIZE 10 +#define MIN_PIN_SIZE 4 #define MAX_APP_LENGTH 128 typedef enum { diff --git a/applications/services/desktop/helpers/slideshow.c b/applications/services/desktop/helpers/slideshow.c index ec02f27a1..565449cbb 100644 --- a/applications/services/desktop/helpers/slideshow.c +++ b/applications/services/desktop/helpers/slideshow.c @@ -5,7 +5,7 @@ #include #include -#define SLIDESHOW_MAGIC 0x72676468 +#define SLIDESHOW_MAGIC 0x72676468 #define SLIDESHOW_MAX_SUPPORTED_VERSION 1 struct Slideshow { diff --git a/applications/services/desktop/scenes/desktop_scene_config.h b/applications/services/desktop/scenes/desktop_scene_config.h index 34d000543..2a536603f 100644 --- a/applications/services/desktop/scenes/desktop_scene_config.h +++ b/applications/services/desktop/scenes/desktop_scene_config.h @@ -7,4 +7,4 @@ ADD_SCENE(desktop, locked, Locked) ADD_SCENE(desktop, pin_input, PinInput) ADD_SCENE(desktop, pin_timeout, PinTimeout) ADD_SCENE(desktop, slideshow, Slideshow) -ADD_SCENE(desktop, secure_enclave, SecureEnclave) \ No newline at end of file +ADD_SCENE(desktop, secure_enclave, SecureEnclave) diff --git a/applications/services/desktop/scenes/desktop_scene_i.h b/applications/services/desktop/scenes/desktop_scene_i.h index 953f8c836..f481733ac 100644 --- a/applications/services/desktop/scenes/desktop_scene_i.h +++ b/applications/services/desktop/scenes/desktop_scene_i.h @@ -1,4 +1,4 @@ #pragma once -#define SCENE_LOCKED_FIRST_ENTER 0 +#define SCENE_LOCKED_FIRST_ENTER 0 #define SCENE_LOCKED_REPEAT_ENTER 1 diff --git a/applications/services/desktop/scenes/desktop_scene_locked.c b/applications/services/desktop/scenes/desktop_scene_locked.c index 6d432858a..846b2b541 100644 --- a/applications/services/desktop/scenes/desktop_scene_locked.c +++ b/applications/services/desktop/scenes/desktop_scene_locked.c @@ -14,7 +14,7 @@ #include "desktop_scene_i.h" #define WRONG_PIN_HEADER_TIMEOUT 3000 -#define INPUT_PIN_VIEW_TIMEOUT 15000 +#define INPUT_PIN_VIEW_TIMEOUT 15000 static void desktop_scene_locked_callback(DesktopEvent event, void* context) { Desktop* desktop = (Desktop*)context; diff --git a/applications/services/desktop/scenes/desktop_scene_pin_input.c b/applications/services/desktop/scenes/desktop_scene_pin_input.c index b1c0d4c85..6f5bfe8cb 100644 --- a/applications/services/desktop/scenes/desktop_scene_pin_input.c +++ b/applications/services/desktop/scenes/desktop_scene_pin_input.c @@ -14,7 +14,7 @@ #include "desktop_scene.h" #define WRONG_PIN_HEADER_TIMEOUT 3000 -#define INPUT_PIN_VIEW_TIMEOUT 15000 +#define INPUT_PIN_VIEW_TIMEOUT 15000 typedef struct { FuriTimer* timer; diff --git a/applications/services/desktop/views/desktop_view_locked.c b/applications/services/desktop/views/desktop_view_locked.c index 34d92b0dd..81d3fc65f 100644 --- a/applications/services/desktop/views/desktop_view_locked.c +++ b/applications/services/desktop/views/desktop_view_locked.c @@ -10,17 +10,17 @@ #include "../desktop_i.h" #include "desktop_view_locked.h" -#define DOOR_MOVING_INTERVAL_MS (1000 / 16) -#define LOCKED_HINT_TIMEOUT_MS (1000) +#define DOOR_MOVING_INTERVAL_MS (1000 / 16) +#define LOCKED_HINT_TIMEOUT_MS (1000) #define UNLOCKED_HINT_TIMEOUT_MS (2000) #define DOOR_OFFSET_START (-55) -#define DOOR_OFFSET_END (0) +#define DOOR_OFFSET_END (0) #define DOOR_L_FINAL_POS (0) #define DOOR_R_FINAL_POS (60) -#define UNLOCK_CNT (3) +#define UNLOCK_CNT (3) #define UNLOCK_RST_TIMEOUT (600) struct DesktopViewLocked { diff --git a/applications/services/desktop/views/desktop_view_pin_input.c b/applications/services/desktop/views/desktop_view_pin_input.c index c859b9b02..965b5cceb 100644 --- a/applications/services/desktop/views/desktop_view_pin_input.c +++ b/applications/services/desktop/views/desktop_view_pin_input.c @@ -11,8 +11,8 @@ #define NO_ACTIVITY_TIMEOUT 15000 #define PIN_CELL_WIDTH 13 -#define DEFAULT_PIN_X 64 -#define DEFAULT_PIN_Y 32 +#define DEFAULT_PIN_X 64 +#define DEFAULT_PIN_Y 32 struct DesktopViewPinInput { View* view; diff --git a/applications/services/desktop/views/desktop_view_slideshow.c b/applications/services/desktop/views/desktop_view_slideshow.c index de8c1cb86..6aae449c8 100644 --- a/applications/services/desktop/views/desktop_view_slideshow.c +++ b/applications/services/desktop/views/desktop_view_slideshow.c @@ -6,7 +6,7 @@ #include "../helpers/slideshow.h" #define DESKTOP_SLIDESHOW_POWEROFF_SHORT 5000 -#define DESKTOP_SLIDESHOW_POWEROFF_LONG (60 * 60 * 1000) +#define DESKTOP_SLIDESHOW_POWEROFF_LONG (60 * 60 * 1000) struct DesktopSlideshowView { View* view; @@ -136,4 +136,4 @@ void desktop_view_slideshow_set_callback( furi_assert(callback); instance->callback = callback; instance->context = context; -} \ No newline at end of file +} diff --git a/applications/services/dolphin/dolphin.c b/applications/services/dolphin/dolphin.c index 4b4ac0674..95982f1af 100644 --- a/applications/services/dolphin/dolphin.c +++ b/applications/services/dolphin/dolphin.c @@ -5,22 +5,22 @@ #define TAG "Dolphin" #define DOLPHIN_LOCK_EVENT_FLAG (0x1) -#define EVENT_QUEUE_SIZE (8) +#define EVENT_QUEUE_SIZE (8) -#define SECONDS_IN_TICKS(x) ((x) * 1000UL) -#define MINUTES_IN_TICKS(x) (SECONDS_IN_TICKS(x) * 60UL) -#define HOURS_IN_TICKS(x) (MINUTES_IN_TICKS(x) * 60UL) +#define SECONDS_IN_TICKS(x) ((x) * 1000UL) +#define MINUTES_IN_TICKS(x) (SECONDS_IN_TICKS(x) * 60UL) +#define HOURS_IN_TICKS(x) (MINUTES_IN_TICKS(x) * 60UL) #define DATE_IN_TICKS(h, m, s) (HOURS_IN_TICKS(h) + MINUTES_IN_TICKS(m) + SECONDS_IN_TICKS(s)) #define FLUSH_TIMEOUT_TICKS (SECONDS_IN_TICKS(30UL)) #ifndef DOLPHIN_DEBUG -#define BUTTHURT_INCREASE_PERIOD_TICKS (HOURS_IN_TICKS(48UL)) -#define CLEAR_LIMITS_PERIOD_TICKS (HOURS_IN_TICKS(24UL)) +#define BUTTHURT_INCREASE_PERIOD_TICKS (HOURS_IN_TICKS(48UL)) +#define CLEAR_LIMITS_PERIOD_TICKS (HOURS_IN_TICKS(24UL)) #define CLEAR_LIMITS_UPDATE_PERIOD_TICKS (HOURS_IN_TICKS(1UL)) #else -#define BUTTHURT_INCREASE_PERIOD_TICKS (SECONDS_IN_TICKS(30UL)) -#define CLEAR_LIMITS_PERIOD_TICKS (MINUTES_IN_TICKS(1)) +#define BUTTHURT_INCREASE_PERIOD_TICKS (SECONDS_IN_TICKS(30UL)) +#define CLEAR_LIMITS_PERIOD_TICKS (MINUTES_IN_TICKS(1)) #define CLEAR_LIMITS_UPDATE_PERIOD_TICKS (SECONDS_IN_TICKS(5UL)) #endif diff --git a/applications/services/dolphin/helpers/dolphin_state.c b/applications/services/dolphin/helpers/dolphin_state.c index 724060e53..5216b961d 100644 --- a/applications/services/dolphin/helpers/dolphin_state.c +++ b/applications/services/dolphin/helpers/dolphin_state.c @@ -10,13 +10,13 @@ #define TAG "DolphinState" -#define DOLPHIN_STATE_PATH INT_PATH(DOLPHIN_STATE_FILE_NAME) -#define DOLPHIN_STATE_HEADER_MAGIC 0xD0 +#define DOLPHIN_STATE_PATH INT_PATH(DOLPHIN_STATE_FILE_NAME) +#define DOLPHIN_STATE_HEADER_MAGIC 0xD0 #define DOLPHIN_STATE_HEADER_VERSION 0x01 -#define LEVEL2_THRESHOLD 300 -#define LEVEL3_THRESHOLD 1800 -#define BUTTHURT_MAX 14 -#define BUTTHURT_MIN 0 +#define LEVEL2_THRESHOLD 300 +#define LEVEL3_THRESHOLD 1800 +#define BUTTHURT_MAX 14 +#define BUTTHURT_MIN 0 DolphinState* dolphin_state_alloc(void) { return malloc(sizeof(DolphinState)); diff --git a/applications/services/expansion/expansion_settings.c b/applications/services/expansion/expansion_settings.c index 691c454a5..ca48a2903 100644 --- a/applications/services/expansion/expansion_settings.c +++ b/applications/services/expansion/expansion_settings.c @@ -5,9 +5,9 @@ #include "expansion_settings_filename.h" -#define EXPANSION_SETTINGS_PATH INT_PATH(EXPANSION_SETTINGS_FILE_NAME) +#define EXPANSION_SETTINGS_PATH INT_PATH(EXPANSION_SETTINGS_FILE_NAME) #define EXPANSION_SETTINGS_VERSION (0) -#define EXPANSION_SETTINGS_MAGIC (0xEA) +#define EXPANSION_SETTINGS_MAGIC (0xEA) bool expansion_settings_load(ExpansionSettings* settings) { furi_assert(settings); diff --git a/applications/services/expansion/expansion_worker.c b/applications/services/expansion/expansion_worker.c index fd92063d2..449d02cff 100644 --- a/applications/services/expansion/expansion_worker.c +++ b/applications/services/expansion/expansion_worker.c @@ -11,7 +11,7 @@ #define TAG "ExpansionSrv" -#define EXPANSION_WORKER_STACK_SZIE (768UL) +#define EXPANSION_WORKER_STACK_SZIE (768UL) #define EXPANSION_WORKER_BUFFER_SIZE (sizeof(ExpansionFrame) + sizeof(ExpansionFrameChecksum)) typedef enum { diff --git a/applications/services/gui/elements.h b/applications/services/gui/elements.h index 54d78420e..88a004815 100644 --- a/applications/services/gui/elements.h +++ b/applications/services/gui/elements.h @@ -16,9 +16,9 @@ extern "C" { #endif -#define ELEMENTS_MAX_LINES_NUM (7) -#define ELEMENTS_BOLD_MARKER '#' -#define ELEMENTS_MONO_MARKER '*' +#define ELEMENTS_MAX_LINES_NUM (7) +#define ELEMENTS_BOLD_MARKER '#' +#define ELEMENTS_MONO_MARKER '*' #define ELEMENTS_INVERSE_MARKER '!' /** Draw progress bar. diff --git a/applications/services/gui/gui_i.h b/applications/services/gui/gui_i.h index 3ca9c05c9..8bd3215f9 100644 --- a/applications/services/gui/gui_i.h +++ b/applications/services/gui/gui_i.h @@ -17,29 +17,29 @@ #include "view_port.h" #include "view_port_i.h" -#define GUI_DISPLAY_WIDTH 128 +#define GUI_DISPLAY_WIDTH 128 #define GUI_DISPLAY_HEIGHT 64 -#define GUI_STATUS_BAR_X 0 -#define GUI_STATUS_BAR_Y 0 -#define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH +#define GUI_STATUS_BAR_X 0 +#define GUI_STATUS_BAR_Y 0 +#define GUI_STATUS_BAR_WIDTH GUI_DISPLAY_WIDTH /* 0-1 pixels for upper thin frame * 2-9 pixels for icons (battery, sd card, etc) * 10-12 pixels for lower bold line */ -#define GUI_STATUS_BAR_HEIGHT 13 +#define GUI_STATUS_BAR_HEIGHT 13 /* icon itself area (battery, sd card, etc) excluding frame. * painted 2 pixels below GUI_STATUS_BAR_X. */ #define GUI_STATUS_BAR_WORKAREA_HEIGHT 8 -#define GUI_WINDOW_X 0 -#define GUI_WINDOW_Y GUI_STATUS_BAR_HEIGHT -#define GUI_WINDOW_WIDTH GUI_DISPLAY_WIDTH +#define GUI_WINDOW_X 0 +#define GUI_WINDOW_Y GUI_STATUS_BAR_HEIGHT +#define GUI_WINDOW_WIDTH GUI_DISPLAY_WIDTH #define GUI_WINDOW_HEIGHT (GUI_DISPLAY_HEIGHT - GUI_WINDOW_Y) -#define GUI_THREAD_FLAG_DRAW (1 << 0) +#define GUI_THREAD_FLAG_DRAW (1 << 0) #define GUI_THREAD_FLAG_INPUT (1 << 1) -#define GUI_THREAD_FLAG_ALL (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT) +#define GUI_THREAD_FLAG_ALL (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT) ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST); diff --git a/applications/services/gui/modules/button_menu.c b/applications/services/gui/modules/button_menu.c index df3e4ca4a..d9c178dd2 100644 --- a/applications/services/gui/modules/button_menu.c +++ b/applications/services/gui/modules/button_menu.c @@ -10,10 +10,10 @@ #include #include -#define ITEM_FIRST_OFFSET 17 -#define ITEM_NEXT_OFFSET 4 -#define ITEM_HEIGHT 14 -#define ITEM_WIDTH 64 +#define ITEM_FIRST_OFFSET 17 +#define ITEM_NEXT_OFFSET 4 +#define ITEM_HEIGHT 14 +#define ITEM_WIDTH 64 #define BUTTONS_PER_SCREEN 6 struct ButtonMenuItem { diff --git a/applications/services/gui/modules/button_panel.c b/applications/services/gui/modules/button_panel.c index 0aa9dd005..9301870ef 100644 --- a/applications/services/gui/modules/button_panel.c +++ b/applications/services/gui/modules/button_panel.c @@ -439,4 +439,4 @@ void button_panel_add_icon( icon->name_selected = icon_name; }, true); -} \ No newline at end of file +} diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index 6fa8e4bb9..477e1fb7d 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -13,17 +13,17 @@ #include #include -#define LIST_ITEMS 5u -#define MAX_LEN_PX 110 +#define LIST_ITEMS 5u +#define MAX_LEN_PX 110 #define FRAME_HEIGHT 12 -#define Y_OFFSET 3 +#define Y_OFFSET 3 #define ITEM_LIST_LEN_MAX 50 #define CUSTOM_ICON_MAX_SIZE 32 #define SCROLL_INTERVAL (333) -#define SCROLL_DELAY (2) +#define SCROLL_DELAY (2) typedef enum { BrowserItemTypeLoading, diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 1ca9ac837..15117eae2 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -14,9 +14,9 @@ #define TAG "BrowserWorker" -#define ASSETS_DIR "assets" -#define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX -#define FILE_NAME_LEN_MAX 256 +#define ASSETS_DIR "assets" +#define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX +#define FILE_NAME_LEN_MAX 256 #define LONG_LOAD_THRESHOLD 100 typedef enum { @@ -117,7 +117,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo if(is_folder) { // Skip assets folders (if enabled) if(browser->skip_assets) { - return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)); + return (furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true); } else { return true; } @@ -295,7 +295,7 @@ static bool furi_record_close(RECORD_STORAGE); - return (items_cnt == count); + return items_cnt == count; } static int32_t browser_worker(void* context) { @@ -509,7 +509,7 @@ void file_browser_worker_folder_enter(BrowserWorker* browser, FuriString* path, bool file_browser_worker_is_in_start_folder(BrowserWorker* browser) { furi_check(browser); - return (furi_string_cmp(browser->path_start, browser->path_current) == 0); + return furi_string_cmp(browser->path_start, browser->path_current) == 0; } void file_browser_worker_folder_exit(BrowserWorker* browser) { diff --git a/applications/services/gui/modules/menu.c b/applications/services/gui/modules/menu.c index 4c526bf92..012fa17d6 100644 --- a/applications/services/gui/modules/menu.c +++ b/applications/services/gui/modules/menu.c @@ -157,7 +157,7 @@ void menu_free(Menu* menu) { View* menu_get_view(Menu* menu) { furi_check(menu); - return (menu->view); + return menu->view; } void menu_add_item( diff --git a/applications/services/gui/modules/text_box.c b/applications/services/gui/modules/text_box.c index 86455dd5c..8b7056a00 100644 --- a/applications/services/gui/modules/text_box.c +++ b/applications/services/gui/modules/text_box.c @@ -4,12 +4,12 @@ #include #include -#define TEXT_BOX_TEXT_WIDTH (120) -#define TEXT_BOX_TEXT_HEIGHT (56) +#define TEXT_BOX_TEXT_WIDTH (120) +#define TEXT_BOX_TEXT_HEIGHT (56) #define TEXT_BOX_MAX_LINES_PER_SCREEN (10) -#define TEXT_BOX_LINES_SCROLL_SPEED_MEDIUM (3) -#define TEXT_BOX_LINES_SCROLL_SPEED_FAST (5) +#define TEXT_BOX_LINES_SCROLL_SPEED_MEDIUM (3) +#define TEXT_BOX_LINES_SCROLL_SPEED_FAST (5) #define TEXT_BOX_LINES_SCROLL_SPEED_SATURATION (9) struct TextBox { diff --git a/applications/services/gui/modules/text_input.c b/applications/services/gui/modules/text_input.c index a14f8ba58..dc1c9c8c1 100644 --- a/applications/services/gui/modules/text_input.c +++ b/applications/services/gui/modules/text_input.c @@ -36,7 +36,7 @@ static const uint8_t keyboard_origin_x = 1; static const uint8_t keyboard_origin_y = 29; static const uint8_t keyboard_row_count = 3; -#define ENTER_KEY '\r' +#define ENTER_KEY '\r' #define BACKSPACE_KEY '\b' static const TextInputKey keyboard_keys_row_1[] = { @@ -132,14 +132,14 @@ static char get_selected_char(TextInputModel* model) { } static bool char_is_lowercase(char letter) { - return (letter >= 0x61 && letter <= 0x7A); + return letter >= 0x61 && letter <= 0x7A; } static char char_to_uppercase(const char letter) { if(letter == '_') { return 0x20; } else if(islower(letter)) { - return (letter - 0x20); + return letter - 0x20; } else { return letter; } diff --git a/applications/services/gui/modules/widget_elements/widget_element.h b/applications/services/gui/modules/widget_elements/widget_element.h index 679904173..473fabd04 100644 --- a/applications/services/gui/modules/widget_elements/widget_element.h +++ b/applications/services/gui/modules/widget_elements/widget_element.h @@ -19,4 +19,4 @@ typedef void (*ButtonCallback)(GuiButtonType result, InputType type, void* conte #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/gui/modules/widget_elements/widget_element_i.h b/applications/services/gui/modules/widget_elements/widget_element_i.h index 456a83172..2bced5576 100644 --- a/applications/services/gui/modules/widget_elements/widget_element_i.h +++ b/applications/services/gui/modules/widget_elements/widget_element_i.h @@ -90,4 +90,4 @@ WidgetElement* widget_element_text_scroll_create( #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/input/input.c b/applications/services/input/input.c index ec9384e76..6cbafb795 100644 --- a/applications/services/input/input.c +++ b/applications/services/input/input.c @@ -8,9 +8,9 @@ #include #define INPUT_DEBOUNCE_TICKS_HALF (INPUT_DEBOUNCE_TICKS / 2) -#define INPUT_PRESS_TICKS 150 -#define INPUT_LONG_PRESS_COUNTS 2 -#define INPUT_THREAD_FLAG_ISR 0x00000001 +#define INPUT_PRESS_TICKS 150 +#define INPUT_LONG_PRESS_COUNTS 2 +#define INPUT_THREAD_FLAG_ISR 0x00000001 /** Input pin state */ typedef struct { diff --git a/applications/services/input/input.h b/applications/services/input/input.h index a62e84569..5233b4a01 100644 --- a/applications/services/input/input.h +++ b/applications/services/input/input.h @@ -11,7 +11,7 @@ extern "C" { #endif -#define RECORD_INPUT_EVENTS "input_events" +#define RECORD_INPUT_EVENTS "input_events" #define INPUT_SEQUENCE_SOURCE_HARDWARE (0u) #define INPUT_SEQUENCE_SOURCE_SOFTWARE (1u) @@ -32,7 +32,7 @@ typedef struct { union { uint32_t sequence; struct { - uint8_t sequence_source : 2; + uint8_t sequence_source : 2; uint32_t sequence_counter : 30; }; }; diff --git a/applications/services/loader/firmware_api/firmware_api.cpp b/applications/services/loader/firmware_api/firmware_api.cpp index 45953eddf..541b67d7d 100644 --- a/applications/services/loader/firmware_api/firmware_api.cpp +++ b/applications/services/loader/firmware_api/firmware_api.cpp @@ -24,4 +24,4 @@ const ElfApiInterface* const firmware_api_interface = &elf_api_interface; extern "C" void furi_hal_info_get_api_version(uint16_t* major, uint16_t* minor) { *major = firmware_api_interface->api_version_major; *minor = firmware_api_interface->api_version_minor; -} \ No newline at end of file +} diff --git a/applications/services/loader/loader.c b/applications/services/loader/loader.c index f22441481..7e42a4488 100644 --- a/applications/services/loader/loader.c +++ b/applications/services/loader/loader.c @@ -11,6 +11,7 @@ #include #define TAG "Loader" + #define LOADER_MAGIC_THREAD_VALUE 0xDEADBEEF // helpers diff --git a/applications/services/loader/loader.h b/applications/services/loader/loader.h index 421b6916d..cacfbff68 100644 --- a/applications/services/loader/loader.h +++ b/applications/services/loader/loader.h @@ -5,7 +5,7 @@ extern "C" { #endif -#define RECORD_LOADER "loader" +#define RECORD_LOADER "loader" #define LOADER_APPLICATIONS_NAME "Apps" typedef struct Loader Loader; diff --git a/applications/services/loader/loader_applications.c b/applications/services/loader/loader_applications.c index 0c5d93cc8..232e5314e 100644 --- a/applications/services/loader/loader_applications.c +++ b/applications/services/loader/loader_applications.c @@ -170,4 +170,4 @@ static int32_t loader_applications_thread(void* p) { } return 0; -} \ No newline at end of file +} diff --git a/applications/services/loader/loader_applications.h b/applications/services/loader/loader_applications.h index 6b132af05..57097ba48 100644 --- a/applications/services/loader/loader_applications.h +++ b/applications/services/loader/loader_applications.h @@ -13,4 +13,4 @@ void loader_applications_free(LoaderApplications* loader_applications); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/loader/loader_menu.c b/applications/services/loader/loader_menu.c index 149fea72c..329354881 100644 --- a/applications/services/loader/loader_menu.c +++ b/applications/services/loader/loader_menu.c @@ -124,7 +124,7 @@ static void loader_menu_build_menu(LoaderMenuApp* app, LoaderMenu* menu) { i++, loader_menu_applications_callback, (void*)menu); -}; +} static void loader_menu_build_submenu(LoaderMenuApp* app, LoaderMenu* loader_menu) { for(size_t i = 0; i < FLIPPER_SETTINGS_APPS_COUNT; i++) { @@ -192,4 +192,4 @@ static int32_t loader_menu_thread(void* p) { loader_menu_app_free(app); return 0; -} \ No newline at end of file +} diff --git a/applications/services/loader/loader_menu.h b/applications/services/loader/loader_menu.h index 528fe7d29..89d01a361 100644 --- a/applications/services/loader/loader_menu.h +++ b/applications/services/loader/loader_menu.h @@ -13,4 +13,4 @@ void loader_menu_free(LoaderMenu* loader_menu); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/locale/locale.c b/applications/services/locale/locale.c index f4ee9c634..6acf2eea9 100644 --- a/applications/services/locale/locale.c +++ b/applications/services/locale/locale.c @@ -31,7 +31,7 @@ float locale_fahrenheit_to_celsius(float temp_f) { } float locale_celsius_to_fahrenheit(float temp_c) { - return (temp_c * 1.8f + 32.f); + return temp_c * 1.8f + 32.f; } void locale_format_time( diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 8e183f74e..d4c5b91c8 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -39,7 +39,7 @@ void notification_message_save_settings(NotificationApp* app) { furi_event_flag_wait( m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever); furi_event_flag_free(m.back_event); -}; +} // internal layer static void @@ -143,17 +143,16 @@ static void notification_apply_notification_leds(NotificationApp* app, const uin // settings uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value) { - return (value * app->settings.display_brightness); + return value * app->settings.display_brightness; } static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value) { - return (value * app->settings.led_brightness); + return value * app->settings.led_brightness; } static uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) { - return ( - (float)(app->settings.display_off_delay_ms) / - (1000.0f / furi_kernel_get_tick_frequency())); + return (float)(app->settings.display_off_delay_ms) / + (1000.0f / furi_kernel_get_tick_frequency()); } // generics @@ -471,7 +470,7 @@ static bool notification_load_settings(NotificationApp* app) { furi_record_close(RECORD_STORAGE); return fs_result; -}; +} static bool notification_save_settings(NotificationApp* app) { NotificationSettings settings; @@ -506,7 +505,7 @@ static bool notification_save_settings(NotificationApp* app) { furi_record_close(RECORD_STORAGE); return fs_result; -}; +} static void input_event_callback(const void* value, void* context) { furi_assert(value); @@ -555,7 +554,7 @@ static NotificationApp* notification_app_alloc(void) { notification_message(app, &sequence_display_backlight_on); return app; -}; +} // App int32_t notification_srv(void* p) { @@ -598,4 +597,4 @@ int32_t notification_srv(void* p) { } return 0; -}; +} diff --git a/applications/services/notification/notification_app.h b/applications/services/notification/notification_app.h index cacc17ffb..434773f2e 100644 --- a/applications/services/notification/notification_app.h +++ b/applications/services/notification/notification_app.h @@ -4,7 +4,7 @@ #include "notification_messages.h" #include "notification_settings_filename.h" -#define NOTIFICATION_LED_COUNT 3 +#define NOTIFICATION_LED_COUNT 3 #define NOTIFICATION_EVENT_COMPLETE 0x00000001U typedef enum { @@ -33,7 +33,7 @@ typedef struct { } NotificationLedLayer; #define NOTIFICATION_SETTINGS_VERSION 0x02 -#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME) +#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME) typedef struct { uint8_t version; diff --git a/applications/services/notification/notification_app_api.c b/applications/services/notification/notification_app_api.c index 90e3f236e..80f7995f1 100644 --- a/applications/services/notification/notification_app_api.c +++ b/applications/services/notification/notification_app_api.c @@ -10,7 +10,7 @@ void notification_message(NotificationApp* app, const NotificationSequence* sequ NotificationAppMessage m = { .type = NotificationLayerMessage, .sequence = sequence, .back_event = NULL}; furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk); -}; +} void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence) { furi_check(app); @@ -19,7 +19,7 @@ void notification_internal_message(NotificationApp* app, const NotificationSeque NotificationAppMessage m = { .type = InternalLayerMessage, .sequence = sequence, .back_event = NULL}; furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk); -}; +} void notification_message_block(NotificationApp* app, const NotificationSequence* sequence) { furi_check(app); @@ -33,7 +33,7 @@ void notification_message_block(NotificationApp* app, const NotificationSequence furi_event_flag_wait( m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever); furi_event_flag_free(m.back_event); -}; +} void notification_internal_message_block( NotificationApp* app, @@ -47,4 +47,4 @@ void notification_internal_message_block( furi_event_flag_wait( m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever); furi_event_flag_free(m.back_event); -}; +} diff --git a/applications/services/power/power_service/power.c b/applications/services/power/power_service/power.c index 278854e13..64121d852 100644 --- a/applications/services/power/power_service/power.c +++ b/applications/services/power/power_service/power.c @@ -3,9 +3,10 @@ #include #include -#define POWER_OFF_TIMEOUT 90 #define TAG "Power" +#define POWER_OFF_TIMEOUT 90 + void power_draw_battery_callback(Canvas* canvas, void* context) { furi_assert(context); Power* power = context; diff --git a/applications/services/rpc/rpc.c b/applications/services/rpc/rpc.c index 32371fa82..6ad16fbff 100644 --- a/applications/services/rpc/rpc.c +++ b/applications/services/rpc/rpc.c @@ -232,7 +232,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) { rpc_debug_print_data("INPUT", buf, bytes_received); #endif - return (count == bytes_received); + return count == bytes_received; } static bool rpc_pb_content_callback(pb_istream_t* stream, const pb_field_t* field, void** arg) { diff --git a/applications/services/rpc/rpc_desktop.c b/applications/services/rpc/rpc_desktop.c index a70e84363..76ab6c70d 100644 --- a/applications/services/rpc/rpc_desktop.c +++ b/applications/services/rpc/rpc_desktop.c @@ -133,4 +133,4 @@ void rpc_desktop_free(void* context) { rpc_desktop->session = NULL; free(rpc_desktop); -} \ No newline at end of file +} diff --git a/applications/services/rpc/rpc_i.h b/applications/services/rpc/rpc_i.h index 20baca7b1..0342df2b6 100644 --- a/applications/services/rpc/rpc_i.h +++ b/applications/services/rpc/rpc_i.h @@ -52,4 +52,4 @@ PB_CommandStatus rpc_system_storage_get_error(FS_Error fs_error); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/services/rpc/rpc_property.c b/applications/services/rpc/rpc_property.c index ad15051eb..e88b11b87 100644 --- a/applications/services/rpc/rpc_property.c +++ b/applications/services/rpc/rpc_property.c @@ -9,7 +9,7 @@ #define TAG "RpcProperty" #define PROPERTY_CATEGORY_DEVICE_INFO "devinfo" -#define PROPERTY_CATEGORY_POWER_INFO "pwrinfo" +#define PROPERTY_CATEGORY_POWER_INFO "pwrinfo" #define PROPERTY_CATEGORY_POWER_DEBUG "pwrdebug" typedef struct { diff --git a/applications/services/storage/filesystem_api.c b/applications/services/storage/filesystem_api.c index e6012864d..cf3803864 100644 --- a/applications/services/storage/filesystem_api.c +++ b/applications/services/storage/filesystem_api.c @@ -40,5 +40,5 @@ const char* filesystem_api_error_get_desc(FS_Error error_id) { bool file_info_is_dir(const FileInfo* file_info) { furi_check(file_info); - return (file_info->flags & FSF_DIRECTORY); -} \ No newline at end of file + return file_info->flags & FSF_DIRECTORY; +} diff --git a/applications/services/storage/storage.c b/applications/services/storage/storage.c index f43c6e815..21f8789ce 100644 --- a/applications/services/storage/storage.c +++ b/applications/services/storage/storage.c @@ -10,7 +10,7 @@ #define STORAGE_TICK 1000 #define ICON_SD_MOUNTED &I_SDcardMounted_11x8 -#define ICON_SD_ERROR &I_SDcardFail_11x8 +#define ICON_SD_ERROR &I_SDcardFail_11x8 #define TAG "Storage" diff --git a/applications/services/storage/storage.h b/applications/services/storage/storage.h index eaef59cd6..a4dffe633 100644 --- a/applications/services/storage/storage.h +++ b/applications/services/storage/storage.h @@ -12,16 +12,16 @@ extern "C" { #endif -#define STORAGE_INT_PATH_PREFIX "/int" -#define STORAGE_EXT_PATH_PREFIX "/ext" -#define STORAGE_ANY_PATH_PREFIX "/any" -#define STORAGE_APP_DATA_PATH_PREFIX "/data" +#define STORAGE_INT_PATH_PREFIX "/int" +#define STORAGE_EXT_PATH_PREFIX "/ext" +#define STORAGE_ANY_PATH_PREFIX "/any" +#define STORAGE_APP_DATA_PATH_PREFIX "/data" #define STORAGE_APP_ASSETS_PATH_PREFIX "/assets" -#define INT_PATH(path) STORAGE_INT_PATH_PREFIX "/" path -#define EXT_PATH(path) STORAGE_EXT_PATH_PREFIX "/" path -#define ANY_PATH(path) STORAGE_ANY_PATH_PREFIX "/" path -#define APP_DATA_PATH(path) STORAGE_APP_DATA_PATH_PREFIX "/" path +#define INT_PATH(path) STORAGE_INT_PATH_PREFIX "/" path +#define EXT_PATH(path) STORAGE_EXT_PATH_PREFIX "/" path +#define ANY_PATH(path) STORAGE_ANY_PATH_PREFIX "/" path +#define APP_DATA_PATH(path) STORAGE_APP_DATA_PATH_PREFIX "/" path #define APP_ASSETS_PATH(path) STORAGE_APP_ASSETS_PATH_PREFIX "/" path #define RECORD_STORAGE "storage" diff --git a/applications/services/storage/storage_cli.c b/applications/services/storage/storage_cli.c index a77cf2d2a..918e796ce 100644 --- a/applications/services/storage/storage_cli.c +++ b/applications/services/storage/storage_cli.c @@ -66,7 +66,7 @@ static void storage_cli_info(Cli* cli, FuriString* path, FuriString* args) { } furi_record_close(RECORD_STORAGE); -}; +} static void storage_cli_format(Cli* cli, FuriString* path, FuriString* args) { UNUSED(args); @@ -93,7 +93,7 @@ static void storage_cli_format(Cli* cli, FuriString* path, FuriString* args) { } else { storage_cli_print_usage(); } -}; +} static void storage_cli_list(Cli* cli, FuriString* path, FuriString* args) { UNUSED(cli); @@ -241,7 +241,7 @@ static void storage_cli_write(Cli* cli, FuriString* path, FuriString* args) { fflush(stdout); read_index++; - if(((read_index % buffer_size) == 0)) { + if((read_index % buffer_size) == 0) { size_t written_size = storage_file_write(file, buffer, buffer_size); if(written_size != buffer_size) { @@ -630,7 +630,7 @@ static void storage_cli_print_usage(void) { printf( "\t%s%s - %s\r\n", cli_cmd, strlen(cli_cmd) > 8 ? "\t" : "\t\t", command_descr->help); } -}; +} void storage_cli(Cli* cli, FuriString* args, void* context) { UNUSED(context); diff --git a/applications/services/storage/storage_external_api.c b/applications/services/storage/storage_external_api.c index adc0e2465..7803e8f6a 100644 --- a/applications/services/storage/storage_external_api.c +++ b/applications/services/storage/storage_external_api.c @@ -7,8 +7,8 @@ #include #include "toolbox/path.h" -#define MAX_NAME_LENGTH 256 -#define MAX_EXT_LEN 16 +#define MAX_NAME_LENGTH 256 +#define MAX_EXT_LEN 16 #define FILE_BUFFER_SIZE 512 #define TAG "StorageApi" @@ -41,10 +41,10 @@ .file = file, \ }}; -#define S_RETURN_BOOL (return_data.bool_value); -#define S_RETURN_UINT16 (return_data.uint16_value); -#define S_RETURN_UINT64 (return_data.uint64_value); -#define S_RETURN_ERROR (return_data.error_value); +#define S_RETURN_BOOL (return_data.bool_value); +#define S_RETURN_UINT16 (return_data.uint16_value); +#define S_RETURN_UINT64 (return_data.uint64_value); +#define S_RETURN_ERROR (return_data.error_value); #define S_RETURN_CSTRING (return_data.cstring_value); typedef enum { @@ -929,12 +929,12 @@ File* storage_file_alloc(Storage* storage) { bool storage_file_is_open(File* file) { furi_check(file); - return (file->type != FileTypeClosed); + return file->type != FileTypeClosed; } bool storage_file_is_dir(File* file) { furi_check(file); - return (file->type == FileTypeOpenDir); + return file->type == FileTypeOpenDir; } void storage_file_free(File* file) { diff --git a/applications/services/storage/storage_glue.h b/applications/services/storage/storage_glue.h index 4323296cf..7aa66fce0 100644 --- a/applications/services/storage/storage_glue.h +++ b/applications/services/storage/storage_glue.h @@ -8,7 +8,12 @@ extern "C" { #endif -typedef enum { ST_EXT = 0, ST_INT = 1, ST_ANY, ST_ERROR } StorageType; +typedef enum { + ST_EXT = 0, + ST_INT = 1, + ST_ANY, + ST_ERROR +} StorageType; typedef struct StorageData StorageData; diff --git a/applications/services/storage/storage_i.h b/applications/services/storage/storage_i.h index cb7f16e47..2ad9dcc78 100644 --- a/applications/services/storage/storage_i.h +++ b/applications/services/storage/storage_i.h @@ -12,7 +12,7 @@ extern "C" { #define STORAGE_COUNT (ST_INT + 1) -#define APPS_DATA_PATH EXT_PATH("apps_data") +#define APPS_DATA_PATH EXT_PATH("apps_data") #define APPS_ASSETS_PATH EXT_PATH("apps_assets") typedef struct { diff --git a/applications/services/storage/storages/storage_ext.c b/applications/services/storage/storages/storage_ext.c index 7e617c0ff..93e06f663 100644 --- a/applications/services/storage/storages/storage_ext.c +++ b/applications/services/storage/storages/storage_ext.c @@ -337,7 +337,7 @@ static bool storage_ext_file_open( file->internal_error_id = f_open(file_data, path, _mode); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_file_close(void* ctx, File* file) { @@ -347,7 +347,7 @@ static bool storage_ext_file_close(void* ctx, File* file) { file->error_id = storage_ext_parse_error(file->internal_error_id); free(file_data); storage_set_storage_file_data(file, NULL, storage); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint16_t @@ -392,7 +392,7 @@ static bool } file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint64_t storage_ext_file_tell(void* ctx, File* file) { @@ -416,7 +416,7 @@ static bool storage_ext_file_truncate(void* ctx, File* file) { file->internal_error_id = f_truncate(file_data); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; #endif } @@ -431,7 +431,7 @@ static bool storage_ext_file_sync(void* ctx, File* file) { file->internal_error_id = f_sync(file_data); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; #endif } @@ -464,7 +464,7 @@ static bool storage_ext_dir_open(void* ctx, File* file, const char* path) { storage_set_storage_file_data(file, file_data, storage); file->internal_error_id = f_opendir(file_data, path); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_dir_close(void* ctx, File* file) { @@ -474,7 +474,7 @@ static bool storage_ext_dir_close(void* ctx, File* file) { file->internal_error_id = f_closedir(file_data); file->error_id = storage_ext_parse_error(file->internal_error_id); free(file_data); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_dir_read( @@ -505,7 +505,7 @@ static bool storage_ext_dir_read( file->error_id = FSE_NOT_EXIST; } - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_ext_dir_rewind(void* ctx, File* file) { @@ -514,7 +514,7 @@ static bool storage_ext_dir_rewind(void* ctx, File* file) { file->internal_error_id = f_readdir(file_data, NULL); file->error_id = storage_ext_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } /******************* Common FS Functions *******************/ diff --git a/applications/services/storage/storages/storage_int.c b/applications/services/storage/storages/storage_int.c index 8c3827fe5..324ce6328 100644 --- a/applications/services/storage/storages/storage_int.c +++ b/applications/services/storage/storages/storage_int.c @@ -4,7 +4,8 @@ #include #define TAG "StorageInt" -#define STORAGE_PATH STORAGE_INT_PATH_PREFIX + +#define STORAGE_PATH STORAGE_INT_PATH_PREFIX #define LFS_CLEAN_FINGERPRINT 0 /* When less than LFS_RESERVED_PAGES_COUNT are left free, creation & @@ -160,7 +161,7 @@ static LFSData* storage_int_lfs_data_alloc(void) { lfs_data->config.lookahead_size = 16; return lfs_data; -}; +} // Returns true if fingerprint was invalid and LFS reformatting is needed static bool storage_int_check_and_set_fingerprint(LFSData* lfs_data) { @@ -287,7 +288,7 @@ static bool storage_int_check_for_free_space(StorageData* storage) { lfs_size_t free_space = (lfs_data->config.block_count - result) * lfs_data->config.block_size; - return (free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size()); + return free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size(); } return false; @@ -344,7 +345,7 @@ static bool storage_int_file_open( file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_file_close(void* ctx, File* file) { @@ -360,7 +361,7 @@ static bool storage_int_file_close(void* ctx, File* file) { file->error_id = storage_int_parse_error(file->internal_error_id); lfs_handle_free(handle); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint16_t @@ -430,7 +431,7 @@ static bool } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint64_t storage_int_file_tell(void* ctx, File* file) { @@ -475,7 +476,7 @@ static bool storage_int_file_truncate(void* ctx, File* file) { file->error_id = storage_int_parse_error(file->internal_error_id); } - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_file_sync(void* ctx, File* file) { @@ -490,7 +491,7 @@ static bool storage_int_file_sync(void* ctx, File* file) { } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static uint64_t storage_int_file_size(void* ctx, File* file) { @@ -557,7 +558,7 @@ static bool storage_int_dir_open(void* ctx, File* file, const char* path) { } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_dir_close(void* ctx, File* file) { @@ -573,7 +574,7 @@ static bool storage_int_dir_close(void* ctx, File* file) { file->error_id = storage_int_parse_error(file->internal_error_id); lfs_handle_free(handle); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_dir_read( @@ -614,7 +615,7 @@ static bool storage_int_dir_read( file->error_id = storage_int_parse_error(file->internal_error_id); } - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } static bool storage_int_dir_rewind(void* ctx, File* file) { @@ -629,7 +630,7 @@ static bool storage_int_dir_rewind(void* ctx, File* file) { } file->error_id = storage_int_parse_error(file->internal_error_id); - return (file->error_id == FSE_OK); + return file->error_id == FSE_OK; } /******************* Common FS Functions *******************/ diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_config.h b/applications/settings/desktop_settings/scenes/desktop_settings_scene_config.h index 52b8829be..4a1d03701 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_config.h +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_config.h @@ -11,4 +11,4 @@ ADD_SCENE(desktop_settings, pin_setup_howto2, PinSetupHowto2) ADD_SCENE(desktop_settings, pin_setup_done, PinSetupDone) ADD_SCENE(desktop_settings, quick_apps_menu, QuickAppsMenu) -ADD_SCENE(desktop_settings, quick_apps_direction_menu, QuickAppsDirectionMenu) \ No newline at end of file +ADD_SCENE(desktop_settings, quick_apps_direction_menu, QuickAppsDirectionMenu) diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c index e46473a71..384c0739c 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c @@ -8,17 +8,17 @@ #define APPS_COUNT (FLIPPER_APPS_COUNT + FLIPPER_EXTERNAL_APPS_COUNT) -#define DEFAULT_INDEX (0) -#define EXTERNAL_BROWSER_NAME ("( ) Apps Menu (Default)") +#define DEFAULT_INDEX (0) +#define EXTERNAL_BROWSER_NAME ("( ) Apps Menu (Default)") #define EXTERNAL_BROWSER_NAME_SELECTED ("(*) Apps Menu (Default)") -#define PASSPORT_NAME ("( ) Passport (Default)") -#define PASSPORT_NAME_SELECTED ("(*) Passport (Default)") +#define PASSPORT_NAME ("( ) Passport (Default)") +#define PASSPORT_NAME_SELECTED ("(*) Passport (Default)") -#define SELECTED_PREFIX ("(*) ") +#define SELECTED_PREFIX ("(*) ") #define NOT_SELECTED_PREFIX ("( ) ") -#define EXTERNAL_APPLICATION_INDEX (1) -#define EXTERNAL_APPLICATION_NAME ("( ) [Select App]") +#define EXTERNAL_APPLICATION_INDEX (1) +#define EXTERNAL_APPLICATION_NAME ("( ) [Select App]") #define EXTERNAL_APPLICATION_NAME_SELECTED ("(*) [Select App]") #define PRESELECTED_SPECIAL 0xffffffff diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_i.h b/applications/settings/desktop_settings/scenes/desktop_settings_scene_i.h index 657680bc3..207824a62 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_i.h +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_i.h @@ -1,10 +1,10 @@ #pragma once -#define SCENE_STATE_PIN_AUTH_DISABLE (0) +#define SCENE_STATE_PIN_AUTH_DISABLE (0) #define SCENE_STATE_PIN_AUTH_CHANGE_PIN (1) #define SCENE_STATE_PIN_ERROR_MISMATCH (0) -#define SCENE_STATE_PIN_ERROR_WRONG (1) +#define SCENE_STATE_PIN_ERROR_WRONG (1) #define SCENE_STATE_SET_FAVORITE_APP (0) -#define SCENE_STATE_SET_DUMMY_APP (1 << 8) +#define SCENE_STATE_SET_DUMMY_APP (1 << 8) diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_auth.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_auth.c index b73fe347b..5af25cd61 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_auth.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_auth.c @@ -8,8 +8,8 @@ #include "desktop_settings_scene.h" #include "desktop_settings_scene_i.h" -#define SCENE_EVENT_EXIT (0U) -#define SCENE_EVENT_PINS_EQUAL (1U) +#define SCENE_EVENT_EXIT (0U) +#define SCENE_EVENT_PINS_EQUAL (1U) #define SCENE_EVENT_PINS_DIFFERENT (2U) static void pin_auth_done_callback(const PinCode* pin_code, void* context) { diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_menu.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_menu.c index 950be4c5a..7375edd3f 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_menu.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_menu.c @@ -5,8 +5,8 @@ #include "desktop_settings_scene.h" #include "desktop_settings_scene_i.h" -#define SCENE_EVENT_SET_PIN 0 -#define SCENE_EVENT_CHANGE_PIN 1 +#define SCENE_EVENT_SET_PIN 0 +#define SCENE_EVENT_CHANGE_PIN 1 #define SCENE_EVENT_DISABLE_PIN 2 static void desktop_settings_scene_pin_menu_submenu_callback(void* context, uint32_t index) { diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup.c index 5b8aa8638..93012330a 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup.c @@ -9,10 +9,10 @@ #include "desktop_settings_scene_i.h" #include -#define SCENE_EVENT_EXIT (0U) +#define SCENE_EVENT_EXIT (0U) #define SCENE_EVENT_1ST_PIN_ENTERED (1U) -#define SCENE_EVENT_PINS_EQUAL (2U) -#define SCENE_EVENT_PINS_DIFFERENT (3U) +#define SCENE_EVENT_PINS_EQUAL (2U) +#define SCENE_EVENT_PINS_DIFFERENT (3U) static void pin_setup_done_callback(const PinCode* pin_code, void* context) { furi_assert(pin_code); diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_quick_apps_menu.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_quick_apps_menu.c index acba4fa25..a7000204f 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_quick_apps_menu.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_quick_apps_menu.c @@ -6,7 +6,7 @@ #include "desktop_settings_scene_i.h" #define SCENE_EVENT_SET_DEFAULT (0U) -#define SCENE_EVENT_SET_DUMMY (1U) +#define SCENE_EVENT_SET_DUMMY (1U) static void desktop_settings_scene_quick_apps_menu_submenu_callback(void* context, uint32_t index) { diff --git a/applications/settings/dolphin_passport/passport.c b/applications/settings/dolphin_passport/passport.c index aae53cd2a..6419f4366 100644 --- a/applications/settings/dolphin_passport/passport.c +++ b/applications/settings/dolphin_passport/passport.c @@ -7,7 +7,7 @@ #include -#define MOODS_TOTAL 3 +#define MOODS_TOTAL 3 #define BUTTHURT_MAX 3 static const Icon* const portrait_happy[BUTTHURT_MAX] = { diff --git a/applications/settings/power_settings_app/power_settings_app.h b/applications/settings/power_settings_app/power_settings_app.h index 09cc5af7a..e19e7c983 100644 --- a/applications/settings/power_settings_app/power_settings_app.h +++ b/applications/settings/power_settings_app/power_settings_app.h @@ -31,4 +31,7 @@ typedef enum { PowerSettingsAppViewDialog, } PowerSettingsAppView; -typedef enum { RebootTypeDFU, RebootTypeNormal } RebootType; +typedef enum { + RebootTypeDFU, + RebootTypeNormal +} RebootType; diff --git a/applications/settings/power_settings_app/views/battery_info.c b/applications/settings/power_settings_app/views/battery_info.c index c626d1844..e4c040b9c 100644 --- a/applications/settings/power_settings_app/views/battery_info.c +++ b/applications/settings/power_settings_app/views/battery_info.c @@ -4,7 +4,7 @@ #include #include -#define LOW_CHARGE_THRESHOLD (10) +#define LOW_CHARGE_THRESHOLD (10) #define HIGH_DRAIN_CURRENT_THRESHOLD (-100) struct BatteryInfo { @@ -18,7 +18,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val) canvas_draw_box(canvas, x - 4, y + 16, 24, 6); canvas_set_color(canvas, ColorBlack); canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val); -}; +} static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) { char emote[20] = {}; @@ -88,7 +88,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) { canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote); canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header); canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value); -}; +} static void battery_info_draw_callback(Canvas* canvas, void* context) { furi_assert(context); diff --git a/applications/settings/storage_settings/scenes/storage_settings_scene_benchmark.c b/applications/settings/storage_settings/scenes/storage_settings_scene_benchmark.c index bfc9ac9c9..c07ab1ae6 100644 --- a/applications/settings/storage_settings/scenes/storage_settings_scene_benchmark.c +++ b/applications/settings/storage_settings/scenes/storage_settings_scene_benchmark.c @@ -4,9 +4,9 @@ #include #define BENCH_DATA_SIZE 4096 -#define BENCH_COUNT 6 -#define BENCH_REPEATS 4 -#define BENCH_FILE EXT_PATH("rwfiletest.bin") +#define BENCH_COUNT 6 +#define BENCH_REPEATS 4 +#define BENCH_FILE EXT_PATH("rwfiletest.bin") static void storage_settings_scene_benchmark_dialog_callback(DialogExResult result, void* context) { diff --git a/applications/system/hid_app/views.h b/applications/system/hid_app/views.h index f94a55cc6..6f027e250 100644 --- a/applications/system/hid_app/views.h +++ b/applications/system/hid_app/views.h @@ -9,4 +9,4 @@ typedef enum { BtHidViewTikTok, HidViewDialog, HidViewPopup, -} HidView; \ No newline at end of file +} HidView; diff --git a/applications/system/hid_app/views/hid_keyboard.c b/applications/system/hid_app/views/hid_keyboard.c index 429f223c1..ec95082e9 100644 --- a/applications/system/hid_app/views/hid_keyboard.c +++ b/applications/system/hid_app/views/hid_keyboard.c @@ -39,12 +39,12 @@ typedef struct { int8_t y; } HidKeyboardPoint; // 4 BY 12 -#define MARGIN_TOP 0 -#define MARGIN_LEFT 4 -#define KEY_WIDTH 9 -#define KEY_HEIGHT 12 -#define KEY_PADDING 1 -#define ROW_COUNT 7 +#define MARGIN_TOP 0 +#define MARGIN_LEFT 4 +#define KEY_WIDTH 9 +#define KEY_HEIGHT 12 +#define KEY_PADDING 1 +#define ROW_COUNT 7 #define COLUMN_COUNT 12 // 0 width items are not drawn, but their value is used diff --git a/applications/system/hid_app/views/hid_mouse.h b/applications/system/hid_app/views/hid_mouse.h index d9fb2fd88..9a1bcc028 100644 --- a/applications/system/hid_app/views/hid_mouse.h +++ b/applications/system/hid_app/views/hid_mouse.h @@ -3,7 +3,7 @@ #include #define MOUSE_MOVE_SHORT 5 -#define MOUSE_MOVE_LONG 20 +#define MOUSE_MOVE_LONG 20 typedef struct Hid Hid; typedef struct HidMouse HidMouse; diff --git a/applications/system/hid_app/views/hid_mouse_clicker.c b/applications/system/hid_app/views/hid_mouse_clicker.c index 3a2a064cb..0bb815249 100644 --- a/applications/system/hid_app/views/hid_mouse_clicker.c +++ b/applications/system/hid_app/views/hid_mouse_clicker.c @@ -5,6 +5,7 @@ #include "hid_icons.h" #define TAG "HidMouseClicker" + #define DEFAULT_CLICK_RATE 1 #define MAXIMUM_CLICK_RATE 60 diff --git a/applications/system/hid_app/views/hid_mouse_jiggler.h b/applications/system/hid_app/views/hid_mouse_jiggler.h index 0813b4351..0ed949aae 100644 --- a/applications/system/hid_app/views/hid_mouse_jiggler.h +++ b/applications/system/hid_app/views/hid_mouse_jiggler.h @@ -3,7 +3,7 @@ #include #define MOUSE_MOVE_SHORT 5 -#define MOUSE_MOVE_LONG 20 +#define MOUSE_MOVE_LONG 20 typedef struct Hid Hid; typedef struct HidMouseJiggler HidMouseJiggler; diff --git a/applications/system/js_app/js_modules.c b/applications/system/js_app/js_modules.c index fa5332884..9ab6cb140 100644 --- a/applications/system/js_app/js_modules.c +++ b/applications/system/js_app/js_modules.c @@ -126,4 +126,4 @@ mjs_val_t js_module_require(JsModules* modules, const char* name, size_t name_le furi_string_free(module_name); return module_object; -} \ No newline at end of file +} diff --git a/applications/system/js_app/js_modules.h b/applications/system/js_app/js_modules.h index aff4d7e8d..77e50786f 100644 --- a/applications/system/js_app/js_modules.h +++ b/applications/system/js_app/js_modules.h @@ -4,7 +4,7 @@ #include #include -#define PLUGIN_APP_ID "js" +#define PLUGIN_APP_ID "js" #define PLUGIN_API_VERSION 1 typedef void* (*JsModeConstructor)(struct mjs* mjs, mjs_val_t* object); diff --git a/applications/system/js_app/modules/js_badusb.c b/applications/system/js_app/modules/js_badusb.c index 199773c39..99f8958f7 100644 --- a/applications/system/js_app/modules/js_badusb.c +++ b/applications/system/js_app/modules/js_badusb.c @@ -159,7 +159,7 @@ static void js_badusb_is_connected(struct mjs* mjs) { uint16_t get_keycode_by_name(const char* key_name, size_t name_len) { if(name_len == 1) { // Single char - return (HID_ASCII_TO_KEY(key_name[0])); + return HID_ASCII_TO_KEY(key_name[0]); } for(size_t i = 0; i < COUNT_OF(key_codes); i++) { diff --git a/applications/system/js_app/modules/js_math.c b/applications/system/js_app/modules/js_math.c index b4c1cdca2..d8812e61b 100644 --- a/applications/system/js_app/modules/js_math.c +++ b/applications/system/js_app/modules/js_math.c @@ -2,8 +2,8 @@ #include "furi_hal_random.h" #include -#define JS_MATH_PI ((double)M_PI) -#define JS_MATH_E ((double)M_E) +#define JS_MATH_PI ((double)M_PI) +#define JS_MATH_E ((double)M_E) #define JS_MATH_EPSILON ((double)DBL_EPSILON) #define TAG "JsMath" diff --git a/applications/system/js_app/modules/js_notification.c b/applications/system/js_app/modules/js_notification.c index e1084be13..2f57c45d1 100644 --- a/applications/system/js_app/modules/js_notification.c +++ b/applications/system/js_app/modules/js_notification.c @@ -106,4 +106,4 @@ static const FlipperAppPluginDescriptor plugin_descriptor = { const FlipperAppPluginDescriptor* js_notification_ep(void) { return &plugin_descriptor; -} \ No newline at end of file +} diff --git a/applications/system/js_app/modules/js_serial.c b/applications/system/js_app/modules/js_serial.c index 4f1b14f98..234eefb43 100644 --- a/applications/system/js_app/modules/js_serial.c +++ b/applications/system/js_app/modules/js_serial.c @@ -3,7 +3,8 @@ #include "../js_modules.h" #include -#define TAG "js_serial" +#define TAG "JsSerial" + #define RX_BUF_LEN 2048 typedef struct { @@ -444,14 +445,14 @@ static int32_t js_serial_expect_check_pattern_start( int32_t pattern_last) { size_t array_len = PatternArray_size(patterns); if((pattern_last + 1) >= (int32_t)array_len) { - return (-1); + return -1; } for(size_t i = pattern_last + 1; i < array_len; i++) { if(PatternArray_get(patterns, i)->data[0] == value) { return i; } } - return (-1); + return -1; } static void js_serial_expect(struct mjs* mjs) { diff --git a/applications/system/js_app/modules/js_textbox.c b/applications/system/js_app/modules/js_textbox.c index d15cd2779..33798b296 100644 --- a/applications/system/js_app/modules/js_textbox.c +++ b/applications/system/js_app/modules/js_textbox.c @@ -217,4 +217,4 @@ static const FlipperAppPluginDescriptor textbox_plugin_descriptor = { const FlipperAppPluginDescriptor* js_textbox_ep(void) { return &textbox_plugin_descriptor; -} \ No newline at end of file +} diff --git a/applications/system/js_app/plugin_api/app_api_interface.h b/applications/system/js_app/plugin_api/app_api_interface.h index d0db44c4a..be4f78930 100644 --- a/applications/system/js_app/plugin_api/app_api_interface.h +++ b/applications/system/js_app/plugin_api/app_api_interface.h @@ -6,4 +6,4 @@ * Resolver interface with private application's symbols. * Implementation is contained in app_api_table.c */ -extern const ElfApiInterface* const application_api_interface; \ No newline at end of file +extern const ElfApiInterface* const application_api_interface; diff --git a/applications/system/js_app/plugin_api/js_plugin_api.h b/applications/system/js_app/plugin_api/js_plugin_api.h index 491860587..a817d34a9 100644 --- a/applications/system/js_app/plugin_api/js_plugin_api.h +++ b/applications/system/js_app/plugin_api/js_plugin_api.h @@ -15,4 +15,4 @@ uint32_t js_flags_wait(struct mjs* mjs, uint32_t flags, uint32_t timeout); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/applications/system/js_app/views/console_view.c b/applications/system/js_app/views/console_view.c index b87e53528..67f5d9de8 100644 --- a/applications/system/js_app/views/console_view.c +++ b/applications/system/js_app/views/console_view.c @@ -1,10 +1,10 @@ #include "../js_app_i.h" #include "console_font.h" -#define CONSOLE_LINES 8 -#define CONSOLE_CHAR_W 5 +#define CONSOLE_LINES 8 +#define CONSOLE_CHAR_W 5 #define LINE_BREAKS_MAX 3 -#define LINE_LEN_MAX (128 / CONSOLE_CHAR_W) +#define LINE_LEN_MAX (128 / CONSOLE_CHAR_W) struct JsConsoleView { View* view; @@ -161,4 +161,4 @@ void console_view_free(JsConsoleView* console_view) { View* console_view_get_view(JsConsoleView* console_view) { return console_view->view; -} \ No newline at end of file +} diff --git a/applications/system/storage_move_to_sd/storage_move_to_sd.c b/applications/system/storage_move_to_sd/storage_move_to_sd.c index 12a77eafa..652c34c72 100644 --- a/applications/system/storage_move_to_sd/storage_move_to_sd.c +++ b/applications/system/storage_move_to_sd/storage_move_to_sd.c @@ -17,7 +17,7 @@ static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo, return true; } - return (name && (*name != '.')); + return name && (*name != '.'); } bool storage_move_to_sd_perform(void) { diff --git a/applications/system/updater/util/update_task.h b/applications/system/updater/util/update_task.h index 82e310fbd..52bdfdbd2 100644 --- a/applications/system/updater/util/update_task.h +++ b/applications/system/updater/util/update_task.h @@ -9,7 +9,7 @@ extern "C" { #include #include -#define UPDATE_DELAY_OPERATION_OK 10 +#define UPDATE_DELAY_OPERATION_OK 10 #define UPDATE_DELAY_OPERATION_ERROR INT_MAX typedef enum { diff --git a/applications/system/updater/util/update_task_i.h b/applications/system/updater/util/update_task_i.h index 1b664e57e..e2663c97d 100644 --- a/applications/system/updater/util/update_task_i.h +++ b/applications/system/updater/util/update_task_i.h @@ -3,7 +3,7 @@ #include #include -#define UPDATE_TASK_NOERR 0 +#define UPDATE_TASK_NOERR 0 #define UPDATE_TASK_FAILED -1 typedef struct UpdateTask { diff --git a/applications/system/updater/util/update_task_worker_flasher.c b/applications/system/updater/util/update_task_worker_flasher.c index 0c7881e63..848cc5494 100644 --- a/applications/system/updater/util/update_task_worker_flasher.c +++ b/applications/system/updater/util/update_task_worker_flasher.c @@ -13,12 +13,12 @@ #define TAG "UpdWorkerRam" -#define STM_DFU_VENDOR_ID 0x0483 -#define STM_DFU_PRODUCT_ID 0xDF11 +#define STM_DFU_VENDOR_ID 0x0483 +#define STM_DFU_PRODUCT_ID 0xDF11 /* Written into DFU file by build pipeline */ #define FLIPPER_ZERO_DFU_DEVICE_CODE 0xFFFF /* Time, in ms, to wait for system restart by C2 before crashing */ -#define C2_MODE_SWITCH_TIMEOUT 10000 +#define C2_MODE_SWITCH_TIMEOUT 10000 static const DfuValidationParams flipper_dfu_params = { .device = FLIPPER_ZERO_DFU_DEVICE_CODE, @@ -36,7 +36,7 @@ static bool page_task_compare_flash( const uint8_t* update_block, uint16_t update_block_len) { const size_t page_addr = furi_hal_flash_get_base() + furi_hal_flash_get_page_size() * i_page; - return (memcmp(update_block, (void*)page_addr, update_block_len) == 0); + return memcmp(update_block, (void*)page_addr, update_block_len) == 0; } /* Verifies a flash operation address for fitting into writable memory @@ -44,7 +44,7 @@ static bool page_task_compare_flash( static bool check_address_boundaries(const size_t address) { const size_t min_allowed_address = furi_hal_flash_get_base(); const size_t max_allowed_address = (size_t)furi_hal_flash_get_free_end_address(); - return ((address >= min_allowed_address) && (address < max_allowed_address)); + return (address >= min_allowed_address) && (address < max_allowed_address); } static bool update_task_flash_program_page( diff --git a/furi/core/check.h b/furi/core/check.h index a51d7b41e..a2b7dd18e 100644 --- a/furi/core/check.h +++ b/furi/core/check.h @@ -22,7 +22,7 @@ extern "C" { // Flags instead of pointers will save ~4 bytes on furi_assert and furi_check calls. #define __FURI_ASSERT_MESSAGE_FLAG (0x01) -#define __FURI_CHECK_MESSAGE_FLAG (0x02) +#define __FURI_CHECK_MESSAGE_FLAG (0x02) /** Crash system */ FURI_NORETURN void __furi_crash_implementation(void); diff --git a/furi/core/core_defines.h b/furi/core/core_defines.h index 732a90cb5..fa56150ce 100644 --- a/furi/core/core_defines.h +++ b/furi/core/core_defines.h @@ -79,7 +79,7 @@ extern "C" { #endif #ifndef CONCATENATE -#define CONCATENATE(a, b) CONCATENATE_(a, b) +#define CONCATENATE(a, b) CONCATENATE_(a, b) #define CONCATENATE_(a, b) a##b #endif diff --git a/furi/core/critical.c b/furi/core/critical.c index 3bef2be38..32797ee00 100644 --- a/furi/core/critical.c +++ b/furi/core/critical.c @@ -29,4 +29,4 @@ void __furi_critical_exit(__FuriCriticalInfo info) { } else { __enable_irq(); } -} \ No newline at end of file +} diff --git a/furi/core/event_flag.c b/furi/core/event_flag.c index c2e04e2fd..f89c4e77f 100644 --- a/furi/core/event_flag.c +++ b/furi/core/event_flag.c @@ -6,7 +6,7 @@ #include #define FURI_EVENT_FLAG_MAX_BITS_EVENT_GROUPS 24U -#define FURI_EVENT_FLAG_INVALID_BITS (~((1UL << FURI_EVENT_FLAG_MAX_BITS_EVENT_GROUPS) - 1U)) +#define FURI_EVENT_FLAG_INVALID_BITS (~((1UL << FURI_EVENT_FLAG_MAX_BITS_EVENT_GROUPS) - 1U)) struct FuriEventFlag { StaticEventGroup_t container; diff --git a/furi/core/kernel.c b/furi/core/kernel.c index 52c0e285e..f3f84e692 100644 --- a/furi/core/kernel.c +++ b/furi/core/kernel.c @@ -29,7 +29,7 @@ bool furi_kernel_is_irq_or_masked(void) { } /* Return context, 0: thread context, 1: IRQ context */ - return (irq); + return irq; } bool furi_kernel_is_running(void) { @@ -58,7 +58,7 @@ int32_t furi_kernel_lock(void) { } /* Return previous lock state */ - return (lock); + return lock; } int32_t furi_kernel_unlock(void) { @@ -88,7 +88,7 @@ int32_t furi_kernel_unlock(void) { } /* Return previous lock state */ - return (lock); + return lock; } int32_t furi_kernel_restore_lock(int32_t lock) { @@ -119,12 +119,12 @@ int32_t furi_kernel_restore_lock(int32_t lock) { } /* Return new lock state */ - return (lock); + return lock; } uint32_t furi_kernel_get_tick_frequency(void) { /* Return frequency in hertz */ - return (configTICK_RATE_HZ_RAW); + return configTICK_RATE_HZ_RAW; } void furi_delay_tick(uint32_t ticks) { @@ -160,7 +160,7 @@ FuriStatus furi_delay_until_tick(uint32_t tick) { } /* Return execution status */ - return (stat); + return stat; } uint32_t furi_get_tick(void) { diff --git a/furi/core/log.h b/furi/core/log.h index 3ce88db5b..817d9dda3 100644 --- a/furi/core/log.h +++ b/furi/core/log.h @@ -23,14 +23,14 @@ typedef enum { FuriLogLevelTrace = 6, } FuriLogLevel; -#define _FURI_LOG_CLR(clr) "\033[0;" clr "m" +#define _FURI_LOG_CLR(clr) "\033[0;" clr "m" #define _FURI_LOG_CLR_RESET "\033[0m" -#define _FURI_LOG_CLR_BLACK "30" -#define _FURI_LOG_CLR_RED "31" -#define _FURI_LOG_CLR_GREEN "32" -#define _FURI_LOG_CLR_BROWN "33" -#define _FURI_LOG_CLR_BLUE "34" +#define _FURI_LOG_CLR_BLACK "30" +#define _FURI_LOG_CLR_RED "31" +#define _FURI_LOG_CLR_GREEN "32" +#define _FURI_LOG_CLR_BROWN "33" +#define _FURI_LOG_CLR_BLUE "34" #define _FURI_LOG_CLR_PURPLE "35" #define _FURI_LOG_CLR_E _FURI_LOG_CLR(_FURI_LOG_CLR_RED) diff --git a/furi/core/memmgr.c b/furi/core/memmgr.c index ba9a7336a..d3ff873ae 100644 --- a/furi/core/memmgr.c +++ b/furi/core/memmgr.c @@ -107,4 +107,4 @@ void* aligned_malloc(size_t size, size_t alignment) { void aligned_free(void* p) { free(((void**)p)[-1]); -} \ No newline at end of file +} diff --git a/furi/core/memmgr_heap.c b/furi/core/memmgr_heap.c index 3827ddde3..359d0e3db 100644 --- a/furi/core/memmgr_heap.c +++ b/furi/core/memmgr_heap.c @@ -528,7 +528,7 @@ void vPortFree(void* pv) { xFreeBytesRemaining += pxLink->xBlockSize; traceFREE(pv, pxLink->xBlockSize); memset(pv, 0, pxLink->xBlockSize - xHeapStructSize); - prvInsertBlockIntoFreeList(((BlockLink_t*)pxLink)); + prvInsertBlockIntoFreeList((BlockLink_t*)pxLink); } (void)xTaskResumeAll(); } else { diff --git a/furi/core/message_queue.c b/furi/core/message_queue.c index f07b3bfcb..3521ceb30 100644 --- a/furi/core/message_queue.c +++ b/furi/core/message_queue.c @@ -8,8 +8,8 @@ // Internal FreeRTOS member names #define uxMessagesWaiting uxDummy4[0] -#define uxLength uxDummy4[1] -#define uxItemSize uxDummy4[2] +#define uxLength uxDummy4[1] +#define uxItemSize uxDummy4[2] struct FuriMessageQueue { StaticQueue_t container; diff --git a/furi/core/stream_buffer.c b/furi/core/stream_buffer.c index 879520010..ef8869dea 100644 --- a/furi/core/stream_buffer.c +++ b/furi/core/stream_buffer.c @@ -29,20 +29,20 @@ FuriStreamBuffer* furi_stream_buffer_alloc(size_t size, size_t trigger_level) { furi_check(hStreamBuffer == (StreamBufferHandle_t)stream_buffer); return stream_buffer; -}; +} void furi_stream_buffer_free(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); vStreamBufferDelete((StreamBufferHandle_t)stream_buffer); free(stream_buffer); -}; +} bool furi_stream_set_trigger_level(FuriStreamBuffer* stream_buffer, size_t trigger_level) { furi_check(stream_buffer); return xStreamBufferSetTriggerLevel((StreamBufferHandle_t)stream_buffer, trigger_level) == pdTRUE; -}; +} size_t furi_stream_buffer_send( FuriStreamBuffer* stream_buffer, @@ -62,7 +62,7 @@ size_t furi_stream_buffer_send( } return ret; -}; +} size_t furi_stream_buffer_receive( FuriStreamBuffer* stream_buffer, @@ -89,25 +89,25 @@ size_t furi_stream_buffer_bytes_available(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); return xStreamBufferBytesAvailable((StreamBufferHandle_t)stream_buffer); -}; +} size_t furi_stream_buffer_spaces_available(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); return xStreamBufferSpacesAvailable((StreamBufferHandle_t)stream_buffer); -}; +} bool furi_stream_buffer_is_full(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); return xStreamBufferIsFull((StreamBufferHandle_t)stream_buffer) == pdTRUE; -}; +} bool furi_stream_buffer_is_empty(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); - return (xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE); -}; + return xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE; +} FuriStatus furi_stream_buffer_reset(FuriStreamBuffer* stream_buffer) { furi_check(stream_buffer); diff --git a/furi/core/thread.c b/furi/core/thread.c index 0a8c88667..c47df55e4 100644 --- a/furi/core/thread.c +++ b/furi/core/thread.c @@ -426,11 +426,11 @@ void furi_thread_yield(void) { } /* Limits */ -#define MAX_BITS_TASK_NOTIFY 31U +#define MAX_BITS_TASK_NOTIFY 31U #define MAX_BITS_EVENT_GROUPS 24U #define THREAD_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_TASK_NOTIFY) - 1U)) -#define EVENT_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_EVENT_GROUPS) - 1U)) +#define EVENT_FLAGS_INVALID_BITS (~((1UL << MAX_BITS_EVENT_GROUPS) - 1U)) uint32_t furi_thread_flags_set(FuriThreadId thread_id, uint32_t flags) { TaskHandle_t hTask = (TaskHandle_t)thread_id; diff --git a/furi/core/thread_list.c b/furi/core/thread_list.c index 86759b66b..5355a896c 100644 --- a/furi/core/thread_list.c +++ b/furi/core/thread_list.c @@ -121,4 +121,4 @@ float furi_thread_list_get_isr_time(FuriThreadList* instance) { const uint32_t isr_counter = instance->isr_current - instance->isr_previous; return (float)isr_counter / (float)runtime_counter; -} \ No newline at end of file +} diff --git a/lib/app-scened-template/record_controller.hpp b/lib/app-scened-template/record_controller.hpp index 171115e15..3453c12f3 100644 --- a/lib/app-scened-template/record_controller.hpp +++ b/lib/app-scened-template/record_controller.hpp @@ -17,7 +17,7 @@ public: RecordController(const char* record_name) { name = record_name; value = static_cast(furi_record_open(name)); - }; + } ~RecordController() { furi_record_close(name); diff --git a/lib/app-scened-template/typeindex_no_rtti.hpp b/lib/app-scened-template/typeindex_no_rtti.hpp index 0f399385a..579a0189d 100644 --- a/lib/app-scened-template/typeindex_no_rtti.hpp +++ b/lib/app-scened-template/typeindex_no_rtti.hpp @@ -50,7 +50,8 @@ struct type_index { * Creates a type_index object for the specified type. */ template - type_index(tag_type) noexcept : hash_code_{index} { + type_index(tag_type) noexcept + : hash_code_{index} { } /** diff --git a/lib/app-scened-template/view_controller.hpp b/lib/app-scened-template/view_controller.hpp index 8c48fcf74..ccd3c0fd3 100644 --- a/lib/app-scened-template/view_controller.hpp +++ b/lib/app-scened-template/view_controller.hpp @@ -27,7 +27,7 @@ public: 0)...); gui = static_cast(furi_record_open("gui")); - }; + } ~ViewController() { for(auto& it : holder) { diff --git a/lib/bit_lib/bit_lib.c b/lib/bit_lib/bit_lib.c index 8122b1cc4..c00cfaca3 100644 --- a/lib/bit_lib/bit_lib.c +++ b/lib/bit_lib/bit_lib.c @@ -482,4 +482,4 @@ uint64_t bit_lib_bytes_to_num_bcd(const uint8_t* src, uint8_t len, bool* is_bcd) } return res; -} \ No newline at end of file +} diff --git a/lib/datetime/datetime.c b/lib/datetime/datetime.c index 9c2194d96..442931262 100644 --- a/lib/datetime/datetime.c +++ b/lib/datetime/datetime.c @@ -4,10 +4,10 @@ #define TAG "DateTime" #define SECONDS_PER_MINUTE 60 -#define SECONDS_PER_HOUR (SECONDS_PER_MINUTE * 60) -#define SECONDS_PER_DAY (SECONDS_PER_HOUR * 24) -#define MONTHS_COUNT 12 -#define EPOCH_START_YEAR 1970 +#define SECONDS_PER_HOUR (SECONDS_PER_MINUTE * 60) +#define SECONDS_PER_DAY (SECONDS_PER_HOUR * 24) +#define MONTHS_COUNT 12 +#define EPOCH_START_YEAR 1970 static const uint8_t datetime_days_per_month[2][MONTHS_COUNT] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, diff --git a/lib/digital_signal/digital_sequence.c b/lib/digital_signal/digital_sequence.c index 3e1643abb..f93ce6d95 100644 --- a/lib/digital_signal/digital_sequence.c +++ b/lib/digital_signal/digital_sequence.c @@ -22,7 +22,7 @@ #define DIGITAL_SEQUENCE_TIMER_MAX 0xFFFFFFFFUL /* Time to wait in loops before returning */ -#define DIGITAL_SEQUENCE_LOCK_WAIT_MS 10UL +#define DIGITAL_SEQUENCE_LOCK_WAIT_MS 10UL #define DIGITAL_SEQUENCE_LOCK_WAIT_TICKS (DIGITAL_SEQUENCE_LOCK_WAIT_MS * 1000 * 64) #define DIGITAL_SEQUENCE_GPIO_BUFFER_SIZE 2 diff --git a/lib/digital_signal/digital_signal_i.h b/lib/digital_signal/digital_signal_i.h index cd2f7fa3b..71a28021c 100644 --- a/lib/digital_signal/digital_signal_i.h +++ b/lib/digital_signal/digital_signal_i.h @@ -8,7 +8,7 @@ #include #include -#define DIGITAL_SIGNAL_T_TIM 1562 /**< 15.625 ns *100 */ +#define DIGITAL_SIGNAL_T_TIM 1562 /**< 15.625 ns *100 */ #define DIGITAL_SIGNAL_T_TIM_DIV2 (DIGITAL_SIGNAL_T_TIM / 2) /**< 15.625 ns / 2 *100 */ /** diff --git a/lib/digital_signal/presets/nfc/iso14443_3a_signal.c b/lib/digital_signal/presets/nfc/iso14443_3a_signal.c index 1f3824e2d..740d6ae98 100644 --- a/lib/digital_signal/presets/nfc/iso14443_3a_signal.c +++ b/lib/digital_signal/presets/nfc/iso14443_3a_signal.c @@ -5,14 +5,14 @@ #define BITS_IN_BYTE (8) #define ISO14443_3A_SIGNAL_BIT_MAX_EDGES (10) -#define ISO14443_3A_SIGNAL_MAX_EDGES (1350) +#define ISO14443_3A_SIGNAL_MAX_EDGES (1350) #define ISO14443_3A_SIGNAL_SEQUENCE_SIZE \ (ISO14443_3A_SIGNAL_MAX_EDGES / (ISO14443_3A_SIGNAL_BIT_MAX_EDGES - 2)) -#define ISO14443_3A_SIGNAL_F_SIG (13560000.0) -#define ISO14443_3A_SIGNAL_T_SIG 7374 //73.746ns*100 -#define ISO14443_3A_SIGNAL_T_SIG_X8 58992 //T_SIG*8 +#define ISO14443_3A_SIGNAL_F_SIG (13560000.0) +#define ISO14443_3A_SIGNAL_T_SIG 7374 //73.746ns*100 +#define ISO14443_3A_SIGNAL_T_SIG_X8 58992 //T_SIG*8 #define ISO14443_3A_SIGNAL_T_SIG_X8_X8 471936 //T_SIG*8*8 #define ISO14443_3A_SIGNAL_T_SIG_X8_X9 530928 //T_SIG*8*9 diff --git a/lib/digital_signal/presets/nfc/iso15693_signal.c b/lib/digital_signal/presets/nfc/iso15693_signal.c index 735a88f57..43066b5bf 100644 --- a/lib/digital_signal/presets/nfc/iso15693_signal.c +++ b/lib/digital_signal/presets/nfc/iso15693_signal.c @@ -8,13 +8,13 @@ #define ISO15693_SIGNAL_COEFF_LO (4U) #define ISO15693_SIGNAL_ZERO_EDGES (16U) -#define ISO15693_SIGNAL_ONE_EDGES (ISO15693_SIGNAL_ZERO_EDGES + 1U) -#define ISO15693_SIGNAL_EOF_EDGES (64U) -#define ISO15693_SIGNAL_SOF_EDGES (ISO15693_SIGNAL_EOF_EDGES + 1U) -#define ISO15693_SIGNAL_EDGES (1350U) +#define ISO15693_SIGNAL_ONE_EDGES (ISO15693_SIGNAL_ZERO_EDGES + 1U) +#define ISO15693_SIGNAL_EOF_EDGES (64U) +#define ISO15693_SIGNAL_SOF_EDGES (ISO15693_SIGNAL_EOF_EDGES + 1U) +#define ISO15693_SIGNAL_EDGES (1350U) -#define ISO15693_SIGNAL_FC (13.56e6) -#define ISO15693_SIGNAL_FC_16 (16.0e11 / ISO15693_SIGNAL_FC) +#define ISO15693_SIGNAL_FC (13.56e6) +#define ISO15693_SIGNAL_FC_16 (16.0e11 / ISO15693_SIGNAL_FC) #define ISO15693_SIGNAL_FC_256 (256.0e11 / ISO15693_SIGNAL_FC) #define ISO15693_SIGNAL_FC_768 (768.0e11 / ISO15693_SIGNAL_FC) diff --git a/lib/drivers/bq25896_reg.h b/lib/drivers/bq25896_reg.h index a6ca3e1c7..23d094003 100644 --- a/lib/drivers/bq25896_reg.h +++ b/lib/drivers/bq25896_reg.h @@ -7,27 +7,27 @@ #error Bit structures defined in this file is not portable to BE #endif -#define BQ25896_ADDRESS 0xD6 +#define BQ25896_ADDRESS 0xD6 #define BQ25896_I2C_TIMEOUT 50 #define IILIM_1600 (1 << 5) -#define IILIM_800 (1 << 4) -#define IILIM_400 (1 << 3) -#define IILIM_200 (1 << 2) -#define IILIM_100 (1 << 1) -#define IILIM_50 (1 << 0) +#define IILIM_800 (1 << 4) +#define IILIM_400 (1 << 3) +#define IILIM_200 (1 << 2) +#define IILIM_100 (1 << 1) +#define IILIM_50 (1 << 0) typedef struct { uint8_t IINLIM : 6; // Input Current Limit, mA, offset: +100mA - bool EN_ILIM : 1; // Enable ILIM Pin - bool EN_HIZ : 1; // Enable HIZ Mode + bool EN_ILIM : 1; // Enable ILIM Pin + bool EN_HIZ : 1; // Enable HIZ Mode } REG00; #define VINDPM_OS_1600 (1 << 4) -#define VINDPM_OS_800 (1 << 3) -#define VINDPM_OS_400 (1 << 2) -#define VINDPM_OS_200 (1 << 1) -#define VINDPM_OS_100 (1 << 0) +#define VINDPM_OS_800 (1 << 3) +#define VINDPM_OS_400 (1 << 2) +#define VINDPM_OS_200 (1 << 1) +#define VINDPM_OS_100 (1 << 0) typedef enum { Bhot34 = 0b00, // – VBHOT1 Threshold (34.75%) (default) @@ -38,18 +38,18 @@ typedef enum { typedef struct { uint8_t VINDPM_OS : 5; // Input Voltage Limit Offset, mV - bool BCOLD : 1; // Boost Mode Cold Temperature Monitor Threshold - Bhot BHOT : 2; // Boost Mode Hot Temperature Monitor Threshold + bool BCOLD : 1; // Boost Mode Cold Temperature Monitor Threshold + Bhot BHOT : 2; // Boost Mode Hot Temperature Monitor Threshold } REG01; typedef struct { bool AUTO_DPDM_EN : 1; // Automatic Input Detection Enable - bool FORCE_DPDM : 1; // Force Input Detection - uint8_t RES : 2; // Reserved - bool ICO_EN : 1; // Input Current Optimizer (ICO) Enable - bool BOOST_FREQ : 1; // Boost Mode Frequency Selection - bool CONV_RATE : 1; // ADC Conversion Rate Selection - bool CONV_START : 1; // ADC Conversion Start Control + bool FORCE_DPDM : 1; // Force Input Detection + uint8_t RES : 2; // Reserved + bool ICO_EN : 1; // Input Current Optimizer (ICO) Enable + bool BOOST_FREQ : 1; // Boost Mode Frequency Selection + bool CONV_RATE : 1; // ADC Conversion Rate Selection + bool CONV_START : 1; // ADC Conversion Start Control } REG02; #define SYS_MIN_400 (1 << 2) @@ -58,45 +58,45 @@ typedef struct { typedef struct { bool MIN_VBAT_SEL : 1; // Minimum Battery Voltage (falling) to exit boost mode - uint8_t SYS_MIN : 3; // Minimum System Voltage Limit, mV, offset: +3000mV - bool CHG_CONFIG : 1; // Charge Enable Configuration - bool OTG_CONFIG : 1; // Boost (OTG) Mode Configuration - bool WD_RST : 1; // I2C Watchdog Timer Reset - bool BAT_LOADEN : 1; // Battery Load (IBATLOAD) Enable + uint8_t SYS_MIN : 3; // Minimum System Voltage Limit, mV, offset: +3000mV + bool CHG_CONFIG : 1; // Charge Enable Configuration + bool OTG_CONFIG : 1; // Boost (OTG) Mode Configuration + bool WD_RST : 1; // I2C Watchdog Timer Reset + bool BAT_LOADEN : 1; // Battery Load (IBATLOAD) Enable } REG03; #define ICHG_4096 (1 << 6) #define ICHG_2048 (1 << 5) #define ICHG_1024 (1 << 4) -#define ICHG_512 (1 << 3) -#define ICHG_256 (1 << 2) -#define ICHG_128 (1 << 1) -#define ICHG_64 (1 << 0) +#define ICHG_512 (1 << 3) +#define ICHG_256 (1 << 2) +#define ICHG_128 (1 << 1) +#define ICHG_64 (1 << 0) typedef struct { - uint8_t ICHG : 7; // Fast Charge Current Limit, mA + uint8_t ICHG : 7; // Fast Charge Current Limit, mA bool EN_PUMPX : 1; // Current pulse control Enable } REG04; #define IPRETERM_512 (1 << 3) #define IPRETERM_256 (1 << 2) #define IPRETERM_128 (1 << 1) -#define IPRETERM_64 (1 << 0) +#define IPRETERM_64 (1 << 0) typedef struct { - uint8_t ITERM : 4; // Termination Current Limit, offset: +64mA + uint8_t ITERM : 4; // Termination Current Limit, offset: +64mA uint8_t IPRECHG : 4; // Precharge Current Limit, offset: +64mA } REG05; #define VREG_512 (1 << 5) #define VREG_256 (1 << 4) #define VREG_128 (1 << 3) -#define VREG_64 (1 << 2) -#define VREG_32 (1 << 1) -#define VREG_16 (1 << 0) +#define VREG_64 (1 << 2) +#define VREG_32 (1 << 1) +#define VREG_16 (1 << 0) typedef struct { - bool VRECHG : 1; // Battery Recharge Threshold Offset + bool VRECHG : 1; // Battery Recharge Threshold Offset bool BATLOWV : 1; // Battery Precharge to Fast Charge Threshold uint8_t VREG : 6; // Charge Voltage Limit, offset: +3840mV } REG06; @@ -116,12 +116,12 @@ typedef enum { } ChgTimer; typedef struct { - bool JEITA_ISET : 1; // JEITA Low Temperature Current Setting + bool JEITA_ISET : 1; // JEITA Low Temperature Current Setting ChgTimer CHG_TIMER : 2; // Fast Charge Timer Setting - bool EN_TIMER : 1; // Charging Safety Timer Enable - Watchdog WATCHDOG : 2; // I2C Watchdog Timer Setting - bool STAT_DIS : 1; // STAT Pin Disable - bool EN_TERM : 1; // Charging Termination Enable + bool EN_TIMER : 1; // Charging Safety Timer Enable + Watchdog WATCHDOG : 2; // I2C Watchdog Timer Setting + bool STAT_DIS : 1; // STAT Pin Disable + bool EN_TERM : 1; // Charging Termination Enable } REG07; #define BAT_COMP_80 (1 << 2) @@ -129,35 +129,35 @@ typedef struct { #define BAT_COMP_20 (1 << 0) #define VCLAMP_128 (1 << 2) -#define VCLAMP_64 (1 << 1) -#define VCLAMP_32 (1 << 0) +#define VCLAMP_64 (1 << 1) +#define VCLAMP_32 (1 << 0) -#define TREG_60 (0b00) -#define TREG_80 (0b01) +#define TREG_60 (0b00) +#define TREG_80 (0b01) #define TREG_100 (0b10) #define TREG_120 (0b11) typedef struct { - uint8_t TREG : 2; // Thermal Regulation Threshold - uint8_t VCLAMP : 3; // IR Compensation Voltage Clamp + uint8_t TREG : 2; // Thermal Regulation Threshold + uint8_t VCLAMP : 3; // IR Compensation Voltage Clamp uint8_t BAT_COMP : 3; // IR Compensation Resistor Setting } REG08; typedef struct { - bool PUMPX_DN : 1; // Current pulse control voltage down enable - bool PUMPX_UP : 1; // Current pulse control voltage up enable + bool PUMPX_DN : 1; // Current pulse control voltage down enable + bool PUMPX_UP : 1; // Current pulse control voltage up enable bool BATFET_RST_EN : 1; // BATFET full system reset enable - bool BATFET_DLY : 1; // BATFET turn off delay control - bool JEITA_VSET : 1; // JEITA High Temperature Voltage Setting - bool BATFET_DIS : 1; // Force BATFET off to enable ship mode - bool TMR2X_EN : 1; // Safety Timer Setting during DPM or Thermal Regulation - bool FORCE_ICO : 1; // Force Start Input Current Optimizer + bool BATFET_DLY : 1; // BATFET turn off delay control + bool JEITA_VSET : 1; // JEITA High Temperature Voltage Setting + bool BATFET_DIS : 1; // Force BATFET off to enable ship mode + bool TMR2X_EN : 1; // Safety Timer Setting during DPM or Thermal Regulation + bool FORCE_ICO : 1; // Force Start Input Current Optimizer } REG09; #define BOOSTV_512 (1 << 3) #define BOOSTV_256 (1 << 2) #define BOOSTV_128 (1 << 1) -#define BOOSTV_64 (1 << 0) +#define BOOSTV_64 (1 << 0) typedef enum { BoostLim_500 = 0b000, @@ -172,8 +172,8 @@ typedef enum { typedef struct { uint8_t BOOST_LIM : 3; // Boost Mode Current Limit - bool PFM_OTG_DIS : 1; // PFM mode allowed in boost mode - uint8_t BOOSTV : 4; // Boost Mode Voltage Regulation, offset: +4550mV + bool PFM_OTG_DIS : 1; // PFM mode allowed in boost mode + uint8_t BOOSTV : 4; // Boost Mode Voltage Regulation, offset: +4550mV } REG0A; typedef enum { @@ -191,9 +191,9 @@ typedef enum { } ChrgStat; typedef struct { - bool VSYS_STAT : 1; // VSYS Regulation Status - bool RES : 1; // Reserved: Always reads 1 - bool PG_STAT : 1; // Power Good Status + bool VSYS_STAT : 1; // VSYS Regulation Status + bool RES : 1; // Reserved: Always reads 1 + bool PG_STAT : 1; // Power Good Status ChrgStat CHRG_STAT : 2; // Charging Status VBusStat VBUS_STAT : 3; // VBUS Status register } REG0B; @@ -214,49 +214,49 @@ typedef enum { } NtcFault; typedef struct { - NtcFault NTC_FAULT : 3; // NTC Fault Status - bool BAT_FAULT : 1; // Battery Fault Status + NtcFault NTC_FAULT : 3; // NTC Fault Status + bool BAT_FAULT : 1; // Battery Fault Status ChrgFault CHRG_FAULT : 2; // Charge Fault Status - bool BOOST_FAULT : 1; // Boost Mode Fault Status - bool WATCHDOG_FAULT : 1; // Watchdog Fault Status + bool BOOST_FAULT : 1; // Boost Mode Fault Status + bool WATCHDOG_FAULT : 1; // Watchdog Fault Status } REG0C; #define VINDPM_6400 (1 << 6) #define VINDPM_3200 (1 << 5) #define VINDPM_1600 (1 << 4) -#define VINDPM_800 (1 << 3) -#define VINDPM_400 (1 << 2) -#define VINDPM_200 (1 << 1) -#define VINDPM_100 (1 << 0) +#define VINDPM_800 (1 << 3) +#define VINDPM_400 (1 << 2) +#define VINDPM_200 (1 << 1) +#define VINDPM_100 (1 << 0) typedef struct { - uint8_t VINDPM : 7; // Absolute VINDPM Threshold, offset: +2600mV + uint8_t VINDPM : 7; // Absolute VINDPM Threshold, offset: +2600mV bool FORCE_VINDPM : 1; // VINDPM Threshold Setting Method } REG0D; typedef struct { - uint8_t BATV : 7; // ADC conversion of Battery Voltage (VBAT), offset: +2304mV + uint8_t BATV : 7; // ADC conversion of Battery Voltage (VBAT), offset: +2304mV bool THERM_STAT : 1; // Thermal Regulation Status } REG0E; typedef struct { uint8_t SYSV : 7; // ADDC conversion of System Voltage (VSYS), offset: +2304mV - uint8_t RES : 1; // Reserved: Always reads 0 + uint8_t RES : 1; // Reserved: Always reads 0 } REG0F; typedef struct { uint8_t TSPCT : 7; // ADC conversion of TS Voltage (TS) as percentage of REGN, offset: +21% - uint8_t RES : 1; // Reserved: Always reads 0 + uint8_t RES : 1; // Reserved: Always reads 0 } REG10; typedef struct { uint8_t VBUSV : 7; // ADC conversion of VBUS voltage (VBUS), offset: +2600mV - bool VBUS_GD : 1; // VBUS Good Status + bool VBUS_GD : 1; // VBUS Good Status } REG11; typedef struct { uint8_t ICHGR : 7; // ADC conversion of Charge Current (IBAT) when VBAT > VBATSHORT - uint8_t RES : 1; // Reserved: Always reads 0 + uint8_t RES : 1; // Reserved: Always reads 0 } REG12; typedef struct { @@ -267,9 +267,9 @@ typedef struct { } REG13; typedef struct { - uint8_t DEV_REV : 2; // Device Revision - bool TS_PROFILE : 1; // Temperature Profile - uint8_t PN : 3; // Device Configuration + uint8_t DEV_REV : 2; // Device Revision + bool TS_PROFILE : 1; // Temperature Profile + uint8_t PN : 3; // Device Configuration bool ICO_OPTIMIZED : 1; // Input Current Optimizer (ICO) Status - bool REG_RST : 1; // Register Reset + bool REG_RST : 1; // Register Reset } REG14; diff --git a/lib/drivers/bq27220.h b/lib/drivers/bq27220.h index ca9e0312e..fc76e318f 100644 --- a/lib/drivers/bq27220.h +++ b/lib/drivers/bq27220.h @@ -4,45 +4,45 @@ #include #include -#define BQ27220_ERROR 0x0 +#define BQ27220_ERROR 0x0 #define BQ27220_SUCCESS 0x1 typedef struct { // Low byte, Low bit first - bool DSG : 1; // The device is in DISCHARGE - bool SYSDWN : 1; // System down bit indicating the system should shut down - bool TDA : 1; // Terminate Discharge Alarm + bool DSG : 1; // The device is in DISCHARGE + bool SYSDWN : 1; // System down bit indicating the system should shut down + bool TDA : 1; // Terminate Discharge Alarm bool BATTPRES : 1; // Battery Present detected - bool AUTH_GD : 1; // Detect inserted battery - bool OCVGD : 1; // Good OCV measurement taken - bool TCA : 1; // Terminate Charge Alarm - bool RSVD : 1; // Reserved + bool AUTH_GD : 1; // Detect inserted battery + bool OCVGD : 1; // Good OCV measurement taken + bool TCA : 1; // Terminate Charge Alarm + bool RSVD : 1; // Reserved // High byte, Low bit first - bool CHGINH : 1; // Charge inhibit - bool FC : 1; // Full-charged is detected - bool OTD : 1; // Overtemperature in discharge condition is detected - bool OTC : 1; // Overtemperature in charge condition is detected - bool SLEEP : 1; // Device is operating in SLEEP mode when set - bool OCVFAIL : 1; // Status bit indicating that the OCV reading failed due to current - bool OCVCOMP : 1; // An OCV measurement update is complete - bool FD : 1; // Full-discharge is detected + bool CHGINH : 1; // Charge inhibit + bool FC : 1; // Full-charged is detected + bool OTD : 1; // Overtemperature in discharge condition is detected + bool OTC : 1; // Overtemperature in charge condition is detected + bool SLEEP : 1; // Device is operating in SLEEP mode when set + bool OCVFAIL : 1; // Status bit indicating that the OCV reading failed due to current + bool OCVCOMP : 1; // An OCV measurement update is complete + bool FD : 1; // Full-discharge is detected } BatteryStatus; _Static_assert(sizeof(BatteryStatus) == 2, "Incorrect structure size"); typedef struct { // Low byte, Low bit first - bool CALMD : 1; /**< Calibration mode enabled */ + bool CALMD : 1; /**< Calibration mode enabled */ uint8_t SEC : 2; /**< Current security access */ - bool EDV2 : 1; /**< EDV2 threshold exceeded */ + bool EDV2 : 1; /**< EDV2 threshold exceeded */ bool VDQ : 1; /**< Indicates if Current discharge cycle is NOT qualified or qualified for an FCC updated */ - bool INITCOMP : 1; /**< gauge initialization is complete */ - bool SMTH : 1; /**< RemainingCapacity is scaled by smooth engine */ - bool BTPINT : 1; /**< BTP threshold has been crossed */ + bool INITCOMP : 1; /**< gauge initialization is complete */ + bool SMTH : 1; /**< RemainingCapacity is scaled by smooth engine */ + bool BTPINT : 1; /**< BTP threshold has been crossed */ // High byte, Low bit first - uint8_t RSVD1 : 2; + uint8_t RSVD1 : 2; bool CFGUPDATE : 1; /**< Gauge is in CONFIG UPDATE mode */ - uint8_t RSVD0 : 5; + uint8_t RSVD0 : 5; } OperationStatus; _Static_assert(sizeof(OperationStatus) == 2, "Incorrect structure size"); diff --git a/lib/drivers/bq27220_data_memory.h b/lib/drivers/bq27220_data_memory.h index ae00be883..30f2dae1e 100644 --- a/lib/drivers/bq27220_data_memory.h +++ b/lib/drivers/bq27220_data_memory.h @@ -67,18 +67,18 @@ struct BQ27220DMData { typedef struct { // Low byte, Low bit first - const bool CCT : 1; - const bool CSYNC : 1; - const bool RSVD0 : 1; - const bool EDV_CMP : 1; - const bool SC : 1; + const bool CCT : 1; + const bool CSYNC : 1; + const bool RSVD0 : 1; + const bool EDV_CMP : 1; + const bool SC : 1; const bool FIXED_EDV0 : 1; - const uint8_t RSVD1 : 2; + const uint8_t RSVD1 : 2; // High byte, Low bit first - const bool FCC_LIM : 1; - const bool RSVD2 : 1; + const bool FCC_LIM : 1; + const bool RSVD2 : 1; const bool FC_FOR_VDQ : 1; - const bool IGNORE_SD : 1; - const bool SME0 : 1; - const uint8_t RSVD3 : 3; + const bool IGNORE_SD : 1; + const bool SME0 : 1; + const uint8_t RSVD3 : 3; } BQ27220DMGaugingConfig; diff --git a/lib/drivers/bq27220_reg.h b/lib/drivers/bq27220_reg.h index 2e6e54aab..1c1ec9d8f 100644 --- a/lib/drivers/bq27220_reg.h +++ b/lib/drivers/bq27220_reg.h @@ -1,68 +1,68 @@ #pragma once -#define BQ27220_ADDRESS 0xAA +#define BQ27220_ADDRESS 0xAA #define BQ27220_I2C_TIMEOUT 50 -#define CommandControl 0x00 -#define CommandAtRate 0x02 -#define CommandAtRateTimeToEmpty 0x04 -#define CommandTemperature 0x06 -#define CommandVoltage 0x08 -#define CommandBatteryStatus 0x0A -#define CommandCurrent 0x0C -#define CommandRemainingCapacity 0x10 -#define CommandFullChargeCapacity 0x12 -#define CommandAverageCurrent 0x14 -#define CommandTimeToEmpty 0x16 -#define CommandTimeToFull 0x18 -#define CommandStandbyCurrent 0x1A -#define CommandStandbyTimeToEmpty 0x1C -#define CommandMaxLoadCurrent 0x1E -#define CommandMaxLoadTimeToEmpty 0x20 -#define CommandRawCoulombCount 0x22 -#define CommandAveragePower 0x24 +#define CommandControl 0x00 +#define CommandAtRate 0x02 +#define CommandAtRateTimeToEmpty 0x04 +#define CommandTemperature 0x06 +#define CommandVoltage 0x08 +#define CommandBatteryStatus 0x0A +#define CommandCurrent 0x0C +#define CommandRemainingCapacity 0x10 +#define CommandFullChargeCapacity 0x12 +#define CommandAverageCurrent 0x14 +#define CommandTimeToEmpty 0x16 +#define CommandTimeToFull 0x18 +#define CommandStandbyCurrent 0x1A +#define CommandStandbyTimeToEmpty 0x1C +#define CommandMaxLoadCurrent 0x1E +#define CommandMaxLoadTimeToEmpty 0x20 +#define CommandRawCoulombCount 0x22 +#define CommandAveragePower 0x24 #define CommandInternalTemperature 0x28 -#define CommandCycleCount 0x2A -#define CommandStateOfCharge 0x2C -#define CommandStateOfHealth 0x2E -#define CommandChargeVoltage 0x30 -#define CommandChargeCurrent 0x32 -#define CommandBTPDischargeSet 0x34 -#define CommandBTPChargeSet 0x36 -#define CommandOperationStatus 0x3A -#define CommandDesignCapacity 0x3C -#define CommandSelectSubclass 0x3E -#define CommandMACData 0x40 -#define CommandMACDataSum 0x60 -#define CommandMACDataLen 0x61 -#define CommandAnalogCount 0x79 -#define CommandRawCurrent 0x7A -#define CommandRawVoltage 0x7C -#define CommandRawIntTemp 0x7E +#define CommandCycleCount 0x2A +#define CommandStateOfCharge 0x2C +#define CommandStateOfHealth 0x2E +#define CommandChargeVoltage 0x30 +#define CommandChargeCurrent 0x32 +#define CommandBTPDischargeSet 0x34 +#define CommandBTPChargeSet 0x36 +#define CommandOperationStatus 0x3A +#define CommandDesignCapacity 0x3C +#define CommandSelectSubclass 0x3E +#define CommandMACData 0x40 +#define CommandMACDataSum 0x60 +#define CommandMACDataLen 0x61 +#define CommandAnalogCount 0x79 +#define CommandRawCurrent 0x7A +#define CommandRawVoltage 0x7C +#define CommandRawIntTemp 0x7E -#define Control_CONTROL_STATUS 0x0000 -#define Control_DEVICE_NUMBER 0x0001 -#define Control_FW_VERSION 0x0002 -#define Control_BOARD_OFFSET 0x0009 -#define Control_CC_OFFSET 0x000A -#define Control_CC_OFFSET_SAVE 0x000B -#define Control_OCV_CMD 0x000C -#define Control_BAT_INSERT 0x000D -#define Control_BAT_REMOVE 0x000E -#define Control_SET_SNOOZE 0x0013 -#define Control_CLEAR_SNOOZE 0x0014 -#define Control_SET_PROFILE_1 0x0015 -#define Control_SET_PROFILE_2 0x0016 -#define Control_SET_PROFILE_3 0x0017 -#define Control_SET_PROFILE_4 0x0018 -#define Control_SET_PROFILE_5 0x0019 -#define Control_SET_PROFILE_6 0x001A -#define Control_CAL_TOGGLE 0x002D -#define Control_SEALED 0x0030 -#define Control_RESET 0x0041 -#define Control_EXIT_CAL 0x0080 -#define Control_ENTER_CAL 0x0081 -#define Control_ENTER_CFG_UPDATE 0x0090 +#define Control_CONTROL_STATUS 0x0000 +#define Control_DEVICE_NUMBER 0x0001 +#define Control_FW_VERSION 0x0002 +#define Control_BOARD_OFFSET 0x0009 +#define Control_CC_OFFSET 0x000A +#define Control_CC_OFFSET_SAVE 0x000B +#define Control_OCV_CMD 0x000C +#define Control_BAT_INSERT 0x000D +#define Control_BAT_REMOVE 0x000E +#define Control_SET_SNOOZE 0x0013 +#define Control_CLEAR_SNOOZE 0x0014 +#define Control_SET_PROFILE_1 0x0015 +#define Control_SET_PROFILE_2 0x0016 +#define Control_SET_PROFILE_3 0x0017 +#define Control_SET_PROFILE_4 0x0018 +#define Control_SET_PROFILE_5 0x0019 +#define Control_SET_PROFILE_6 0x001A +#define Control_CAL_TOGGLE 0x002D +#define Control_SEALED 0x0030 +#define Control_RESET 0x0041 +#define Control_EXIT_CAL 0x0080 +#define Control_ENTER_CAL 0x0081 +#define Control_ENTER_CFG_UPDATE 0x0090 #define Control_EXIT_CFG_UPDATE_REINIT 0x0091 -#define Control_EXIT_CFG_UPDATE 0x0092 -#define Control_RETURN_TO_ROM 0x0F00 +#define Control_EXIT_CFG_UPDATE 0x0092 +#define Control_RETURN_TO_ROM 0x0F00 diff --git a/lib/drivers/cc1101.c b/lib/drivers/cc1101.c index b71d78ff0..40b286a9b 100644 --- a/lib/drivers/cc1101.c +++ b/lib/drivers/cc1101.c @@ -185,4 +185,4 @@ uint8_t cc1101_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* data, uint8_t* si furi_hal_spi_bus_trx(handle, NULL, data, *size, CC1101_TIMEOUT); return *size; -} \ No newline at end of file +} diff --git a/lib/drivers/cc1101_regs.h b/lib/drivers/cc1101_regs.h index e0aed6bd9..aaf9062a8 100644 --- a/lib/drivers/cc1101_regs.h +++ b/lib/drivers/cc1101_regs.h @@ -9,65 +9,65 @@ extern "C" { /* Frequency Synthesizer constants */ #define CC1101_QUARTZ 26000000 -#define CC1101_FMASK 0xFFFFFF -#define CC1101_FDIV 0x10000 -#define CC1101_IFDIV 0x400 +#define CC1101_FMASK 0xFFFFFF +#define CC1101_FDIV 0x10000 +#define CC1101_IFDIV 0x400 /* IO Bus constants */ #define CC1101_TIMEOUT 250 /* Bits and pieces */ -#define CC1101_READ (1 << 7) /** Read Bit */ +#define CC1101_READ (1 << 7) /** Read Bit */ #define CC1101_BURST (1 << 6) /** Burst Bit */ /* Common registers, CC1101_BURST and CC1101_WRITE behaves as expected */ -#define CC1101_IOCFG2 0x00 /** GDO2 output pin configuration */ -#define CC1101_IOCFG1 0x01 /** GDO1 output pin configuration */ -#define CC1101_IOCFG0 0x02 /** GDO0 output pin configuration */ -#define CC1101_FIFOTHR 0x03 /** RX FIFO and TX FIFO thresholds */ -#define CC1101_SYNC1 0x04 /** Sync word, high byte */ -#define CC1101_SYNC0 0x05 /** Sync word, low byte */ -#define CC1101_PKTLEN 0x06 /** Packet length */ +#define CC1101_IOCFG2 0x00 /** GDO2 output pin configuration */ +#define CC1101_IOCFG1 0x01 /** GDO1 output pin configuration */ +#define CC1101_IOCFG0 0x02 /** GDO0 output pin configuration */ +#define CC1101_FIFOTHR 0x03 /** RX FIFO and TX FIFO thresholds */ +#define CC1101_SYNC1 0x04 /** Sync word, high byte */ +#define CC1101_SYNC0 0x05 /** Sync word, low byte */ +#define CC1101_PKTLEN 0x06 /** Packet length */ #define CC1101_PKTCTRL1 0x07 /** Packet automation control */ #define CC1101_PKTCTRL0 0x08 /** Packet automation control */ -#define CC1101_ADDR 0x09 /** Device address */ -#define CC1101_CHANNR 0x0A /** Channel number */ -#define CC1101_FSCTRL1 0x0B /** Frequency synthesizer control */ -#define CC1101_FSCTRL0 0x0C /** Frequency synthesizer control */ -#define CC1101_FREQ2 0x0D /** Frequency control word, high byte */ -#define CC1101_FREQ1 0x0E /** Frequency control word, middle byte */ -#define CC1101_FREQ0 0x0F /** Frequency control word, low byte */ -#define CC1101_MDMCFG4 0x10 /** Modem configuration */ -#define CC1101_MDMCFG3 0x11 /** Modem configuration */ -#define CC1101_MDMCFG2 0x12 /** Modem configuration */ -#define CC1101_MDMCFG1 0x13 /** Modem configuration */ -#define CC1101_MDMCFG0 0x14 /** Modem configuration */ -#define CC1101_DEVIATN 0x15 /** Modem deviation setting */ -#define CC1101_MCSM2 0x16 /** Main Radio Control State Machine configuration */ -#define CC1101_MCSM1 0x17 /** Main Radio Control State Machine configuration */ -#define CC1101_MCSM0 0x18 /** Main Radio Control State Machine configuration */ -#define CC1101_FOCCFG 0x19 /** Frequency Offset Compensation configuration */ -#define CC1101_BSCFG 0x1A /** Bit Synchronization configuration */ +#define CC1101_ADDR 0x09 /** Device address */ +#define CC1101_CHANNR 0x0A /** Channel number */ +#define CC1101_FSCTRL1 0x0B /** Frequency synthesizer control */ +#define CC1101_FSCTRL0 0x0C /** Frequency synthesizer control */ +#define CC1101_FREQ2 0x0D /** Frequency control word, high byte */ +#define CC1101_FREQ1 0x0E /** Frequency control word, middle byte */ +#define CC1101_FREQ0 0x0F /** Frequency control word, low byte */ +#define CC1101_MDMCFG4 0x10 /** Modem configuration */ +#define CC1101_MDMCFG3 0x11 /** Modem configuration */ +#define CC1101_MDMCFG2 0x12 /** Modem configuration */ +#define CC1101_MDMCFG1 0x13 /** Modem configuration */ +#define CC1101_MDMCFG0 0x14 /** Modem configuration */ +#define CC1101_DEVIATN 0x15 /** Modem deviation setting */ +#define CC1101_MCSM2 0x16 /** Main Radio Control State Machine configuration */ +#define CC1101_MCSM1 0x17 /** Main Radio Control State Machine configuration */ +#define CC1101_MCSM0 0x18 /** Main Radio Control State Machine configuration */ +#define CC1101_FOCCFG 0x19 /** Frequency Offset Compensation configuration */ +#define CC1101_BSCFG 0x1A /** Bit Synchronization configuration */ #define CC1101_AGCCTRL2 0x1B /** AGC control */ #define CC1101_AGCCTRL1 0x1C /** AGC control */ #define CC1101_AGCCTRL0 0x1D /** AGC control */ -#define CC1101_WOREVT1 0x1E /** High byte Event 0 timeout */ -#define CC1101_WOREVT0 0x1F /** Low byte Event 0 timeout */ -#define CC1101_WORCTRL 0x20 /** Wake On Radio control */ -#define CC1101_FREND1 0x21 /** Front end RX configuration */ -#define CC1101_FREND0 0x22 /** Front end TX configuration */ -#define CC1101_FSCAL3 0x23 /** Frequency synthesizer calibration */ -#define CC1101_FSCAL2 0x24 /** Frequency synthesizer calibration */ -#define CC1101_FSCAL1 0x25 /** Frequency synthesizer calibration */ -#define CC1101_FSCAL0 0x26 /** Frequency synthesizer calibration */ -#define CC1101_RCCTRL1 0x27 /** RC oscillator configuration */ -#define CC1101_RCCTRL0 0x28 /** RC oscillator configuration */ -#define CC1101_FSTEST 0x29 /** Frequency synthesizer calibration control */ -#define CC1101_PTEST 0x2A /** Production test */ -#define CC1101_AGCTEST 0x2B /** AGC test */ -#define CC1101_TEST2 0x2C /** Various test settings */ -#define CC1101_TEST1 0x2D /** Various test settings */ -#define CC1101_TEST0 0x2E /** Various test settings */ +#define CC1101_WOREVT1 0x1E /** High byte Event 0 timeout */ +#define CC1101_WOREVT0 0x1F /** Low byte Event 0 timeout */ +#define CC1101_WORCTRL 0x20 /** Wake On Radio control */ +#define CC1101_FREND1 0x21 /** Front end RX configuration */ +#define CC1101_FREND0 0x22 /** Front end TX configuration */ +#define CC1101_FSCAL3 0x23 /** Frequency synthesizer calibration */ +#define CC1101_FSCAL2 0x24 /** Frequency synthesizer calibration */ +#define CC1101_FSCAL1 0x25 /** Frequency synthesizer calibration */ +#define CC1101_FSCAL0 0x26 /** Frequency synthesizer calibration */ +#define CC1101_RCCTRL1 0x27 /** RC oscillator configuration */ +#define CC1101_RCCTRL0 0x28 /** RC oscillator configuration */ +#define CC1101_FSTEST 0x29 /** Frequency synthesizer calibration control */ +#define CC1101_PTEST 0x2A /** Production test */ +#define CC1101_AGCTEST 0x2B /** AGC test */ +#define CC1101_TEST2 0x2C /** Various test settings */ +#define CC1101_TEST1 0x2D /** Various test settings */ +#define CC1101_TEST0 0x2E /** Various test settings */ /* Strobe registers, CC1101_BURST is not available, CC1101_WRITE ignored */ #define CC1101_STROBE_SRES 0x30 /** Reset chip. */ @@ -95,15 +95,15 @@ extern "C" { 0x3D /** No operation. May be used to get access to the chip status byte.*/ /* Status registers, must be accessed with CC1101_BURST, but one by one */ -#define CC1101_STATUS_PARTNUM 0x30 /** Chip ID Part Number */ -#define CC1101_STATUS_VERSION 0x31 /** Chip ID Version */ -#define CC1101_STATUS_FREQEST 0x32 /** Frequency Offset Estimate from Demodulator */ -#define CC1101_STATUS_LQI 0x33 /** Demodulator Estimate for Link Quality, 7bit-CRC, 6..0-LQI*/ -#define CC1101_STATUS_RSSI 0x34 /** Received Signal Strength Indication */ -#define CC1101_STATUS_MARCSTATE 0x35 /** Main Radio Control State Machine State */ -#define CC1101_STATUS_WORTIME1 0x36 /** High Byte of WOR Time */ -#define CC1101_STATUS_WORTIME0 0x37 /** Low Byte of WOR Time */ -#define CC1101_STATUS_PKTSTATUS 0x38 /** Current GDOx Status and Packet Status */ +#define CC1101_STATUS_PARTNUM 0x30 /** Chip ID Part Number */ +#define CC1101_STATUS_VERSION 0x31 /** Chip ID Version */ +#define CC1101_STATUS_FREQEST 0x32 /** Frequency Offset Estimate from Demodulator */ +#define CC1101_STATUS_LQI 0x33 /** Demodulator Estimate for Link Quality, 7bit-CRC, 6..0-LQI*/ +#define CC1101_STATUS_RSSI 0x34 /** Received Signal Strength Indication */ +#define CC1101_STATUS_MARCSTATE 0x35 /** Main Radio Control State Machine State */ +#define CC1101_STATUS_WORTIME1 0x36 /** High Byte of WOR Time */ +#define CC1101_STATUS_WORTIME0 0x37 /** Low Byte of WOR Time */ +#define CC1101_STATUS_PKTSTATUS 0x38 /** Current GDOx Status and Packet Status */ #define CC1101_STATUS_VCO_VC_DAC 0x39 /** Current Setting from PLL Calibration Module */ #define CC1101_STATUS_TXBYTES \ 0x3A /** Underflow and Number of Bytes, 7bit-Underflow, 6..0-Number of Bytes*/ @@ -188,8 +188,8 @@ typedef enum { typedef struct { uint8_t FIFO_BYTES_AVAILABLE : 4; - CC1101State STATE : 3; - bool CHIP_RDYn : 1; + CC1101State STATE : 3; + bool CHIP_RDYn : 1; } CC1101Status; typedef union { @@ -198,12 +198,12 @@ typedef union { } CC1101StatusRaw; typedef struct { - uint8_t NUM_TXBYTES : 7; + uint8_t NUM_TXBYTES : 7; bool TXFIFO_UNDERFLOW : 1; } CC1101TxBytes; typedef struct { - uint8_t NUM_RXBYTES : 7; + uint8_t NUM_RXBYTES : 7; bool RXFIFO_OVERFLOW : 1; } CC1101RxBytes; diff --git a/lib/drivers/lp5562_reg.h b/lib/drivers/lp5562_reg.h index e65cc2afe..9103e5395 100644 --- a/lib/drivers/lp5562_reg.h +++ b/lib/drivers/lp5562_reg.h @@ -4,17 +4,17 @@ #error Bit structures defined in this file is not portable to BE #endif -#define LP5562_ADDRESS 0x60 +#define LP5562_ADDRESS 0x60 #define LP5562_I2C_TIMEOUT 50 -#define LP5562_CHANNEL_RED_CURRENT_REGISTER 0x07 +#define LP5562_CHANNEL_RED_CURRENT_REGISTER 0x07 #define LP5562_CHANNEL_GREEN_CURRENT_REGISTER 0x06 -#define LP5562_CHANNEL_BLUE_CURRENT_REGISTER 0x05 +#define LP5562_CHANNEL_BLUE_CURRENT_REGISTER 0x05 #define LP5562_CHANNEL_WHITE_CURRENT_REGISTER 0x0F -#define LP5562_CHANNEL_RED_VALUE_REGISTER 0x04 +#define LP5562_CHANNEL_RED_VALUE_REGISTER 0x04 #define LP5562_CHANNEL_GREEN_VALUE_REGISTER 0x03 -#define LP5562_CHANNEL_BLUE_VALUE_REGISTER 0x02 +#define LP5562_CHANNEL_BLUE_VALUE_REGISTER 0x02 #define LP5562_CHANNEL_WHITE_VALUE_REGISTER 0x0E typedef enum { @@ -28,8 +28,8 @@ typedef struct { EngExec ENG3_EXEC : 2; EngExec ENG2_EXEC : 2; EngExec ENG1_EXEC : 2; - bool CHIP_EN : 1; - bool LOG_EN : 1; + bool CHIP_EN : 1; + bool LOG_EN : 1; } Reg00_Enable; typedef enum { @@ -43,39 +43,39 @@ typedef struct { EngMode ENG3_MODE : 2; EngMode ENG2_MODE : 2; EngMode ENG1_MODE : 2; - uint8_t reserved : 2; + uint8_t reserved : 2; } Reg01_OpMode; typedef struct { - bool INT_CLK_EN : 1; - bool CLK_DET_EN : 1; + bool INT_CLK_EN : 1; + bool CLK_DET_EN : 1; uint8_t reserved0 : 3; - bool PS_EN : 1; - bool PWM_HF : 1; + bool PS_EN : 1; + bool PWM_HF : 1; uint8_t reserved1 : 1; } Reg08_Config; typedef struct { - uint8_t pc : 3; + uint8_t pc : 3; uint8_t reserved : 5; } Reg09_Engine1PC; typedef struct { - uint8_t pc : 3; + uint8_t pc : 3; uint8_t reserved : 5; } Reg0A_Engine2PC; typedef struct { - uint8_t pc : 3; + uint8_t pc : 3; uint8_t reserved : 5; } Reg0B_Engine3PC; typedef struct { - bool ENG3_INT : 1; - bool ENG2_INT : 1; - bool ENG1_INT : 1; + bool ENG3_INT : 1; + bool ENG2_INT : 1; + bool ENG1_INT : 1; bool EXT_CLK_USED : 1; - uint8_t reserved : 5; + uint8_t reserved : 5; } Reg0C_Status; typedef struct { @@ -90,8 +90,8 @@ typedef enum { } EngSelect; typedef struct { - EngSelect blue : 2; + EngSelect blue : 2; EngSelect green : 2; - EngSelect red : 2; + EngSelect red : 2; EngSelect white : 2; } Reg70_LedMap; diff --git a/lib/drivers/st25r3916.h b/lib/drivers/st25r3916.h index 532239f47..0e77b6317 100644 --- a/lib/drivers/st25r3916.h +++ b/lib/drivers/st25r3916.h @@ -6,7 +6,7 @@ extern "C" { #endif -#define ST25R3916_IRQ_MASK_ALL (uint32_t)(0xFFFFFFFFUL) /** All ST25R3916 interrupt sources */ +#define ST25R3916_IRQ_MASK_ALL (uint32_t)(0xFFFFFFFFUL) /** All ST25R3916 interrupt sources */ #define ST25R3916_IRQ_MASK_NONE (uint32_t)(0x00000000UL) /**No ST25R3916 interrupt source */ /** Main interrupt register */ diff --git a/lib/drivers/st25r3916_reg.c b/lib/drivers/st25r3916_reg.c index 76a882755..f7a47d463 100644 --- a/lib/drivers/st25r3916_reg.c +++ b/lib/drivers/st25r3916_reg.c @@ -253,5 +253,5 @@ bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t reg_val = 0; st25r3916_read_reg(handle, reg, ®_val); - return ((reg_val & mask) == val); + return (reg_val & mask) == val; } diff --git a/lib/drivers/st25r3916_reg.h b/lib/drivers/st25r3916_reg.h index 8a924fc39..5163c4423 100644 --- a/lib/drivers/st25r3916_reg.h +++ b/lib/drivers/st25r3916_reg.h @@ -9,49 +9,49 @@ extern "C" { /** ST25R3916 direct commands */ #define ST25R3916_CMD_SET_DEFAULT \ 0xC1U /** Puts the chip in default state (same as after power-up */ -#define ST25R3916_CMD_STOP 0xC2U /*!< Stops all activities and clears FIFO */ -#define ST25R3916_CMD_TRANSMIT_WITH_CRC 0xC4U /** Transmit with CRC */ +#define ST25R3916_CMD_STOP 0xC2U /*!< Stops all activities and clears FIFO */ +#define ST25R3916_CMD_TRANSMIT_WITH_CRC 0xC4U /** Transmit with CRC */ #define ST25R3916_CMD_TRANSMIT_WITHOUT_CRC 0xC5U /** Transmit without CRC */ -#define ST25R3916_CMD_TRANSMIT_REQA 0xC6U /** Transmit REQA */ -#define ST25R3916_CMD_TRANSMIT_WUPA 0xC7U /** Transmit WUPA */ +#define ST25R3916_CMD_TRANSMIT_REQA 0xC6U /** Transmit REQA */ +#define ST25R3916_CMD_TRANSMIT_WUPA 0xC7U /** Transmit WUPA */ #define ST25R3916_CMD_INITIAL_RF_COLLISION \ 0xC8U /** NFC transmit with Initial RF Collision Avoidance */ #define ST25R3916_CMD_RESPONSE_RF_COLLISION_N \ 0xC9U /** NFC transmit with Response RF Collision Avoidance */ -#define ST25R3916_CMD_GOTO_SENSE 0xCDU /** Passive target logic to Sense/Idle state */ -#define ST25R3916_CMD_GOTO_SLEEP 0xCEU /** Passive target logic to Sleep/Halt state */ -#define ST25R3916_CMD_MASK_RECEIVE_DATA 0xD0U /** Mask receive data */ +#define ST25R3916_CMD_GOTO_SENSE 0xCDU /** Passive target logic to Sense/Idle state */ +#define ST25R3916_CMD_GOTO_SLEEP 0xCEU /** Passive target logic to Sleep/Halt state */ +#define ST25R3916_CMD_MASK_RECEIVE_DATA 0xD0U /** Mask receive data */ #define ST25R3916_CMD_UNMASK_RECEIVE_DATA 0xD1U /** Unmask receive data */ #define ST25R3916_CMD_AM_MOD_STATE_CHANGE 0xD2U /** AM Modulation state change */ -#define ST25R3916_CMD_MEASURE_AMPLITUDE 0xD3U /** Measure singal amplitude on RFI inputs */ -#define ST25R3916_CMD_RESET_RXGAIN 0xD5U /** Reset RX Gain */ -#define ST25R3916_CMD_ADJUST_REGULATORS 0xD6U /** Adjust regulators */ +#define ST25R3916_CMD_MEASURE_AMPLITUDE 0xD3U /** Measure singal amplitude on RFI inputs */ +#define ST25R3916_CMD_RESET_RXGAIN 0xD5U /** Reset RX Gain */ +#define ST25R3916_CMD_ADJUST_REGULATORS 0xD6U /** Adjust regulators */ #define ST25R3916_CMD_CALIBRATE_DRIVER_TIMING \ 0xD8U /** Starts the sequence to adjust the driver timing */ -#define ST25R3916_CMD_MEASURE_PHASE 0xD9U /** Measure phase between RFO and RFI signal */ -#define ST25R3916_CMD_CLEAR_RSSI 0xDAU /** Clear RSSI bits and restart the measurement */ -#define ST25R3916_CMD_CLEAR_FIFO 0xDBU /** Clears FIFO, Collision and IRQ status */ -#define ST25R3916_CMD_TRANSPARENT_MODE 0xDCU /** Transparent mode */ -#define ST25R3916_CMD_CALIBRATE_C_SENSOR 0xDDU /** Calibrate the capacitive sensor */ -#define ST25R3916_CMD_MEASURE_CAPACITANCE 0xDEU /** Measure capacitance */ -#define ST25R3916_CMD_MEASURE_VDD 0xDFU /** Measure power supply voltage */ -#define ST25R3916_CMD_START_GP_TIMER 0xE0U /** Start the general purpose timer */ -#define ST25R3916_CMD_START_WUP_TIMER 0xE1U /** Start the wake-up timer */ +#define ST25R3916_CMD_MEASURE_PHASE 0xD9U /** Measure phase between RFO and RFI signal */ +#define ST25R3916_CMD_CLEAR_RSSI 0xDAU /** Clear RSSI bits and restart the measurement */ +#define ST25R3916_CMD_CLEAR_FIFO 0xDBU /** Clears FIFO, Collision and IRQ status */ +#define ST25R3916_CMD_TRANSPARENT_MODE 0xDCU /** Transparent mode */ +#define ST25R3916_CMD_CALIBRATE_C_SENSOR 0xDDU /** Calibrate the capacitive sensor */ +#define ST25R3916_CMD_MEASURE_CAPACITANCE 0xDEU /** Measure capacitance */ +#define ST25R3916_CMD_MEASURE_VDD 0xDFU /** Measure power supply voltage */ +#define ST25R3916_CMD_START_GP_TIMER 0xE0U /** Start the general purpose timer */ +#define ST25R3916_CMD_START_WUP_TIMER 0xE1U /** Start the wake-up timer */ #define ST25R3916_CMD_START_MASK_RECEIVE_TIMER 0xE2U /** Start the mask-receive timer */ -#define ST25R3916_CMD_START_NO_RESPONSE_TIMER 0xE3U /** Start the no-response timer */ -#define ST25R3916_CMD_START_PPON2_TIMER 0xE4U /** Start PPon2 timer */ -#define ST25R3916_CMD_STOP_NRT 0xE8U /** Stop No Response Timer */ -#define ST25R3916_CMD_SPACE_B_ACCESS 0xFBU /** Enable R/W access to the test registers */ -#define ST25R3916_CMD_TEST_ACCESS 0xFCU /** Enable R/W access to the test registers */ +#define ST25R3916_CMD_START_NO_RESPONSE_TIMER 0xE3U /** Start the no-response timer */ +#define ST25R3916_CMD_START_PPON2_TIMER 0xE4U /** Start PPon2 timer */ +#define ST25R3916_CMD_STOP_NRT 0xE8U /** Stop No Response Timer */ +#define ST25R3916_CMD_SPACE_B_ACCESS 0xFBU /** Enable R/W access to the test registers */ +#define ST25R3916_CMD_TEST_ACCESS 0xFCU /** Enable R/W access to the test registers */ -#define ST25R3916_SPACE_B 0x40U /** ST25R3916 Space-B indicator */ +#define ST25R3916_SPACE_B 0x40U /** ST25R3916 Space-B indicator */ #define ST25R3916_SPACE_B_REG_LEN 16U /** Number of register in the space B */ #define ST25R3916_FIFO_STATUS_LEN 2 /** Number of FIFO Status Register */ -#define ST25R3916_PTM_A_LEN 15U /** Passive target memory A config length */ -#define ST25R3916_PTM_B_LEN 0U /** Passive target memory B config length */ -#define ST25R3916_PTM_F_LEN 21U /** Passive target memory F config length */ +#define ST25R3916_PTM_A_LEN 15U /** Passive target memory A config length */ +#define ST25R3916_PTM_B_LEN 0U /** Passive target memory B config length */ +#define ST25R3916_PTM_F_LEN 21U /** Passive target memory F config length */ #define ST25R3916_PTM_TSN_LEN 12U /** Passive target memory TSN data length */ /** Full Passive target memory length */ @@ -64,8 +64,8 @@ extern "C" { /** Operation control and mode definition */ #define ST25R3916_REG_OP_CONTROL 0x02U /** RW Operation Control Register */ -#define ST25R3916_REG_MODE 0x03U /** RW Mode Definition Register */ -#define ST25R3916_REG_BIT_RATE 0x04U /** RW Bit Rate Definition Register */ +#define ST25R3916_REG_MODE 0x03U /** RW Mode Definition Register */ +#define ST25R3916_REG_BIT_RATE 0x04U /** RW Bit Rate Definition Register */ /** Protocol Configuration registers */ #define ST25R3916_REG_ISO14443A_NFC 0x05U /** RW ISO14443A and NFC 106 kBit/s Settings Register */ @@ -74,10 +74,10 @@ extern "C" { #define ST25R3916_REG_ISO14443B_1 0x06U /** RW ISO14443B Settings Register 1 */ #define ST25R3916_REG_SUBC_START_TIME \ (ST25R3916_SPACE_B | 0x06U) /*!< RW Subcarrier Start Time Register */ -#define ST25R3916_REG_ISO14443B_2 0x07U /** RW ISO14443B Settings Register 2 */ +#define ST25R3916_REG_ISO14443B_2 0x07U /** RW ISO14443B Settings Register 2 */ #define ST25R3916_REG_PASSIVE_TARGET 0x08U /** RW Passive Target Definition Register */ -#define ST25R3916_REG_STREAM_MODE 0x09U /** RW Stream Mode Definition Register */ -#define ST25R3916_REG_AUX 0x0AU /** RW Auxiliary Definition Register */ +#define ST25R3916_REG_STREAM_MODE 0x09U /** RW Stream Mode Definition Register */ +#define ST25R3916_REG_AUX 0x0AU /** RW Auxiliary Definition Register */ /** Receiver Configuration registers */ #define ST25R3916_REG_RX_CONF1 0x0BU /** RW Receiver Configuration Register 1 */ @@ -92,28 +92,28 @@ extern "C" { (ST25R3916_SPACE_B | 0x0DU) /** RW Correlator configuration register 2 */ /** Timer definition registers */ -#define ST25R3916_REG_MASK_RX_TIMER 0x0FU /** RW Mask Receive Timer Register */ +#define ST25R3916_REG_MASK_RX_TIMER 0x0FU /** RW Mask Receive Timer Register */ #define ST25R3916_REG_NO_RESPONSE_TIMER1 0x10U /** RW No-response Timer Register 1 */ #define ST25R3916_REG_NO_RESPONSE_TIMER2 0x11U /** RW No-response Timer Register 2 */ -#define ST25R3916_REG_TIMER_EMV_CONTROL 0x12U /** RW Timer and EMV Control */ -#define ST25R3916_REG_GPT1 0x13U /** RW General Purpose Timer Register 1 */ -#define ST25R3916_REG_GPT2 0x14U /** RW General Purpose Timer Register 2 */ -#define ST25R3916_REG_PPON2 0x15U /** RW PPON2 Field waiting Timer Register */ -#define ST25R3916_REG_SQUELCH_TIMER (ST25R3916_SPACE_B | 0x0FU) /** RW Squelch timeout Register */ -#define ST25R3916_REG_FIELD_ON_GT (ST25R3916_SPACE_B | 0x15U) /** RW NFC Field on guard time */ +#define ST25R3916_REG_TIMER_EMV_CONTROL 0x12U /** RW Timer and EMV Control */ +#define ST25R3916_REG_GPT1 0x13U /** RW General Purpose Timer Register 1 */ +#define ST25R3916_REG_GPT2 0x14U /** RW General Purpose Timer Register 2 */ +#define ST25R3916_REG_PPON2 0x15U /** RW PPON2 Field waiting Timer Register */ +#define ST25R3916_REG_SQUELCH_TIMER (ST25R3916_SPACE_B | 0x0FU) /** RW Squelch timeout Register */ +#define ST25R3916_REG_FIELD_ON_GT (ST25R3916_SPACE_B | 0x15U) /** RW NFC Field on guard time */ /** Interrupt and associated reporting registers */ -#define ST25R3916_REG_IRQ_MASK_MAIN 0x16U /** RW Mask Main Interrupt Register */ -#define ST25R3916_REG_IRQ_MASK_TIMER_NFC 0x17U /** RW Mask Timer and NFC Interrupt Register */ -#define ST25R3916_REG_IRQ_MASK_ERROR_WUP 0x18U /** RW Mask Error and Wake-up Interrupt Register */ -#define ST25R3916_REG_IRQ_MASK_TARGET 0x19U /** RW Mask 3916 Target Interrupt Register */ -#define ST25R3916_REG_IRQ_MAIN 0x1AU /** R Main Interrupt Register */ -#define ST25R3916_REG_IRQ_TIMER_NFC 0x1BU /** R Timer and NFC Interrupt Register */ -#define ST25R3916_REG_IRQ_ERROR_WUP 0x1CU /** R Error and Wake-up Interrupt Register */ -#define ST25R3916_REG_IRQ_TARGET 0x1DU /*!< R ST25R3916 Target Interrupt Register */ -#define ST25R3916_REG_FIFO_STATUS1 0x1EU /** R FIFO Status Register 1 */ -#define ST25R3916_REG_FIFO_STATUS2 0x1FU /** R FIFO Status Register 2 */ -#define ST25R3916_REG_COLLISION_STATUS 0x20U /** R Collision Display Register */ +#define ST25R3916_REG_IRQ_MASK_MAIN 0x16U /** RW Mask Main Interrupt Register */ +#define ST25R3916_REG_IRQ_MASK_TIMER_NFC 0x17U /** RW Mask Timer and NFC Interrupt Register */ +#define ST25R3916_REG_IRQ_MASK_ERROR_WUP 0x18U /** RW Mask Error and Wake-up Interrupt Register */ +#define ST25R3916_REG_IRQ_MASK_TARGET 0x19U /** RW Mask 3916 Target Interrupt Register */ +#define ST25R3916_REG_IRQ_MAIN 0x1AU /** R Main Interrupt Register */ +#define ST25R3916_REG_IRQ_TIMER_NFC 0x1BU /** R Timer and NFC Interrupt Register */ +#define ST25R3916_REG_IRQ_ERROR_WUP 0x1CU /** R Error and Wake-up Interrupt Register */ +#define ST25R3916_REG_IRQ_TARGET 0x1DU /*!< R ST25R3916 Target Interrupt Register */ +#define ST25R3916_REG_FIFO_STATUS1 0x1EU /** R FIFO Status Register 1 */ +#define ST25R3916_REG_FIFO_STATUS2 0x1FU /** R FIFO Status Register 2 */ +#define ST25R3916_REG_COLLISION_STATUS 0x20U /** R Collision Display Register */ #define ST25R3916_REG_PASSIVE_TARGET_STATUS 0x21U /** R Passive target state status */ /** Definition of number of transmitted bytes */ @@ -132,8 +132,8 @@ extern "C" { /** Antenna Driver and Modulation registers */ #define ST25R3916_REG_TX_DRIVER 0x28U /** RW TX driver register */ -#define ST25R3916_REG_PT_MOD 0x29U /** RW PT modulation Register */ -#define ST25R3916_REG_AUX_MOD (ST25R3916_SPACE_B | 0x28U) /** RW Aux Modulation setting Register */ +#define ST25R3916_REG_PT_MOD 0x29U /** RW PT modulation Register */ +#define ST25R3916_REG_AUX_MOD (ST25R3916_SPACE_B | 0x28U) /** RW Aux Modulation setting Register */ #define ST25R3916_REG_TX_DRIVER_TIMING \ (ST25R3916_SPACE_B | 0x29U) /** RW TX driver timing Register */ #define ST25R3916_REG_RES_AM_MOD \ @@ -153,11 +153,11 @@ extern "C" { (ST25R3916_SPACE_B | 0x2CU) /** R Regulator Display Register */ /** Receiver State Display Register */ -#define ST25R3916_REG_RSSI_RESULT 0x2DU /** R RSSI Display Register */ -#define ST25R3916_REG_GAIN_RED_STATE 0x2EU /** R Gain Reduction State Register */ +#define ST25R3916_REG_RSSI_RESULT 0x2DU /** R RSSI Display Register */ +#define ST25R3916_REG_GAIN_RED_STATE 0x2EU /** R Gain Reduction State Register */ #define ST25R3916_REG_CAP_SENSOR_CONTROL 0x2FU /** RW Capacitive Sensor Control Register */ -#define ST25R3916_REG_CAP_SENSOR_RESULT 0x30U /** R Capacitive Sensor Display Register */ -#define ST25R3916_REG_AUX_DISPLAY 0x31U /** R Auxiliary Display Register */ +#define ST25R3916_REG_CAP_SENSOR_RESULT 0x30U /** R Capacitive Sensor Display Register */ +#define ST25R3916_REG_AUX_DISPLAY 0x31U /** R Auxiliary Display Register */ /** Over/Undershoot Protection Configuration Registers */ #define ST25R3916_REG_OVERSHOOT_CONF1 \ @@ -180,7 +180,7 @@ extern "C" { #define ST25R3916_REG_AMPLITUDE_MEASURE_RESULT \ 0x36U /** R Amplitude Measurement Display Register */ #define ST25R3916_REG_PHASE_MEASURE_CONF 0x37U /** RW Phase Measurement Configuration Register */ -#define ST25R3916_REG_PHASE_MEASURE_REF 0x38U /** RW Phase Measurement Reference Register */ +#define ST25R3916_REG_PHASE_MEASURE_REF 0x38U /** RW Phase Measurement Reference Register */ #define ST25R3916_REG_PHASE_MEASURE_AA_RESULT \ 0x39U /** R Phase Measurement Auto Averaging Display */ #define ST25R3916_REG_PHASE_MEASURE_RESULT 0x3AU /** R Phase Measurement Display Register */ @@ -198,304 +198,304 @@ extern "C" { /** Register bit definitions */ -#define ST25R3916_REG_IO_CONF1_single (1U << 7) -#define ST25R3916_REG_IO_CONF1_rfo2 (1U << 6) -#define ST25R3916_REG_IO_CONF1_i2c_thd1 (1U << 5) -#define ST25R3916_REG_IO_CONF1_i2c_thd0 (1U << 4) -#define ST25R3916_REG_IO_CONF1_i2c_thd_mask (3U << 4) -#define ST25R3916_REG_IO_CONF1_i2c_thd_shift (4U) -#define ST25R3916_REG_IO_CONF1_rfu (1U << 3) -#define ST25R3916_REG_IO_CONF1_out_cl1 (1U << 2) -#define ST25R3916_REG_IO_CONF1_out_cl0 (1U << 1) +#define ST25R3916_REG_IO_CONF1_single (1U << 7) +#define ST25R3916_REG_IO_CONF1_rfo2 (1U << 6) +#define ST25R3916_REG_IO_CONF1_i2c_thd1 (1U << 5) +#define ST25R3916_REG_IO_CONF1_i2c_thd0 (1U << 4) +#define ST25R3916_REG_IO_CONF1_i2c_thd_mask (3U << 4) +#define ST25R3916_REG_IO_CONF1_i2c_thd_shift (4U) +#define ST25R3916_REG_IO_CONF1_rfu (1U << 3) +#define ST25R3916_REG_IO_CONF1_out_cl1 (1U << 2) +#define ST25R3916_REG_IO_CONF1_out_cl0 (1U << 1) #define ST25R3916_REG_IO_CONF1_out_cl_disabled (3U << 1) #define ST25R3916_REG_IO_CONF1_out_cl_13_56MHZ (2U << 1) -#define ST25R3916_REG_IO_CONF1_out_cl_4_78MHZ (1U << 1) -#define ST25R3916_REG_IO_CONF1_out_cl_3_39MHZ (0U << 1) -#define ST25R3916_REG_IO_CONF1_out_cl_mask (3U << 1) -#define ST25R3916_REG_IO_CONF1_out_cl_shift (1U) -#define ST25R3916_REG_IO_CONF1_lf_clk_off (1U << 0) -#define ST25R3916_REG_IO_CONF1_lf_clk_off_on (1U << 0) -#define ST25R3916_REG_IO_CONF1_lf_clk_off_off (0U << 0) +#define ST25R3916_REG_IO_CONF1_out_cl_4_78MHZ (1U << 1) +#define ST25R3916_REG_IO_CONF1_out_cl_3_39MHZ (0U << 1) +#define ST25R3916_REG_IO_CONF1_out_cl_mask (3U << 1) +#define ST25R3916_REG_IO_CONF1_out_cl_shift (1U) +#define ST25R3916_REG_IO_CONF1_lf_clk_off (1U << 0) +#define ST25R3916_REG_IO_CONF1_lf_clk_off_on (1U << 0) +#define ST25R3916_REG_IO_CONF1_lf_clk_off_off (0U << 0) -#define ST25R3916_REG_IO_CONF2_sup3V (1U << 7) -#define ST25R3916_REG_IO_CONF2_sup3V_3V (1U << 7) -#define ST25R3916_REG_IO_CONF2_sup3V_5V (0U << 7) -#define ST25R3916_REG_IO_CONF2_vspd_off (1U << 6) -#define ST25R3916_REG_IO_CONF2_aat_en (1U << 5) -#define ST25R3916_REG_IO_CONF2_miso_pd2 (1U << 4) -#define ST25R3916_REG_IO_CONF2_miso_pd1 (1U << 3) +#define ST25R3916_REG_IO_CONF2_sup3V (1U << 7) +#define ST25R3916_REG_IO_CONF2_sup3V_3V (1U << 7) +#define ST25R3916_REG_IO_CONF2_sup3V_5V (0U << 7) +#define ST25R3916_REG_IO_CONF2_vspd_off (1U << 6) +#define ST25R3916_REG_IO_CONF2_aat_en (1U << 5) +#define ST25R3916_REG_IO_CONF2_miso_pd2 (1U << 4) +#define ST25R3916_REG_IO_CONF2_miso_pd1 (1U << 3) #define ST25R3916_REG_IO_CONF2_io_drv_lvl (1U << 2) -#define ST25R3916_REG_IO_CONF2_slow_up (1U << 0) +#define ST25R3916_REG_IO_CONF2_slow_up (1U << 0) -#define ST25R3916_REG_OP_CONTROL_en (1U << 7) -#define ST25R3916_REG_OP_CONTROL_rx_en (1U << 6) -#define ST25R3916_REG_OP_CONTROL_rx_chn (1U << 5) -#define ST25R3916_REG_OP_CONTROL_rx_man (1U << 4) -#define ST25R3916_REG_OP_CONTROL_tx_en (1U << 3) -#define ST25R3916_REG_OP_CONTROL_wu (1U << 2) -#define ST25R3916_REG_OP_CONTROL_en_fd_c1 (1U << 1) -#define ST25R3916_REG_OP_CONTROL_en_fd_c0 (1U << 0) -#define ST25R3916_REG_OP_CONTROL_en_fd_efd_off (0U << 0) -#define ST25R3916_REG_OP_CONTROL_en_fd_manual_efd_ca (1U << 0) +#define ST25R3916_REG_OP_CONTROL_en (1U << 7) +#define ST25R3916_REG_OP_CONTROL_rx_en (1U << 6) +#define ST25R3916_REG_OP_CONTROL_rx_chn (1U << 5) +#define ST25R3916_REG_OP_CONTROL_rx_man (1U << 4) +#define ST25R3916_REG_OP_CONTROL_tx_en (1U << 3) +#define ST25R3916_REG_OP_CONTROL_wu (1U << 2) +#define ST25R3916_REG_OP_CONTROL_en_fd_c1 (1U << 1) +#define ST25R3916_REG_OP_CONTROL_en_fd_c0 (1U << 0) +#define ST25R3916_REG_OP_CONTROL_en_fd_efd_off (0U << 0) +#define ST25R3916_REG_OP_CONTROL_en_fd_manual_efd_ca (1U << 0) #define ST25R3916_REG_OP_CONTROL_en_fd_manual_efd_pdt (2U << 0) -#define ST25R3916_REG_OP_CONTROL_en_fd_auto_efd (3U << 0) -#define ST25R3916_REG_OP_CONTROL_en_fd_shift (0U) -#define ST25R3916_REG_OP_CONTROL_en_fd_mask (3U << 0) +#define ST25R3916_REG_OP_CONTROL_en_fd_auto_efd (3U << 0) +#define ST25R3916_REG_OP_CONTROL_en_fd_shift (0U) +#define ST25R3916_REG_OP_CONTROL_en_fd_mask (3U << 0) -#define ST25R3916_REG_MODE_targ (1U << 7) -#define ST25R3916_REG_MODE_targ_targ (1U << 7) -#define ST25R3916_REG_MODE_targ_init (0U << 7) -#define ST25R3916_REG_MODE_om3 (1U << 6) -#define ST25R3916_REG_MODE_om2 (1U << 5) -#define ST25R3916_REG_MODE_om1 (1U << 4) -#define ST25R3916_REG_MODE_om0 (1U << 3) -#define ST25R3916_REG_MODE_om_bpsk_stream (0xfU << 3) +#define ST25R3916_REG_MODE_targ (1U << 7) +#define ST25R3916_REG_MODE_targ_targ (1U << 7) +#define ST25R3916_REG_MODE_targ_init (0U << 7) +#define ST25R3916_REG_MODE_om3 (1U << 6) +#define ST25R3916_REG_MODE_om2 (1U << 5) +#define ST25R3916_REG_MODE_om1 (1U << 4) +#define ST25R3916_REG_MODE_om0 (1U << 3) +#define ST25R3916_REG_MODE_om_bpsk_stream (0xfU << 3) #define ST25R3916_REG_MODE_om_subcarrier_stream (0xeU << 3) -#define ST25R3916_REG_MODE_om_topaz (0x4U << 3) -#define ST25R3916_REG_MODE_om_felica (0x3U << 3) -#define ST25R3916_REG_MODE_om_iso14443b (0x2U << 3) -#define ST25R3916_REG_MODE_om_iso14443a (0x1U << 3) -#define ST25R3916_REG_MODE_om_targ_nfca (0x1U << 3) -#define ST25R3916_REG_MODE_om_targ_nfcb (0x2U << 3) -#define ST25R3916_REG_MODE_om_targ_nfcf (0x4U << 3) -#define ST25R3916_REG_MODE_om_targ_nfcip (0x7U << 3) -#define ST25R3916_REG_MODE_om_nfc (0x0U << 3) -#define ST25R3916_REG_MODE_om_mask (0xfU << 3) -#define ST25R3916_REG_MODE_om_shift (3U) -#define ST25R3916_REG_MODE_tr_am (1U << 2) -#define ST25R3916_REG_MODE_tr_am_ook (0U << 2) -#define ST25R3916_REG_MODE_tr_am_am (1U << 2) -#define ST25R3916_REG_MODE_nfc_ar1 (1U << 1) -#define ST25R3916_REG_MODE_nfc_ar0 (1U << 0) -#define ST25R3916_REG_MODE_nfc_ar_off (0U << 0) -#define ST25R3916_REG_MODE_nfc_ar_auto_rx (1U << 0) -#define ST25R3916_REG_MODE_nfc_ar_eof (2U << 0) -#define ST25R3916_REG_MODE_nfc_ar_rfu (3U << 0) -#define ST25R3916_REG_MODE_nfc_ar_mask (3U << 0) -#define ST25R3916_REG_MODE_nfc_ar_shift (0U) +#define ST25R3916_REG_MODE_om_topaz (0x4U << 3) +#define ST25R3916_REG_MODE_om_felica (0x3U << 3) +#define ST25R3916_REG_MODE_om_iso14443b (0x2U << 3) +#define ST25R3916_REG_MODE_om_iso14443a (0x1U << 3) +#define ST25R3916_REG_MODE_om_targ_nfca (0x1U << 3) +#define ST25R3916_REG_MODE_om_targ_nfcb (0x2U << 3) +#define ST25R3916_REG_MODE_om_targ_nfcf (0x4U << 3) +#define ST25R3916_REG_MODE_om_targ_nfcip (0x7U << 3) +#define ST25R3916_REG_MODE_om_nfc (0x0U << 3) +#define ST25R3916_REG_MODE_om_mask (0xfU << 3) +#define ST25R3916_REG_MODE_om_shift (3U) +#define ST25R3916_REG_MODE_tr_am (1U << 2) +#define ST25R3916_REG_MODE_tr_am_ook (0U << 2) +#define ST25R3916_REG_MODE_tr_am_am (1U << 2) +#define ST25R3916_REG_MODE_nfc_ar1 (1U << 1) +#define ST25R3916_REG_MODE_nfc_ar0 (1U << 0) +#define ST25R3916_REG_MODE_nfc_ar_off (0U << 0) +#define ST25R3916_REG_MODE_nfc_ar_auto_rx (1U << 0) +#define ST25R3916_REG_MODE_nfc_ar_eof (2U << 0) +#define ST25R3916_REG_MODE_nfc_ar_rfu (3U << 0) +#define ST25R3916_REG_MODE_nfc_ar_mask (3U << 0) +#define ST25R3916_REG_MODE_nfc_ar_shift (0U) -#define ST25R3916_REG_BIT_RATE_txrate_106 (0x0U << 4) -#define ST25R3916_REG_BIT_RATE_txrate_212 (0x1U << 4) -#define ST25R3916_REG_BIT_RATE_txrate_424 (0x2U << 4) -#define ST25R3916_REG_BIT_RATE_txrate_848 (0x3U << 4) -#define ST25R3916_REG_BIT_RATE_txrate_mask (0x3U << 4) +#define ST25R3916_REG_BIT_RATE_txrate_106 (0x0U << 4) +#define ST25R3916_REG_BIT_RATE_txrate_212 (0x1U << 4) +#define ST25R3916_REG_BIT_RATE_txrate_424 (0x2U << 4) +#define ST25R3916_REG_BIT_RATE_txrate_848 (0x3U << 4) +#define ST25R3916_REG_BIT_RATE_txrate_mask (0x3U << 4) #define ST25R3916_REG_BIT_RATE_txrate_shift (4U) -#define ST25R3916_REG_BIT_RATE_rxrate_106 (0x0U << 0) -#define ST25R3916_REG_BIT_RATE_rxrate_212 (0x1U << 0) -#define ST25R3916_REG_BIT_RATE_rxrate_424 (0x2U << 0) -#define ST25R3916_REG_BIT_RATE_rxrate_848 (0x3U << 0) -#define ST25R3916_REG_BIT_RATE_rxrate_mask (0x3U << 0) +#define ST25R3916_REG_BIT_RATE_rxrate_106 (0x0U << 0) +#define ST25R3916_REG_BIT_RATE_rxrate_212 (0x1U << 0) +#define ST25R3916_REG_BIT_RATE_rxrate_424 (0x2U << 0) +#define ST25R3916_REG_BIT_RATE_rxrate_848 (0x3U << 0) +#define ST25R3916_REG_BIT_RATE_rxrate_mask (0x3U << 0) #define ST25R3916_REG_BIT_RATE_rxrate_shift (0U) -#define ST25R3916_REG_ISO14443A_NFC_no_tx_par (1U << 7) +#define ST25R3916_REG_ISO14443A_NFC_no_tx_par (1U << 7) #define ST25R3916_REG_ISO14443A_NFC_no_tx_par_off (0U << 7) -#define ST25R3916_REG_ISO14443A_NFC_no_rx_par (1U << 6) +#define ST25R3916_REG_ISO14443A_NFC_no_rx_par (1U << 6) #define ST25R3916_REG_ISO14443A_NFC_no_rx_par_off (0U << 6) -#define ST25R3916_REG_ISO14443A_NFC_nfc_f0 (1U << 5) -#define ST25R3916_REG_ISO14443A_NFC_nfc_f0_off (0U << 5) -#define ST25R3916_REG_ISO14443A_NFC_p_len3 (1U << 4) -#define ST25R3916_REG_ISO14443A_NFC_p_len2 (1U << 3) -#define ST25R3916_REG_ISO14443A_NFC_p_len1 (1U << 2) -#define ST25R3916_REG_ISO14443A_NFC_p_len0 (1U << 1) -#define ST25R3916_REG_ISO14443A_NFC_p_len_mask (0xfU << 1) -#define ST25R3916_REG_ISO14443A_NFC_p_len_shift (1U) -#define ST25R3916_REG_ISO14443A_NFC_antcl (1U << 0) +#define ST25R3916_REG_ISO14443A_NFC_nfc_f0 (1U << 5) +#define ST25R3916_REG_ISO14443A_NFC_nfc_f0_off (0U << 5) +#define ST25R3916_REG_ISO14443A_NFC_p_len3 (1U << 4) +#define ST25R3916_REG_ISO14443A_NFC_p_len2 (1U << 3) +#define ST25R3916_REG_ISO14443A_NFC_p_len1 (1U << 2) +#define ST25R3916_REG_ISO14443A_NFC_p_len0 (1U << 1) +#define ST25R3916_REG_ISO14443A_NFC_p_len_mask (0xfU << 1) +#define ST25R3916_REG_ISO14443A_NFC_p_len_shift (1U) +#define ST25R3916_REG_ISO14443A_NFC_antcl (1U << 0) -#define ST25R3916_REG_EMD_SUP_CONF_emd_emv (1U << 7) -#define ST25R3916_REG_EMD_SUP_CONF_emd_emv_on (1U << 7) -#define ST25R3916_REG_EMD_SUP_CONF_emd_emv_off (0U << 7) -#define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv (1U << 6) -#define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv_on (1U << 6) +#define ST25R3916_REG_EMD_SUP_CONF_emd_emv (1U << 7) +#define ST25R3916_REG_EMD_SUP_CONF_emd_emv_on (1U << 7) +#define ST25R3916_REG_EMD_SUP_CONF_emd_emv_off (0U << 7) +#define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv (1U << 6) +#define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv_on (1U << 6) #define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv_off (0U << 6) -#define ST25R3916_REG_EMD_SUP_CONF_rfu1 (1U << 5) -#define ST25R3916_REG_EMD_SUP_CONF_rfu0 (1U << 4) -#define ST25R3916_REG_EMD_SUP_CONF_emd_thld3 (1U << 3) -#define ST25R3916_REG_EMD_SUP_CONF_emd_thld2 (1U << 2) -#define ST25R3916_REG_EMD_SUP_CONF_emd_thld1 (1U << 1) -#define ST25R3916_REG_EMD_SUP_CONF_emd_thld0 (1U << 0) -#define ST25R3916_REG_EMD_SUP_CONF_emd_thld_mask (0xfU << 0) -#define ST25R3916_REG_EMD_SUP_CONF_emd_thld_shift (0U) +#define ST25R3916_REG_EMD_SUP_CONF_rfu1 (1U << 5) +#define ST25R3916_REG_EMD_SUP_CONF_rfu0 (1U << 4) +#define ST25R3916_REG_EMD_SUP_CONF_emd_thld3 (1U << 3) +#define ST25R3916_REG_EMD_SUP_CONF_emd_thld2 (1U << 2) +#define ST25R3916_REG_EMD_SUP_CONF_emd_thld1 (1U << 1) +#define ST25R3916_REG_EMD_SUP_CONF_emd_thld0 (1U << 0) +#define ST25R3916_REG_EMD_SUP_CONF_emd_thld_mask (0xfU << 0) +#define ST25R3916_REG_EMD_SUP_CONF_emd_thld_shift (0U) -#define ST25R3916_REG_SUBC_START_TIME_rfu2 (1U << 7) -#define ST25R3916_REG_SUBC_START_TIME_rfu1 (1U << 6) -#define ST25R3916_REG_SUBC_START_TIME_rfu0 (1U << 5) -#define ST25R3916_REG_SUBC_START_TIME_sst4 (1U << 4) -#define ST25R3916_REG_SUBC_START_TIME_sst3 (1U << 3) -#define ST25R3916_REG_SUBC_START_TIME_sst2 (1U << 2) -#define ST25R3916_REG_SUBC_START_TIME_sst1 (1U << 1) -#define ST25R3916_REG_SUBC_START_TIME_sst0 (1U << 0) -#define ST25R3916_REG_SUBC_START_TIME_sst_mask (0x1fU << 0) +#define ST25R3916_REG_SUBC_START_TIME_rfu2 (1U << 7) +#define ST25R3916_REG_SUBC_START_TIME_rfu1 (1U << 6) +#define ST25R3916_REG_SUBC_START_TIME_rfu0 (1U << 5) +#define ST25R3916_REG_SUBC_START_TIME_sst4 (1U << 4) +#define ST25R3916_REG_SUBC_START_TIME_sst3 (1U << 3) +#define ST25R3916_REG_SUBC_START_TIME_sst2 (1U << 2) +#define ST25R3916_REG_SUBC_START_TIME_sst1 (1U << 1) +#define ST25R3916_REG_SUBC_START_TIME_sst0 (1U << 0) +#define ST25R3916_REG_SUBC_START_TIME_sst_mask (0x1fU << 0) #define ST25R3916_REG_SUBC_START_TIME_sst_shift (0U) -#define ST25R3916_REG_ISO14443B_1_egt2 (1U << 7) -#define ST25R3916_REG_ISO14443B_1_egt1 (1U << 6) -#define ST25R3916_REG_ISO14443B_1_egt0 (1U << 5) -#define ST25R3916_REG_ISO14443B_1_egt_shift (5U) -#define ST25R3916_REG_ISO14443B_1_egt_mask (7U << 5) -#define ST25R3916_REG_ISO14443B_1_sof_1 (1U << 3) -#define ST25R3916_REG_ISO14443B_1_sof_1_3etu (1U << 3) -#define ST25R3916_REG_ISO14443B_1_sof_1_2etu (0U << 3) -#define ST25R3916_REG_ISO14443B_1_sof_0 (1U << 4) +#define ST25R3916_REG_ISO14443B_1_egt2 (1U << 7) +#define ST25R3916_REG_ISO14443B_1_egt1 (1U << 6) +#define ST25R3916_REG_ISO14443B_1_egt0 (1U << 5) +#define ST25R3916_REG_ISO14443B_1_egt_shift (5U) +#define ST25R3916_REG_ISO14443B_1_egt_mask (7U << 5) +#define ST25R3916_REG_ISO14443B_1_sof_1 (1U << 3) +#define ST25R3916_REG_ISO14443B_1_sof_1_3etu (1U << 3) +#define ST25R3916_REG_ISO14443B_1_sof_1_2etu (0U << 3) +#define ST25R3916_REG_ISO14443B_1_sof_0 (1U << 4) #define ST25R3916_REG_ISO14443B_1_sof_0_11etu (1U << 4) #define ST25R3916_REG_ISO14443B_1_sof_0_10etu (0U << 4) -#define ST25R3916_REG_ISO14443B_1_sof_mask (3U << 3) -#define ST25R3916_REG_ISO14443B_1_eof (1U << 2) -#define ST25R3916_REG_ISO14443B_1_eof_11etu (1U << 2) -#define ST25R3916_REG_ISO14443B_1_eof_10etu (0U << 2) -#define ST25R3916_REG_ISO14443B_1_half (1U << 1) -#define ST25R3916_REG_ISO14443B_1_rx_st_om (1U << 0) +#define ST25R3916_REG_ISO14443B_1_sof_mask (3U << 3) +#define ST25R3916_REG_ISO14443B_1_eof (1U << 2) +#define ST25R3916_REG_ISO14443B_1_eof_11etu (1U << 2) +#define ST25R3916_REG_ISO14443B_1_eof_10etu (0U << 2) +#define ST25R3916_REG_ISO14443B_1_half (1U << 1) +#define ST25R3916_REG_ISO14443B_1_rx_st_om (1U << 0) -#define ST25R3916_REG_ISO14443B_2_tr1_1 (1U << 7) -#define ST25R3916_REG_ISO14443B_2_tr1_0 (1U << 6) +#define ST25R3916_REG_ISO14443B_2_tr1_1 (1U << 7) +#define ST25R3916_REG_ISO14443B_2_tr1_0 (1U << 6) #define ST25R3916_REG_ISO14443B_2_tr1_64fs32fs (1U << 6) #define ST25R3916_REG_ISO14443B_2_tr1_80fs80fs (0U << 6) -#define ST25R3916_REG_ISO14443B_2_tr1_mask (3U << 6) -#define ST25R3916_REG_ISO14443B_2_tr1_shift (6U) -#define ST25R3916_REG_ISO14443B_2_no_sof (1U << 5) -#define ST25R3916_REG_ISO14443B_2_no_eof (1U << 4) -#define ST25R3916_REG_ISO14443B_rfu1 (1U << 3) -#define ST25R3916_REG_ISO14443B_rfu0 (1U << 2) -#define ST25R3916_REG_ISO14443B_2_f_p1 (1U << 1) -#define ST25R3916_REG_ISO14443B_2_f_p0 (1U << 0) -#define ST25R3916_REG_ISO14443B_2_f_p_96 (3U << 0) -#define ST25R3916_REG_ISO14443B_2_f_p_80 (2U << 0) -#define ST25R3916_REG_ISO14443B_2_f_p_64 (1U << 0) -#define ST25R3916_REG_ISO14443B_2_f_p_48 (0U << 0) -#define ST25R3916_REG_ISO14443B_2_f_p_mask (3U << 0) -#define ST25R3916_REG_ISO14443B_2_f_p_shift (0U) +#define ST25R3916_REG_ISO14443B_2_tr1_mask (3U << 6) +#define ST25R3916_REG_ISO14443B_2_tr1_shift (6U) +#define ST25R3916_REG_ISO14443B_2_no_sof (1U << 5) +#define ST25R3916_REG_ISO14443B_2_no_eof (1U << 4) +#define ST25R3916_REG_ISO14443B_rfu1 (1U << 3) +#define ST25R3916_REG_ISO14443B_rfu0 (1U << 2) +#define ST25R3916_REG_ISO14443B_2_f_p1 (1U << 1) +#define ST25R3916_REG_ISO14443B_2_f_p0 (1U << 0) +#define ST25R3916_REG_ISO14443B_2_f_p_96 (3U << 0) +#define ST25R3916_REG_ISO14443B_2_f_p_80 (2U << 0) +#define ST25R3916_REG_ISO14443B_2_f_p_64 (1U << 0) +#define ST25R3916_REG_ISO14443B_2_f_p_48 (0U << 0) +#define ST25R3916_REG_ISO14443B_2_f_p_mask (3U << 0) +#define ST25R3916_REG_ISO14443B_2_f_p_shift (0U) -#define ST25R3916_REG_PASSIVE_TARGET_fdel_3 (1U << 7) -#define ST25R3916_REG_PASSIVE_TARGET_fdel_2 (1U << 6) -#define ST25R3916_REG_PASSIVE_TARGET_fdel_1 (1U << 5) -#define ST25R3916_REG_PASSIVE_TARGET_fdel_0 (1U << 4) -#define ST25R3916_REG_PASSIVE_TARGET_fdel_mask (0xfU << 4) -#define ST25R3916_REG_PASSIVE_TARGET_fdel_shift (4U) -#define ST25R3916_REG_PASSIVE_TARGET_d_ac_ap2p (1U << 3) +#define ST25R3916_REG_PASSIVE_TARGET_fdel_3 (1U << 7) +#define ST25R3916_REG_PASSIVE_TARGET_fdel_2 (1U << 6) +#define ST25R3916_REG_PASSIVE_TARGET_fdel_1 (1U << 5) +#define ST25R3916_REG_PASSIVE_TARGET_fdel_0 (1U << 4) +#define ST25R3916_REG_PASSIVE_TARGET_fdel_mask (0xfU << 4) +#define ST25R3916_REG_PASSIVE_TARGET_fdel_shift (4U) +#define ST25R3916_REG_PASSIVE_TARGET_d_ac_ap2p (1U << 3) #define ST25R3916_REG_PASSIVE_TARGET_d_212_424_1r (1U << 2) -#define ST25R3916_REG_PASSIVE_TARGET_rfu (1U << 1) -#define ST25R3916_REG_PASSIVE_TARGET_d_106_ac_a (1U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_rfu (1U << 1) +#define ST25R3916_REG_PASSIVE_TARGET_d_106_ac_a (1U << 0) -#define ST25R3916_REG_STREAM_MODE_rfu (1U << 7) -#define ST25R3916_REG_STREAM_MODE_scf1 (1U << 6) -#define ST25R3916_REG_STREAM_MODE_scf0 (1U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_sc212 (0U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_sc424 (1U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_sc848 (2U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_sc1695 (3U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_bpsk848 (0U << 5) +#define ST25R3916_REG_STREAM_MODE_rfu (1U << 7) +#define ST25R3916_REG_STREAM_MODE_scf1 (1U << 6) +#define ST25R3916_REG_STREAM_MODE_scf0 (1U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_sc212 (0U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_sc424 (1U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_sc848 (2U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_sc1695 (3U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_bpsk848 (0U << 5) #define ST25R3916_REG_STREAM_MODE_scf_bpsk1695 (1U << 5) #define ST25R3916_REG_STREAM_MODE_scf_bpsk3390 (2U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_bpsk106 (3U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_mask (3U << 5) -#define ST25R3916_REG_STREAM_MODE_scf_shift (5U) -#define ST25R3916_REG_STREAM_MODE_scp1 (1U << 4) -#define ST25R3916_REG_STREAM_MODE_scp0 (1U << 3) -#define ST25R3916_REG_STREAM_MODE_scp_1pulse (0U << 3) -#define ST25R3916_REG_STREAM_MODE_scp_2pulses (1U << 3) -#define ST25R3916_REG_STREAM_MODE_scp_4pulses (2U << 3) -#define ST25R3916_REG_STREAM_MODE_scp_8pulses (3U << 3) -#define ST25R3916_REG_STREAM_MODE_scp_mask (3U << 3) -#define ST25R3916_REG_STREAM_MODE_scp_shift (3U) -#define ST25R3916_REG_STREAM_MODE_stx2 (1U << 2) -#define ST25R3916_REG_STREAM_MODE_stx1 (1U << 1) -#define ST25R3916_REG_STREAM_MODE_stx0 (1U << 0) -#define ST25R3916_REG_STREAM_MODE_stx_106 (0U << 0) -#define ST25R3916_REG_STREAM_MODE_stx_212 (1U << 0) -#define ST25R3916_REG_STREAM_MODE_stx_424 (2U << 0) -#define ST25R3916_REG_STREAM_MODE_stx_848 (3U << 0) -#define ST25R3916_REG_STREAM_MODE_stx_mask (7U << 0) -#define ST25R3916_REG_STREAM_MODE_stx_shift (0U) +#define ST25R3916_REG_STREAM_MODE_scf_bpsk106 (3U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_mask (3U << 5) +#define ST25R3916_REG_STREAM_MODE_scf_shift (5U) +#define ST25R3916_REG_STREAM_MODE_scp1 (1U << 4) +#define ST25R3916_REG_STREAM_MODE_scp0 (1U << 3) +#define ST25R3916_REG_STREAM_MODE_scp_1pulse (0U << 3) +#define ST25R3916_REG_STREAM_MODE_scp_2pulses (1U << 3) +#define ST25R3916_REG_STREAM_MODE_scp_4pulses (2U << 3) +#define ST25R3916_REG_STREAM_MODE_scp_8pulses (3U << 3) +#define ST25R3916_REG_STREAM_MODE_scp_mask (3U << 3) +#define ST25R3916_REG_STREAM_MODE_scp_shift (3U) +#define ST25R3916_REG_STREAM_MODE_stx2 (1U << 2) +#define ST25R3916_REG_STREAM_MODE_stx1 (1U << 1) +#define ST25R3916_REG_STREAM_MODE_stx0 (1U << 0) +#define ST25R3916_REG_STREAM_MODE_stx_106 (0U << 0) +#define ST25R3916_REG_STREAM_MODE_stx_212 (1U << 0) +#define ST25R3916_REG_STREAM_MODE_stx_424 (2U << 0) +#define ST25R3916_REG_STREAM_MODE_stx_848 (3U << 0) +#define ST25R3916_REG_STREAM_MODE_stx_mask (7U << 0) +#define ST25R3916_REG_STREAM_MODE_stx_shift (0U) -#define ST25R3916_REG_AUX_no_crc_rx (1U << 7) -#define ST25R3916_REG_AUX_rfu (1U << 6) -#define ST25R3916_REG_AUX_nfc_id1 (1U << 5) -#define ST25R3916_REG_AUX_nfc_id0 (1U << 4) -#define ST25R3916_REG_AUX_nfc_id_7bytes (1U << 4) -#define ST25R3916_REG_AUX_nfc_id_4bytes (0U << 4) -#define ST25R3916_REG_AUX_nfc_id_mask (3U << 4) -#define ST25R3916_REG_AUX_nfc_id_shift (4U) -#define ST25R3916_REG_AUX_mfaz_cl90 (1U << 3) -#define ST25R3916_REG_AUX_dis_corr (1U << 2) -#define ST25R3916_REG_AUX_dis_corr_coherent (1U << 2) +#define ST25R3916_REG_AUX_no_crc_rx (1U << 7) +#define ST25R3916_REG_AUX_rfu (1U << 6) +#define ST25R3916_REG_AUX_nfc_id1 (1U << 5) +#define ST25R3916_REG_AUX_nfc_id0 (1U << 4) +#define ST25R3916_REG_AUX_nfc_id_7bytes (1U << 4) +#define ST25R3916_REG_AUX_nfc_id_4bytes (0U << 4) +#define ST25R3916_REG_AUX_nfc_id_mask (3U << 4) +#define ST25R3916_REG_AUX_nfc_id_shift (4U) +#define ST25R3916_REG_AUX_mfaz_cl90 (1U << 3) +#define ST25R3916_REG_AUX_dis_corr (1U << 2) +#define ST25R3916_REG_AUX_dis_corr_coherent (1U << 2) #define ST25R3916_REG_AUX_dis_corr_correlator (0U << 2) -#define ST25R3916_REG_AUX_nfc_n1 (1U << 1) -#define ST25R3916_REG_AUX_nfc_n0 (1U << 0) -#define ST25R3916_REG_AUX_nfc_n_mask (3U << 0) -#define ST25R3916_REG_AUX_nfc_n_shift (0U) +#define ST25R3916_REG_AUX_nfc_n1 (1U << 1) +#define ST25R3916_REG_AUX_nfc_n0 (1U << 0) +#define ST25R3916_REG_AUX_nfc_n_mask (3U << 0) +#define ST25R3916_REG_AUX_nfc_n_shift (0U) -#define ST25R3916_REG_RX_CONF1_ch_sel (1U << 7) -#define ST25R3916_REG_RX_CONF1_ch_sel_PM (1U << 7) -#define ST25R3916_REG_RX_CONF1_ch_sel_AM (0U << 7) -#define ST25R3916_REG_RX_CONF1_lp2 (1U << 6) -#define ST25R3916_REG_RX_CONF1_lp1 (1U << 5) -#define ST25R3916_REG_RX_CONF1_lp0 (1U << 4) -#define ST25R3916_REG_RX_CONF1_lp_1200khz (0U << 4) -#define ST25R3916_REG_RX_CONF1_lp_600khz (1U << 4) -#define ST25R3916_REG_RX_CONF1_lp_300khz (2U << 4) -#define ST25R3916_REG_RX_CONF1_lp_2000khz (4U << 4) -#define ST25R3916_REG_RX_CONF1_lp_7000khz (5U << 4) -#define ST25R3916_REG_RX_CONF1_lp_mask (7U << 4) -#define ST25R3916_REG_RX_CONF1_lp_shift (4U) -#define ST25R3916_REG_RX_CONF1_z600k (1U << 3) -#define ST25R3916_REG_RX_CONF1_h200 (1U << 2) -#define ST25R3916_REG_RX_CONF1_h80 (1U << 1) -#define ST25R3916_REG_RX_CONF1_z12k (1U << 0) -#define ST25R3916_REG_RX_CONF1_hz_60_400khz (0U << 0) -#define ST25R3916_REG_RX_CONF1_hz_60_200khz (4U << 0) -#define ST25R3916_REG_RX_CONF1_hz_40_80khz (2U << 0) -#define ST25R3916_REG_RX_CONF1_hz_12_200khz (1U << 0) -#define ST25R3916_REG_RX_CONF1_hz_12_80khz (3U << 0) +#define ST25R3916_REG_RX_CONF1_ch_sel (1U << 7) +#define ST25R3916_REG_RX_CONF1_ch_sel_PM (1U << 7) +#define ST25R3916_REG_RX_CONF1_ch_sel_AM (0U << 7) +#define ST25R3916_REG_RX_CONF1_lp2 (1U << 6) +#define ST25R3916_REG_RX_CONF1_lp1 (1U << 5) +#define ST25R3916_REG_RX_CONF1_lp0 (1U << 4) +#define ST25R3916_REG_RX_CONF1_lp_1200khz (0U << 4) +#define ST25R3916_REG_RX_CONF1_lp_600khz (1U << 4) +#define ST25R3916_REG_RX_CONF1_lp_300khz (2U << 4) +#define ST25R3916_REG_RX_CONF1_lp_2000khz (4U << 4) +#define ST25R3916_REG_RX_CONF1_lp_7000khz (5U << 4) +#define ST25R3916_REG_RX_CONF1_lp_mask (7U << 4) +#define ST25R3916_REG_RX_CONF1_lp_shift (4U) +#define ST25R3916_REG_RX_CONF1_z600k (1U << 3) +#define ST25R3916_REG_RX_CONF1_h200 (1U << 2) +#define ST25R3916_REG_RX_CONF1_h80 (1U << 1) +#define ST25R3916_REG_RX_CONF1_z12k (1U << 0) +#define ST25R3916_REG_RX_CONF1_hz_60_400khz (0U << 0) +#define ST25R3916_REG_RX_CONF1_hz_60_200khz (4U << 0) +#define ST25R3916_REG_RX_CONF1_hz_40_80khz (2U << 0) +#define ST25R3916_REG_RX_CONF1_hz_12_200khz (1U << 0) +#define ST25R3916_REG_RX_CONF1_hz_12_80khz (3U << 0) #define ST25R3916_REG_RX_CONF1_hz_12_200khz_alt (5U << 0) -#define ST25R3916_REG_RX_CONF1_hz_600_400khz (8U << 0) -#define ST25R3916_REG_RX_CONF1_hz_600_200khz (12U << 0) -#define ST25R3916_REG_RX_CONF1_hz_mask (0xfU << 0) -#define ST25R3916_REG_RX_CONF1_hz_shift (0U) +#define ST25R3916_REG_RX_CONF1_hz_600_400khz (8U << 0) +#define ST25R3916_REG_RX_CONF1_hz_600_200khz (12U << 0) +#define ST25R3916_REG_RX_CONF1_hz_mask (0xfU << 0) +#define ST25R3916_REG_RX_CONF1_hz_shift (0U) -#define ST25R3916_REG_RX_CONF2_demod_mode (1U << 7) -#define ST25R3916_REG_RX_CONF2_amd_sel (1U << 6) +#define ST25R3916_REG_RX_CONF2_demod_mode (1U << 7) +#define ST25R3916_REG_RX_CONF2_amd_sel (1U << 6) #define ST25R3916_REG_RX_CONF2_amd_sel_mixer (1U << 6) -#define ST25R3916_REG_RX_CONF2_amd_sel_peak (0U << 6) -#define ST25R3916_REG_RX_CONF2_sqm_dyn (1U << 5) -#define ST25R3916_REG_RX_CONF2_pulz_61 (1U << 4) -#define ST25R3916_REG_RX_CONF2_agc_en (1U << 3) -#define ST25R3916_REG_RX_CONF2_agc_m (1U << 2) -#define ST25R3916_REG_RX_CONF2_agc_alg (1U << 1) -#define ST25R3916_REG_RX_CONF2_agc6_3 (1U << 0) +#define ST25R3916_REG_RX_CONF2_amd_sel_peak (0U << 6) +#define ST25R3916_REG_RX_CONF2_sqm_dyn (1U << 5) +#define ST25R3916_REG_RX_CONF2_pulz_61 (1U << 4) +#define ST25R3916_REG_RX_CONF2_agc_en (1U << 3) +#define ST25R3916_REG_RX_CONF2_agc_m (1U << 2) +#define ST25R3916_REG_RX_CONF2_agc_alg (1U << 1) +#define ST25R3916_REG_RX_CONF2_agc6_3 (1U << 0) -#define ST25R3916_REG_RX_CONF3_rg1_am2 (1U << 7) -#define ST25R3916_REG_RX_CONF3_rg1_am1 (1U << 6) -#define ST25R3916_REG_RX_CONF3_rg1_am0 (1U << 5) -#define ST25R3916_REG_RX_CONF3_rg1_am_mask (0x7U << 5) +#define ST25R3916_REG_RX_CONF3_rg1_am2 (1U << 7) +#define ST25R3916_REG_RX_CONF3_rg1_am1 (1U << 6) +#define ST25R3916_REG_RX_CONF3_rg1_am0 (1U << 5) +#define ST25R3916_REG_RX_CONF3_rg1_am_mask (0x7U << 5) #define ST25R3916_REG_RX_CONF3_rg1_am_shift (5U) -#define ST25R3916_REG_RX_CONF3_rg1_pm2 (1U << 4) -#define ST25R3916_REG_RX_CONF3_rg1_pm1 (1U << 3) -#define ST25R3916_REG_RX_CONF3_rg1_pm0 (1U << 2) -#define ST25R3916_REG_RX_CONF3_rg1_pm_mask (0x7U << 2) +#define ST25R3916_REG_RX_CONF3_rg1_pm2 (1U << 4) +#define ST25R3916_REG_RX_CONF3_rg1_pm1 (1U << 3) +#define ST25R3916_REG_RX_CONF3_rg1_pm0 (1U << 2) +#define ST25R3916_REG_RX_CONF3_rg1_pm_mask (0x7U << 2) #define ST25R3916_REG_RX_CONF3_rg1_pm_shift (2U) -#define ST25R3916_REG_RX_CONF3_lf_en (1U << 1) -#define ST25R3916_REG_RX_CONF3_lf_op (1U << 0) +#define ST25R3916_REG_RX_CONF3_lf_en (1U << 1) +#define ST25R3916_REG_RX_CONF3_lf_op (1U << 0) -#define ST25R3916_REG_RX_CONF4_rg2_am3 (1U << 7) -#define ST25R3916_REG_RX_CONF4_rg2_am2 (1U << 6) -#define ST25R3916_REG_RX_CONF4_rg2_am1 (1U << 5) -#define ST25R3916_REG_RX_CONF4_rg2_am0 (1U << 4) -#define ST25R3916_REG_RX_CONF4_rg2_am_mask (0xfU << 4) +#define ST25R3916_REG_RX_CONF4_rg2_am3 (1U << 7) +#define ST25R3916_REG_RX_CONF4_rg2_am2 (1U << 6) +#define ST25R3916_REG_RX_CONF4_rg2_am1 (1U << 5) +#define ST25R3916_REG_RX_CONF4_rg2_am0 (1U << 4) +#define ST25R3916_REG_RX_CONF4_rg2_am_mask (0xfU << 4) #define ST25R3916_REG_RX_CONF4_rg2_am_shift (4U) -#define ST25R3916_REG_RX_CONF4_rg2_pm3 (1U << 3) -#define ST25R3916_REG_RX_CONF4_rg2_pm2 (1U << 2) -#define ST25R3916_REG_RX_CONF4_rg2_pm1 (1U << 1) -#define ST25R3916_REG_RX_CONF4_rg2_pm0 (1U << 0) -#define ST25R3916_REG_RX_CONF4_rg2_pm_mask (0xfU << 0) +#define ST25R3916_REG_RX_CONF4_rg2_pm3 (1U << 3) +#define ST25R3916_REG_RX_CONF4_rg2_pm2 (1U << 2) +#define ST25R3916_REG_RX_CONF4_rg2_pm1 (1U << 1) +#define ST25R3916_REG_RX_CONF4_rg2_pm0 (1U << 0) +#define ST25R3916_REG_RX_CONF4_rg2_pm_mask (0xfU << 0) #define ST25R3916_REG_RX_CONF4_rg2_pm_shift (0U) -#define ST25R3916_REG_P2P_RX_CONF_ook_fd (1U << 7) -#define ST25R3916_REG_P2P_RX_CONF_ook_rc1 (1U << 6) -#define ST25R3916_REG_P2P_RX_CONF_ook_rc0 (1U << 5) +#define ST25R3916_REG_P2P_RX_CONF_ook_fd (1U << 7) +#define ST25R3916_REG_P2P_RX_CONF_ook_rc1 (1U << 6) +#define ST25R3916_REG_P2P_RX_CONF_ook_rc0 (1U << 5) #define ST25R3916_REG_P2P_RX_CONF_ook_thd1 (1U << 4) #define ST25R3916_REG_P2P_RX_CONF_ook_thd0 (1U << 3) -#define ST25R3916_REG_P2P_RX_CONF_ask_rc1 (1U << 2) -#define ST25R3916_REG_P2P_RX_CONF_ask_rc0 (1U << 1) -#define ST25R3916_REG_P2P_RX_CONF_ask_thd (1U << 0) +#define ST25R3916_REG_P2P_RX_CONF_ask_rc1 (1U << 2) +#define ST25R3916_REG_P2P_RX_CONF_ask_rc0 (1U << 1) +#define ST25R3916_REG_P2P_RX_CONF_ask_thd (1U << 0) #define ST25R3916_REG_CORR_CONF1_corr_s7 (1U << 7) #define ST25R3916_REG_CORR_CONF1_corr_s6 (1U << 6) @@ -506,122 +506,122 @@ extern "C" { #define ST25R3916_REG_CORR_CONF1_corr_s1 (1U << 1) #define ST25R3916_REG_CORR_CONF1_corr_s0 (1U << 0) -#define ST25R3916_REG_CORR_CONF2_rfu5 (1U << 7) -#define ST25R3916_REG_CORR_CONF2_rfu4 (1U << 6) -#define ST25R3916_REG_CORR_CONF2_rfu3 (1U << 5) -#define ST25R3916_REG_CORR_CONF2_rfu2 (1U << 4) -#define ST25R3916_REG_CORR_CONF2_rfu1 (1U << 3) -#define ST25R3916_REG_CORR_CONF2_rfu0 (1U << 2) +#define ST25R3916_REG_CORR_CONF2_rfu5 (1U << 7) +#define ST25R3916_REG_CORR_CONF2_rfu4 (1U << 6) +#define ST25R3916_REG_CORR_CONF2_rfu3 (1U << 5) +#define ST25R3916_REG_CORR_CONF2_rfu2 (1U << 4) +#define ST25R3916_REG_CORR_CONF2_rfu1 (1U << 3) +#define ST25R3916_REG_CORR_CONF2_rfu0 (1U << 2) #define ST25R3916_REG_CORR_CONF2_corr_s9 (1U << 1) #define ST25R3916_REG_CORR_CONF2_corr_s8 (1U << 0) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc2 (1U << 7) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc1 (1U << 6) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc0 (1U << 5) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_no_trigger (0U << 5) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_erx (1U << 5) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_srx (2U << 5) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_etx_nfc (3U << 5) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_mask (7U << 5) -#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_shift (5U) -#define ST25R3916_REG_TIMER_EMV_CONTROL_rfu (1U << 4) -#define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step (1U << 3) -#define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step_512 (1U << 3) -#define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step_64 (0U << 3) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc (1U << 2) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc_on (1U << 2) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc_off (0U << 2) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv (1U << 1) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv_on (1U << 1) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv_off (0U << 1) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step (1U << 0) -#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step_64fc (0U << 0) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc2 (1U << 7) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc1 (1U << 6) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc0 (1U << 5) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_no_trigger (0U << 5) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_erx (1U << 5) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_srx (2U << 5) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_etx_nfc (3U << 5) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_mask (7U << 5) +#define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_shift (5U) +#define ST25R3916_REG_TIMER_EMV_CONTROL_rfu (1U << 4) +#define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step (1U << 3) +#define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step_512 (1U << 3) +#define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step_64 (0U << 3) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc (1U << 2) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc_on (1U << 2) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc_off (0U << 2) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv (1U << 1) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv_on (1U << 1) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv_off (0U << 1) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step (1U << 0) +#define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step_64fc (0U << 0) #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step_4096_fc (1U << 0) -#define ST25R3916_REG_FIFO_STATUS2_fifo_b9 (1U << 7) -#define ST25R3916_REG_FIFO_STATUS2_fifo_b8 (1U << 6) -#define ST25R3916_REG_FIFO_STATUS2_fifo_b_mask (3U << 6) -#define ST25R3916_REG_FIFO_STATUS2_fifo_b_shift (6U) -#define ST25R3916_REG_FIFO_STATUS2_fifo_unf (1U << 5) -#define ST25R3916_REG_FIFO_STATUS2_fifo_ovr (1U << 4) -#define ST25R3916_REG_FIFO_STATUS2_fifo_lb2 (1U << 3) -#define ST25R3916_REG_FIFO_STATUS2_fifo_lb1 (1U << 2) -#define ST25R3916_REG_FIFO_STATUS2_fifo_lb0 (1U << 1) -#define ST25R3916_REG_FIFO_STATUS2_fifo_lb_mask (7U << 1) +#define ST25R3916_REG_FIFO_STATUS2_fifo_b9 (1U << 7) +#define ST25R3916_REG_FIFO_STATUS2_fifo_b8 (1U << 6) +#define ST25R3916_REG_FIFO_STATUS2_fifo_b_mask (3U << 6) +#define ST25R3916_REG_FIFO_STATUS2_fifo_b_shift (6U) +#define ST25R3916_REG_FIFO_STATUS2_fifo_unf (1U << 5) +#define ST25R3916_REG_FIFO_STATUS2_fifo_ovr (1U << 4) +#define ST25R3916_REG_FIFO_STATUS2_fifo_lb2 (1U << 3) +#define ST25R3916_REG_FIFO_STATUS2_fifo_lb1 (1U << 2) +#define ST25R3916_REG_FIFO_STATUS2_fifo_lb0 (1U << 1) +#define ST25R3916_REG_FIFO_STATUS2_fifo_lb_mask (7U << 1) #define ST25R3916_REG_FIFO_STATUS2_fifo_lb_shift (1U) -#define ST25R3916_REG_FIFO_STATUS2_np_lb (1U << 0) +#define ST25R3916_REG_FIFO_STATUS2_np_lb (1U << 0) -#define ST25R3916_REG_COLLISION_STATUS_c_byte3 (1U << 7) -#define ST25R3916_REG_COLLISION_STATUS_c_byte2 (1U << 6) -#define ST25R3916_REG_COLLISION_STATUS_c_byte1 (1U << 5) -#define ST25R3916_REG_COLLISION_STATUS_c_byte0 (1U << 4) -#define ST25R3916_REG_COLLISION_STATUS_c_byte_mask (0xfU << 4) +#define ST25R3916_REG_COLLISION_STATUS_c_byte3 (1U << 7) +#define ST25R3916_REG_COLLISION_STATUS_c_byte2 (1U << 6) +#define ST25R3916_REG_COLLISION_STATUS_c_byte1 (1U << 5) +#define ST25R3916_REG_COLLISION_STATUS_c_byte0 (1U << 4) +#define ST25R3916_REG_COLLISION_STATUS_c_byte_mask (0xfU << 4) #define ST25R3916_REG_COLLISION_STATUS_c_byte_shift (4U) -#define ST25R3916_REG_COLLISION_STATUS_c_bit2 (1U << 3) -#define ST25R3916_REG_COLLISION_STATUS_c_bit1 (1U << 2) -#define ST25R3916_REG_COLLISION_STATUS_c_bit0 (1U << 1) -#define ST25R3916_REG_COLLISION_STATUS_c_pb (1U << 0) -#define ST25R3916_REG_COLLISION_STATUS_c_bit_mask (3U << 1) -#define ST25R3916_REG_COLLISION_STATUS_c_bit_shift (1U) +#define ST25R3916_REG_COLLISION_STATUS_c_bit2 (1U << 3) +#define ST25R3916_REG_COLLISION_STATUS_c_bit1 (1U << 2) +#define ST25R3916_REG_COLLISION_STATUS_c_bit0 (1U << 1) +#define ST25R3916_REG_COLLISION_STATUS_c_pb (1U << 0) +#define ST25R3916_REG_COLLISION_STATUS_c_bit_mask (3U << 1) +#define ST25R3916_REG_COLLISION_STATUS_c_bit_shift (1U) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu (1U << 7) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu1 (1U << 6) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu2 (1U << 5) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu3 (1U << 4) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state3 (1U << 3) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state2 (1U << 2) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state1 (1U << 1) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state0 (1U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_power_off (0x0U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_idle (0x1U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l1 (0x2U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l2 (0x3U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu4 (0x4U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_active (0x5U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu6 (0x6U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu7 (0x7U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu8 (0x8U << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_halt (0x9U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu (1U << 7) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu1 (1U << 6) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu2 (1U << 5) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu3 (1U << 4) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state3 (1U << 3) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state2 (1U << 2) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state1 (1U << 1) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state0 (1U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_power_off (0x0U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_idle (0x1U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l1 (0x2U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l2 (0x3U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu4 (0x4U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_active (0x5U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu6 (0x6U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu7 (0x7U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu8 (0x8U << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_halt (0x9U << 0) #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l1_x (0xaU << 0) #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l2_x (0xbU << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu12 (0xcU << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_active_x (0xdU << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state_mask (0xfU << 0) -#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state_shift (0U) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu12 (0xcU << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_active_x (0xdU << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state_mask (0xfU << 0) +#define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state_shift (0U) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx4 (1U << 7) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx3 (1U << 6) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx2 (1U << 5) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx1 (1U << 4) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx0 (1U << 3) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx_mask (0x1fU << 3) -#define ST25R3916_REG_NUM_TX_BYTES2_ntx_shift (3U) -#define ST25R3916_REG_NUM_TX_BYTES2_nbtx2 (1U << 2) -#define ST25R3916_REG_NUM_TX_BYTES2_nbtx1 (1U << 1) -#define ST25R3916_REG_NUM_TX_BYTES2_nbtx0 (1U << 0) -#define ST25R3916_REG_NUM_TX_BYTES2_nbtx_mask (7U << 0) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx4 (1U << 7) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx3 (1U << 6) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx2 (1U << 5) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx1 (1U << 4) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx0 (1U << 3) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx_mask (0x1fU << 3) +#define ST25R3916_REG_NUM_TX_BYTES2_ntx_shift (3U) +#define ST25R3916_REG_NUM_TX_BYTES2_nbtx2 (1U << 2) +#define ST25R3916_REG_NUM_TX_BYTES2_nbtx1 (1U << 1) +#define ST25R3916_REG_NUM_TX_BYTES2_nbtx0 (1U << 0) +#define ST25R3916_REG_NUM_TX_BYTES2_nbtx_mask (7U << 0) #define ST25R3916_REG_NUM_TX_BYTES2_nbtx_shift (0U) -#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rfu1 (1U << 7) -#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rfu0 (1U << 6) -#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate1 (1U << 5) -#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate0 (1U << 4) -#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate_mask (0x3U << 4) +#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rfu1 (1U << 7) +#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rfu0 (1U << 6) +#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate1 (1U << 5) +#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate0 (1U << 4) +#define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate_mask (0x3U << 4) #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate_shift (4U) -#define ST25R3916_REG_NFCIP1_BIT_RATE_ppt2_on (1U << 3) -#define ST25R3916_REG_NFCIP1_BIT_RATE_gpt_on (1U << 2) -#define ST25R3916_REG_NFCIP1_BIT_RATE_nrt_on (1U << 1) -#define ST25R3916_REG_NFCIP1_BIT_RATE_mrt_on (1U << 0) +#define ST25R3916_REG_NFCIP1_BIT_RATE_ppt2_on (1U << 3) +#define ST25R3916_REG_NFCIP1_BIT_RATE_gpt_on (1U << 2) +#define ST25R3916_REG_NFCIP1_BIT_RATE_nrt_on (1U << 1) +#define ST25R3916_REG_NFCIP1_BIT_RATE_mrt_on (1U << 0) -#define ST25R3916_REG_TX_DRIVER_am_mod3 (1U << 7) -#define ST25R3916_REG_TX_DRIVER_am_mod2 (1U << 6) -#define ST25R3916_REG_TX_DRIVER_am_mod1 (1U << 5) -#define ST25R3916_REG_TX_DRIVER_am_mod0 (1U << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_5percent (0x0U << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_6percent (0x1U << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_7percent (0x2U << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_8percent (0x3U << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_9percent (0x4U << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod3 (1U << 7) +#define ST25R3916_REG_TX_DRIVER_am_mod2 (1U << 6) +#define ST25R3916_REG_TX_DRIVER_am_mod1 (1U << 5) +#define ST25R3916_REG_TX_DRIVER_am_mod0 (1U << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod_5percent (0x0U << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod_6percent (0x1U << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod_7percent (0x2U << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod_8percent (0x3U << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod_9percent (0x4U << 4) #define ST25R3916_REG_TX_DRIVER_am_mod_10percent (0x5U << 4) #define ST25R3916_REG_TX_DRIVER_am_mod_11percent (0x6U << 4) #define ST25R3916_REG_TX_DRIVER_am_mod_12percent (0x7U << 4) @@ -633,78 +633,78 @@ extern "C" { #define ST25R3916_REG_TX_DRIVER_am_mod_22percent (0xdU << 4) #define ST25R3916_REG_TX_DRIVER_am_mod_26percent (0xeU << 4) #define ST25R3916_REG_TX_DRIVER_am_mod_40percent (0xfU << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_mask (0xfU << 4) -#define ST25R3916_REG_TX_DRIVER_am_mod_shift (4U) -#define ST25R3916_REG_TX_DRIVER_d_res3 (1U << 3) -#define ST25R3916_REG_TX_DRIVER_d_res2 (1U << 2) -#define ST25R3916_REG_TX_DRIVER_d_res1 (1U << 1) -#define ST25R3916_REG_TX_DRIVER_d_res0 (1U << 0) -#define ST25R3916_REG_TX_DRIVER_d_res_mask (0xfU << 0) -#define ST25R3916_REG_TX_DRIVER_d_res_shift (0U) +#define ST25R3916_REG_TX_DRIVER_am_mod_mask (0xfU << 4) +#define ST25R3916_REG_TX_DRIVER_am_mod_shift (4U) +#define ST25R3916_REG_TX_DRIVER_d_res3 (1U << 3) +#define ST25R3916_REG_TX_DRIVER_d_res2 (1U << 2) +#define ST25R3916_REG_TX_DRIVER_d_res1 (1U << 1) +#define ST25R3916_REG_TX_DRIVER_d_res0 (1U << 0) +#define ST25R3916_REG_TX_DRIVER_d_res_mask (0xfU << 0) +#define ST25R3916_REG_TX_DRIVER_d_res_shift (0U) -#define ST25R3916_REG_PT_MOD_ptm_res3 (1U << 7) -#define ST25R3916_REG_PT_MOD_ptm_res2 (1U << 6) -#define ST25R3916_REG_PT_MOD_ptm_res1 (1U << 5) -#define ST25R3916_REG_PT_MOD_ptm_res0 (1U << 4) -#define ST25R3916_REG_PT_MOD_ptm_res_mask (0xfU << 4) +#define ST25R3916_REG_PT_MOD_ptm_res3 (1U << 7) +#define ST25R3916_REG_PT_MOD_ptm_res2 (1U << 6) +#define ST25R3916_REG_PT_MOD_ptm_res1 (1U << 5) +#define ST25R3916_REG_PT_MOD_ptm_res0 (1U << 4) +#define ST25R3916_REG_PT_MOD_ptm_res_mask (0xfU << 4) #define ST25R3916_REG_PT_MOD_ptm_res_shift (4U) -#define ST25R3916_REG_PT_MOD_pt_res3 (1U << 3) -#define ST25R3916_REG_PT_MOD_pt_res2 (1U << 2) -#define ST25R3916_REG_PT_MOD_pt_res1 (1U << 1) -#define ST25R3916_REG_PT_MOD_pt_res0 (1U << 0) -#define ST25R3916_REG_PT_MOD_pt_res_mask (0xfU << 0) -#define ST25R3916_REG_PT_MOD_pt_res_shift (0U) +#define ST25R3916_REG_PT_MOD_pt_res3 (1U << 3) +#define ST25R3916_REG_PT_MOD_pt_res2 (1U << 2) +#define ST25R3916_REG_PT_MOD_pt_res1 (1U << 1) +#define ST25R3916_REG_PT_MOD_pt_res0 (1U << 0) +#define ST25R3916_REG_PT_MOD_pt_res_mask (0xfU << 0) +#define ST25R3916_REG_PT_MOD_pt_res_shift (0U) #define ST25R3916_REG_AUX_MOD_dis_reg_am (1U << 7) #define ST25R3916_REG_AUX_MOD_lm_ext_pol (1U << 6) -#define ST25R3916_REG_AUX_MOD_lm_ext (1U << 5) -#define ST25R3916_REG_AUX_MOD_lm_dri (1U << 4) -#define ST25R3916_REG_AUX_MOD_res_am (1U << 3) -#define ST25R3916_REG_AUX_MOD_rfu2 (1U << 2) -#define ST25R3916_REG_AUX_MOD_rfu1 (1U << 1) -#define ST25R3916_REG_AUX_MOD_rfu0 (1U << 0) +#define ST25R3916_REG_AUX_MOD_lm_ext (1U << 5) +#define ST25R3916_REG_AUX_MOD_lm_dri (1U << 4) +#define ST25R3916_REG_AUX_MOD_res_am (1U << 3) +#define ST25R3916_REG_AUX_MOD_rfu2 (1U << 2) +#define ST25R3916_REG_AUX_MOD_rfu1 (1U << 1) +#define ST25R3916_REG_AUX_MOD_rfu0 (1U << 0) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t3 (1U << 7) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t2 (1U << 6) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t1 (1U << 5) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t0 (1U << 4) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_mask (0xfU << 4) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_shift (4U) -#define ST25R3916_REG_TX_DRIVER_TIMING_rfu (1U << 3) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m2 (1U << 2) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m1 (1U << 1) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m0 (1U << 0) -#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m_mask (0x7U << 0) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t3 (1U << 7) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t2 (1U << 6) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t1 (1U << 5) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t0 (1U << 4) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_mask (0xfU << 4) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_shift (4U) +#define ST25R3916_REG_TX_DRIVER_TIMING_rfu (1U << 3) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m2 (1U << 2) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m1 (1U << 1) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m0 (1U << 0) +#define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m_mask (0x7U << 0) #define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m_shift (0U) -#define ST25R3916_REG_RES_AM_MOD_fa3_f (1U << 7) -#define ST25R3916_REG_RES_AM_MOD_md_res6 (1U << 6) -#define ST25R3916_REG_RES_AM_MOD_md_res5 (1U << 5) -#define ST25R3916_REG_RES_AM_MOD_md_res4 (1U << 4) -#define ST25R3916_REG_RES_AM_MOD_md_res3 (1U << 3) -#define ST25R3916_REG_RES_AM_MOD_md_res2 (1U << 2) -#define ST25R3916_REG_RES_AM_MOD_md_res1 (1U << 1) -#define ST25R3916_REG_RES_AM_MOD_md_res0 (1U << 0) -#define ST25R3916_REG_RES_AM_MOD_md_res_mask (0x7FU << 0) +#define ST25R3916_REG_RES_AM_MOD_fa3_f (1U << 7) +#define ST25R3916_REG_RES_AM_MOD_md_res6 (1U << 6) +#define ST25R3916_REG_RES_AM_MOD_md_res5 (1U << 5) +#define ST25R3916_REG_RES_AM_MOD_md_res4 (1U << 4) +#define ST25R3916_REG_RES_AM_MOD_md_res3 (1U << 3) +#define ST25R3916_REG_RES_AM_MOD_md_res2 (1U << 2) +#define ST25R3916_REG_RES_AM_MOD_md_res1 (1U << 1) +#define ST25R3916_REG_RES_AM_MOD_md_res0 (1U << 0) +#define ST25R3916_REG_RES_AM_MOD_md_res_mask (0x7FU << 0) #define ST25R3916_REG_RES_AM_MOD_md_res_shift (0U) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r3 (1U << 7) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r2 (1U << 6) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r1 (1U << 5) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r0 (1U << 4) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_mask (0xfU << 4) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r3 (1U << 7) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r2 (1U << 6) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r1 (1U << 5) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r0 (1U << 4) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_mask (0xfU << 4) #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_shift (4U) -#define ST25R3916_REG_TX_DRIVER_STATUS_rfu (1U << 3) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r2 (1U << 2) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r1 (1U << 1) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r0 (1U << 0) -#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_mask (0x7U << 0) +#define ST25R3916_REG_TX_DRIVER_STATUS_rfu (1U << 3) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r2 (1U << 2) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r1 (1U << 1) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r0 (1U << 0) +#define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_mask (0x7U << 0) #define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_shift (0U) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l2a (1U << 6) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l1a (1U << 5) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l0a (1U << 4) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_75mV (0x0U << 4) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l2a (1U << 6) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l1a (1U << 5) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l0a (1U << 4) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_75mV (0x0U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_105mV (0x1U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_150mV (0x2U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_205mV (0x3U << 4) @@ -712,13 +712,13 @@ extern "C" { #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_400mV (0x5U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_560mV (0x6U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_800mV (0x7U << 4) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_mask (7U << 4) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_mask (7U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_shift (4U) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t3a (1U << 3) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t2a (1U << 2) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t1a (1U << 1) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t0a (1U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_75mV (0x0U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t3a (1U << 3) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t2a (1U << 2) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t1a (1U << 1) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t0a (1U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_75mV (0x0U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_105mV (0x1U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_150mV (0x2U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_205mV (0x3U << 0) @@ -726,21 +726,21 @@ extern "C" { #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_400mV (0x5U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_560mV (0x6U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_800mV (0x7U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_25mV (0x8U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_33mV (0x9U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_47mV (0xAU << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_64mV (0xBU << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_90mV (0xCU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_25mV (0x8U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_33mV (0x9U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_47mV (0xAU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_64mV (0xBU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_90mV (0xCU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_125mV (0xDU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_175mV (0xEU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_250mV (0xFU << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_mask (0xfU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_mask (0xfU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_shift (0U) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l2d (1U << 6) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l1d (1U << 5) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l0d (1U << 4) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_75mV (0x0U << 4) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l2d (1U << 6) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l1d (1U << 5) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l0d (1U << 4) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_75mV (0x0U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_105mV (0x1U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_150mV (0x2U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_205mV (0x3U << 4) @@ -748,13 +748,13 @@ extern "C" { #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_400mV (0x5U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_560mV (0x6U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_800mV (0x7U << 4) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_mask (7U << 4) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_mask (7U << 4) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_shift (4U) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t3d (1U << 3) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t2d (1U << 2) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t1d (1U << 1) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t0d (1U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_75mV (0x0U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t3d (1U << 3) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t2d (1U << 2) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t1d (1U << 1) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t0d (1U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_75mV (0x0U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_105mV (0x1U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_150mV (0x2U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_205mV (0x3U << 0) @@ -762,112 +762,112 @@ extern "C" { #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_400mV (0x5U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_560mV (0x6U << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_800mV (0x7U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_25mV (0x8U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_33mV (0x9U << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_47mV (0xAU << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_64mV (0xBU << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_90mV (0xCU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_25mV (0x8U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_33mV (0x9U << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_47mV (0xAU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_64mV (0xBU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_90mV (0xCU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_125mV (0xDU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_175mV (0xEU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_250mV (0xFU << 0) -#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_mask (0xfU << 0) +#define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_mask (0xfU << 0) #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_shift (0U) -#define ST25R3916_REG_REGULATOR_CONTROL_reg_s (1U << 7) -#define ST25R3916_REG_REGULATOR_CONTROL_rege_3 (1U << 6) -#define ST25R3916_REG_REGULATOR_CONTROL_rege_2 (1U << 5) -#define ST25R3916_REG_REGULATOR_CONTROL_rege_1 (1U << 4) -#define ST25R3916_REG_REGULATOR_CONTROL_rege_0 (1U << 3) -#define ST25R3916_REG_REGULATOR_CONTROL_rege_mask (0xfU << 3) -#define ST25R3916_REG_REGULATOR_CONTROL_rege_shift (3U) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv2 (2U << 2) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv1 (1U << 1) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv0 (1U << 0) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd (0U) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_a (1U) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_d (2U) +#define ST25R3916_REG_REGULATOR_CONTROL_reg_s (1U << 7) +#define ST25R3916_REG_REGULATOR_CONTROL_rege_3 (1U << 6) +#define ST25R3916_REG_REGULATOR_CONTROL_rege_2 (1U << 5) +#define ST25R3916_REG_REGULATOR_CONTROL_rege_1 (1U << 4) +#define ST25R3916_REG_REGULATOR_CONTROL_rege_0 (1U << 3) +#define ST25R3916_REG_REGULATOR_CONTROL_rege_mask (0xfU << 3) +#define ST25R3916_REG_REGULATOR_CONTROL_rege_shift (3U) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv2 (2U << 2) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv1 (1U << 1) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv0 (1U << 0) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd (0U) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_a (1U) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_d (2U) #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_rf (3U) #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_am (4U) -#define ST25R3916_REG_REGULATOR_CONTROL_rfu (5U) -#define ST25R3916_REG_REGULATOR_CONTROL_rfu1 (6U) -#define ST25R3916_REG_REGULATOR_CONTROL_rfu2 (7U) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_mask (7U) -#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_shift (0U) +#define ST25R3916_REG_REGULATOR_CONTROL_rfu (5U) +#define ST25R3916_REG_REGULATOR_CONTROL_rfu1 (6U) +#define ST25R3916_REG_REGULATOR_CONTROL_rfu2 (7U) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_mask (7U) +#define ST25R3916_REG_REGULATOR_CONTROL_mpsv_shift (0U) -#define ST25R3916_REG_REGULATOR_RESULT_reg_3 (1U << 7) -#define ST25R3916_REG_REGULATOR_RESULT_reg_2 (1U << 6) -#define ST25R3916_REG_REGULATOR_RESULT_reg_1 (1U << 5) -#define ST25R3916_REG_REGULATOR_RESULT_reg_0 (1U << 4) -#define ST25R3916_REG_REGULATOR_RESULT_reg_mask (0xfU << 4) +#define ST25R3916_REG_REGULATOR_RESULT_reg_3 (1U << 7) +#define ST25R3916_REG_REGULATOR_RESULT_reg_2 (1U << 6) +#define ST25R3916_REG_REGULATOR_RESULT_reg_1 (1U << 5) +#define ST25R3916_REG_REGULATOR_RESULT_reg_0 (1U << 4) +#define ST25R3916_REG_REGULATOR_RESULT_reg_mask (0xfU << 4) #define ST25R3916_REG_REGULATOR_RESULT_reg_shift (4U) -#define ST25R3916_REG_REGULATOR_RESULT_i_lim (1U << 0) +#define ST25R3916_REG_REGULATOR_RESULT_i_lim (1U << 0) -#define ST25R3916_REG_RSSI_RESULT_rssi_am_3 (1U << 7) -#define ST25R3916_REG_RSSI_RESULT_rssi_am_2 (1U << 6) -#define ST25R3916_REG_RSSI_RESULT_rssi_am_1 (1U << 5) -#define ST25R3916_REG_RSSI_RESULT_rssi_am_0 (1U << 4) -#define ST25R3916_REG_RSSI_RESULT_rssi_am_mask (0xfU << 4) +#define ST25R3916_REG_RSSI_RESULT_rssi_am_3 (1U << 7) +#define ST25R3916_REG_RSSI_RESULT_rssi_am_2 (1U << 6) +#define ST25R3916_REG_RSSI_RESULT_rssi_am_1 (1U << 5) +#define ST25R3916_REG_RSSI_RESULT_rssi_am_0 (1U << 4) +#define ST25R3916_REG_RSSI_RESULT_rssi_am_mask (0xfU << 4) #define ST25R3916_REG_RSSI_RESULT_rssi_am_shift (4U) -#define ST25R3916_REG_RSSI_RESULT_rssi_pm3 (1U << 3) -#define ST25R3916_REG_RSSI_RESULT_rssi_pm2 (1U << 2) -#define ST25R3916_REG_RSSI_RESULT_rssi_pm1 (1U << 1) -#define ST25R3916_REG_RSSI_RESULT_rssi_pm0 (1U << 0) -#define ST25R3916_REG_RSSI_RESULT_rssi_pm_mask (0xfU << 0) +#define ST25R3916_REG_RSSI_RESULT_rssi_pm3 (1U << 3) +#define ST25R3916_REG_RSSI_RESULT_rssi_pm2 (1U << 2) +#define ST25R3916_REG_RSSI_RESULT_rssi_pm1 (1U << 1) +#define ST25R3916_REG_RSSI_RESULT_rssi_pm0 (1U << 0) +#define ST25R3916_REG_RSSI_RESULT_rssi_pm_mask (0xfU << 0) #define ST25R3916_REG_RSSI_RESULT_rssi_pm_shift (0U) -#define ST25R3916_REG_GAIN_RED_STATE_gs_am_3 (1U << 7) -#define ST25R3916_REG_GAIN_RED_STATE_gs_am_2 (1U << 6) -#define ST25R3916_REG_GAIN_RED_STATE_gs_am_1 (1U << 5) -#define ST25R3916_REG_GAIN_RED_STATE_gs_am_0 (1U << 4) -#define ST25R3916_REG_GAIN_RED_STATE_gs_am_mask (0xfU << 4) +#define ST25R3916_REG_GAIN_RED_STATE_gs_am_3 (1U << 7) +#define ST25R3916_REG_GAIN_RED_STATE_gs_am_2 (1U << 6) +#define ST25R3916_REG_GAIN_RED_STATE_gs_am_1 (1U << 5) +#define ST25R3916_REG_GAIN_RED_STATE_gs_am_0 (1U << 4) +#define ST25R3916_REG_GAIN_RED_STATE_gs_am_mask (0xfU << 4) #define ST25R3916_REG_GAIN_RED_STATE_gs_am_shift (4U) -#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_3 (1U << 3) -#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_2 (1U << 2) -#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_1 (1U << 1) -#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_0 (1U << 0) -#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_mask (0xfU << 0) +#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_3 (1U << 3) +#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_2 (1U << 2) +#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_1 (1U << 1) +#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_0 (1U << 0) +#define ST25R3916_REG_GAIN_RED_STATE_gs_pm_mask (0xfU << 0) #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_shift (0U) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal4 (1U << 7) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal3 (1U << 6) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal2 (1U << 5) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal1 (1U << 4) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal0 (1U << 3) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal_mask (0x1fU << 3) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal4 (1U << 7) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal3 (1U << 6) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal2 (1U << 5) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal1 (1U << 4) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal0 (1U << 3) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal_mask (0x1fU << 3) #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal_shift (3U) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g2 (1U << 2) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g1 (1U << 1) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g0 (1U << 0) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g_mask (7U << 0) -#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g_shift (0U) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g2 (1U << 2) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g1 (1U << 1) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g0 (1U << 0) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g_mask (7U << 0) +#define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g_shift (0U) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal4 (1U << 7) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal3 (1U << 6) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal2 (1U << 5) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal1 (1U << 4) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal0 (1U << 3) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_mask (0x1fU << 3) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal4 (1U << 7) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal3 (1U << 6) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal2 (1U << 5) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal1 (1U << 4) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal0 (1U << 3) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_mask (0x1fU << 3) #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_shift (3U) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_end (1U << 2) -#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_err (1U << 1) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_end (1U << 2) +#define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_err (1U << 1) -#define ST25R3916_REG_AUX_DISPLAY_a_cha (1U << 7) -#define ST25R3916_REG_AUX_DISPLAY_efd_o (1U << 6) -#define ST25R3916_REG_AUX_DISPLAY_tx_on (1U << 5) -#define ST25R3916_REG_AUX_DISPLAY_osc_ok (1U << 4) -#define ST25R3916_REG_AUX_DISPLAY_rx_on (1U << 3) -#define ST25R3916_REG_AUX_DISPLAY_rx_act (1U << 2) +#define ST25R3916_REG_AUX_DISPLAY_a_cha (1U << 7) +#define ST25R3916_REG_AUX_DISPLAY_efd_o (1U << 6) +#define ST25R3916_REG_AUX_DISPLAY_tx_on (1U << 5) +#define ST25R3916_REG_AUX_DISPLAY_osc_ok (1U << 4) +#define ST25R3916_REG_AUX_DISPLAY_rx_on (1U << 3) +#define ST25R3916_REG_AUX_DISPLAY_rx_act (1U << 2) #define ST25R3916_REG_AUX_DISPLAY_en_peer (1U << 1) -#define ST25R3916_REG_AUX_DISPLAY_en_ac (1U << 0) +#define ST25R3916_REG_AUX_DISPLAY_en_ac (1U << 0) -#define ST25R3916_REG_OVERSHOOT_CONF1_ov_tx_mode1 (1U << 7) -#define ST25R3916_REG_OVERSHOOT_CONF1_ov_tx_mode0 (1U << 6) +#define ST25R3916_REG_OVERSHOOT_CONF1_ov_tx_mode1 (1U << 7) +#define ST25R3916_REG_OVERSHOOT_CONF1_ov_tx_mode0 (1U << 6) #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern13 (1U << 5) #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern12 (1U << 4) #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern11 (1U << 3) #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern10 (1U << 2) -#define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern9 (1U << 1) -#define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern8 (1U << 0) +#define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern9 (1U << 1) +#define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern8 (1U << 0) #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern7 (1U << 7) #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern6 (1U << 6) @@ -878,14 +878,14 @@ extern "C" { #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern1 (1U << 1) #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern0 (1U << 0) -#define ST25R3916_REG_UNDERSHOOT_CONF1_un_tx_mode1 (1U << 7) -#define ST25R3916_REG_UNDERSHOOT_CONF1_un_tx_mode0 (1U << 6) +#define ST25R3916_REG_UNDERSHOOT_CONF1_un_tx_mode1 (1U << 7) +#define ST25R3916_REG_UNDERSHOOT_CONF1_un_tx_mode0 (1U << 6) #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern13 (1U << 5) #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern12 (1U << 4) #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern11 (1U << 3) #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern10 (1U << 2) -#define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern9 (1U << 1) -#define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern8 (1U << 0) +#define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern9 (1U << 1) +#define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern8 (1U << 0) #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern7 (1U << 7) #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern6 (1U << 6) @@ -896,70 +896,70 @@ extern "C" { #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern1 (1U << 1) #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern0 (1U << 0) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wur (1U << 7) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wut2 (1U << 6) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wut1 (1U << 5) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wut0 (1U << 4) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wut_mask (7U << 4) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wur (1U << 7) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wut2 (1U << 6) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wut1 (1U << 5) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wut0 (1U << 4) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wut_mask (7U << 4) #define ST25R3916_REG_WUP_TIMER_CONTROL_wut_shift (4U) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wto (1U << 3) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wam (1U << 2) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wph (1U << 1) -#define ST25R3916_REG_WUP_TIMER_CONTROL_wcap (1U << 0) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wto (1U << 3) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wam (1U << 2) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wph (1U << 1) +#define ST25R3916_REG_WUP_TIMER_CONTROL_wcap (1U << 0) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d3 (1U << 7) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d2 (1U << 6) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d1 (1U << 5) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d0 (1U << 4) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d_mask (0xfU << 4) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d_shift (4U) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aam (1U << 3) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew1 (1U << 2) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew0 (1U << 1) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew_mask (0x3U << 1) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d3 (1U << 7) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d2 (1U << 6) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d1 (1U << 5) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d0 (1U << 4) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d_mask (0xfU << 4) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d_shift (4U) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aam (1U << 3) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew1 (1U << 2) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew0 (1U << 1) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew_mask (0x3U << 1) #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew_shift (1U) -#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_ae (1U << 0) +#define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_ae (1U << 0) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d3 (1U << 7) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d2 (1U << 6) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d1 (1U << 5) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d0 (1U << 4) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d_mask (0xfU << 4) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d_shift (4U) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aam (1U << 3) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew1 (1U << 2) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew0 (1U << 1) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew_mask (0x3U << 1) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d3 (1U << 7) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d2 (1U << 6) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d1 (1U << 5) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d0 (1U << 4) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d_mask (0xfU << 4) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d_shift (4U) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aam (1U << 3) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew1 (1U << 2) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew0 (1U << 1) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew_mask (0x3U << 1) #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew_shift (1U) -#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_ae (1U << 0) +#define ST25R3916_REG_PHASE_MEASURE_CONF_pm_ae (1U << 0) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d3 (1U << 7) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d2 (1U << 6) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d1 (1U << 5) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d0 (1U << 4) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d_mask (0xfU << 4) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d_shift (4U) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aam (1U << 3) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew1 (1U << 2) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew0 (1U << 1) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew_mask (0x3U << 1) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d3 (1U << 7) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d2 (1U << 6) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d1 (1U << 5) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d0 (1U << 4) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d_mask (0xfU << 4) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d_shift (4U) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aam (1U << 3) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew1 (1U << 2) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew0 (1U << 1) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew_mask (0x3U << 1) #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew_shift (1U) -#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_ae (1U << 0) +#define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_ae (1U << 0) -#define ST25R3916_REG_IC_IDENTITY_ic_type4 (1U << 7) -#define ST25R3916_REG_IC_IDENTITY_ic_type3 (1U << 6) -#define ST25R3916_REG_IC_IDENTITY_ic_type2 (1U << 5) -#define ST25R3916_REG_IC_IDENTITY_ic_type1 (1U << 4) -#define ST25R3916_REG_IC_IDENTITY_ic_type0 (1U << 3) +#define ST25R3916_REG_IC_IDENTITY_ic_type4 (1U << 7) +#define ST25R3916_REG_IC_IDENTITY_ic_type3 (1U << 6) +#define ST25R3916_REG_IC_IDENTITY_ic_type2 (1U << 5) +#define ST25R3916_REG_IC_IDENTITY_ic_type1 (1U << 4) +#define ST25R3916_REG_IC_IDENTITY_ic_type0 (1U << 3) #define ST25R3916_REG_IC_IDENTITY_ic_type_st25r3916 (5U << 3) -#define ST25R3916_REG_IC_IDENTITY_ic_type_mask (0x1fU << 3) -#define ST25R3916_REG_IC_IDENTITY_ic_type_shift (3U) -#define ST25R3916_REG_IC_IDENTITY_ic_rev2 (1U << 2) -#define ST25R3916_REG_IC_IDENTITY_ic_rev1 (1U << 1) -#define ST25R3916_REG_IC_IDENTITY_ic_rev0 (1U << 0) -#define ST25R3916_REG_IC_IDENTITY_ic_rev_v0 (0U << 0) -#define ST25R3916_REG_IC_IDENTITY_ic_rev_mask (7U << 0) -#define ST25R3916_REG_IC_IDENTITY_ic_rev_shift (0U) +#define ST25R3916_REG_IC_IDENTITY_ic_type_mask (0x1fU << 3) +#define ST25R3916_REG_IC_IDENTITY_ic_type_shift (3U) +#define ST25R3916_REG_IC_IDENTITY_ic_rev2 (1U << 2) +#define ST25R3916_REG_IC_IDENTITY_ic_rev1 (1U << 1) +#define ST25R3916_REG_IC_IDENTITY_ic_rev0 (1U << 0) +#define ST25R3916_REG_IC_IDENTITY_ic_rev_v0 (0U << 0) +#define ST25R3916_REG_IC_IDENTITY_ic_rev_mask (7U << 0) +#define ST25R3916_REG_IC_IDENTITY_ic_rev_shift (0U) /** Read register * diff --git a/lib/flipper_format/flipper_format_stream.c b/lib/flipper_format/flipper_format_stream.c index 405b819a7..83e77a4e2 100644 --- a/lib/flipper_format/flipper_format_stream.c +++ b/lib/flipper_format/flipper_format_stream.c @@ -122,7 +122,11 @@ bool flipper_format_stream_seek_to_key(Stream* stream, const char* key, bool str } static bool flipper_format_stream_read_value(Stream* stream, FuriString* value, bool* last) { - enum { LeadingSpace, ReadValue, TrailingSpace } state = LeadingSpace; + enum { + LeadingSpace, + ReadValue, + TrailingSpace + } state = LeadingSpace; const size_t buffer_size = 32; uint8_t buffer[buffer_size]; bool result = false; diff --git a/lib/ibutton/ibutton_protocols.c b/lib/ibutton/ibutton_protocols.c index 84fcccd71..ecd5f9a0d 100644 --- a/lib/ibutton/ibutton_protocols.c +++ b/lib/ibutton/ibutton_protocols.c @@ -17,8 +17,8 @@ iButtonProtocolGroupInfo info; \ ibutton_protocols_get_group_by_id(protocols, (id), &info); -#define GROUP_BASE (info.base) -#define GROUP_DATA (info.group) +#define GROUP_BASE (info.base) +#define GROUP_DATA (info.group) #define PROTOCOL_ID (info.id) struct iButtonProtocols { diff --git a/lib/ibutton/protocols/blanks/rw1990.c b/lib/ibutton/protocols/blanks/rw1990.c index f86e43d99..d8017ca83 100644 --- a/lib/ibutton/protocols/blanks/rw1990.c +++ b/lib/ibutton/protocols/blanks/rw1990.c @@ -3,12 +3,12 @@ #include #define RW1990_1_CMD_WRITE_RECORD_FLAG 0xD1 -#define RW1990_1_CMD_READ_RECORD_FLAG 0xB5 -#define RW1990_1_CMD_WRITE_ROM 0xD5 +#define RW1990_1_CMD_READ_RECORD_FLAG 0xB5 +#define RW1990_1_CMD_WRITE_ROM 0xD5 #define RW1990_2_CMD_WRITE_RECORD_FLAG 0x1D -#define RW1990_2_CMD_READ_RECORD_FLAG 0x1E -#define RW1990_2_CMD_WRITE_ROM 0xD5 +#define RW1990_2_CMD_READ_RECORD_FLAG 0x1E +#define RW1990_2_CMD_WRITE_ROM 0xD5 #define DS1990_CMD_READ_ROM 0x33 diff --git a/lib/ibutton/protocols/blanks/tm2004.c b/lib/ibutton/protocols/blanks/tm2004.c index b020a218d..a275dda0a 100644 --- a/lib/ibutton/protocols/blanks/tm2004.c +++ b/lib/ibutton/protocols/blanks/tm2004.c @@ -2,10 +2,10 @@ #include -#define TM2004_CMD_READ_STATUS 0xAA -#define TM2004_CMD_READ_MEMORY 0xF0 -#define TM2004_CMD_WRITE_ROM 0x3C -#define TM2004_CMD_FINALIZATION 0x35 +#define TM2004_CMD_READ_STATUS 0xAA +#define TM2004_CMD_READ_MEMORY 0xF0 +#define TM2004_CMD_WRITE_ROM 0x3C +#define TM2004_CMD_FINALIZATION 0x35 #define TM2004_ANSWER_READ_MEMORY 0xF5 bool tm2004_write(OneWireHost* host, const uint8_t* data, size_t data_size) { diff --git a/lib/ibutton/protocols/dallas/dallas_common.c b/lib/ibutton/protocols/dallas/dallas_common.c index 7ce12f7a0..e9e655717 100644 --- a/lib/ibutton/protocols/dallas/dallas_common.c +++ b/lib/ibutton/protocols/dallas/dallas_common.c @@ -9,12 +9,12 @@ #define DALLAS_COMMON_ROM_DATA_KEY_V2 "Rom Data" #define DALLAS_COMMON_COPY_SCRATCH_MIN_TIMEOUT_US 5U -#define DALLAS_COMMON_COPY_SCRATCH_POLL_COUNT 20U +#define DALLAS_COMMON_COPY_SCRATCH_POLL_COUNT 20U #define DALLAS_COMMON_END_ADDRESS_MASK 0x01F -#define DALLAS_COMMON_STATUS_FLAG_PF (1U << 5) -#define DALLAS_COMMON_STATUS_FLAG_OF (1U << 6) -#define DALLAS_COMMON_STATUS_FLAG_AA (1U << 7) +#define DALLAS_COMMON_STATUS_FLAG_PF (1U << 5) +#define DALLAS_COMMON_STATUS_FLAG_OF (1U << 6) +#define DALLAS_COMMON_STATUS_FLAG_AA (1U << 7) #define DALLAS_COMMON_BRIEF_HEAD_COUNT 4U #define DALLAS_COMMON_BRIEF_TAIL_COUNT 3U diff --git a/lib/ibutton/protocols/dallas/dallas_common.h b/lib/ibutton/protocols/dallas/dallas_common.h index 90fec3e28..3df0e1c96 100644 --- a/lib/ibutton/protocols/dallas/dallas_common.h +++ b/lib/ibutton/protocols/dallas/dallas_common.h @@ -7,19 +7,19 @@ #define DALLAS_COMMON_MANUFACTURER_NAME "Dallas" -#define DALLAS_COMMON_CMD_READ_ROM 0x33U -#define DALLAS_COMMON_CMD_MATCH_ROM 0x55U -#define DALLAS_COMMON_CMD_SKIP_ROM 0xCCU +#define DALLAS_COMMON_CMD_READ_ROM 0x33U +#define DALLAS_COMMON_CMD_MATCH_ROM 0x55U +#define DALLAS_COMMON_CMD_SKIP_ROM 0xCCU #define DALLAS_COMMON_CMD_COND_SEARCH 0xECU -#define DALLAS_COMMON_CMD_SEARCH_ROM 0xF0U +#define DALLAS_COMMON_CMD_SEARCH_ROM 0xF0U -#define DALLAS_COMMON_CMD_READ_SCRATCH 0xAAU +#define DALLAS_COMMON_CMD_READ_SCRATCH 0xAAU #define DALLAS_COMMON_CMD_WRITE_SCRATCH 0x0FU -#define DALLAS_COMMON_CMD_COPY_SCRATCH 0x55U +#define DALLAS_COMMON_CMD_COPY_SCRATCH 0x55U #define DALLAS_COMMON_CMD_READ_MEM 0xF0U -#define DALLAS_COMMON_CMD_OVERDRIVE_SKIP_ROM 0x3CU +#define DALLAS_COMMON_CMD_OVERDRIVE_SKIP_ROM 0x3CU #define DALLAS_COMMON_CMD_OVERDRIVE_MATCH_ROM 0x69U typedef enum { diff --git a/lib/ibutton/protocols/dallas/protocol_ds1971.c b/lib/ibutton/protocols/dallas/protocol_ds1971.c index 6d147d28d..64920f6ac 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1971.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1971.c @@ -8,14 +8,14 @@ #define DS1971_FAMILY_CODE 0x14U #define DS1971_FAMILY_NAME "DS1971" -#define DS1971_EEPROM_DATA_SIZE 32U -#define DS1971_SRAM_PAGE_SIZE 32U +#define DS1971_EEPROM_DATA_SIZE 32U +#define DS1971_SRAM_PAGE_SIZE 32U #define DS1971_COPY_SCRATCH_DELAY_US 250U #define DS1971_DATA_BYTE_COUNT 4U #define DS1971_EEPROM_DATA_KEY "Eeprom Data" -#define DS1971_MEMORY_TYPE "EEPROM" +#define DS1971_MEMORY_TYPE "EEPROM" #define DS1971_CMD_FINALIZATION 0xA5 diff --git a/lib/ibutton/protocols/dallas/protocol_ds1992.c b/lib/ibutton/protocols/dallas/protocol_ds1992.c index 483d9827f..0b6cd4fca 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1992.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1992.c @@ -10,14 +10,14 @@ #define DS1992_FAMILY_CODE 0x08U #define DS1992_FAMILY_NAME "DS1992" -#define DS1992_SRAM_DATA_SIZE 128U -#define DS1992_SRAM_PAGE_SIZE 4U +#define DS1992_SRAM_DATA_SIZE 128U +#define DS1992_SRAM_PAGE_SIZE 4U #define DS1992_COPY_SCRATCH_TIMEOUT_US 100U #define DS1992_DATA_BYTE_COUNT 4U #define DS1992_SRAM_DATA_KEY "Sram Data" -#define DS1992_MEMORY_TYPE "SRAM" +#define DS1992_MEMORY_TYPE "SRAM" typedef struct { OneWireSlave* bus; diff --git a/lib/ibutton/protocols/dallas/protocol_ds1996.c b/lib/ibutton/protocols/dallas/protocol_ds1996.c index 157dc601a..d78a303f8 100644 --- a/lib/ibutton/protocols/dallas/protocol_ds1996.c +++ b/lib/ibutton/protocols/dallas/protocol_ds1996.c @@ -8,14 +8,14 @@ #define DS1996_FAMILY_CODE 0x0CU #define DS1996_FAMILY_NAME "DS1996" -#define DS1996_SRAM_DATA_SIZE 8192U -#define DS1996_SRAM_PAGE_SIZE 32U +#define DS1996_SRAM_DATA_SIZE 8192U +#define DS1996_SRAM_PAGE_SIZE 32U #define DS1996_COPY_SCRATCH_TIMEOUT_US 100U #define DS1996_DATA_BYTE_COUNT 4U #define DS1996_SRAM_DATA_KEY "Sram Data" -#define DS1996_MEMORY_TYPE "SRAM" +#define DS1996_MEMORY_TYPE "SRAM" typedef struct { OneWireSlave* bus; diff --git a/lib/ibutton/protocols/misc/protocol_cyfral.c b/lib/ibutton/protocols/misc/protocol_cyfral.c index e43d0c6ad..2f9f8bc74 100644 --- a/lib/ibutton/protocols/misc/protocol_cyfral.c +++ b/lib/ibutton/protocols/misc/protocol_cyfral.c @@ -4,11 +4,11 @@ #include "protocol_cyfral.h" #define CYFRAL_DATA_SIZE sizeof(uint16_t) -#define CYFRAL_PERIOD (125 * furi_hal_cortex_instructions_per_microsecond()) -#define CYFRAL_0_LOW (CYFRAL_PERIOD * 0.66f) -#define CYFRAL_0_HI (CYFRAL_PERIOD * 0.33f) -#define CYFRAL_1_LOW (CYFRAL_PERIOD * 0.33f) -#define CYFRAL_1_HI (CYFRAL_PERIOD * 0.66f) +#define CYFRAL_PERIOD (125 * furi_hal_cortex_instructions_per_microsecond()) +#define CYFRAL_0_LOW (CYFRAL_PERIOD * 0.66f) +#define CYFRAL_0_HI (CYFRAL_PERIOD * 0.33f) +#define CYFRAL_1_LOW (CYFRAL_PERIOD * 0.33f) +#define CYFRAL_1_HI (CYFRAL_PERIOD * 0.66f) #define CYFRAL_MAX_PERIOD_US 230 diff --git a/lib/ibutton/protocols/misc/protocol_metakom.c b/lib/ibutton/protocols/misc/protocol_metakom.c index 6d5e0339d..26e5cd1d7 100644 --- a/lib/ibutton/protocols/misc/protocol_metakom.c +++ b/lib/ibutton/protocols/misc/protocol_metakom.c @@ -4,11 +4,11 @@ #include "protocol_metakom.h" #define METAKOM_DATA_SIZE sizeof(uint32_t) -#define METAKOM_PERIOD (125 * furi_hal_cortex_instructions_per_microsecond()) -#define METAKOM_0_LOW (METAKOM_PERIOD * 0.33f) -#define METAKOM_0_HI (METAKOM_PERIOD * 0.66f) -#define METAKOM_1_LOW (METAKOM_PERIOD * 0.66f) -#define METAKOM_1_HI (METAKOM_PERIOD * 0.33f) +#define METAKOM_PERIOD (125 * furi_hal_cortex_instructions_per_microsecond()) +#define METAKOM_0_LOW (METAKOM_PERIOD * 0.33f) +#define METAKOM_0_HI (METAKOM_PERIOD * 0.66f) +#define METAKOM_1_LOW (METAKOM_PERIOD * 0.66f) +#define METAKOM_1_HI (METAKOM_PERIOD * 0.33f) #define METAKOM_PERIOD_SAMPLE_COUNT 10 diff --git a/lib/infrared/encoder_decoder/infrared.h b/lib/infrared/encoder_decoder/infrared.h index 377ce0ef2..cc652c88c 100644 --- a/lib/infrared/encoder_decoder/infrared.h +++ b/lib/infrared/encoder_decoder/infrared.h @@ -9,7 +9,7 @@ extern "C" { #endif #define INFRARED_COMMON_CARRIER_FREQUENCY ((uint32_t)38000) -#define INFRARED_COMMON_DUTY_CYCLE ((float)0.33) +#define INFRARED_COMMON_DUTY_CYCLE ((float)0.33) /* if we want to see split raw signals during bruteforce, * we have to have RX raw timing delay less than TX */ diff --git a/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo_i.h b/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo_i.h index bee116c4d..c3ad3f1f6 100644 --- a/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo_i.h +++ b/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo_i.h @@ -2,23 +2,23 @@ #include "../common/infrared_common_i.h" -#define INFRARED_KASEIKYO_UNIT 432 -#define INFRARED_KASEIKYO_PREAMBLE_MARK (8 * INFRARED_KASEIKYO_UNIT) -#define INFRARED_KASEIKYO_PREAMBLE_SPACE (4 * INFRARED_KASEIKYO_UNIT) -#define INFRARED_KASEIKYO_BIT1_MARK INFRARED_KASEIKYO_UNIT -#define INFRARED_KASEIKYO_BIT1_SPACE (3 * INFRARED_KASEIKYO_UNIT) -#define INFRARED_KASEIKYO_BIT0_MARK INFRARED_KASEIKYO_UNIT -#define INFRARED_KASEIKYO_BIT0_SPACE INFRARED_KASEIKYO_UNIT -#define INFRARED_KASEIKYO_REPEAT_PERIOD 130000 -#define INFRARED_KASEIKYO_SILENCE INFRARED_KASEIKYO_REPEAT_PERIOD -#define INFRARED_KASEIKYO_MIN_SPLIT_TIME INFRARED_KASEIKYO_REPEAT_PAUSE_MIN -#define INFRARED_KASEIKYO_REPEAT_PAUSE_MIN 4000 -#define INFRARED_KASEIKYO_REPEAT_PAUSE_MAX 150000 -#define INFRARED_KASEIKYO_REPEAT_COUNT_MIN 1 -#define INFRARED_KASEIKYO_REPEAT_MARK INFRARED_KASEIKYO_PREAMBLE_MARK -#define INFRARED_KASEIKYO_REPEAT_SPACE (INFRARED_KASEIKYO_REPEAT_PERIOD - 56000) +#define INFRARED_KASEIKYO_UNIT 432 +#define INFRARED_KASEIKYO_PREAMBLE_MARK (8 * INFRARED_KASEIKYO_UNIT) +#define INFRARED_KASEIKYO_PREAMBLE_SPACE (4 * INFRARED_KASEIKYO_UNIT) +#define INFRARED_KASEIKYO_BIT1_MARK INFRARED_KASEIKYO_UNIT +#define INFRARED_KASEIKYO_BIT1_SPACE (3 * INFRARED_KASEIKYO_UNIT) +#define INFRARED_KASEIKYO_BIT0_MARK INFRARED_KASEIKYO_UNIT +#define INFRARED_KASEIKYO_BIT0_SPACE INFRARED_KASEIKYO_UNIT +#define INFRARED_KASEIKYO_REPEAT_PERIOD 130000 +#define INFRARED_KASEIKYO_SILENCE INFRARED_KASEIKYO_REPEAT_PERIOD +#define INFRARED_KASEIKYO_MIN_SPLIT_TIME INFRARED_KASEIKYO_REPEAT_PAUSE_MIN +#define INFRARED_KASEIKYO_REPEAT_PAUSE_MIN 4000 +#define INFRARED_KASEIKYO_REPEAT_PAUSE_MAX 150000 +#define INFRARED_KASEIKYO_REPEAT_COUNT_MIN 1 +#define INFRARED_KASEIKYO_REPEAT_MARK INFRARED_KASEIKYO_PREAMBLE_MARK +#define INFRARED_KASEIKYO_REPEAT_SPACE (INFRARED_KASEIKYO_REPEAT_PERIOD - 56000) #define INFRARED_KASEIKYO_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_KASEIKYO_BIT_TOLERANCE 120 // us +#define INFRARED_KASEIKYO_BIT_TOLERANCE 120 // us extern const InfraredCommonProtocolSpec infrared_protocol_kaseikyo; diff --git a/lib/infrared/encoder_decoder/nec/infrared_protocol_nec_i.h b/lib/infrared/encoder_decoder/nec/infrared_protocol_nec_i.h index 05df1f474..56a6607eb 100644 --- a/lib/infrared/encoder_decoder/nec/infrared_protocol_nec_i.h +++ b/lib/infrared/encoder_decoder/nec/infrared_protocol_nec_i.h @@ -2,22 +2,22 @@ #include "../common/infrared_common_i.h" -#define INFRARED_NEC_PREAMBLE_MARK 9000 -#define INFRARED_NEC_PREAMBLE_SPACE 4500 -#define INFRARED_NEC_BIT1_MARK 560 -#define INFRARED_NEC_BIT1_SPACE 1690 -#define INFRARED_NEC_BIT0_MARK 560 -#define INFRARED_NEC_BIT0_SPACE 560 -#define INFRARED_NEC_REPEAT_PERIOD 110000 -#define INFRARED_NEC_SILENCE INFRARED_NEC_REPEAT_PERIOD -#define INFRARED_NEC_MIN_SPLIT_TIME INFRARED_NEC_REPEAT_PAUSE_MIN -#define INFRARED_NEC_REPEAT_PAUSE_MIN 4000 -#define INFRARED_NEC_REPEAT_PAUSE_MAX 150000 -#define INFRARED_NEC_REPEAT_COUNT_MIN 1 -#define INFRARED_NEC_REPEAT_MARK 9000 -#define INFRARED_NEC_REPEAT_SPACE 2250 +#define INFRARED_NEC_PREAMBLE_MARK 9000 +#define INFRARED_NEC_PREAMBLE_SPACE 4500 +#define INFRARED_NEC_BIT1_MARK 560 +#define INFRARED_NEC_BIT1_SPACE 1690 +#define INFRARED_NEC_BIT0_MARK 560 +#define INFRARED_NEC_BIT0_SPACE 560 +#define INFRARED_NEC_REPEAT_PERIOD 110000 +#define INFRARED_NEC_SILENCE INFRARED_NEC_REPEAT_PERIOD +#define INFRARED_NEC_MIN_SPLIT_TIME INFRARED_NEC_REPEAT_PAUSE_MIN +#define INFRARED_NEC_REPEAT_PAUSE_MIN 4000 +#define INFRARED_NEC_REPEAT_PAUSE_MAX 150000 +#define INFRARED_NEC_REPEAT_COUNT_MIN 1 +#define INFRARED_NEC_REPEAT_MARK 9000 +#define INFRARED_NEC_REPEAT_SPACE 2250 #define INFRARED_NEC_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_NEC_BIT_TOLERANCE 120 // us +#define INFRARED_NEC_BIT_TOLERANCE 120 // us extern const InfraredCommonProtocolSpec infrared_protocol_nec; diff --git a/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h index 2ff7f7e3a..791242a3a 100644 --- a/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h +++ b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h @@ -2,19 +2,19 @@ #include "../common/infrared_common_i.h" -#define INFRARED_PIONEER_CARRIER_FREQUENCY 40000 -#define INFRARED_PIONEER_DUTY_CYCLE 0.33 -#define INFRARED_PIONEER_PREAMBLE_MARK 8500 -#define INFRARED_PIONEER_PREAMBLE_SPACE 4225 -#define INFRARED_PIONEER_BIT1_MARK 500 -#define INFRARED_PIONEER_BIT1_SPACE 1500 -#define INFRARED_PIONEER_BIT0_MARK 500 -#define INFRARED_PIONEER_BIT0_SPACE 500 +#define INFRARED_PIONEER_CARRIER_FREQUENCY 40000 +#define INFRARED_PIONEER_DUTY_CYCLE 0.33 +#define INFRARED_PIONEER_PREAMBLE_MARK 8500 +#define INFRARED_PIONEER_PREAMBLE_SPACE 4225 +#define INFRARED_PIONEER_BIT1_MARK 500 +#define INFRARED_PIONEER_BIT1_SPACE 1500 +#define INFRARED_PIONEER_BIT0_MARK 500 +#define INFRARED_PIONEER_BIT0_SPACE 500 #define INFRARED_PIONEER_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_PIONEER_BIT_TOLERANCE 120 // us -#define INFRARED_PIONEER_SILENCE 26000 -#define INFRARED_PIONEER_MIN_SPLIT_TIME (INFRARED_PIONEER_SILENCE) -#define INFRARED_PIONEER_REPEAT_COUNT_MIN 2 +#define INFRARED_PIONEER_BIT_TOLERANCE 120 // us +#define INFRARED_PIONEER_SILENCE 26000 +#define INFRARED_PIONEER_MIN_SPLIT_TIME (INFRARED_PIONEER_SILENCE) +#define INFRARED_PIONEER_REPEAT_COUNT_MIN 2 extern const InfraredCommonProtocolSpec infrared_protocol_pioneer; @@ -22,4 +22,4 @@ bool infrared_decoder_pioneer_interpret(InfraredCommonDecoder* decoder); InfraredStatus infrared_encoder_pioneer_encode_repeat( InfraredCommonEncoder* encoder, uint32_t* duration, - bool* level); \ No newline at end of file + bool* level); diff --git a/lib/infrared/encoder_decoder/rc5/infrared_protocol_rc5_i.h b/lib/infrared/encoder_decoder/rc5/infrared_protocol_rc5_i.h index b906c369e..551163e0c 100644 --- a/lib/infrared/encoder_decoder/rc5/infrared_protocol_rc5_i.h +++ b/lib/infrared/encoder_decoder/rc5/infrared_protocol_rc5_i.h @@ -3,17 +3,17 @@ #include "../common/infrared_common_i.h" #define INFRARED_RC5_CARRIER_FREQUENCY 36000 -#define INFRARED_RC5_DUTY_CYCLE 0.33 +#define INFRARED_RC5_DUTY_CYCLE 0.33 -#define INFRARED_RC5_PREAMBLE_MARK 0 -#define INFRARED_RC5_PREAMBLE_SPACE 0 -#define INFRARED_RC5_BIT 888 // half of time-quant for 1 bit +#define INFRARED_RC5_PREAMBLE_MARK 0 +#define INFRARED_RC5_PREAMBLE_SPACE 0 +#define INFRARED_RC5_BIT 888 // half of time-quant for 1 bit #define INFRARED_RC5_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_RC5_BIT_TOLERANCE 120 // us +#define INFRARED_RC5_BIT_TOLERANCE 120 // us /* protocol allows 2700 silence, but it is hard to send 1 message without repeat */ -#define INFRARED_RC5_SILENCE (2700 * 10) -#define INFRARED_RC5_MIN_SPLIT_TIME 2700 -#define INFRARED_RC5_REPEAT_COUNT_MIN 1 +#define INFRARED_RC5_SILENCE (2700 * 10) +#define INFRARED_RC5_MIN_SPLIT_TIME 2700 +#define INFRARED_RC5_REPEAT_COUNT_MIN 1 extern const InfraredCommonProtocolSpec infrared_protocol_rc5; diff --git a/lib/infrared/encoder_decoder/rc6/infrared_protocol_rc6_i.h b/lib/infrared/encoder_decoder/rc6/infrared_protocol_rc6_i.h index 06aa2a6a5..efa3071f4 100644 --- a/lib/infrared/encoder_decoder/rc6/infrared_protocol_rc6_i.h +++ b/lib/infrared/encoder_decoder/rc6/infrared_protocol_rc6_i.h @@ -3,17 +3,17 @@ #include "../common/infrared_common_i.h" #define INFRARED_RC6_CARRIER_FREQUENCY 36000 -#define INFRARED_RC6_DUTY_CYCLE 0.33 +#define INFRARED_RC6_DUTY_CYCLE 0.33 -#define INFRARED_RC6_PREAMBLE_MARK 2666 -#define INFRARED_RC6_PREAMBLE_SPACE 889 -#define INFRARED_RC6_BIT 444 // half of time-quant for 1 bit +#define INFRARED_RC6_PREAMBLE_MARK 2666 +#define INFRARED_RC6_PREAMBLE_SPACE 889 +#define INFRARED_RC6_BIT 444 // half of time-quant for 1 bit #define INFRARED_RC6_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_RC6_BIT_TOLERANCE 120 // us +#define INFRARED_RC6_BIT_TOLERANCE 120 // us /* protocol allows 2700 silence, but it is hard to send 1 message without repeat */ -#define INFRARED_RC6_SILENCE (2700 * 10) -#define INFRARED_RC6_MIN_SPLIT_TIME 2700 -#define INFRARED_RC6_REPEAT_COUNT_MIN 1 +#define INFRARED_RC6_SILENCE (2700 * 10) +#define INFRARED_RC6_MIN_SPLIT_TIME 2700 +#define INFRARED_RC6_REPEAT_COUNT_MIN 1 extern const InfraredCommonProtocolSpec infrared_protocol_rc6; diff --git a/lib/infrared/encoder_decoder/rca/infrared_protocol_rca_i.h b/lib/infrared/encoder_decoder/rca/infrared_protocol_rca_i.h index 9ec4fe3b1..b628735c8 100644 --- a/lib/infrared/encoder_decoder/rca/infrared_protocol_rca_i.h +++ b/lib/infrared/encoder_decoder/rca/infrared_protocol_rca_i.h @@ -2,23 +2,23 @@ #include "../common/infrared_common_i.h" -#define INFRARED_RCA_PREAMBLE_MARK 4000 +#define INFRARED_RCA_PREAMBLE_MARK 4000 #define INFRARED_RCA_PREAMBLE_SPACE 4000 -#define INFRARED_RCA_BIT1_MARK 500 -#define INFRARED_RCA_BIT1_SPACE 2000 -#define INFRARED_RCA_BIT0_MARK 500 -#define INFRARED_RCA_BIT0_SPACE 1000 -#define INFRARED_RCA_REPEAT_PERIOD 8000 -#define INFRARED_RCA_SILENCE INFRARED_RCA_REPEAT_PERIOD +#define INFRARED_RCA_BIT1_MARK 500 +#define INFRARED_RCA_BIT1_SPACE 2000 +#define INFRARED_RCA_BIT0_MARK 500 +#define INFRARED_RCA_BIT0_SPACE 1000 +#define INFRARED_RCA_REPEAT_PERIOD 8000 +#define INFRARED_RCA_SILENCE INFRARED_RCA_REPEAT_PERIOD -#define INFRARED_RCA_MIN_SPLIT_TIME INFRARED_RCA_REPEAT_PAUSE_MIN -#define INFRARED_RCA_REPEAT_PAUSE_MIN 4000 -#define INFRARED_RCA_REPEAT_PAUSE_MAX 150000 -#define INFRARED_RCA_REPEAT_COUNT_MIN 1 -#define INFRARED_RCA_REPEAT_MARK INFRARED_RCA_PREAMBLE_MARK -#define INFRARED_RCA_REPEAT_SPACE INFRARED_RCA_PREAMBLE_SPACE +#define INFRARED_RCA_MIN_SPLIT_TIME INFRARED_RCA_REPEAT_PAUSE_MIN +#define INFRARED_RCA_REPEAT_PAUSE_MIN 4000 +#define INFRARED_RCA_REPEAT_PAUSE_MAX 150000 +#define INFRARED_RCA_REPEAT_COUNT_MIN 1 +#define INFRARED_RCA_REPEAT_MARK INFRARED_RCA_PREAMBLE_MARK +#define INFRARED_RCA_REPEAT_SPACE INFRARED_RCA_PREAMBLE_SPACE #define INFRARED_RCA_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_RCA_BIT_TOLERANCE 120 // us +#define INFRARED_RCA_BIT_TOLERANCE 120 // us extern const InfraredCommonProtocolSpec infrared_protocol_rca; diff --git a/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung_i.h b/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung_i.h index b85384942..ceb082e22 100644 --- a/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung_i.h +++ b/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung_i.h @@ -2,28 +2,28 @@ #include "../common/infrared_common_i.h" -#define INFRARED_SAMSUNG_PREAMBLE_MARK 4500 -#define INFRARED_SAMSUNG_PREAMBLE_SPACE 4500 -#define INFRARED_SAMSUNG_BIT1_MARK 550 -#define INFRARED_SAMSUNG_BIT1_SPACE 1650 -#define INFRARED_SAMSUNG_BIT0_MARK 550 -#define INFRARED_SAMSUNG_BIT0_SPACE 550 -#define INFRARED_SAMSUNG_REPEAT_PAUSE_MIN 30000 -#define INFRARED_SAMSUNG_REPEAT_PAUSE_MAX 140000 -#define INFRARED_SAMSUNG_REPEAT_PAUSE1 46000 -#define INFRARED_SAMSUNG_REPEAT_PAUSE2 97000 -#define INFRARED_SAMSUNG_REPEAT_COUNT_MIN 1 +#define INFRARED_SAMSUNG_PREAMBLE_MARK 4500 +#define INFRARED_SAMSUNG_PREAMBLE_SPACE 4500 +#define INFRARED_SAMSUNG_BIT1_MARK 550 +#define INFRARED_SAMSUNG_BIT1_SPACE 1650 +#define INFRARED_SAMSUNG_BIT0_MARK 550 +#define INFRARED_SAMSUNG_BIT0_SPACE 550 +#define INFRARED_SAMSUNG_REPEAT_PAUSE_MIN 30000 +#define INFRARED_SAMSUNG_REPEAT_PAUSE_MAX 140000 +#define INFRARED_SAMSUNG_REPEAT_PAUSE1 46000 +#define INFRARED_SAMSUNG_REPEAT_PAUSE2 97000 +#define INFRARED_SAMSUNG_REPEAT_COUNT_MIN 1 /* Samsung silence have to be greater than REPEAT MAX * otherwise there can be problems during unit tests parsing * of some data. Real tolerances we don't know, but in real life * silence time should be greater than max repeat time. This is * because of similar preambule timings for repeat and first messages. */ -#define INFRARED_SAMSUNG_MIN_SPLIT_TIME 5000 -#define INFRARED_SAMSUNG_SILENCE 145000 -#define INFRARED_SAMSUNG_REPEAT_MARK 4500 -#define INFRARED_SAMSUNG_REPEAT_SPACE 4500 +#define INFRARED_SAMSUNG_MIN_SPLIT_TIME 5000 +#define INFRARED_SAMSUNG_SILENCE 145000 +#define INFRARED_SAMSUNG_REPEAT_MARK 4500 +#define INFRARED_SAMSUNG_REPEAT_SPACE 4500 #define INFRARED_SAMSUNG_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_SAMSUNG_BIT_TOLERANCE 120 // us +#define INFRARED_SAMSUNG_BIT_TOLERANCE 120 // us bool infrared_decoder_samsung32_interpret(InfraredCommonDecoder* decoder); InfraredStatus infrared_decoder_samsung32_decode_repeat(InfraredCommonDecoder* decoder); diff --git a/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc_i.h b/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc_i.h index e38be9bc8..e37b98469 100644 --- a/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc_i.h +++ b/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc_i.h @@ -2,20 +2,20 @@ #include "../common/infrared_common_i.h" -#define INFRARED_SIRC_CARRIER_FREQUENCY 40000 -#define INFRARED_SIRC_DUTY_CYCLE 0.33 -#define INFRARED_SIRC_PREAMBLE_MARK 2400 -#define INFRARED_SIRC_PREAMBLE_SPACE 600 -#define INFRARED_SIRC_BIT1_MARK 1200 -#define INFRARED_SIRC_BIT1_SPACE 600 -#define INFRARED_SIRC_BIT0_MARK 600 -#define INFRARED_SIRC_BIT0_SPACE 600 +#define INFRARED_SIRC_CARRIER_FREQUENCY 40000 +#define INFRARED_SIRC_DUTY_CYCLE 0.33 +#define INFRARED_SIRC_PREAMBLE_MARK 2400 +#define INFRARED_SIRC_PREAMBLE_SPACE 600 +#define INFRARED_SIRC_BIT1_MARK 1200 +#define INFRARED_SIRC_BIT1_SPACE 600 +#define INFRARED_SIRC_BIT0_MARK 600 +#define INFRARED_SIRC_BIT0_SPACE 600 #define INFRARED_SIRC_PREAMBLE_TOLERANCE 200 // us -#define INFRARED_SIRC_BIT_TOLERANCE 120 // us -#define INFRARED_SIRC_SILENCE 10000 -#define INFRARED_SIRC_MIN_SPLIT_TIME (INFRARED_SIRC_SILENCE - 1000) -#define INFRARED_SIRC_REPEAT_PERIOD 45000 -#define INFRARED_SIRC_REPEAT_COUNT_MIN 3 +#define INFRARED_SIRC_BIT_TOLERANCE 120 // us +#define INFRARED_SIRC_SILENCE 10000 +#define INFRARED_SIRC_MIN_SPLIT_TIME (INFRARED_SIRC_SILENCE - 1000) +#define INFRARED_SIRC_REPEAT_PERIOD 45000 +#define INFRARED_SIRC_REPEAT_COUNT_MIN 3 extern const InfraredCommonProtocolSpec infrared_protocol_sirc; diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index 89f351eb9..cc9361ccf 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -10,12 +10,12 @@ #define INFRARED_WORKER_RX_TIMEOUT INFRARED_RAW_RX_TIMING_DELAY_US -#define INFRARED_WORKER_RX_RECEIVED 0x01 +#define INFRARED_WORKER_RX_RECEIVED 0x01 #define INFRARED_WORKER_RX_TIMEOUT_RECEIVED 0x02 -#define INFRARED_WORKER_OVERRUN 0x04 -#define INFRARED_WORKER_EXIT 0x08 -#define INFRARED_WORKER_TX_FILL_BUFFER 0x10 -#define INFRARED_WORKER_TX_MESSAGE_SENT 0x20 +#define INFRARED_WORKER_OVERRUN 0x04 +#define INFRARED_WORKER_EXIT 0x08 +#define INFRARED_WORKER_TX_FILL_BUFFER 0x10 +#define INFRARED_WORKER_TX_MESSAGE_SENT 0x20 #define INFRARED_WORKER_ALL_RX_EVENTS \ (INFRARED_WORKER_RX_RECEIVED | INFRARED_WORKER_RX_TIMEOUT_RECEIVED | \ diff --git a/lib/lfrfid/lfrfid_dict_file.c b/lib/lfrfid/lfrfid_dict_file.c index 367150812..11e812fdb 100644 --- a/lib/lfrfid/lfrfid_dict_file.c +++ b/lib/lfrfid/lfrfid_dict_file.c @@ -185,4 +185,4 @@ ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) { furi_record_close(RECORD_STORAGE); return result; -} \ No newline at end of file +} diff --git a/lib/lfrfid/lfrfid_dict_file.h b/lib/lfrfid/lfrfid_dict_file.h index 077bb0ba1..8be9e60b4 100644 --- a/lib/lfrfid/lfrfid_dict_file.h +++ b/lib/lfrfid/lfrfid_dict_file.h @@ -28,4 +28,4 @@ ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/lfrfid/lfrfid_raw_file.c b/lib/lfrfid/lfrfid_raw_file.c index 441cf7333..c0aac71be 100644 --- a/lib/lfrfid/lfrfid_raw_file.c +++ b/lib/lfrfid/lfrfid_raw_file.c @@ -3,7 +3,7 @@ #include #include -#define LFRFID_RAW_FILE_MAGIC 0x4C464952 +#define LFRFID_RAW_FILE_MAGIC 0x4C464952 #define LFRFID_RAW_FILE_VERSION 1 #define TAG "LfRfidRawFile" @@ -71,7 +71,7 @@ bool lfrfid_raw_file_write_header( .max_buffer_size = max_buffer_size}; size_t size = stream_write(file->stream, (uint8_t*)&header, sizeof(LFRFIDRawFileHeader)); - return (size == sizeof(LFRFIDRawFileHeader)); + return size == sizeof(LFRFIDRawFileHeader); } bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, size_t buffer_size) { @@ -166,4 +166,4 @@ bool lfrfid_raw_file_read_pair( } return true; -} \ No newline at end of file +} diff --git a/lib/lfrfid/lfrfid_raw_worker.c b/lib/lfrfid/lfrfid_raw_worker.c index 7c04b9dfa..bef30506b 100644 --- a/lib/lfrfid/lfrfid_raw_worker.c +++ b/lib/lfrfid/lfrfid_raw_worker.c @@ -6,8 +6,8 @@ #include "lfrfid_raw_file.h" #include "tools/varint_pair.h" -#define EMULATE_BUFFER_SIZE 1024 -#define RFID_DATA_BUFFER_SIZE 2048 +#define EMULATE_BUFFER_SIZE 1024 +#define RFID_DATA_BUFFER_SIZE 2048 #define READ_DATA_BUFFER_COUNT 4 #define TAG_EMULATE "RawEmulate" diff --git a/lib/lfrfid/lfrfid_raw_worker.h b/lib/lfrfid/lfrfid_raw_worker.h index e145dcaa3..7bfe25cab 100644 --- a/lib/lfrfid/lfrfid_raw_worker.h +++ b/lib/lfrfid/lfrfid_raw_worker.h @@ -65,4 +65,4 @@ void lfrfid_raw_worker_stop(LFRFIDRawWorker* worker); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/lfrfid/lfrfid_worker.c b/lib/lfrfid/lfrfid_worker.c index 3a0841cac..179c3c48f 100644 --- a/lib/lfrfid/lfrfid_worker.c +++ b/lib/lfrfid/lfrfid_worker.c @@ -141,7 +141,7 @@ void lfrfid_worker_stop_thread(LFRFIDWorker* worker) { bool lfrfid_worker_check_for_stop(LFRFIDWorker* worker) { UNUSED(worker); uint32_t flags = furi_thread_flags_get(); - return (flags & LFRFIDEventStopMode); + return flags & LFRFIDEventStopMode; } size_t lfrfid_worker_dict_get_data_size(LFRFIDWorker* worker, LFRFIDProtocol protocol) { diff --git a/lib/lfrfid/lfrfid_worker_modes.c b/lib/lfrfid/lfrfid_worker_modes.c index a017863b3..aec19e374 100644 --- a/lib/lfrfid/lfrfid_worker_modes.c +++ b/lib/lfrfid/lfrfid_worker_modes.c @@ -18,23 +18,23 @@ #ifdef LFRFID_WORKER_READ_DEBUG_GPIO #define LFRFID_WORKER_READ_DEBUG_GPIO_VALUE &gpio_ext_pa7 -#define LFRFID_WORKER_READ_DEBUG_GPIO_LOAD &gpio_ext_pa6 +#define LFRFID_WORKER_READ_DEBUG_GPIO_LOAD &gpio_ext_pa6 #endif #define LFRFID_WORKER_READ_AVERAGE_COUNT 64 -#define LFRFID_WORKER_READ_MIN_TIME_US 16 +#define LFRFID_WORKER_READ_MIN_TIME_US 16 -#define LFRFID_WORKER_READ_DROP_TIME_MS 50 +#define LFRFID_WORKER_READ_DROP_TIME_MS 50 #define LFRFID_WORKER_READ_STABILIZE_TIME_MS 450 -#define LFRFID_WORKER_READ_SWITCH_TIME_MS 2000 +#define LFRFID_WORKER_READ_SWITCH_TIME_MS 2000 -#define LFRFID_WORKER_WRITE_VERIFY_TIME_MS 2000 -#define LFRFID_WORKER_WRITE_DROP_TIME_MS 50 +#define LFRFID_WORKER_WRITE_VERIFY_TIME_MS 2000 +#define LFRFID_WORKER_WRITE_DROP_TIME_MS 50 #define LFRFID_WORKER_WRITE_TOO_LONG_TIME_MS 10000 #define LFRFID_WORKER_WRITE_MAX_UNSUCCESSFUL_READS 5 -#define LFRFID_WORKER_READ_BUFFER_SIZE 512 +#define LFRFID_WORKER_READ_BUFFER_SIZE 512 #define LFRFID_WORKER_READ_BUFFER_COUNT 16 #define LFRFID_WORKER_EMULATE_BUFFER_SIZE 1024 diff --git a/lib/lfrfid/protocols/protocol_awid.c b/lib/lfrfid/protocols/protocol_awid.c index b3e92245e..299e5cab5 100644 --- a/lib/lfrfid/protocols/protocol_awid.c +++ b/lib/lfrfid/protocols/protocol_awid.c @@ -6,12 +6,12 @@ #include "lfrfid_protocols.h" #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) #define AWID_DECODED_DATA_SIZE (9) -#define AWID_ENCODED_BIT_SIZE (96) +#define AWID_ENCODED_BIT_SIZE (96) #define AWID_ENCODED_DATA_SIZE (((AWID_ENCODED_BIT_SIZE) / 8) + 1) #define AWID_ENCODED_DATA_LAST (AWID_ENCODED_DATA_SIZE - 1) @@ -37,21 +37,21 @@ ProtocolAwid* protocol_awid_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_awid_free(ProtocolAwid* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_awid_get_data(ProtocolAwid* protocol) { return protocol->data; -}; +} void protocol_awid_decoder_start(ProtocolAwid* protocol) { memset(protocol->encoded_data, 0, AWID_ENCODED_DATA_SIZE); -}; +} static bool protocol_awid_can_be_decoded(uint8_t* data) { bool result = false; @@ -112,7 +112,7 @@ bool protocol_awid_decoder_feed(ProtocolAwid* protocol, bool level, uint32_t dur } return result; -}; +} static void protocol_awid_encode(const uint8_t* decoded_data, uint8_t* encoded_data) { memset(encoded_data, 0, AWID_ENCODED_DATA_SIZE); @@ -125,14 +125,14 @@ static void protocol_awid_encode(const uint8_t* decoded_data, uint8_t* encoded_d value |= bit_lib_test_parity_32(value, BitLibParityOdd); bit_lib_set_bits(encoded_data, 8 + i * 4, value, 4); } -}; +} bool protocol_awid_encoder_start(ProtocolAwid* protocol) { protocol_awid_encode(protocol->data, (uint8_t*)protocol->encoded_data); protocol->encoder.encoded_index = 0; fsk_osc_reset(protocol->encoder.fsk_osc); return true; -}; +} LevelDuration protocol_awid_encoder_yield(ProtocolAwid* protocol) { bool level; @@ -145,7 +145,7 @@ LevelDuration protocol_awid_encoder_yield(ProtocolAwid* protocol) { bit_lib_increment_index(protocol->encoder.encoded_index, AWID_ENCODED_BIT_SIZE); } return level_duration_make(level, duration); -}; +} void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) { // Index map @@ -186,7 +186,7 @@ void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) { furi_string_cat_printf(result, "%02hhX", decoded_data[i]); } } -}; +} void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result) { uint8_t* decoded_data = protocol->data; @@ -210,7 +210,7 @@ void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result) } else { furi_string_cat(result, "\nData: Unknown"); } -}; +} bool protocol_awid_write_data(ProtocolAwid* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -239,7 +239,7 @@ bool protocol_awid_write_data(ProtocolAwid* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_awid = { .name = "AWID", diff --git a/lib/lfrfid/protocols/protocol_awid.h b/lib/lfrfid/protocols/protocol_awid.h index 51a4ea52f..4e694a37d 100644 --- a/lib/lfrfid/protocols/protocol_awid.h +++ b/lib/lfrfid/protocols/protocol_awid.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_awid; \ No newline at end of file +extern const ProtocolBase protocol_awid; diff --git a/lib/lfrfid/protocols/protocol_electra.c b/lib/lfrfid/protocols/protocol_electra.c index f01b8f2ba..014c83d1f 100644 --- a/lib/lfrfid/protocols/protocol_electra.c +++ b/lib/lfrfid/protocols/protocol_electra.c @@ -61,17 +61,17 @@ typedef uint64_t ElectraDecodedData; -#define EM_HEADER_POS (55) +#define EM_HEADER_POS (55) #define EM_HEADER_MASK (0x1FFLLU << EM_HEADER_POS) #define EM_FIRST_ROW_POS (50) -#define EM_ROW_COUNT (10) -#define EM_COLUMN_COUNT (4) +#define EM_ROW_COUNT (10) +#define EM_COLUMN_COUNT (4) #define EM_BITS_PER_ROW_COUNT (EM_COLUMN_COUNT + 1) -#define EM_COLUMN_POS (4) -#define ELECTRA_STOP_POS (0) +#define EM_COLUMN_POS (4) +#define ELECTRA_STOP_POS (0) #define ELECTRA_STOP_MASK (0x1LLU << ELECTRA_STOP_POS) #define EM_HEADER_AND_STOP_MASK (EM_HEADER_MASK | ELECTRA_STOP_MASK) @@ -90,14 +90,14 @@ typedef uint64_t ElectraDecodedData; #define ELECTRA_CLOCK_PER_BIT (64) -#define ELECTRA_READ_SHORT_TIME (256) -#define ELECTRA_READ_LONG_TIME (512) +#define ELECTRA_READ_SHORT_TIME (256) +#define ELECTRA_READ_LONG_TIME (512) #define ELECTRA_READ_JITTER_TIME (100) -#define ELECTRA_READ_SHORT_TIME_LOW (ELECTRA_READ_SHORT_TIME - ELECTRA_READ_JITTER_TIME) +#define ELECTRA_READ_SHORT_TIME_LOW (ELECTRA_READ_SHORT_TIME - ELECTRA_READ_JITTER_TIME) #define ELECTRA_READ_SHORT_TIME_HIGH (ELECTRA_READ_SHORT_TIME + ELECTRA_READ_JITTER_TIME) -#define ELECTRA_READ_LONG_TIME_LOW (ELECTRA_READ_LONG_TIME - ELECTRA_READ_JITTER_TIME) -#define ELECTRA_READ_LONG_TIME_HIGH (ELECTRA_READ_LONG_TIME + ELECTRA_READ_JITTER_TIME) +#define ELECTRA_READ_LONG_TIME_LOW (ELECTRA_READ_LONG_TIME - ELECTRA_READ_JITTER_TIME) +#define ELECTRA_READ_LONG_TIME_HIGH (ELECTRA_READ_LONG_TIME + ELECTRA_READ_JITTER_TIME) #define EM_ENCODED_DATA_HEADER (0xFF80000000000000ULL) @@ -116,15 +116,15 @@ typedef struct { ProtocolElectra* protocol_electra_alloc(void) { ProtocolElectra* proto = malloc(sizeof(ProtocolElectra)); return (void*)proto; -}; +} void protocol_electra_free(ProtocolElectra* proto) { free(proto); -}; +} uint8_t* protocol_electra_get_data(ProtocolElectra* proto) { return proto->data; -}; +} static void electra_decode( const uint8_t* encoded_base_data, @@ -198,7 +198,7 @@ static bool electra_can_be_decoded( parity_sum += (*base_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { return false; } } @@ -211,7 +211,7 @@ static bool electra_can_be_decoded( parity_sum += (*base_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { FURI_LOG_D( TAG, "Unexpected column parity found. EM4100 data: %016llX", @@ -242,7 +242,7 @@ void protocol_electra_decoder_start(ProtocolElectra* proto) { ManchesterEventReset, &proto->decoder_manchester_state, NULL); -}; +} bool protocol_electra_decoder_feed(ProtocolElectra* proto, bool level, uint32_t duration) { bool result = false; @@ -299,7 +299,7 @@ bool protocol_electra_decoder_feed(ProtocolElectra* proto, bool level, uint32_t } return result; -}; +} static void em_write_nibble(bool low_nibble, uint8_t data, ElectraDecodedData* encoded_base_data) { uint8_t parity_sum = 0; @@ -354,7 +354,7 @@ bool protocol_electra_encoder_start(ProtocolElectra* proto) { } return true; -}; +} LevelDuration protocol_electra_encoder_yield(ProtocolElectra* proto) { bool level; @@ -378,7 +378,7 @@ LevelDuration protocol_electra_encoder_yield(ProtocolElectra* proto) { } return level_duration_make(level, duration); -}; +} bool protocol_electra_write_data(ProtocolElectra* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -408,12 +408,12 @@ bool protocol_electra_write_data(ProtocolElectra* protocol, void* data) { result = true; } return result; -}; +} void protocol_electra_render_data(ProtocolElectra* protocol, FuriString* result) { protocol_electra_encoder_start(protocol); furi_string_printf(result, "Epilogue: %016llX", protocol->encoded_epilogue); -}; +} const ProtocolBase protocol_electra = { .name = "Electra", @@ -437,4 +437,4 @@ const ProtocolBase protocol_electra = { .render_data = (ProtocolRenderData)protocol_electra_render_data, .render_brief_data = (ProtocolRenderData)protocol_electra_render_data, .write_data = (ProtocolWriteData)protocol_electra_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_electra.h b/lib/lfrfid/protocols/protocol_electra.h index 2c9f79285..b5aef5a07 100644 --- a/lib/lfrfid/protocols/protocol_electra.h +++ b/lib/lfrfid/protocols/protocol_electra.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_electra; \ No newline at end of file +extern const ProtocolBase protocol_electra; diff --git a/lib/lfrfid/protocols/protocol_em4100.c b/lib/lfrfid/protocols/protocol_em4100.c index a4a403167..eca14c046 100644 --- a/lib/lfrfid/protocols/protocol_em4100.c +++ b/lib/lfrfid/protocols/protocol_em4100.c @@ -6,18 +6,18 @@ typedef uint64_t EM4100DecodedData; typedef uint64_t EM4100Epilogue; -#define EM_HEADER_POS (55) +#define EM_HEADER_POS (55) #define EM_HEADER_MASK (0x1FFLLU << EM_HEADER_POS) #define EM_FIRST_ROW_POS (50) -#define EM_ROW_COUNT (10) -#define EM_COLUMN_COUNT (4) +#define EM_ROW_COUNT (10) +#define EM_COLUMN_COUNT (4) #define EM_BITS_PER_ROW_COUNT (EM_COLUMN_COUNT + 1) #define EM_COLUMN_POS (4) -#define EM_STOP_POS (0) -#define EM_STOP_MASK (0x1LLU << EM_STOP_POS) +#define EM_STOP_POS (0) +#define EM_STOP_MASK (0x1LLU << EM_STOP_POS) #define EM_HEADER_AND_STOP_MASK (EM_HEADER_MASK | EM_STOP_MASK) #define EM_HEADER_AND_STOP_DATA (EM_HEADER_MASK) @@ -25,8 +25,8 @@ typedef uint64_t EM4100Epilogue; #define EM4100_DECODED_DATA_SIZE (5) #define EM4100_ENCODED_DATA_SIZE (sizeof(EM4100DecodedData)) -#define EM_READ_SHORT_TIME_BASE (256) -#define EM_READ_LONG_TIME_BASE (512) +#define EM_READ_SHORT_TIME_BASE (256) +#define EM_READ_LONG_TIME_BASE (512) #define EM_READ_JITTER_TIME_BASE (100) #define EM_ENCODED_DATA_HEADER (0xFF80000000000000ULL) @@ -93,27 +93,27 @@ ProtocolEM4100* protocol_em4100_alloc(void) { ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100)); proto->clock_per_bit = 64; return (void*)proto; -}; +} ProtocolEM4100* protocol_em4100_16_alloc(void) { ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100)); proto->clock_per_bit = 16; return (void*)proto; -}; +} ProtocolEM4100* protocol_em4100_32_alloc(void) { ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100)); proto->clock_per_bit = 32; return (void*)proto; -}; +} void protocol_em4100_free(ProtocolEM4100* proto) { free(proto); -}; +} uint8_t* protocol_em4100_get_data(ProtocolEM4100* proto) { return proto->data; -}; +} static void em4100_decode( const uint8_t* encoded_data, @@ -173,7 +173,7 @@ static bool em4100_can_be_decoded( parity_sum += (*card_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { return false; } } @@ -186,7 +186,7 @@ static bool em4100_can_be_decoded( parity_sum += (*card_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1; } - if((parity_sum % 2)) { + if(parity_sum % 2) { return false; } } @@ -202,7 +202,7 @@ void protocol_em4100_decoder_start(ProtocolEM4100* proto) { ManchesterEventReset, &proto->decoder_manchester_state, NULL); -}; +} bool protocol_em4100_decoder_feed(ProtocolEM4100* proto, bool level, uint32_t duration) { bool result = false; @@ -252,7 +252,7 @@ bool protocol_em4100_decoder_feed(ProtocolEM4100* proto, bool level, uint32_t du } return result; -}; +} static void em4100_write_nibble(bool low_nibble, uint8_t data, EM4100DecodedData* encoded_data) { uint8_t parity_sum = 0; @@ -296,7 +296,7 @@ bool protocol_em4100_encoder_start(ProtocolEM4100* proto) { proto->encoded_polarity = true; return true; -}; +} LevelDuration protocol_em4100_encoder_yield(ProtocolEM4100* proto) { bool level = (proto->encoded_data >> (63 - proto->encoded_data_index)) & 1; @@ -315,7 +315,7 @@ LevelDuration protocol_em4100_encoder_yield(ProtocolEM4100* proto) { } return level_duration_make(level, duration); -}; +} bool protocol_em4100_write_data(ProtocolEM4100* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -341,7 +341,7 @@ bool protocol_em4100_write_data(ProtocolEM4100* protocol, void* data) { result = true; } return result; -}; +} void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) { uint8_t* data = protocol->data; @@ -352,7 +352,7 @@ void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) { data[2], (uint16_t)((data[3] << 8) | (data[4])), protocol->clock_per_bit); -}; +} const ProtocolBase protocol_em4100 = { .name = "EM4100", diff --git a/lib/lfrfid/protocols/protocol_fdx_a.c b/lib/lfrfid/protocols/protocol_fdx_a.c index f7852eb10..9849a39b6 100644 --- a/lib/lfrfid/protocols/protocol_fdx_a.c +++ b/lib/lfrfid/protocols/protocol_fdx_a.c @@ -6,16 +6,16 @@ #include #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) -#define FDXA_DATA_SIZE 10 +#define FDXA_DATA_SIZE 10 #define FDXA_PREAMBLE_SIZE 2 #define FDXA_ENCODED_DATA_SIZE (FDXA_PREAMBLE_SIZE + FDXA_DATA_SIZE + FDXA_PREAMBLE_SIZE) -#define FDXA_ENCODED_BIT_SIZE ((FDXA_PREAMBLE_SIZE + FDXA_DATA_SIZE) * 8) +#define FDXA_ENCODED_BIT_SIZE ((FDXA_PREAMBLE_SIZE + FDXA_DATA_SIZE) * 8) #define FDXA_DECODED_DATA_SIZE (5) -#define FDXA_DECODED_BIT_SIZE ((FDXA_ENCODED_BIT_SIZE - FDXA_PREAMBLE_SIZE * 8) / 2) +#define FDXA_DECODED_BIT_SIZE ((FDXA_ENCODED_BIT_SIZE - FDXA_PREAMBLE_SIZE * 8) / 2) #define FDXA_PREAMBLE_0 0x55 #define FDXA_PREAMBLE_1 0x1D @@ -44,21 +44,21 @@ ProtocolFDXA* protocol_fdx_a_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_fdx_a_free(ProtocolFDXA* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_fdx_a_get_data(ProtocolFDXA* protocol) { return protocol->data; -}; +} void protocol_fdx_a_decoder_start(ProtocolFDXA* protocol) { memset(protocol->encoded_data, 0, FDXA_ENCODED_DATA_SIZE); -}; +} static bool protocol_fdx_a_decode(const uint8_t* from, uint8_t* to) { size_t bit_index = 0; @@ -104,7 +104,7 @@ static bool protocol_fdx_a_can_be_decoded(const uint8_t* data) { decoded_data[i] &= 0x7F; } - return (parity_sum == 0); + return parity_sum == 0; } bool protocol_fdx_a_decoder_feed(ProtocolFDXA* protocol, bool level, uint32_t duration) { @@ -124,7 +124,7 @@ bool protocol_fdx_a_decoder_feed(ProtocolFDXA* protocol, bool level, uint32_t du } return result; -}; +} static void protocol_fdx_a_encode(ProtocolFDXA* protocol) { protocol->encoded_data[0] = FDXA_PREAMBLE_0; @@ -150,7 +150,7 @@ bool protocol_fdx_a_encoder_start(ProtocolFDXA* protocol) { protocol_fdx_a_encode(protocol); return true; -}; +} LevelDuration protocol_fdx_a_encoder_yield(ProtocolFDXA* protocol) { bool level = 0; @@ -180,7 +180,7 @@ LevelDuration protocol_fdx_a_encoder_yield(ProtocolFDXA* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_fdx_a_write_data(ProtocolFDXA* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -203,7 +203,7 @@ bool protocol_fdx_a_write_data(ProtocolFDXA* protocol, void* data) { result = true; } return result; -}; +} void protocol_fdx_a_render_data(ProtocolFDXA* protocol, FuriString* result) { uint8_t data[FDXA_DECODED_DATA_SIZE]; @@ -221,7 +221,7 @@ void protocol_fdx_a_render_data(ProtocolFDXA* protocol, FuriString* result) { "Parity: %c", bit_lib_get_bits_64(data, 0, 40), parity_sum == 0 ? '+' : '-'); -}; +} const ProtocolBase protocol_fdx_a = { .name = "FDX-A", diff --git a/lib/lfrfid/protocols/protocol_fdx_a.h b/lib/lfrfid/protocols/protocol_fdx_a.h index 355544881..6eafb0055 100644 --- a/lib/lfrfid/protocols/protocol_fdx_a.h +++ b/lib/lfrfid/protocols/protocol_fdx_a.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_fdx_a; \ No newline at end of file +extern const ProtocolBase protocol_fdx_a; diff --git a/lib/lfrfid/protocols/protocol_fdx_b.c b/lib/lfrfid/protocols/protocol_fdx_b.c index a5af855e4..3de2b661b 100644 --- a/lib/lfrfid/protocols/protocol_fdx_b.c +++ b/lib/lfrfid/protocols/protocol_fdx_b.c @@ -6,22 +6,22 @@ #include "lfrfid_protocols.h" #include -#define FDX_B_ENCODED_BIT_SIZE (128) -#define FDX_B_ENCODED_BYTE_SIZE (((FDX_B_ENCODED_BIT_SIZE) / 8)) -#define FDX_B_PREAMBLE_BIT_SIZE (11) -#define FDX_B_PREAMBLE_BYTE_SIZE (2) +#define FDX_B_ENCODED_BIT_SIZE (128) +#define FDX_B_ENCODED_BYTE_SIZE (((FDX_B_ENCODED_BIT_SIZE) / 8)) +#define FDX_B_PREAMBLE_BIT_SIZE (11) +#define FDX_B_PREAMBLE_BYTE_SIZE (2) #define FDX_B_ENCODED_BYTE_FULL_SIZE (FDX_B_ENCODED_BYTE_SIZE + FDX_B_PREAMBLE_BYTE_SIZE) #define FDXB_DECODED_DATA_SIZE (11) -#define FDX_B_SHORT_TIME (128) -#define FDX_B_LONG_TIME (256) +#define FDX_B_SHORT_TIME (128) +#define FDX_B_LONG_TIME (256) #define FDX_B_JITTER_TIME (60) -#define FDX_B_SHORT_TIME_LOW (FDX_B_SHORT_TIME - FDX_B_JITTER_TIME) +#define FDX_B_SHORT_TIME_LOW (FDX_B_SHORT_TIME - FDX_B_JITTER_TIME) #define FDX_B_SHORT_TIME_HIGH (FDX_B_SHORT_TIME + FDX_B_JITTER_TIME) -#define FDX_B_LONG_TIME_LOW (FDX_B_LONG_TIME - FDX_B_JITTER_TIME) -#define FDX_B_LONG_TIME_HIGH (FDX_B_LONG_TIME + FDX_B_JITTER_TIME) +#define FDX_B_LONG_TIME_LOW (FDX_B_LONG_TIME - FDX_B_JITTER_TIME) +#define FDX_B_LONG_TIME_HIGH (FDX_B_LONG_TIME + FDX_B_JITTER_TIME) typedef struct { bool last_short; @@ -34,20 +34,20 @@ typedef struct { ProtocolFDXB* protocol_fdx_b_alloc(void) { ProtocolFDXB* protocol = malloc(sizeof(ProtocolFDXB)); return protocol; -}; +} void protocol_fdx_b_free(ProtocolFDXB* protocol) { free(protocol); -}; +} uint8_t* protocol_fdx_b_get_data(ProtocolFDXB* proto) { return proto->data; -}; +} void protocol_fdx_b_decoder_start(ProtocolFDXB* protocol) { memset(protocol->encoded_data, 0, FDX_B_ENCODED_BYTE_FULL_SIZE); protocol->last_short = false; -}; +} static bool protocol_fdx_b_can_be_decoded(ProtocolFDXB* protocol) { bool result = false; @@ -179,7 +179,7 @@ bool protocol_fdx_b_decoder_feed(ProtocolFDXB* protocol, bool level, uint32_t du } return result; -}; +} bool protocol_fdx_b_encoder_start(ProtocolFDXB* protocol) { memset(protocol->encoded_data, 0, FDX_B_ENCODED_BYTE_FULL_SIZE); @@ -203,7 +203,7 @@ bool protocol_fdx_b_encoder_start(ProtocolFDXB* protocol) { protocol->last_short = false; protocol->last_level = false; return true; -}; +} LevelDuration protocol_fdx_b_encoder_yield(ProtocolFDXB* protocol) { uint32_t duration; @@ -228,7 +228,7 @@ LevelDuration protocol_fdx_b_encoder_yield(ProtocolFDXB* protocol) { } return level_duration_make(protocol->last_level, duration); -}; +} // 0 nnnnnnnn // 8 nnnnnnnn 38 bit (12 digit) National code. @@ -320,7 +320,7 @@ void protocol_fdx_b_render_data(ProtocolFDXB* protocol, FuriString* result) { reserved, user_info, replacement_number); -}; +} void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result) { // 38 bits of national code @@ -348,7 +348,7 @@ void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result } else { furi_string_cat(result, "---"); } -}; +} bool protocol_fdx_b_write_data(ProtocolFDXB* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -371,7 +371,7 @@ bool protocol_fdx_b_write_data(ProtocolFDXB* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_fdx_b = { .name = "FDX-B", diff --git a/lib/lfrfid/protocols/protocol_fdx_b.h b/lib/lfrfid/protocols/protocol_fdx_b.h index 549c862e3..78a171db4 100644 --- a/lib/lfrfid/protocols/protocol_fdx_b.h +++ b/lib/lfrfid/protocols/protocol_fdx_b.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_fdx_b; \ No newline at end of file +extern const ProtocolBase protocol_fdx_b; diff --git a/lib/lfrfid/protocols/protocol_gallagher.c b/lib/lfrfid/protocols/protocol_gallagher.c index b00c14acd..9ae0cf80a 100644 --- a/lib/lfrfid/protocols/protocol_gallagher.c +++ b/lib/lfrfid/protocols/protocol_gallagher.c @@ -6,22 +6,22 @@ #define GALLAGHER_CLOCK_PER_BIT (32) -#define GALLAGHER_ENCODED_BIT_SIZE (96) -#define GALLAGHER_ENCODED_BYTE_SIZE ((GALLAGHER_ENCODED_BIT_SIZE) / 8) -#define GALLAGHER_PREAMBLE_BIT_SIZE (16) +#define GALLAGHER_ENCODED_BIT_SIZE (96) +#define GALLAGHER_ENCODED_BYTE_SIZE ((GALLAGHER_ENCODED_BIT_SIZE) / 8) +#define GALLAGHER_PREAMBLE_BIT_SIZE (16) #define GALLAGHER_PREAMBLE_BYTE_SIZE ((GALLAGHER_PREAMBLE_BIT_SIZE) / 8) #define GALLAGHER_ENCODED_BYTE_FULL_SIZE \ (GALLAGHER_ENCODED_BYTE_SIZE + GALLAGHER_PREAMBLE_BYTE_SIZE) #define GALLAGHER_DECODED_DATA_SIZE 8 -#define GALLAGHER_READ_SHORT_TIME (128) -#define GALLAGHER_READ_LONG_TIME (256) +#define GALLAGHER_READ_SHORT_TIME (128) +#define GALLAGHER_READ_LONG_TIME (256) #define GALLAGHER_READ_JITTER_TIME (60) -#define GALLAGHER_READ_SHORT_TIME_LOW (GALLAGHER_READ_SHORT_TIME - GALLAGHER_READ_JITTER_TIME) +#define GALLAGHER_READ_SHORT_TIME_LOW (GALLAGHER_READ_SHORT_TIME - GALLAGHER_READ_JITTER_TIME) #define GALLAGHER_READ_SHORT_TIME_HIGH (GALLAGHER_READ_SHORT_TIME + GALLAGHER_READ_JITTER_TIME) -#define GALLAGHER_READ_LONG_TIME_LOW (GALLAGHER_READ_LONG_TIME - GALLAGHER_READ_JITTER_TIME) -#define GALLAGHER_READ_LONG_TIME_HIGH (GALLAGHER_READ_LONG_TIME + GALLAGHER_READ_JITTER_TIME) +#define GALLAGHER_READ_LONG_TIME_LOW (GALLAGHER_READ_LONG_TIME - GALLAGHER_READ_JITTER_TIME) +#define GALLAGHER_READ_LONG_TIME_HIGH (GALLAGHER_READ_LONG_TIME + GALLAGHER_READ_JITTER_TIME) typedef struct { uint8_t data[GALLAGHER_DECODED_DATA_SIZE]; @@ -36,15 +36,15 @@ typedef struct { ProtocolGallagher* protocol_gallagher_alloc(void) { ProtocolGallagher* proto = malloc(sizeof(ProtocolGallagher)); return (void*)proto; -}; +} void protocol_gallagher_free(ProtocolGallagher* protocol) { free(protocol); -}; +} uint8_t* protocol_gallagher_get_data(ProtocolGallagher* protocol) { return protocol->data; -}; +} static void protocol_gallagher_scramble(uint8_t* data, size_t length) { const uint8_t lut[] = { @@ -152,7 +152,7 @@ void protocol_gallagher_decoder_start(ProtocolGallagher* protocol) { ManchesterEventReset, &protocol->decoder_manchester_state, NULL); -}; +} bool protocol_gallagher_decoder_feed(ProtocolGallagher* protocol, bool level, uint32_t duration) { bool result = false; @@ -189,7 +189,7 @@ bool protocol_gallagher_decoder_feed(ProtocolGallagher* protocol, bool level, ui } return result; -}; +} bool protocol_gallagher_encoder_start(ProtocolGallagher* protocol) { // Preamble @@ -227,7 +227,7 @@ bool protocol_gallagher_encoder_start(ProtocolGallagher* protocol) { bit_lib_set_bits(protocol->encoded_data, 16 + (9 * 8), crc, 8); return true; -}; +} LevelDuration protocol_gallagher_encoder_yield(ProtocolGallagher* protocol) { bool level = bit_lib_get_bit(protocol->encoded_data, protocol->encoded_data_index); @@ -243,7 +243,7 @@ LevelDuration protocol_gallagher_encoder_yield(ProtocolGallagher* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_gallagher_write_data(ProtocolGallagher* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -266,7 +266,7 @@ bool protocol_gallagher_write_data(ProtocolGallagher* protocol, void* data) { result = true; } return result; -}; +} static void protocol_gallagher_render_data_internal( ProtocolGallagher* protocol, @@ -296,7 +296,7 @@ static void protocol_gallagher_render_data_internal( region, issue_level); } -}; +} void protocol_gallagher_render_data(ProtocolGallagher* protocol, FuriString* result) { protocol_gallagher_render_data_internal(protocol, result, false); diff --git a/lib/lfrfid/protocols/protocol_gallagher.h b/lib/lfrfid/protocols/protocol_gallagher.h index 2d922f605..f9fef9ea0 100644 --- a/lib/lfrfid/protocols/protocol_gallagher.h +++ b/lib/lfrfid/protocols/protocol_gallagher.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_gallagher; \ No newline at end of file +extern const ProtocolBase protocol_gallagher; diff --git a/lib/lfrfid/protocols/protocol_h10301.c b/lib/lfrfid/protocols/protocol_h10301.c index 6c6d5771a..66f1c617d 100644 --- a/lib/lfrfid/protocols/protocol_h10301.c +++ b/lib/lfrfid/protocols/protocol_h10301.c @@ -5,14 +5,14 @@ #include "lfrfid_protocols.h" #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) -#define H10301_DECODED_DATA_SIZE (3) +#define H10301_DECODED_DATA_SIZE (3) #define H10301_ENCODED_DATA_SIZE_U32 (3) -#define H10301_ENCODED_DATA_SIZE (sizeof(uint32_t) * H10301_ENCODED_DATA_SIZE_U32) +#define H10301_ENCODED_DATA_SIZE (sizeof(uint32_t) * H10301_ENCODED_DATA_SIZE_U32) -#define H10301_BIT_SIZE (sizeof(uint32_t) * 8) +#define H10301_BIT_SIZE (sizeof(uint32_t) * 8) #define H10301_BIT_MAX_SIZE (H10301_BIT_SIZE * H10301_DECODED_DATA_SIZE) typedef struct { @@ -38,21 +38,21 @@ ProtocolH10301* protocol_h10301_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_h10301_free(ProtocolH10301* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_h10301_get_data(ProtocolH10301* protocol) { return protocol->data; -}; +} void protocol_h10301_decoder_start(ProtocolH10301* protocol) { memset(protocol->encoded_data, 0, sizeof(uint32_t) * 3); -}; +} static void protocol_h10301_decoder_store_data(ProtocolH10301* protocol, bool data) { protocol->encoded_data[0] = (protocol->encoded_data[0] << 1) | @@ -205,7 +205,7 @@ bool protocol_h10301_decoder_feed(ProtocolH10301* protocol, bool level, uint32_t } return result; -}; +} static void protocol_h10301_write_raw_bit(bool bit, uint8_t position, uint32_t* card_data) { if(bit) { @@ -295,7 +295,7 @@ bool protocol_h10301_encoder_start(ProtocolH10301* protocol) { protocol->encoder.pulse = 0; return true; -}; +} LevelDuration protocol_h10301_encoder_yield(ProtocolH10301* protocol) { bool level = 0; @@ -331,7 +331,7 @@ LevelDuration protocol_h10301_encoder_yield(ProtocolH10301* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_h10301_write_data(ProtocolH10301* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -353,7 +353,7 @@ bool protocol_h10301_write_data(ProtocolH10301* protocol, void* data) { result = true; } return result; -}; +} void protocol_h10301_render_data(ProtocolH10301* protocol, FuriString* result) { uint8_t* data = protocol->data; @@ -363,7 +363,7 @@ void protocol_h10301_render_data(ProtocolH10301* protocol, FuriString* result) { "Card: %hu", data[0], (uint16_t)((data[1] << 8) | (data[2]))); -}; +} const ProtocolBase protocol_h10301 = { .name = "H10301", diff --git a/lib/lfrfid/protocols/protocol_h10301.h b/lib/lfrfid/protocols/protocol_h10301.h index b7ee5ad57..03073308e 100644 --- a/lib/lfrfid/protocols/protocol_h10301.h +++ b/lib/lfrfid/protocols/protocol_h10301.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_h10301; \ No newline at end of file +extern const ProtocolBase protocol_h10301; diff --git a/lib/lfrfid/protocols/protocol_hid_ex_generic.c b/lib/lfrfid/protocols/protocol_hid_ex_generic.c index efc7a5190..936a194b8 100644 --- a/lib/lfrfid/protocols/protocol_hid_ex_generic.c +++ b/lib/lfrfid/protocols/protocol_hid_ex_generic.c @@ -6,16 +6,16 @@ #include #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) -#define HID_DATA_SIZE 23 +#define HID_DATA_SIZE 23 #define HID_PREAMBLE_SIZE 1 #define HID_ENCODED_DATA_SIZE (HID_PREAMBLE_SIZE + HID_DATA_SIZE + HID_PREAMBLE_SIZE) -#define HID_ENCODED_BIT_SIZE ((HID_PREAMBLE_SIZE + HID_DATA_SIZE) * 8) +#define HID_ENCODED_BIT_SIZE ((HID_PREAMBLE_SIZE + HID_DATA_SIZE) * 8) #define HID_DECODED_DATA_SIZE (12) -#define HID_DECODED_BIT_SIZE ((HID_ENCODED_BIT_SIZE - HID_PREAMBLE_SIZE * 8) / 2) +#define HID_DECODED_BIT_SIZE ((HID_ENCODED_BIT_SIZE - HID_PREAMBLE_SIZE * 8) / 2) #define HID_PREAMBLE 0x1D @@ -43,21 +43,21 @@ ProtocolHIDEx* protocol_hid_ex_generic_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_hid_ex_generic_free(ProtocolHIDEx* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_hid_ex_generic_get_data(ProtocolHIDEx* protocol) { return protocol->data; -}; +} void protocol_hid_ex_generic_decoder_start(ProtocolHIDEx* protocol) { memset(protocol->encoded_data, 0, HID_ENCODED_DATA_SIZE); -}; +} static bool protocol_hid_ex_generic_can_be_decoded(const uint8_t* data) { // check preamble @@ -110,7 +110,7 @@ bool protocol_hid_ex_generic_decoder_feed(ProtocolHIDEx* protocol, bool level, u } return result; -}; +} static void protocol_hid_ex_generic_encode(ProtocolHIDEx* protocol) { protocol->encoded_data[0] = HID_PREAMBLE; @@ -135,7 +135,7 @@ bool protocol_hid_ex_generic_encoder_start(ProtocolHIDEx* protocol) { protocol_hid_ex_generic_encode(protocol); return true; -}; +} LevelDuration protocol_hid_ex_generic_encoder_yield(ProtocolHIDEx* protocol) { bool level = 0; @@ -165,7 +165,7 @@ LevelDuration protocol_hid_ex_generic_encoder_yield(ProtocolHIDEx* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_hid_ex_generic_write_data(ProtocolHIDEx* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -190,7 +190,7 @@ bool protocol_hid_ex_generic_write_data(ProtocolHIDEx* protocol, void* data) { result = true; } return result; -}; +} void protocol_hid_ex_generic_render_data(ProtocolHIDEx* protocol, FuriString* result) { UNUSED(protocol); @@ -200,7 +200,7 @@ void protocol_hid_ex_generic_render_data(ProtocolHIDEx* protocol, FuriString* re result, "Type: Generic HID Extended\n" "Data: Unknown"); -}; +} const ProtocolBase protocol_hid_ex_generic = { .name = "HIDExt", diff --git a/lib/lfrfid/protocols/protocol_hid_ex_generic.h b/lib/lfrfid/protocols/protocol_hid_ex_generic.h index 9c4ddffff..34877b8a3 100644 --- a/lib/lfrfid/protocols/protocol_hid_ex_generic.h +++ b/lib/lfrfid/protocols/protocol_hid_ex_generic.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_hid_ex_generic; \ No newline at end of file +extern const ProtocolBase protocol_hid_ex_generic; diff --git a/lib/lfrfid/protocols/protocol_hid_generic.c b/lib/lfrfid/protocols/protocol_hid_generic.c index 1a9528885..b7d58d6fd 100644 --- a/lib/lfrfid/protocols/protocol_hid_generic.c +++ b/lib/lfrfid/protocols/protocol_hid_generic.c @@ -6,17 +6,17 @@ #include #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) -#define HID_DATA_SIZE 11 -#define HID_PREAMBLE_SIZE 1 +#define HID_DATA_SIZE 11 +#define HID_PREAMBLE_SIZE 1 #define HID_PROTOCOL_SIZE_UNKNOWN 0 #define HID_ENCODED_DATA_SIZE (HID_PREAMBLE_SIZE + HID_DATA_SIZE + HID_PREAMBLE_SIZE) -#define HID_ENCODED_BIT_SIZE ((HID_PREAMBLE_SIZE + HID_DATA_SIZE) * 8) +#define HID_ENCODED_BIT_SIZE ((HID_PREAMBLE_SIZE + HID_DATA_SIZE) * 8) #define HID_DECODED_DATA_SIZE (6) -#define HID_DECODED_BIT_SIZE ((HID_ENCODED_BIT_SIZE - HID_PREAMBLE_SIZE * 8) / 2) +#define HID_DECODED_BIT_SIZE ((HID_ENCODED_BIT_SIZE - HID_PREAMBLE_SIZE * 8) / 2) #define HID_PREAMBLE 0x1D @@ -43,21 +43,21 @@ ProtocolHID* protocol_hid_generic_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_hid_generic_free(ProtocolHID* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_hid_generic_get_data(ProtocolHID* protocol) { return protocol->data; -}; +} void protocol_hid_generic_decoder_start(ProtocolHID* protocol) { memset(protocol->encoded_data, 0, HID_ENCODED_DATA_SIZE); -}; +} static bool protocol_hid_generic_can_be_decoded(const uint8_t* data) { // check preamble @@ -142,7 +142,7 @@ bool protocol_hid_generic_decoder_feed(ProtocolHID* protocol, bool level, uint32 } return result; -}; +} static void protocol_hid_generic_encode(ProtocolHID* protocol) { protocol->encoded_data[0] = HID_PREAMBLE; @@ -167,7 +167,7 @@ bool protocol_hid_generic_encoder_start(ProtocolHID* protocol) { protocol_hid_generic_encode(protocol); return true; -}; +} LevelDuration protocol_hid_generic_encoder_yield(ProtocolHID* protocol) { bool level = 0; @@ -197,7 +197,7 @@ LevelDuration protocol_hid_generic_encoder_yield(ProtocolHID* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_hid_generic_write_data(ProtocolHID* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -219,7 +219,7 @@ bool protocol_hid_generic_write_data(ProtocolHID* protocol, void* data) { result = true; } return result; -}; +} static void protocol_hid_generic_string_cat_protocol_bits( ProtocolHID* protocol, @@ -261,7 +261,7 @@ void protocol_hid_generic_render_data(ProtocolHID* protocol, FuriString* result) protocol_size); protocol_hid_generic_string_cat_protocol_bits(protocol, protocol_size, result); } -}; +} const ProtocolBase protocol_hid_generic = { .name = "HIDProx", diff --git a/lib/lfrfid/protocols/protocol_hid_generic.h b/lib/lfrfid/protocols/protocol_hid_generic.h index 22e78a4d3..4ffa5dabb 100644 --- a/lib/lfrfid/protocols/protocol_hid_generic.h +++ b/lib/lfrfid/protocols/protocol_hid_generic.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_hid_generic; \ No newline at end of file +extern const ProtocolBase protocol_hid_generic; diff --git a/lib/lfrfid/protocols/protocol_idteck.c b/lib/lfrfid/protocols/protocol_idteck.c index 2075576ba..0fb654597 100644 --- a/lib/lfrfid/protocols/protocol_idteck.c +++ b/lib/lfrfid/protocols/protocol_idteck.c @@ -8,17 +8,17 @@ // 4 9 4 4 5 4 4 B 3 5 1 F B E 4 B // 0100 1001 0100 0100 0101 0100 0100 1011 0011 0101 0001 1111 1011 1110 0100 1011 -#define IDTECK_PREAMBLE_BIT_SIZE (32) +#define IDTECK_PREAMBLE_BIT_SIZE (32) #define IDTECK_PREAMBLE_DATA_SIZE (8) -#define IDTECK_ENCODED_BIT_SIZE (64) +#define IDTECK_ENCODED_BIT_SIZE (64) #define IDTECK_ENCODED_DATA_SIZE (((IDTECK_ENCODED_BIT_SIZE) / 8) + IDTECK_PREAMBLE_DATA_SIZE) #define IDTECK_ENCODED_DATA_LAST ((IDTECK_ENCODED_BIT_SIZE) / 8) -#define IDTECK_DECODED_BIT_SIZE (64) +#define IDTECK_DECODED_BIT_SIZE (64) #define IDTECK_DECODED_DATA_SIZE (8) -#define IDTECK_US_PER_BIT (255) +#define IDTECK_US_PER_BIT (255) #define IDTECK_ENCODER_PULSES_PER_BIT (16) typedef struct { @@ -42,22 +42,22 @@ typedef struct { ProtocolIdteck* protocol_idteck_alloc(void) { ProtocolIdteck* protocol = malloc(sizeof(ProtocolIdteck)); return protocol; -}; +} void protocol_idteck_free(ProtocolIdteck* protocol) { free(protocol); -}; +} uint8_t* protocol_idteck_get_data(ProtocolIdteck* protocol) { return protocol->data; -}; +} void protocol_idteck_decoder_start(ProtocolIdteck* protocol) { memset(protocol->encoded_data, 0, IDTECK_ENCODED_DATA_SIZE); memset(protocol->negative_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE); memset(protocol->corrupted_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE); memset(protocol->corrupted_negative_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE); -}; +} static bool protocol_idteck_check_preamble(uint8_t* data, size_t bit_index) { // Preamble 01001001 01000100 01010100 01001011 @@ -144,7 +144,7 @@ bool protocol_idteck_decoder_feed(ProtocolIdteck* protocol, bool level, uint32_t } return result; -}; +} bool protocol_idteck_encoder_start(ProtocolIdteck* protocol) { memset(protocol->encoded_data, 0, IDTECK_ENCODED_DATA_SIZE); @@ -159,7 +159,7 @@ bool protocol_idteck_encoder_start(ProtocolIdteck* protocol) { protocol->encoder.bit_clock_index = 0; return true; -}; +} LevelDuration protocol_idteck_encoder_yield(ProtocolIdteck* protocol) { LevelDuration level_duration; @@ -189,7 +189,7 @@ LevelDuration protocol_idteck_encoder_yield(ProtocolIdteck* protocol) { } return level_duration; -}; +} // factory code static uint32_t get_fc(const uint8_t* data) { @@ -232,7 +232,7 @@ bool protocol_idteck_write_data(ProtocolIdteck* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_idteck = { .name = "Idteck", diff --git a/lib/lfrfid/protocols/protocol_indala26.c b/lib/lfrfid/protocols/protocol_indala26.c index 893361abb..d0a711daa 100644 --- a/lib/lfrfid/protocols/protocol_indala26.c +++ b/lib/lfrfid/protocols/protocol_indala26.c @@ -3,7 +3,7 @@ #include #include "lfrfid_protocols.h" -#define INDALA26_PREAMBLE_BIT_SIZE (33) +#define INDALA26_PREAMBLE_BIT_SIZE (33) #define INDALA26_PREAMBLE_DATA_SIZE (5) #define INDALA26_ENCODED_BIT_SIZE (64) @@ -11,10 +11,10 @@ (((INDALA26_ENCODED_BIT_SIZE) / 8) + INDALA26_PREAMBLE_DATA_SIZE) #define INDALA26_ENCODED_DATA_LAST ((INDALA26_ENCODED_BIT_SIZE) / 8) -#define INDALA26_DECODED_BIT_SIZE (28) +#define INDALA26_DECODED_BIT_SIZE (28) #define INDALA26_DECODED_DATA_SIZE (4) -#define INDALA26_US_PER_BIT (255) +#define INDALA26_US_PER_BIT (255) #define INDALA26_ENCODER_PULSES_PER_BIT (16) typedef struct { @@ -38,22 +38,22 @@ typedef struct { ProtocolIndala* protocol_indala26_alloc(void) { ProtocolIndala* protocol = malloc(sizeof(ProtocolIndala)); return protocol; -}; +} void protocol_indala26_free(ProtocolIndala* protocol) { free(protocol); -}; +} uint8_t* protocol_indala26_get_data(ProtocolIndala* protocol) { return protocol->data; -}; +} void protocol_indala26_decoder_start(ProtocolIndala* protocol) { memset(protocol->encoded_data, 0, INDALA26_ENCODED_DATA_SIZE); memset(protocol->negative_encoded_data, 0, INDALA26_ENCODED_DATA_SIZE); memset(protocol->corrupted_encoded_data, 0, INDALA26_ENCODED_DATA_SIZE); memset(protocol->corrupted_negative_encoded_data, 0, INDALA26_ENCODED_DATA_SIZE); -}; +} static bool protocol_indala26_check_preamble(uint8_t* data, size_t bit_index) { // Preamble 10100000 00000000 00000000 00000000 1 @@ -146,7 +146,7 @@ bool protocol_indala26_decoder_feed(ProtocolIndala* protocol, bool level, uint32 } return result; -}; +} bool protocol_indala26_encoder_start(ProtocolIndala* protocol) { memset(protocol->encoded_data, 0, INDALA26_ENCODED_DATA_SIZE); @@ -164,7 +164,7 @@ bool protocol_indala26_encoder_start(ProtocolIndala* protocol) { protocol->encoder.bit_clock_index = 0; return true; -}; +} LevelDuration protocol_indala26_encoder_yield(ProtocolIndala* protocol) { LevelDuration level_duration; @@ -194,7 +194,7 @@ LevelDuration protocol_indala26_encoder_yield(ProtocolIndala* protocol) { } return level_duration; -}; +} // factory code static uint8_t get_fc(const uint8_t* data) { @@ -328,7 +328,7 @@ bool protocol_indala26_write_data(ProtocolIndala* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_indala26 = { .name = "Indala26", diff --git a/lib/lfrfid/protocols/protocol_io_prox_xsf.c b/lib/lfrfid/protocols/protocol_io_prox_xsf.c index b41cb66f3..bce4e817d 100644 --- a/lib/lfrfid/protocols/protocol_io_prox_xsf.c +++ b/lib/lfrfid/protocols/protocol_io_prox_xsf.c @@ -6,13 +6,13 @@ #include "lfrfid_protocols.h" #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) #define IOPROXXSF_DECODED_DATA_SIZE (4) #define IOPROXXSF_ENCODED_DATA_SIZE (8) -#define IOPROXXSF_BIT_SIZE (8) +#define IOPROXXSF_BIT_SIZE (8) #define IOPROXXSF_BIT_MAX_SIZE (IOPROXXSF_BIT_SIZE * IOPROXXSF_ENCODED_DATA_SIZE) typedef struct { @@ -36,21 +36,21 @@ ProtocolIOProxXSF* protocol_io_prox_xsf_alloc(void) { protocol->decoder.fsk_demod = fsk_demod_alloc(MIN_TIME, 8, MAX_TIME, 6); protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 64); return protocol; -}; +} void protocol_io_prox_xsf_free(ProtocolIOProxXSF* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_io_prox_xsf_get_data(ProtocolIOProxXSF* protocol) { return protocol->data; -}; +} void protocol_io_prox_xsf_decoder_start(ProtocolIOProxXSF* protocol) { memset(protocol->encoded_data, 0, IOPROXXSF_ENCODED_DATA_SIZE); -}; +} static uint8_t protocol_io_prox_xsf_compute_checksum(const uint8_t* data) { // Packet structure: @@ -172,7 +172,7 @@ bool protocol_io_prox_xsf_decoder_feed(ProtocolIOProxXSF* protocol, bool level, } return result; -}; +} static void protocol_io_prox_xsf_encode(const uint8_t* decoded_data, uint8_t* encoded_data) { // Packet to transmit: @@ -217,7 +217,7 @@ bool protocol_io_prox_xsf_encoder_start(ProtocolIOProxXSF* protocol) { protocol->encoder.encoded_index = 0; fsk_osc_reset(protocol->encoder.fsk_osc); return true; -}; +} LevelDuration protocol_io_prox_xsf_encoder_yield(ProtocolIOProxXSF* protocol) { bool level; @@ -230,7 +230,7 @@ LevelDuration protocol_io_prox_xsf_encoder_yield(ProtocolIOProxXSF* protocol) { bit_lib_increment_index(protocol->encoder.encoded_index, IOPROXXSF_BIT_MAX_SIZE); } return level_duration_make(level, duration); -}; +} void protocol_io_prox_xsf_render_data(ProtocolIOProxXSF* protocol, FuriString* result) { uint8_t* data = protocol->data; @@ -274,7 +274,7 @@ bool protocol_io_prox_xsf_write_data(ProtocolIOProxXSF* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_io_prox_xsf = { .name = "IoProxXSF", diff --git a/lib/lfrfid/protocols/protocol_jablotron.c b/lib/lfrfid/protocols/protocol_jablotron.c index c2cbb4174..643bb1be6 100644 --- a/lib/lfrfid/protocols/protocol_jablotron.c +++ b/lib/lfrfid/protocols/protocol_jablotron.c @@ -5,23 +5,23 @@ #include #include "lfrfid_protocols.h" -#define JABLOTRON_ENCODED_BIT_SIZE (64) -#define JABLOTRON_ENCODED_BYTE_SIZE (((JABLOTRON_ENCODED_BIT_SIZE) / 8)) -#define JABLOTRON_PREAMBLE_BIT_SIZE (16) +#define JABLOTRON_ENCODED_BIT_SIZE (64) +#define JABLOTRON_ENCODED_BYTE_SIZE (((JABLOTRON_ENCODED_BIT_SIZE) / 8)) +#define JABLOTRON_PREAMBLE_BIT_SIZE (16) #define JABLOTRON_PREAMBLE_BYTE_SIZE (2) #define JABLOTRON_ENCODED_BYTE_FULL_SIZE \ (JABLOTRON_ENCODED_BYTE_SIZE + JABLOTRON_PREAMBLE_BYTE_SIZE) #define JABLOTRON_DECODED_DATA_SIZE (5) -#define JABLOTRON_SHORT_TIME (256) -#define JABLOTRON_LONG_TIME (512) +#define JABLOTRON_SHORT_TIME (256) +#define JABLOTRON_LONG_TIME (512) #define JABLOTRON_JITTER_TIME (120) -#define JABLOTRON_SHORT_TIME_LOW (JABLOTRON_SHORT_TIME - JABLOTRON_JITTER_TIME) +#define JABLOTRON_SHORT_TIME_LOW (JABLOTRON_SHORT_TIME - JABLOTRON_JITTER_TIME) #define JABLOTRON_SHORT_TIME_HIGH (JABLOTRON_SHORT_TIME + JABLOTRON_JITTER_TIME) -#define JABLOTRON_LONG_TIME_LOW (JABLOTRON_LONG_TIME - JABLOTRON_JITTER_TIME) -#define JABLOTRON_LONG_TIME_HIGH (JABLOTRON_LONG_TIME + JABLOTRON_JITTER_TIME) +#define JABLOTRON_LONG_TIME_LOW (JABLOTRON_LONG_TIME - JABLOTRON_JITTER_TIME) +#define JABLOTRON_LONG_TIME_HIGH (JABLOTRON_LONG_TIME + JABLOTRON_JITTER_TIME) typedef struct { bool last_short; @@ -34,20 +34,20 @@ typedef struct { ProtocolJablotron* protocol_jablotron_alloc(void) { ProtocolJablotron* protocol = malloc(sizeof(ProtocolJablotron)); return protocol; -}; +} void protocol_jablotron_free(ProtocolJablotron* protocol) { free(protocol); -}; +} uint8_t* protocol_jablotron_get_data(ProtocolJablotron* proto) { return proto->data; -}; +} void protocol_jablotron_decoder_start(ProtocolJablotron* protocol) { memset(protocol->encoded_data, 0, JABLOTRON_ENCODED_BYTE_FULL_SIZE); protocol->last_short = false; -}; +} uint8_t protocol_jablotron_checksum(uint8_t* bits) { uint8_t chksum = 0; @@ -115,7 +115,7 @@ bool protocol_jablotron_decoder_feed(ProtocolJablotron* protocol, bool level, ui } return false; -}; +} bool protocol_jablotron_encoder_start(ProtocolJablotron* protocol) { // preamble @@ -133,7 +133,7 @@ bool protocol_jablotron_encoder_start(ProtocolJablotron* protocol) { protocol->last_short = false; protocol->last_level = false; return true; -}; +} LevelDuration protocol_jablotron_encoder_yield(ProtocolJablotron* protocol) { uint32_t duration; @@ -158,12 +158,12 @@ LevelDuration protocol_jablotron_encoder_yield(ProtocolJablotron* protocol) { } return level_duration_make(protocol->last_level, duration); -}; +} void protocol_jablotron_render_data(ProtocolJablotron* protocol, FuriString* result) { uint64_t id = protocol_jablotron_card_id(protocol->data); furi_string_printf(result, "Card: %llX", id); -}; +} bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -184,7 +184,7 @@ bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_jablotron = { .name = "Jablotron", diff --git a/lib/lfrfid/protocols/protocol_jablotron.h b/lib/lfrfid/protocols/protocol_jablotron.h index 4de57de42..08b96c20b 100644 --- a/lib/lfrfid/protocols/protocol_jablotron.h +++ b/lib/lfrfid/protocols/protocol_jablotron.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_jablotron; \ No newline at end of file +extern const ProtocolBase protocol_jablotron; diff --git a/lib/lfrfid/protocols/protocol_keri.c b/lib/lfrfid/protocols/protocol_keri.c index 2cc7e8cdf..666369dce 100644 --- a/lib/lfrfid/protocols/protocol_keri.c +++ b/lib/lfrfid/protocols/protocol_keri.c @@ -3,17 +3,17 @@ #include #include "lfrfid_protocols.h" -#define KERI_PREAMBLE_BIT_SIZE (33) +#define KERI_PREAMBLE_BIT_SIZE (33) #define KERI_PREAMBLE_DATA_SIZE (5) -#define KERI_ENCODED_BIT_SIZE (64) +#define KERI_ENCODED_BIT_SIZE (64) #define KERI_ENCODED_DATA_SIZE (((KERI_ENCODED_BIT_SIZE) / 8) + KERI_PREAMBLE_DATA_SIZE) #define KERI_ENCODED_DATA_LAST ((KERI_ENCODED_BIT_SIZE) / 8) -#define KERI_DECODED_BIT_SIZE (28) +#define KERI_DECODED_BIT_SIZE (28) #define KERI_DECODED_DATA_SIZE (4) -#define KERI_US_PER_BIT (255) +#define KERI_US_PER_BIT (255) #define KERI_ENCODER_PULSES_PER_BIT (16) typedef struct { @@ -37,22 +37,22 @@ typedef struct { ProtocolKeri* protocol_keri_alloc(void) { ProtocolKeri* protocol = malloc(sizeof(ProtocolKeri)); return protocol; -}; +} void protocol_keri_free(ProtocolKeri* protocol) { free(protocol); -}; +} uint8_t* protocol_keri_get_data(ProtocolKeri* protocol) { return protocol->data; -}; +} void protocol_keri_decoder_start(ProtocolKeri* protocol) { memset(protocol->encoded_data, 0, KERI_ENCODED_DATA_SIZE); memset(protocol->negative_encoded_data, 0, KERI_ENCODED_DATA_SIZE); memset(protocol->corrupted_encoded_data, 0, KERI_ENCODED_DATA_SIZE); memset(protocol->corrupted_negative_encoded_data, 0, KERI_ENCODED_DATA_SIZE); -}; +} static bool protocol_keri_check_preamble(uint8_t* data, size_t bit_index) { // Preamble 11100000 00000000 00000000 00000000 1 @@ -164,7 +164,7 @@ bool protocol_keri_decoder_feed(ProtocolKeri* protocol, bool level, uint32_t dur } return result; -}; +} bool protocol_keri_encoder_start(ProtocolKeri* protocol) { memset(protocol->encoded_data, 0, KERI_ENCODED_DATA_SIZE); @@ -180,7 +180,7 @@ bool protocol_keri_encoder_start(ProtocolKeri* protocol) { protocol->encoder.bit_clock_index = 0; return true; -}; +} LevelDuration protocol_keri_encoder_yield(ProtocolKeri* protocol) { LevelDuration level_duration; @@ -210,7 +210,7 @@ LevelDuration protocol_keri_encoder_yield(ProtocolKeri* protocol) { } return level_duration; -}; +} static void protocol_keri_render_data_internal(ProtocolKeri* protocol, FuriString* result, bool brief) { @@ -267,7 +267,7 @@ bool protocol_keri_write_data(ProtocolKeri* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_keri = { .name = "Keri", diff --git a/lib/lfrfid/protocols/protocol_nexwatch.c b/lib/lfrfid/protocols/protocol_nexwatch.c index 3df83be7a..a794a4a8e 100644 --- a/lib/lfrfid/protocols/protocol_nexwatch.c +++ b/lib/lfrfid/protocols/protocol_nexwatch.c @@ -3,16 +3,16 @@ #include #include "lfrfid_protocols.h" -#define NEXWATCH_PREAMBLE_BIT_SIZE (8) +#define NEXWATCH_PREAMBLE_BIT_SIZE (8) #define NEXWATCH_PREAMBLE_DATA_SIZE (1) -#define NEXWATCH_ENCODED_BIT_SIZE (96) +#define NEXWATCH_ENCODED_BIT_SIZE (96) #define NEXWATCH_ENCODED_DATA_SIZE ((NEXWATCH_ENCODED_BIT_SIZE) / 8) -#define NEXWATCH_DECODED_BIT_SIZE (NEXWATCH_DECODED_DATA_SIZE * 8) +#define NEXWATCH_DECODED_BIT_SIZE (NEXWATCH_DECODED_DATA_SIZE * 8) #define NEXWATCH_DECODED_DATA_SIZE (8) -#define NEXWATCH_US_PER_BIT (255) +#define NEXWATCH_US_PER_BIT (255) #define NEXWATCH_ENCODER_PULSES_PER_BIT (16) typedef struct { @@ -47,22 +47,22 @@ typedef struct { ProtocolNexwatch* protocol_nexwatch_alloc(void) { ProtocolNexwatch* protocol = malloc(sizeof(ProtocolNexwatch)); return protocol; -}; +} void protocol_nexwatch_free(ProtocolNexwatch* protocol) { free(protocol); -}; +} uint8_t* protocol_nexwatch_get_data(ProtocolNexwatch* protocol) { return protocol->data; -}; +} void protocol_nexwatch_decoder_start(ProtocolNexwatch* protocol) { memset(protocol->encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); memset(protocol->negative_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); memset(protocol->corrupted_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); memset(protocol->corrupted_negative_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); -}; +} static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) { // 01010110 @@ -71,7 +71,7 @@ static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) { } static uint8_t protocol_nexwatch_parity_swap(uint8_t parity) { - uint8_t a = (((parity >> 3) & 1)); + uint8_t a = ((parity >> 3) & 1); a |= (((parity >> 1) & 1) << 1); a |= (((parity >> 2) & 1) << 2); a |= ((parity & 1) << 3); @@ -215,7 +215,7 @@ bool protocol_nexwatch_decoder_feed(ProtocolNexwatch* protocol, bool level, uint } return result; -}; +} bool protocol_nexwatch_encoder_start(ProtocolNexwatch* protocol) { memset(protocol->encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); @@ -231,7 +231,7 @@ bool protocol_nexwatch_encoder_start(ProtocolNexwatch* protocol) { protocol->encoder.bit_clock_index = 0; return true; -}; +} LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) { LevelDuration level_duration; @@ -261,7 +261,7 @@ LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) { } return level_duration; -}; +} static void protocol_nexwatch_render_data_internal( ProtocolNexwatch* protocol, @@ -328,7 +328,7 @@ bool protocol_nexwatch_write_data(ProtocolNexwatch* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_nexwatch = { .name = "Nexwatch", diff --git a/lib/lfrfid/protocols/protocol_pac_stanley.c b/lib/lfrfid/protocols/protocol_pac_stanley.c index c59b0871d..4d4c58e99 100644 --- a/lib/lfrfid/protocols/protocol_pac_stanley.c +++ b/lib/lfrfid/protocols/protocol_pac_stanley.c @@ -5,13 +5,13 @@ #include #include "lfrfid_protocols.h" -#define PAC_STANLEY_ENCODED_BIT_SIZE (128) -#define PAC_STANLEY_ENCODED_BYTE_SIZE (((PAC_STANLEY_ENCODED_BIT_SIZE) / 8)) -#define PAC_STANLEY_PREAMBLE_BIT_SIZE (8) +#define PAC_STANLEY_ENCODED_BIT_SIZE (128) +#define PAC_STANLEY_ENCODED_BYTE_SIZE (((PAC_STANLEY_ENCODED_BIT_SIZE) / 8)) +#define PAC_STANLEY_PREAMBLE_BIT_SIZE (8) #define PAC_STANLEY_PREAMBLE_BYTE_SIZE (1) #define PAC_STANLEY_ENCODED_BYTE_FULL_SIZE \ (PAC_STANLEY_ENCODED_BYTE_SIZE + PAC_STANLEY_PREAMBLE_BYTE_SIZE) -#define PAC_STANLEY_BYTE_LENGTH (10) // start bit, 7 data bits, parity bit, stop bit +#define PAC_STANLEY_BYTE_LENGTH (10) // start bit, 7 data bits, parity bit, stop bit #define PAC_STANLEY_DATA_START_INDEX (8 + (3 * PAC_STANLEY_BYTE_LENGTH) + 1) #define PAC_STANLEY_DECODED_DATA_SIZE (4) @@ -19,8 +19,8 @@ #define PAC_STANLEY_CLOCKS_IN_US (32) #define PAC_STANLEY_CYCLE_LENGTH (256) -#define PAC_STANLEY_MIN_TIME (60) -#define PAC_STANLEY_MAX_TIME (4000) +#define PAC_STANLEY_MIN_TIME (60) +#define PAC_STANLEY_MAX_TIME (4000) typedef struct { bool inverted; diff --git a/lib/lfrfid/protocols/protocol_pac_stanley.h b/lib/lfrfid/protocols/protocol_pac_stanley.h index 3ca329cf7..322a6c95f 100644 --- a/lib/lfrfid/protocols/protocol_pac_stanley.h +++ b/lib/lfrfid/protocols/protocol_pac_stanley.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_pac_stanley; \ No newline at end of file +extern const ProtocolBase protocol_pac_stanley; diff --git a/lib/lfrfid/protocols/protocol_paradox.c b/lib/lfrfid/protocols/protocol_paradox.c index bb52f0529..f04b58113 100644 --- a/lib/lfrfid/protocols/protocol_paradox.c +++ b/lib/lfrfid/protocols/protocol_paradox.c @@ -6,13 +6,13 @@ #include "lfrfid_protocols.h" #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) #define PARADOX_DECODED_DATA_SIZE (6) -#define PARADOX_PREAMBLE_LENGTH (8) -#define PARADOX_ENCODED_BIT_SIZE (96) +#define PARADOX_PREAMBLE_LENGTH (8) +#define PARADOX_ENCODED_BIT_SIZE (96) #define PARADOX_ENCODED_DATA_SIZE (((PARADOX_ENCODED_BIT_SIZE) / 8) + 1) #define PARADOX_ENCODED_DATA_LAST (PARADOX_ENCODED_DATA_SIZE - 1) @@ -38,21 +38,21 @@ ProtocolParadox* protocol_paradox_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_paradox_free(ProtocolParadox* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_paradox_get_data(ProtocolParadox* protocol) { return protocol->data; -}; +} void protocol_paradox_decoder_start(ProtocolParadox* protocol) { memset(protocol->encoded_data, 0, PARADOX_ENCODED_DATA_SIZE); -}; +} static bool protocol_paradox_can_be_decoded(ProtocolParadox* protocol) { // check preamble @@ -101,7 +101,7 @@ bool protocol_paradox_decoder_feed(ProtocolParadox* protocol, bool level, uint32 } return false; -}; +} static void protocol_paradox_encode(const uint8_t* decoded_data, uint8_t* encoded_data) { // preamble @@ -114,14 +114,14 @@ static void protocol_paradox_encode(const uint8_t* decoded_data, uint8_t* encode bit_lib_set_bits(encoded_data, PARADOX_PREAMBLE_LENGTH + i * 2, 0b01, 2); } } -}; +} bool protocol_paradox_encoder_start(ProtocolParadox* protocol) { protocol_paradox_encode(protocol->data, (uint8_t*)protocol->encoded_data); protocol->encoder.encoded_index = 0; fsk_osc_reset(protocol->encoder.fsk_osc); return true; -}; +} LevelDuration protocol_paradox_encoder_yield(ProtocolParadox* protocol) { bool level; @@ -134,7 +134,7 @@ LevelDuration protocol_paradox_encoder_yield(ProtocolParadox* protocol) { bit_lib_increment_index(protocol->encoder.encoded_index, PARADOX_ENCODED_BIT_SIZE); } return level_duration_make(level, duration); -}; +} static uint8_t protocol_paradox_calculate_checksum(uint8_t fc, uint16_t card_id) { uint8_t card_hi = (card_id >> 8) & 0xff; @@ -185,7 +185,7 @@ void protocol_paradox_render_data(ProtocolParadox* protocol, FuriString* result) if(card_crc != calc_crc) { furi_string_cat(result, "\nCRC Mismatch, Invalid Card!"); } -}; +} void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* result) { uint8_t* decoded_data = protocol->data; @@ -200,7 +200,7 @@ void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* r if(calc_crc != card_crc) { furi_string_cat(result, "\nCRC Mismatch, Invalid Card!"); } -}; +} bool protocol_paradox_write_data(ProtocolParadox* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -222,7 +222,7 @@ bool protocol_paradox_write_data(ProtocolParadox* protocol, void* data) { result = true; } return result; -}; +} const ProtocolBase protocol_paradox = { .name = "Paradox", diff --git a/lib/lfrfid/protocols/protocol_paradox.h b/lib/lfrfid/protocols/protocol_paradox.h index a80696c35..7c0bf5692 100644 --- a/lib/lfrfid/protocols/protocol_paradox.h +++ b/lib/lfrfid/protocols/protocol_paradox.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_paradox; \ No newline at end of file +extern const ProtocolBase protocol_paradox; diff --git a/lib/lfrfid/protocols/protocol_pyramid.c b/lib/lfrfid/protocols/protocol_pyramid.c index 7143a3acc..cab217d14 100644 --- a/lib/lfrfid/protocols/protocol_pyramid.c +++ b/lib/lfrfid/protocols/protocol_pyramid.c @@ -6,17 +6,17 @@ #include #define JITTER_TIME (20) -#define MIN_TIME (64 - JITTER_TIME) -#define MAX_TIME (80 + JITTER_TIME) +#define MIN_TIME (64 - JITTER_TIME) +#define MAX_TIME (80 + JITTER_TIME) -#define PYRAMID_DATA_SIZE 13 +#define PYRAMID_DATA_SIZE 13 #define PYRAMID_PREAMBLE_SIZE 3 #define PYRAMID_ENCODED_DATA_SIZE \ (PYRAMID_PREAMBLE_SIZE + PYRAMID_DATA_SIZE + PYRAMID_PREAMBLE_SIZE) -#define PYRAMID_ENCODED_BIT_SIZE ((PYRAMID_PREAMBLE_SIZE + PYRAMID_DATA_SIZE) * 8) +#define PYRAMID_ENCODED_BIT_SIZE ((PYRAMID_PREAMBLE_SIZE + PYRAMID_DATA_SIZE) * 8) #define PYRAMID_DECODED_DATA_SIZE (4) -#define PYRAMID_DECODED_BIT_SIZE ((PYRAMID_ENCODED_BIT_SIZE - PYRAMID_PREAMBLE_SIZE * 8) / 2) +#define PYRAMID_DECODED_BIT_SIZE ((PYRAMID_ENCODED_BIT_SIZE - PYRAMID_PREAMBLE_SIZE * 8) / 2) typedef struct { FSKDemod* fsk_demod; @@ -41,21 +41,21 @@ ProtocolPyramid* protocol_pyramid_alloc(void) { protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50); return protocol; -}; +} void protocol_pyramid_free(ProtocolPyramid* protocol) { fsk_demod_free(protocol->decoder.fsk_demod); fsk_osc_free(protocol->encoder.fsk_osc); free(protocol); -}; +} uint8_t* protocol_pyramid_get_data(ProtocolPyramid* protocol) { return protocol->data; -}; +} void protocol_pyramid_decoder_start(ProtocolPyramid* protocol) { memset(protocol->encoded_data, 0, PYRAMID_ENCODED_DATA_SIZE); -}; +} static bool protocol_pyramid_can_be_decoded(uint8_t* data) { // check preamble @@ -122,7 +122,7 @@ bool protocol_pyramid_decoder_feed(ProtocolPyramid* protocol, bool level, uint32 } return result; -}; +} bool protocol_pyramid_get_parity(const uint8_t* bits, uint8_t type, int length) { int x; @@ -184,7 +184,7 @@ bool protocol_pyramid_encoder_start(ProtocolPyramid* protocol) { protocol_pyramid_encode(protocol); return true; -}; +} LevelDuration protocol_pyramid_encoder_yield(ProtocolPyramid* protocol) { bool level = 0; @@ -214,7 +214,7 @@ LevelDuration protocol_pyramid_encoder_yield(ProtocolPyramid* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_pyramid_write_data(ProtocolPyramid* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -238,7 +238,7 @@ bool protocol_pyramid_write_data(ProtocolPyramid* protocol, void* data) { result = true; } return result; -}; +} void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result) { uint8_t* decoded_data = protocol->data; @@ -256,7 +256,7 @@ void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result) } else { furi_string_cat_printf(result, "Data: Unknown"); } -}; +} const ProtocolBase protocol_pyramid = { .name = "Pyramid", diff --git a/lib/lfrfid/protocols/protocol_securakey.c b/lib/lfrfid/protocols/protocol_securakey.c index 81536b771..a4bfeca60 100644 --- a/lib/lfrfid/protocols/protocol_securakey.c +++ b/lib/lfrfid/protocols/protocol_securakey.c @@ -11,28 +11,29 @@ #include #define TAG "SECURAKEY" + #define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BITS (96) #define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BYTE (12) #define SECURAKEY_RKKTH_ENCODED_FULL_SIZE_BITS (64) #define SECURAKEY_RKKTH_ENCODED_FULL_SIZE_BYTE (8) -#define SECURAKEY_DECODED_DATA_SIZE_BITS (48) +#define SECURAKEY_DECODED_DATA_SIZE_BITS (48) // RKKT: 16-bit for facility code/number, 16-bit for card number, 16-bit for two checksum // RKKTH: 16-bit zero padding, 32-bit card number #define SECURAKEY_DECODED_DATA_SIZE_BYTES (SECURAKEY_DECODED_DATA_SIZE_BITS / 8) -#define LFRFID_FREQUENCY (125000) -#define SECURAKEY_CLOCK_PER_BIT (40) // RF/40 +#define LFRFID_FREQUENCY (125000) +#define SECURAKEY_CLOCK_PER_BIT (40) // RF/40 #define SECURAKEY_READ_LONG_TIME \ (1000000 / (LFRFID_FREQUENCY / SECURAKEY_CLOCK_PER_BIT)) // 1000000 micro sec / sec -#define SECURAKEY_READ_SHORT_TIME (SECURAKEY_READ_LONG_TIME / 2) +#define SECURAKEY_READ_SHORT_TIME (SECURAKEY_READ_LONG_TIME / 2) #define SECURAKEY_READ_JITTER_TIME (SECURAKEY_READ_SHORT_TIME * 40 / 100) // 40% jitter tolerance #define SECURAKEY_READ_SHORT_TIME_LOW \ (SECURAKEY_READ_SHORT_TIME - \ SECURAKEY_READ_JITTER_TIME) // these are used for manchester decoding #define SECURAKEY_READ_SHORT_TIME_HIGH (SECURAKEY_READ_SHORT_TIME + SECURAKEY_READ_JITTER_TIME) -#define SECURAKEY_READ_LONG_TIME_LOW (SECURAKEY_READ_LONG_TIME - SECURAKEY_READ_JITTER_TIME) -#define SECURAKEY_READ_LONG_TIME_HIGH (SECURAKEY_READ_LONG_TIME + SECURAKEY_READ_JITTER_TIME) +#define SECURAKEY_READ_LONG_TIME_LOW (SECURAKEY_READ_LONG_TIME - SECURAKEY_READ_JITTER_TIME) +#define SECURAKEY_READ_LONG_TIME_HIGH (SECURAKEY_READ_LONG_TIME + SECURAKEY_READ_JITTER_TIME) typedef struct { uint8_t data[SECURAKEY_DECODED_DATA_SIZE_BYTES]; @@ -47,15 +48,15 @@ typedef struct { ProtocolSecurakey* protocol_securakey_alloc(void) { ProtocolSecurakey* protocol = malloc(sizeof(ProtocolSecurakey)); return (void*)protocol; -}; +} void protocol_securakey_free(ProtocolSecurakey* protocol) { free(protocol); -}; +} uint8_t* protocol_securakey_get_data(ProtocolSecurakey* protocol) { return protocol->data; -}; +} static bool protocol_securakey_can_be_decoded(ProtocolSecurakey* protocol) { // check 19 bits preamble + format flag @@ -71,7 +72,7 @@ static bool protocol_securakey_can_be_decoded(ProtocolSecurakey* protocol) { } else { return false; } -}; +} static void protocol_securakey_decode(ProtocolSecurakey* protocol) { memset(protocol->data, 0, SECURAKEY_DECODED_DATA_SIZE_BYTES); @@ -142,7 +143,7 @@ static void protocol_securakey_decode(ProtocolSecurakey* protocol) { // plaintext format (preamble and 32-bit? card number) // pppppppp pppppppp cccccccc cccccccc cccccccc cccccccc // 00000000 00000000 00101011 00011101 00000100 01001010 -}; +} void protocol_securakey_decoder_start(ProtocolSecurakey* protocol) { // always takes in encoded data as RKKT for simplicity @@ -153,7 +154,7 @@ void protocol_securakey_decoder_start(ProtocolSecurakey* protocol) { ManchesterEventReset, &protocol->decoder_manchester_state, NULL); -}; +} bool protocol_securakey_decoder_feed(ProtocolSecurakey* protocol, bool level, uint32_t duration) { bool result = false; @@ -187,7 +188,7 @@ bool protocol_securakey_decoder_feed(ProtocolSecurakey* protocol, bool level, ui } } return result; -}; +} void protocol_securakey_render_data(ProtocolSecurakey* protocol, FuriString* result) { if(bit_lib_get_bits_16(protocol->data, 0, 16) == 0) { @@ -209,7 +210,7 @@ void protocol_securakey_render_data(ProtocolSecurakey* protocol, FuriString* res bit_lib_get_bits_16(protocol->data, 0, 16), bit_lib_get_bits_16(protocol->data, 16, 16)); } -}; +} bool protocol_securakey_encoder_start(ProtocolSecurakey* protocol) { // set all of our encoded_data bits to zeros. @@ -277,7 +278,7 @@ bool protocol_securakey_encoder_start(ProtocolSecurakey* protocol) { protocol->encoded_data_index = 0; protocol->encoded_polarity = true; return true; -}; +} LevelDuration protocol_securakey_encoder_yield(ProtocolSecurakey* protocol) { if(bit_lib_get_bits_16(protocol->data, 0, 16) == 0) { @@ -305,7 +306,7 @@ LevelDuration protocol_securakey_encoder_yield(ProtocolSecurakey* protocol) { } return level_duration_make(level, duration); } -}; +} bool protocol_securakey_write_data(ProtocolSecurakey* protocol, void* data) { protocol_securakey_encoder_start(protocol); @@ -337,7 +338,7 @@ bool protocol_securakey_write_data(ProtocolSecurakey* protocol, void* data) { } } return result; -}; +} const ProtocolBase protocol_securakey = { .name = "Radio Key", @@ -361,4 +362,4 @@ const ProtocolBase protocol_securakey = { .render_data = (ProtocolRenderData)protocol_securakey_render_data, .render_brief_data = (ProtocolRenderData)protocol_securakey_render_data, .write_data = (ProtocolWriteData)protocol_securakey_write_data, -}; \ No newline at end of file +}; diff --git a/lib/lfrfid/protocols/protocol_securakey.h b/lib/lfrfid/protocols/protocol_securakey.h index ad990f119..4af153e3d 100644 --- a/lib/lfrfid/protocols/protocol_securakey.h +++ b/lib/lfrfid/protocols/protocol_securakey.h @@ -1,4 +1,4 @@ #pragma once #include -extern const ProtocolBase protocol_securakey; \ No newline at end of file +extern const ProtocolBase protocol_securakey; diff --git a/lib/lfrfid/protocols/protocol_viking.c b/lib/lfrfid/protocols/protocol_viking.c index 4989e4e68..78499a415 100644 --- a/lib/lfrfid/protocols/protocol_viking.c +++ b/lib/lfrfid/protocols/protocol_viking.c @@ -6,21 +6,21 @@ #define VIKING_CLOCK_PER_BIT (32) -#define VIKING_ENCODED_BIT_SIZE (64) -#define VIKING_ENCODED_BYTE_SIZE (((VIKING_ENCODED_BIT_SIZE) / 8)) -#define VIKING_PREAMBLE_BIT_SIZE (24) -#define VIKING_PREAMBLE_BYTE_SIZE (3) +#define VIKING_ENCODED_BIT_SIZE (64) +#define VIKING_ENCODED_BYTE_SIZE (((VIKING_ENCODED_BIT_SIZE) / 8)) +#define VIKING_PREAMBLE_BIT_SIZE (24) +#define VIKING_PREAMBLE_BYTE_SIZE (3) #define VIKING_ENCODED_BYTE_FULL_SIZE (VIKING_ENCODED_BYTE_SIZE + VIKING_PREAMBLE_BYTE_SIZE) -#define VIKING_DECODED_DATA_SIZE 4 +#define VIKING_DECODED_DATA_SIZE 4 -#define VIKING_READ_SHORT_TIME (128) -#define VIKING_READ_LONG_TIME (256) +#define VIKING_READ_SHORT_TIME (128) +#define VIKING_READ_LONG_TIME (256) #define VIKING_READ_JITTER_TIME (60) -#define VIKING_READ_SHORT_TIME_LOW (VIKING_READ_SHORT_TIME - VIKING_READ_JITTER_TIME) +#define VIKING_READ_SHORT_TIME_LOW (VIKING_READ_SHORT_TIME - VIKING_READ_JITTER_TIME) #define VIKING_READ_SHORT_TIME_HIGH (VIKING_READ_SHORT_TIME + VIKING_READ_JITTER_TIME) -#define VIKING_READ_LONG_TIME_LOW (VIKING_READ_LONG_TIME - VIKING_READ_JITTER_TIME) -#define VIKING_READ_LONG_TIME_HIGH (VIKING_READ_LONG_TIME + VIKING_READ_JITTER_TIME) +#define VIKING_READ_LONG_TIME_LOW (VIKING_READ_LONG_TIME - VIKING_READ_JITTER_TIME) +#define VIKING_READ_LONG_TIME_HIGH (VIKING_READ_LONG_TIME + VIKING_READ_JITTER_TIME) typedef struct { uint8_t data[VIKING_DECODED_DATA_SIZE]; @@ -35,15 +35,15 @@ typedef struct { ProtocolViking* protocol_viking_alloc(void) { ProtocolViking* proto = malloc(sizeof(ProtocolViking)); return (void*)proto; -}; +} void protocol_viking_free(ProtocolViking* protocol) { free(protocol); -}; +} uint8_t* protocol_viking_get_data(ProtocolViking* protocol) { return protocol->data; -}; +} static void protocol_viking_decode(ProtocolViking* protocol) { // Copy Card ID @@ -80,7 +80,7 @@ void protocol_viking_decoder_start(ProtocolViking* protocol) { ManchesterEventReset, &protocol->decoder_manchester_state, NULL); -}; +} bool protocol_viking_decoder_feed(ProtocolViking* protocol, bool level, uint32_t duration) { bool result = false; @@ -117,7 +117,7 @@ bool protocol_viking_decoder_feed(ProtocolViking* protocol, bool level, uint32_t } return result; -}; +} bool protocol_viking_encoder_start(ProtocolViking* protocol) { // Preamble @@ -135,7 +135,7 @@ bool protocol_viking_encoder_start(ProtocolViking* protocol) { bit_lib_set_bits(protocol->encoded_data, 56, checksum, 8); return true; -}; +} LevelDuration protocol_viking_encoder_yield(ProtocolViking* protocol) { bool level = bit_lib_get_bit(protocol->encoded_data, protocol->encoded_data_index); @@ -151,7 +151,7 @@ LevelDuration protocol_viking_encoder_yield(ProtocolViking* protocol) { } return level_duration_make(level, duration); -}; +} bool protocol_viking_write_data(ProtocolViking* protocol, void* data) { LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; @@ -173,11 +173,11 @@ bool protocol_viking_write_data(ProtocolViking* protocol, void* data) { result = true; } return result; -}; +} void protocol_viking_render_data(ProtocolViking* protocol, FuriString* result) { furi_string_printf(result, "ID: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32)); -}; +} const ProtocolBase protocol_viking = { .name = "Viking", diff --git a/lib/lfrfid/tools/fsk_ocs.c b/lib/lfrfid/tools/fsk_ocs.c index 1fd46cf17..a71e24aac 100644 --- a/lib/lfrfid/tools/fsk_ocs.c +++ b/lib/lfrfid/tools/fsk_ocs.c @@ -59,4 +59,4 @@ bool fsk_osc_next_half(FSKOsc* osc, bool bit, bool* level, uint32_t* duration) { } return advance; -} \ No newline at end of file +} diff --git a/lib/lfrfid/tools/fsk_osc.h b/lib/lfrfid/tools/fsk_osc.h index ed7d436c8..048f090ab 100644 --- a/lib/lfrfid/tools/fsk_osc.h +++ b/lib/lfrfid/tools/fsk_osc.h @@ -57,4 +57,4 @@ bool fsk_osc_next_half(FSKOsc* osc, bool bit, bool* level, uint32_t* duration); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/lfrfid/tools/t5577.c b/lib/lfrfid/tools/t5577.c index 9d0d28fc5..59ec7d272 100644 --- a/lib/lfrfid/tools/t5577.c +++ b/lib/lfrfid/tools/t5577.c @@ -5,13 +5,13 @@ #define T5577_TIMING_WAIT_TIME 400 #define T5577_TIMING_START_GAP 30 #define T5577_TIMING_WRITE_GAP 18 -#define T5577_TIMING_DATA_0 24 -#define T5577_TIMING_DATA_1 56 -#define T5577_TIMING_PROGRAM 700 +#define T5577_TIMING_DATA_0 24 +#define T5577_TIMING_DATA_1 56 +#define T5577_TIMING_PROGRAM 700 #define T5577_OPCODE_PAGE_0 0b10 #define T5577_OPCODE_PAGE_1 0b11 -#define T5577_OPCODE_RESET 0b00 +#define T5577_OPCODE_RESET 0b00 #define T5577_BLOCKS_IN_PAGE_0 8 #define T5577_BLOCKS_IN_PAGE_1 4 diff --git a/lib/lfrfid/tools/t5577.h b/lib/lfrfid/tools/t5577.h index f7b5cc4f5..026e7290b 100644 --- a/lib/lfrfid/tools/t5577.h +++ b/lib/lfrfid/tools/t5577.h @@ -9,35 +9,35 @@ extern "C" { #define LFRFID_T5577_BLOCK_COUNT 8 // T5577 block 0 definitions, thanks proxmark3! -#define LFRFID_T5577_POR_DELAY 0x00000001 -#define LFRFID_T5577_ST_TERMINATOR 0x00000008 -#define LFRFID_T5577_PWD 0x00000010 -#define LFRFID_T5577_MAXBLOCK_SHIFT 5 -#define LFRFID_T5577_AOR 0x00000200 -#define LFRFID_T5577_PSKCF_RF_2 0 -#define LFRFID_T5577_PSKCF_RF_4 0x00000400 -#define LFRFID_T5577_PSKCF_RF_8 0x00000800 -#define LFRFID_T5577_MODULATION_DIRECT 0 -#define LFRFID_T5577_MODULATION_PSK1 0x00001000 -#define LFRFID_T5577_MODULATION_PSK2 0x00002000 -#define LFRFID_T5577_MODULATION_PSK3 0x00003000 -#define LFRFID_T5577_MODULATION_FSK1 0x00004000 -#define LFRFID_T5577_MODULATION_FSK2 0x00005000 -#define LFRFID_T5577_MODULATION_FSK1a 0x00006000 -#define LFRFID_T5577_MODULATION_FSK2a 0x00007000 +#define LFRFID_T5577_POR_DELAY 0x00000001 +#define LFRFID_T5577_ST_TERMINATOR 0x00000008 +#define LFRFID_T5577_PWD 0x00000010 +#define LFRFID_T5577_MAXBLOCK_SHIFT 5 +#define LFRFID_T5577_AOR 0x00000200 +#define LFRFID_T5577_PSKCF_RF_2 0 +#define LFRFID_T5577_PSKCF_RF_4 0x00000400 +#define LFRFID_T5577_PSKCF_RF_8 0x00000800 +#define LFRFID_T5577_MODULATION_DIRECT 0 +#define LFRFID_T5577_MODULATION_PSK1 0x00001000 +#define LFRFID_T5577_MODULATION_PSK2 0x00002000 +#define LFRFID_T5577_MODULATION_PSK3 0x00003000 +#define LFRFID_T5577_MODULATION_FSK1 0x00004000 +#define LFRFID_T5577_MODULATION_FSK2 0x00005000 +#define LFRFID_T5577_MODULATION_FSK1a 0x00006000 +#define LFRFID_T5577_MODULATION_FSK2a 0x00007000 #define LFRFID_T5577_MODULATION_MANCHESTER 0x00008000 -#define LFRFID_T5577_MODULATION_BIPHASE 0x00010000 -#define LFRFID_T5577_MODULATION_DIPHASE 0x00018000 -#define LFRFID_T5577_X_MODE 0x00020000 -#define LFRFID_T5577_BITRATE_RF_8 0 -#define LFRFID_T5577_BITRATE_RF_16 0x00040000 -#define LFRFID_T5577_BITRATE_RF_32 0x00080000 -#define LFRFID_T5577_BITRATE_RF_40 0x000C0000 -#define LFRFID_T5577_BITRATE_RF_50 0x00100000 -#define LFRFID_T5577_BITRATE_RF_64 0x00140000 -#define LFRFID_T5577_BITRATE_RF_100 0x00180000 -#define LFRFID_T5577_BITRATE_RF_128 0x001C0000 -#define LFRFID_T5577_TESTMODE_DISABLED 0x60000000 +#define LFRFID_T5577_MODULATION_BIPHASE 0x00010000 +#define LFRFID_T5577_MODULATION_DIPHASE 0x00018000 +#define LFRFID_T5577_X_MODE 0x00020000 +#define LFRFID_T5577_BITRATE_RF_8 0 +#define LFRFID_T5577_BITRATE_RF_16 0x00040000 +#define LFRFID_T5577_BITRATE_RF_32 0x00080000 +#define LFRFID_T5577_BITRATE_RF_40 0x000C0000 +#define LFRFID_T5577_BITRATE_RF_50 0x00100000 +#define LFRFID_T5577_BITRATE_RF_64 0x00140000 +#define LFRFID_T5577_BITRATE_RF_100 0x00180000 +#define LFRFID_T5577_BITRATE_RF_128 0x001C0000 +#define LFRFID_T5577_TESTMODE_DISABLED 0x60000000 typedef struct { uint32_t block[LFRFID_T5577_BLOCK_COUNT]; @@ -58,4 +58,4 @@ void t5577_write_with_mask(LFRFIDT5577* data, uint8_t page, bool with_pass, uint #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/lfrfid/tools/varint_pair.h b/lib/lfrfid/tools/varint_pair.h index 12697a7a6..4567e2d04 100644 --- a/lib/lfrfid/tools/varint_pair.h +++ b/lib/lfrfid/tools/varint_pair.h @@ -76,4 +76,4 @@ bool varint_pair_unpack( #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/music_worker/music_worker.c b/lib/music_worker/music_worker.c index 3225134b7..ce91f6029 100644 --- a/lib/music_worker/music_worker.c +++ b/lib/music_worker/music_worker.c @@ -12,12 +12,12 @@ #define TAG "MusicWorker" #define MUSIC_PLAYER_FILETYPE "Flipper Music Format" -#define MUSIC_PLAYER_VERSION 0 +#define MUSIC_PLAYER_VERSION 0 #define SEMITONE_PAUSE 0xFF -#define NOTE_C4 261.63f -#define NOTE_C4_SEMITONE (4.0f * 12.0f) +#define NOTE_C4 261.63f +#define NOTE_C4_SEMITONE (4.0f * 12.0f) #define TWO_POW_TWELTH_ROOT 1.059463094359f typedef struct { diff --git a/lib/nfc/helpers/crypto1.c b/lib/nfc/helpers/crypto1.c index 571c4ac31..bd4fc8d61 100644 --- a/lib/nfc/helpers/crypto1.c +++ b/lib/nfc/helpers/crypto1.c @@ -8,7 +8,7 @@ #define SWAPENDIAN(x) \ ((x) = ((x) >> 8 & 0xff00ff) | ((x) & 0xff00ff) << 8, (x) = (x) >> 16 | (x) << 16) -#define LF_POLY_ODD (0x29CE5C) +#define LF_POLY_ODD (0x29CE5C) #define LF_POLY_EVEN (0x870804) #define BEBIT(x, n) FURI_BIT(x, (n) ^ 24) diff --git a/lib/nfc/helpers/felica_crc.c b/lib/nfc/helpers/felica_crc.c index bba7cee34..e1b4fc287 100644 --- a/lib/nfc/helpers/felica_crc.c +++ b/lib/nfc/helpers/felica_crc.c @@ -45,7 +45,7 @@ bool felica_crc_check(const BitBuffer* buf) { const uint8_t* data = bit_buffer_get_data(buf); const uint16_t crc_calc = felica_crc_calculate(data, data_size - FELICA_CRC_SIZE); - return (crc_calc == crc_received); + return crc_calc == crc_received; } void felica_crc_trim(BitBuffer* buf) { diff --git a/lib/nfc/helpers/iso13239_crc.c b/lib/nfc/helpers/iso13239_crc.c index c1affba46..3837382e3 100644 --- a/lib/nfc/helpers/iso13239_crc.c +++ b/lib/nfc/helpers/iso13239_crc.c @@ -2,9 +2,9 @@ #include -#define ISO13239_CRC_INIT_DEFAULT (0xFFFFU) +#define ISO13239_CRC_INIT_DEFAULT (0xFFFFU) #define ISO13239_CRC_INIT_PICOPASS (0xE012U) -#define ISO13239_CRC_POLY (0x8408U) +#define ISO13239_CRC_POLY (0x8408U) static uint16_t iso13239_crc_calculate(Iso13239CrcType type, const uint8_t* data, size_t data_size) { @@ -55,7 +55,7 @@ bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) { const uint8_t* data = bit_buffer_get_data(buf); const uint16_t crc_calc = iso13239_crc_calculate(type, data, data_size - ISO13239_CRC_SIZE); - return (crc_calc == crc_received); + return crc_calc == crc_received; } void iso13239_crc_trim(BitBuffer* buf) { diff --git a/lib/nfc/helpers/iso14443_4_layer.c b/lib/nfc/helpers/iso14443_4_layer.c index d5b0d32de..3e8c6e83a 100644 --- a/lib/nfc/helpers/iso14443_4_layer.c +++ b/lib/nfc/helpers/iso14443_4_layer.c @@ -2,7 +2,7 @@ #include -#define ISO14443_4_BLOCK_PCB (1U << 1) +#define ISO14443_4_BLOCK_PCB (1U << 1) #define ISO14443_4_BLOCK_PCB_I (0U) #define ISO14443_4_BLOCK_PCB_R (5U << 5) #define ISO14443_4_BLOCK_PCB_S (3U << 6) diff --git a/lib/nfc/helpers/iso14443_crc.c b/lib/nfc/helpers/iso14443_crc.c index 33789bd71..88d5f41d2 100644 --- a/lib/nfc/helpers/iso14443_crc.c +++ b/lib/nfc/helpers/iso14443_crc.c @@ -50,7 +50,7 @@ bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) { const uint8_t* data = bit_buffer_get_data(buf); const uint16_t crc_calc = iso14443_crc_calculate(type, data, data_size - ISO14443_CRC_SIZE); - return (crc_calc == crc_received); + return crc_calc == crc_received; } void iso14443_crc_trim(BitBuffer* buf) { diff --git a/lib/nfc/helpers/nfc_util.c b/lib/nfc/helpers/nfc_util.c index 31ade8fc7..f502b4bfb 100644 --- a/lib/nfc/helpers/nfc_util.c +++ b/lib/nfc/helpers/nfc_util.c @@ -17,7 +17,7 @@ uint8_t nfc_util_even_parity32(uint32_t data) { // data ^= data >> 16; // data ^= data >> 8; // return !nfc_util_odd_byte_parity[data]; - return (__builtin_parity(data) & 0xFF); + return __builtin_parity(data) & 0xFF; } uint8_t nfc_util_odd_parity8(uint8_t data) { @@ -45,4 +45,4 @@ void nfc_util_odd_parity(const uint8_t* src, uint8_t* dst, uint8_t len) { if(bit) { *dst = parity; } -} \ No newline at end of file +} diff --git a/lib/nfc/nfc_common.h b/lib/nfc/nfc_common.h index c3cccf697..1da6e307a 100644 --- a/lib/nfc/nfc_common.h +++ b/lib/nfc/nfc_common.h @@ -9,13 +9,13 @@ extern "C" { #endif /* NFC file format version which changed ATQA format. Deprecated. */ -#define NFC_LSB_ATQA_FORMAT_VERSION (2) +#define NFC_LSB_ATQA_FORMAT_VERSION (2) /* NFC file format version which is still supported as backwards compatible. */ #define NFC_MINIMUM_SUPPORTED_FORMAT_VERSION NFC_LSB_ATQA_FORMAT_VERSION /* NFC file format version which implemented the unified loading process. */ -#define NFC_UNIFIED_FORMAT_VERSION (4) +#define NFC_UNIFIED_FORMAT_VERSION (4) /* Current NFC file format version. */ -#define NFC_CURRENT_FORMAT_VERSION NFC_UNIFIED_FORMAT_VERSION +#define NFC_CURRENT_FORMAT_VERSION NFC_UNIFIED_FORMAT_VERSION #ifdef __cplusplus } diff --git a/lib/nfc/nfc_device.c b/lib/nfc/nfc_device.c index 9f95dfc15..463b2df1a 100644 --- a/lib/nfc/nfc_device.c +++ b/lib/nfc/nfc_device.c @@ -6,10 +6,10 @@ #include "nfc_common.h" #include "protocols/nfc_device_defs.h" -#define NFC_FILE_HEADER "Flipper NFC device" +#define NFC_FILE_HEADER "Flipper NFC device" #define NFC_DEV_TYPE_ERROR "Protocol type mismatch" -#define NFC_DEVICE_UID_KEY "UID" +#define NFC_DEVICE_UID_KEY "UID" #define NFC_DEVICE_TYPE_KEY "Device type" #define NFC_DEVICE_UID_MAX_LEN (10U) diff --git a/lib/nfc/protocols/felica/felica.c b/lib/nfc/protocols/felica/felica.c index 89e610f86..e9ffb771a 100644 --- a/lib/nfc/protocols/felica/felica.c +++ b/lib/nfc/protocols/felica/felica.c @@ -5,10 +5,10 @@ #include #define FELICA_PROTOCOL_NAME "FeliCa" -#define FELICA_DEVICE_NAME "FeliCa" +#define FELICA_DEVICE_NAME "FeliCa" -#define FELICA_DATA_FORMAT_VERSION "Data format version" -#define FELICA_MANUFACTURE_ID "Manufacture id" +#define FELICA_DATA_FORMAT_VERSION "Data format version" +#define FELICA_MANUFACTURE_ID "Manufacture id" #define FELICA_MANUFACTURE_PARAMETER "Manufacture parameter" static const uint32_t felica_data_format_version = 1; @@ -353,4 +353,4 @@ void felica_calculate_mac_write( memcpy(session_swapped, session_key + 8, 8); memcpy(session_swapped + 8, session_key, 8); felica_calculate_mac(ctx, session_swapped, rc, first_block, data, FELICA_DATA_BLOCK_SIZE, mac); -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/felica/felica.h b/lib/nfc/protocols/felica/felica.h index 17229c150..7b9c78e07 100644 --- a/lib/nfc/protocols/felica/felica.h +++ b/lib/nfc/protocols/felica/felica.h @@ -8,44 +8,44 @@ extern "C" { #endif -#define FELICA_IDM_SIZE (8U) -#define FELICA_PMM_SIZE (8U) +#define FELICA_IDM_SIZE (8U) +#define FELICA_PMM_SIZE (8U) #define FELICA_DATA_BLOCK_SIZE (16U) -#define FELICA_CMD_READ_WITHOUT_ENCRYPTION (0x06U) +#define FELICA_CMD_READ_WITHOUT_ENCRYPTION (0x06U) #define FELICA_CMD_WRITE_WITHOUT_ENCRYPTION (0x08U) #define FELICA_SERVICE_RW_ACCESS (0x0009U) #define FELICA_SERVICE_RO_ACCESS (0x000BU) -#define FELICA_BLOCKS_TOTAL_COUNT (28U) -#define FELICA_BLOCK_INDEX_REG (0x0EU) -#define FELICA_BLOCK_INDEX_RC (0x80U) -#define FELICA_BLOCK_INDEX_MAC (0x81U) -#define FELICA_BLOCK_INDEX_ID (0x82U) -#define FELICA_BLOCK_INDEX_D_ID (0x83U) -#define FELICA_BLOCK_INDEX_SER_C (0x84U) -#define FELICA_BLOCK_INDEX_SYS_C (0x85U) -#define FELICA_BLOCK_INDEX_CKV (0x86U) -#define FELICA_BLOCK_INDEX_CK (0x87U) -#define FELICA_BLOCK_INDEX_MC (0x88U) -#define FELICA_BLOCK_INDEX_WCNT (0x90U) -#define FELICA_BLOCK_INDEX_MAC_A (0x91U) -#define FELICA_BLOCK_INDEX_STATE (0x92U) +#define FELICA_BLOCKS_TOTAL_COUNT (28U) +#define FELICA_BLOCK_INDEX_REG (0x0EU) +#define FELICA_BLOCK_INDEX_RC (0x80U) +#define FELICA_BLOCK_INDEX_MAC (0x81U) +#define FELICA_BLOCK_INDEX_ID (0x82U) +#define FELICA_BLOCK_INDEX_D_ID (0x83U) +#define FELICA_BLOCK_INDEX_SER_C (0x84U) +#define FELICA_BLOCK_INDEX_SYS_C (0x85U) +#define FELICA_BLOCK_INDEX_CKV (0x86U) +#define FELICA_BLOCK_INDEX_CK (0x87U) +#define FELICA_BLOCK_INDEX_MC (0x88U) +#define FELICA_BLOCK_INDEX_WCNT (0x90U) +#define FELICA_BLOCK_INDEX_MAC_A (0x91U) +#define FELICA_BLOCK_INDEX_STATE (0x92U) #define FELICA_BLOCK_INDEX_CRC_CHECK (0xA0U) -#define FELICA_GUARD_TIME_US (20000U) -#define FELICA_FDT_POLL_FC (10000U) +#define FELICA_GUARD_TIME_US (20000U) +#define FELICA_FDT_POLL_FC (10000U) #define FELICA_POLL_POLL_MIN_US (1280U) #define FELICA_FDT_LISTEN_FC (1172) #define FELICA_SYSTEM_CODE_CODE (0xFFFFU) -#define FELICA_TIME_SLOT_1 (0x00U) -#define FELICA_TIME_SLOT_2 (0x01U) -#define FELICA_TIME_SLOT_4 (0x03U) -#define FELICA_TIME_SLOT_8 (0x07U) -#define FELICA_TIME_SLOT_16 (0x0FU) +#define FELICA_TIME_SLOT_1 (0x00U) +#define FELICA_TIME_SLOT_2 (0x01U) +#define FELICA_TIME_SLOT_4 (0x03U) +#define FELICA_TIME_SLOT_8 (0x07U) +#define FELICA_TIME_SLOT_16 (0x0FU) /** @brief Type of possible Felica errors */ typedef enum { @@ -174,8 +174,8 @@ typedef struct { typedef struct { uint8_t service_code : 4; - uint8_t access_mode : 3; - uint8_t length : 1; + uint8_t access_mode : 3; + uint8_t length : 1; uint8_t block_number; } FelicaBlockListElement; diff --git a/lib/nfc/protocols/felica/felica_listener.c b/lib/nfc/protocols/felica/felica_listener.c index 90215eced..d019eb21d 100644 --- a/lib/nfc/protocols/felica/felica_listener.c +++ b/lib/nfc/protocols/felica/felica_listener.c @@ -4,8 +4,8 @@ #include #include -#define FELICA_LISTENER_MAX_BUFFER_SIZE (128) -#define FELICA_LISTENER_RESPONSE_CODE_READ (0x07) +#define FELICA_LISTENER_MAX_BUFFER_SIZE (128) +#define FELICA_LISTENER_RESPONSE_CODE_READ (0x07) #define FELICA_LISTENER_RESPONSE_CODE_WRITE (0x09) #define TAG "FelicaListener" @@ -207,4 +207,4 @@ const NfcListenerBase nfc_listener_felica = { .set_callback = (NfcListenerSetCallback)felica_listener_set_callback, .get_data = (NfcListenerGetData)felica_listener_get_data, .run = (NfcListenerRun)felica_listener_run, -}; \ No newline at end of file +}; diff --git a/lib/nfc/protocols/felica/felica_listener.h b/lib/nfc/protocols/felica/felica_listener.h index d210befa5..a7cbbe38c 100644 --- a/lib/nfc/protocols/felica/felica_listener.h +++ b/lib/nfc/protocols/felica/felica_listener.h @@ -11,4 +11,4 @@ typedef struct FelicaListener FelicaListener; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/nfc/protocols/felica/felica_listener_i.c b/lib/nfc/protocols/felica/felica_listener_i.c index caab11778..b3ae24635 100644 --- a/lib/nfc/protocols/felica/felica_listener_i.c +++ b/lib/nfc/protocols/felica/felica_listener_i.c @@ -2,25 +2,25 @@ #include -#define FELICA_WCNT_MC2_FF_MAX_VALUE (0x00FFFFFFU) -#define FELICA_WCNT_MC2_00_MAX_VALUE (0x00FFFE00U) +#define FELICA_WCNT_MC2_FF_MAX_VALUE (0x00FFFFFFU) +#define FELICA_WCNT_MC2_00_MAX_VALUE (0x00FFFE00U) #define FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE (0x00001027U) -#define FELICA_WCNT_MC2_00_WARNING_END_VALUE (0x00FFFDFFU) +#define FELICA_WCNT_MC2_00_WARNING_END_VALUE (0x00FFFDFFU) -#define FELICA_MC_SP_REG_ALL_RW_BYTES_0_1 (0U) -#define FELICA_MC_ALL_BYTE (2U) -#define FELICA_MC_SYS_OP (3U) -#define FELICA_MC_RF_PRM (4U) -#define FELICA_MC_CKCKV_W_MAC_A (5U) -#define FELICA_MC_SP_REG_R_RESTR_BYTES_6_7 (6U) -#define FELICA_MC_SP_REG_W_RESTR_BYTES_8_9 (8U) +#define FELICA_MC_SP_REG_ALL_RW_BYTES_0_1 (0U) +#define FELICA_MC_ALL_BYTE (2U) +#define FELICA_MC_SYS_OP (3U) +#define FELICA_MC_RF_PRM (4U) +#define FELICA_MC_CKCKV_W_MAC_A (5U) +#define FELICA_MC_SP_REG_R_RESTR_BYTES_6_7 (6U) +#define FELICA_MC_SP_REG_W_RESTR_BYTES_8_9 (8U) #define FELICA_MC_SP_REG_W_MAC_A_BYTES_10_11 (10U) -#define FELICA_MC_STATE_W_MAC_A (12U) -#define FELICA_MC_RESERVED_13 (13U) -#define FELICA_MC_RESERVED_14 (14U) -#define FELICA_MC_RESERVED_15 (15U) +#define FELICA_MC_STATE_W_MAC_A (12U) +#define FELICA_MC_RESERVED_13 (13U) +#define FELICA_MC_RESERVED_14 (14U) +#define FELICA_MC_RESERVED_15 (15U) -#define FELICA_MC_BYTE_GET(data, byte) (data->data.fs.mc.data[byte]) +#define FELICA_MC_BYTE_GET(data, byte) (data->data.fs.mc.data[byte]) #define FELICA_SYSTEM_BLOCK_RO_ACCESS(data) (FELICA_MC_BYTE_GET(data, FELICA_MC_ALL_BYTE) == 0x00) #define FELICA_SYSTEM_BLOCK_RW_ACCESS(data) (FELICA_MC_BYTE_GET(data, FELICA_MC_ALL_BYTE) == 0xFF) @@ -39,10 +39,9 @@ static uint32_t felica_wcnt_get_max_value(const FelicaData* data) { static bool felica_wcnt_check_warning_boundary(const FelicaData* data) { const uint32_t* wcnt_ptr = (uint32_t*)data->data.fs.wcnt.data; - return ( - FELICA_SYSTEM_BLOCK_RO_ACCESS(data) && - ((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) && - (*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE))); + return FELICA_SYSTEM_BLOCK_RO_ACCESS(data) && + ((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) && + (*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE)); } static bool felica_wcnt_check_error_boundary(const FelicaData* data) { @@ -138,7 +137,7 @@ static bool felica_listener_check_write_request_data_size( uint8_t possible_data_size = fact_item_cnt * FELICA_DATA_BLOCK_SIZE; uint8_t fact_data_size = request->base.length - sizeof(FelicaListenerGenericRequest) - instance->block_list_size; - return (possible_data_size <= fact_data_size); + return possible_data_size <= fact_data_size; } static bool felica_listener_test_block_list_size_bounds(const FelicaListenerGenericRequest* req) { @@ -735,4 +734,4 @@ FelicaError } while(false); return ret; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/felica/felica_listener_i.h b/lib/nfc/protocols/felica/felica_listener_i.h index 43c03a608..0ea144249 100644 --- a/lib/nfc/protocols/felica/felica_listener_i.h +++ b/lib/nfc/protocols/felica/felica_listener_i.h @@ -2,8 +2,8 @@ #include -#define FELICA_LISTENER_READ_BLOCK_COUNT_MAX (4U) -#define FELICA_LISTENER_READ_BLOCK_COUNT_MIN (1U) +#define FELICA_LISTENER_READ_BLOCK_COUNT_MAX (4U) +#define FELICA_LISTENER_READ_BLOCK_COUNT_MIN (1U) #define FELICA_LISTENER_WRITE_BLOCK_COUNT_MAX (2U) #define FELICA_LISTENER_WRITE_BLOCK_COUNT_MIN (1U) diff --git a/lib/nfc/protocols/felica/felica_poller_i.h b/lib/nfc/protocols/felica/felica_poller_i.h index 9857d96d6..df205ba67 100644 --- a/lib/nfc/protocols/felica/felica_poller_i.h +++ b/lib/nfc/protocols/felica/felica_poller_i.h @@ -11,7 +11,7 @@ extern "C" { #define FELICA_POLLER_POLLING_FWT (200000U) -#define FELICA_POLLER_CMD_POLLING_REQ_CODE (0x00U) +#define FELICA_POLLER_CMD_POLLING_REQ_CODE (0x00U) #define FELICA_POLLER_CMD_POLLING_RESP_CODE (0x01U) typedef enum { diff --git a/lib/nfc/protocols/felica/felica_poller_sync.c b/lib/nfc/protocols/felica/felica_poller_sync.c index f20ff08e1..ec73227f5 100644 --- a/lib/nfc/protocols/felica/felica_poller_sync.c +++ b/lib/nfc/protocols/felica/felica_poller_sync.c @@ -67,4 +67,4 @@ FelicaError felica_poller_sync_read(Nfc* nfc, FelicaData* data, const FelicaCard } return poller_context.error; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a.c b/lib/nfc/protocols/iso14443_3a/iso14443_3a.c index 96e30e5c8..fc527a59c 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a.c +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a.c @@ -6,11 +6,11 @@ #define ISO14443A_ATS_BIT (1U << 5) #define ISO14443_3A_PROTOCOL_NAME_LEGACY "UID" -#define ISO14443_3A_PROTOCOL_NAME "ISO14443-3A" -#define ISO14443_3A_DEVICE_NAME "ISO14443-3A (Unknown)" +#define ISO14443_3A_PROTOCOL_NAME "ISO14443-3A" +#define ISO14443_3A_DEVICE_NAME "ISO14443-3A (Unknown)" #define ISO14443_3A_ATQA_KEY "ATQA" -#define ISO14443_3A_SAK_KEY "SAK" +#define ISO14443_3A_SAK_KEY "SAK" const NfcDeviceBase nfc_device_iso14443_3a = { .protocol_name = ISO14443_3A_PROTOCOL_NAME, diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a.h b/lib/nfc/protocols/iso14443_3a/iso14443_3a.h index 714c1dada..0a8bd2413 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a.h +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a.h @@ -7,16 +7,16 @@ extern "C" { #endif -#define ISO14443_3A_UID_4_BYTES (4U) -#define ISO14443_3A_UID_7_BYTES (7U) +#define ISO14443_3A_UID_4_BYTES (4U) +#define ISO14443_3A_UID_7_BYTES (7U) #define ISO14443_3A_UID_10_BYTES (10U) #define ISO14443_3A_MAX_UID_SIZE ISO14443_3A_UID_10_BYTES -#define ISO14443_3A_GUARD_TIME_US (5000) -#define ISO14443_3A_FDT_POLL_FC (1620) -#define ISO14443_3A_FDT_LISTEN_FC (1172) +#define ISO14443_3A_GUARD_TIME_US (5000) +#define ISO14443_3A_FDT_POLL_FC (1620) +#define ISO14443_3A_FDT_LISTEN_FC (1172) #define ISO14443_3A_POLLER_MASK_RX_FS ((ISO14443_3A_FDT_LISTEN_FC) / 2) -#define ISO14443_3A_POLL_POLL_MIN_US (1100) +#define ISO14443_3A_POLL_POLL_MIN_US (1100) typedef enum { Iso14443_3aErrorNone, diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a_listener_i.c b/lib/nfc/protocols/iso14443_3a/iso14443_3a_listener_i.c index 46501503c..33320f492 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a_listener_i.c +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a_listener_i.c @@ -47,7 +47,7 @@ Iso14443_3aError iso14443_3a_listener_tx_with_custom_parity( } return ret; -}; +} Iso14443_3aError iso14443_3a_listener_send_standard_frame( Iso14443_3aListener* instance, diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.h b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.h index 664d54598..29a8c29b5 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.h +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.h @@ -12,7 +12,7 @@ extern "C" { #define ISO14443_3A_POLLER_SEL_CMD(cascade_lvl) (0x93 + 2 * (cascade_lvl)) #define ISO14443_3A_POLLER_SEL_PAR(bytes, bits) (((bytes) << 4 & 0xf0U) | ((bits) & 0x0fU)) -#define ISO14443_3A_POLLER_SDD_CL (0x88U) +#define ISO14443_3A_POLLER_SDD_CL (0x88U) typedef enum { Iso14443_3aPollerColResStateStateIdle, diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_sync.c b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_sync.c index 52ba7e845..2bbc65564 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_sync.c +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_sync.c @@ -55,4 +55,4 @@ Iso14443_3aError iso14443_3a_poller_sync_read(Nfc* nfc, Iso14443_3aData* iso1444 } return poller_context.error; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b.c b/lib/nfc/protocols/iso14443_3b/iso14443_3b.c index c2dc7e5a0..caae5f0c9 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b.c +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b.c @@ -7,9 +7,9 @@ #include #define ISO14443_3B_PROTOCOL_NAME "ISO14443-3B" -#define ISO14443_3B_DEVICE_NAME "ISO14443-3B (Unknown)" +#define ISO14443_3B_DEVICE_NAME "ISO14443-3B (Unknown)" -#define ISO14443_3B_APP_DATA_KEY "Application data" +#define ISO14443_3B_APP_DATA_KEY "Application data" #define ISO14443_3B_PROTOCOL_INFO_KEY "Protocol info" #define ISO14443_3B_FDT_POLL_DEFAULT_FC (ISO14443_3B_FDT_POLL_FC) diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b_i.h b/lib/nfc/protocols/iso14443_3b/iso14443_3b_i.h index f4ff36bd7..01e9a914b 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b_i.h +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b_i.h @@ -2,20 +2,20 @@ #include "iso14443_3b.h" -#define ISO14443_3B_UID_SIZE (4U) +#define ISO14443_3B_UID_SIZE (4U) #define ISO14443_3B_APP_DATA_SIZE (4U) -#define ISO14443_3B_GUARD_TIME_US (5000U) -#define ISO14443_3B_FDT_POLL_FC (9000U) +#define ISO14443_3B_GUARD_TIME_US (5000U) +#define ISO14443_3B_FDT_POLL_FC (9000U) #define ISO14443_3B_POLL_POLL_MIN_US (1280U) -#define ISO14443_3B_BIT_RATE_BOTH_106KBIT (0U << 0) -#define ISO14443_3B_BIT_RATE_PCD_TO_PICC_212KBIT (1U << 0) -#define ISO14443_3B_BIT_RATE_PCD_TO_PICC_424KBIT (1U << 1) -#define ISO14443_3B_BIT_RATE_PCD_TO_PICC_848KBIT (1U << 2) -#define ISO14443_3B_BIT_RATE_PICC_TO_PCD_212KBIT (1U << 4) -#define ISO14443_3B_BIT_RATE_PICC_TO_PCD_424KBIT (1U << 5) -#define ISO14443_3B_BIT_RATE_PICC_TO_PCD_848KBIT (1U << 6) +#define ISO14443_3B_BIT_RATE_BOTH_106KBIT (0U << 0) +#define ISO14443_3B_BIT_RATE_PCD_TO_PICC_212KBIT (1U << 0) +#define ISO14443_3B_BIT_RATE_PCD_TO_PICC_424KBIT (1U << 1) +#define ISO14443_3B_BIT_RATE_PCD_TO_PICC_848KBIT (1U << 2) +#define ISO14443_3B_BIT_RATE_PICC_TO_PCD_212KBIT (1U << 4) +#define ISO14443_3B_BIT_RATE_PICC_TO_PCD_424KBIT (1U << 5) +#define ISO14443_3B_BIT_RATE_PICC_TO_PCD_848KBIT (1U << 6) #define ISO14443_3B_BIT_RATE_BOTH_SAME_COMPULSORY (1U << 7) #define ISO14443_3B_FRAME_OPTION_NAD (1U << 1) @@ -23,11 +23,11 @@ typedef struct { uint8_t bit_rate_capability; - uint8_t protocol_type : 4; + uint8_t protocol_type : 4; uint8_t max_frame_size : 4; - uint8_t fo : 2; - uint8_t adc : 2; - uint8_t fwi : 4; + uint8_t fo : 2; + uint8_t adc : 2; + uint8_t fwi : 4; } Iso14443_3bProtocolInfo; struct Iso14443_3bData { diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a.c b/lib/nfc/protocols/iso14443_4a/iso14443_4a.c index 756c35084..cdef65a25 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a.c +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a.c @@ -3,12 +3,12 @@ #include #define ISO14443_4A_PROTOCOL_NAME "ISO14443-4A" -#define ISO14443_4A_DEVICE_NAME "ISO14443-4A (Unknown)" +#define ISO14443_4A_DEVICE_NAME "ISO14443-4A (Unknown)" -#define ISO14443_4A_T0_KEY "T0" -#define ISO14443_4A_TA1_KEY "TA(1)" -#define ISO14443_4A_TB1_KEY "TB(1)" -#define ISO14443_4A_TC1_KEY "TC(1)" +#define ISO14443_4A_T0_KEY "T0" +#define ISO14443_4A_TA1_KEY "TA(1)" +#define ISO14443_4A_TB1_KEY "TB(1)" +#define ISO14443_4A_TC1_KEY "TC(1)" #define ISO14443_4A_T1_TK_KEY "T1...Tk" #define ISO14443_4A_FDT_DEFAULT_FC ISO14443_3A_FDT_POLL_FC diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a_i.h b/lib/nfc/protocols/iso14443_4a/iso14443_4a_i.h index e5483a6ba..9b0230975 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a_i.h +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a_i.h @@ -9,13 +9,13 @@ #define ISO14443_4A_ATS_T0_TB1 (1U << 5) #define ISO14443_4A_ATS_T0_TC1 (1U << 6) -#define ISO14443_4A_ATS_TA1_BOTH_106KBIT (0U << 0) -#define ISO14443_4A_ATS_TA1_PCD_TO_PICC_212KBIT (1U << 0) -#define ISO14443_4A_ATS_TA1_PCD_TO_PICC_424KBIT (1U << 1) -#define ISO14443_4A_ATS_TA1_PCD_TO_PICC_848KBIT (1U << 2) -#define ISO14443_4A_ATS_TA1_PICC_TO_PCD_212KBIT (1U << 4) -#define ISO14443_4A_ATS_TA1_PICC_TO_PCD_424KBIT (1U << 5) -#define ISO14443_4A_ATS_TA1_PICC_TO_PCD_848KBIT (1U << 6) +#define ISO14443_4A_ATS_TA1_BOTH_106KBIT (0U << 0) +#define ISO14443_4A_ATS_TA1_PCD_TO_PICC_212KBIT (1U << 0) +#define ISO14443_4A_ATS_TA1_PCD_TO_PICC_424KBIT (1U << 1) +#define ISO14443_4A_ATS_TA1_PCD_TO_PICC_848KBIT (1U << 2) +#define ISO14443_4A_ATS_TA1_PICC_TO_PCD_212KBIT (1U << 4) +#define ISO14443_4A_ATS_TA1_PICC_TO_PCD_424KBIT (1U << 5) +#define ISO14443_4A_ATS_TA1_PICC_TO_PCD_848KBIT (1U << 6) #define ISO14443_4A_ATS_TA1_BOTH_SAME_COMPULSORY (1U << 7) #define ISO14443_4A_ATS_TC1_NAD (1U << 0) diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c b/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c index 961a61d71..a9453b039 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c @@ -6,11 +6,11 @@ #define TAG "Iso14443_4aPoller" -#define ISO14443_4A_FSDI_256 (0x8U) -#define ISO14443_4A_FWT_MAX (4096UL << 14) +#define ISO14443_4A_FSDI_256 (0x8U) +#define ISO14443_4A_FWT_MAX (4096UL << 14) #define ISO14443_4A_WTXM_MASK (0x3FU) -#define ISO14443_4A_WTXM_MAX (0x3BU) -#define ISO14443_4A_SWTX (0xF2U) +#define ISO14443_4A_WTXM_MAX (0x3BU) +#define ISO14443_4A_SWTX (0xF2U) Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance) { furi_check(instance); diff --git a/lib/nfc/protocols/iso14443_4b/iso14443_4b.c b/lib/nfc/protocols/iso14443_4b/iso14443_4b.c index 6f849b1d4..2e72eced8 100644 --- a/lib/nfc/protocols/iso14443_4b/iso14443_4b.c +++ b/lib/nfc/protocols/iso14443_4b/iso14443_4b.c @@ -4,7 +4,7 @@ #include #define ISO14443_4B_PROTOCOL_NAME "ISO14443-4B" -#define ISO14443_4B_DEVICE_NAME "ISO14443-4B (Unknown)" +#define ISO14443_4B_DEVICE_NAME "ISO14443-4B (Unknown)" const NfcDeviceBase nfc_device_iso14443_4b = { .protocol_name = ISO14443_4B_PROTOCOL_NAME, diff --git a/lib/nfc/protocols/iso15693_3/iso15693_3.c b/lib/nfc/protocols/iso15693_3/iso15693_3.c index 1c94ac811..e2628b258 100644 --- a/lib/nfc/protocols/iso15693_3/iso15693_3.c +++ b/lib/nfc/protocols/iso15693_3/iso15693_3.c @@ -3,21 +3,21 @@ #include -#define ISO15693_3_PROTOCOL_NAME "ISO15693-3" +#define ISO15693_3_PROTOCOL_NAME "ISO15693-3" #define ISO15693_3_PROTOCOL_NAME_LEGACY "ISO15693" -#define ISO15693_3_DEVICE_NAME "ISO15693-3 (Unknown)" +#define ISO15693_3_DEVICE_NAME "ISO15693-3 (Unknown)" #define ISO15693_3_LOCK_DSFID_LEGACY (1U << 0) -#define ISO15693_3_LOCK_AFI_LEGACY (1U << 1) +#define ISO15693_3_LOCK_AFI_LEGACY (1U << 1) -#define ISO15693_3_DSFID_KEY "DSFID" -#define ISO15693_3_AFI_KEY "AFI" -#define ISO15693_3_IC_REF_KEY "IC Reference" -#define ISO15693_3_BLOCK_COUNT_KEY "Block Count" -#define ISO15693_3_BLOCK_SIZE_KEY "Block Size" -#define ISO15693_3_DATA_CONTENT_KEY "Data Content" -#define ISO15693_3_LOCK_DSFID_KEY "Lock DSFID" -#define ISO15693_3_LOCK_AFI_KEY "Lock AFI" +#define ISO15693_3_DSFID_KEY "DSFID" +#define ISO15693_3_AFI_KEY "AFI" +#define ISO15693_3_IC_REF_KEY "IC Reference" +#define ISO15693_3_BLOCK_COUNT_KEY "Block Count" +#define ISO15693_3_BLOCK_SIZE_KEY "Block Size" +#define ISO15693_3_DATA_CONTENT_KEY "Data Content" +#define ISO15693_3_LOCK_DSFID_KEY "Lock DSFID" +#define ISO15693_3_LOCK_AFI_KEY "Lock AFI" #define ISO15693_3_SECURITY_STATUS_KEY "Security Status" const NfcDeviceBase nfc_device_iso15693_3 = { diff --git a/lib/nfc/protocols/iso15693_3/iso15693_3.h b/lib/nfc/protocols/iso15693_3/iso15693_3.h index 1120ac56e..fdff7112b 100644 --- a/lib/nfc/protocols/iso15693_3/iso15693_3.h +++ b/lib/nfc/protocols/iso15693_3/iso15693_3.h @@ -10,9 +10,9 @@ extern "C" { #define ISO15693_3_UID_SIZE (8U) -#define ISO15693_3_GUARD_TIME_US (5000U) -#define ISO15693_3_FDT_POLL_FC (4202U) -#define ISO15693_3_FDT_LISTEN_FC (4320U) +#define ISO15693_3_GUARD_TIME_US (5000U) +#define ISO15693_3_FDT_POLL_FC (4202U) +#define ISO15693_3_FDT_LISTEN_FC (4320U) #define ISO15693_3_POLL_POLL_MIN_US (1500U) #define ISO15693_3_REQ_FLAG_SUBCARRIER_1 (0U << 0) @@ -21,59 +21,59 @@ extern "C" { #define ISO15693_3_REQ_FLAG_DATA_RATE_HI (1U << 1) #define ISO15693_3_REQ_FLAG_INVENTORY_T4 (0U << 2) #define ISO15693_3_REQ_FLAG_INVENTORY_T5 (1U << 2) -#define ISO15693_3_REQ_FLAG_EXTENSION (1U << 3) +#define ISO15693_3_REQ_FLAG_EXTENSION (1U << 3) -#define ISO15693_3_REQ_FLAG_T4_SELECTED (1U << 4) +#define ISO15693_3_REQ_FLAG_T4_SELECTED (1U << 4) #define ISO15693_3_REQ_FLAG_T4_ADDRESSED (1U << 5) -#define ISO15693_3_REQ_FLAG_T4_OPTION (1U << 6) +#define ISO15693_3_REQ_FLAG_T4_OPTION (1U << 6) #define ISO15693_3_REQ_FLAG_T5_AFI_PRESENT (1U << 4) -#define ISO15693_3_REQ_FLAG_T5_N_SLOTS_16 (0U << 5) -#define ISO15693_3_REQ_FLAG_T5_N_SLOTS_1 (1U << 5) -#define ISO15693_3_REQ_FLAG_T5_OPTION (1U << 6) +#define ISO15693_3_REQ_FLAG_T5_N_SLOTS_16 (0U << 5) +#define ISO15693_3_REQ_FLAG_T5_N_SLOTS_1 (1U << 5) +#define ISO15693_3_REQ_FLAG_T5_OPTION (1U << 6) -#define ISO15693_3_RESP_FLAG_NONE (0U) -#define ISO15693_3_RESP_FLAG_ERROR (1U << 0) +#define ISO15693_3_RESP_FLAG_NONE (0U) +#define ISO15693_3_RESP_FLAG_ERROR (1U << 0) #define ISO15693_3_RESP_FLAG_EXTENSION (1U << 3) -#define ISO15693_3_RESP_ERROR_NOT_SUPPORTED (0x01U) -#define ISO15693_3_RESP_ERROR_FORMAT (0x02U) -#define ISO15693_3_RESP_ERROR_OPTION (0x03U) -#define ISO15693_3_RESP_ERROR_UNKNOWN (0x0FU) -#define ISO15693_3_RESP_ERROR_BLOCK_UNAVAILABLE (0x10U) +#define ISO15693_3_RESP_ERROR_NOT_SUPPORTED (0x01U) +#define ISO15693_3_RESP_ERROR_FORMAT (0x02U) +#define ISO15693_3_RESP_ERROR_OPTION (0x03U) +#define ISO15693_3_RESP_ERROR_UNKNOWN (0x0FU) +#define ISO15693_3_RESP_ERROR_BLOCK_UNAVAILABLE (0x10U) #define ISO15693_3_RESP_ERROR_BLOCK_ALREADY_LOCKED (0x11U) -#define ISO15693_3_RESP_ERROR_BLOCK_LOCKED (0x12U) -#define ISO15693_3_RESP_ERROR_BLOCK_WRITE (0x13U) -#define ISO15693_3_RESP_ERROR_BLOCK_LOCK (0x14U) -#define ISO15693_3_RESP_ERROR_CUSTOM_START (0xA0U) -#define ISO15693_3_RESP_ERROR_CUSTOM_END (0xDFU) +#define ISO15693_3_RESP_ERROR_BLOCK_LOCKED (0x12U) +#define ISO15693_3_RESP_ERROR_BLOCK_WRITE (0x13U) +#define ISO15693_3_RESP_ERROR_BLOCK_LOCK (0x14U) +#define ISO15693_3_RESP_ERROR_CUSTOM_START (0xA0U) +#define ISO15693_3_RESP_ERROR_CUSTOM_END (0xDFU) -#define ISO15693_3_CMD_MANDATORY_START (0x01U) -#define ISO15693_3_CMD_INVENTORY (0x01U) -#define ISO15693_3_CMD_STAY_QUIET (0x02U) -#define ISO15693_3_CMD_MANDATORY_RFU (0x03U) -#define ISO15693_3_CMD_OPTIONAL_START (0x20U) -#define ISO15693_3_CMD_READ_BLOCK (0x20U) -#define ISO15693_3_CMD_WRITE_BLOCK (0x21U) -#define ISO15693_3_CMD_LOCK_BLOCK (0x22U) -#define ISO15693_3_CMD_READ_MULTI_BLOCKS (0x23U) -#define ISO15693_3_CMD_WRITE_MULTI_BLOCKS (0x24U) -#define ISO15693_3_CMD_SELECT (0x25U) -#define ISO15693_3_CMD_RESET_TO_READY (0x26U) -#define ISO15693_3_CMD_WRITE_AFI (0x27U) -#define ISO15693_3_CMD_LOCK_AFI (0x28U) -#define ISO15693_3_CMD_WRITE_DSFID (0x29U) -#define ISO15693_3_CMD_LOCK_DSFID (0x2AU) -#define ISO15693_3_CMD_GET_SYS_INFO (0x2BU) +#define ISO15693_3_CMD_MANDATORY_START (0x01U) +#define ISO15693_3_CMD_INVENTORY (0x01U) +#define ISO15693_3_CMD_STAY_QUIET (0x02U) +#define ISO15693_3_CMD_MANDATORY_RFU (0x03U) +#define ISO15693_3_CMD_OPTIONAL_START (0x20U) +#define ISO15693_3_CMD_READ_BLOCK (0x20U) +#define ISO15693_3_CMD_WRITE_BLOCK (0x21U) +#define ISO15693_3_CMD_LOCK_BLOCK (0x22U) +#define ISO15693_3_CMD_READ_MULTI_BLOCKS (0x23U) +#define ISO15693_3_CMD_WRITE_MULTI_BLOCKS (0x24U) +#define ISO15693_3_CMD_SELECT (0x25U) +#define ISO15693_3_CMD_RESET_TO_READY (0x26U) +#define ISO15693_3_CMD_WRITE_AFI (0x27U) +#define ISO15693_3_CMD_LOCK_AFI (0x28U) +#define ISO15693_3_CMD_WRITE_DSFID (0x29U) +#define ISO15693_3_CMD_LOCK_DSFID (0x2AU) +#define ISO15693_3_CMD_GET_SYS_INFO (0x2BU) #define ISO15693_3_CMD_GET_BLOCKS_SECURITY (0x2CU) -#define ISO15693_3_CMD_OPTIONAL_RFU (0x2DU) -#define ISO15693_3_CMD_CUSTOM_START (0xA0U) +#define ISO15693_3_CMD_OPTIONAL_RFU (0x2DU) +#define ISO15693_3_CMD_CUSTOM_START (0xA0U) #define ISO15693_3_MANDATORY_COUNT (ISO15693_3_CMD_MANDATORY_RFU - ISO15693_3_CMD_MANDATORY_START) -#define ISO15693_3_OPTIONAL_COUNT (ISO15693_3_CMD_OPTIONAL_RFU - ISO15693_3_CMD_OPTIONAL_START) +#define ISO15693_3_OPTIONAL_COUNT (ISO15693_3_CMD_OPTIONAL_RFU - ISO15693_3_CMD_OPTIONAL_START) -#define ISO15693_3_SYSINFO_FLAG_DSFID (1U << 0) -#define ISO15693_3_SYSINFO_FLAG_AFI (1U << 1) +#define ISO15693_3_SYSINFO_FLAG_DSFID (1U << 0) +#define ISO15693_3_SYSINFO_FLAG_AFI (1U << 1) #define ISO15693_3_SYSINFO_FLAG_MEMORY (1U << 2) #define ISO15693_3_SYSINFO_FLAG_IC_REF (1U << 3) diff --git a/lib/nfc/protocols/mf_classic/mf_classic.c b/lib/nfc/protocols/mf_classic/mf_classic.c index 8bf96bff4..4f92201e3 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic.c +++ b/lib/nfc/protocols/mf_classic/mf_classic.c @@ -546,7 +546,7 @@ void mf_classic_set_key_not_found( bool mf_classic_is_block_read(const MfClassicData* data, uint8_t block_num) { furi_check(data); - return (FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1); + return FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1; } void mf_classic_set_block_read(MfClassicData* data, uint8_t block_num, MfClassicBlock* block_data) { @@ -661,22 +661,20 @@ static bool mf_classic_is_allowed_access_sector_trailer( } case MfClassicActionKeyAWrite: case MfClassicActionKeyBWrite: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) || - (key_type == MfClassicKeyTypeB && - (AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) || + (key_type == MfClassicKeyTypeB && + (AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01)); } case MfClassicActionKeyBRead: { return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x02 || AC == 0x01)) || (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x02 || AC == 0x01)); } case MfClassicActionACRead: { - return ((key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB)); + return (key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB); } case MfClassicActionACWrite: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x01)) || - (key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05))); + return (key_type == MfClassicKeyTypeA && (AC == 0x01)) || + (key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05)); } default: return false; @@ -727,25 +725,21 @@ bool mf_classic_is_allowed_access_data_block( switch(action) { case MfClassicActionDataRead: { - return ( - (key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) || - (key_type == MfClassicKeyTypeB && !(AC == 0x07))); + return (key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) || + (key_type == MfClassicKeyTypeB && !(AC == 0x07)); } case MfClassicActionDataWrite: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00)) || - (key_type == MfClassicKeyTypeB && - (AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00)) || + (key_type == MfClassicKeyTypeB && + (AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03)); } case MfClassicActionDataInc: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00)) || - (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00)) || + (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06)); } case MfClassicActionDataDec: { - return ( - (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) || - (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01))); + return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) || + (key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01)); } default: return false; diff --git a/lib/nfc/protocols/mf_classic/mf_classic.h b/lib/nfc/protocols/mf_classic/mf_classic.h index 6cb8aac15..801ec1764 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic.h +++ b/lib/nfc/protocols/mf_classic/mf_classic.h @@ -6,27 +6,27 @@ extern "C" { #endif -#define MF_CLASSIC_CMD_AUTH_KEY_A (0x60U) -#define MF_CLASSIC_CMD_AUTH_KEY_B (0x61U) -#define MF_CLASSIC_CMD_READ_BLOCK (0x30U) -#define MF_CLASSIC_CMD_WRITE_BLOCK (0xA0U) -#define MF_CLASSIC_CMD_VALUE_DEC (0xC0U) -#define MF_CLASSIC_CMD_VALUE_INC (0xC1U) -#define MF_CLASSIC_CMD_VALUE_RESTORE (0xC2U) +#define MF_CLASSIC_CMD_AUTH_KEY_A (0x60U) +#define MF_CLASSIC_CMD_AUTH_KEY_B (0x61U) +#define MF_CLASSIC_CMD_READ_BLOCK (0x30U) +#define MF_CLASSIC_CMD_WRITE_BLOCK (0xA0U) +#define MF_CLASSIC_CMD_VALUE_DEC (0xC0U) +#define MF_CLASSIC_CMD_VALUE_INC (0xC1U) +#define MF_CLASSIC_CMD_VALUE_RESTORE (0xC2U) #define MF_CLASSIC_CMD_VALUE_TRANSFER (0xB0U) -#define MF_CLASSIC_CMD_HALT_MSB (0x50) -#define MF_CLASSIC_CMD_HALT_LSB (0x00) -#define MF_CLASSIC_CMD_ACK (0x0A) -#define MF_CLASSIC_CMD_NACK (0x00) -#define MF_CLASSIC_CMD_NACK_TRANSFER_INVALID (0x04) +#define MF_CLASSIC_CMD_HALT_MSB (0x50) +#define MF_CLASSIC_CMD_HALT_LSB (0x00) +#define MF_CLASSIC_CMD_ACK (0x0A) +#define MF_CLASSIC_CMD_NACK (0x00) +#define MF_CLASSIC_CMD_NACK_TRANSFER_INVALID (0x04) #define MF_CLASSIC_CMD_NACK_TRANSFER_CRC_ERROR (0x01) #define MF_CLASSIC_TOTAL_SECTORS_MAX (40) -#define MF_CLASSIC_TOTAL_BLOCKS_MAX (256) -#define MF_CLASSIC_READ_MASK_SIZE (MF_CLASSIC_TOTAL_BLOCKS_MAX / 32) -#define MF_CLASSIC_BLOCK_SIZE (16) -#define MF_CLASSIC_KEY_SIZE (6) +#define MF_CLASSIC_TOTAL_BLOCKS_MAX (256) +#define MF_CLASSIC_READ_MASK_SIZE (MF_CLASSIC_TOTAL_BLOCKS_MAX / 32) +#define MF_CLASSIC_BLOCK_SIZE (16) +#define MF_CLASSIC_KEY_SIZE (6) #define MF_CLASSIC_ACCESS_BYTES_SIZE (4) #define MF_CLASSIC_NT_SIZE (4) diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire.h b/lib/nfc/protocols/mf_desfire/mf_desfire.h index 2818e9a24..dd2009276 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire.h +++ b/lib/nfc/protocols/mf_desfire/mf_desfire.h @@ -8,26 +8,26 @@ extern "C" { #endif -#define MF_DESFIRE_CMD_GET_VERSION (0x60) -#define MF_DESFIRE_CMD_GET_FREE_MEMORY (0x6E) -#define MF_DESFIRE_CMD_GET_KEY_SETTINGS (0x45) -#define MF_DESFIRE_CMD_GET_KEY_VERSION (0x64) +#define MF_DESFIRE_CMD_GET_VERSION (0x60) +#define MF_DESFIRE_CMD_GET_FREE_MEMORY (0x6E) +#define MF_DESFIRE_CMD_GET_KEY_SETTINGS (0x45) +#define MF_DESFIRE_CMD_GET_KEY_VERSION (0x64) #define MF_DESFIRE_CMD_GET_APPLICATION_IDS (0x6A) -#define MF_DESFIRE_CMD_SELECT_APPLICATION (0x5A) -#define MF_DESFIRE_CMD_GET_FILE_IDS (0x6F) -#define MF_DESFIRE_CMD_GET_FILE_SETTINGS (0xF5) +#define MF_DESFIRE_CMD_SELECT_APPLICATION (0x5A) +#define MF_DESFIRE_CMD_GET_FILE_IDS (0x6F) +#define MF_DESFIRE_CMD_GET_FILE_SETTINGS (0xF5) -#define MF_DESFIRE_CMD_READ_DATA (0xBD) -#define MF_DESFIRE_CMD_GET_VALUE (0x6C) +#define MF_DESFIRE_CMD_READ_DATA (0xBD) +#define MF_DESFIRE_CMD_GET_VALUE (0x6C) #define MF_DESFIRE_CMD_READ_RECORDS (0xBB) -#define MF_DESFIRE_MAX_KEYS (14) +#define MF_DESFIRE_MAX_KEYS (14) #define MF_DESFIRE_MAX_FILES (32) -#define MF_DESFIRE_UID_SIZE (7) -#define MF_DESFIRE_BATCH_SIZE (5) +#define MF_DESFIRE_UID_SIZE (7) +#define MF_DESFIRE_BATCH_SIZE (5) #define MF_DESFIRE_APP_ID_SIZE (3) -#define MF_DESFIRE_VALUE_SIZE (4) +#define MF_DESFIRE_VALUE_SIZE (4) typedef struct { uint8_t hw_vendor; diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_i.c b/lib/nfc/protocols/mf_desfire/mf_desfire_i.c index bfbbadadf..d83a91ad1 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_i.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_i.c @@ -11,15 +11,15 @@ MF_DESFIRE_FFF_PICC_PREFIX " " \ "Free Memory" -#define MF_DESFIRE_FFF_CHANGE_KEY_ID_KEY "Change Key ID" -#define MF_DESFIRE_FFF_CONFIG_CHANGEABLE_KEY "Config Changeable" +#define MF_DESFIRE_FFF_CHANGE_KEY_ID_KEY "Change Key ID" +#define MF_DESFIRE_FFF_CONFIG_CHANGEABLE_KEY "Config Changeable" #define MF_DESFIRE_FFF_FREE_CREATE_DELETE_KEY "Free Create Delete" -#define MF_DESFIRE_FFF_FREE_DIR_LIST_KEY "Free Directory List" -#define MF_DESFIRE_FFF_KEY_CHANGEABLE_KEY "Key Changeable" -#define MF_DESFIRE_FFF_FLAGS_KEY "Flags" -#define MF_DESFIRE_FFF_MAX_KEYS_KEY "Max Keys" +#define MF_DESFIRE_FFF_FREE_DIR_LIST_KEY "Free Directory List" +#define MF_DESFIRE_FFF_KEY_CHANGEABLE_KEY "Key Changeable" +#define MF_DESFIRE_FFF_FLAGS_KEY "Flags" +#define MF_DESFIRE_FFF_MAX_KEYS_KEY "Max Keys" -#define MF_DESFIRE_FFF_KEY_SUB_PREFIX "Key" +#define MF_DESFIRE_FFF_KEY_SUB_PREFIX "Key" #define MF_DESFIRE_FFF_KEY_VERSION_KEY "Version" #define MF_DESFIRE_FFF_APPLICATION_COUNT_KEY \ @@ -33,15 +33,15 @@ #define MF_DESFIRE_FFF_FILE_IDS_KEY \ MF_DESFIRE_FFF_FILE_SUB_PREFIX " " \ "IDs" -#define MF_DESFIRE_FFF_FILE_TYPE_KEY "Type" +#define MF_DESFIRE_FFF_FILE_TYPE_KEY "Type" #define MF_DESFIRE_FFF_FILE_COMM_SETTINGS_KEY "Communication Settings" #define MF_DESFIRE_FFF_FILE_ACCESS_RIGHTS_KEY "Access Rights" #define MF_DESFIRE_FFF_FILE_SIZE_KEY "Size" -#define MF_DESFIRE_FFF_FILE_HI_LIMIT_KEY "Hi Limit" -#define MF_DESFIRE_FFF_FILE_LO_LIMIT_KEY "Lo Limit" -#define MF_DESFIRE_FFF_FILE_LIMIT_CREDIT_VALUE_KEY "Limited Credit Value" +#define MF_DESFIRE_FFF_FILE_HI_LIMIT_KEY "Hi Limit" +#define MF_DESFIRE_FFF_FILE_LO_LIMIT_KEY "Lo Limit" +#define MF_DESFIRE_FFF_FILE_LIMIT_CREDIT_VALUE_KEY "Limited Credit Value" #define MF_DESFIRE_FFF_FILE_LIMIT_CREDIT_ENABLED_KEY "Limited Credit Enabled" #define MF_DESFIRE_FFF_FILE_MAX_KEY "Max" @@ -78,12 +78,12 @@ bool mf_desfire_free_memory_parse(MfDesfireFreeMemory* data, const BitBuffer* bu bool mf_desfire_key_settings_parse(MfDesfireKeySettings* data, const BitBuffer* buf) { typedef struct FURI_PACKED { bool is_master_key_changeable : 1; - bool is_free_directory_list : 1; - bool is_free_create_delete : 1; - bool is_config_changeable : 1; - uint8_t change_key_id : 4; - uint8_t max_keys : 4; - uint8_t flags : 4; + bool is_free_directory_list : 1; + bool is_free_create_delete : 1; + bool is_config_changeable : 1; + uint8_t change_key_id : 4; + uint8_t max_keys : 4; + uint8_t flags : 4; } MfDesfireKeySettingsLayout; const bool can_parse = bit_buffer_get_size_bytes(buf) == sizeof(MfDesfireKeySettingsLayout); @@ -164,8 +164,8 @@ bool mf_desfire_file_settings_parse(MfDesfireFileSettings* data, const BitBuffer typedef struct FURI_PACKED { uint32_t size : 3 * BITS_IN_BYTE; - uint32_t max : 3 * BITS_IN_BYTE; - uint32_t cur : 3 * BITS_IN_BYTE; + uint32_t max : 3 * BITS_IN_BYTE; + uint32_t cur : 3 * BITS_IN_BYTE; } MfDesfireFileSettingsRecord; typedef struct FURI_PACKED { diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_i.h b/lib/nfc/protocols/mf_desfire/mf_desfire_i.h index 21250baac..921bbb9de 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_i.h +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_i.h @@ -3,53 +3,53 @@ #include "mf_desfire.h" #define MF_DESFIRE_FFF_PICC_PREFIX "PICC" -#define MF_DESFIRE_FFF_APP_PREFIX "Application" +#define MF_DESFIRE_FFF_APP_PREFIX "Application" // Successful operation -#define MF_DESFIRE_STATUS_OPERATION_OK (0x00) +#define MF_DESFIRE_STATUS_OPERATION_OK (0x00) // No changes done to backup files, CommitTransaction / AbortTransaction not necessary -#define MF_DESFIRE_STATUS_NO_CHANGES (0x0C) +#define MF_DESFIRE_STATUS_NO_CHANGES (0x0C) // Insufficient NV-Memory to complete command -#define MF_DESFIRE_STATUS_OUT_OF_EEPROM_ERROR (0x0E) +#define MF_DESFIRE_STATUS_OUT_OF_EEPROM_ERROR (0x0E) // Command code not supported -#define MF_DESFIRE_STATUS_ILLEGAL_COMMAND_CODE (0x1C) +#define MF_DESFIRE_STATUS_ILLEGAL_COMMAND_CODE (0x1C) // CRC or MAC does not match data Padding bytes not valid -#define MF_DESFIRE_STATUS_INTEGRITY_ERROR (0x1E) +#define MF_DESFIRE_STATUS_INTEGRITY_ERROR (0x1E) // Invalid key number specified -#define MF_DESFIRE_STATUS_NO_SUCH_KEY (0x40) +#define MF_DESFIRE_STATUS_NO_SUCH_KEY (0x40) // Length of command string invalid -#define MF_DESFIRE_STATUS_LENGTH_ERROR (0x7E) +#define MF_DESFIRE_STATUS_LENGTH_ERROR (0x7E) // Current configuration / status does not allow the requested command -#define MF_DESFIRE_STATUS_PERMISSION_DENIED (0x9D) +#define MF_DESFIRE_STATUS_PERMISSION_DENIED (0x9D) // Value of the parameter(s) invalid -#define MF_DESFIRE_STATUS_PARAMETER_ERROR (0x9E) +#define MF_DESFIRE_STATUS_PARAMETER_ERROR (0x9E) // Requested AID not present on PICC #define MF_DESFIRE_STATUS_APPLICATION_NOT_FOUND (0xA0) // Unrecoverable error within application, application will be disabled -#define MF_DESFIRE_STATUS_APPL_INTEGRITY_ERROR (0xA1) +#define MF_DESFIRE_STATUS_APPL_INTEGRITY_ERROR (0xA1) // Current authentication status does not allow the requested command -#define MF_DESFIRE_STATUS_AUTHENTICATION_ERROR (0xAE) +#define MF_DESFIRE_STATUS_AUTHENTICATION_ERROR (0xAE) // Additional data frame is expected to be sent -#define MF_DESFIRE_STATUS_ADDITIONAL_FRAME (0xAF) +#define MF_DESFIRE_STATUS_ADDITIONAL_FRAME (0xAF) // Attempt to read/write data from/to beyond the file's/record's limits // Attempt to exceed the limits of a value file. -#define MF_DESFIRE_STATUS_BOUNDARY_ERROR (0xBE) +#define MF_DESFIRE_STATUS_BOUNDARY_ERROR (0xBE) // Unrecoverable error within PICC, PICC will be disabled -#define MF_DESFIRE_STATUS_PICC_INTEGRITY_ERROR (0xC1) +#define MF_DESFIRE_STATUS_PICC_INTEGRITY_ERROR (0xC1) // Previous Command was not fully completed. Not all Frames were requested or provided by the PCD -#define MF_DESFIRE_STATUS_COMMAND_ABORTED (0xCA) +#define MF_DESFIRE_STATUS_COMMAND_ABORTED (0xCA) // PICC was disabled by an unrecoverable error -#define MF_DESFIRE_STATUS_PICC_DISABLED_ERROR (0xCD) +#define MF_DESFIRE_STATUS_PICC_DISABLED_ERROR (0xCD) // Number of Applications limited to 28, no additional CreateApplication possible -#define MF_DESFIRE_STATUS_COUNT_ERROR (0xCE) +#define MF_DESFIRE_STATUS_COUNT_ERROR (0xCE) // Creation of file/application failed because file/application with same number already exists -#define MF_DESFIRE_STATUS_DUBLICATE_ERROR (0xDE) +#define MF_DESFIRE_STATUS_DUBLICATE_ERROR (0xDE) // Could not complete NV-write operation due to loss of power, internal backup/rollback mechanism activated -#define MF_DESFIRE_STATUS_EEPROM_ERROR (0xEE) +#define MF_DESFIRE_STATUS_EEPROM_ERROR (0xEE) // Specified file number does not exist -#define MF_DESFIRE_STATUS_FILE_NOT_FOUND (0xF0) +#define MF_DESFIRE_STATUS_FILE_NOT_FOUND (0xF0) // Unrecoverable error within file, file will be disabled -#define MF_DESFIRE_STATUS_FILE_INTEGRITY_ERROR (0xF1) +#define MF_DESFIRE_STATUS_FILE_INTEGRITY_ERROR (0xF1) // SimpleArray configurations diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c index fa8a7ae9b..bd8ecfaee 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c @@ -6,7 +6,7 @@ #define TAG "MfDesfirePoller" -#define MF_DESFIRE_BUF_SIZE (64U) +#define MF_DESFIRE_BUF_SIZE (64U) #define MF_DESFIRE_RESULT_BUF_SIZE (512U) typedef NfcCommand (*MfDesfirePollerReadHandler)(MfDesfirePoller* instance); diff --git a/lib/nfc/protocols/mf_plus/mf_plus.c b/lib/nfc/protocols/mf_plus/mf_plus.c index 32d8d6c59..1d00594c6 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus.c +++ b/lib/nfc/protocols/mf_plus/mf_plus.c @@ -177,4 +177,4 @@ Iso14443_4aData* mf_plus_get_base_data(const MfPlusData* data) { furi_check(data); return data->iso14443_4a_data; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/mf_plus/mf_plus.h b/lib/nfc/protocols/mf_plus/mf_plus.h index 31559ffdc..b68c3279e 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus.h +++ b/lib/nfc/protocols/mf_plus/mf_plus.h @@ -7,7 +7,7 @@ extern "C" { #endif #define MF_PLUS_UID_SIZE_MAX (7) -#define MF_PLUS_BATCH_SIZE (5) +#define MF_PLUS_BATCH_SIZE (5) #define MF_PLUS_CMD_GET_VERSION (0x60) @@ -112,4 +112,4 @@ Iso14443_4aData* mf_plus_get_base_data(const MfPlusData* data); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/nfc/protocols/mf_plus/mf_plus_i.c b/lib/nfc/protocols/mf_plus/mf_plus_i.c index 13bf8c5d8..4ad2ff878 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_i.c +++ b/lib/nfc/protocols/mf_plus/mf_plus_i.c @@ -7,8 +7,8 @@ #define MF_PLUS_T1_TK_VALUE_LEN 7 #define MF_PLUS_FFF_SECURITY_LEVEL_KEY "Security Level" -#define MF_PLUS_FFF_CARD_TYPE_KEY "Card Type" -#define MF_PLUS_FFF_MEMORY_SIZE_KEY "Memory Size" +#define MF_PLUS_FFF_CARD_TYPE_KEY "Card Type" +#define MF_PLUS_FFF_MEMORY_SIZE_KEY "Memory Size" #define TAG "MfPlus" diff --git a/lib/nfc/protocols/mf_plus/mf_plus_poller.c b/lib/nfc/protocols/mf_plus/mf_plus_poller.c index c93ec9e67..8d1cc1c99 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_poller.c +++ b/lib/nfc/protocols/mf_plus/mf_plus_poller.c @@ -7,7 +7,7 @@ #define TAG "MfPlusPoller" -#define MF_PLUS_BUF_SIZE (64U) +#define MF_PLUS_BUF_SIZE (64U) #define MF_PLUS_RESULT_BUF_SIZE (512U) typedef NfcCommand (*MfPlusPollerReadHandler)(MfPlusPoller* instance); @@ -197,7 +197,7 @@ static bool mf_plus_poller_detect(NfcGenericEvent event, void* context) { } } - return (error == MfPlusErrorNone); + return error == MfPlusErrorNone; } const NfcPollerBase mf_plus_poller = { diff --git a/lib/nfc/protocols/mf_plus/mf_plus_poller.h b/lib/nfc/protocols/mf_plus/mf_plus_poller.h index 7e892366f..1e4e97eaf 100644 --- a/lib/nfc/protocols/mf_plus/mf_plus_poller.h +++ b/lib/nfc/protocols/mf_plus/mf_plus_poller.h @@ -52,4 +52,4 @@ MfPlusError mf_plus_poller_read_version(MfPlusPoller* instance, MfPlusVersion* d #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c index b10ac40b6..d1f08294f 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c @@ -5,15 +5,15 @@ #define MF_ULTRALIGHT_PROTOCOL_NAME "NTAG/Ultralight" -#define MF_ULTRALIGHT_FORMAT_VERSION_KEY "Data format version" -#define MF_ULTRALIGHT_TYPE_KEY MF_ULTRALIGHT_PROTOCOL_NAME " type" -#define MF_ULTRALIGHT_SIGNATURE_KEY "Signature" -#define MF_ULTRALIGHT_MIFARE_VERSION_KEY "Mifare version" -#define MF_ULTRALIGHT_COUNTER_KEY "Counter" -#define MF_ULTRALIGHT_TEARING_KEY "Tearing" -#define MF_ULTRALIGHT_PAGES_TOTAL_KEY "Pages total" -#define MF_ULTRALIGHT_PAGES_READ_KEY "Pages read" -#define MF_ULTRALIGHT_PAGE_KEY "Page" +#define MF_ULTRALIGHT_FORMAT_VERSION_KEY "Data format version" +#define MF_ULTRALIGHT_TYPE_KEY MF_ULTRALIGHT_PROTOCOL_NAME " type" +#define MF_ULTRALIGHT_SIGNATURE_KEY "Signature" +#define MF_ULTRALIGHT_MIFARE_VERSION_KEY "Mifare version" +#define MF_ULTRALIGHT_COUNTER_KEY "Counter" +#define MF_ULTRALIGHT_TEARING_KEY "Tearing" +#define MF_ULTRALIGHT_PAGES_TOTAL_KEY "Pages total" +#define MF_ULTRALIGHT_PAGES_READ_KEY "Pages read" +#define MF_ULTRALIGHT_PAGE_KEY "Page" #define MF_ULTRALIGHT_FAILED_ATTEMPTS_KEY "Failed authentication attempts" typedef struct { @@ -598,7 +598,7 @@ uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) { bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page) { uint8_t pwd_page = mf_ultralight_get_pwd_page_num(type); uint8_t pack_page = pwd_page + 1; - return ((pwd_page != 0) && (page == pwd_page || page == pack_page)); + return (pwd_page != 0) && (page == pwd_page || page == pack_page); } bool mf_ultralight_support_feature(const uint32_t feature_set, const uint32_t features_to_check) { @@ -730,4 +730,4 @@ void mf_ultralight_3des_decrypt( mbedtls_des3_set2key_dec(ctx, ck); mbedtls_des3_crypt_cbc(ctx, MBEDTLS_DES_DECRYPT, length, (uint8_t*)iv, input, out); -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight.h b/lib/nfc/protocols/mf_ultralight/mf_ultralight.h index f748f6813..caf25ceee 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight.h +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight.h @@ -9,44 +9,44 @@ extern "C" { #define MF_ULTRALIGHT_TEARING_FLAG_DEFAULT (0xBD) -#define MF_ULTRALIGHT_CMD_GET_VERSION (0x60) -#define MF_ULTRALIGHT_CMD_READ_PAGE (0x30) -#define MF_ULTRALIGHT_CMD_FAST_READ (0x3A) +#define MF_ULTRALIGHT_CMD_GET_VERSION (0x60) +#define MF_ULTRALIGHT_CMD_READ_PAGE (0x30) +#define MF_ULTRALIGHT_CMD_FAST_READ (0x3A) #define MF_ULTRALIGHT_CMD_SECTOR_SELECT (0xC2) -#define MF_ULTRALIGHT_CMD_COMP_WRITE (0xA0) -#define MF_ULTRALIGHT_CMD_WRITE_PAGE (0xA2) -#define MF_ULTRALIGHT_CMD_FAST_WRITE (0xA6) -#define MF_ULTRALIGHT_CMD_READ_SIG (0x3C) -#define MF_ULTRALIGHT_CMD_READ_CNT (0x39) -#define MF_ULTRALIGHT_CMD_INCR_CNT (0xA5) +#define MF_ULTRALIGHT_CMD_COMP_WRITE (0xA0) +#define MF_ULTRALIGHT_CMD_WRITE_PAGE (0xA2) +#define MF_ULTRALIGHT_CMD_FAST_WRITE (0xA6) +#define MF_ULTRALIGHT_CMD_READ_SIG (0x3C) +#define MF_ULTRALIGHT_CMD_READ_CNT (0x39) +#define MF_ULTRALIGHT_CMD_INCR_CNT (0xA5) #define MF_ULTRALIGHT_CMD_CHECK_TEARING (0x3E) -#define MF_ULTRALIGHT_CMD_PWD_AUTH (0x1B) -#define MF_ULTRALIGHT_CMD_AUTH (0x1A) -#define MF_ULTRALIGHT_CMD_VCSL (0x4B) +#define MF_ULTRALIGHT_CMD_PWD_AUTH (0x1B) +#define MF_ULTRALIGHT_CMD_AUTH (0x1A) +#define MF_ULTRALIGHT_CMD_VCSL (0x4B) -#define MF_ULTRALIGHT_CMD_ACK (0x0A) -#define MF_ULTRALIGHT_CMD_NACK (0x00) +#define MF_ULTRALIGHT_CMD_ACK (0x0A) +#define MF_ULTRALIGHT_CMD_NACK (0x00) #define MF_ULTRALIGHT_CMD_AUTH_NAK (0x04) -#define MF_ULTRALIGHT_MAX_CNTR_VAL (0x00FFFFFF) -#define MF_ULTRALIGHT_MAX_PAGE_NUM (510) -#define MF_ULTRALIGHT_PAGE_SIZE (4U) -#define MF_ULTRALIGHT_SIGNATURE_SIZE (32) -#define MF_ULTRALIGHT_COUNTER_SIZE (3) -#define MF_ULTRALIGHT_COUNTER_NUM (3) -#define MF_ULTRALIGHT_TEARING_FLAG_SIZE (1) -#define MF_ULTRALIGHT_TEARING_FLAG_NUM (3) +#define MF_ULTRALIGHT_MAX_CNTR_VAL (0x00FFFFFF) +#define MF_ULTRALIGHT_MAX_PAGE_NUM (510) +#define MF_ULTRALIGHT_PAGE_SIZE (4U) +#define MF_ULTRALIGHT_SIGNATURE_SIZE (32) +#define MF_ULTRALIGHT_COUNTER_SIZE (3) +#define MF_ULTRALIGHT_COUNTER_NUM (3) +#define MF_ULTRALIGHT_TEARING_FLAG_SIZE (1) +#define MF_ULTRALIGHT_TEARING_FLAG_NUM (3) #define MF_ULTRALIGHT_AUTH_PASSWORD_SIZE (4) -#define MF_ULTRALIGHT_AUTH_PACK_SIZE (2) +#define MF_ULTRALIGHT_AUTH_PACK_SIZE (2) -#define MF_ULTRALIGHT_C_AUTH_RESPONSE_SIZE (9) -#define MF_ULTRALIGHT_C_AUTH_DES_KEY_SIZE (16) -#define MF_ULTRALIGHT_C_AUTH_DATA_SIZE (MF_ULTRALIGHT_C_AUTH_DES_KEY_SIZE) -#define MF_ULTRALIGHT_C_AUTH_IV_BLOCK_SIZE (8) -#define MF_ULTRALIGHT_C_AUTH_RND_BLOCK_SIZE (8) +#define MF_ULTRALIGHT_C_AUTH_RESPONSE_SIZE (9) +#define MF_ULTRALIGHT_C_AUTH_DES_KEY_SIZE (16) +#define MF_ULTRALIGHT_C_AUTH_DATA_SIZE (MF_ULTRALIGHT_C_AUTH_DES_KEY_SIZE) +#define MF_ULTRALIGHT_C_AUTH_IV_BLOCK_SIZE (8) +#define MF_ULTRALIGHT_C_AUTH_RND_BLOCK_SIZE (8) #define MF_ULTRALIGHT_C_AUTH_RND_A_BLOCK_OFFSET (0) #define MF_ULTRALIGHT_C_AUTH_RND_B_BLOCK_OFFSET (8) -#define MF_ULTRALIGHT_C_ENCRYPTED_PACK_SIZE (MF_ULTRALIGHT_C_AUTH_DATA_SIZE + 1) +#define MF_ULTRALIGHT_C_ENCRYPTED_PACK_SIZE (MF_ULTRALIGHT_C_AUTH_DATA_SIZE + 1) typedef enum { MfUltralightErrorNone, @@ -147,10 +147,10 @@ typedef struct FURI_PACKED { union { uint8_t value; struct { - uint8_t rfui1 : 2; - bool strg_mod_en : 1; - bool rfui2 : 1; - uint8_t mirror_byte : 2; + uint8_t rfui1 : 2; + bool strg_mod_en : 1; + bool rfui2 : 1; + uint8_t mirror_byte : 2; MfUltralightMirrorConf mirror_conf : 2; }; } mirror; @@ -160,12 +160,12 @@ typedef struct FURI_PACKED { union { uint8_t value; struct { - uint8_t authlim : 3; + uint8_t authlim : 3; bool nfc_cnt_pwd_prot : 1; - bool nfc_cnt_en : 1; - bool nfc_dis_sec1 : 1; // NTAG I2C Plus only - bool cfglck : 1; - bool prot : 1; + bool nfc_cnt_en : 1; + bool nfc_dis_sec1 : 1; // NTAG I2C Plus only + bool cfglck : 1; + bool prot : 1; }; } access; uint8_t vctid; diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener.c index b5980b388..050f9abc1 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener.c @@ -38,7 +38,7 @@ static void mf_ultralight_listener_send_short_resp(MfUltralightListener* instanc bit_buffer_set_size(instance->tx_buffer, 4); bit_buffer_set_byte(instance->tx_buffer, 0, data); iso14443_3a_listener_tx(instance->iso14443_3a_listener, instance->tx_buffer); -}; +} static void mf_ultralight_listener_perform_read( MfUltralightPage* pages, diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c index d84630b99..f38badae6 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_listener_i.c @@ -2,13 +2,13 @@ #include -#define MF_ULTRALIGHT_STATIC_BIT_LOCK_OTP_CC 0 -#define MF_ULTRALIGHT_STATIC_BIT_LOCK_BL_9_4 1 +#define MF_ULTRALIGHT_STATIC_BIT_LOCK_OTP_CC 0 +#define MF_ULTRALIGHT_STATIC_BIT_LOCK_BL_9_4 1 #define MF_ULTRALIGHT_STATIC_BIT_LOCK_BL_15_10 2 #define MF_ULTRALIGHT_BIT_ACTIVE(lock_bits, bit) (((lock_bits) & (1U << (bit))) != 0) -#define MF_ULTRALIGHT_BITS_SET(lock_bits, mask) ((lock_bits) |= (mask)) -#define MF_ULTRALIGHT_BITS_CLR(lock_bits, mask) ((lock_bits) &= ~(mask)) +#define MF_ULTRALIGHT_BITS_SET(lock_bits, mask) ((lock_bits) |= (mask)) +#define MF_ULTRALIGHT_BITS_CLR(lock_bits, mask) ((lock_bits) &= ~(mask)) #define MF_ULTRALIGHT_PAGE_LOCKED(lock_bits, page) MF_ULTRALIGHT_BIT_ACTIVE(lock_bits, page) @@ -35,7 +35,7 @@ #define MF_ULTRALIGHT_I2C_PAGE_ON_MIRRORED_SESSION_REG(page) \ MF_ULTRALIGHT_PAGE_IN_BOUNDS(page, 0x00F8, 0x00F9) -#define MF_ULTRALIGHT_AUTH_RESET_ATTEMPTS(instance) (instance->data->auth_attempts = 0) +#define MF_ULTRALIGHT_AUTH_RESET_ATTEMPTS(instance) (instance->data->auth_attempts = 0) #define MF_ULTRALIGHT_AUTH_INCREASE_ATTEMPTS(instance) (instance->data->auth_attempts++) static MfUltralightMirrorConf mf_ultralight_mirror_check_mode( @@ -125,7 +125,7 @@ static uint8_t mf_ultralight_get_mirror_data_size(MfUltralightMirrorConf mode) { static uint8_t mf_ultralight_get_mirror_last_page(MfUltralightListener* instance) { uint8_t strSize = mf_ultralight_get_mirror_data_size(instance->mirror.actual_mode); - return (instance->config->mirror_page + 1U + strSize / 4); + return instance->config->mirror_page + 1U + strSize / 4; } static uint8_t mf_ultralight_get_ascii_offset(uint8_t start_page, MfUltralightListener* instance) { @@ -207,7 +207,7 @@ void mf_ultraligt_mirror_format_counter(MfUltralightListener* instance) { } bool mf_ultralight_composite_command_in_progress(MfUltralightListener* instance) { - return (instance->composite_cmd.callback != NULL); + return instance->composite_cmd.callback != NULL; } MfUltralightCommand @@ -550,7 +550,7 @@ static bool mf_ultralight_auth_check_attempts(const MfUltralightListener* instan (1U << instance->config->access.authlim) : instance->config->access.authlim; - return (instance->data->auth_attempts >= authlim); + return instance->data->auth_attempts >= authlim; } bool mf_ultralight_auth_limit_check_and_update(MfUltralightListener* instance, bool auth_success) { @@ -634,4 +634,4 @@ bool mf_ultralight_c_check_access( } while(false); return access_success; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.h b/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.h index 1f395ddd2..b35c49aea 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.h +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.h @@ -9,7 +9,7 @@ extern "C" { #endif #define MF_ULTRALIGHT_POLLER_STANDARD_FWT_FC (60000) -#define MF_ULTRALIGHT_MAX_BUFF_SIZE (64) +#define MF_ULTRALIGHT_MAX_BUFF_SIZE (64) #define MF_ULTRALIGHT_DEFAULT_PASSWORD (0xffffffffUL) diff --git a/lib/nfc/protocols/slix/slix.c b/lib/nfc/protocols/slix/slix.c index f6ce885d4..7a6068230 100644 --- a/lib/nfc/protocols/slix/slix.c +++ b/lib/nfc/protocols/slix/slix.c @@ -5,36 +5,36 @@ #include #define SLIX_PROTOCOL_NAME "SLIX" -#define SLIX_DEVICE_NAME "SLIX" +#define SLIX_DEVICE_NAME "SLIX" #define SLIX_TYPE_SLIX_SLIX2 (0x01U) -#define SLIX_TYPE_SLIX_S (0x02U) -#define SLIX_TYPE_SLIX_L (0x03U) +#define SLIX_TYPE_SLIX_S (0x02U) +#define SLIX_TYPE_SLIX_L (0x03U) -#define SLIX_TYPE_INDICATOR_SLIX (0x02U) +#define SLIX_TYPE_INDICATOR_SLIX (0x02U) #define SLIX_TYPE_INDICATOR_SLIX2 (0x01U) -#define SLIX_CAPABILITIES_KEY "Capabilities" -#define SLIX_PASSWORD_READ_KEY "Password Read" -#define SLIX_PASSWORD_WRITE_KEY "Password Write" -#define SLIX_PASSWORD_PRIVACY_KEY "Password Privacy" -#define SLIX_PASSWORD_DESTROY_KEY "Password Destroy" -#define SLIX_PASSWORD_EAS_KEY "Password EAS" -#define SLIX_SIGNATURE_KEY "Signature" -#define SLIX_PRIVACY_MODE_KEY "Privacy Mode" -#define SLIX_PROTECTION_POINTER_KEY "Protection Pointer" +#define SLIX_CAPABILITIES_KEY "Capabilities" +#define SLIX_PASSWORD_READ_KEY "Password Read" +#define SLIX_PASSWORD_WRITE_KEY "Password Write" +#define SLIX_PASSWORD_PRIVACY_KEY "Password Privacy" +#define SLIX_PASSWORD_DESTROY_KEY "Password Destroy" +#define SLIX_PASSWORD_EAS_KEY "Password EAS" +#define SLIX_SIGNATURE_KEY "Signature" +#define SLIX_PRIVACY_MODE_KEY "Privacy Mode" +#define SLIX_PROTECTION_POINTER_KEY "Protection Pointer" #define SLIX_PROTECTION_CONDITION_KEY "Protection Condition" -#define SLIX_LOCK_EAS_KEY "Lock EAS" -#define SLIX_LOCK_PPL_KEY "Lock PPL" +#define SLIX_LOCK_EAS_KEY "Lock EAS" +#define SLIX_LOCK_PPL_KEY "Lock PPL" typedef struct { uint8_t iso15693_3[2]; uint8_t icode_type; union { struct { - uint8_t unused_1 : 3; + uint8_t unused_1 : 3; uint8_t type_indicator : 2; - uint8_t unused_2 : 3; + uint8_t unused_2 : 3; }; uint8_t serial_num[5]; }; diff --git a/lib/nfc/protocols/slix/slix.h b/lib/nfc/protocols/slix/slix.h index cc2390c6e..2a3222445 100644 --- a/lib/nfc/protocols/slix/slix.h +++ b/lib/nfc/protocols/slix/slix.h @@ -6,7 +6,7 @@ extern "C" { #endif -#define SLIX_BLOCK_SIZE (4U) +#define SLIX_BLOCK_SIZE (4U) #define SLIX_SIGNATURE_SIZE (32U) #define SLIX_COUNTER_BLOCK_NUM (79U) @@ -16,27 +16,27 @@ extern "C" { #define SLIX_PP_CONDITION_RH (1U << 4) #define SLIX_PP_CONDITION_WH (1U << 5) -#define SLIX_FEATURE_FLAG_UM_PP (1UL << 0) -#define SLIX_FEATURE_FLAG_COUNTER (1UL << 1) -#define SLIX_FEATURE_FLAG_EAS_ID (1UL << 2) -#define SLIX_FEATURE_FLAG_EAS_PP (1UL << 3) -#define SLIX_FEATURE_FLAG_AFI_PP (1UL << 4) +#define SLIX_FEATURE_FLAG_UM_PP (1UL << 0) +#define SLIX_FEATURE_FLAG_COUNTER (1UL << 1) +#define SLIX_FEATURE_FLAG_EAS_ID (1UL << 2) +#define SLIX_FEATURE_FLAG_EAS_PP (1UL << 3) +#define SLIX_FEATURE_FLAG_AFI_PP (1UL << 4) #define SLIX_FEATURE_FLAG_INVENTORY_READ_EXT (1UL << 5) -#define SLIX_FEATURE_FLAG_EAS_IR (1UL << 6) -#define SLIX_FEATURE_FLAG_ORIGINALITY_SIG (1UL << 8) +#define SLIX_FEATURE_FLAG_EAS_IR (1UL << 6) +#define SLIX_FEATURE_FLAG_ORIGINALITY_SIG (1UL << 8) #define SLIX_FEATURE_FLAG_ORIGINALITY_SIG_PP (1UL << 9) -#define SLIX_FEATURE_FLAG_PERSISTENT_QUIET (1UL << 10) -#define SLIX_FEATURE_FLAG_PRIVACY (1UL << 12) -#define SLIX_FEATURE_FLAG_DESTROY (1UL << 13) -#define SLIX_FEATURE_EXT (1UL << 31) +#define SLIX_FEATURE_FLAG_PERSISTENT_QUIET (1UL << 10) +#define SLIX_FEATURE_FLAG_PRIVACY (1UL << 12) +#define SLIX_FEATURE_FLAG_DESTROY (1UL << 13) +#define SLIX_FEATURE_EXT (1UL << 31) -#define SLIX_TYPE_FEATURE_READ (1U << 0) -#define SLIX_TYPE_FEATURE_WRITE (1U << 1) -#define SLIX_TYPE_FEATURE_PRIVACY (1U << 2) -#define SLIX_TYPE_FEATURE_DESTROY (1U << 3) -#define SLIX_TYPE_FEATURE_EAS (1U << 4) -#define SLIX_TYPE_FEATURE_SIGNATURE (1U << 5) -#define SLIX_TYPE_FEATURE_PROTECTION (1U << 6) +#define SLIX_TYPE_FEATURE_READ (1U << 0) +#define SLIX_TYPE_FEATURE_WRITE (1U << 1) +#define SLIX_TYPE_FEATURE_PRIVACY (1U << 2) +#define SLIX_TYPE_FEATURE_DESTROY (1U << 3) +#define SLIX_TYPE_FEATURE_EAS (1U << 4) +#define SLIX_TYPE_FEATURE_SIGNATURE (1U << 5) +#define SLIX_TYPE_FEATURE_PROTECTION (1U << 6) #define SLIX_TYPE_FEATURE_NFC_SYSTEM_INFO (1U << 7) typedef uint32_t SlixTypeFeatures; diff --git a/lib/nfc/protocols/slix/slix_i.h b/lib/nfc/protocols/slix/slix_i.h index 4a15b50ff..c8830f31b 100644 --- a/lib/nfc/protocols/slix/slix_i.h +++ b/lib/nfc/protocols/slix/slix_i.h @@ -11,33 +11,33 @@ extern "C" { #define SLIX_NXP_MANUFACTURER_CODE (0x04U) -#define SLIX_LOCK_BITS_AFI (1U << 0) -#define SLIX_LOCK_BITS_EAS (1U << 1) +#define SLIX_LOCK_BITS_AFI (1U << 0) +#define SLIX_LOCK_BITS_EAS (1U << 1) #define SLIX_LOCK_BITS_DSFID (1U << 2) -#define SLIX_LOCK_BITS_PPL (1U << 3) +#define SLIX_LOCK_BITS_PPL (1U << 3) -#define SLIX_CMD_CUSTOM_START (0xA2U) -#define SLIX_CMD_SET_EAS (0xA2U) -#define SLIX_CMD_RESET_EAS (0xA3U) -#define SLIX_CMD_LOCK_EAS (0xA4U) -#define SLIX_CMD_EAS_ALARM (0xA5U) -#define SLIX_CMD_PASSWORD_PROTECT_EAS_AFI (0xA6U) -#define SLIX_CMD_WRITE_EAS_ID (0xA7U) -#define SLIX_CMD_GET_NXP_SYSTEM_INFORMATION (0xABU) -#define SLIX_CMD_INVENTORY_PAGE_READ (0xB0U) -#define SLIX_CMD_INVENTORY_PAGE_READ_FAST (0xB1U) -#define SLIX_CMD_GET_RANDOM_NUMBER (0xB2U) -#define SLIX_CMD_SET_PASSWORD (0xB3U) -#define SLIX_CMD_WRITE_PASSWORD (0xB4U) -#define SLIX_CMD_64_BIT_PASSWORD_PROTECTION (0xB5U) -#define SLIX_CMD_PROTECT_PAGE (0xB6U) +#define SLIX_CMD_CUSTOM_START (0xA2U) +#define SLIX_CMD_SET_EAS (0xA2U) +#define SLIX_CMD_RESET_EAS (0xA3U) +#define SLIX_CMD_LOCK_EAS (0xA4U) +#define SLIX_CMD_EAS_ALARM (0xA5U) +#define SLIX_CMD_PASSWORD_PROTECT_EAS_AFI (0xA6U) +#define SLIX_CMD_WRITE_EAS_ID (0xA7U) +#define SLIX_CMD_GET_NXP_SYSTEM_INFORMATION (0xABU) +#define SLIX_CMD_INVENTORY_PAGE_READ (0xB0U) +#define SLIX_CMD_INVENTORY_PAGE_READ_FAST (0xB1U) +#define SLIX_CMD_GET_RANDOM_NUMBER (0xB2U) +#define SLIX_CMD_SET_PASSWORD (0xB3U) +#define SLIX_CMD_WRITE_PASSWORD (0xB4U) +#define SLIX_CMD_64_BIT_PASSWORD_PROTECTION (0xB5U) +#define SLIX_CMD_PROTECT_PAGE (0xB6U) #define SLIX_CMD_LOCK_PAGE_PROTECTION_CONDITION (0xB7U) -#define SLIX_CMD_DESTROY (0xB9U) -#define SLIX_CMD_ENABLE_PRIVACY (0xBAU) -#define SLIX_CMD_STAY_QUIET_PERSISTENT (0xBCU) -#define SLIX_CMD_READ_SIGNATURE (0xBDU) -#define SLIX_CMD_CUSTOM_END (0xBEU) -#define SLIX_CMD_CUSTOM_COUNT (SLIX_CMD_CUSTOM_END - SLIX_CMD_CUSTOM_START) +#define SLIX_CMD_DESTROY (0xB9U) +#define SLIX_CMD_ENABLE_PRIVACY (0xBAU) +#define SLIX_CMD_STAY_QUIET_PERSISTENT (0xBCU) +#define SLIX_CMD_READ_SIGNATURE (0xBDU) +#define SLIX_CMD_CUSTOM_END (0xBEU) +#define SLIX_CMD_CUSTOM_COUNT (SLIX_CMD_CUSTOM_END - SLIX_CMD_CUSTOM_START) #define SLIX_TYPE_FEATURES_SLIX (SLIX_TYPE_FEATURE_EAS) #define SLIX_TYPE_FEATURES_SLIX_S \ diff --git a/lib/nfc/protocols/st25tb/st25tb.c b/lib/nfc/protocols/st25tb/st25tb.c index 8b1e9be2e..e5a8c1cc0 100644 --- a/lib/nfc/protocols/st25tb/st25tb.c +++ b/lib/nfc/protocols/st25tb/st25tb.c @@ -6,9 +6,9 @@ #include #include -#define ST25TB_PROTOCOL_NAME "ST25TB" -#define ST25TB_TYPE_KEY "ST25TB Type" -#define ST25TB_BLOCK_KEY "Block %d" +#define ST25TB_PROTOCOL_NAME "ST25TB" +#define ST25TB_TYPE_KEY "ST25TB Type" +#define ST25TB_BLOCK_KEY "Block %d" #define ST25TB_SYSTEM_BLOCK_KEY "System OTP Block" typedef struct { diff --git a/lib/nfc/protocols/st25tb/st25tb.h b/lib/nfc/protocols/st25tb/st25tb.h index 67d733315..cda6c570f 100644 --- a/lib/nfc/protocols/st25tb/st25tb.h +++ b/lib/nfc/protocols/st25tb/st25tb.h @@ -9,13 +9,13 @@ extern "C" { #define ST25TB_UID_SIZE (8U) //#define ST25TB_FDT_FC (4205U) -#define ST25TB_FDT_FC (8494U) -#define ST25TB_GUARD_TIME_US (5000U) +#define ST25TB_FDT_FC (8494U) +#define ST25TB_GUARD_TIME_US (5000U) #define ST25TB_POLL_POLL_MIN_US (1280U) -#define ST25TB_MAX_BLOCKS (128U) +#define ST25TB_MAX_BLOCKS (128U) #define ST25TB_SYSTEM_OTP_BLOCK (0xFFU) -#define ST25TB_BLOCK_SIZE (4U) +#define ST25TB_BLOCK_SIZE (4U) typedef enum { St25tbErrorNone, diff --git a/lib/nfc/protocols/st25tb/st25tb_poller_sync.c b/lib/nfc/protocols/st25tb/st25tb_poller_sync.c index 359435034..c8f82c8ff 100644 --- a/lib/nfc/protocols/st25tb/st25tb_poller_sync.c +++ b/lib/nfc/protocols/st25tb/st25tb_poller_sync.c @@ -211,4 +211,4 @@ St25tbError st25tb_poller_sync_read(Nfc* nfc, St25tbData* data) { nfc_poller_free(poller); return poller_context.error; -} \ No newline at end of file +} diff --git a/lib/nfc/protocols/st25tb/st25tb_poller_sync.h b/lib/nfc/protocols/st25tb/st25tb_poller_sync.h index ecd994b39..78c5ab91e 100644 --- a/lib/nfc/protocols/st25tb/st25tb_poller_sync.h +++ b/lib/nfc/protocols/st25tb/st25tb_poller_sync.h @@ -17,4 +17,4 @@ St25tbError st25tb_poller_sync_read(Nfc* nfc, St25tbData* data); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/one_wire/one_wire_slave.c b/lib/one_wire/one_wire_slave.c index 8dfbe4aa5..36edc620f 100644 --- a/lib/one_wire/one_wire_slave.c +++ b/lib/one_wire/one_wire_slave.c @@ -150,7 +150,7 @@ static inline bool onewire_slave_receive_and_process_command(OneWireSlave* bus) } } - return (bus->error == OneWireSlaveErrorResetInProgress); + return bus->error == OneWireSlaveErrorResetInProgress; } return false; @@ -204,7 +204,7 @@ static void onewire_slave_exti_callback(void* context) { } else { pulse_start = DWT->CYCCNT; } -}; +} /*********************** PUBLIC ***********************/ diff --git a/lib/print/printf_tiny.c b/lib/print/printf_tiny.c index a1332529c..387a6451e 100644 --- a/lib/print/printf_tiny.c +++ b/lib/print/printf_tiny.c @@ -96,15 +96,15 @@ /////////////////////////////////////////////////////////////////////////////// // internal flag definitions -#define FLAGS_ZEROPAD (1U << 0U) -#define FLAGS_LEFT (1U << 1U) -#define FLAGS_PLUS (1U << 2U) -#define FLAGS_SPACE (1U << 3U) -#define FLAGS_HASH (1U << 4U) +#define FLAGS_ZEROPAD (1U << 0U) +#define FLAGS_LEFT (1U << 1U) +#define FLAGS_PLUS (1U << 2U) +#define FLAGS_SPACE (1U << 3U) +#define FLAGS_HASH (1U << 4U) #define FLAGS_UPPERCASE (1U << 5U) -#define FLAGS_CHAR (1U << 6U) -#define FLAGS_SHORT (1U << 7U) -#define FLAGS_LONG (1U << 8U) +#define FLAGS_CHAR (1U << 6U) +#define FLAGS_SHORT (1U << 7U) +#define FLAGS_LONG (1U << 8U) #define FLAGS_LONG_LONG (1U << 9U) #define FLAGS_PRECISION (1U << 10U) #define FLAGS_ADAPT_EXP (1U << 11U) diff --git a/lib/print/wrappers.c b/lib/print/wrappers.c index b248aeb3d..c8d72d192 100644 --- a/lib/print/wrappers.c +++ b/lib/print/wrappers.c @@ -68,4 +68,4 @@ __attribute__((__noreturn__)) void UNUSED(line); UNUSED(func); furi_crash(e); -} \ No newline at end of file +} diff --git a/lib/print/wrappers.h b/lib/print/wrappers.h index 7c0d1f92e..3cec88249 100644 --- a/lib/print/wrappers.h +++ b/lib/print/wrappers.h @@ -23,4 +23,4 @@ __attribute__((__noreturn__)) void #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/pulse_reader/pulse_reader.h b/lib/pulse_reader/pulse_reader.h index 62c5f2fa4..a4383b4c6 100644 --- a/lib/pulse_reader/pulse_reader.h +++ b/lib/pulse_reader/pulse_reader.h @@ -10,9 +10,9 @@ extern "C" { #endif -#define PULSE_READER_NO_EDGE (0xFFFFFFFFUL) +#define PULSE_READER_NO_EDGE (0xFFFFFFFFUL) #define PULSE_READER_LOST_EDGE (0xFFFFFFFEUL) -#define F_TIM2 (64000000UL) +#define F_TIM2 (64000000UL) /** * unit of the edge durations to return diff --git a/lib/signal_reader/parsers/iso15693/iso15693_parser.c b/lib/signal_reader/parsers/iso15693/iso15693_parser.c index c5326a354..a2c6912e6 100644 --- a/lib/signal_reader/parsers/iso15693/iso15693_parser.c +++ b/lib/signal_reader/parsers/iso15693/iso15693_parser.c @@ -5,8 +5,8 @@ #include #define ISO15693_PARSER_SIGNAL_READER_BUFF_SIZE (2) -#define ISO15693_PARSER_BITSTREAM_BUFF_SIZE (32) -#define ISO15693_PARSER_BITRATE_F64MHZ (603U) +#define ISO15693_PARSER_BITSTREAM_BUFF_SIZE (32) +#define ISO15693_PARSER_BITRATE_F64MHZ (603U) #define TAG "Iso15693Parser" diff --git a/lib/signal_reader/signal_reader.c b/lib/signal_reader/signal_reader.c index 8df2d5c72..97d56435c 100644 --- a/lib/signal_reader/signal_reader.c +++ b/lib/signal_reader/signal_reader.c @@ -13,18 +13,18 @@ #define SIGNAL_READER_DMA DMA2 -#define SIGNAL_READER_CAPTURE_TIM (TIM16) +#define SIGNAL_READER_CAPTURE_TIM (TIM16) #define SIGNAL_READER_CAPTURE_TIM_CHANNEL LL_TIM_CHANNEL_CH1 -#define SIGNAL_READER_DMA_GPIO LL_DMA_CHANNEL_2 +#define SIGNAL_READER_DMA_GPIO LL_DMA_CHANNEL_2 #define SIGNAL_READER_DMA_GPIO_IRQ FuriHalInterruptIdDma2Ch2 #define SIGNAL_READER_DMA_GPIO_DEF SIGNAL_READER_DMA, SIGNAL_READER_DMA_GPIO -#define SIGNAL_READER_DMA_TRIGGER LL_DMA_CHANNEL_3 +#define SIGNAL_READER_DMA_TRIGGER LL_DMA_CHANNEL_3 #define SIGNAL_READER_DMA_TRIGGER_IRQ FuriHalInterruptIdDma2Ch3 #define SIGNAL_READER_DMA_TRIGGER_DEF SIGNAL_READER_DMA, SIGNAL_READER_DMA_TRIGGER -#define SIGNAL_READER_DMA_CNT_SYNC LL_DMA_CHANNEL_5 +#define SIGNAL_READER_DMA_CNT_SYNC LL_DMA_CHANNEL_5 #define SIGNAL_READER_DMA_CNT_SYNC_IRQ FuriHalInterruptIdDma2Ch5 #define SIGNAL_READER_DMA_CNT_SYNC_DEF SIGNAL_READER_DMA, SIGNAL_READER_DMA_CNT_SYNC diff --git a/lib/subghz/blocks/const.h b/lib/subghz/blocks/const.h index f32334e2f..e73b1a559 100644 --- a/lib/subghz/blocks/const.h +++ b/lib/subghz/blocks/const.h @@ -17,4 +17,4 @@ typedef struct { #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/subghz/blocks/decoder.h b/lib/subghz/blocks/decoder.h index a5e561e35..4323dae09 100644 --- a/lib/subghz/blocks/decoder.h +++ b/lib/subghz/blocks/decoder.h @@ -44,4 +44,4 @@ uint8_t subghz_protocol_blocks_get_hash_data(SubGhzBlockDecoder* decoder, size_t #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/subghz/blocks/encoder.h b/lib/subghz/blocks/encoder.h index aeaa2add0..71710fa14 100644 --- a/lib/subghz/blocks/encoder.h +++ b/lib/subghz/blocks/encoder.h @@ -64,4 +64,4 @@ size_t subghz_protocol_blocks_get_upload_from_bit_array( #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/subghz/blocks/generic.c b/lib/subghz/blocks/generic.c index 06be6b3d5..164ed65ae 100644 --- a/lib/subghz/blocks/generic.c +++ b/lib/subghz/blocks/generic.c @@ -150,4 +150,4 @@ SubGhzProtocolStatus subghz_block_generic_deserialize_check_count_bit( } } while(false); return ret; -} \ No newline at end of file +} diff --git a/lib/subghz/blocks/generic.h b/lib/subghz/blocks/generic.h index bc26a54d9..54342601d 100644 --- a/lib/subghz/blocks/generic.h +++ b/lib/subghz/blocks/generic.h @@ -66,4 +66,4 @@ SubGhzProtocolStatus subghz_block_generic_deserialize_check_count_bit( #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/subghz/blocks/math.c b/lib/subghz/blocks/math.c index 24202ad1c..226bb3e74 100644 --- a/lib/subghz/blocks/math.c +++ b/lib/subghz/blocks/math.c @@ -241,4 +241,4 @@ uint8_t subghz_protocol_blocks_xor_bytes(uint8_t const message[], size_t size) { result ^= message[i]; } return result; -} \ No newline at end of file +} diff --git a/lib/subghz/blocks/math.h b/lib/subghz/blocks/math.h index dcea3da5f..bee1bf733 100644 --- a/lib/subghz/blocks/math.h +++ b/lib/subghz/blocks/math.h @@ -16,7 +16,7 @@ (value) &= ~(_one << (bit)); \ }) #define bit_write(value, bit, bitvalue) (bitvalue ? bit_set(value, bit) : bit_clear(value, bit)) -#define DURATION_DIFF(x, y) (((x) < (y)) ? ((y) - (x)) : ((x) - (y))) +#define DURATION_DIFF(x, y) (((x) < (y)) ? ((y) - (x)) : ((x) - (y))) #ifdef __cplusplus extern "C" { diff --git a/lib/subghz/devices/cc1101_configs.h b/lib/subghz/devices/cc1101_configs.h index eecab01d9..a821ade6b 100644 --- a/lib/subghz/devices/cc1101_configs.h +++ b/lib/subghz/devices/cc1101_configs.h @@ -15,4 +15,4 @@ extern const uint8_t subghz_device_cc1101_preset_gfsk_9_99kb_async_regs[]; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/subghz/devices/types.h b/lib/subghz/devices/types.h index 8a4198426..9060ab930 100644 --- a/lib/subghz/devices/types.h +++ b/lib/subghz/devices/types.h @@ -11,7 +11,7 @@ #include -#define SUBGHZ_RADIO_DEVICE_PLUGIN_APP_ID "subghz_radio_device" +#define SUBGHZ_RADIO_DEVICE_PLUGIN_APP_ID "subghz_radio_device" #define SUBGHZ_RADIO_DEVICE_PLUGIN_API_VERSION 1 typedef struct SubGhzDeviceRegistry SubGhzDeviceRegistry; diff --git a/lib/subghz/environment.c b/lib/subghz/environment.c index 1df598dc3..134b4d278 100644 --- a/lib/subghz/environment.c +++ b/lib/subghz/environment.c @@ -116,4 +116,4 @@ const char* } else { return NULL; } -} \ No newline at end of file +} diff --git a/lib/subghz/protocols/bin_raw.c b/lib/subghz/protocols/bin_raw.c index 8f62ccb1f..8298bce6b 100644 --- a/lib/subghz/protocols/bin_raw.c +++ b/lib/subghz/protocols/bin_raw.c @@ -14,15 +14,15 @@ #define TAG "SubGhzProtocolBinRaw" //change very carefully, RAM ends at the most inopportune moment -#define BIN_RAW_BUF_RAW_SIZE 2048 +#define BIN_RAW_BUF_RAW_SIZE 2048 #define BIN_RAW_BUF_DATA_SIZE 512 -#define BIN_RAW_THRESHOLD_RSSI -85.0f -#define BIN_RAW_DELTA_RSSI 7.0f -#define BIN_RAW_SEARCH_CLASSES 20 -#define BIN_RAW_TE_MIN_COUNT 40 +#define BIN_RAW_THRESHOLD_RSSI -85.0f +#define BIN_RAW_DELTA_RSSI 7.0f +#define BIN_RAW_SEARCH_CLASSES 20 +#define BIN_RAW_TE_MIN_COUNT 40 #define BIN_RAW_BUF_MIN_DATA_COUNT 128 -#define BIN_RAW_MAX_MARKUP_COUNT 20 +#define BIN_RAW_MAX_MARKUP_COUNT 20 //#define BIN_RAW_DEBUG @@ -131,7 +131,7 @@ static uint16_t subghz_protocol_bin_raw_get_full_byte(uint16_t bit_count) { if(bit_count & 0x7) { return (bit_count >> 3) + 1; } else { - return (bit_count >> 3); + return bit_count >> 3; } } diff --git a/lib/subghz/protocols/came.c b/lib/subghz/protocols/came.c index 40ae05bad..645f5eee1 100644 --- a/lib/subghz/protocols/came.c +++ b/lib/subghz/protocols/came.c @@ -13,12 +13,13 @@ */ #define TAG "SubGhzProtocolCame" -#define CAME_12_COUNT_BIT 12 -#define CAME_24_COUNT_BIT 24 -#define PRASTEL_COUNT_BIT 25 -#define PRASTEL_NAME "Prastel" + +#define CAME_12_COUNT_BIT 12 +#define CAME_24_COUNT_BIT 24 +#define PRASTEL_COUNT_BIT 25 +#define PRASTEL_NAME "Prastel" #define AIRFORCE_COUNT_BIT 18 -#define AIRFORCE_NAME "Airforce" +#define AIRFORCE_NAME "Airforce" static const SubGhzBlockConst subghz_protocol_came_const = { .te_short = 320, @@ -173,7 +174,7 @@ SubGhzProtocolStatus if(ret != SubGhzProtocolStatusOk) { break; } - if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) { + if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) { FURI_LOG_E(TAG, "Wrong number of bits in key"); ret = SubGhzProtocolStatusErrorValueBitCount; break; @@ -336,7 +337,7 @@ SubGhzProtocolStatus if(ret != SubGhzProtocolStatusOk) { break; } - if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) { + if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) { FURI_LOG_E(TAG, "Wrong number of bits in key"); ret = SubGhzProtocolStatusErrorValueBitCount; break; diff --git a/lib/subghz/protocols/chamberlain_code.c b/lib/subghz/protocols/chamberlain_code.c index 0dd0d2b0b..ea85fc0d9 100644 --- a/lib/subghz/protocols/chamberlain_code.c +++ b/lib/subghz/protocols/chamberlain_code.c @@ -9,8 +9,8 @@ #define TAG "SubGhzProtocolChambCode" #define CHAMBERLAIN_CODE_BIT_STOP 0b0001 -#define CHAMBERLAIN_CODE_BIT_1 0b0011 -#define CHAMBERLAIN_CODE_BIT_0 0b0111 +#define CHAMBERLAIN_CODE_BIT_1 0b0011 +#define CHAMBERLAIN_CODE_BIT_0 0b0111 #define CHAMBERLAIN_7_CODE_MASK 0xF000000FF0F #define CHAMBERLAIN_8_CODE_MASK 0xF00000F00F diff --git a/lib/subghz/protocols/clemsa.c b/lib/subghz/protocols/clemsa.c index a0547a113..5cbffefed 100644 --- a/lib/subghz/protocols/clemsa.c +++ b/lib/subghz/protocols/clemsa.c @@ -267,13 +267,12 @@ void subghz_protocol_decoder_clemsa_feed(void* context, bool level, uint32_t dur } else if( DURATION_DIFF(duration, subghz_protocol_clemsa_const.te_short * 51) < subghz_protocol_clemsa_const.te_delta * 25) { - if((DURATION_DIFF( - instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) < - subghz_protocol_clemsa_const.te_delta)) { + if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) < + subghz_protocol_clemsa_const.te_delta) { subghz_protocol_blocks_add_bit(&instance->decoder, 0); - } else if((DURATION_DIFF( - instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) < - subghz_protocol_clemsa_const.te_delta * 3)) { + } else if( + DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) < + subghz_protocol_clemsa_const.te_delta * 3) { subghz_protocol_blocks_add_bit(&instance->decoder, 1); } else { instance->decoder.parser_step = ClemsaDecoderStepReset; diff --git a/lib/subghz/protocols/doitrand.c b/lib/subghz/protocols/doitrand.c index 69b8bba4a..cf9618fcb 100644 --- a/lib/subghz/protocols/doitrand.c +++ b/lib/subghz/protocols/doitrand.c @@ -219,8 +219,8 @@ void subghz_protocol_decoder_doitrand_feed(void* context, bool level, uint32_t d } break; case DoitrandDecoderStepFoundStartBit: - if(level && ((DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) < - subghz_protocol_doitrand_const.te_delta * 3))) { + if(level && (DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) < + subghz_protocol_doitrand_const.te_delta * 3)) { //Found start bit instance->decoder.parser_step = DoitrandDecoderStepSaveDuration; instance->decoder.decode_data = 0; diff --git a/lib/subghz/protocols/gate_tx.c b/lib/subghz/protocols/gate_tx.c index 2ebd6bb03..d6a6bc7c9 100644 --- a/lib/subghz/protocols/gate_tx.c +++ b/lib/subghz/protocols/gate_tx.c @@ -212,8 +212,8 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du } break; case GateTXDecoderStepFoundStartBit: - if(level && ((DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) < - subghz_protocol_gate_tx_const.te_delta * 3))) { + if(level && (DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) < + subghz_protocol_gate_tx_const.te_delta * 3)) { //Found start bit instance->decoder.parser_step = GateTXDecoderStepSaveDuration; instance->decoder.decode_data = 0; diff --git a/lib/subghz/protocols/holtek.c b/lib/subghz/protocols/holtek.c index 294bd124d..b4717f5c6 100644 --- a/lib/subghz/protocols/holtek.c +++ b/lib/subghz/protocols/holtek.c @@ -16,7 +16,7 @@ #define TAG "SubGhzProtocolHoltek" #define HOLTEK_HEADER_MASK 0xF000000000 -#define HOLTEK_HEADER 0x5000000000 +#define HOLTEK_HEADER 0x5000000000 static const SubGhzBlockConst subghz_protocol_holtek_const = { .te_short = 430, @@ -358,7 +358,7 @@ void subghz_protocol_decoder_holtek_get_string(void* context, FuriString* output if((instance->generic.btn & 0xF) == 0xE) { furi_string_cat_printf(output, "ON\r\n"); - } else if(((instance->generic.btn & 0xF) == 0xB)) { + } else if((instance->generic.btn & 0xF) == 0xB) { furi_string_cat_printf(output, "OFF\r\n"); } } diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c index 51f7d3590..b38abb75b 100644 --- a/lib/subghz/protocols/keeloq.c +++ b/lib/subghz/protocols/keeloq.c @@ -473,7 +473,7 @@ static inline bool subghz_protocol_keeloq_check_decrypt_centurion( uint8_t btn) { furi_assert(instance); - if((decrypt >> 28 == btn) && (((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE))) { + if((decrypt >> 28 == btn) && ((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE)) { instance->cnt = decrypt & 0x0000FFFF; return true; } @@ -521,7 +521,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); - if((strcmp(furi_string_get_cstr(manufacture_code->name), "Centurion") == 0)) { + if(strcmp(furi_string_get_cstr(manufacture_code->name), "Centurion") == 0) { if(subghz_protocol_keeloq_check_decrypt_centurion(instance, decrypt, btn)) { *manufacture_name = furi_string_get_cstr(manufacture_code->name); return 1; diff --git a/lib/subghz/protocols/keeloq_common.h b/lib/subghz/protocols/keeloq_common.h index df3d0dbf3..6e40b66ce 100644 --- a/lib/subghz/protocols/keeloq_common.h +++ b/lib/subghz/protocols/keeloq_common.h @@ -16,11 +16,11 @@ * KeeLoq learning types * https://phreakerclub.com/forum/showthread.php?t=67 */ -#define KEELOQ_LEARNING_UNKNOWN 0u -#define KEELOQ_LEARNING_SIMPLE 1u -#define KEELOQ_LEARNING_NORMAL 2u -#define KEELOQ_LEARNING_SECURE 3u -#define KEELOQ_LEARNING_MAGIC_XOR_TYPE_1 4u +#define KEELOQ_LEARNING_UNKNOWN 0u +#define KEELOQ_LEARNING_SIMPLE 1u +#define KEELOQ_LEARNING_NORMAL 2u +#define KEELOQ_LEARNING_SECURE 3u +#define KEELOQ_LEARNING_MAGIC_XOR_TYPE_1 4u #define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_1 5u #define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_2 6u #define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_3 7u diff --git a/lib/subghz/protocols/linear.c b/lib/subghz/protocols/linear.c index 8d3735796..f9d7aaca8 100644 --- a/lib/subghz/protocols/linear.c +++ b/lib/subghz/protocols/linear.c @@ -243,8 +243,8 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur if(duration >= (subghz_protocol_linear_const.te_short * 5)) { instance->decoder.parser_step = LinearDecoderStepReset; //checking that the duration matches the guardtime - if((DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) > - subghz_protocol_linear_const.te_delta * 20)) { + if(DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) > + subghz_protocol_linear_const.te_delta * 20) { break; } if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_short) < diff --git a/lib/subghz/protocols/mastercode.c b/lib/subghz/protocols/mastercode.c index 54ad5bfaa..d4c549a42 100644 --- a/lib/subghz/protocols/mastercode.c +++ b/lib/subghz/protocols/mastercode.c @@ -269,14 +269,14 @@ void subghz_protocol_decoder_mastercode_feed(void* context, bool level, uint32_t } else if( DURATION_DIFF(duration, subghz_protocol_mastercode_const.te_short * 15) < subghz_protocol_mastercode_const.te_delta * 15) { - if((DURATION_DIFF( - instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) < - subghz_protocol_mastercode_const.te_delta)) { + if(DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) < + subghz_protocol_mastercode_const.te_delta) { subghz_protocol_blocks_add_bit(&instance->decoder, 0); - } else if((DURATION_DIFF( - instance->decoder.te_last, - subghz_protocol_mastercode_const.te_long) < - subghz_protocol_mastercode_const.te_delta * 8)) { + } else if( + DURATION_DIFF( + instance->decoder.te_last, subghz_protocol_mastercode_const.te_long) < + subghz_protocol_mastercode_const.te_delta * 8) { subghz_protocol_blocks_add_bit(&instance->decoder, 1); } else { instance->decoder.parser_step = MastercodeDecoderStepReset; diff --git a/lib/subghz/protocols/nice_flor_s.c b/lib/subghz/protocols/nice_flor_s.c index d8f5a070a..413204f20 100644 --- a/lib/subghz/protocols/nice_flor_s.c +++ b/lib/subghz/protocols/nice_flor_s.c @@ -15,7 +15,7 @@ #define TAG "SubGhzProtocoNiceFlorS" #define NICE_ONE_COUNT_BIT 72 -#define NICE_ONE_NAME "Nice One" +#define NICE_ONE_NAME "Nice One" static const SubGhzBlockConst subghz_protocol_nice_flor_s_const = { .te_short = 500, diff --git a/lib/subghz/protocols/phoenix_v2.c b/lib/subghz/protocols/phoenix_v2.c index 2416a9d01..2fabed73d 100644 --- a/lib/subghz/protocols/phoenix_v2.c +++ b/lib/subghz/protocols/phoenix_v2.c @@ -215,8 +215,8 @@ void subghz_protocol_decoder_phoenix_v2_feed(void* context, bool level, uint32_t } break; case Phoenix_V2DecoderStepFoundStartBit: - if(level && ((DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) < - subghz_protocol_phoenix_v2_const.te_delta * 4))) { + if(level && (DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) < + subghz_protocol_phoenix_v2_const.te_delta * 4)) { //Found start bit instance->decoder.parser_step = Phoenix_V2DecoderStepSaveDuration; instance->decoder.decode_data = 0; diff --git a/lib/subghz/protocols/power_smart.c b/lib/subghz/protocols/power_smart.c index d03282f73..828c4a76e 100644 --- a/lib/subghz/protocols/power_smart.c +++ b/lib/subghz/protocols/power_smart.c @@ -8,7 +8,8 @@ #include "../blocks/math.h" #define TAG "SubGhzProtocolPowerSmart" -#define POWER_SMART_PACKET_HEADER 0xFD000000AA000000 + +#define POWER_SMART_PACKET_HEADER 0xFD000000AA000000 #define POWER_SMART_PACKET_HEADER_MASK 0xFF000000FF000000 #define CHANNEL_PATTERN "%c%c%c%c%c%c" diff --git a/lib/subghz/protocols/princeton.c b/lib/subghz/protocols/princeton.c index 888ea9645..350349351 100644 --- a/lib/subghz/protocols/princeton.c +++ b/lib/subghz/protocols/princeton.c @@ -13,6 +13,7 @@ */ #define TAG "SubGhzProtocolPrinceton" + #define PRINCETON_GUARD_TIME_DEFALUT 30 //GUARD_TIME = PRINCETON_GUARD_TIME_DEFALUT * TE // Guard Time value should be between 15 -> 72 otherwise default value will be used diff --git a/lib/subghz/protocols/raw.c b/lib/subghz/protocols/raw.c index b5677f9c2..d7b31be37 100644 --- a/lib/subghz/protocols/raw.c +++ b/lib/subghz/protocols/raw.c @@ -9,6 +9,7 @@ #include #define TAG "SubGhzProtocolRaw" + #define SUBGHZ_DOWNLOAD_MAX_SIZE 512 static const SubGhzBlockConst subghz_protocol_raw_const = { diff --git a/lib/subghz/protocols/secplus_v1.c b/lib/subghz/protocols/secplus_v1.c index 644b2fba9..f878ecb01 100644 --- a/lib/subghz/protocols/secplus_v1.c +++ b/lib/subghz/protocols/secplus_v1.c @@ -14,16 +14,16 @@ #define TAG "SubGhzProtocoSecPlusV1" #define SECPLUS_V1_BIT_ERR -1 //0b0000 -#define SECPLUS_V1_BIT_0 0 //0b0001 -#define SECPLUS_V1_BIT_1 1 //0b0011 -#define SECPLUS_V1_BIT_2 2 //0b0111 +#define SECPLUS_V1_BIT_0 0 //0b0001 +#define SECPLUS_V1_BIT_1 1 //0b0011 +#define SECPLUS_V1_BIT_2 2 //0b0111 -#define SECPLUS_V1_PACKET_1_HEADER 0x00 -#define SECPLUS_V1_PACKET_2_HEADER 0x02 +#define SECPLUS_V1_PACKET_1_HEADER 0x00 +#define SECPLUS_V1_PACKET_2_HEADER 0x02 #define SECPLUS_V1_PACKET_1_INDEX_BASE 0 #define SECPLUS_V1_PACKET_2_INDEX_BASE 21 -#define SECPLUS_V1_PACKET_1_ACCEPTED (1 << 0) -#define SECPLUS_V1_PACKET_2_ACCEPTED (1 << 1) +#define SECPLUS_V1_PACKET_1_ACCEPTED (1 << 0) +#define SECPLUS_V1_PACKET_2_ACCEPTED (1 << 1) static const SubGhzBlockConst subghz_protocol_secplus_v1_const = { .te_short = 500, diff --git a/lib/subghz/protocols/secplus_v2.c b/lib/subghz/protocols/secplus_v2.c index 08d5c84f6..4f11e22b6 100644 --- a/lib/subghz/protocols/secplus_v2.c +++ b/lib/subghz/protocols/secplus_v2.c @@ -15,10 +15,10 @@ #define TAG "SubGhzProtocoSecPlusV2" -#define SECPLUS_V2_HEADER 0x3C0000000000 +#define SECPLUS_V2_HEADER 0x3C0000000000 #define SECPLUS_V2_HEADER_MASK 0xFFFF3C0000000000 -#define SECPLUS_V2_PACKET_1 0x000000000000 -#define SECPLUS_V2_PACKET_2 0x010000000000 +#define SECPLUS_V2_PACKET_1 0x000000000000 +#define SECPLUS_V2_PACKET_2 0x010000000000 #define SECPLUS_V2_PACKET_MASK 0x30000000000 static const SubGhzBlockConst subghz_protocol_secplus_v2_const = { diff --git a/lib/subghz/subghz_keystore.c b/lib/subghz/subghz_keystore.c index c5c676a60..4191d768f 100644 --- a/lib/subghz/subghz_keystore.c +++ b/lib/subghz/subghz_keystore.c @@ -13,9 +13,9 @@ #define FILE_BUFFER_SIZE 64 -#define SUBGHZ_KEYSTORE_FILE_TYPE "Flipper SubGhz Keystore File" +#define SUBGHZ_KEYSTORE_FILE_TYPE "Flipper SubGhz Keystore File" #define SUBGHZ_KEYSTORE_FILE_RAW_TYPE "Flipper SubGhz Keystore RAW File" -#define SUBGHZ_KEYSTORE_FILE_VERSION 0 +#define SUBGHZ_KEYSTORE_FILE_VERSION 0 #define SUBGHZ_KEYSTORE_FILE_ENCRYPTION_KEY_SLOT 1 #define SUBGHZ_KEYSTORE_FILE_DECRYPTED_LINE_SIZE 512 diff --git a/lib/subghz/subghz_setting.c b/lib/subghz/subghz_setting.c index ed1120a20..12b7bd16a 100644 --- a/lib/subghz/subghz_setting.c +++ b/lib/subghz/subghz_setting.c @@ -7,11 +7,11 @@ #define TAG "SubGhzSetting" -#define SUBGHZ_SETTING_FILE_TYPE "Flipper SubGhz Setting File" +#define SUBGHZ_SETTING_FILE_TYPE "Flipper SubGhz Setting File" #define SUBGHZ_SETTING_FILE_VERSION 1 #define FREQUENCY_FLAG_DEFAULT (1 << 31) -#define FREQUENCY_MASK (0xFFFFFFFF ^ FREQUENCY_FLAG_DEFAULT) +#define FREQUENCY_MASK (0xFFFFFFFF ^ FREQUENCY_FLAG_DEFAULT) /* Default */ static const uint32_t subghz_frequency_list[] = { diff --git a/lib/subghz/subghz_tx_rx_worker.c b/lib/subghz/subghz_tx_rx_worker.c index edef84caf..9a98ed57a 100644 --- a/lib/subghz/subghz_tx_rx_worker.c +++ b/lib/subghz/subghz_tx_rx_worker.c @@ -4,7 +4,7 @@ #define TAG "SubGhzTxRxWorker" -#define SUBGHZ_TXRX_WORKER_BUF_SIZE 2048 +#define SUBGHZ_TXRX_WORKER_BUF_SIZE 2048 //you can not set more than 62 because it will not fit into the FIFO CC1101 #define SUBGHZ_TXRX_WORKER_MAX_TXRX_SIZE 60 diff --git a/lib/subghz/subghz_worker.c b/lib/subghz/subghz_worker.c index fe68d5e2d..a771d1d19 100644 --- a/lib/subghz/subghz_worker.c +++ b/lib/subghz/subghz_worker.c @@ -146,4 +146,4 @@ bool subghz_worker_is_running(SubGhzWorker* instance) { void subghz_worker_set_filter(SubGhzWorker* instance, uint16_t timeout) { furi_check(instance); instance->filter_duration = timeout; -} \ No newline at end of file +} diff --git a/lib/subghz/types.h b/lib/subghz/types.h index 8c7f50d5d..e674ef730 100644 --- a/lib/subghz/types.h +++ b/lib/subghz/types.h @@ -11,21 +11,21 @@ #include #include -#define SUBGHZ_APP_FOLDER EXT_PATH("subghz") -#define SUBGHZ_RAW_FOLDER EXT_PATH("subghz") -#define SUBGHZ_APP_FILENAME_PREFIX "SubGHz" +#define SUBGHZ_APP_FOLDER EXT_PATH("subghz") +#define SUBGHZ_RAW_FOLDER EXT_PATH("subghz") +#define SUBGHZ_APP_FILENAME_PREFIX "SubGHz" #define SUBGHZ_APP_FILENAME_EXTENSION ".sub" #define SUBGHZ_KEY_FILE_VERSION 1 -#define SUBGHZ_KEY_FILE_TYPE "Flipper SubGhz Key File" +#define SUBGHZ_KEY_FILE_TYPE "Flipper SubGhz Key File" #define SUBGHZ_RAW_FILE_VERSION 1 -#define SUBGHZ_RAW_FILE_TYPE "Flipper SubGhz RAW File" +#define SUBGHZ_RAW_FILE_TYPE "Flipper SubGhz RAW File" -#define SUBGHZ_KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes") +#define SUBGHZ_KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes") #define SUBGHZ_KEYSTORE_DIR_USER_NAME EXT_PATH("subghz/assets/keeloq_mfcodes_user") -#define SUBGHZ_CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo") -#define SUBGHZ_NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s") +#define SUBGHZ_CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo") +#define SUBGHZ_NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s") #define SUBGHZ_ALUTECH_AT_4N_DIR_NAME EXT_PATH("subghz/assets/alutech_at_4n") typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry; diff --git a/lib/toolbox/buffer_stream.c b/lib/toolbox/buffer_stream.c index dccc97f1c..4ab4a0c5b 100644 --- a/lib/toolbox/buffer_stream.c +++ b/lib/toolbox/buffer_stream.c @@ -135,4 +135,4 @@ void buffer_stream_reset(BufferStream* buffer_stream) { buffer_reset(&buffer_stream->buffers[i]); } FURI_CRITICAL_EXIT(); -} \ No newline at end of file +} diff --git a/lib/toolbox/dir_walk.h b/lib/toolbox/dir_walk.h index 535237fc6..f2d32921f 100644 --- a/lib/toolbox/dir_walk.h +++ b/lib/toolbox/dir_walk.h @@ -76,4 +76,4 @@ void dir_walk_close(DirWalk* dir_walk); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/toolbox/hex.c b/lib/toolbox/hex.c index e5cdfff17..4b5bd30d3 100644 --- a/lib/toolbox/hex.c +++ b/lib/toolbox/hex.c @@ -4,10 +4,10 @@ bool hex_char_to_hex_nibble(char c, uint8_t* nibble) { furi_check(nibble); - if((c >= '0' && c <= '9')) { + if(c >= '0' && c <= '9') { *nibble = c - '0'; return true; - } else if((c >= 'A' && c <= 'F')) { + } else if(c >= 'A' && c <= 'F') { *nibble = c - 'A' + 10; return true; } else if(c >= 'a' && c <= 'f') { diff --git a/lib/toolbox/level_duration.h b/lib/toolbox/level_duration.h index 7618344ac..cb50fa3b4 100644 --- a/lib/toolbox/level_duration.h +++ b/lib/toolbox/level_duration.h @@ -6,15 +6,15 @@ #ifdef LEVEL_DURATION_BIG -#define LEVEL_DURATION_RESET 0U -#define LEVEL_DURATION_LEVEL_LOW 1U +#define LEVEL_DURATION_RESET 0U +#define LEVEL_DURATION_LEVEL_LOW 1U #define LEVEL_DURATION_LEVEL_HIGH 2U -#define LEVEL_DURATION_WAIT 3U -#define LEVEL_DURATION_RESERVED 0x800000U +#define LEVEL_DURATION_WAIT 3U +#define LEVEL_DURATION_RESERVED 0x800000U typedef struct { uint32_t duration : 30; - uint8_t level : 2; + uint8_t level : 2; } LevelDuration; static inline LevelDuration level_duration_make(bool level, uint32_t duration) { @@ -54,7 +54,7 @@ static inline uint32_t level_duration_get_duration(LevelDuration level_duration) #else -#define LEVEL_DURATION_RESET 0U +#define LEVEL_DURATION_RESET 0U #define LEVEL_DURATION_RESERVED 0x800000U typedef int32_t LevelDuration; @@ -68,11 +68,11 @@ static inline LevelDuration level_duration_reset() { } static inline bool level_duration_is_reset(LevelDuration level_duration) { - return (level_duration == LEVEL_DURATION_RESET); + return level_duration == LEVEL_DURATION_RESET; } static inline bool level_duration_get_level(LevelDuration level_duration) { - return (level_duration > 0); + return level_duration > 0; } static inline uint32_t level_duration_get_duration(LevelDuration level_duration) { diff --git a/lib/toolbox/m_cstr_dup.h b/lib/toolbox/m_cstr_dup.h index 11b7fe35a..8cc45dd85 100644 --- a/lib/toolbox/m_cstr_dup.h +++ b/lib/toolbox/m_cstr_dup.h @@ -1,10 +1,10 @@ #pragma once #include -#define M_INIT_DUP(a) ((a) = strdup("")) +#define M_INIT_DUP(a) ((a) = strdup("")) #define M_INIT_SET_DUP(a, b) ((a) = strdup(b)) -#define M_SET_DUP(a, b) (free((void*)a), (a) = strdup(b)) -#define M_CLEAR_DUP(a) (free((void*)a)) +#define M_SET_DUP(a, b) (free((void*)a), (a) = strdup(b)) +#define M_CLEAR_DUP(a) (free((void*)a)) #define M_CSTR_DUP_OPLIST \ (INIT(M_INIT_DUP), \ diff --git a/lib/toolbox/md5_calc.c b/lib/toolbox/md5_calc.c index 59c9403e8..f70f2361e 100644 --- a/lib/toolbox/md5_calc.c +++ b/lib/toolbox/md5_calc.c @@ -55,4 +55,4 @@ bool md5_string_calc_file(File* file, const char* path, FuriString* output, FS_E } return result; -} \ No newline at end of file +} diff --git a/lib/toolbox/name_generator.h b/lib/toolbox/name_generator.h index bc17d54cd..624533afb 100644 --- a/lib/toolbox/name_generator.h +++ b/lib/toolbox/name_generator.h @@ -32,4 +32,4 @@ void name_generator_make_detailed(char* name, size_t max_name_size, const char* #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/toolbox/pretty_format.h b/lib/toolbox/pretty_format.h index 860528e4c..fcd500fc6 100644 --- a/lib/toolbox/pretty_format.h +++ b/lib/toolbox/pretty_format.h @@ -6,7 +6,7 @@ extern "C" { #endif -#define PRETTY_FORMAT_FONT_BOLD "\e#" +#define PRETTY_FORMAT_FONT_BOLD "\e#" #define PRETTY_FORMAT_FONT_MONOSPACE "\e*" /** diff --git a/lib/toolbox/profiler.h b/lib/toolbox/profiler.h index 037711a8f..4c5d906ba 100644 --- a/lib/toolbox/profiler.h +++ b/lib/toolbox/profiler.h @@ -20,4 +20,4 @@ void profiler_dump(Profiler* profiler); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/toolbox/protocols/protocol.h b/lib/toolbox/protocols/protocol.h index 0ee165d13..855839dc7 100644 --- a/lib/toolbox/protocols/protocol.h +++ b/lib/toolbox/protocols/protocol.h @@ -44,4 +44,4 @@ typedef struct { ProtocolRenderData render_data; ProtocolRenderData render_brief_data; ProtocolWriteData write_data; -} ProtocolBase; \ No newline at end of file +} ProtocolBase; diff --git a/lib/toolbox/protocols/protocol_dict.c b/lib/toolbox/protocols/protocol_dict.c index 34cbcd13a..5680be18d 100644 --- a/lib/toolbox/protocols/protocol_dict.c +++ b/lib/toolbox/protocols/protocol_dict.c @@ -245,4 +245,4 @@ bool protocol_dict_get_write_data(ProtocolDict* dict, size_t protocol_index, voi furi_check(fn); return fn(dict->data[protocol_index], data); -} \ No newline at end of file +} diff --git a/lib/toolbox/protocols/protocol_dict.h b/lib/toolbox/protocols/protocol_dict.h index dd0711732..543b3ead2 100644 --- a/lib/toolbox/protocols/protocol_dict.h +++ b/lib/toolbox/protocols/protocol_dict.h @@ -9,7 +9,7 @@ typedef struct ProtocolDict ProtocolDict; typedef int32_t ProtocolId; -#define PROTOCOL_NO (-1) +#define PROTOCOL_NO (-1) #define PROTOCOL_ALL_FEATURES (0xFFFFFFFF) ProtocolDict* protocol_dict_alloc(const ProtocolBase** protocols, size_t protocol_count); diff --git a/lib/toolbox/pulse_joiner.c b/lib/toolbox/pulse_joiner.c index dce63b823..dcacb1f98 100644 --- a/lib/toolbox/pulse_joiner.c +++ b/lib/toolbox/pulse_joiner.c @@ -114,4 +114,4 @@ void pulse_joiner_pop_pulse(PulseJoiner* pulse_joiner, size_t* period, size_t* p break; } } -} \ No newline at end of file +} diff --git a/lib/toolbox/pulse_joiner.h b/lib/toolbox/pulse_joiner.h index f9597280f..b4b7d2d9f 100644 --- a/lib/toolbox/pulse_joiner.h +++ b/lib/toolbox/pulse_joiner.h @@ -43,4 +43,4 @@ void pulse_joiner_pop_pulse(PulseJoiner* pulse_joiner, size_t* period, size_t* p #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/toolbox/stream/stream.c b/lib/toolbox/stream/stream.c index 9aff8bd4f..0e4c5fc7a 100644 --- a/lib/toolbox/stream/stream.c +++ b/lib/toolbox/stream/stream.c @@ -144,7 +144,7 @@ static bool stream_write_struct(Stream* stream, const void* context) { furi_check(stream); furi_check(context); const StreamWriteData* write_data = context; - return (stream_write(stream, write_data->data, write_data->size) == write_data->size); + return stream_write(stream, write_data->data, write_data->size) == write_data->size; } bool stream_read_line(Stream* stream, FuriString* str_result) { diff --git a/lib/toolbox/stream/string_stream.c b/lib/toolbox/stream/string_stream.c index 742547fb7..7b014391e 100644 --- a/lib/toolbox/stream/string_stream.c +++ b/lib/toolbox/stream/string_stream.c @@ -51,7 +51,7 @@ static void string_stream_free(StringStream* stream) { } static bool string_stream_eof(StringStream* stream) { - return (string_stream_tell(stream) >= string_stream_size(stream)); + return string_stream_tell(stream) >= string_stream_size(stream); } static void string_stream_clean(StringStream* stream) { diff --git a/lib/toolbox/tar/tar_archive.c b/lib/toolbox/tar/tar_archive.c index 739627efd..80144a0f4 100644 --- a/lib/toolbox/tar/tar_archive.c +++ b/lib/toolbox/tar/tar_archive.c @@ -7,10 +7,11 @@ #include #define TAG "TarArch" -#define MAX_NAME_LEN 255 + +#define MAX_NAME_LEN 255 #define FILE_BLOCK_SIZE 512 -#define FILE_OPEN_NTRIES 10 +#define FILE_OPEN_NTRIES 10 #define FILE_OPEN_RETRY_DELAY 25 TarOpenMode tar_archive_get_mode_for_path(const char* path) { @@ -245,12 +246,12 @@ bool tar_archive_get_read_progress(TarArchive* archive, int32_t* processed, int3 bool tar_archive_dir_add_element(TarArchive* archive, const char* dirpath) { furi_check(archive); - return (mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS); + return mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS; } bool tar_archive_finalize(TarArchive* archive) { furi_check(archive); - return (mtar_finalize(&archive->tar) == MTAR_ESUCCESS); + return mtar_finalize(&archive->tar) == MTAR_ESUCCESS; } bool tar_archive_store_data( @@ -260,16 +261,15 @@ bool tar_archive_store_data( const int32_t data_len) { furi_check(archive); - return ( - tar_archive_file_add_header(archive, path, data_len) && - tar_archive_file_add_data_block(archive, data, data_len) && - tar_archive_file_finalize(archive)); + return tar_archive_file_add_header(archive, path, data_len) && + tar_archive_file_add_data_block(archive, data, data_len) && + tar_archive_file_finalize(archive); } bool tar_archive_file_add_header(TarArchive* archive, const char* path, const int32_t data_len) { furi_check(archive); - return (mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS); + return mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS; } bool tar_archive_file_add_data_block( @@ -278,12 +278,12 @@ bool tar_archive_file_add_data_block( const int32_t block_len) { furi_check(archive); - return (mtar_write_data(&archive->tar, data_block, block_len) == block_len); + return mtar_write_data(&archive->tar, data_block, block_len) == block_len; } bool tar_archive_file_finalize(TarArchive* archive) { furi_check(archive); - return (mtar_end_data(&archive->tar) == MTAR_ESUCCESS); + return mtar_end_data(&archive->tar) == MTAR_ESUCCESS; } typedef struct { @@ -396,8 +396,8 @@ bool tar_archive_unpack_to( FURI_LOG_I(TAG, "Restoring '%s'", destination); - return (mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS); -}; + return mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS; +} bool tar_archive_add_file( TarArchive* archive, diff --git a/lib/toolbox/varint.h b/lib/toolbox/varint.h index bf4681d4d..997c4d9d8 100644 --- a/lib/toolbox/varint.h +++ b/lib/toolbox/varint.h @@ -32,4 +32,4 @@ size_t varint_int32_length(int32_t value); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/lib/u8g2/u8g2.h b/lib/u8g2/u8g2.h index 540b7a873..c37f3b931 100644 --- a/lib/u8g2/u8g2.h +++ b/lib/u8g2/u8g2.h @@ -348,7 +348,7 @@ struct u8g2_struct { //#define u8g2_GetU8x8(u8g2) (&((u8g2)->u8x8)) #ifdef U8X8_WITH_USER_PTR -#define u8g2_GetUserPtr(u8g2) ((u8g2_GetU8x8(u8g2))->user_ptr) +#define u8g2_GetUserPtr(u8g2) ((u8g2_GetU8x8(u8g2))->user_ptr) #define u8g2_SetUserPtr(u8g2, p) ((u8g2_GetU8x8(u8g2))->user_ptr = (p)) #endif @@ -361,27 +361,27 @@ struct u8g2_struct { #define u8g2_SetupDisplay(u8g2, display_cb, cad_cb, byte_cb, gpio_and_delay_cb) \ u8x8_Setup(u8g2_GetU8x8(u8g2), (display_cb), (cad_cb), (byte_cb), (gpio_and_delay_cb)) -#define u8g2_InitDisplay(u8g2) u8x8_InitDisplay(u8g2_GetU8x8(u8g2)) +#define u8g2_InitDisplay(u8g2) u8x8_InitDisplay(u8g2_GetU8x8(u8g2)) #define u8g2_SetPowerSave(u8g2, is_enable) u8x8_SetPowerSave(u8g2_GetU8x8(u8g2), (is_enable)) -#define u8g2_SetFlipMode(u8g2, mode) u8x8_SetFlipMode(u8g2_GetU8x8(u8g2), (mode)) -#define u8g2_SetContrast(u8g2, value) u8x8_SetContrast(u8g2_GetU8x8(u8g2), (value)) +#define u8g2_SetFlipMode(u8g2, mode) u8x8_SetFlipMode(u8g2_GetU8x8(u8g2), (mode)) +#define u8g2_SetContrast(u8g2, value) u8x8_SetContrast(u8g2_GetU8x8(u8g2), (value)) //#define u8g2_ClearDisplay(u8g2) u8x8_ClearDisplay(u8g2_GetU8x8(u8g2)) obsolete, can not be used in all cases void u8g2_ClearDisplay(u8g2_t* u8g2); #define u8g2_GetDisplayHeight(u8g2) ((u8g2)->height) -#define u8g2_GetDisplayWidth(u8g2) ((u8g2)->width) -#define u8g2_GetDrawColor(u8g2) ((u8g2)->draw_color) +#define u8g2_GetDisplayWidth(u8g2) ((u8g2)->width) +#define u8g2_GetDrawColor(u8g2) ((u8g2)->draw_color) #define u8g2_SetI2CAddress(u8g2, address) ((u8g2_GetU8x8(u8g2))->i2c_address = (address)) -#define u8g2_GetI2CAddress(u8g2) u8x8_GetI2CAddress(u8g2_GetU8x8(u8g2)) +#define u8g2_GetI2CAddress(u8g2) u8x8_GetI2CAddress(u8g2_GetU8x8(u8g2)) #ifdef U8X8_USE_PINS #define u8g2_SetMenuSelectPin(u8g2, val) u8x8_SetMenuSelectPin(u8g2_GetU8x8(u8g2), (val)) -#define u8g2_SetMenuNextPin(u8g2, val) u8x8_SetMenuNextPin(u8g2_GetU8x8(u8g2), (val)) -#define u8g2_SetMenuPrevPin(u8g2, val) u8x8_SetMenuPrevPin(u8g2_GetU8x8(u8g2), (val)) -#define u8g2_SetMenuHomePin(u8g2, val) u8x8_SetMenuHomePin(u8g2_GetU8x8(u8g2), (val)) -#define u8g2_SetMenuUpPin(u8g2, val) u8x8_SetMenuUpPin(u8g2_GetU8x8(u8g2), (val)) -#define u8g2_SetMenuDownPin(u8g2, val) u8x8_SetMenuDownPin(u8g2_GetU8x8(u8g2), (val)) +#define u8g2_SetMenuNextPin(u8g2, val) u8x8_SetMenuNextPin(u8g2_GetU8x8(u8g2), (val)) +#define u8g2_SetMenuPrevPin(u8g2, val) u8x8_SetMenuPrevPin(u8g2_GetU8x8(u8g2), (val)) +#define u8g2_SetMenuHomePin(u8g2, val) u8x8_SetMenuHomePin(u8g2_GetU8x8(u8g2), (val)) +#define u8g2_SetMenuUpPin(u8g2, val) u8x8_SetMenuUpPin(u8g2_GetU8x8(u8g2), (val)) +#define u8g2_SetMenuDownPin(u8g2, val) u8x8_SetMenuDownPin(u8g2_GetU8x8(u8g2), (val)) #endif /*==========================================*/ @@ -395,10 +395,10 @@ extern const u8g2_cb_t u8g2_cb_r2; extern const u8g2_cb_t u8g2_cb_r3; extern const u8g2_cb_t u8g2_cb_mirror; -#define U8G2_R0 (&u8g2_cb_r0) -#define U8G2_R1 (&u8g2_cb_r1) -#define U8G2_R2 (&u8g2_cb_r2) -#define U8G2_R3 (&u8g2_cb_r3) +#define U8G2_R0 (&u8g2_cb_r0) +#define U8G2_R1 (&u8g2_cb_r1) +#define U8G2_R2 (&u8g2_cb_r2) +#define U8G2_R3 (&u8g2_cb_r3) #define U8G2_MIRROR (&u8g2_cb_mirror) /* u8g2: A new, not yet initialized u8g2 memory areay @@ -3559,12 +3559,12 @@ uint8_t u8g2_NextPage(u8g2_t* u8g2); #define u8g2_GetBufferSize(u8g2) \ ((u8g2)->u8x8.display_info->tile_width * 8 * (u8g2)->tile_buf_height) #endif -#define u8g2_GetBufferPtr(u8g2) ((u8g2)->tile_buf_ptr) -#define u8g2_GetBufferTileHeight(u8g2) ((u8g2)->tile_buf_height) -#define u8g2_GetBufferTileWidth(u8g2) (u8g2_GetU8x8(u8g2)->display_info->tile_width) +#define u8g2_GetBufferPtr(u8g2) ((u8g2)->tile_buf_ptr) +#define u8g2_GetBufferTileHeight(u8g2) ((u8g2)->tile_buf_height) +#define u8g2_GetBufferTileWidth(u8g2) (u8g2_GetU8x8(u8g2)->display_info->tile_width) /* the following variable is only valid after calling u8g2_FirstPage */ /* renamed from Page to Buffer: the CurrTileRow is the current row of the buffer, issue #370 */ -#define u8g2_GetPageCurrTileRow(u8g2) ((u8g2)->tile_curr_row) +#define u8g2_GetPageCurrTileRow(u8g2) ((u8g2)->tile_curr_row) #define u8g2_GetBufferCurrTileRow(u8g2) ((u8g2)->tile_curr_row) void u8g2_UpdateDisplayArea(u8g2_t* u8g2, uint8_t tx, uint8_t ty, uint8_t tw, uint8_t th); @@ -3660,8 +3660,8 @@ uint8_t u8g2_IsIntersection( /*==========================================*/ /* u8g2_circle.c */ #define U8G2_DRAW_UPPER_RIGHT 0x01 -#define U8G2_DRAW_UPPER_LEFT 0x02 -#define U8G2_DRAW_LOWER_LEFT 0x04 +#define U8G2_DRAW_UPPER_LEFT 0x02 +#define U8G2_DRAW_LOWER_LEFT 0x04 #define U8G2_DRAW_LOWER_RIGHT 0x08 #define U8G2_DRAW_ALL \ (U8G2_DRAW_UPPER_RIGHT | U8G2_DRAW_UPPER_LEFT | U8G2_DRAW_LOWER_RIGHT | U8G2_DRAW_LOWER_LEFT) @@ -3733,9 +3733,9 @@ u8g2_uint_t u8g2_add_vector_x(u8g2_uint_t dx, int8_t x, int8_t y, uint8_t dir) U size_t u8g2_GetFontSize(const uint8_t* font_arg); -#define U8G2_FONT_HEIGHT_MODE_TEXT 0 +#define U8G2_FONT_HEIGHT_MODE_TEXT 0 #define U8G2_FONT_HEIGHT_MODE_XTEXT 1 -#define U8G2_FONT_HEIGHT_MODE_ALL 2 +#define U8G2_FONT_HEIGHT_MODE_ALL 2 void u8g2_SetFont(u8g2_t* u8g2, const uint8_t* font); void u8g2_SetFontMode(u8g2_t* u8g2, uint8_t is_transparent); @@ -3764,11 +3764,11 @@ u8g2_uint_t u8g2_DrawExtUTF8( const char* str); #define u8g2_GetMaxCharHeight(u8g2) ((u8g2)->font_info.max_char_height) -#define u8g2_GetMaxCharWidth(u8g2) ((u8g2)->font_info.max_char_width) -#define u8g2_GetAscent(u8g2) ((u8g2)->font_ref_ascent) -#define u8g2_GetDescent(u8g2) ((u8g2)->font_ref_descent) -#define u8g2_GetFontAscent(u8g2) ((u8g2)->font_ref_ascent) -#define u8g2_GetFontDescent(u8g2) ((u8g2)->font_ref_descent) +#define u8g2_GetMaxCharWidth(u8g2) ((u8g2)->font_info.max_char_width) +#define u8g2_GetAscent(u8g2) ((u8g2)->font_ref_ascent) +#define u8g2_GetDescent(u8g2) ((u8g2)->font_ref_descent) +#define u8g2_GetFontAscent(u8g2) ((u8g2)->font_ref_ascent) +#define u8g2_GetFontDescent(u8g2) ((u8g2)->font_ref_descent) uint8_t u8g2_IsAllValidUTF8(u8g2_t* u8g2, const char* str); // checks whether all codes are valid @@ -3859,7 +3859,7 @@ void u8g2_SetupBuffer_Utf8(u8g2_t* u8g2, const u8g2_cb_t* u8g2_cb); /*==========================================*/ /* itoa procedures */ -#define u8g2_u8toa u8x8_u8toa +#define u8g2_u8toa u8x8_u8toa #define u8g2_u16toa u8x8_u16toa /*==========================================*/ @@ -5818,197 +5818,197 @@ extern const uint8_t u8g2_font_px437wyse700b_mn[] U8G2_FONT_SECTION("u8g2_font_p /*==========================================*/ /* u8g font mapping, might be incomplete.... */ -#define u8g_font_10x20 u8g2_font_10x20_tf -#define u8g_font_10x20r u8g2_font_10x20_tr -#define u8g_font_4x6 u8g2_font_4x6_tf -#define u8g_font_4x6r u8g2_font_4x6_tr -#define u8g_font_5x7 u8g2_font_5x7_tf -#define u8g_font_5x7r u8g2_font_5x7_tr -#define u8g_font_5x8 u8g2_font_5x8_tf -#define u8g_font_5x8r u8g2_font_5x8_tr -#define u8g_font_6x10 u8g2_font_6x10_tf -#define u8g_font_6x10r u8g2_font_6x10_tr -#define u8g_font_6x12 u8g2_font_6x12_tf -#define u8g_font_6x12r u8g2_font_6x12_tr -#define u8g_font_6x13B u8g2_font_6x13B_tf -#define u8g_font_6x13Br u8g2_font_6x13B_tr -#define u8g_font_6x13 u8g2_font_6x13_tf -#define u8g_font_6x13r u8g2_font_6x13_tr -#define u8g_font_6x13O u8g2_font_6x13O_tf -#define u8g_font_6x13Or u8g2_font_6x13O_tr -#define u8g_font_7x13B u8g2_font_7x13B_tf -#define u8g_font_7x13Br u8g2_font_7x13B_tr -#define u8g_font_7x13 u8g2_font_7x13_tf -#define u8g_font_7x13r u8g2_font_7x13_tr -#define u8g_font_7x13O u8g2_font_7x13O_tf -#define u8g_font_7x13Or u8g2_font_7x13O_tr -#define u8g_font_7x14B u8g2_font_7x14B_tf -#define u8g_font_7x14Br u8g2_font_7x14B_tr -#define u8g_font_7x14 u8g2_font_7x14_tf -#define u8g_font_7x14r u8g2_font_7x14_tr -#define u8g_font_8x13B u8g2_font_8x13B_tf -#define u8g_font_8x13Br u8g2_font_8x13B_tr -#define u8g_font_8x13 u8g2_font_8x13_tf -#define u8g_font_8x13r u8g2_font_8x13_tr -#define u8g_font_8x13O u8g2_font_8x13O_tf -#define u8g_font_8x13Or u8g2_font_8x13O_tr -#define u8g_font_9x15B u8g2_font_9x15B_tf -#define u8g_font_9x15Br u8g2_font_9x15B_tr -#define u8g_font_9x15 u8g2_font_9x15_tf -#define u8g_font_9x15r u8g2_font_9x15_tr -#define u8g_font_9x18B u8g2_font_9x18B_tf -#define u8g_font_9x18 u8g2_font_9x18_tf -#define u8g_font_9x18Br u8g2_font_9x18B_tr -#define u8g_font_9x18r u8g2_font_9x18_tr -#define u8g_font_cu12 u8g2_font_cu12_tf -#define u8g_font_micro u8g2_font_micro_tf -#define u8g_font_unifont u8g2_font_unifont_t_latin -#define u8g_font_unifontr u8g2_font_unifont_t_latin -#define u8g_font_courB08 u8g2_font_courB08_tf -#define u8g_font_courB08r u8g2_font_courB08_tr -#define u8g_font_courB10 u8g2_font_courB10_tf -#define u8g_font_courB10r u8g2_font_courB10_tr -#define u8g_font_courB12 u8g2_font_courB12_tf -#define u8g_font_courB12r u8g2_font_courB12_tr -#define u8g_font_courB14 u8g2_font_courB14_tf -#define u8g_font_courB14r u8g2_font_courB14_tr -#define u8g_font_courB18 u8g2_font_courB18_tf -#define u8g_font_courB18r u8g2_font_courB18_tr -#define u8g_font_courB24 u8g2_font_courB24_tf -#define u8g_font_courB24r u8g2_font_courB24_tr -#define u8g_font_courB24n u8g2_font_courB24_tn -#define u8g_font_courR08 u8g2_font_courR08_tf -#define u8g_font_courR08r u8g2_font_courR08_tr -#define u8g_font_courR10 u8g2_font_courR10_tf -#define u8g_font_courR10r u8g2_font_courR10_tr -#define u8g_font_courR12 u8g2_font_courR12_tf -#define u8g_font_courR12r u8g2_font_courR12_tr -#define u8g_font_courR14 u8g2_font_courR14_tf -#define u8g_font_courR14r u8g2_font_courR14_tr -#define u8g_font_courR18 u8g2_font_courR18_tf -#define u8g_font_courR18r u8g2_font_courR18_tr -#define u8g_font_courR24 u8g2_font_courR24_tf -#define u8g_font_courR24r u8g2_font_courR24_tr -#define u8g_font_courR24n u8g2_font_courR24_tn -#define u8g_font_helvB08 u8g2_font_helvB08_tf -#define u8g_font_helvB08r u8g2_font_helvB08_tr -#define u8g_font_helvB08n u8g2_font_helvB08_tn -#define u8g_font_helvB10 u8g2_font_helvB10_tf -#define u8g_font_helvB10r u8g2_font_helvB10_tr -#define u8g_font_helvB10n u8g2_font_helvB10_tn -#define u8g_font_helvB12 u8g2_font_helvB12_tf -#define u8g_font_helvB12r u8g2_font_helvB12_tr -#define u8g_font_helvB12n u8g2_font_helvB12_tn -#define u8g_font_helvB14 u8g2_font_helvB14_tf -#define u8g_font_helvB14r u8g2_font_helvB14_tr -#define u8g_font_helvB14n u8g2_font_helvB14_tn -#define u8g_font_helvB18 u8g2_font_helvB18_tf -#define u8g_font_helvB18r u8g2_font_helvB18_tr -#define u8g_font_helvB18n u8g2_font_helvB18_tn -#define u8g_font_helvB24 u8g2_font_helvB24_tf -#define u8g_font_helvB24r u8g2_font_helvB24_tr -#define u8g_font_helvB24n u8g2_font_helvB24_tn -#define u8g_font_helvR08 u8g2_font_helvR08_tf -#define u8g_font_helvR08r u8g2_font_helvR08_tr -#define u8g_font_helvR08n u8g2_font_helvR08_tn -#define u8g_font_helvR10 u8g2_font_helvR10_tf -#define u8g_font_helvR10r u8g2_font_helvR10_tr -#define u8g_font_helvR10n u8g2_font_helvR10_tn -#define u8g_font_helvR12 u8g2_font_helvR12_tf -#define u8g_font_helvR12r u8g2_font_helvR12_tr -#define u8g_font_helvR12n u8g2_font_helvR12_tn -#define u8g_font_helvR14 u8g2_font_helvR14_tf -#define u8g_font_helvR14r u8g2_font_helvR14_tr -#define u8g_font_helvR14n u8g2_font_helvR14_tn -#define u8g_font_helvR18 u8g2_font_helvR18_tf -#define u8g_font_helvR18r u8g2_font_helvR18_tr -#define u8g_font_helvR18n u8g2_font_helvR18_tn -#define u8g_font_helvR24 u8g2_font_helvR24_tf -#define u8g_font_helvR24r u8g2_font_helvR24_tr -#define u8g_font_helvR24n u8g2_font_helvR24_tn -#define u8g_font_ncenB08 u8g2_font_ncenB08_tf -#define u8g_font_ncenB08r u8g2_font_ncenB08_tr -#define u8g_font_ncenB10 u8g2_font_ncenB10_tf -#define u8g_font_ncenB10r u8g2_font_ncenB10_tr -#define u8g_font_ncenB12 u8g2_font_ncenB12_tf -#define u8g_font_ncenB12r u8g2_font_ncenB12_tr -#define u8g_font_ncenB14 u8g2_font_ncenB14_tf -#define u8g_font_ncenB14r u8g2_font_ncenB14_tr -#define u8g_font_ncenB18 u8g2_font_ncenB18_tf -#define u8g_font_ncenB18r u8g2_font_ncenB18_tr -#define u8g_font_ncenB24 u8g2_font_ncenB24_tf -#define u8g_font_ncenB24r u8g2_font_ncenB24_tr -#define u8g_font_ncenB24n u8g2_font_ncenB24_tn -#define u8g_font_ncenR08 u8g2_font_ncenR08_tf -#define u8g_font_ncenR08r u8g2_font_ncenR08_tr -#define u8g_font_ncenR10 u8g2_font_ncenR10_tf -#define u8g_font_ncenR10r u8g2_font_ncenR10_tr -#define u8g_font_ncenR12 u8g2_font_ncenR12_tf -#define u8g_font_ncenR12r u8g2_font_ncenR12_tr -#define u8g_font_ncenR14 u8g2_font_ncenR14_tf -#define u8g_font_ncenR14r u8g2_font_ncenR14_tr -#define u8g_font_ncenR18 u8g2_font_ncenR18_tf -#define u8g_font_ncenR18r u8g2_font_ncenR18_tr -#define u8g_font_ncenR24 u8g2_font_ncenR24_tf -#define u8g_font_ncenR24r u8g2_font_ncenR24_tr -#define u8g_font_ncenR24n u8g2_font_ncenR24_tn -#define u8g_font_timB08 u8g2_font_timB08_tf -#define u8g_font_timB08r u8g2_font_timB08_tr -#define u8g_font_timB10 u8g2_font_timB10_tf -#define u8g_font_timB10r u8g2_font_timB10_tr -#define u8g_font_timB12 u8g2_font_timB12_tf -#define u8g_font_timB12r u8g2_font_timB12_tr -#define u8g_font_timB14 u8g2_font_timB14_tf -#define u8g_font_timB14r u8g2_font_timB14_tr -#define u8g_font_timB18 u8g2_font_timB18_tf -#define u8g_font_timB18r u8g2_font_timB18_tr -#define u8g_font_timB24 u8g2_font_timB24_tf -#define u8g_font_timB24r u8g2_font_timB24_tr -#define u8g_font_timB24n u8g2_font_timB24_tn -#define u8g_font_timR08 u8g2_font_timR08_tf -#define u8g_font_timR08r u8g2_font_timR08_tr -#define u8g_font_timR10 u8g2_font_timR10_tf -#define u8g_font_timR10r u8g2_font_timR10_tr -#define u8g_font_timR12 u8g2_font_timR12_tf -#define u8g_font_timR12r u8g2_font_timR12_tr -#define u8g_font_timR14 u8g2_font_timR14_tf -#define u8g_font_timR14r u8g2_font_timR14_tr -#define u8g_font_timR18 u8g2_font_timR18_tf -#define u8g_font_timR18r u8g2_font_timR18_tr -#define u8g_font_timR24 u8g2_font_timR24_tf -#define u8g_font_timR24r u8g2_font_timR24_tr -#define u8g_font_timR24n u8g2_font_timR24_tn -#define u8g_font_p01type u8g2_font_p01type_tf -#define u8g_font_p01typer u8g2_font_p01type_tr -#define u8g_font_lucasfont_alternate u8g2_font_lucasfont_alternate_tf +#define u8g_font_10x20 u8g2_font_10x20_tf +#define u8g_font_10x20r u8g2_font_10x20_tr +#define u8g_font_4x6 u8g2_font_4x6_tf +#define u8g_font_4x6r u8g2_font_4x6_tr +#define u8g_font_5x7 u8g2_font_5x7_tf +#define u8g_font_5x7r u8g2_font_5x7_tr +#define u8g_font_5x8 u8g2_font_5x8_tf +#define u8g_font_5x8r u8g2_font_5x8_tr +#define u8g_font_6x10 u8g2_font_6x10_tf +#define u8g_font_6x10r u8g2_font_6x10_tr +#define u8g_font_6x12 u8g2_font_6x12_tf +#define u8g_font_6x12r u8g2_font_6x12_tr +#define u8g_font_6x13B u8g2_font_6x13B_tf +#define u8g_font_6x13Br u8g2_font_6x13B_tr +#define u8g_font_6x13 u8g2_font_6x13_tf +#define u8g_font_6x13r u8g2_font_6x13_tr +#define u8g_font_6x13O u8g2_font_6x13O_tf +#define u8g_font_6x13Or u8g2_font_6x13O_tr +#define u8g_font_7x13B u8g2_font_7x13B_tf +#define u8g_font_7x13Br u8g2_font_7x13B_tr +#define u8g_font_7x13 u8g2_font_7x13_tf +#define u8g_font_7x13r u8g2_font_7x13_tr +#define u8g_font_7x13O u8g2_font_7x13O_tf +#define u8g_font_7x13Or u8g2_font_7x13O_tr +#define u8g_font_7x14B u8g2_font_7x14B_tf +#define u8g_font_7x14Br u8g2_font_7x14B_tr +#define u8g_font_7x14 u8g2_font_7x14_tf +#define u8g_font_7x14r u8g2_font_7x14_tr +#define u8g_font_8x13B u8g2_font_8x13B_tf +#define u8g_font_8x13Br u8g2_font_8x13B_tr +#define u8g_font_8x13 u8g2_font_8x13_tf +#define u8g_font_8x13r u8g2_font_8x13_tr +#define u8g_font_8x13O u8g2_font_8x13O_tf +#define u8g_font_8x13Or u8g2_font_8x13O_tr +#define u8g_font_9x15B u8g2_font_9x15B_tf +#define u8g_font_9x15Br u8g2_font_9x15B_tr +#define u8g_font_9x15 u8g2_font_9x15_tf +#define u8g_font_9x15r u8g2_font_9x15_tr +#define u8g_font_9x18B u8g2_font_9x18B_tf +#define u8g_font_9x18 u8g2_font_9x18_tf +#define u8g_font_9x18Br u8g2_font_9x18B_tr +#define u8g_font_9x18r u8g2_font_9x18_tr +#define u8g_font_cu12 u8g2_font_cu12_tf +#define u8g_font_micro u8g2_font_micro_tf +#define u8g_font_unifont u8g2_font_unifont_t_latin +#define u8g_font_unifontr u8g2_font_unifont_t_latin +#define u8g_font_courB08 u8g2_font_courB08_tf +#define u8g_font_courB08r u8g2_font_courB08_tr +#define u8g_font_courB10 u8g2_font_courB10_tf +#define u8g_font_courB10r u8g2_font_courB10_tr +#define u8g_font_courB12 u8g2_font_courB12_tf +#define u8g_font_courB12r u8g2_font_courB12_tr +#define u8g_font_courB14 u8g2_font_courB14_tf +#define u8g_font_courB14r u8g2_font_courB14_tr +#define u8g_font_courB18 u8g2_font_courB18_tf +#define u8g_font_courB18r u8g2_font_courB18_tr +#define u8g_font_courB24 u8g2_font_courB24_tf +#define u8g_font_courB24r u8g2_font_courB24_tr +#define u8g_font_courB24n u8g2_font_courB24_tn +#define u8g_font_courR08 u8g2_font_courR08_tf +#define u8g_font_courR08r u8g2_font_courR08_tr +#define u8g_font_courR10 u8g2_font_courR10_tf +#define u8g_font_courR10r u8g2_font_courR10_tr +#define u8g_font_courR12 u8g2_font_courR12_tf +#define u8g_font_courR12r u8g2_font_courR12_tr +#define u8g_font_courR14 u8g2_font_courR14_tf +#define u8g_font_courR14r u8g2_font_courR14_tr +#define u8g_font_courR18 u8g2_font_courR18_tf +#define u8g_font_courR18r u8g2_font_courR18_tr +#define u8g_font_courR24 u8g2_font_courR24_tf +#define u8g_font_courR24r u8g2_font_courR24_tr +#define u8g_font_courR24n u8g2_font_courR24_tn +#define u8g_font_helvB08 u8g2_font_helvB08_tf +#define u8g_font_helvB08r u8g2_font_helvB08_tr +#define u8g_font_helvB08n u8g2_font_helvB08_tn +#define u8g_font_helvB10 u8g2_font_helvB10_tf +#define u8g_font_helvB10r u8g2_font_helvB10_tr +#define u8g_font_helvB10n u8g2_font_helvB10_tn +#define u8g_font_helvB12 u8g2_font_helvB12_tf +#define u8g_font_helvB12r u8g2_font_helvB12_tr +#define u8g_font_helvB12n u8g2_font_helvB12_tn +#define u8g_font_helvB14 u8g2_font_helvB14_tf +#define u8g_font_helvB14r u8g2_font_helvB14_tr +#define u8g_font_helvB14n u8g2_font_helvB14_tn +#define u8g_font_helvB18 u8g2_font_helvB18_tf +#define u8g_font_helvB18r u8g2_font_helvB18_tr +#define u8g_font_helvB18n u8g2_font_helvB18_tn +#define u8g_font_helvB24 u8g2_font_helvB24_tf +#define u8g_font_helvB24r u8g2_font_helvB24_tr +#define u8g_font_helvB24n u8g2_font_helvB24_tn +#define u8g_font_helvR08 u8g2_font_helvR08_tf +#define u8g_font_helvR08r u8g2_font_helvR08_tr +#define u8g_font_helvR08n u8g2_font_helvR08_tn +#define u8g_font_helvR10 u8g2_font_helvR10_tf +#define u8g_font_helvR10r u8g2_font_helvR10_tr +#define u8g_font_helvR10n u8g2_font_helvR10_tn +#define u8g_font_helvR12 u8g2_font_helvR12_tf +#define u8g_font_helvR12r u8g2_font_helvR12_tr +#define u8g_font_helvR12n u8g2_font_helvR12_tn +#define u8g_font_helvR14 u8g2_font_helvR14_tf +#define u8g_font_helvR14r u8g2_font_helvR14_tr +#define u8g_font_helvR14n u8g2_font_helvR14_tn +#define u8g_font_helvR18 u8g2_font_helvR18_tf +#define u8g_font_helvR18r u8g2_font_helvR18_tr +#define u8g_font_helvR18n u8g2_font_helvR18_tn +#define u8g_font_helvR24 u8g2_font_helvR24_tf +#define u8g_font_helvR24r u8g2_font_helvR24_tr +#define u8g_font_helvR24n u8g2_font_helvR24_tn +#define u8g_font_ncenB08 u8g2_font_ncenB08_tf +#define u8g_font_ncenB08r u8g2_font_ncenB08_tr +#define u8g_font_ncenB10 u8g2_font_ncenB10_tf +#define u8g_font_ncenB10r u8g2_font_ncenB10_tr +#define u8g_font_ncenB12 u8g2_font_ncenB12_tf +#define u8g_font_ncenB12r u8g2_font_ncenB12_tr +#define u8g_font_ncenB14 u8g2_font_ncenB14_tf +#define u8g_font_ncenB14r u8g2_font_ncenB14_tr +#define u8g_font_ncenB18 u8g2_font_ncenB18_tf +#define u8g_font_ncenB18r u8g2_font_ncenB18_tr +#define u8g_font_ncenB24 u8g2_font_ncenB24_tf +#define u8g_font_ncenB24r u8g2_font_ncenB24_tr +#define u8g_font_ncenB24n u8g2_font_ncenB24_tn +#define u8g_font_ncenR08 u8g2_font_ncenR08_tf +#define u8g_font_ncenR08r u8g2_font_ncenR08_tr +#define u8g_font_ncenR10 u8g2_font_ncenR10_tf +#define u8g_font_ncenR10r u8g2_font_ncenR10_tr +#define u8g_font_ncenR12 u8g2_font_ncenR12_tf +#define u8g_font_ncenR12r u8g2_font_ncenR12_tr +#define u8g_font_ncenR14 u8g2_font_ncenR14_tf +#define u8g_font_ncenR14r u8g2_font_ncenR14_tr +#define u8g_font_ncenR18 u8g2_font_ncenR18_tf +#define u8g_font_ncenR18r u8g2_font_ncenR18_tr +#define u8g_font_ncenR24 u8g2_font_ncenR24_tf +#define u8g_font_ncenR24r u8g2_font_ncenR24_tr +#define u8g_font_ncenR24n u8g2_font_ncenR24_tn +#define u8g_font_timB08 u8g2_font_timB08_tf +#define u8g_font_timB08r u8g2_font_timB08_tr +#define u8g_font_timB10 u8g2_font_timB10_tf +#define u8g_font_timB10r u8g2_font_timB10_tr +#define u8g_font_timB12 u8g2_font_timB12_tf +#define u8g_font_timB12r u8g2_font_timB12_tr +#define u8g_font_timB14 u8g2_font_timB14_tf +#define u8g_font_timB14r u8g2_font_timB14_tr +#define u8g_font_timB18 u8g2_font_timB18_tf +#define u8g_font_timB18r u8g2_font_timB18_tr +#define u8g_font_timB24 u8g2_font_timB24_tf +#define u8g_font_timB24r u8g2_font_timB24_tr +#define u8g_font_timB24n u8g2_font_timB24_tn +#define u8g_font_timR08 u8g2_font_timR08_tf +#define u8g_font_timR08r u8g2_font_timR08_tr +#define u8g_font_timR10 u8g2_font_timR10_tf +#define u8g_font_timR10r u8g2_font_timR10_tr +#define u8g_font_timR12 u8g2_font_timR12_tf +#define u8g_font_timR12r u8g2_font_timR12_tr +#define u8g_font_timR14 u8g2_font_timR14_tf +#define u8g_font_timR14r u8g2_font_timR14_tr +#define u8g_font_timR18 u8g2_font_timR18_tf +#define u8g_font_timR18r u8g2_font_timR18_tr +#define u8g_font_timR24 u8g2_font_timR24_tf +#define u8g_font_timR24r u8g2_font_timR24_tr +#define u8g_font_timR24n u8g2_font_timR24_tn +#define u8g_font_p01type u8g2_font_p01type_tf +#define u8g_font_p01typer u8g2_font_p01type_tr +#define u8g_font_lucasfont_alternate u8g2_font_lucasfont_alternate_tf #define u8g_font_lucasfont_alternater u8g2_font_lucasfont_alternate_tr -#define u8g_font_chikita u8g2_font_chikita_tf -#define u8g_font_chikitar u8g2_font_chikita_tr -#define u8g_font_pixelle_micro u8g2_font_pixelle_micro_tf -#define u8g_font_pixelle_micror u8g2_font_pixelle_micro_tr -#define u8g_font_trixel_square u8g2_font_trixel_square_tf -#define u8g_font_trixel_squarer u8g2_font_trixel_square_tr -#define u8g_font_robot_de_niro u8g2_font_robot_de_niro_tf -#define u8g_font_robot_de_niror u8g2_font_robot_de_niro_tr -#define u8g_font_baby u8g2_font_baby_tf -#define u8g_font_babyr u8g2_font_baby_tr -#define u8g_font_blipfest_07 u8g2_font_blipfest_07_tr -#define u8g_font_blipfest_07r u8g2_font_blipfest_07_tr -#define u8g_font_blipfest_07n u8g2_font_blipfest_07_tn -#define u8g_font_profont10 u8g2_font_profont10_tf -#define u8g_font_profont10r u8g2_font_profont10_tr -#define u8g_font_profont11 u8g2_font_profont11_tf -#define u8g_font_profont11r u8g2_font_profont11_tr -#define u8g_font_profont12 u8g2_font_profont12_tf -#define u8g_font_profont12r u8g2_font_profont12_tr -#define u8g_font_profont15 u8g2_font_profont15_tf -#define u8g_font_profont15r u8g2_font_profont15_tr -#define u8g_font_profont17 u8g2_font_profont17_tf -#define u8g_font_profont17r u8g2_font_profont17_tr -#define u8g_font_profont22 u8g2_font_profont22_tf -#define u8g_font_profont22r u8g2_font_profont22_tr -#define u8g_font_profont29 u8g2_font_profont29_tf -#define u8g_font_profont29r u8g2_font_profont29_tr +#define u8g_font_chikita u8g2_font_chikita_tf +#define u8g_font_chikitar u8g2_font_chikita_tr +#define u8g_font_pixelle_micro u8g2_font_pixelle_micro_tf +#define u8g_font_pixelle_micror u8g2_font_pixelle_micro_tr +#define u8g_font_trixel_square u8g2_font_trixel_square_tf +#define u8g_font_trixel_squarer u8g2_font_trixel_square_tr +#define u8g_font_robot_de_niro u8g2_font_robot_de_niro_tf +#define u8g_font_robot_de_niror u8g2_font_robot_de_niro_tr +#define u8g_font_baby u8g2_font_baby_tf +#define u8g_font_babyr u8g2_font_baby_tr +#define u8g_font_blipfest_07 u8g2_font_blipfest_07_tr +#define u8g_font_blipfest_07r u8g2_font_blipfest_07_tr +#define u8g_font_blipfest_07n u8g2_font_blipfest_07_tn +#define u8g_font_profont10 u8g2_font_profont10_tf +#define u8g_font_profont10r u8g2_font_profont10_tr +#define u8g_font_profont11 u8g2_font_profont11_tf +#define u8g_font_profont11r u8g2_font_profont11_tr +#define u8g_font_profont12 u8g2_font_profont12_tf +#define u8g_font_profont12r u8g2_font_profont12_tr +#define u8g_font_profont15 u8g2_font_profont15_tf +#define u8g_font_profont15r u8g2_font_profont15_tr +#define u8g_font_profont17 u8g2_font_profont17_tf +#define u8g_font_profont17r u8g2_font_profont17_tr +#define u8g_font_profont22 u8g2_font_profont22_tf +#define u8g_font_profont22r u8g2_font_profont22_tr +#define u8g_font_profont29 u8g2_font_profont29_tf +#define u8g_font_profont29r u8g2_font_profont29_tr /*==========================================*/ /* C++ compatible */ diff --git a/lib/u8g2/u8g2_glue.c b/lib/u8g2/u8g2_glue.c index 230bd2a1b..b3e74c229 100644 --- a/lib/u8g2/u8g2_glue.c +++ b/lib/u8g2/u8g2_glue.c @@ -55,22 +55,22 @@ uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ return 1; } -#define ST756X_CMD_ON_OFF 0b10101110 /**< 0:0 Switch Display ON/OFF: last bit */ -#define ST756X_CMD_SET_LINE 0b01000000 /**< 0:0 Set Start Line: last 6 bits */ -#define ST756X_CMD_SET_PAGE 0b10110000 /**< 0:0 Set Page address: last 4 bits */ -#define ST756X_CMD_SET_COLUMN_MSB 0b00010000 /**< 0:0 Set Column MSB: last 4 bits */ -#define ST756X_CMD_SET_COLUMN_LSB 0b00000000 /**< 0:0 Set Column LSB: last 4 bits */ -#define ST756X_CMD_SEG_DIRECTION 0b10100000 /**< 0:0 Reverse scan direction of SEG: last bit */ -#define ST756X_CMD_INVERSE_DISPLAY 0b10100110 /**< 0:0 Invert display: last bit */ -#define ST756X_CMD_ALL_PIXEL_ON 0b10100100 /**< 0:0 Set all pixel on: last bit */ -#define ST756X_CMD_BIAS_SELECT 0b10100010 /**< 0:0 Select 1/9(0) or 1/7(1) bias: last bit */ -#define ST756X_CMD_R_M_W 0b11100000 /**< 0:0 Enter Read Modify Write mode: read+0, write+1 */ -#define ST756X_CMD_END 0b11101110 /**< 0:0 Exit Read Modify Write mode */ -#define ST756X_CMD_RESET 0b11100010 /**< 0:0 Software Reset */ -#define ST756X_CMD_COM_DIRECTION 0b11000000 /**< 0:0 Com direction reverse: +0b1000 */ -#define ST756X_CMD_POWER_CONTROL 0b00101000 /**< 0:0 Power control: last 3 bits VB:VR:VF */ +#define ST756X_CMD_ON_OFF 0b10101110 /**< 0:0 Switch Display ON/OFF: last bit */ +#define ST756X_CMD_SET_LINE 0b01000000 /**< 0:0 Set Start Line: last 6 bits */ +#define ST756X_CMD_SET_PAGE 0b10110000 /**< 0:0 Set Page address: last 4 bits */ +#define ST756X_CMD_SET_COLUMN_MSB 0b00010000 /**< 0:0 Set Column MSB: last 4 bits */ +#define ST756X_CMD_SET_COLUMN_LSB 0b00000000 /**< 0:0 Set Column LSB: last 4 bits */ +#define ST756X_CMD_SEG_DIRECTION 0b10100000 /**< 0:0 Reverse scan direction of SEG: last bit */ +#define ST756X_CMD_INVERSE_DISPLAY 0b10100110 /**< 0:0 Invert display: last bit */ +#define ST756X_CMD_ALL_PIXEL_ON 0b10100100 /**< 0:0 Set all pixel on: last bit */ +#define ST756X_CMD_BIAS_SELECT 0b10100010 /**< 0:0 Select 1/9(0) or 1/7(1) bias: last bit */ +#define ST756X_CMD_R_M_W 0b11100000 /**< 0:0 Enter Read Modify Write mode: read+0, write+1 */ +#define ST756X_CMD_END 0b11101110 /**< 0:0 Exit Read Modify Write mode */ +#define ST756X_CMD_RESET 0b11100010 /**< 0:0 Software Reset */ +#define ST756X_CMD_COM_DIRECTION 0b11000000 /**< 0:0 Com direction reverse: +0b1000 */ +#define ST756X_CMD_POWER_CONTROL 0b00101000 /**< 0:0 Power control: last 3 bits VB:VR:VF */ #define ST756X_CMD_REGULATION_RATIO 0b00100000 /**< 0:0 Regulation resistor ration: last 3bits */ -#define ST756X_CMD_SET_EV 0b10000001 /**< 0:0 Set electronic volume: 5 bits in next byte */ +#define ST756X_CMD_SET_EV 0b10000001 /**< 0:0 Set electronic volume: 5 bits in next byte */ #define ST756X_CMD_SET_BOOSTER \ 0b11111000 /**< 0:0 Set Booster level, 4X(0) or 5X(1): last bit in next byte */ #define ST756X_CMD_NOP 0b11100011 /**< 0:0 No operation */ @@ -142,7 +142,7 @@ uint8_t u8x8_d_st756x_common(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* a x *= 8; x += u8x8->x_offset; u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4)); - u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15))); + u8x8_cad_SendCmd(u8x8, 0x000 | (x & 15)); u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t*)arg_ptr)->y_pos)); c = ((u8x8_tile_t*)arg_ptr)->cnt; diff --git a/lib/u8g2/u8x8.h b/lib/u8g2/u8x8.h index 834284f5d..821fba92e 100644 --- a/lib/u8g2/u8x8.h +++ b/lib/u8g2/u8x8.h @@ -137,9 +137,9 @@ extern "C" { */ #ifdef __GNUC__ -#define U8X8_NOINLINE __attribute__((noinline)) +#define U8X8_NOINLINE __attribute__((noinline)) #define U8X8_SECTION(name) __attribute__((section(name))) -#define U8X8_UNUSED __attribute__((unused)) +#define U8X8_UNUSED __attribute__((unused)) #else #define U8X8_SECTION(name) #define U8X8_NOINLINE @@ -148,14 +148,14 @@ extern "C" { #if defined(__GNUC__) && defined(__AVR__) #define U8X8_FONT_SECTION(name) U8X8_SECTION(".progmem." name) -#define u8x8_pgm_read(adr) pgm_read_byte_near(adr) -#define U8X8_PROGMEM PROGMEM +#define u8x8_pgm_read(adr) pgm_read_byte_near(adr) +#define U8X8_PROGMEM PROGMEM #endif #if defined(ESP8266) uint8_t u8x8_pgm_read_esp(const uint8_t* addr); /* u8x8_8x8.c */ #define U8X8_FONT_SECTION(name) __attribute__((section(".text." name))) -#define u8x8_pgm_read(adr) u8x8_pgm_read_esp(adr) +#define u8x8_pgm_read(adr) u8x8_pgm_read_esp(adr) #define U8X8_PROGMEM #endif @@ -269,24 +269,24 @@ struct u8x8_display_info_struct { }; /* list of U8x8 pins */ -#define U8X8_PIN_D0 0 +#define U8X8_PIN_D0 0 #define U8X8_PIN_SPI_CLOCK 0 -#define U8X8_PIN_D1 1 -#define U8X8_PIN_SPI_DATA 1 -#define U8X8_PIN_D2 2 -#define U8X8_PIN_D3 3 -#define U8X8_PIN_D4 4 -#define U8X8_PIN_D5 5 -#define U8X8_PIN_D6 6 -#define U8X8_PIN_D7 7 +#define U8X8_PIN_D1 1 +#define U8X8_PIN_SPI_DATA 1 +#define U8X8_PIN_D2 2 +#define U8X8_PIN_D3 3 +#define U8X8_PIN_D4 4 +#define U8X8_PIN_D5 5 +#define U8X8_PIN_D6 6 +#define U8X8_PIN_D7 7 -#define U8X8_PIN_E 8 -#define U8X8_PIN_CS 9 /* parallel, SPI */ -#define U8X8_PIN_DC 10 /* parallel, SPI */ +#define U8X8_PIN_E 8 +#define U8X8_PIN_CS 9 /* parallel, SPI */ +#define U8X8_PIN_DC 10 /* parallel, SPI */ #define U8X8_PIN_RESET 11 /* parallel, SPI, I2C */ #define U8X8_PIN_I2C_CLOCK 12 /* 1 = Input/high impedance, 0 = drive low */ -#define U8X8_PIN_I2C_DATA 13 /* 1 = Input/high impedance, 0 = drive low */ +#define U8X8_PIN_I2C_DATA 13 /* 1 = Input/high impedance, 0 = drive low */ #define U8X8_PIN_CS1 14 /* KS0108 extra chip select */ #define U8X8_PIN_CS2 15 /* KS0108 extra chip select */ @@ -294,16 +294,16 @@ struct u8x8_display_info_struct { #define U8X8_PIN_OUTPUT_CNT 16 #define U8X8_PIN_MENU_SELECT 16 -#define U8X8_PIN_MENU_NEXT 17 -#define U8X8_PIN_MENU_PREV 18 -#define U8X8_PIN_MENU_HOME 19 -#define U8X8_PIN_MENU_UP 20 -#define U8X8_PIN_MENU_DOWN 21 +#define U8X8_PIN_MENU_NEXT 17 +#define U8X8_PIN_MENU_PREV 18 +#define U8X8_PIN_MENU_HOME 19 +#define U8X8_PIN_MENU_UP 20 +#define U8X8_PIN_MENU_DOWN 21 #define U8X8_PIN_INPUT_CNT 6 #ifdef U8X8_USE_PINS -#define U8X8_PIN_CNT (U8X8_PIN_OUTPUT_CNT + U8X8_PIN_INPUT_CNT) +#define U8X8_PIN_CNT (U8X8_PIN_OUTPUT_CNT + U8X8_PIN_INPUT_CNT) #define U8X8_PIN_NONE 255 #endif @@ -341,32 +341,32 @@ struct u8x8_struct { }; #ifdef U8X8_WITH_USER_PTR -#define u8x8_GetUserPtr(u8x8) ((u8x8)->user_ptr) +#define u8x8_GetUserPtr(u8x8) ((u8x8)->user_ptr) #define u8x8_SetUserPtr(u8x8, p) ((u8x8)->user_ptr = (p)) #endif -#define u8x8_GetCols(u8x8) ((u8x8)->display_info->tile_width) -#define u8x8_GetRows(u8x8) ((u8x8)->display_info->tile_height) -#define u8x8_GetI2CAddress(u8x8) ((u8x8)->i2c_address) +#define u8x8_GetCols(u8x8) ((u8x8)->display_info->tile_width) +#define u8x8_GetRows(u8x8) ((u8x8)->display_info->tile_height) +#define u8x8_GetI2CAddress(u8x8) ((u8x8)->i2c_address) #define u8x8_SetI2CAddress(u8x8, address) ((u8x8)->i2c_address = (address)) #define u8x8_SetGPIOResult(u8x8, val) ((u8x8)->gpio_result = (val)) #define u8x8_GetSPIClockPhase(u8x8) \ ((u8x8)->display_info->spi_mode & 0x01) /* 0 means rising edge */ -#define u8x8_GetSPIClockPolarity(u8x8) (((u8x8)->display_info->spi_mode & 0x02) >> 1) +#define u8x8_GetSPIClockPolarity(u8x8) (((u8x8)->display_info->spi_mode & 0x02) >> 1) #define u8x8_GetSPIClockDefaultLevel(u8x8) (((u8x8)->display_info->spi_mode & 0x02) >> 1) -#define u8x8_GetFontCharWidth(u8x8) u8x8_pgm_read((u8x8)->font + 2) +#define u8x8_GetFontCharWidth(u8x8) u8x8_pgm_read((u8x8)->font + 2) #define u8x8_GetFontCharHeight(u8x8) u8x8_pgm_read((u8x8)->font + 3) #ifdef U8X8_USE_PINS -#define u8x8_SetPin(u8x8, pin, val) (u8x8)->pins[pin] = (val) +#define u8x8_SetPin(u8x8, pin, val) (u8x8)->pins[pin] = (val) #define u8x8_SetMenuSelectPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_SELECT, (val)) -#define u8x8_SetMenuNextPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_NEXT, (val)) -#define u8x8_SetMenuPrevPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_PREV, (val)) -#define u8x8_SetMenuHomePin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_HOME, (val)) -#define u8x8_SetMenuUpPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_UP, (val)) -#define u8x8_SetMenuDownPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_DOWN, (val)) +#define u8x8_SetMenuNextPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_NEXT, (val)) +#define u8x8_SetMenuPrevPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_PREV, (val)) +#define u8x8_SetMenuHomePin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_HOME, (val)) +#define u8x8_SetMenuUpPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_UP, (val)) +#define u8x8_SetMenuDownPin(u8x8, val) u8x8_SetPin((u8x8), U8X8_PIN_MENU_DOWN, (val)) #endif /*==========================================*/ @@ -558,15 +558,15 @@ void u8x8_ClearLine(u8x8_t* u8x8, uint8_t line); */ #define U8X8_MSG_CAD_INIT 20 -#define U8X8_MSG_CAD_SEND_CMD 21 +#define U8X8_MSG_CAD_SEND_CMD 21 /* arg_int: cmd byte */ -#define U8X8_MSG_CAD_SEND_ARG 22 +#define U8X8_MSG_CAD_SEND_ARG 22 /* arg_int: arg byte */ -#define U8X8_MSG_CAD_SEND_DATA 23 +#define U8X8_MSG_CAD_SEND_DATA 23 /* arg_int: expected cs level after processing this msg */ #define U8X8_MSG_CAD_START_TRANSFER 24 /* arg_int: expected cs level after processing this msg */ -#define U8X8_MSG_CAD_END_TRANSFER 25 +#define U8X8_MSG_CAD_END_TRANSFER 25 /* arg_int = 0: disable chip, arg_int = 1: enable chip */ //#define U8X8_MSG_CAD_SET_I2C_ADR 26 //#define U8X8_MSG_CAD_SET_DEVICE 27 @@ -592,8 +592,8 @@ void u8x8_SendF(u8x8_t* u8x8, const char* fmt, ...); #define U8X8_D1(d0) (0x11), (d0) */ -#define U8X8_C(c0) (U8X8_MSG_CAD_SEND_CMD), (c0) -#define U8X8_A(a0) (U8X8_MSG_CAD_SEND_ARG), (a0) +#define U8X8_C(c0) (U8X8_MSG_CAD_SEND_CMD), (c0) +#define U8X8_A(a0) (U8X8_MSG_CAD_SEND_ARG), (a0) #define U8X8_CA(c0, a0) (U8X8_MSG_CAD_SEND_CMD), (c0), (U8X8_MSG_CAD_SEND_ARG), (a0) #define U8X8_CAA(c0, a0, a1) \ (U8X8_MSG_CAD_SEND_CMD), (c0), (U8X8_MSG_CAD_SEND_ARG), (a0), (U8X8_MSG_CAD_SEND_ARG), (a1) @@ -612,9 +612,9 @@ void u8x8_SendF(u8x8_t* u8x8, const char* fmt, ...); U8X8_A4((a0), (a1), (a2), (a3)), U8X8_A4((a4), (a5), (a6), (a7)) #define U8X8_START_TRANSFER() (U8X8_MSG_CAD_START_TRANSFER) -#define U8X8_END_TRANSFER() (U8X8_MSG_CAD_END_TRANSFER) -#define U8X8_DLY(m) (0xfe), (m) /* delay in milli seconds */ -#define U8X8_END() (0xff) +#define U8X8_END_TRANSFER() (U8X8_MSG_CAD_END_TRANSFER) +#define U8X8_DLY(m) (0xfe), (m) /* delay in milli seconds */ +#define U8X8_END() (0xff) void u8x8_cad_SendSequence(u8x8_t* u8x8, uint8_t const* data); uint8_t u8x8_cad_empty(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr); @@ -632,13 +632,13 @@ uint8_t u8x8_cad_uc16xx_i2c(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* ar /*==========================================*/ /* Byte Interface */ -#define U8X8_MSG_BYTE_INIT U8X8_MSG_CAD_INIT +#define U8X8_MSG_BYTE_INIT U8X8_MSG_CAD_INIT #define U8X8_MSG_BYTE_SET_DC 32 #define U8X8_MSG_BYTE_SEND U8X8_MSG_CAD_SEND_DATA #define U8X8_MSG_BYTE_START_TRANSFER U8X8_MSG_CAD_START_TRANSFER -#define U8X8_MSG_BYTE_END_TRANSFER U8X8_MSG_CAD_END_TRANSFER +#define U8X8_MSG_BYTE_END_TRANSFER U8X8_MSG_CAD_END_TRANSFER //#define U8X8_MSG_BYTE_SET_I2C_ADR U8X8_MSG_CAD_SET_I2C_ADR //#define U8X8_MSG_BYTE_SET_DEVICE U8X8_MSG_CAD_SET_DEVICE @@ -684,7 +684,7 @@ uint8_t u8x8_byte_sed1520(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ #define U8X8_MSG_DELAY_NANO 44 /* delay of one i2c unit, should be 5us for 100K, and 1.25us for 400K */ -#define U8X8_MSG_DELAY_I2C 45 +#define U8X8_MSG_DELAY_I2C 45 #define U8X8_MSG_GPIO(x) (64 + (x)) #ifdef U8X8_USE_PINS @@ -692,33 +692,33 @@ uint8_t u8x8_byte_sed1520(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ #define u8x8_GetPinValue(u8x8, msg) ((u8x8)->pins[(msg) & 0x3f]) #endif -#define U8X8_MSG_GPIO_D0 U8X8_MSG_GPIO(U8X8_PIN_D0) +#define U8X8_MSG_GPIO_D0 U8X8_MSG_GPIO(U8X8_PIN_D0) #define U8X8_MSG_GPIO_SPI_CLOCK U8X8_MSG_GPIO(U8X8_PIN_SPI_CLOCK) -#define U8X8_MSG_GPIO_D1 U8X8_MSG_GPIO(U8X8_PIN_D1) -#define U8X8_MSG_GPIO_SPI_DATA U8X8_MSG_GPIO(U8X8_PIN_SPI_DATA) -#define U8X8_MSG_GPIO_D2 U8X8_MSG_GPIO(U8X8_PIN_D2) -#define U8X8_MSG_GPIO_D3 U8X8_MSG_GPIO(U8X8_PIN_D3) -#define U8X8_MSG_GPIO_D4 U8X8_MSG_GPIO(U8X8_PIN_D4) -#define U8X8_MSG_GPIO_D5 U8X8_MSG_GPIO(U8X8_PIN_D5) -#define U8X8_MSG_GPIO_D6 U8X8_MSG_GPIO(U8X8_PIN_D6) -#define U8X8_MSG_GPIO_D7 U8X8_MSG_GPIO(U8X8_PIN_D7) -#define U8X8_MSG_GPIO_E U8X8_MSG_GPIO(U8X8_PIN_E) // used as E1 for the SED1520 -#define U8X8_MSG_GPIO_CS U8X8_MSG_GPIO(U8X8_PIN_CS) // used as E2 for the SED1520 -#define U8X8_MSG_GPIO_DC U8X8_MSG_GPIO(U8X8_PIN_DC) -#define U8X8_MSG_GPIO_RESET U8X8_MSG_GPIO(U8X8_PIN_RESET) +#define U8X8_MSG_GPIO_D1 U8X8_MSG_GPIO(U8X8_PIN_D1) +#define U8X8_MSG_GPIO_SPI_DATA U8X8_MSG_GPIO(U8X8_PIN_SPI_DATA) +#define U8X8_MSG_GPIO_D2 U8X8_MSG_GPIO(U8X8_PIN_D2) +#define U8X8_MSG_GPIO_D3 U8X8_MSG_GPIO(U8X8_PIN_D3) +#define U8X8_MSG_GPIO_D4 U8X8_MSG_GPIO(U8X8_PIN_D4) +#define U8X8_MSG_GPIO_D5 U8X8_MSG_GPIO(U8X8_PIN_D5) +#define U8X8_MSG_GPIO_D6 U8X8_MSG_GPIO(U8X8_PIN_D6) +#define U8X8_MSG_GPIO_D7 U8X8_MSG_GPIO(U8X8_PIN_D7) +#define U8X8_MSG_GPIO_E U8X8_MSG_GPIO(U8X8_PIN_E) // used as E1 for the SED1520 +#define U8X8_MSG_GPIO_CS U8X8_MSG_GPIO(U8X8_PIN_CS) // used as E2 for the SED1520 +#define U8X8_MSG_GPIO_DC U8X8_MSG_GPIO(U8X8_PIN_DC) +#define U8X8_MSG_GPIO_RESET U8X8_MSG_GPIO(U8X8_PIN_RESET) #define U8X8_MSG_GPIO_I2C_CLOCK U8X8_MSG_GPIO(U8X8_PIN_I2C_CLOCK) -#define U8X8_MSG_GPIO_I2C_DATA U8X8_MSG_GPIO(U8X8_PIN_I2C_DATA) +#define U8X8_MSG_GPIO_I2C_DATA U8X8_MSG_GPIO(U8X8_PIN_I2C_DATA) #define U8X8_MSG_GPIO_CS1 U8X8_MSG_GPIO(U8X8_PIN_CS1) /* KS0108 extra chip select */ #define U8X8_MSG_GPIO_CS2 U8X8_MSG_GPIO(U8X8_PIN_CS2) /* KS0108 extra chip select */ /* these message expect the return value in u8x8->gpio_result */ #define U8X8_MSG_GPIO_MENU_SELECT U8X8_MSG_GPIO(U8X8_PIN_MENU_SELECT) -#define U8X8_MSG_GPIO_MENU_NEXT U8X8_MSG_GPIO(U8X8_PIN_MENU_NEXT) -#define U8X8_MSG_GPIO_MENU_PREV U8X8_MSG_GPIO(U8X8_PIN_MENU_PREV) -#define U8X8_MSG_GPIO_MENU_HOME U8X8_MSG_GPIO(U8X8_PIN_MENU_HOME) -#define U8X8_MSG_GPIO_MENU_UP U8X8_MSG_GPIO(U8X8_PIN_MENU_UP) -#define U8X8_MSG_GPIO_MENU_DOWN U8X8_MSG_GPIO(U8X8_PIN_MENU_DOWN) +#define U8X8_MSG_GPIO_MENU_NEXT U8X8_MSG_GPIO(U8X8_PIN_MENU_NEXT) +#define U8X8_MSG_GPIO_MENU_PREV U8X8_MSG_GPIO(U8X8_PIN_MENU_PREV) +#define U8X8_MSG_GPIO_MENU_HOME U8X8_MSG_GPIO(U8X8_PIN_MENU_HOME) +#define U8X8_MSG_GPIO_MENU_UP U8X8_MSG_GPIO(U8X8_PIN_MENU_UP) +#define U8X8_MSG_GPIO_MENU_DOWN U8X8_MSG_GPIO(U8X8_PIN_MENU_DOWN) #define u8x8_gpio_Init(u8x8) \ ((u8x8)->gpio_and_delay_cb((u8x8), U8X8_MSG_GPIO_AND_DELAY_INIT, 0, NULL)) @@ -729,13 +729,13 @@ uint8_t u8x8_byte_sed1520(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ #define u8x8_gpio_SetReset(u8x8, v) ((u8x8)->gpio_and_delay_cb((u8x8), U8X8_MSG_GPIO_RESET, (v), NULL )) */ -#define u8x8_gpio_SetDC(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_DC, (v)) -#define u8x8_gpio_SetCS(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_CS, (v)) -#define u8x8_gpio_SetReset(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_RESET, (v)) +#define u8x8_gpio_SetDC(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_DC, (v)) +#define u8x8_gpio_SetCS(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_CS, (v)) +#define u8x8_gpio_SetReset(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_RESET, (v)) #define u8x8_gpio_SetSPIClock(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_SPI_CLOCK, (v)) -#define u8x8_gpio_SetSPIData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_SPI_DATA, (v)) +#define u8x8_gpio_SetSPIData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_SPI_DATA, (v)) #define u8x8_gpio_SetI2CClock(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_I2C_CLOCK, (v)) -#define u8x8_gpio_SetI2CData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_I2C_DATA, (v)) +#define u8x8_gpio_SetI2CData(u8x8, v) u8x8_gpio_call(u8x8, U8X8_MSG_GPIO_I2C_DATA, (v)) void u8x8_gpio_call(u8x8_t* u8x8, uint8_t msg, uint8_t arg) U8X8_NOINLINE; diff --git a/lib/update_util/dfu_file.c b/lib/update_util/dfu_file.c index 85b661e8e..c336a19d0 100644 --- a/lib/update_util/dfu_file.c +++ b/lib/update_util/dfu_file.c @@ -4,8 +4,8 @@ #include #define VALID_WHOLE_FILE_CRC 0xFFFFFFFF -#define DFU_SUFFIX_VERSION 0x011A -#define DFU_SIGNATURE "DfuSe" +#define DFU_SUFFIX_VERSION 0x011A +#define DFU_SIGNATURE "DfuSe" bool dfu_file_validate_crc(File* dfuf, const DfuPageTaskProgressCb progress_cb, void* context) { uint32_t file_crc = crc32_calc_file(dfuf, progress_cb, context); diff --git a/lib/update_util/resources/manifest.h b/lib/update_util/resources/manifest.h index decba02cd..90b41fa54 100644 --- a/lib/update_util/resources/manifest.h +++ b/lib/update_util/resources/manifest.h @@ -75,4 +75,4 @@ ResourceManifestEntry* #ifdef __cplusplus } // extern "C" -#endif \ No newline at end of file +#endif diff --git a/lib/update_util/update_manifest.c b/lib/update_util/update_manifest.c index eef27cb42..920db3f03 100644 --- a/lib/update_util/update_manifest.c +++ b/lib/update_util/update_manifest.c @@ -4,20 +4,20 @@ #include #include -#define MANIFEST_KEY_INFO "Info" -#define MANIFEST_KEY_TARGET "Target" -#define MANIFEST_KEY_LOADER_FILE "Loader" -#define MANIFEST_KEY_LOADER_CRC "Loader CRC" -#define MANIFEST_KEY_DFU_FILE "Firmware" -#define MANIFEST_KEY_RADIO_FILE "Radio" +#define MANIFEST_KEY_INFO "Info" +#define MANIFEST_KEY_TARGET "Target" +#define MANIFEST_KEY_LOADER_FILE "Loader" +#define MANIFEST_KEY_LOADER_CRC "Loader CRC" +#define MANIFEST_KEY_DFU_FILE "Firmware" +#define MANIFEST_KEY_RADIO_FILE "Radio" #define MANIFEST_KEY_RADIO_ADDRESS "Radio address" #define MANIFEST_KEY_RADIO_VERSION "Radio version" -#define MANIFEST_KEY_RADIO_CRC "Radio CRC" -#define MANIFEST_KEY_ASSETS_FILE "Resources" -#define MANIFEST_KEY_OB_REFERENCE "OB reference" -#define MANIFEST_KEY_OB_MASK "OB mask" +#define MANIFEST_KEY_RADIO_CRC "Radio CRC" +#define MANIFEST_KEY_ASSETS_FILE "Resources" +#define MANIFEST_KEY_OB_REFERENCE "OB reference" +#define MANIFEST_KEY_OB_MASK "OB mask" #define MANIFEST_KEY_OB_WRITE_MASK "OB write mask" -#define MANIFEST_KEY_SPLASH_FILE "Splashscreen" +#define MANIFEST_KEY_SPLASH_FILE "Splashscreen" UpdateManifest* update_manifest_alloc(void) { UpdateManifest* update_manifest = malloc(sizeof(UpdateManifest)); diff --git a/lib/update_util/update_manifest.h b/lib/update_util/update_manifest.h index 0c6284516..4d064b3f7 100644 --- a/lib/update_util/update_manifest.h +++ b/lib/update_util/update_manifest.h @@ -10,7 +10,7 @@ extern "C" { #include /* Paths don't include /ext -- because at startup SD card is mounted as FS root */ -#define UPDATE_MANIFEST_DEFAULT_NAME "update.fuf" +#define UPDATE_MANIFEST_DEFAULT_NAME "update.fuf" #define UPDATE_MANIFEST_POINTER_FILE_NAME ".fupdate" typedef union { diff --git a/lib/update_util/update_operation.c b/lib/update_util/update_operation.c index cb603abe0..3ab8c02b0 100644 --- a/lib/update_util/update_operation.c +++ b/lib/update_util/update_operation.c @@ -71,7 +71,7 @@ static bool update_operation_get_current_package_path_rtc(Storage* storage, Furi return found; } -#define UPDATE_FILE_POINTER_FN EXT_PATH(UPDATE_MANIFEST_POINTER_FILE_NAME) +#define UPDATE_FILE_POINTER_FN EXT_PATH(UPDATE_MANIFEST_POINTER_FILE_NAME) #define UPDATE_MANIFEST_MAX_PATH_LEN 256u bool update_operation_get_current_package_manifest_path(Storage* storage, FuriString* out_path) { diff --git a/lib/update_util/update_operation.h b/lib/update_util/update_operation.h index 063f577e2..1f246337e 100644 --- a/lib/update_util/update_operation.h +++ b/lib/update_util/update_operation.h @@ -8,8 +8,8 @@ extern "C" { #endif #define UPDATE_OPERATION_ROOT_DIR_PACKAGE_MAGIC 0 -#define UPDATE_OPERATION_MAX_MANIFEST_PATH_LEN 255u -#define UPDATE_OPERATION_MIN_MANIFEST_VERSION 2 +#define UPDATE_OPERATION_MAX_MANIFEST_PATH_LEN 255u +#define UPDATE_OPERATION_MIN_MANIFEST_VERSION 2 /* * Checks if supplied full manifest path is valid diff --git a/targets/f18/furi_hal/furi_hal_version_device.c b/targets/f18/furi_hal/furi_hal_version_device.c index 8b8526031..f9be05e24 100644 --- a/targets/f18/furi_hal/furi_hal_version_device.c +++ b/targets/f18/furi_hal/furi_hal_version_device.c @@ -30,4 +30,4 @@ const char* furi_hal_version_get_srrc_id(void) { const char* furi_hal_version_get_ncc_id(void) { return "Pending"; -} \ No newline at end of file +} diff --git a/targets/f7/ble_glue/app_conf.h b/targets/f7/ble_glue/app_conf.h index d0e089eb1..43be8129d 100644 --- a/targets/f7/ble_glue/app_conf.h +++ b/targets/f7/ble_glue/app_conf.h @@ -26,12 +26,12 @@ * Define PHY */ #define ALL_PHYS_PREFERENCE 0x00 -#define RX_2M_PREFERRED 0x02 -#define TX_2M_PREFERRED 0x02 -#define TX_1M 0x01 -#define TX_2M 0x02 -#define RX_1M 0x01 -#define RX_2M 0x02 +#define RX_2M_PREFERRED 0x02 +#define TX_2M_PREFERRED 0x02 +#define TX_1M 0x01 +#define TX_2M 0x02 +#define RX_1M 0x01 +#define RX_2M 0x02 /****************************************************************************** * BLE Stack diff --git a/targets/f7/ble_glue/app_debug.c b/targets/f7/ble_glue/app_debug.c index eab17e5b7..37263849a 100644 --- a/targets/f7/ble_glue/app_debug.c +++ b/targets/f7/ble_glue/app_debug.c @@ -19,15 +19,15 @@ typedef PACKED_STRUCT { } APPD_GpioConfig_t; -#define GPIO_NBR_OF_RF_SIGNALS 9 -#define GPIO_CFG_NBR_OF_FEATURES 34 -#define NBR_OF_TRACES_CONFIG_PARAMETERS 4 +#define GPIO_NBR_OF_RF_SIGNALS 9 +#define GPIO_CFG_NBR_OF_FEATURES 34 +#define NBR_OF_TRACES_CONFIG_PARAMETERS 4 #define NBR_OF_GENERAL_CONFIG_PARAMETERS 4 /** * THIS SHALL BE SET TO A VALUE DIFFERENT FROM 0 ONLY ON REQUEST FROM ST SUPPORT */ -#define BLE_DTB_CFG 0 +#define BLE_DTB_CFG 0 // #define BLE_DTB_CFG 7 #define SYS_DBG_CFG1 (SHCI_C2_DEBUG_OPTIONS_IPCORE_LP | SHCI_C2_DEBUG_OPTIONS_CPU2_STOP_EN) diff --git a/targets/f7/ble_glue/ble_event_thread.c b/targets/f7/ble_glue/ble_event_thread.c index deafbb9a4..c6bc56846 100644 --- a/targets/f7/ble_glue/ble_event_thread.c +++ b/targets/f7/ble_glue/ble_event_thread.c @@ -9,8 +9,8 @@ #define TAG "BleEvt" -#define BLE_EVENT_THREAD_FLAG_SHCI_EVENT (1UL << 0) -#define BLE_EVENT_THREAD_FLAG_HCI_EVENT (1UL << 1) +#define BLE_EVENT_THREAD_FLAG_SHCI_EVENT (1UL << 0) +#define BLE_EVENT_THREAD_FLAG_HCI_EVENT (1UL << 1) #define BLE_EVENT_THREAD_FLAG_KILL_THREAD (1UL << 2) #define BLE_EVENT_THREAD_FLAG_ALL \ diff --git a/targets/f7/ble_glue/ble_glue.c b/targets/f7/ble_glue/ble_glue.c index c50360361..73bb41bad 100644 --- a/targets/f7/ble_glue/ble_glue.c +++ b/targets/f7/ble_glue/ble_glue.c @@ -370,7 +370,7 @@ static void ble_glue_clear_shared_memory(void) { } bool ble_glue_reinit_c2(void) { - return (SHCI_C2_Reinit() == SHCI_Success); + return SHCI_C2_Reinit() == SHCI_Success; } BleGlueCommandResult ble_glue_fus_stack_delete(void) { diff --git a/targets/f7/ble_glue/compiler.h b/targets/f7/ble_glue/compiler.h index 1d32c2a2e..7446b7941 100644 --- a/targets/f7/ble_glue/compiler.h +++ b/targets/f7/ble_glue/compiler.h @@ -65,7 +65,7 @@ * Usage: PACKED(struct) myStruct_s * PACKED(union) myStruct_s */ -#define PACKED(decl) decl __attribute__((packed)) +#define PACKED(decl) decl __attribute__((packed)) /** * @brief SECTION @@ -79,7 +79,7 @@ * Use the ALIGN_DEF macro to specify the alignment of a variable. * Usage: ALIGN_DEF(4) */ -#define ALIGN_DEF(N) __attribute__((aligned(N))) +#define ALIGN_DEF(N) __attribute__((aligned(N))) /** * @brief NO_INIT @@ -87,7 +87,7 @@ * Usage: NO_INIT(int my_no_init_var) * Usage: NO_INIT(uint16_t my_no_init_array[10]) */ -#define NO_INIT(var) var __attribute__((section(".noinit"))) +#define NO_INIT(var) var __attribute__((section(".noinit"))) /** * @brief This is the section dedicated to Keil toolchain @@ -105,7 +105,7 @@ * Usage: PACKED(struct) myStruct_s * PACKED(union) myStruct_s */ -#define PACKED(decl) decl __attribute__((packed)) +#define PACKED(decl) decl __attribute__((packed)) /** * @brief SECTION @@ -119,7 +119,7 @@ * Use the ALIGN_DEF macro to specify the alignment of a variable. * Usage: ALIGN_DEF(4) */ -#define ALIGN_DEF(N) __attribute__((aligned(N))) +#define ALIGN_DEF(N) __attribute__((aligned(N))) /** * @brief NO_INIT @@ -127,7 +127,7 @@ * Usage: NO_INIT(int my_no_init_var) * Usage: NO_INIT(uint16_t my_no_init_array[10]) */ -#define NO_INIT(var) var __attribute__((section("NoInit"))) +#define NO_INIT(var) var __attribute__((section("NoInit"))) #else diff --git a/targets/f7/ble_glue/extra_beacon.c b/targets/f7/ble_glue/extra_beacon.c index 60338cb76..0fd452a5a 100644 --- a/targets/f7/ble_glue/extra_beacon.c +++ b/targets/f7/ble_glue/extra_beacon.c @@ -159,4 +159,4 @@ const GapExtraBeaconConfig* gap_extra_beacon_get_config(void) { } return &extra_beacon.last_config; -} \ No newline at end of file +} diff --git a/targets/f7/ble_glue/furi_ble/gatt.h b/targets/f7/ble_glue/furi_ble/gatt.h index 5a33e9e54..d4d85181a 100644 --- a/targets/f7/ble_glue/furi_ble/gatt.h +++ b/targets/f7/ble_glue/furi_ble/gatt.h @@ -55,8 +55,8 @@ typedef struct { Char_UUID_t uuid; // Some packed bitfields to save space BleGattCharacteristicDataType data_prop_type : 2; - uint8_t is_variable : 2; - uint8_t uuid_type : 2; + uint8_t is_variable : 2; + uint8_t uuid_type : 2; uint8_t char_properties; uint8_t security_permissions; uint8_t gatt_evt_mask; diff --git a/targets/f7/ble_glue/gap.c b/targets/f7/ble_glue/gap.c index 2235a8da3..9cd33456b 100644 --- a/targets/f7/ble_glue/gap.c +++ b/targets/f7/ble_glue/gap.c @@ -11,7 +11,7 @@ #define TAG "BleGap" -#define FAST_ADV_TIMEOUT 30000 +#define FAST_ADV_TIMEOUT 30000 #define INITIAL_ADV_TIMEOUT 60000 #define GAP_INTERVAL_TO_MS(x) (uint16_t)((x) * 1.25) diff --git a/targets/f7/ble_glue/hsem_map.h b/targets/f7/ble_glue/hsem_map.h index 9a5f51d20..2166d0696 100644 --- a/targets/f7/ble_glue/hsem_map.h +++ b/targets/f7/ble_glue/hsem_map.h @@ -8,7 +8,7 @@ * Index of the semaphore used the prevent conflicts after standby sleep. * Each CPUs takes this semaphore at standby wakeup until conflicting elements are restored. */ -#define CFG_HW_PWR_STANDBY_SEMID 10 +#define CFG_HW_PWR_STANDBY_SEMID 10 /** * The CPU2 may be configured to store the Thread persistent data either in internal NVM storage on CPU2 or in * SRAM2 buffer provided by the user application. This can be configured with the system command SHCI_C2_Config() diff --git a/targets/f7/ble_glue/services/battery_service.c b/targets/f7/ble_glue/services/battery_service.c index 4250b356c..66aafc495 100644 --- a/targets/f7/ble_glue/services/battery_service.c +++ b/targets/f7/ble_glue/services/battery_service.c @@ -30,10 +30,10 @@ enum { }; typedef struct { - uint8_t present : 2; + uint8_t present : 2; uint8_t discharging : 2; - uint8_t charging : 2; - uint8_t level : 2; + uint8_t charging : 2; + uint8_t level : 2; } BattrySvcPowerState; _Static_assert(sizeof(BattrySvcPowerState) == 1, "Incorrect structure size"); diff --git a/targets/f7/ble_glue/services/serial_service.h b/targets/f7/ble_glue/services/serial_service.h index 91ad886e0..4d2b069d1 100644 --- a/targets/f7/ble_glue/services/serial_service.h +++ b/targets/f7/ble_glue/services/serial_service.h @@ -11,7 +11,7 @@ extern "C" { * Serial service. Implements RPC over BLE, with flow control. */ -#define BLE_SVC_SERIAL_DATA_LEN_MAX (486) +#define BLE_SVC_SERIAL_DATA_LEN_MAX (486) #define BLE_SVC_SERIAL_CHAR_VALUE_LEN_MAX (243) typedef enum { diff --git a/targets/f7/ble_glue/tl_dbg_conf.h b/targets/f7/ble_glue/tl_dbg_conf.h index 240cd5f2f..53d312b2e 100644 --- a/targets/f7/ble_glue/tl_dbg_conf.h +++ b/targets/f7/ble_glue/tl_dbg_conf.h @@ -21,7 +21,7 @@ extern "C" { #define TL_HCI_CMD_DBG_EN 1 /* Reports BLE command sent to CPU2 and the command response */ #define TL_HCI_CMD_DBG_RAW_EN \ 0 /* Reports raw data BLE command sent to CPU2 and the command response */ -#define TL_HCI_EVT_DBG_EN 1 /* Reports BLE Asynchronous Events received from CPU2 */ +#define TL_HCI_EVT_DBG_EN 1 /* Reports BLE Asynchronous Events received from CPU2 */ #define TL_HCI_EVT_DBG_RAW_EN 0 /* Reports raw data BLE Asynchronous Events received from CPU2 */ #define TL_MM_DBG_EN 1 /* Reports the informations of the buffer released to CPU2 */ diff --git a/targets/f7/fatfs/fatfs.h b/targets/f7/fatfs/fatfs.h index 8376bf6cc..2bde80bde 100644 --- a/targets/f7/fatfs/fatfs.h +++ b/targets/f7/fatfs/fatfs.h @@ -16,4 +16,4 @@ void fatfs_init(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/targets/f7/fatfs/ffconf.h b/targets/f7/fatfs/ffconf.h index 8408a1ec1..08dd5b994 100644 --- a/targets/f7/fatfs/ffconf.h +++ b/targets/f7/fatfs/ffconf.h @@ -164,7 +164,7 @@ /* USER CODE BEGIN Volumes */ #define _STR_VOLUME_ID 0 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */ -#define _VOLUME_STRS "SD" +#define _VOLUME_STRS "SD" /* _STR_VOLUME_ID switches string support of volume ID. / When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive / number in the path name. _VOLUME_STRS defines the drive ID strings for each @@ -179,8 +179,8 @@ / When multi-partition is enabled (1), each logical drive number can be bound to / arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() / funciton will be available. */ -#define _MIN_SS 512 /* 512, 1024, 2048 or 4096 */ -#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */ +#define _MIN_SS 512 /* 512, 1024, 2048 or 4096 */ +#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */ /* These options configure the range of sector size to be supported. (512, 1024, / 2048 or 4096) Always set both 512 for most systems, all type of memory cards and / harddisk. But a larger value may be required for on-board flash memory and some @@ -241,8 +241,8 @@ / lock control is independent of re-entrancy. */ #define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */ -#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */ -#define _SYNC_t FuriMutex* +#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */ +#define _SYNC_t FuriMutex* /* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs / module itself. Note that regardless of this option, file access to different / volume is always re-entrant and volume control functions, f_mount(), f_mkfs() @@ -264,7 +264,7 @@ #if !defined(ff_malloc) && !defined(ff_free) #include #define ff_malloc malloc -#define ff_free free +#define ff_free free #endif #endif /* _FFCONF */ diff --git a/targets/f7/fatfs/sector_cache.c b/targets/f7/fatfs/sector_cache.c index 319dd2173..a76035a09 100644 --- a/targets/f7/fatfs/sector_cache.c +++ b/targets/f7/fatfs/sector_cache.c @@ -7,7 +7,7 @@ #include #define SECTOR_SIZE 512 -#define N_SECTORS 8 +#define N_SECTORS 8 typedef struct { uint32_t itr; @@ -53,4 +53,4 @@ void sector_cache_invalidate_range(uint32_t start_sector, uint32_t end_sector) { cache->sectors[sector_i] = 0; } } -} \ No newline at end of file +} diff --git a/targets/f7/fatfs/user_diskio.h b/targets/f7/fatfs/user_diskio.h index db636fbb9..009a17d4b 100644 --- a/targets/f7/fatfs/user_diskio.h +++ b/targets/f7/fatfs/user_diskio.h @@ -10,4 +10,4 @@ extern Diskio_drvTypeDef sd_fatfs_driver; #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/targets/f7/furi_hal/furi_hal_bus.c b/targets/f7/furi_hal/furi_hal_bus.c index 85b121dc4..30b3879f6 100644 --- a/targets/f7/furi_hal/furi_hal_bus.c +++ b/targets/f7/furi_hal/furi_hal_bus.c @@ -46,7 +46,7 @@ /* Test macro definitions */ #define FURI_HAL_BUS_IS_ALL_CLEAR(reg, value) (READ_BIT((reg), (value)) == 0UL) -#define FURI_HAL_BUS_IS_ALL_SET(reg, value) (READ_BIT((reg), (value)) == (value)) +#define FURI_HAL_BUS_IS_ALL_SET(reg, value) (READ_BIT((reg), (value)) == (value)) #define FURI_HAL_BUS_IS_CLOCK_ENABLED(bus, value, ...) \ (FURI_HAL_BUS_IS_ALL_SET(RCC->bus##ENR##__VA_ARGS__, (value))) @@ -67,10 +67,10 @@ FURI_HAL_BUS_IS_RESET_ASSERTED(bus, (value), __VA_ARGS__)) /* Control macro definitions */ -#define FURI_HAL_BUS_RESET_ASSERT(bus, value, grp) LL_##bus##_GRP##grp##_ForceReset(value) +#define FURI_HAL_BUS_RESET_ASSERT(bus, value, grp) LL_##bus##_GRP##grp##_ForceReset(value) #define FURI_HAL_BUS_RESET_DEASSERT(bus, value, grp) LL_##bus##_GRP##grp##_ReleaseReset(value) -#define FURI_HAL_BUS_CLOCK_ENABLE(bus, value, grp) LL_##bus##_GRP##grp##_EnableClock(value) +#define FURI_HAL_BUS_CLOCK_ENABLE(bus, value, grp) LL_##bus##_GRP##grp##_EnableClock(value) #define FURI_HAL_BUS_CLOCK_DISABLE(bus, value, grp) LL_##bus##_GRP##grp##_DisableClock(value) #define FURI_HAL_BUS_PERIPH_ENABLE(bus, value, grp) \ diff --git a/targets/f7/furi_hal/furi_hal_clock.c b/targets/f7/furi_hal/furi_hal_clock.c index ca4c7ad4d..fd55bf6f2 100644 --- a/targets/f7/furi_hal/furi_hal_clock.c +++ b/targets/f7/furi_hal/furi_hal_clock.c @@ -15,10 +15,10 @@ #define CPU_CLOCK_EARLY_HZ 4000000 #define CPU_CLOCK_HSI16_HZ 16000000 -#define CPU_CLOCK_HSE_HZ 32000000 -#define CPU_CLOCK_PLL_HZ 64000000 +#define CPU_CLOCK_HSE_HZ 32000000 +#define CPU_CLOCK_PLL_HZ 64000000 -#define TICK_INT_PRIORITY 15U +#define TICK_INT_PRIORITY 15U #define HS_CLOCK_IS_READY() (LL_RCC_HSE_IsReady() && LL_RCC_HSI_IsReady()) #define LS_CLOCK_IS_READY() (LL_RCC_LSE_IsReady() && LL_RCC_LSI1_IsReady()) diff --git a/targets/f7/furi_hal/furi_hal_crypto.c b/targets/f7/furi_hal/furi_hal_crypto.c index 236573bca..1879eb2ca 100644 --- a/targets/f7/furi_hal/furi_hal_crypto.c +++ b/targets/f7/furi_hal/furi_hal_crypto.c @@ -11,32 +11,32 @@ #define TAG "FuriHalCrypto" #define ENCLAVE_FACTORY_KEY_SLOTS 10 -#define ENCLAVE_SIGNATURE_SIZE 16 +#define ENCLAVE_SIGNATURE_SIZE 16 -#define CRYPTO_BLK_LEN (4 * sizeof(uint32_t)) +#define CRYPTO_BLK_LEN (4 * sizeof(uint32_t)) #define CRYPTO_TIMEOUT_US (1000000) -#define CRYPTO_MODE_ENCRYPT 0U -#define CRYPTO_MODE_INIT (AES_CR_MODE_0) -#define CRYPTO_MODE_DECRYPT (AES_CR_MODE_1) +#define CRYPTO_MODE_ENCRYPT 0U +#define CRYPTO_MODE_INIT (AES_CR_MODE_0) +#define CRYPTO_MODE_DECRYPT (AES_CR_MODE_1) #define CRYPTO_MODE_DECRYPT_INIT (AES_CR_MODE_0 | AES_CR_MODE_1) #define CRYPTO_DATATYPE_32B 0U #define CRYPTO_KEYSIZE_256B (AES_CR_KEYSIZE) -#define CRYPTO_AES_CBC (AES_CR_CHMOD_0) +#define CRYPTO_AES_CBC (AES_CR_CHMOD_0) -#define CRYPTO_AES_CTR (AES_CR_CHMOD_1) -#define CRYPTO_CTR_IV_LEN (12U) +#define CRYPTO_AES_CTR (AES_CR_CHMOD_1) +#define CRYPTO_CTR_IV_LEN (12U) #define CRYPTO_CTR_CTR_LEN (4U) -#define CRYPTO_AES_GCM (AES_CR_CHMOD_1 | AES_CR_CHMOD_0) -#define CRYPTO_GCM_IV_LEN (12U) -#define CRYPTO_GCM_CTR_LEN (4U) -#define CRYPTO_GCM_TAG_LEN (16U) -#define CRYPTO_GCM_PH_INIT (0x0U << AES_CR_GCMPH_Pos) -#define CRYPTO_GCM_PH_HEADER (AES_CR_GCMPH_0) +#define CRYPTO_AES_GCM (AES_CR_CHMOD_1 | AES_CR_CHMOD_0) +#define CRYPTO_GCM_IV_LEN (12U) +#define CRYPTO_GCM_CTR_LEN (4U) +#define CRYPTO_GCM_TAG_LEN (16U) +#define CRYPTO_GCM_PH_INIT (0x0U << AES_CR_GCMPH_Pos) +#define CRYPTO_GCM_PH_HEADER (AES_CR_GCMPH_0) #define CRYPTO_GCM_PH_PAYLOAD (AES_CR_GCMPH_1) -#define CRYPTO_GCM_PH_FINAL (AES_CR_GCMPH_1 | AES_CR_GCMPH_0) +#define CRYPTO_GCM_PH_FINAL (AES_CR_GCMPH_1 | AES_CR_GCMPH_0) static FuriMutex* furi_hal_crypto_mutex = NULL; static bool furi_hal_crypto_mode_init_done = false; @@ -192,7 +192,7 @@ bool furi_hal_crypto_enclave_store_key(FuriHalCryptoKey* key, uint8_t* slot) { SHCI_CmdStatus_t shci_state = SHCI_C2_FUS_StoreUsrKey(&pParam, slot); furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk); - return (shci_state == SHCI_Success); + return shci_state == SHCI_Success; } static void crypto_key_init(uint32_t* key, uint32_t* iv) { @@ -291,7 +291,7 @@ bool furi_hal_crypto_enclave_unload_key(uint8_t slot) { furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk); - return (shci_state == SHCI_Success); + return shci_state == SHCI_Success; } bool furi_hal_crypto_load_key(const uint8_t* key, const uint8_t* iv) { @@ -631,7 +631,7 @@ static bool furi_hal_crypto_gcm_compare_tag(const uint8_t* tag1, const uint8_t* diff |= tag1[i] ^ tag2[i]; } - return (diff == 0); + return diff == 0; } bool furi_hal_crypto_gcm( diff --git a/targets/f7/furi_hal/furi_hal_debug.c b/targets/f7/furi_hal/furi_hal_debug.c index 7d1488fa5..f97673ea1 100644 --- a/targets/f7/furi_hal/furi_hal_debug.c +++ b/targets/f7/furi_hal/furi_hal_debug.c @@ -38,4 +38,4 @@ void furi_hal_debug_disable(void) { bool furi_hal_debug_is_gdb_session_active(void) { return furi_hal_debug_gdb_session_active; -} \ No newline at end of file +} diff --git a/targets/f7/furi_hal/furi_hal_flash.c b/targets/f7/furi_hal/furi_hal_flash.c index 30151d837..8bf1ac702 100644 --- a/targets/f7/furi_hal/furi_hal_flash.c +++ b/targets/f7/furi_hal/furi_hal_flash.c @@ -22,21 +22,21 @@ #define FURI_LOG_T(...) #endif -#define FURI_HAL_CRITICAL_MSG "Critical flash operation fail" -#define FURI_HAL_FLASH_READ_BLOCK (8U) -#define FURI_HAL_FLASH_WRITE_BLOCK (8U) -#define FURI_HAL_FLASH_PAGE_SIZE (4096U) +#define FURI_HAL_CRITICAL_MSG "Critical flash operation fail" +#define FURI_HAL_FLASH_READ_BLOCK (8U) +#define FURI_HAL_FLASH_WRITE_BLOCK (8U) +#define FURI_HAL_FLASH_PAGE_SIZE (4096U) #define FURI_HAL_FLASH_CYCLES_COUNT (10000U) -#define FURI_HAL_FLASH_TIMEOUT (1000U) -#define FURI_HAL_FLASH_KEY1 (0x45670123U) -#define FURI_HAL_FLASH_KEY2 (0xCDEF89ABU) -#define FURI_HAL_FLASH_TOTAL_PAGES (256U) +#define FURI_HAL_FLASH_TIMEOUT (1000U) +#define FURI_HAL_FLASH_KEY1 (0x45670123U) +#define FURI_HAL_FLASH_KEY2 (0xCDEF89ABU) +#define FURI_HAL_FLASH_TOTAL_PAGES (256U) #define FURI_HAL_FLASH_SR_ERRORS \ (FLASH_SR_OPERR | FLASH_SR_PROGERR | FLASH_SR_WRPERR | FLASH_SR_PGAERR | FLASH_SR_SIZERR | \ FLASH_SR_PGSERR | FLASH_SR_MISERR | FLASH_SR_FASTERR | FLASH_SR_RDERR | FLASH_SR_OPTVERR) -#define FURI_HAL_FLASH_OPT_KEY1 (0x08192A3BU) -#define FURI_HAL_FLASH_OPT_KEY2 (0x4C5D6E7FU) +#define FURI_HAL_FLASH_OPT_KEY1 (0x08192A3BU) +#define FURI_HAL_FLASH_OPT_KEY2 (0x4C5D6E7FU) #define FURI_HAL_FLASH_OB_TOTAL_WORDS (0x80 / (sizeof(uint32_t) * 2)) /* STM32CubeWB/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_RfWithFlash/Core/Src/flash_driver.c diff --git a/targets/f7/furi_hal/furi_hal_flash.h b/targets/f7/furi_hal/furi_hal_flash.h index 6a5d42222..c20f90749 100644 --- a/targets/f7/furi_hal/furi_hal_flash.h +++ b/targets/f7/furi_hal/furi_hal_flash.h @@ -9,8 +9,8 @@ extern "C" { #endif #define FURI_HAL_FLASH_OB_RAW_SIZE_BYTES 0x80 -#define FURI_HAL_FLASH_OB_SIZE_WORDS (FURI_HAL_FLASH_OB_RAW_SIZE_BYTES / sizeof(uint32_t)) -#define FURI_HAL_FLASH_OB_TOTAL_VALUES (FURI_HAL_FLASH_OB_SIZE_WORDS / 2) +#define FURI_HAL_FLASH_OB_SIZE_WORDS (FURI_HAL_FLASH_OB_RAW_SIZE_BYTES / sizeof(uint32_t)) +#define FURI_HAL_FLASH_OB_TOTAL_VALUES (FURI_HAL_FLASH_OB_SIZE_WORDS / 2) typedef union { uint8_t bytes[FURI_HAL_FLASH_OB_RAW_SIZE_BYTES]; diff --git a/targets/f7/furi_hal/furi_hal_gpio.c b/targets/f7/furi_hal/furi_hal_gpio.c index c68c1ffd4..a020e9d7c 100644 --- a/targets/f7/furi_hal/furi_hal_gpio.c +++ b/targets/f7/furi_hal/furi_hal_gpio.c @@ -39,11 +39,11 @@ static uint32_t furi_hal_gpio_invalid_argument_crash(void) { furi_hal_gpio_invalid_argument_crash()) #define GET_SYSCFG_EXTI_PORT(port) GPIO_PORT_MAP(port, LL_SYSCFG_EXTI_PORT) -#define GET_SYSCFG_EXTI_LINE(pin) GPIO_PIN_MAP(pin, LL_SYSCFG_EXTI_LINE) -#define GET_EXTI_LINE(pin) GPIO_PIN_MAP(pin, LL_EXTI_LINE_) +#define GET_SYSCFG_EXTI_LINE(pin) GPIO_PIN_MAP(pin, LL_SYSCFG_EXTI_LINE) +#define GET_EXTI_LINE(pin) GPIO_PIN_MAP(pin, LL_EXTI_LINE_) #define GET_PWR_PORT(port) GPIO_PORT_MAP(port, LL_PWR_GPIO_) -#define GET_PWR_PIN(pin) GPIO_PIN_MAP(pin, LL_PWR_GPIO_BIT_) +#define GET_PWR_PIN(pin) GPIO_PIN_MAP(pin, LL_PWR_GPIO_BIT_) static volatile GpioInterrupt gpio_interrupt[GPIO_NUMBER]; diff --git a/targets/f7/furi_hal/furi_hal_ibutton.c b/targets/f7/furi_hal/furi_hal_ibutton.c index 07cf8de6e..4f7c5e473 100644 --- a/targets/f7/furi_hal/furi_hal_ibutton.c +++ b/targets/f7/furi_hal/furi_hal_ibutton.c @@ -8,7 +8,8 @@ #include #define TAG "FuriHalIbutton" -#define FURI_HAL_IBUTTON_TIMER TIM1 + +#define FURI_HAL_IBUTTON_TIMER TIM1 #define FURI_HAL_IBUTTON_TIMER_BUS FuriHalBusTIM1 #define FURI_HAL_IBUTTON_TIMER_IRQ FuriHalInterruptIdTim1UpTim16 diff --git a/targets/f7/furi_hal/furi_hal_idle_timer.h b/targets/f7/furi_hal/furi_hal_idle_timer.h index e1ffb1b25..76d2238f9 100644 --- a/targets/f7/furi_hal/furi_hal_idle_timer.h +++ b/targets/f7/furi_hal/furi_hal_idle_timer.h @@ -8,7 +8,7 @@ // Timer used for tickless idle #define FURI_HAL_IDLE_TIMER_MAX 0xFFFF -#define FURI_HAL_IDLE_TIMER LPTIM1 +#define FURI_HAL_IDLE_TIMER LPTIM1 #define FURI_HAL_IDLE_TIMER_IRQ LPTIM1_IRQn static inline void furi_hal_idle_timer_init() { diff --git a/targets/f7/furi_hal/furi_hal_infrared.c b/targets/f7/furi_hal/furi_hal_infrared.c index a0b166fad..029d103cb 100644 --- a/targets/f7/furi_hal/furi_hal_infrared.c +++ b/targets/f7/furi_hal/furi_hal_infrared.c @@ -11,7 +11,7 @@ #include #define INFRARED_TIM_TX_DMA_BUFFER_SIZE 200 -#define INFRARED_POLARITY_SHIFT 1 +#define INFRARED_POLARITY_SHIFT 1 #define INFRARED_TX_CCMR_HIGH \ (TIM_CCMR2_OC3PE | LL_TIM_OCMODE_PWM2) /* Mark time - enable PWM2 mode */ @@ -19,23 +19,23 @@ (TIM_CCMR2_OC3PE | LL_TIM_OCMODE_FORCED_INACTIVE) /* Space time - force low */ /* DMA Channels definition */ -#define INFRARED_DMA DMA2 +#define INFRARED_DMA DMA2 #define INFRARED_DMA_CH1_CHANNEL LL_DMA_CHANNEL_1 #define INFRARED_DMA_CH2_CHANNEL LL_DMA_CHANNEL_2 -#define INFRARED_DMA_CH1_IRQ FuriHalInterruptIdDma2Ch1 -#define INFRARED_DMA_CH2_IRQ FuriHalInterruptIdDma2Ch2 -#define INFRARED_DMA_CH1_DEF INFRARED_DMA, INFRARED_DMA_CH1_CHANNEL -#define INFRARED_DMA_CH2_DEF INFRARED_DMA, INFRARED_DMA_CH2_CHANNEL +#define INFRARED_DMA_CH1_IRQ FuriHalInterruptIdDma2Ch1 +#define INFRARED_DMA_CH2_IRQ FuriHalInterruptIdDma2Ch2 +#define INFRARED_DMA_CH1_DEF INFRARED_DMA, INFRARED_DMA_CH1_CHANNEL +#define INFRARED_DMA_CH2_DEF INFRARED_DMA, INFRARED_DMA_CH2_CHANNEL /* Timers definition */ -#define INFRARED_RX_TIMER TIM2 -#define INFRARED_DMA_TIMER TIM1 -#define INFRARED_RX_TIMER_BUS FuriHalBusTIM2 +#define INFRARED_RX_TIMER TIM2 +#define INFRARED_DMA_TIMER TIM1 +#define INFRARED_RX_TIMER_BUS FuriHalBusTIM2 #define INFRARED_DMA_TIMER_BUS FuriHalBusTIM1 /* Misc */ #define INFRARED_RX_GPIO_ALT GpioAltFn1TIM2 -#define INFRARED_RX_IRQ FuriHalInterruptIdTIM2 +#define INFRARED_RX_IRQ FuriHalInterruptIdTIM2 typedef struct { FuriHalInfraredRxCaptureCallback capture_callback; diff --git a/targets/f7/furi_hal/furi_hal_interrupt.c b/targets/f7/furi_hal/furi_hal_interrupt.c index f366cff16..6e14e09c8 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.c +++ b/targets/f7/furi_hal/furi_hal_interrupt.c @@ -527,4 +527,4 @@ const char* furi_hal_interrupt_get_name(uint8_t exception_number) { uint32_t furi_hal_interrupt_get_time_in_isr_total(void) { return furi_hal_interrupt.counter_time_in_isr_total; -} \ No newline at end of file +} diff --git a/targets/f7/furi_hal/furi_hal_light.c b/targets/f7/furi_hal/furi_hal_light.c index b44342b52..621478d14 100644 --- a/targets/f7/furi_hal/furi_hal_light.c +++ b/targets/f7/furi_hal/furi_hal_light.c @@ -4,9 +4,9 @@ #include #include -#define LED_CURRENT_RED (50u) +#define LED_CURRENT_RED (50u) #define LED_CURRENT_GREEN (50u) -#define LED_CURRENT_BLUE (50u) +#define LED_CURRENT_BLUE (50u) #define LED_CURRENT_WHITE (150u) void furi_hal_light_init(void) { diff --git a/targets/f7/furi_hal/furi_hal_memory.c b/targets/f7/furi_hal/furi_hal_memory.c index 780a9d743..cae87342a 100644 --- a/targets/f7/furi_hal/furi_hal_memory.c +++ b/targets/f7/furi_hal/furi_hal_memory.c @@ -65,11 +65,11 @@ void furi_hal_memory_init(void) { TAG, "SRAM2B: 0x%p, %lu", memory->region[SRAM_B].start, memory->region[SRAM_B].size); if((memory->region[SRAM_A].size > 0) || (memory->region[SRAM_B].size > 0)) { - if((memory->region[SRAM_A].size > 0)) { + if(memory->region[SRAM_A].size > 0) { FURI_LOG_I(TAG, "SRAM2A clear"); memset(memory->region[SRAM_A].start, 0, memory->region[SRAM_A].size); } - if((memory->region[SRAM_B].size > 0)) { + if(memory->region[SRAM_B].size > 0) { FURI_LOG_I(TAG, "SRAM2B clear"); memset(memory->region[SRAM_B].start, 0, memory->region[SRAM_B].size); } diff --git a/targets/f7/furi_hal/furi_hal_mpu.c b/targets/f7/furi_hal/furi_hal_mpu.c index 5fe3ab66b..5af638ab1 100644 --- a/targets/f7/furi_hal/furi_hal_mpu.c +++ b/targets/f7/furi_hal/furi_hal_mpu.c @@ -69,4 +69,4 @@ void furi_hal_mpu_set_stack_protection(uint32_t* stack) { furi_hal_mpu_protect_read_only( FuriHalMpuRegionThreadStack, stack_ptr, FURI_HAL_MPU_STACK_PROTECT_REGION); -} \ No newline at end of file +} diff --git a/targets/f7/furi_hal/furi_hal_nfc.c b/targets/f7/furi_hal/furi_hal_nfc.c index 550f1b16e..ee7a04e45 100644 --- a/targets/f7/furi_hal/furi_hal_nfc.c +++ b/targets/f7/furi_hal/furi_hal_nfc.c @@ -253,7 +253,7 @@ FuriHalNfcError furi_hal_nfc_init(void) { } static bool furi_hal_nfc_is_mine(void) { - return (furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id()); + return furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id(); } FuriHalNfcError furi_hal_nfc_acquire(void) { diff --git a/targets/f7/furi_hal/furi_hal_nfc_iso15693.c b/targets/f7/furi_hal/furi_hal_nfc_iso15693.c index 9ab3532f9..3245b67cc 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_iso15693.c +++ b/targets/f7/furi_hal/furi_hal_nfc_iso15693.c @@ -6,21 +6,21 @@ #include -#define FURI_HAL_NFC_ISO15693_MAX_FRAME_SIZE (1024U) +#define FURI_HAL_NFC_ISO15693_MAX_FRAME_SIZE (1024U) #define FURI_HAL_NFC_ISO15693_POLLER_MAX_BUFFER_SIZE (64) -#define FURI_HAL_NFC_ISO15693_RESP_SOF_SIZE (5) -#define FURI_HAL_NFC_ISO15693_RESP_EOF_SIZE (5) -#define FURI_HAL_NFC_ISO15693_RESP_SOF_MASK (0x1FU) +#define FURI_HAL_NFC_ISO15693_RESP_SOF_SIZE (5) +#define FURI_HAL_NFC_ISO15693_RESP_EOF_SIZE (5) +#define FURI_HAL_NFC_ISO15693_RESP_SOF_MASK (0x1FU) #define FURI_HAL_NFC_ISO15693_RESP_SOF_PATTERN (0x17U) #define FURI_HAL_NFC_ISO15693_RESP_EOF_PATTERN (0x1DU) #define FURI_HAL_NFC_ISO15693_RESP_PATTERN_MASK (0x03U) -#define FURI_HAL_NFC_ISO15693_RESP_PATTERN_0 (0x01U) -#define FURI_HAL_NFC_ISO15693_RESP_PATTERN_1 (0x02U) +#define FURI_HAL_NFC_ISO15693_RESP_PATTERN_0 (0x01U) +#define FURI_HAL_NFC_ISO15693_RESP_PATTERN_1 (0x02U) // Derived experimentally -#define FURI_HAL_NFC_ISO15693_POLLER_FWT_COMP_FC (-1300) +#define FURI_HAL_NFC_ISO15693_POLLER_FWT_COMP_FC (-1300) #define FURI_HAL_NFC_ISO15693_LISTENER_FDT_COMP_FC (2850) #define BITS_IN_BYTE (8U) diff --git a/targets/f7/furi_hal/furi_hal_os.c b/targets/f7/furi_hal/furi_hal_os.c index ba28a141f..35e381a55 100644 --- a/targets/f7/furi_hal/furi_hal_os.c +++ b/targets/f7/furi_hal/furi_hal_os.c @@ -15,17 +15,17 @@ #define TAG "FuriHalOs" #define FURI_HAL_IDLE_TIMER_CLK_HZ 32768 -#define FURI_HAL_OS_TICK_HZ configTICK_RATE_HZ +#define FURI_HAL_OS_TICK_HZ configTICK_RATE_HZ #define FURI_HAL_OS_IDLE_CNT_TO_TICKS(x) (((x) * FURI_HAL_OS_TICK_HZ) / FURI_HAL_IDLE_TIMER_CLK_HZ) #define FURI_HAL_OS_TICKS_TO_IDLE_CNT(x) (((x) * FURI_HAL_IDLE_TIMER_CLK_HZ) / FURI_HAL_OS_TICK_HZ) #define FURI_HAL_IDLE_TIMER_TICK_PER_EPOCH (FURI_HAL_OS_IDLE_CNT_TO_TICKS(FURI_HAL_IDLE_TIMER_MAX)) -#define FURI_HAL_OS_MAX_SLEEP (FURI_HAL_IDLE_TIMER_TICK_PER_EPOCH - 1) +#define FURI_HAL_OS_MAX_SLEEP (FURI_HAL_IDLE_TIMER_TICK_PER_EPOCH - 1) #define FURI_HAL_OS_NVIC_IS_PENDING() (NVIC->ISPR[0] || NVIC->ISPR[1]) -#define FURI_HAL_OS_EXTI_LINE_0_31 0 -#define FURI_HAL_OS_EXTI_LINE_32_63 1 +#define FURI_HAL_OS_EXTI_LINE_0_31 0 +#define FURI_HAL_OS_EXTI_LINE_32_63 1 // Arbitrary (but small) number for better tick consistency #define FURI_HAL_OS_EXTRA_CNT 3 diff --git a/targets/f7/furi_hal/furi_hal_random.c b/targets/f7/furi_hal/furi_hal_random.c index fd557fa98..8b75a05c5 100644 --- a/targets/f7/furi_hal/furi_hal_random.c +++ b/targets/f7/furi_hal/furi_hal_random.c @@ -75,9 +75,9 @@ void srand(unsigned seed) { } int rand(void) { - return (furi_hal_random_get() & RAND_MAX); + return furi_hal_random_get() & RAND_MAX; } long random(void) { - return (furi_hal_random_get() & RAND_MAX); + return furi_hal_random_get() & RAND_MAX; } diff --git a/targets/f7/furi_hal/furi_hal_resources.h b/targets/f7/furi_hal/furi_hal_resources.h index 99768654d..c01b2207f 100644 --- a/targets/f7/furi_hal/furi_hal_resources.h +++ b/targets/f7/furi_hal/furi_hal_resources.h @@ -110,107 +110,107 @@ extern const GpioPin gpio_periph_power; extern const GpioPin gpio_usb_dm; extern const GpioPin gpio_usb_dp; -#define BUTTON_BACK_GPIO_Port GPIOC -#define BUTTON_BACK_Pin LL_GPIO_PIN_13 -#define BUTTON_DOWN_GPIO_Port GPIOC -#define BUTTON_DOWN_Pin LL_GPIO_PIN_6 -#define BUTTON_LEFT_GPIO_Port GPIOB -#define BUTTON_LEFT_Pin LL_GPIO_PIN_11 -#define BUTTON_OK_GPIO_Port GPIOH -#define BUTTON_OK_Pin LL_GPIO_PIN_3 +#define BUTTON_BACK_GPIO_Port GPIOC +#define BUTTON_BACK_Pin LL_GPIO_PIN_13 +#define BUTTON_DOWN_GPIO_Port GPIOC +#define BUTTON_DOWN_Pin LL_GPIO_PIN_6 +#define BUTTON_LEFT_GPIO_Port GPIOB +#define BUTTON_LEFT_Pin LL_GPIO_PIN_11 +#define BUTTON_OK_GPIO_Port GPIOH +#define BUTTON_OK_Pin LL_GPIO_PIN_3 #define BUTTON_RIGHT_GPIO_Port GPIOB -#define BUTTON_RIGHT_Pin LL_GPIO_PIN_12 -#define BUTTON_UP_GPIO_Port GPIOB -#define BUTTON_UP_Pin LL_GPIO_PIN_10 +#define BUTTON_RIGHT_Pin LL_GPIO_PIN_12 +#define BUTTON_UP_GPIO_Port GPIOB +#define BUTTON_UP_Pin LL_GPIO_PIN_10 #define CC1101_CS_GPIO_Port GPIOD -#define CC1101_CS_Pin LL_GPIO_PIN_0 +#define CC1101_CS_Pin LL_GPIO_PIN_0 #define CC1101_G0_GPIO_Port GPIOA -#define CC1101_G0_Pin LL_GPIO_PIN_1 +#define CC1101_G0_Pin LL_GPIO_PIN_1 -#define DISPLAY_CS_GPIO_Port GPIOC -#define DISPLAY_CS_Pin LL_GPIO_PIN_11 -#define DISPLAY_DI_GPIO_Port GPIOB -#define DISPLAY_DI_Pin LL_GPIO_PIN_1 +#define DISPLAY_CS_GPIO_Port GPIOC +#define DISPLAY_CS_Pin LL_GPIO_PIN_11 +#define DISPLAY_DI_GPIO_Port GPIOB +#define DISPLAY_DI_Pin LL_GPIO_PIN_1 #define DISPLAY_RST_GPIO_Port GPIOB -#define DISPLAY_RST_Pin LL_GPIO_PIN_0 +#define DISPLAY_RST_Pin LL_GPIO_PIN_0 #define IR_RX_GPIO_Port GPIOA -#define IR_RX_Pin LL_GPIO_PIN_0 +#define IR_RX_Pin LL_GPIO_PIN_0 #define IR_TX_GPIO_Port GPIOB -#define IR_TX_Pin LL_GPIO_PIN_9 +#define IR_TX_Pin LL_GPIO_PIN_9 #define NFC_CS_GPIO_Port GPIOE -#define NFC_CS_Pin LL_GPIO_PIN_4 +#define NFC_CS_Pin LL_GPIO_PIN_4 #define PA4_GPIO_Port GPIOA -#define PA4_Pin LL_GPIO_PIN_4 +#define PA4_Pin LL_GPIO_PIN_4 #define PA6_GPIO_Port GPIOA -#define PA6_Pin LL_GPIO_PIN_6 +#define PA6_Pin LL_GPIO_PIN_6 #define PA7_GPIO_Port GPIOA -#define PA7_Pin LL_GPIO_PIN_7 +#define PA7_Pin LL_GPIO_PIN_7 #define PB2_GPIO_Port GPIOB -#define PB2_Pin LL_GPIO_PIN_2 +#define PB2_Pin LL_GPIO_PIN_2 #define PB3_GPIO_Port GPIOB -#define PB3_Pin LL_GPIO_PIN_3 +#define PB3_Pin LL_GPIO_PIN_3 #define PC0_GPIO_Port GPIOC -#define PC0_Pin LL_GPIO_PIN_0 +#define PC0_Pin LL_GPIO_PIN_0 #define PC1_GPIO_Port GPIOC -#define PC1_Pin LL_GPIO_PIN_1 +#define PC1_Pin LL_GPIO_PIN_1 #define PC3_GPIO_Port GPIOC -#define PC3_Pin LL_GPIO_PIN_3 +#define PC3_Pin LL_GPIO_PIN_3 -#define QUARTZ_32MHZ_IN_GPIO_Port GPIOC -#define QUARTZ_32MHZ_IN_Pin LL_GPIO_PIN_14 +#define QUARTZ_32MHZ_IN_GPIO_Port GPIOC +#define QUARTZ_32MHZ_IN_Pin LL_GPIO_PIN_14 #define QUARTZ_32MHZ_OUT_GPIO_Port GPIOC -#define QUARTZ_32MHZ_OUT_Pin LL_GPIO_PIN_15 +#define QUARTZ_32MHZ_OUT_Pin LL_GPIO_PIN_15 -#define RFID_OUT_GPIO_Port GPIOB -#define RFID_OUT_Pin LL_GPIO_PIN_13 -#define RFID_PULL_GPIO_Port GPIOA -#define RFID_PULL_Pin LL_GPIO_PIN_2 -#define RFID_RF_IN_GPIO_Port GPIOC -#define RFID_RF_IN_Pin LL_GPIO_PIN_5 +#define RFID_OUT_GPIO_Port GPIOB +#define RFID_OUT_Pin LL_GPIO_PIN_13 +#define RFID_PULL_GPIO_Port GPIOA +#define RFID_PULL_Pin LL_GPIO_PIN_2 +#define RFID_RF_IN_GPIO_Port GPIOC +#define RFID_RF_IN_Pin LL_GPIO_PIN_5 #define RFID_CARRIER_GPIO_Port GPIOA -#define RFID_CARRIER_Pin LL_GPIO_PIN_15 +#define RFID_CARRIER_Pin LL_GPIO_PIN_15 #define RF_SW_0_GPIO_Port GPIOC -#define RF_SW_0_Pin LL_GPIO_PIN_4 +#define RF_SW_0_Pin LL_GPIO_PIN_4 #define SD_CD_GPIO_Port GPIOC -#define SD_CD_Pin LL_GPIO_PIN_10 +#define SD_CD_Pin LL_GPIO_PIN_10 #define SD_CS_GPIO_Port GPIOC -#define SD_CS_Pin LL_GPIO_PIN_12 +#define SD_CS_Pin LL_GPIO_PIN_12 #define SPEAKER_GPIO_Port GPIOB -#define SPEAKER_Pin LL_GPIO_PIN_8 +#define SPEAKER_Pin LL_GPIO_PIN_8 #define VIBRO_GPIO_Port GPIOA -#define VIBRO_Pin LL_GPIO_PIN_8 +#define VIBRO_Pin LL_GPIO_PIN_8 #define iBTN_GPIO_Port GPIOB -#define iBTN_Pin LL_GPIO_PIN_14 +#define iBTN_Pin LL_GPIO_PIN_14 -#define USART1_TX_Pin LL_GPIO_PIN_6 +#define USART1_TX_Pin LL_GPIO_PIN_6 #define USART1_TX_Port GPIOB -#define USART1_RX_Pin LL_GPIO_PIN_7 +#define USART1_RX_Pin LL_GPIO_PIN_7 #define USART1_RX_Port GPIOB #define SPI_D_MISO_GPIO_Port GPIOC -#define SPI_D_MISO_Pin LL_GPIO_PIN_2 +#define SPI_D_MISO_Pin LL_GPIO_PIN_2 #define SPI_D_MOSI_GPIO_Port GPIOB -#define SPI_D_MOSI_Pin LL_GPIO_PIN_15 -#define SPI_D_SCK_GPIO_Port GPIOD -#define SPI_D_SCK_Pin LL_GPIO_PIN_1 +#define SPI_D_MOSI_Pin LL_GPIO_PIN_15 +#define SPI_D_SCK_GPIO_Port GPIOD +#define SPI_D_SCK_Pin LL_GPIO_PIN_1 #define SPI_R_MISO_GPIO_Port GPIOB -#define SPI_R_MISO_Pin LL_GPIO_PIN_4 +#define SPI_R_MISO_Pin LL_GPIO_PIN_4 #define SPI_R_MOSI_GPIO_Port GPIOB -#define SPI_R_MOSI_Pin LL_GPIO_PIN_5 -#define SPI_R_SCK_GPIO_Port GPIOA -#define SPI_R_SCK_Pin LL_GPIO_PIN_5 +#define SPI_R_MOSI_Pin LL_GPIO_PIN_5 +#define SPI_R_SCK_GPIO_Port GPIOA +#define SPI_R_SCK_Pin LL_GPIO_PIN_5 -#define NFC_IRQ_Pin RFID_PULL_Pin +#define NFC_IRQ_Pin RFID_PULL_Pin #define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port void furi_hal_resources_init_early(void); diff --git a/targets/f7/furi_hal/furi_hal_rfid.c b/targets/f7/furi_hal/furi_hal_rfid.c index 07ea5ab0a..34bb3a516 100644 --- a/targets/f7/furi_hal/furi_hal_rfid.c +++ b/targets/f7/furi_hal/furi_hal_rfid.c @@ -9,42 +9,42 @@ #include #include -#define FURI_HAL_RFID_READ_TIMER TIM1 -#define FURI_HAL_RFID_READ_TIMER_BUS FuriHalBusTIM1 -#define FURI_HAL_RFID_READ_TIMER_CHANNEL LL_TIM_CHANNEL_CH1N +#define FURI_HAL_RFID_READ_TIMER TIM1 +#define FURI_HAL_RFID_READ_TIMER_BUS FuriHalBusTIM1 +#define FURI_HAL_RFID_READ_TIMER_CHANNEL LL_TIM_CHANNEL_CH1N // We can't use N channel for LL_TIM_OC_Init, so... #define FURI_HAL_RFID_READ_TIMER_CHANNEL_CONFIG LL_TIM_CHANNEL_CH1 -#define FURI_HAL_RFID_EMULATE_TIMER TIM2 -#define FURI_HAL_RFID_EMULATE_TIMER_BUS FuriHalBusTIM2 -#define FURI_HAL_RFID_EMULATE_TIMER_IRQ FuriHalInterruptIdTIM2 +#define FURI_HAL_RFID_EMULATE_TIMER TIM2 +#define FURI_HAL_RFID_EMULATE_TIMER_BUS FuriHalBusTIM2 +#define FURI_HAL_RFID_EMULATE_TIMER_IRQ FuriHalInterruptIdTIM2 #define FURI_HAL_RFID_EMULATE_TIMER_CHANNEL LL_TIM_CHANNEL_CH3 -#define RFID_CAPTURE_TIM TIM2 +#define RFID_CAPTURE_TIM TIM2 #define RFID_CAPTURE_TIM_BUS FuriHalBusTIM2 -#define RFID_CAPTURE_IND_CH LL_TIM_CHANNEL_CH3 -#define RFID_CAPTURE_DIR_CH LL_TIM_CHANNEL_CH4 +#define RFID_CAPTURE_IND_CH LL_TIM_CHANNEL_CH3 +#define RFID_CAPTURE_DIR_CH LL_TIM_CHANNEL_CH4 // Field presence detection #define FURI_HAL_RFID_FIELD_FREQUENCY_MIN 80000 #define FURI_HAL_RFID_FIELD_FREQUENCY_MAX 200000 -#define FURI_HAL_RFID_FIELD_COUNTER_TIMER TIM2 -#define FURI_HAL_RFID_FIELD_COUNTER_TIMER_BUS FuriHalBusTIM2 +#define FURI_HAL_RFID_FIELD_COUNTER_TIMER TIM2 +#define FURI_HAL_RFID_FIELD_COUNTER_TIMER_BUS FuriHalBusTIM2 #define FURI_HAL_RFID_FIELD_COUNTER_TIMER_CHANNEL LL_TIM_CHANNEL_CH3 -#define FURI_HAL_RFID_FIELD_TIMEOUT_TIMER TIM1 +#define FURI_HAL_RFID_FIELD_TIMEOUT_TIMER TIM1 #define FURI_HAL_RFID_FIELD_TIMEOUT_TIMER_BUS FuriHalBusTIM1 #define FURI_HAL_RFID_FIELD_DMAMUX_DMA LL_DMAMUX_REQ_TIM1_UP /* DMA Channels definition */ -#define RFID_DMA DMA2 +#define RFID_DMA DMA2 #define RFID_DMA_CH1_CHANNEL LL_DMA_CHANNEL_1 #define RFID_DMA_CH2_CHANNEL LL_DMA_CHANNEL_2 -#define RFID_DMA_CH1_IRQ FuriHalInterruptIdDma2Ch1 -#define RFID_DMA_CH1_DEF RFID_DMA, RFID_DMA_CH1_CHANNEL -#define RFID_DMA_CH2_DEF RFID_DMA, RFID_DMA_CH2_CHANNEL +#define RFID_DMA_CH1_IRQ FuriHalInterruptIdDma2Ch1 +#define RFID_DMA_CH1_DEF RFID_DMA, RFID_DMA_CH1_CHANNEL +#define RFID_DMA_CH2_DEF RFID_DMA, RFID_DMA_CH2_CHANNEL typedef struct { uint32_t counter; @@ -60,11 +60,11 @@ typedef struct { FuriHalRfid* furi_hal_rfid = NULL; -#define LFRFID_LL_READ_TIM TIM1 +#define LFRFID_LL_READ_TIM TIM1 #define LFRFID_LL_READ_CONFIG_CHANNEL LL_TIM_CHANNEL_CH1 -#define LFRFID_LL_READ_CHANNEL LL_TIM_CHANNEL_CH1N +#define LFRFID_LL_READ_CHANNEL LL_TIM_CHANNEL_CH1N -#define LFRFID_LL_EMULATE_TIM TIM2 +#define LFRFID_LL_EMULATE_TIM TIM2 #define LFRFID_LL_EMULATE_CHANNEL LL_TIM_CHANNEL_CH3 void furi_hal_rfid_init(void) { @@ -585,7 +585,6 @@ bool furi_hal_rfid_field_is_present(uint32_t* frequency) { furi_check(frequency); *frequency = furi_hal_rfid->field.counter * 10; - return ( - (*frequency >= FURI_HAL_RFID_FIELD_FREQUENCY_MIN) && - (*frequency <= FURI_HAL_RFID_FIELD_FREQUENCY_MAX)); -} \ No newline at end of file + return (*frequency >= FURI_HAL_RFID_FIELD_FREQUENCY_MIN) && + (*frequency <= FURI_HAL_RFID_FIELD_FREQUENCY_MAX); +} diff --git a/targets/f7/furi_hal/furi_hal_rtc.c b/targets/f7/furi_hal/furi_hal_rtc.c index a1c8b46c3..f5f7bdf2d 100644 --- a/targets/f7/furi_hal/furi_hal_rtc.c +++ b/targets/f7/furi_hal/furi_hal_rtc.c @@ -17,7 +17,7 @@ #define FURI_HAL_RTC_CLOCK_IS_READY() (LL_RCC_LSE_IsReady() && LL_RCC_LSI1_IsReady()) -#define FURI_HAL_RTC_HEADER_MAGIC 0x10F1 +#define FURI_HAL_RTC_HEADER_MAGIC 0x10F1 #define FURI_HAL_RTC_HEADER_VERSION 0 typedef struct { @@ -27,17 +27,17 @@ typedef struct { } FuriHalRtcHeader; typedef struct { - uint8_t log_level : 4; + uint8_t log_level : 4; uint8_t log_reserved : 4; uint8_t flags; - FuriHalRtcBootMode boot_mode : 4; - FuriHalRtcHeapTrackMode heap_track_mode : 2; - FuriHalRtcLocaleUnits locale_units : 1; + FuriHalRtcBootMode boot_mode : 4; + FuriHalRtcHeapTrackMode heap_track_mode : 2; + FuriHalRtcLocaleUnits locale_units : 1; FuriHalRtcLocaleTimeFormat locale_timeformat : 1; FuriHalRtcLocaleDateFormat locale_dateformat : 2; - FuriHalRtcLogDevice log_device : 2; - FuriHalRtcLogBaudRate log_baud_rate : 3; - uint8_t reserved : 1; + FuriHalRtcLogDevice log_device : 2; + FuriHalRtcLogBaudRate log_baud_rate : 3; + uint8_t reserved : 1; } SystemReg; _Static_assert(sizeof(SystemReg) == 4, "SystemReg size mismatch"); diff --git a/targets/f7/furi_hal/furi_hal_sd.c b/targets/f7/furi_hal/furi_hal_sd.c index fb7f43ec8..eca5b6da9 100644 --- a/targets/f7/furi_hal/furi_hal_sd.c +++ b/targets/f7/furi_hal/furi_hal_sd.c @@ -11,12 +11,12 @@ #define sd_spi_debug(...) #endif -#define SD_CMD_LENGTH (6) -#define SD_DUMMY_BYTE (0xFF) +#define SD_CMD_LENGTH (6) +#define SD_DUMMY_BYTE (0xFF) #define SD_ANSWER_RETRY_COUNT (8) -#define SD_IDLE_RETRY_COUNT (100) -#define SD_TIMEOUT_MS (1000) -#define SD_BLOCK_SIZE (512) +#define SD_IDLE_RETRY_COUNT (100) +#define SD_TIMEOUT_MS (1000) +#define SD_BLOCK_SIZE (512) #define FLAG_SET(x, y) (((x) & (y)) == (y)) @@ -125,53 +125,53 @@ typedef enum { */ typedef struct { /* Header part */ - uint8_t CSDStruct : 2; /* CSD structure */ - uint8_t Reserved1 : 6; /* Reserved */ - uint8_t TAAC : 8; /* Data read access-time 1 */ - uint8_t NSAC : 8; /* Data read access-time 2 in CLK cycles */ - uint8_t MaxBusClkFreq : 8; /* Max. bus clock frequency */ + uint8_t CSDStruct : 2; /* CSD structure */ + uint8_t Reserved1 : 6; /* Reserved */ + uint8_t TAAC : 8; /* Data read access-time 1 */ + uint8_t NSAC : 8; /* Data read access-time 2 in CLK cycles */ + uint8_t MaxBusClkFreq : 8; /* Max. bus clock frequency */ uint16_t CardComdClasses : 12; /* Card command classes */ - uint8_t RdBlockLen : 4; /* Max. read data block length */ - uint8_t PartBlockRead : 1; /* Partial blocks for read allowed */ - uint8_t WrBlockMisalign : 1; /* Write block misalignment */ - uint8_t RdBlockMisalign : 1; /* Read block misalignment */ - uint8_t DSRImpl : 1; /* DSR implemented */ + uint8_t RdBlockLen : 4; /* Max. read data block length */ + uint8_t PartBlockRead : 1; /* Partial blocks for read allowed */ + uint8_t WrBlockMisalign : 1; /* Write block misalignment */ + uint8_t RdBlockMisalign : 1; /* Read block misalignment */ + uint8_t DSRImpl : 1; /* DSR implemented */ /* v1 or v2 struct */ union csd_version { struct { - uint8_t Reserved1 : 2; /* Reserved */ - uint16_t DeviceSize : 12; /* Device Size */ + uint8_t Reserved1 : 2; /* Reserved */ + uint16_t DeviceSize : 12; /* Device Size */ uint8_t MaxRdCurrentVDDMin : 3; /* Max. read current @ VDD min */ uint8_t MaxRdCurrentVDDMax : 3; /* Max. read current @ VDD max */ uint8_t MaxWrCurrentVDDMin : 3; /* Max. write current @ VDD min */ uint8_t MaxWrCurrentVDDMax : 3; /* Max. write current @ VDD max */ - uint8_t DeviceSizeMul : 3; /* Device size multiplier */ + uint8_t DeviceSizeMul : 3; /* Device size multiplier */ } v1; struct { - uint8_t Reserved1 : 6; /* Reserved */ + uint8_t Reserved1 : 6; /* Reserved */ uint32_t DeviceSize : 22; /* Device Size */ - uint8_t Reserved2 : 1; /* Reserved */ + uint8_t Reserved2 : 1; /* Reserved */ } v2; } version; uint8_t EraseSingleBlockEnable : 1; /* Erase single block enable */ - uint8_t EraseSectorSize : 7; /* Erase group size multiplier */ - uint8_t WrProtectGrSize : 7; /* Write protect group size */ - uint8_t WrProtectGrEnable : 1; /* Write protect group enable */ - uint8_t Reserved2 : 2; /* Reserved */ - uint8_t WrSpeedFact : 3; /* Write speed factor */ - uint8_t MaxWrBlockLen : 4; /* Max. write data block length */ - uint8_t WriteBlockPartial : 1; /* Partial blocks for write allowed */ - uint8_t Reserved3 : 5; /* Reserved */ - uint8_t FileFormatGrouop : 1; /* File format group */ - uint8_t CopyFlag : 1; /* Copy flag (OTP) */ - uint8_t PermWrProtect : 1; /* Permanent write protection */ - uint8_t TempWrProtect : 1; /* Temporary write protection */ - uint8_t FileFormat : 2; /* File Format */ - uint8_t Reserved4 : 2; /* Reserved */ - uint8_t crc : 7; /* Reserved */ - uint8_t Reserved5 : 1; /* always 1*/ + uint8_t EraseSectorSize : 7; /* Erase group size multiplier */ + uint8_t WrProtectGrSize : 7; /* Write protect group size */ + uint8_t WrProtectGrEnable : 1; /* Write protect group enable */ + uint8_t Reserved2 : 2; /* Reserved */ + uint8_t WrSpeedFact : 3; /* Write speed factor */ + uint8_t MaxWrBlockLen : 4; /* Max. write data block length */ + uint8_t WriteBlockPartial : 1; /* Partial blocks for write allowed */ + uint8_t Reserved3 : 5; /* Reserved */ + uint8_t FileFormatGrouop : 1; /* File format group */ + uint8_t CopyFlag : 1; /* Copy flag (OTP) */ + uint8_t PermWrProtect : 1; /* Permanent write protection */ + uint8_t TempWrProtect : 1; /* Temporary write protection */ + uint8_t FileFormat : 2; /* File Format */ + uint8_t Reserved4 : 2; /* Reserved */ + uint8_t crc : 7; /* Reserved */ + uint8_t Reserved5 : 1; /* always 1*/ } SD_CSD; @@ -324,7 +324,7 @@ static FuriStatus sd_spi_wait_for_data(uint8_t data, uint32_t timeout_ms) { if(furi_hal_cortex_timer_is_expired(timer)) { return FuriStatusErrorTimeout; } - } while((byte != data)); + } while(byte != data); return FuriStatusOk; } @@ -1098,4 +1098,4 @@ FuriStatus furi_hal_sd_info(FuriHalSdInfo* info) { furi_hal_spi_release(&furi_hal_spi_bus_handle_sd_fast); return status; -} \ No newline at end of file +} diff --git a/targets/f7/furi_hal/furi_hal_serial.c b/targets/f7/furi_hal/furi_hal_serial.c index f26b412d2..5ddb0785f 100644 --- a/targets/f7/furi_hal/furi_hal_serial.c +++ b/targets/f7/furi_hal/furi_hal_serial.c @@ -15,10 +15,10 @@ #define FURI_HAL_SERIAL_USART_OVERSAMPLING LL_USART_OVERSAMPLING_16 #define FURI_HAL_SERIAL_USART_DMA_INSTANCE (DMA1) -#define FURI_HAL_SERIAL_USART_DMA_CHANNEL (LL_DMA_CHANNEL_6) +#define FURI_HAL_SERIAL_USART_DMA_CHANNEL (LL_DMA_CHANNEL_6) #define FURI_HAL_SERIAL_LPUART_DMA_INSTANCE (DMA1) -#define FURI_HAL_SERIAL_LPUART_DMA_CHANNEL (LL_DMA_CHANNEL_7) +#define FURI_HAL_SERIAL_LPUART_DMA_CHANNEL (LL_DMA_CHANNEL_7) typedef struct { uint8_t* buffer_rx_ptr; diff --git a/targets/f7/furi_hal/furi_hal_speaker.c b/targets/f7/furi_hal/furi_hal_speaker.c index 0aa8ce951..65b517b9e 100644 --- a/targets/f7/furi_hal/furi_hal_speaker.c +++ b/targets/f7/furi_hal/furi_hal_speaker.c @@ -9,9 +9,9 @@ #define TAG "FuriHalSpeaker" -#define FURI_HAL_SPEAKER_TIMER TIM16 -#define FURI_HAL_SPEAKER_CHANNEL LL_TIM_CHANNEL_CH1 -#define FURI_HAL_SPEAKER_PRESCALER 500 +#define FURI_HAL_SPEAKER_TIMER TIM16 +#define FURI_HAL_SPEAKER_CHANNEL LL_TIM_CHANNEL_CH1 +#define FURI_HAL_SPEAKER_PRESCALER 500 #define FURI_HAL_SPEAKER_MAX_VOLUME 60 static FuriMutex* furi_hal_speaker_mutex = NULL; diff --git a/targets/f7/furi_hal/furi_hal_spi.c b/targets/f7/furi_hal/furi_hal_spi.c index e2892572f..49bcd48a1 100644 --- a/targets/f7/furi_hal/furi_hal_spi.c +++ b/targets/f7/furi_hal/furi_hal_spi.c @@ -11,13 +11,13 @@ #define TAG "FuriHalSpi" -#define SPI_DMA DMA2 +#define SPI_DMA DMA2 #define SPI_DMA_RX_CHANNEL LL_DMA_CHANNEL_6 #define SPI_DMA_TX_CHANNEL LL_DMA_CHANNEL_7 -#define SPI_DMA_RX_IRQ FuriHalInterruptIdDma2Ch6 -#define SPI_DMA_TX_IRQ FuriHalInterruptIdDma2Ch7 -#define SPI_DMA_RX_DEF SPI_DMA, SPI_DMA_RX_CHANNEL -#define SPI_DMA_TX_DEF SPI_DMA, SPI_DMA_TX_CHANNEL +#define SPI_DMA_RX_IRQ FuriHalInterruptIdDma2Ch6 +#define SPI_DMA_TX_IRQ FuriHalInterruptIdDma2Ch7 +#define SPI_DMA_RX_DEF SPI_DMA, SPI_DMA_RX_CHANNEL +#define SPI_DMA_TX_DEF SPI_DMA, SPI_DMA_TX_CHANNEL // For simplicity, I assume that only one SPI DMA transaction can occur at a time. static FuriSemaphore* spi_dma_lock = NULL; diff --git a/targets/f7/furi_hal/furi_hal_subghz.c b/targets/f7/furi_hal/furi_hal_subghz.c index c5670f73e..220e9219b 100644 --- a/targets/f7/furi_hal/furi_hal_subghz.c +++ b/targets/f7/furi_hal/furi_hal_subghz.c @@ -20,12 +20,12 @@ static uint32_t furi_hal_subghz_debug_gpio_buff[2] = {0}; /* DMA Channels definition */ -#define SUBGHZ_DMA (DMA2) +#define SUBGHZ_DMA (DMA2) #define SUBGHZ_DMA_CH1_CHANNEL (LL_DMA_CHANNEL_1) #define SUBGHZ_DMA_CH2_CHANNEL (LL_DMA_CHANNEL_2) -#define SUBGHZ_DMA_CH1_IRQ (FuriHalInterruptIdDma2Ch1) -#define SUBGHZ_DMA_CH1_DEF SUBGHZ_DMA, SUBGHZ_DMA_CH1_CHANNEL -#define SUBGHZ_DMA_CH2_DEF SUBGHZ_DMA, SUBGHZ_DMA_CH2_CHANNEL +#define SUBGHZ_DMA_CH1_IRQ (FuriHalInterruptIdDma2Ch1) +#define SUBGHZ_DMA_CH1_DEF SUBGHZ_DMA, SUBGHZ_DMA_CH1_CHANNEL +#define SUBGHZ_DMA_CH2_DEF SUBGHZ_DMA, SUBGHZ_DMA_CH2_CHANNEL /** SubGhz state */ typedef enum { @@ -253,7 +253,7 @@ bool furi_hal_subghz_is_rx_data_crc_valid(void) { uint8_t data[1]; cc1101_read_reg(&furi_hal_spi_bus_handle_subghz, CC1101_STATUS_LQI | CC1101_BURST, data); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); - if(((data[0] >> 7) & 0x01)) { + if((data[0] >> 7) & 0x01) { return true; } else { return false; diff --git a/targets/f7/furi_hal/furi_hal_subghz.h b/targets/f7/furi_hal/furi_hal_subghz.h index 0a0ee7667..49c7360bc 100644 --- a/targets/f7/furi_hal/furi_hal_subghz.h +++ b/targets/f7/furi_hal/furi_hal_subghz.h @@ -20,7 +20,7 @@ extern "C" { /** Various subghz defines */ #define FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL (256u) #define FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF (FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL / 2) -#define FURI_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME (999u) +#define FURI_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME (999u) /** Switchable Radio Paths */ typedef enum { diff --git a/targets/f7/furi_hal/furi_hal_usb_ccid.c b/targets/f7/furi_hal/furi_hal_usb_ccid.c index 6a6527c3b..7ce60f61e 100644 --- a/targets/f7/furi_hal/furi_hal_usb_ccid.c +++ b/targets/f7/furi_hal/furi_hal_usb_ccid.c @@ -12,17 +12,17 @@ static const uint8_t USB_DEVICE_NO_SUBCLASS = 0x0; static const uint8_t USB_DEVICE_NO_PROTOCOL = 0x0; #define FIXED_CONTROL_ENDPOINT_SIZE 8 -#define IF_NUM_MAX 1 +#define IF_NUM_MAX 1 #define CCID_VID_DEFAULT 0x1234 #define CCID_PID_DEFAULT 0xABCD #define CCID_TOTAL_SLOTS 1 -#define CCID_SLOT_INDEX 0 +#define CCID_SLOT_INDEX 0 #define CCID_DATABLOCK_SIZE \ (4 + 1 + CCID_SHORT_APDU_SIZE + 1) //APDU Header + Lc + Short APDU size + Le -#define ENDPOINT_DIR_IN 0x80 +#define ENDPOINT_DIR_IN 0x80 #define ENDPOINT_DIR_OUT 0x00 #define INTERFACE_ID_CCID 0 @@ -539,4 +539,4 @@ static usbd_respond ccid_control(usbd_device* dev, usbd_ctlreq* req, usbd_rqc_ca } } return usbd_fail; -} \ No newline at end of file +} diff --git a/targets/f7/furi_hal/furi_hal_usb_cdc.c b/targets/f7/furi_hal/furi_hal_usb_cdc.c index 8525022c0..cfedb5e76 100644 --- a/targets/f7/furi_hal/furi_hal_usb_cdc.c +++ b/targets/f7/furi_hal/furi_hal_usb_cdc.c @@ -518,7 +518,7 @@ int32_t furi_hal_cdc_receive(uint8_t if_num, uint8_t* buf, uint16_t max_len) { } else { len = usbd_ep_read(usb_dev, CDC1_RXD_EP, buf, max_len); } - return ((len < 0) ? 0 : len); + return (len < 0) ? 0 : len; } static void cdc_on_wakeup(usbd_device* dev) { diff --git a/targets/f7/furi_hal/furi_hal_usb_u2f.c b/targets/f7/furi_hal/furi_hal_usb_u2f.c index 390070c8f..05f498376 100644 --- a/targets/f7/furi_hal/furi_hal_usb_u2f.c +++ b/targets/f7/furi_hal/furi_hal_usb_u2f.c @@ -6,12 +6,12 @@ #include "usb.h" #include "usb_hid.h" -#define HID_PAGE_FIDO 0xF1D0 -#define HID_FIDO_U2F 0x01 -#define HID_FIDO_INPUT 0x20 +#define HID_PAGE_FIDO 0xF1D0 +#define HID_FIDO_U2F 0x01 +#define HID_FIDO_INPUT 0x20 #define HID_FIDO_OUTPUT 0x21 -#define HID_EP_IN 0x81 +#define HID_EP_IN 0x81 #define HID_EP_OUT 0x01 struct HidIadDescriptor { @@ -237,7 +237,7 @@ void furi_hal_hid_u2f_send_response(uint8_t* data, uint8_t len) { uint32_t furi_hal_hid_u2f_get_request(uint8_t* data) { int32_t len = usbd_ep_read(usb_dev, HID_EP_IN, data, HID_U2F_PACKET_LEN); - return ((len < 0) ? 0 : len); + return (len < 0) ? 0 : len; } static void hid_u2f_rx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { diff --git a/targets/f7/furi_hal/furi_hal_version.c b/targets/f7/furi_hal/furi_hal_version.c index c7656a8df..bd449e599 100644 --- a/targets/f7/furi_hal/furi_hal_version.c +++ b/targets/f7/furi_hal/furi_hal_version.c @@ -11,7 +11,7 @@ #define TAG "FuriHalVersion" #define FURI_HAL_VERSION_OTP_HEADER_MAGIC 0xBABE -#define FURI_HAL_VERSION_OTP_ADDRESS OTP_AREA_BASE +#define FURI_HAL_VERSION_OTP_ADDRESS OTP_AREA_BASE /** OTP V0 Structure: prototypes and early EVT */ typedef struct { diff --git a/targets/f7/furi_hal/furi_hal_version_device.c b/targets/f7/furi_hal/furi_hal_version_device.c index af88c0671..6ddb99e86 100644 --- a/targets/f7/furi_hal/furi_hal_version_device.c +++ b/targets/f7/furi_hal/furi_hal_version_device.c @@ -30,4 +30,4 @@ const char* furi_hal_version_get_srrc_id(void) { const char* furi_hal_version_get_ncc_id(void) { return "CCAJ23LP34D0T3"; -} \ No newline at end of file +} diff --git a/targets/f7/inc/FreeRTOSConfig.h b/targets/f7/inc/FreeRTOSConfig.h index 37aac1eb0..62310511d 100644 --- a/targets/f7/inc/FreeRTOSConfig.h +++ b/targets/f7/inc/FreeRTOSConfig.h @@ -14,73 +14,73 @@ #define configENABLE_FPU 1 #define configENABLE_MPU 0 -#define configUSE_PREEMPTION 1 -#define configSUPPORT_STATIC_ALLOCATION 1 +#define configUSE_PREEMPTION 1 +#define configSUPPORT_STATIC_ALLOCATION 1 #define configSUPPORT_DYNAMIC_ALLOCATION 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 configMAX_PRIORITIES (32) -#define configMINIMAL_STACK_SIZE ((uint16_t)128) +#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 configMAX_PRIORITIES (32) +#define configMINIMAL_STACK_SIZE ((uint16_t)128) /* Heap size determined automatically by linker */ // #define configTOTAL_HEAP_SIZE ((size_t)0) #define configMAX_TASK_NAME_LEN (32) -#define configGENERATE_RUN_TIME_STATS 1 +#define configGENERATE_RUN_TIME_STATS 1 #define portGET_RUN_TIME_COUNTER_VALUE() (DWT->CYCCNT) #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 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configENABLE_BACKWARD_COMPATIBILITY 0 +#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 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configENABLE_BACKWARD_COMPATIBILITY 0 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#define configUSE_TICKLESS_IDLE 2 -#define configRECORD_STACK_HIGH_ADDRESS 1 -#define configUSE_NEWLIB_REENTRANT 0 +#define configUSE_TICKLESS_IDLE 2 +#define configRECORD_STACK_HIGH_ADDRESS 1 +#define configUSE_NEWLIB_REENTRANT 0 /* Defaults to size_t for backward compatibility, but can be changed if lengths will always be less than the number of bytes in a size_t. */ -#define configMESSAGE_BUFFER_LENGTH_TYPE size_t +#define configMESSAGE_BUFFER_LENGTH_TYPE size_t #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1 -#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 4 +#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 4 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 /* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (2) -#define configTIMER_QUEUE_LENGTH 32 -#define configTIMER_TASK_STACK_DEPTH 256 +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (2) +#define configTIMER_QUEUE_LENGTH 32 +#define configTIMER_TASK_STACK_DEPTH 256 #define configTIMER_SERVICE_TASK_NAME "TimersSrv" -#define configIDLE_TASK_NAME "(-_-)" +#define configIDLE_TASK_NAME "(-_-)" #define configIDLE_TASK_STACK_DEPTH 128 /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ -#define INCLUDE_xTaskGetHandle 1 -#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskGetHandle 1 +#define INCLUDE_eTaskGetState 1 #define INCLUDE_uxTaskGetStackHighWaterMark 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_xQueueGetMutexHolder 1 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_xQueueGetMutexHolder 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTimerPendFunctionCall 1 /* Workaround for various notification issues: * - First one used by system primitives @@ -138,7 +138,7 @@ header file. */ /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */ -#define vPortSVCHandler SVC_Handler +#define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler #define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 1 diff --git a/targets/f7/inc/furi_config.h b/targets/f7/inc/furi_config.h index c935611ab..d03549c79 100644 --- a/targets/f7/inc/furi_config.h +++ b/targets/f7/inc/furi_config.h @@ -1,3 +1,3 @@ #pragma once -#define FURI_CONFIG_THREAD_MAX_PRIORITIES (32) \ No newline at end of file +#define FURI_CONFIG_THREAD_MAX_PRIORITIES (32) diff --git a/targets/f7/inc/stm32.h b/targets/f7/inc/stm32.h index 8e5cc379b..8209fd6a2 100644 --- a/targets/f7/inc/stm32.h +++ b/targets/f7/inc/stm32.h @@ -4,17 +4,17 @@ /* modify bitfield */ #define _BMD(reg, msk, val) (reg) = (((reg) & ~(msk)) | (val)) /* set bitfield */ -#define _BST(reg, bits) (reg) = ((reg) | (bits)) +#define _BST(reg, bits) (reg) = ((reg) | (bits)) /* clear bitfield */ -#define _BCL(reg, bits) (reg) = ((reg) & ~(bits)) +#define _BCL(reg, bits) (reg) = ((reg) & ~(bits)) /* wait until bitfield set */ -#define _WBS(reg, bits) while(((reg) & (bits)) == 0) +#define _WBS(reg, bits) while(((reg) & (bits)) == 0) /* wait until bitfield clear */ -#define _WBC(reg, bits) while(((reg) & (bits)) != 0) +#define _WBC(reg, bits) while(((reg) & (bits)) != 0) /* wait for bitfield value */ #define _WVL(reg, msk, val) while(((reg) & (msk)) != (val)) /* bit value */ -#define _BV(bit) (0x01 << (bit)) +#define _BV(bit) (0x01 << (bit)) #include "stm32wbxx.h" diff --git a/targets/f7/platform_specific/math_wrapper.h b/targets/f7/platform_specific/math_wrapper.h index 83f5a8b75..e2dfd4541 100644 --- a/targets/f7/platform_specific/math_wrapper.h +++ b/targets/f7/platform_specific/math_wrapper.h @@ -1,2 +1,2 @@ #pragma once -#include \ No newline at end of file +#include diff --git a/targets/furi_hal_include/furi_hal_bt.h b/targets/furi_hal_include/furi_hal_bt.h index ef6b31bb4..6da723311 100644 --- a/targets/furi_hal_include/furi_hal_bt.h +++ b/targets/furi_hal_include/furi_hal_bt.h @@ -16,7 +16,7 @@ #define FURI_HAL_BT_STACK_VERSION_MAJOR (1) #define FURI_HAL_BT_STACK_VERSION_MINOR (12) -#define FURI_HAL_BT_C2_START_TIMEOUT (1000) +#define FURI_HAL_BT_C2_START_TIMEOUT (1000) #ifdef __cplusplus extern "C" { diff --git a/targets/furi_hal_include/furi_hal_crypto.h b/targets/furi_hal_include/furi_hal_crypto.h index 04a2c67cf..9a3b488fb 100644 --- a/targets/furi_hal_include/furi_hal_crypto.h +++ b/targets/furi_hal_include/furi_hal_crypto.h @@ -51,14 +51,14 @@ extern "C" { /** Factory provisioned keys slot range. All of them are exactly same on all flippers. */ #define FURI_HAL_CRYPTO_ENCLAVE_FACTORY_KEY_SLOT_START (1u) -#define FURI_HAL_CRYPTO_ENCLAVE_FACTORY_KEY_SLOT_END (10u) +#define FURI_HAL_CRYPTO_ENCLAVE_FACTORY_KEY_SLOT_END (10u) /** Device unique key slot. This key generated on first use or provisioned by user. Use furi_hal_crypto_enclave_ensure_key before using this slot. */ #define FURI_HAL_CRYPTO_ENCLAVE_UNIQUE_KEY_SLOT (11u) /** User key slot range. This slots can be used for your needs, but never use them in public apps. */ #define FURI_HAL_CRYPTO_ENCLAVE_USER_KEY_SLOT_START (12u) -#define FURI_HAL_CRYPTO_ENCLAVE_USER_KEY_SLOT_END (100u) +#define FURI_HAL_CRYPTO_ENCLAVE_USER_KEY_SLOT_END (100u) /** [Deprecated] Indicates availability of advanced crypto functions, will be dropped before v1.0 */ #define FURI_HAL_CRYPTO_ADVANCED_AVAIL 1 diff --git a/targets/furi_hal_include/furi_hal_memory.h b/targets/furi_hal_include/furi_hal_memory.h index 6451d93bc..c57c434fa 100644 --- a/targets/furi_hal_include/furi_hal_memory.h +++ b/targets/furi_hal_include/furi_hal_memory.h @@ -41,4 +41,4 @@ size_t furi_hal_memory_max_pool_block(void); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/targets/furi_hal_include/furi_hal_usb_hid.h b/targets/furi_hal_include/furi_hal_usb_hid.h index 29994196f..af4a542de 100644 --- a/targets/furi_hal_include/furi_hal_usb_hid.h +++ b/targets/furi_hal_include/furi_hal_usb_hid.h @@ -10,14 +10,14 @@ extern "C" { #endif /** Max number of simultaneously pressed keys (keyboard) */ -#define HID_KB_MAX_KEYS 6 +#define HID_KB_MAX_KEYS 6 /** Max number of simultaneously pressed keys (consumer control) */ #define HID_CONSUMER_MAX_KEYS 2 /** OS-specific consumer keys, defined as "Reserved" in HID Usage Tables document */ #define HID_CONSUMER_BRIGHTNESS_INCREMENT 0x006F #define HID_CONSUMER_BRIGHTNESS_DECREMENT 0x0070 -#define HID_CONSUMER_FN_GLOBE 0x029D +#define HID_CONSUMER_FN_GLOBE 0x029D #define HID_KEYBOARD_NONE 0x00 diff --git a/targets/furi_hal_include/furi_hal_version.h b/targets/furi_hal_include/furi_hal_version.h index 79ebf4275..8e00a7541 100644 --- a/targets/furi_hal_include/furi_hal_version.h +++ b/targets/furi_hal_include/furi_hal_version.h @@ -14,8 +14,8 @@ extern "C" { #endif -#define FURI_HAL_VERSION_NAME_LENGTH 8 -#define FURI_HAL_VERSION_ARRAY_NAME_LENGTH (FURI_HAL_VERSION_NAME_LENGTH + 1) +#define FURI_HAL_VERSION_NAME_LENGTH 8 +#define FURI_HAL_VERSION_ARRAY_NAME_LENGTH (FURI_HAL_VERSION_NAME_LENGTH + 1) /** BLE symbol + "Flipper " + name */ #define FURI_HAL_VERSION_DEVICE_NAME_LENGTH (1 + 8 + FURI_HAL_VERSION_ARRAY_NAME_LENGTH)