From a09ec4d9769f96c49256315918bcedc71a365335 Mon Sep 17 00:00:00 2001 From: Anna Prosvetova Date: Tue, 19 Mar 2024 10:19:31 +0100 Subject: [PATCH 01/28] Infrared: Add Fujitsu ASYG24KMTB (#3513) --- .../infrared/resources/infrared/assets/ac.ir | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/applications/main/infrared/resources/infrared/assets/ac.ir b/applications/main/infrared/resources/infrared/assets/ac.ir index 64d473deff1..4e1735246e7 100644 --- a/applications/main/infrared/resources/infrared/assets/ac.ir +++ b/applications/main/infrared/resources/infrared/assets/ac.ir @@ -788,3 +788,41 @@ type: raw frequency: 38000 duty_cycle: 0.330000 data: 664 17757 3057 8901 528 469 550 1434 556 465 553 440 529 465 554 439 555 439 555 438 555 440 553 1435 552 443 550 470 524 1466 522 472 522 472 521 1467 523 1466 549 1440 549 1440 548 1440 548 445 549 445 549 445 549 446 548 470 524 471 523 471 523 471 523 472 522 472 522 473 522 472 523 472 548 446 549 445 550 445 548 446 548 446 548 446 548 446 548 447 547 470 524 471 523 471 523 471 523 471 523 474 519 474 521 474 521 473 522 473 546 447 547 1441 548 1442 546 1442 547 1442 546 2947 3023 8935 522 1466 522 472 522 498 496 498 495 499 496 498 496 498 521 473 522 471 523 1466 522 471 523 471 522 1466 523 471 523 1467 522 1467 522 1467 521 1493 495 1494 496 1493 521 473 522 472 522 471 523 472 522 471 523 472 522 472 522 472 522 472 522 472 522 472 522 472 522 473 521 499 495 499 495 499 495 499 496 498 522 473 522 472 523 471 522 472 522 472 522 472 522 472 522 472 522 472 522 473 521 473 521 473 521 473 521 499 495 500 494 500 495 499 496 498 522 2947 3023 8937 521 1468 520 473 521 473 521 473 521 473 521 473 521 473 521 474 520 474 520 1470 518 500 494 500 494 500 494 500 494 1494 521 1468 521 473 521 1468 520 1468 520 1469 520 1469 520 1470 518 1495 493 1496 493 1495 494 500 519 475 520 474 520 1469 519 1469 520 1469 519 474 520 474 520 475 519 477 517 500 494 1496 493 1496 493 1496 493 500 495 1495 519 475 518 475 519 475 518 476 518 475 519 1470 519 500 494 500 494 501 493 501 493 501 493 1499 490 1497 493 1497 492 1496 518 +# +# Model: Fujitsu ASYG24KMTB +# +name: Dh +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 3302 1639 405 423 407 420 410 1234 405 421 409 1210 440 387 432 420 410 417 413 1231 408 1238 412 388 431 422 408 392 438 1233 406 1238 412 389 430 396 434 419 411 390 440 413 406 394 436 391 439 388 431 421 409 417 413 414 405 421 409 392 438 1233 406 421 409 417 413 414 405 395 435 418 412 388 432 421 409 1236 414 387 432 420 410 390 440 388 431 1213 437 1208 431 1239 411 1234 405 1213 437 1208 431 1214 436 1235 415 386 433 420 410 1234 405 422 408 418 412 389 431 396 434 1211 439 388 432 422 408 418 412 1233 406 1238 412 415 404 422 408 1237 413 388 432 422 408 1236 414 1205 434 1210 440 1205 434 392 438 390 440 1231 408 392 438 415 404 396 434 392 438 415 404 422 408 419 411 416 414 412 407 394 436 417 413 414 405 421 409 417 413 1232 407 419 411 390 440 1204 435 418 412 415 415 412 407 419 411 1208 431 421 409 418 412 388 432 421 409 392 438 415 404 395 435 1211 439 388 432 1213 437 416 414 386 433 1212 438 415 404 396 434 392 438 416 414 413 406 420 410 417 413 1231 409 418 412 389 430 1240 410 391 439 1205 434 420 410 390 440 387 432 420 410 417 413 +# +name: Cool_hi +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 3293 1649 405 396 434 419 411 1207 432 395 435 1236 414 413 406 394 436 417 413 1232 407 1212 438 415 404 396 434 419 411 1234 405 1239 411 417 413 414 405 421 409 419 411 389 430 423 407 393 437 416 414 387 432 394 436 417 413 388 431 421 409 1236 414 387 432 421 409 418 412 414 405 422 408 418 412 415 404 1240 410 391 439 414 405 421 409 419 411 1234 405 1239 411 1208 431 1239 411 1235 404 1214 436 1210 440 1205 434 419 411 416 414 1204 435 418 412 415 404 396 434 393 437 1235 404 396 434 420 410 416 414 1231 408 1210 440 387 432 421 409 1235 415 414 405 395 435 418 412 1232 407 420 410 1208 431 422 408 1237 413 415 404 396 434 419 411 416 414 413 406 420 410 417 413 414 405 421 409 418 412 415 404 422 408 419 411 416 414 413 406 1238 412 415 404 422 408 1237 413 414 405 421 409 418 412 416 414 1231 408 418 412 415 404 422 408 419 411 416 414 413 406 420 410 1235 404 423 407 420 410 1234 405 422 408 1210 440 414 405 421 409 392 438 415 404 422 408 420 410 417 413 1231 408 419 411 416 414 413 406 1237 413 415 404 1239 411 417 413 1232 407 420 410 417 413 +# +name: Cool_lo +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 3302 1614 440 414 405 421 409 1235 414 413 406 1238 411 415 404 422 408 419 411 1234 405 1240 409 418 412 415 404 422 408 1237 412 1232 407 420 410 417 413 414 405 422 408 419 411 416 414 413 406 420 410 417 413 414 405 421 409 418 412 415 404 1239 410 418 412 415 404 422 408 419 411 416 414 413 406 420 410 1234 405 422 408 419 411 416 414 414 405 1239 411 1207 432 1239 410 1235 414 1230 409 1236 413 1232 407 1237 412 415 415 412 407 1237 412 414 405 422 408 419 411 416 414 1231 408 419 411 416 414 413 406 1238 411 1206 433 421 409 418 412 1206 433 421 409 418 412 1206 433 1238 412 1207 432 1213 436 390 440 1232 407 420 410 417 413 414 405 421 409 418 412 415 404 422 408 419 411 416 414 413 406 421 409 418 412 415 404 422 408 419 411 1233 406 421 409 418 412 1232 407 420 410 418 412 389 430 422 408 1210 440 414 405 395 435 418 412 415 404 423 407 420 410 416 414 414 405 422 408 418 412 415 404 1240 409 1235 414 413 406 420 410 417 413 414 405 422 408 419 411 416 414 1231 408 418 412 415 404 1240 409 1209 440 387 432 1212 437 1234 405 1214 435 1209 440 1204 435 +# +name: Heat_hi +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 3301 1615 439 415 404 422 408 1210 439 414 405 1239 410 416 414 414 405 395 435 1209 440 1205 434 419 411 417 413 414 405 1212 437 1207 432 422 408 419 411 416 414 414 405 421 409 418 412 415 404 422 408 393 437 416 414 413 406 420 410 417 413 1205 434 420 410 417 413 414 405 421 409 418 412 415 404 422 408 1210 439 414 405 422 408 419 411 417 413 1205 434 1236 413 1206 433 1211 438 1207 432 1212 437 1209 440 1204 435 418 412 415 415 1204 435 418 412 415 404 422 408 419 411 1208 441 412 407 420 410 417 413 1205 434 1237 412 414 405 422 408 1210 439 415 404 396 434 419 411 1207 432 1213 436 417 413 1205 434 420 410 417 413 1231 408 419 411 416 414 413 406 421 409 418 412 414 405 422 408 419 411 415 404 424 406 421 409 418 412 415 404 1239 410 417 413 414 405 1239 410 416 414 413 406 422 408 419 411 1233 406 421 409 418 412 415 404 423 407 419 411 416 414 413 406 1238 411 416 414 413 406 421 409 1235 414 1230 409 418 412 415 415 412 407 420 410 417 413 414 405 422 408 1236 413 413 406 421 409 1235 414 1204 435 1210 439 1206 433 1212 437 1207 432 395 435 1236 413 +# +name: Heat_lo +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 3295 1646 408 420 410 390 440 1205 434 393 437 1234 405 421 409 419 411 415 415 1230 409 1210 440 414 405 421 409 418 412 1233 406 1212 437 416 414 413 406 394 436 418 412 415 404 422 408 393 437 416 414 413 406 420 410 417 413 414 405 421 409 1236 413 414 405 421 409 418 412 415 404 423 407 419 411 416 414 1231 408 418 412 415 415 412 407 421 409 1235 414 1204 435 1209 441 1205 434 1210 440 1205 434 1212 437 1207 432 395 435 419 411 1233 406 421 409 418 412 415 404 422 408 1238 411 415 404 396 434 419 411 1234 405 1239 410 417 413 414 405 1213 436 417 413 414 405 1213 436 1235 404 1214 435 1209 441 413 406 421 409 418 412 1206 433 394 436 418 412 388 431 422 408 419 411 415 415 386 433 420 410 418 412 414 405 422 408 419 411 389 430 1241 408 418 412 415 404 1240 409 417 413 414 405 395 435 419 411 1233 406 395 435 418 412 415 404 422 408 419 411 416 414 413 406 421 409 1236 413 413 406 394 436 1235 414 1230 409 418 412 415 404 422 408 420 410 417 413 414 405 421 409 1236 413 413 406 420 410 417 413 1232 407 1237 412 416 414 1230 409 1236 413 1205 434 1210 439 +# +name: Off +type: raw +frequency: 38000 +duty_cycle: 0.330000 +data: 3302 1640 404 423 407 420 410 1212 437 390 440 1234 405 395 435 392 438 415 415 1207 432 1242 407 420 410 391 439 414 405 1243 406 1241 408 392 438 415 415 386 433 393 437 390 440 414 405 396 434 419 411 389 441 412 407 420 410 390 440 387 432 1242 407 393 437 390 440 414 405 395 435 392 438 389 430 396 434 1240 409 417 413 414 405 395 435 419 411 1237 412 389 430 396 434 393 437 416 414 387 432 394 436 1212 437 389 441 1234 405 1217 432 1241 408 1213 436 1212 437 1210 439 From acc39a4bc02407b233ed9500ae01dbcc1819115d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Tue, 19 Mar 2024 23:43:52 +0900 Subject: [PATCH 02/28] Api Symbols: replace asserts with checks (#3507) * Api Symbols: replace asserts with checks * Api Symbols: replace asserts with checks part 2 * Update no args function signatures with void, to help compiler to track incorrect usage * More unavoidable void * Update PVS config and code to make it happy * Format sources * nfc: fix checks * dead code cleanup & include fixes Co-authored-by: gornekich Co-authored-by: hedger Co-authored-by: hedger --- .pvsconfig | 9 +- applications/debug/accessor/accessor_app.h | 20 +-- .../debug/accessor/accessor_view_manager.h | 8 +- applications/debug/accessor/helpers/wiegand.h | 20 +-- .../debug/battery_test_app/battery_test_app.c | 2 +- .../battery_test_app/views/battery_info.c | 2 +- .../battery_test_app/views/battery_info.h | 2 +- .../debug/bt_debug_app/bt_debug_app.c | 2 +- .../bt_debug_app/views/bt_carrier_test.c | 2 +- .../bt_debug_app/views/bt_carrier_test.h | 2 +- .../debug/bt_debug_app/views/bt_packet_test.c | 2 +- .../debug/bt_debug_app/views/bt_packet_test.h | 2 +- .../debug/bt_debug_app/views/bt_test.c | 2 +- .../debug/bt_debug_app/views/bt_test.h | 2 +- applications/debug/ccid_test/ccid_test_app.c | 2 +- applications/debug/crash_test/crash_test.c | 4 +- applications/debug/direct_draw/direct_draw.c | 2 +- .../debug/display_test/display_test.c | 2 +- .../debug/display_test/view_display_test.c | 2 +- .../debug/display_test/view_display_test.h | 2 +- .../debug/expansion_test/expansion_test.c | 2 +- .../debug/lfrfid_debug/lfrfid_debug.c | 2 +- .../views/lfrfid_debug_view_tune.c | 2 +- .../views/lfrfid_debug_view_tune.h | 2 +- applications/debug/locale_test/locale_test.c | 2 +- .../debug/rpc_debug_app/rpc_debug_app.c | 2 +- .../debug/speaker_debug/speaker_debug.c | 2 +- .../protocol/princeton_for_testing.c | 2 +- .../protocol/princeton_for_testing.h | 4 +- .../debug/subghz_test/subghz_test_app.c | 2 +- .../subghz_test/views/subghz_test_carrier.c | 2 +- .../subghz_test/views/subghz_test_carrier.h | 2 +- .../subghz_test/views/subghz_test_packet.c | 2 +- .../subghz_test/views/subghz_test_packet.h | 2 +- .../subghz_test/views/subghz_test_static.c | 2 +- .../subghz_test/views/subghz_test_static.h | 2 +- .../debug/unit_tests/bit_lib/bit_lib_test.c | 2 +- applications/debug/unit_tests/bt/bt_test.c | 10 +- .../unit_tests/datetimelib/datetimelib_test.c | 2 +- .../dialogs/dialogs_file_browser_options.c | 2 +- .../unit_tests/expansion/expansion_test.c | 2 +- .../flipper_format_string_test.c | 2 +- .../flipper_format/flipper_format_test.c | 6 +- .../unit_tests/float_tools/float_tools_test.c | 2 +- .../debug/unit_tests/furi/furi_memmgr_test.c | 2 +- .../debug/unit_tests/furi/furi_pubsub_test.c | 2 +- .../debug/unit_tests/furi/furi_record_test.c | 2 +- .../debug/unit_tests/furi/furi_string_test.c | 2 +- .../debug/unit_tests/furi/furi_test.c | 2 +- .../furi_hal/furi_hal_crypto_tests.c | 10 +- .../unit_tests/furi_hal/furi_hal_tests.c | 10 +- .../debug/unit_tests/infrared/infrared_test.c | 6 +- .../unit_tests/lfrfid/lfrfid_protocols.c | 2 +- .../debug/unit_tests/manifest/manifest.c | 2 +- applications/debug/unit_tests/nfc/nfc_test.c | 14 +- .../debug/unit_tests/nfc/nfc_transport.c | 2 +- .../debug/unit_tests/power/power_test.c | 2 +- .../protocol_dict/protocol_dict_test.c | 6 +- applications/debug/unit_tests/rpc/rpc_test.c | 2 +- .../debug/unit_tests/storage/dirwalk_test.c | 2 +- .../debug/unit_tests/storage/storage_test.c | 6 +- .../debug/unit_tests/stream/stream_test.c | 2 +- .../debug/unit_tests/subghz/subghz_test.c | 4 +- applications/debug/unit_tests/test_index.c | 4 +- .../debug/unit_tests/varint/varint_test.c | 2 +- applications/debug/usb_test/usb_test.c | 2 +- .../drivers/subghz/cc1101_ext/cc1101_ext.c | 46 +++---- .../drivers/subghz/cc1101_ext/cc1101_ext.h | 40 +++--- .../cc1101_ext/cc1101_ext_interconnect.c | 2 +- .../cc1101_ext/cc1101_ext_interconnect.h | 2 +- .../example_ble_beacon/ble_beacon_app.c | 2 +- .../examples/example_plugins/plugin1.c | 4 +- .../examples/example_plugins/plugin2.c | 4 +- .../example_plugins/plugin_interface.h | 2 +- .../example_plugins_advanced/app_api.c | 2 +- .../example_plugins_advanced/app_api.h | 2 +- .../example_plugins_advanced/plugin1.c | 4 +- .../example_plugins_advanced/plugin2.c | 4 +- .../plugin_interface.h | 2 +- .../examples/example_thermo/example_thermo.c | 2 +- applications/main/archive/archive.c | 2 +- .../main/archive/helpers/archive_favorites.c | 2 +- .../main/archive/views/archive_browser_view.c | 2 +- .../main/archive/views/archive_browser_view.h | 2 +- .../main/bad_usb/helpers/ducky_script.c | 2 +- .../main/bad_usb/views/bad_usb_view.c | 2 +- .../main/bad_usb/views/bad_usb_view.h | 2 +- applications/main/gpio/gpio_app.c | 2 +- applications/main/gpio/gpio_items.c | 2 +- applications/main/gpio/gpio_items.h | 2 +- applications/main/gpio/views/gpio_usb_uart.c | 2 +- applications/main/gpio/views/gpio_usb_uart.h | 2 +- applications/main/ibutton/ibutton.c | 2 +- applications/main/ibutton/ibutton_cli.c | 4 +- applications/main/infrared/infrared_app.c | 2 +- .../main/infrared/infrared_brute_force.c | 2 +- .../main/infrared/infrared_brute_force.h | 2 +- applications/main/infrared/infrared_cli.c | 2 +- applications/main/infrared/infrared_remote.c | 2 +- applications/main/infrared/infrared_remote.h | 2 +- applications/main/infrared/infrared_signal.c | 2 +- applications/main/infrared/infrared_signal.h | 2 +- .../main/infrared/views/infrared_debug_view.c | 2 +- .../main/infrared/views/infrared_debug_view.h | 2 +- .../infrared/views/infrared_progress_view.h | 2 +- applications/main/lfrfid/lfrfid.c | 2 +- applications/main/lfrfid/lfrfid_cli.c | 4 +- .../main/lfrfid/views/lfrfid_view_read.c | 2 +- .../main/lfrfid/views/lfrfid_view_read.h | 2 +- .../main/nfc/helpers/mf_classic_key_cache.c | 2 +- .../main/nfc/helpers/mf_classic_key_cache.h | 2 +- .../main/nfc/helpers/mf_ultralight_auth.c | 2 +- .../main/nfc/helpers/mf_ultralight_auth.h | 2 +- .../main/nfc/helpers/nfc_supported_cards.c | 4 +- .../main/nfc/helpers/nfc_supported_cards.h | 2 +- applications/main/nfc/helpers/slix_unlock.c | 2 +- applications/main/nfc/helpers/slix_unlock.h | 2 +- applications/main/nfc/nfc_app.c | 4 +- applications/main/nfc/nfc_cli.c | 4 +- .../main/nfc/plugins/supported_cards/aime.c | 2 +- .../nfc/plugins/supported_cards/all_in_one.c | 2 +- .../main/nfc/plugins/supported_cards/bip.c | 2 +- .../nfc/plugins/supported_cards/clipper.c | 2 +- .../nfc/plugins/supported_cards/gallagher.c | 2 +- .../main/nfc/plugins/supported_cards/hi.c | 2 +- .../main/nfc/plugins/supported_cards/hid.c | 2 +- .../main/nfc/plugins/supported_cards/itso.c | 2 +- .../nfc/plugins/supported_cards/microel.c | 2 +- .../main/nfc/plugins/supported_cards/mizip.c | 2 +- .../main/nfc/plugins/supported_cards/mykey.c | 2 +- .../main/nfc/plugins/supported_cards/myki.c | 2 +- .../main/nfc/plugins/supported_cards/opal.c | 2 +- .../nfc/plugins/supported_cards/plantain.c | 2 +- .../main/nfc/plugins/supported_cards/troika.c | 2 +- .../nfc/plugins/supported_cards/two_cities.c | 2 +- .../main/nfc/plugins/supported_cards/umarsh.c | 2 +- .../nfc/plugins/supported_cards/washcity.c | 2 +- applications/main/nfc/views/detect_reader.c | 2 +- applications/main/nfc/views/detect_reader.h | 2 +- applications/main/nfc/views/dict_attack.c | 2 +- applications/main/nfc/views/dict_attack.h | 2 +- applications/main/onewire/onewire_cli.c | 4 +- .../main/subghz/helpers/subghz_txrx.c | 2 +- .../main/subghz/helpers/subghz_txrx.h | 2 +- applications/main/subghz/subghz.c | 2 +- applications/main/subghz/subghz_cli.c | 8 +- applications/main/subghz/subghz_cli.h | 2 +- applications/main/subghz/views/receiver.c | 2 +- applications/main/subghz/views/receiver.h | 2 +- .../subghz/views/subghz_frequency_analyzer.c | 2 +- .../subghz/views/subghz_frequency_analyzer.h | 2 +- .../main/subghz/views/subghz_read_raw.c | 2 +- .../main/subghz/views/subghz_read_raw.h | 2 +- applications/main/subghz/views/transmitter.c | 2 +- applications/main/subghz/views/transmitter.h | 2 +- applications/main/u2f/u2f.c | 2 +- applications/main/u2f/u2f.h | 2 +- applications/main/u2f/u2f_app.c | 2 +- applications/main/u2f/u2f_data.c | 2 +- applications/main/u2f/u2f_data.h | 2 +- applications/main/u2f/views/u2f_view.c | 2 +- applications/main/u2f/views/u2f_view.h | 2 +- applications/services/bt/bt_cli.c | 4 +- applications/services/bt/bt_service/bt.c | 2 +- applications/services/bt/bt_service/bt_api.c | 18 +-- applications/services/cli/cli.c | 30 +++-- applications/services/cli/cli.h | 2 +- applications/services/cli/cli_command_gpio.c | 2 +- applications/services/cli/cli_commands.c | 4 +- applications/services/cli/cli_i.h | 2 +- applications/services/cli/cli_vcp.c | 4 +- applications/services/crypto/crypto_cli.c | 4 +- applications/services/desktop/desktop.c | 2 +- applications/services/desktop/desktop_i.h | 2 +- applications/services/desktop/helpers/pin.c | 4 +- applications/services/desktop/helpers/pin.h | 4 +- .../services/desktop/helpers/slideshow.c | 2 +- .../services/desktop/helpers/slideshow.h | 2 +- .../desktop/views/desktop_view_debug.c | 2 +- .../desktop/views/desktop_view_debug.h | 2 +- .../desktop/views/desktop_view_lock_menu.c | 2 +- .../desktop/views/desktop_view_lock_menu.h | 2 +- .../desktop/views/desktop_view_locked.c | 2 +- .../desktop/views/desktop_view_locked.h | 2 +- .../desktop/views/desktop_view_main.c | 2 +- .../desktop/views/desktop_view_main.h | 2 +- .../desktop/views/desktop_view_slideshow.c | 2 +- .../desktop/views/desktop_view_slideshow.h | 2 +- applications/services/dialogs/dialogs.c | 3 +- applications/services/dialogs/dialogs.h | 2 +- applications/services/dialogs/dialogs_api.c | 4 + .../services/dialogs/dialogs_module_message.c | 11 +- applications/services/dolphin/dolphin.c | 9 +- applications/services/dolphin/dolphin_i.h | 2 +- .../services/dolphin/helpers/dolphin_state.c | 4 +- .../services/dolphin/helpers/dolphin_state.h | 4 +- applications/services/expansion/expansion.c | 2 +- applications/services/gui/canvas.c | 92 ++++++------- applications/services/gui/canvas_i.h | 2 +- applications/services/gui/elements.c | 53 +++++--- applications/services/gui/gui.c | 33 ++--- applications/services/gui/icon.c | 7 + applications/services/gui/icon_animation.c | 26 ++-- .../services/gui/modules/button_menu.c | 14 +- .../services/gui/modules/button_panel.c | 14 +- .../services/gui/modules/byte_input.c | 10 +- .../services/gui/modules/byte_input.h | 2 +- applications/services/gui/modules/dialog_ex.c | 28 ++-- applications/services/gui/modules/dialog_ex.h | 2 +- .../services/gui/modules/empty_screen.c | 6 +- .../services/gui/modules/empty_screen.h | 2 +- .../services/gui/modules/file_browser.c | 34 ++--- .../gui/modules/file_browser_worker.c | 28 ++-- applications/services/gui/modules/loading.c | 5 +- applications/services/gui/modules/loading.h | 2 +- applications/services/gui/modules/menu.c | 18 ++- applications/services/gui/modules/menu.h | 2 +- applications/services/gui/modules/popup.c | 28 ++-- applications/services/gui/modules/popup.h | 2 +- applications/services/gui/modules/submenu.c | 15 ++- applications/services/gui/modules/submenu.h | 2 +- applications/services/gui/modules/text_box.c | 16 +-- applications/services/gui/modules/text_box.h | 2 +- .../services/gui/modules/text_input.c | 13 +- .../services/gui/modules/text_input.h | 2 +- .../services/gui/modules/validators.c | 4 +- .../services/gui/modules/variable_item_list.c | 21 ++- .../services/gui/modules/variable_item_list.h | 2 +- applications/services/gui/modules/widget.c | 24 ++-- applications/services/gui/modules/widget.h | 2 +- applications/services/gui/scene_manager.c | 38 +++--- applications/services/gui/view.c | 56 ++++---- applications/services/gui/view.h | 2 +- applications/services/gui/view_dispatcher.c | 62 ++++----- applications/services/gui/view_dispatcher.h | 2 +- applications/services/gui/view_holder.c | 2 +- applications/services/gui/view_holder.h | 2 +- applications/services/gui/view_port.c | 36 ++--- applications/services/gui/view_port.h | 2 +- applications/services/input/input_cli.c | 4 +- applications/services/loader/loader.c | 23 +++- .../services/loader/loader_applications.c | 2 +- applications/services/loader/loader_cli.c | 6 +- applications/services/locale/locale.c | 10 +- applications/services/locale/locale.h | 4 +- .../services/notification/notification_app.c | 6 +- .../notification/notification_app_api.c | 12 ++ applications/services/power/power_cli.c | 4 +- applications/services/power/power_cli.h | 2 +- .../services/power/power_service/power.c | 2 +- .../services/power/power_service/power_api.c | 15 ++- .../power/power_service/views/power_off.c | 2 +- .../power/power_service/views/power_off.h | 2 +- .../power_service/views/power_unplug_usb.c | 2 +- .../power_service/views/power_unplug_usb.h | 2 +- applications/services/rpc/rpc.c | 24 ++-- applications/services/rpc/rpc_app.c | 20 +-- .../services/storage/filesystem_api.c | 2 + applications/services/storage/storage.c | 2 +- applications/services/storage/storage_cli.c | 4 +- .../services/storage/storage_external_api.c | 72 +++++++++- .../services/storage/storage_internal_api.c | 4 + .../services/storage/storages/storage_int.c | 6 +- .../bt_settings_app/bt_settings_app.c | 2 +- .../desktop_settings/desktop_settings_app.c | 2 +- .../desktop_settings_view_pin_setup_howto.c | 2 +- .../desktop_settings_view_pin_setup_howto.h | 2 +- .../desktop_settings_view_pin_setup_howto2.c | 2 +- .../desktop_settings_view_pin_setup_howto2.h | 2 +- .../expansion_settings_app.c | 2 +- .../notification_settings_app.c | 2 +- .../power_settings_app/views/battery_info.c | 2 +- .../power_settings_app/views/battery_info.h | 2 +- .../storage_settings/storage_settings.c | 2 +- .../settings/system/system_settings.c | 2 +- applications/system/hid_app/hid.c | 2 +- applications/system/hid_app/views/hid_media.h | 4 +- .../storage_move_to_sd/storage_move_to_sd.c | 2 +- applications/system/updater/cli/updater_cli.c | 2 +- .../updater/scenes/updater_scene_main.c | 2 +- .../system/updater/util/update_task.c | 2 +- .../system/updater/util/update_task.h | 2 +- .../system/updater/views/updater_main.c | 2 +- .../system/updater/views/updater_main.h | 2 +- furi/core/check.c | 12 +- furi/core/check.h | 9 +- furi/core/common_defines.h | 4 + furi/core/event_flag.c | 22 +-- furi/core/event_flag.h | 2 +- furi/core/kernel.c | 22 +-- furi/core/kernel.h | 10 +- furi/core/log.c | 4 +- furi/core/memmgr_heap.c | 8 +- furi/core/memmgr_heap.h | 4 +- furi/core/message_queue.c | 55 ++++---- furi/core/mutex.c | 14 +- furi/core/pubsub.c | 7 +- furi/core/pubsub.h | 2 +- furi/core/record.c | 30 +++-- furi/core/record.h | 2 +- furi/core/semaphore.c | 14 +- furi/core/stream_buffer.c | 21 ++- furi/core/string.c | 2 +- furi/core/string.h | 2 +- furi/core/thread.c | 126 ++++++++++-------- furi/core/thread.h | 14 +- furi/core/timer.c | 35 ++--- furi/flipper.c | 2 +- furi/flipper.h | 2 +- furi/furi.c | 12 +- furi/furi.h | 4 +- lib/app-scened-template/text_store.h | 2 +- .../view_modules/byte_input_vm.h | 2 +- .../view_modules/dialog_ex_vm.h | 2 +- .../view_modules/popup_vm.h | 6 +- .../view_modules/submenu_vm.h | 2 +- .../view_modules/text_input_vm.h | 4 +- lib/bit_lib/bit_lib.c | 20 +-- lib/ble_profile/extra_services/hid_service.c | 2 +- lib/ble_profile/extra_services/hid_service.h | 2 +- lib/datetime/datetime.c | 4 + lib/digital_signal/digital_sequence.c | 24 ++-- lib/digital_signal/digital_signal.c | 14 +- lib/drivers/st25r3916_reg.c | 74 +++++----- .../api_hashtable/api_hashtable.cpp | 5 + .../application_manifest.c | 11 ++ lib/flipper_application/flipper_application.c | 32 ++++- .../plugins/composite_resolver.c | 11 +- .../plugins/composite_resolver.h | 2 +- .../plugins/plugin_manager.c | 10 ++ lib/flipper_format/flipper_format.c | 66 ++++----- lib/flipper_format/flipper_format.h | 2 +- lib/ibutton/ibutton_key.c | 9 ++ lib/ibutton/ibutton_protocols.c | 65 ++++++++- lib/ibutton/ibutton_protocols.h | 4 +- lib/ibutton/ibutton_worker.c | 34 +++++ .../protocols/dallas/protocol_group_dallas.c | 2 +- .../protocols/misc/protocol_group_misc.c | 2 +- lib/infrared/encoder_decoder/infrared.c | 47 ++++--- lib/infrared/worker/infrared_transmit.c | 12 +- lib/infrared/worker/infrared_worker.c | 77 ++++++----- lib/infrared/worker/infrared_worker.h | 2 +- lib/lfrfid/lfrfid_dict_file.c | 6 + lib/lfrfid/lfrfid_raw_file.c | 24 ++++ lib/lfrfid/lfrfid_raw_worker.c | 17 ++- lib/lfrfid/lfrfid_raw_worker.h | 2 +- lib/lfrfid/lfrfid_worker.c | 28 +++- lib/lfrfid/tools/t5577.c | 6 +- lib/lfrfid/tools/varint_pair.c | 2 +- lib/lfrfid/tools/varint_pair.h | 2 +- lib/music_worker/music_worker.c | 2 +- lib/music_worker/music_worker.h | 2 +- lib/nfc/helpers/iso13239_crc.c | 6 + lib/nfc/helpers/iso14443_4_layer.c | 2 +- lib/nfc/helpers/iso14443_4_layer.h | 2 +- lib/nfc/helpers/iso14443_crc.c | 7 +- lib/nfc/helpers/nfc_data_generator.c | 5 + lib/nfc/helpers/nfc_util.c | 4 +- lib/nfc/nfc.c | 82 ++++++------ lib/nfc/nfc.h | 2 +- lib/nfc/nfc_device.c | 64 ++++----- lib/nfc/nfc_device.h | 2 +- lib/nfc/nfc_listener.c | 20 +-- lib/nfc/nfc_poller.c | 30 ++--- lib/nfc/nfc_scanner.c | 17 +-- lib/nfc/protocols/felica/felica.c | 2 +- lib/nfc/protocols/felica/felica.h | 2 +- lib/nfc/protocols/iso14443_3a/iso14443_3a.c | 44 +++--- lib/nfc/protocols/iso14443_3a/iso14443_3a.h | 2 +- .../iso14443_3a/iso14443_3a_poller_i.c | 36 ++--- .../iso14443_3a/iso14443_3a_poller_sync.c | 4 +- lib/nfc/protocols/iso14443_3b/iso14443_3b.c | 41 +++--- lib/nfc/protocols/iso14443_3b/iso14443_3b.h | 2 +- .../iso14443_3b/iso14443_3b_poller_i.c | 11 +- lib/nfc/protocols/iso14443_4a/iso14443_4a.c | 38 +++--- lib/nfc/protocols/iso14443_4a/iso14443_4a.h | 2 +- .../iso14443_4a/iso14443_4a_poller_i.c | 9 +- lib/nfc/protocols/iso14443_4b/iso14443_4b.c | 27 ++-- lib/nfc/protocols/iso14443_4b/iso14443_4b.h | 2 +- .../iso14443_4b/iso14443_4b_poller_i.c | 6 +- lib/nfc/protocols/iso15693_3/iso15693_3.c | 47 ++++--- lib/nfc/protocols/iso15693_3/iso15693_3.h | 2 +- .../iso15693_3/iso15693_3_poller_i.c | 2 + lib/nfc/protocols/mf_classic/crypto1.c | 2 +- lib/nfc/protocols/mf_classic/crypto1.h | 2 +- lib/nfc/protocols/mf_classic/mf_classic.c | 76 ++++++----- lib/nfc/protocols/mf_classic/mf_classic.h | 2 +- .../mf_classic/mf_classic_poller_i.c | 20 +++ .../mf_classic/mf_classic_poller_sync.c | 40 +++--- lib/nfc/protocols/mf_desfire/mf_desfire.c | 41 ++++-- lib/nfc/protocols/mf_desfire/mf_desfire.h | 2 +- .../mf_desfire/mf_desfire_poller_i.c | 60 +++++---- .../protocols/mf_ultralight/mf_ultralight.c | 52 +++++--- .../protocols/mf_ultralight/mf_ultralight.h | 2 +- .../mf_ultralight/mf_ultralight_poller_i.c | 26 ++++ .../mf_ultralight/mf_ultralight_poller_sync.c | 28 ++-- lib/nfc/protocols/nfc_device_base_i.h | 2 +- lib/nfc/protocols/nfc_protocol.c | 6 +- lib/nfc/protocols/slix/slix.c | 47 ++++--- lib/nfc/protocols/slix/slix.h | 2 +- lib/nfc/protocols/st25tb/st25tb.c | 36 +++-- lib/nfc/protocols/st25tb/st25tb.h | 2 +- lib/nfc/protocols/st25tb/st25tb_poller_i.c | 33 ++--- lib/nfc/protocols/st25tb/st25tb_poller_sync.c | 11 +- lib/one_wire/maxim_crc.c | 3 + lib/one_wire/one_wire_host.c | 33 +++++ lib/one_wire/one_wire_slave.c | 20 +++ lib/signal_reader/signal_reader.c | 20 +-- lib/subghz/blocks/encoder.c | 4 +- lib/subghz/blocks/generic.c | 6 +- lib/subghz/devices/devices.c | 54 ++++---- lib/subghz/devices/devices.h | 2 +- lib/subghz/environment.c | 30 ++--- lib/subghz/environment.h | 2 +- lib/subghz/protocols/base.c | 12 ++ lib/subghz/protocols/bin_raw.c | 2 +- lib/subghz/protocols/keeloq.c | 2 +- lib/subghz/protocols/raw.c | 29 ++-- lib/subghz/protocols/secplus_v2.c | 3 +- lib/subghz/receiver.c | 16 ++- lib/subghz/registry.c | 6 +- lib/subghz/subghz_file_encoder_worker.c | 2 +- lib/subghz/subghz_file_encoder_worker.h | 2 +- lib/subghz/subghz_keystore.c | 2 +- lib/subghz/subghz_keystore.h | 2 +- lib/subghz/subghz_setting.c | 36 ++--- lib/subghz/subghz_tx_rx_worker.c | 30 ++--- lib/subghz/subghz_tx_rx_worker.h | 2 +- lib/subghz/subghz_worker.c | 22 +-- lib/subghz/subghz_worker.h | 2 +- lib/subghz/transmitter.c | 8 +- lib/toolbox/bit_buffer.c | 124 ++++++++--------- lib/toolbox/compress.c | 14 +- lib/toolbox/compress.h | 2 +- lib/toolbox/dir_walk.c | 10 ++ lib/toolbox/hex.c | 15 +++ lib/toolbox/keys_dict.c | 52 ++++---- lib/toolbox/manchester_encoder.c | 11 +- lib/toolbox/name_generator.c | 10 +- lib/toolbox/path.c | 22 +++ lib/toolbox/pretty_format.c | 2 +- lib/toolbox/profiler.c | 2 +- lib/toolbox/profiler.h | 2 +- lib/toolbox/property.c | 2 +- lib/toolbox/protocols/protocol_dict.c | 47 ++++--- lib/toolbox/pulse_joiner.c | 2 +- lib/toolbox/pulse_joiner.h | 2 +- lib/toolbox/pulse_protocols/pulse_glue.c | 2 +- lib/toolbox/pulse_protocols/pulse_glue.h | 2 +- lib/toolbox/saved_struct.c | 10 +- lib/toolbox/simple_array.c | 30 +++-- lib/toolbox/stream/buffered_file_stream.c | 10 +- lib/toolbox/stream/file_stream.c | 8 +- lib/toolbox/stream/stream.c | 83 +++++++----- lib/toolbox/stream/stream_cache.c | 2 +- lib/toolbox/stream/stream_cache.h | 2 +- lib/toolbox/stream/string_stream.c | 2 +- lib/toolbox/stream/string_stream.h | 2 +- lib/toolbox/tar/tar_archive.c | 32 ++--- lib/update_util/update_manifest.c | 2 +- lib/update_util/update_manifest.h | 2 +- lib/update_util/update_operation.c | 4 +- lib/update_util/update_operation.h | 4 +- targets/f18/api_symbols.csv | 4 +- targets/f18/furi_hal/furi_hal.c | 6 +- targets/f18/furi_hal/furi_hal_resources.c | 6 +- targets/f18/furi_hal/furi_hal_resources.h | 6 +- targets/f18/furi_hal/furi_hal_spi_config.c | 6 +- .../f18/furi_hal/furi_hal_version_device.c | 16 +-- targets/f7/api_symbols.csv | 4 +- targets/f7/ble_glue/app_debug.c | 2 +- targets/f7/ble_glue/ble_glue.c | 4 +- targets/f7/ble_glue/ble_glue.h | 2 +- targets/f7/ble_glue/extra_beacon.c | 10 +- targets/f7/ble_glue/extra_beacon.h | 10 +- targets/f7/ble_glue/furi_ble/gatt.c | 4 +- targets/f7/ble_glue/hw_ipcc.c | 32 ++--- .../f7/ble_glue/services/battery_service.c | 2 +- .../f7/ble_glue/services/dev_info_service.c | 2 +- targets/f7/ble_glue/services/serial_service.c | 8 +- targets/f7/fatfs/fatfs.c | 2 +- targets/f7/fatfs/sector_cache.c | 2 +- targets/f7/fatfs/sector_cache.h | 2 +- targets/f7/furi_hal/furi_hal.c | 6 +- targets/f7/furi_hal/furi_hal_bt.c | 64 ++++----- targets/f7/furi_hal/furi_hal_bus.c | 4 +- targets/f7/furi_hal/furi_hal_bus.h | 4 +- targets/f7/furi_hal/furi_hal_clock.c | 20 +-- targets/f7/furi_hal/furi_hal_clock.h | 20 +-- targets/f7/furi_hal/furi_hal_cortex.c | 4 +- targets/f7/furi_hal/furi_hal_crypto.c | 20 +-- targets/f7/furi_hal/furi_hal_debug.c | 6 +- targets/f7/furi_hal/furi_hal_dma.c | 4 +- targets/f7/furi_hal/furi_hal_dma.h | 4 +- targets/f7/furi_hal/furi_hal_flash.c | 30 ++--- targets/f7/furi_hal/furi_hal_flash.h | 24 ++-- targets/f7/furi_hal/furi_hal_gpio.c | 12 +- targets/f7/furi_hal/furi_hal_i2c.c | 14 +- targets/f7/furi_hal/furi_hal_ibutton.c | 14 +- targets/f7/furi_hal/furi_hal_ibutton.h | 8 +- targets/f7/furi_hal/furi_hal_infrared.c | 70 +++++----- targets/f7/furi_hal/furi_hal_interrupt.c | 70 +++++----- targets/f7/furi_hal/furi_hal_interrupt.h | 2 +- targets/f7/furi_hal/furi_hal_light.c | 12 +- targets/f7/furi_hal/furi_hal_memory.c | 6 +- targets/f7/furi_hal/furi_hal_mpu.c | 6 +- targets/f7/furi_hal/furi_hal_nfc.c | 78 +++++------ targets/f7/furi_hal/furi_hal_nfc_event.c | 22 +-- targets/f7/furi_hal/furi_hal_nfc_felica.c | 3 + targets/f7/furi_hal/furi_hal_nfc_i.h | 10 +- targets/f7/furi_hal/furi_hal_nfc_irq.c | 4 +- targets/f7/furi_hal/furi_hal_nfc_iso14443a.c | 15 +-- targets/f7/furi_hal/furi_hal_nfc_iso15693.c | 26 ++-- targets/f7/furi_hal/furi_hal_nfc_timer.c | 10 +- targets/f7/furi_hal/furi_hal_os.c | 10 +- targets/f7/furi_hal/furi_hal_os.h | 4 +- targets/f7/furi_hal/furi_hal_power.c | 80 +++++------ targets/f7/furi_hal/furi_hal_pwm.c | 9 +- targets/f7/furi_hal/furi_hal_random.c | 13 +- targets/f7/furi_hal/furi_hal_region.c | 11 +- targets/f7/furi_hal/furi_hal_resources.c | 6 +- targets/f7/furi_hal/furi_hal_resources.h | 6 +- targets/f7/furi_hal/furi_hal_rfid.c | 42 +++--- targets/f7/furi_hal/furi_hal_rfid.h | 26 ++-- targets/f7/furi_hal/furi_hal_rtc.c | 42 +++--- targets/f7/furi_hal/furi_hal_rtc.h | 2 +- targets/f7/furi_hal/furi_hal_sd.c | 22 +-- targets/f7/furi_hal/furi_hal_serial.c | 7 +- targets/f7/furi_hal/furi_hal_speaker.c | 10 +- targets/f7/furi_hal/furi_hal_spi.c | 47 +++---- targets/f7/furi_hal/furi_hal_spi_config.c | 6 +- targets/f7/furi_hal/furi_hal_subghz.c | 73 ++++++---- targets/f7/furi_hal/furi_hal_subghz.h | 36 ++--- targets/f7/furi_hal/furi_hal_usb.c | 16 +-- targets/f7/furi_hal/furi_hal_usb_ccid.c | 20 +-- targets/f7/furi_hal/furi_hal_usb_cdc.c | 6 +- targets/f7/furi_hal/furi_hal_usb_hid.c | 6 +- targets/f7/furi_hal/furi_hal_usb_u2f.c | 2 +- targets/f7/furi_hal/furi_hal_version.c | 42 +++--- targets/f7/furi_hal/furi_hal_version_device.c | 16 +-- targets/f7/furi_hal/furi_hal_vibro.c | 2 +- targets/f7/inc/FreeRTOSConfig.h | 2 +- targets/f7/inc/alt_boot.h | 6 +- .../f7/platform_specific/cxx_virtual_stub.c | 2 +- .../f7/platform_specific/cxx_virtual_stub.h | 2 +- targets/f7/src/dfu.c | 4 +- targets/f7/src/main.c | 4 +- targets/f7/src/recovery.c | 2 +- targets/f7/src/update.c | 6 +- targets/furi_hal_include/furi_hal.h | 6 +- targets/furi_hal_include/furi_hal_bt.h | 48 +++---- targets/furi_hal_include/furi_hal_cortex.h | 4 +- targets/furi_hal_include/furi_hal_crypto.h | 2 +- targets/furi_hal_include/furi_hal_debug.h | 6 +- targets/furi_hal_include/furi_hal_i2c.h | 6 +- targets/furi_hal_include/furi_hal_light.h | 4 +- targets/furi_hal_include/furi_hal_memory.h | 6 +- targets/furi_hal_include/furi_hal_mpu.h | 6 +- targets/furi_hal_include/furi_hal_nfc.h | 44 +++--- targets/furi_hal_include/furi_hal_power.h | 59 ++++---- targets/furi_hal_include/furi_hal_random.h | 4 +- targets/furi_hal_include/furi_hal_region.h | 8 +- targets/furi_hal_include/furi_hal_sd.h | 8 +- targets/furi_hal_include/furi_hal_speaker.h | 10 +- targets/furi_hal_include/furi_hal_spi.h | 8 +- targets/furi_hal_include/furi_hal_usb.h | 16 +-- targets/furi_hal_include/furi_hal_usb_ccid.h | 4 +- targets/furi_hal_include/furi_hal_usb_hid.h | 6 +- .../furi_hal_include/furi_hal_usb_hid_u2f.h | 2 +- targets/furi_hal_include/furi_hal_version.h | 52 ++++---- targets/furi_hal_include/furi_hal_vibro.h | 2 +- 571 files changed, 3565 insertions(+), 2704 deletions(-) diff --git a/.pvsconfig b/.pvsconfig index 49c63ad7398..b6001ca5c02 100644 --- a/.pvsconfig +++ b/.pvsconfig @@ -1,10 +1,10 @@ # MLib macros we can't do much about. //-V:M_LET:1048,1044 //-V:M_EACH:1048,1044 -//-V:ARRAY_DEF:760,747,568,776,729,712,654 -//-V:LIST_DEF:760,747,568,712,729,654,776 +//-V:ARRAY_DEF:760,747,568,776,729,712,654,1103 +//-V:LIST_DEF:760,747,568,712,729,654,776,1103 //-V:BPTREE_DEF2:779,1086,557,773,512 -//-V:DICT_DEF2:779,524,776,760,1044,1001,729,590,568,747,685 +//-V:DICT_DEF2:779,524,776,760,1044,1001,729,590,568,747,685,1103 //-V:ALGO_DEF:1048,747,1044 //-V:TUPLE_DEF2:524,590,1001,760 @@ -42,8 +42,5 @@ # Model-related warnings //-V:with_view_model:1044,1048 -# Functions that always return the same error code -//-V:picopass_device_decrypt:1048 - # Examples //V_EXCLUDE_PATH applications/examples/ \ No newline at end of file diff --git a/applications/debug/accessor/accessor_app.h b/applications/debug/accessor/accessor_app.h index 2afd796d5a9..bfd5c06e152 100644 --- a/applications/debug/accessor/accessor_app.h +++ b/applications/debug/accessor/accessor_app.h @@ -11,29 +11,29 @@ class AccessorApp { public: void run(void); - AccessorApp(); - ~AccessorApp(); + AccessorApp(void); + ~AccessorApp(void); enum class Scene : uint8_t { Exit, Start, }; - AccessorAppViewManager* get_view_manager(); + AccessorAppViewManager* get_view_manager(void); void switch_to_next_scene(Scene index); void search_and_switch_to_previous_scene(std::initializer_list scenes_list); bool switch_to_previous_scene(uint8_t count = 1); - Scene get_previous_scene(); + Scene get_previous_scene(void); - void notify_green_blink(); - void notify_success(); + void notify_green_blink(void); + void notify_success(void); - char* get_text_store(); - uint8_t get_text_store_size(); + char* get_text_store(void); + uint8_t get_text_store_size(void); void set_text_store(const char* text...); - WIEGAND* get_wiegand(); - OneWireHost* get_one_wire(); + WIEGAND* get_wiegand(void); + OneWireHost* get_one_wire(void); private: std::list previous_scenes_list = {Scene::Exit}; diff --git a/applications/debug/accessor/accessor_view_manager.h b/applications/debug/accessor/accessor_view_manager.h index 8cd4377975c..66e54e41cec 100644 --- a/applications/debug/accessor/accessor_view_manager.h +++ b/applications/debug/accessor/accessor_view_manager.h @@ -15,16 +15,16 @@ class AccessorAppViewManager { FuriMessageQueue* event_queue; - AccessorAppViewManager(); - ~AccessorAppViewManager(); + AccessorAppViewManager(void); + ~AccessorAppViewManager(void); void switch_to(ViewType type); void receive_event(AccessorEvent* event); void send_event(AccessorEvent* event); - Submenu* get_submenu(); - Popup* get_popup(); + Submenu* get_submenu(void); + Popup* get_popup(void); private: ViewDispatcher* view_dispatcher; diff --git a/applications/debug/accessor/helpers/wiegand.h b/applications/debug/accessor/helpers/wiegand.h index be80f94cd51..1e1ab6bc801 100644 --- a/applications/debug/accessor/helpers/wiegand.h +++ b/applications/debug/accessor/helpers/wiegand.h @@ -2,19 +2,19 @@ class WIEGAND { public: - WIEGAND(); - void begin(); - void end(); - bool available(); - unsigned long getCode(); - unsigned long getCodeHigh(); - int getWiegandType(); + WIEGAND(void); + void begin(void); + void end(void); + bool available(void); + unsigned long getCode(void); + unsigned long getCodeHigh(void); + int getWiegandType(void); - static void ReadD0(); - static void ReadD1(); + static void ReadD0(void); + static void ReadD1(void); private: - static bool DoWiegandConversion(); + static bool DoWiegandConversion(void); static unsigned long GetCardId(unsigned long* codehigh, unsigned long* codelow, char bitlength); diff --git a/applications/debug/battery_test_app/battery_test_app.c b/applications/debug/battery_test_app/battery_test_app.c index 82c814ef4a0..5f9934e7779 100644 --- a/applications/debug/battery_test_app/battery_test_app.c +++ b/applications/debug/battery_test_app/battery_test_app.c @@ -32,7 +32,7 @@ static void battery_test_battery_info_update_model(void* context) { notification_message(app->notifications, &sequence_display_backlight_on); } -BatteryTestApp* battery_test_alloc() { +BatteryTestApp* battery_test_alloc(void) { BatteryTestApp* app = malloc(sizeof(BatteryTestApp)); // Records diff --git a/applications/debug/battery_test_app/views/battery_info.c b/applications/debug/battery_test_app/views/battery_info.c index 5353a2e2a67..4b5dcd62764 100644 --- a/applications/debug/battery_test_app/views/battery_info.c +++ b/applications/debug/battery_test_app/views/battery_info.c @@ -116,7 +116,7 @@ static void battery_info_draw_callback(Canvas* canvas, void* context) { draw_stat(canvas, 104, 42, &I_Health_16x16, health); } -BatteryInfo* battery_info_alloc() { +BatteryInfo* battery_info_alloc(void) { BatteryInfo* battery_info = malloc(sizeof(BatteryInfo)); battery_info->view = view_alloc(); view_set_context(battery_info->view, battery_info); diff --git a/applications/debug/battery_test_app/views/battery_info.h b/applications/debug/battery_test_app/views/battery_info.h index 7bfacf69e27..403caac4bbe 100644 --- a/applications/debug/battery_test_app/views/battery_info.h +++ b/applications/debug/battery_test_app/views/battery_info.h @@ -14,7 +14,7 @@ typedef struct { uint8_t health; } BatteryInfoModel; -BatteryInfo* battery_info_alloc(); +BatteryInfo* battery_info_alloc(void); void battery_info_free(BatteryInfo* battery_info); diff --git a/applications/debug/bt_debug_app/bt_debug_app.c b/applications/debug/bt_debug_app/bt_debug_app.c index bf13f6570a0..109feee6029 100644 --- a/applications/debug/bt_debug_app/bt_debug_app.c +++ b/applications/debug/bt_debug_app/bt_debug_app.c @@ -28,7 +28,7 @@ uint32_t bt_debug_start_view(void* context) { return BtDebugAppViewSubmenu; } -BtDebugApp* bt_debug_app_alloc() { +BtDebugApp* bt_debug_app_alloc(void) { BtDebugApp* app = malloc(sizeof(BtDebugApp)); // Gui diff --git a/applications/debug/bt_debug_app/views/bt_carrier_test.c b/applications/debug/bt_debug_app/views/bt_carrier_test.c index 8e224049574..23066434b08 100644 --- a/applications/debug/bt_debug_app/views/bt_carrier_test.c +++ b/applications/debug/bt_debug_app/views/bt_carrier_test.c @@ -129,7 +129,7 @@ static void bt_test_carrier_timer_callback(void* context) { } } -BtCarrierTest* bt_carrier_test_alloc() { +BtCarrierTest* bt_carrier_test_alloc(void) { BtCarrierTest* bt_carrier_test = malloc(sizeof(BtCarrierTest)); bt_carrier_test->bt_test = bt_test_alloc(); bt_test_set_context(bt_carrier_test->bt_test, bt_carrier_test); diff --git a/applications/debug/bt_debug_app/views/bt_carrier_test.h b/applications/debug/bt_debug_app/views/bt_carrier_test.h index 51a40089010..07fedccc1bd 100644 --- a/applications/debug/bt_debug_app/views/bt_carrier_test.h +++ b/applications/debug/bt_debug_app/views/bt_carrier_test.h @@ -3,7 +3,7 @@ typedef struct BtCarrierTest BtCarrierTest; -BtCarrierTest* bt_carrier_test_alloc(); +BtCarrierTest* bt_carrier_test_alloc(void); void bt_carrier_test_free(BtCarrierTest* bt_carrier_test); diff --git a/applications/debug/bt_debug_app/views/bt_packet_test.c b/applications/debug/bt_debug_app/views/bt_packet_test.c index 8a56a30031a..c30c6b5d25c 100644 --- a/applications/debug/bt_debug_app/views/bt_packet_test.c +++ b/applications/debug/bt_debug_app/views/bt_packet_test.c @@ -97,7 +97,7 @@ static void bt_test_packet_timer_callback(void* context) { } } -BtPacketTest* bt_packet_test_alloc() { +BtPacketTest* bt_packet_test_alloc(void) { BtPacketTest* bt_packet_test = malloc(sizeof(BtPacketTest)); bt_packet_test->bt_test = bt_test_alloc(); bt_test_set_context(bt_packet_test->bt_test, bt_packet_test); diff --git a/applications/debug/bt_debug_app/views/bt_packet_test.h b/applications/debug/bt_debug_app/views/bt_packet_test.h index 8ea449b2119..e31af3218ea 100644 --- a/applications/debug/bt_debug_app/views/bt_packet_test.h +++ b/applications/debug/bt_debug_app/views/bt_packet_test.h @@ -3,7 +3,7 @@ typedef struct BtPacketTest BtPacketTest; -BtPacketTest* bt_packet_test_alloc(); +BtPacketTest* bt_packet_test_alloc(void); void bt_packet_test_free(BtPacketTest* bt_packet_test); diff --git a/applications/debug/bt_debug_app/views/bt_test.c b/applications/debug/bt_debug_app/views/bt_test.c index cd52b8650e5..792ebfd8f88 100644 --- a/applications/debug/bt_debug_app/views/bt_test.c +++ b/applications/debug/bt_debug_app/views/bt_test.c @@ -305,7 +305,7 @@ void bt_test_process_back(BtTest* bt_test) { } } -BtTest* bt_test_alloc() { +BtTest* bt_test_alloc(void) { BtTest* bt_test = malloc(sizeof(BtTest)); bt_test->view = view_alloc(); view_set_context(bt_test->view, bt_test); diff --git a/applications/debug/bt_debug_app/views/bt_test.h b/applications/debug/bt_debug_app/views/bt_test.h index 2d738cbd08c..9d5ea26ec2b 100644 --- a/applications/debug/bt_debug_app/views/bt_test.h +++ b/applications/debug/bt_debug_app/views/bt_test.h @@ -12,7 +12,7 @@ typedef void (*BtTestBackCallback)(void* context); typedef struct BtTestParam BtTestParam; typedef void (*BtTestParamChangeCallback)(BtTestParam* param); -BtTest* bt_test_alloc(); +BtTest* bt_test_alloc(void); void bt_test_free(BtTest* bt_test); diff --git a/applications/debug/ccid_test/ccid_test_app.c b/applications/debug/ccid_test/ccid_test_app.c index 3d7fba39de5..50b356696c5 100644 --- a/applications/debug/ccid_test/ccid_test_app.c +++ b/applications/debug/ccid_test/ccid_test_app.c @@ -90,7 +90,7 @@ uint32_t ccid_test_exit(void* context) { return VIEW_NONE; } -CcidTestApp* ccid_test_app_alloc() { +CcidTestApp* ccid_test_app_alloc(void) { CcidTestApp* app = malloc(sizeof(CcidTestApp)); // Gui diff --git a/applications/debug/crash_test/crash_test.c b/applications/debug/crash_test/crash_test.c index 92f1668be9f..ae0074fe1c2 100644 --- a/applications/debug/crash_test/crash_test.c +++ b/applications/debug/crash_test/crash_test.c @@ -50,7 +50,7 @@ static void crash_test_submenu_callback(void* context, uint32_t index) { furi_halt("Crash test: furi_halt"); break; default: - furi_crash("Programming error"); + furi_crash(); } } @@ -59,7 +59,7 @@ static uint32_t crash_test_exit_callback(void* context) { return VIEW_NONE; } -CrashTest* crash_test_alloc() { +CrashTest* crash_test_alloc(void) { CrashTest* instance = malloc(sizeof(CrashTest)); View* view = NULL; diff --git a/applications/debug/direct_draw/direct_draw.c b/applications/debug/direct_draw/direct_draw.c index 63e03530a7a..bc1e5545977 100644 --- a/applications/debug/direct_draw/direct_draw.c +++ b/applications/debug/direct_draw/direct_draw.c @@ -26,7 +26,7 @@ static void gui_input_events_callback(const void* value, void* ctx) { } } -static DirectDraw* direct_draw_alloc() { +static DirectDraw* direct_draw_alloc(void) { DirectDraw* instance = malloc(sizeof(DirectDraw)); instance->input = furi_record_open(RECORD_INPUT_EVENTS); diff --git a/applications/debug/display_test/display_test.c b/applications/debug/display_test/display_test.c index 8065a23a1f9..ac1b6c65df2 100644 --- a/applications/debug/display_test/display_test.c +++ b/applications/debug/display_test/display_test.c @@ -121,7 +121,7 @@ static void display_config_set_contrast(VariableItem* item) { display_test_reload_config(instance); } -DisplayTest* display_test_alloc() { +DisplayTest* display_test_alloc(void) { DisplayTest* instance = malloc(sizeof(DisplayTest)); View* view = NULL; diff --git a/applications/debug/display_test/view_display_test.c b/applications/debug/display_test/view_display_test.c index b47c74c6c2c..d4fe433efe0 100644 --- a/applications/debug/display_test/view_display_test.c +++ b/applications/debug/display_test/view_display_test.c @@ -154,7 +154,7 @@ static void view_display_test_timer_callback(void* context) { instance->view, ViewDisplayTestModel * model, { model->counter++; }, true); } -ViewDisplayTest* view_display_test_alloc() { +ViewDisplayTest* view_display_test_alloc(void) { ViewDisplayTest* instance = malloc(sizeof(ViewDisplayTest)); instance->view = view_alloc(); diff --git a/applications/debug/display_test/view_display_test.h b/applications/debug/display_test/view_display_test.h index cafa142a84e..ca78e5ffe4d 100644 --- a/applications/debug/display_test/view_display_test.h +++ b/applications/debug/display_test/view_display_test.h @@ -5,7 +5,7 @@ typedef struct ViewDisplayTest ViewDisplayTest; -ViewDisplayTest* view_display_test_alloc(); +ViewDisplayTest* view_display_test_alloc(void); void view_display_test_free(ViewDisplayTest* instance); diff --git a/applications/debug/expansion_test/expansion_test.c b/applications/debug/expansion_test/expansion_test.c index a0b8b42e8bd..fc7fb189452 100644 --- a/applications/debug/expansion_test/expansion_test.c +++ b/applications/debug/expansion_test/expansion_test.c @@ -81,7 +81,7 @@ static void expansion_test_app_serial_rx_callback( } } -static ExpansionTestApp* expansion_test_app_alloc() { +static ExpansionTestApp* expansion_test_app_alloc(void) { ExpansionTestApp* instance = malloc(sizeof(ExpansionTestApp)); instance->buf = furi_stream_buffer_alloc(RECEIVE_BUFFER_SIZE, 1); return instance; diff --git a/applications/debug/lfrfid_debug/lfrfid_debug.c b/applications/debug/lfrfid_debug/lfrfid_debug.c index 63d66b68b9c..8776f8b7ad9 100644 --- a/applications/debug/lfrfid_debug/lfrfid_debug.c +++ b/applications/debug/lfrfid_debug/lfrfid_debug.c @@ -12,7 +12,7 @@ static bool lfrfid_debug_back_event_callback(void* context) { return scene_manager_handle_back_event(app->scene_manager); } -static LfRfidDebug* lfrfid_debug_alloc() { +static LfRfidDebug* lfrfid_debug_alloc(void) { LfRfidDebug* app = malloc(sizeof(LfRfidDebug)); app->view_dispatcher = view_dispatcher_alloc(); diff --git a/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.c b/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.c index 9e48a7e27fe..6b9501e5b72 100644 --- a/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.c +++ b/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.c @@ -170,7 +170,7 @@ static bool lfrfid_debug_view_tune_input_callback(InputEvent* event, void* conte return consumed; } -LfRfidTuneView* lfrfid_debug_view_tune_alloc() { +LfRfidTuneView* lfrfid_debug_view_tune_alloc(void) { LfRfidTuneView* tune_view = malloc(sizeof(LfRfidTuneView)); tune_view->view = view_alloc(); view_set_context(tune_view->view, tune_view); diff --git a/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.h b/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.h index be54b63f9a8..a0ee4cbf5ce 100644 --- a/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.h +++ b/applications/debug/lfrfid_debug/views/lfrfid_debug_view_tune.h @@ -3,7 +3,7 @@ typedef struct LfRfidTuneView LfRfidTuneView; -LfRfidTuneView* lfrfid_debug_view_tune_alloc(); +LfRfidTuneView* lfrfid_debug_view_tune_alloc(void); void lfrfid_debug_view_tune_free(LfRfidTuneView* tune_view); diff --git a/applications/debug/locale_test/locale_test.c b/applications/debug/locale_test/locale_test.c index a7cbd52f809..1ca077db1fc 100644 --- a/applications/debug/locale_test/locale_test.c +++ b/applications/debug/locale_test/locale_test.c @@ -53,7 +53,7 @@ static uint32_t locale_test_exit(void* context) { return VIEW_NONE; } -static LocaleTestApp* locale_test_alloc() { +static LocaleTestApp* locale_test_alloc(void) { LocaleTestApp* app = malloc(sizeof(LocaleTestApp)); // Gui diff --git a/applications/debug/rpc_debug_app/rpc_debug_app.c b/applications/debug/rpc_debug_app/rpc_debug_app.c index 2a0756383c2..5e53c221e17 100644 --- a/applications/debug/rpc_debug_app/rpc_debug_app.c +++ b/applications/debug/rpc_debug_app/rpc_debug_app.c @@ -83,7 +83,7 @@ static bool rpc_debug_app_rpc_init_rpc(RpcDebugApp* app, const char* args) { return ret; } -static RpcDebugApp* rpc_debug_app_alloc() { +static RpcDebugApp* rpc_debug_app_alloc(void) { RpcDebugApp* app = malloc(sizeof(RpcDebugApp)); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/debug/speaker_debug/speaker_debug.c b/applications/debug/speaker_debug/speaker_debug.c index e01d5b8ec44..82a6fbc7746 100644 --- a/applications/debug/speaker_debug/speaker_debug.c +++ b/applications/debug/speaker_debug/speaker_debug.c @@ -21,7 +21,7 @@ typedef struct { Cli* cli; } SpeakerDebugApp; -static SpeakerDebugApp* speaker_app_alloc() { +static SpeakerDebugApp* speaker_app_alloc(void) { SpeakerDebugApp* app = (SpeakerDebugApp*)malloc(sizeof(SpeakerDebugApp)); app->music_worker = music_worker_alloc(); app->message_queue = furi_message_queue_alloc(8, sizeof(SpeakerDebugAppMessage)); diff --git a/applications/debug/subghz_test/protocol/princeton_for_testing.c b/applications/debug/subghz_test/protocol/princeton_for_testing.c index 334a8241bbe..70f323937da 100644 --- a/applications/debug/subghz_test/protocol/princeton_for_testing.c +++ b/applications/debug/subghz_test/protocol/princeton_for_testing.c @@ -38,7 +38,7 @@ typedef enum { PrincetonDecoderStepCheckDuration, } PrincetonDecoderStep; -SubGhzEncoderPrinceton* subghz_encoder_princeton_for_testing_alloc() { +SubGhzEncoderPrinceton* subghz_encoder_princeton_for_testing_alloc(void) { SubGhzEncoderPrinceton* instance = malloc(sizeof(SubGhzEncoderPrinceton)); return instance; } diff --git a/applications/debug/subghz_test/protocol/princeton_for_testing.h b/applications/debug/subghz_test/protocol/princeton_for_testing.h index 7b4201d38a9..281cb148b10 100644 --- a/applications/debug/subghz_test/protocol/princeton_for_testing.h +++ b/applications/debug/subghz_test/protocol/princeton_for_testing.h @@ -15,7 +15,7 @@ typedef void (*SubGhzDecoderPrincetonCallback)(SubGhzDecoderPrinceton* parser, v * Allocate SubGhzEncoderPrinceton * @return pointer to SubGhzEncoderPrinceton instance */ -SubGhzEncoderPrinceton* subghz_encoder_princeton_for_testing_alloc(); +SubGhzEncoderPrinceton* subghz_encoder_princeton_for_testing_alloc(void); /** * Free SubGhzEncoderPrinceton instance @@ -69,7 +69,7 @@ LevelDuration subghz_encoder_princeton_for_testing_yield(void* context); * Allocate SubGhzDecoderPrinceton * @return SubGhzDecoderPrinceton* */ -SubGhzDecoderPrinceton* subghz_decoder_princeton_for_testing_alloc(); +SubGhzDecoderPrinceton* subghz_decoder_princeton_for_testing_alloc(void); /** * Free SubGhzDecoderPrinceton diff --git a/applications/debug/subghz_test/subghz_test_app.c b/applications/debug/subghz_test/subghz_test_app.c index 704941fb28e..6eba864f6e7 100644 --- a/applications/debug/subghz_test/subghz_test_app.c +++ b/applications/debug/subghz_test/subghz_test_app.c @@ -21,7 +21,7 @@ static void subghz_test_app_tick_event_callback(void* context) { scene_manager_handle_tick_event(app->scene_manager); } -SubGhzTestApp* subghz_test_app_alloc() { +SubGhzTestApp* subghz_test_app_alloc(void) { SubGhzTestApp* app = malloc(sizeof(SubGhzTestApp)); // GUI diff --git a/applications/debug/subghz_test/views/subghz_test_carrier.c b/applications/debug/subghz_test/views/subghz_test_carrier.c index 53e309b7c98..a941cd4bb50 100644 --- a/applications/debug/subghz_test/views/subghz_test_carrier.c +++ b/applications/debug/subghz_test/views/subghz_test_carrier.c @@ -186,7 +186,7 @@ void subghz_test_carrier_rssi_timer_callback(void* context) { false); } -SubGhzTestCarrier* subghz_test_carrier_alloc() { +SubGhzTestCarrier* subghz_test_carrier_alloc(void) { SubGhzTestCarrier* subghz_test_carrier = malloc(sizeof(SubGhzTestCarrier)); // View allocation and configuration diff --git a/applications/debug/subghz_test/views/subghz_test_carrier.h b/applications/debug/subghz_test/views/subghz_test_carrier.h index 7db3343edc0..3d6c4a38d25 100644 --- a/applications/debug/subghz_test/views/subghz_test_carrier.h +++ b/applications/debug/subghz_test/views/subghz_test_carrier.h @@ -15,7 +15,7 @@ void subghz_test_carrier_set_callback( SubGhzTestCarrierCallback callback, void* context); -SubGhzTestCarrier* subghz_test_carrier_alloc(); +SubGhzTestCarrier* subghz_test_carrier_alloc(void); void subghz_test_carrier_free(SubGhzTestCarrier* subghz_test_carrier); diff --git a/applications/debug/subghz_test/views/subghz_test_packet.c b/applications/debug/subghz_test/views/subghz_test_packet.c index 1f345829617..d50f10ad46e 100644 --- a/applications/debug/subghz_test/views/subghz_test_packet.c +++ b/applications/debug/subghz_test/views/subghz_test_packet.c @@ -236,7 +236,7 @@ void subghz_test_packet_exit(void* context) { furi_hal_subghz_sleep(); } -SubGhzTestPacket* subghz_test_packet_alloc() { +SubGhzTestPacket* subghz_test_packet_alloc(void) { SubGhzTestPacket* instance = malloc(sizeof(SubGhzTestPacket)); // View allocation and configuration diff --git a/applications/debug/subghz_test/views/subghz_test_packet.h b/applications/debug/subghz_test/views/subghz_test_packet.h index f384cf4fea0..3a8204f1fee 100644 --- a/applications/debug/subghz_test/views/subghz_test_packet.h +++ b/applications/debug/subghz_test/views/subghz_test_packet.h @@ -15,7 +15,7 @@ void subghz_test_packet_set_callback( SubGhzTestPacketCallback callback, void* context); -SubGhzTestPacket* subghz_test_packet_alloc(); +SubGhzTestPacket* subghz_test_packet_alloc(void); void subghz_test_packet_free(SubGhzTestPacket* subghz_test_packet); diff --git a/applications/debug/subghz_test/views/subghz_test_static.c b/applications/debug/subghz_test/views/subghz_test_static.c index 6764fd5ca9f..22ad662c57a 100644 --- a/applications/debug/subghz_test/views/subghz_test_static.c +++ b/applications/debug/subghz_test/views/subghz_test_static.c @@ -164,7 +164,7 @@ void subghz_test_static_exit(void* context) { furi_hal_subghz_sleep(); } -SubGhzTestStatic* subghz_test_static_alloc() { +SubGhzTestStatic* subghz_test_static_alloc(void) { SubGhzTestStatic* instance = malloc(sizeof(SubGhzTestStatic)); // View allocation and configuration diff --git a/applications/debug/subghz_test/views/subghz_test_static.h b/applications/debug/subghz_test/views/subghz_test_static.h index 9020364310d..3bb6156f7e0 100644 --- a/applications/debug/subghz_test/views/subghz_test_static.h +++ b/applications/debug/subghz_test/views/subghz_test_static.h @@ -15,7 +15,7 @@ void subghz_test_static_set_callback( SubGhzTestStaticCallback callback, void* context); -SubGhzTestStatic* subghz_test_static_alloc(); +SubGhzTestStatic* subghz_test_static_alloc(void); void subghz_test_static_free(SubGhzTestStatic* subghz_static); diff --git a/applications/debug/unit_tests/bit_lib/bit_lib_test.c b/applications/debug/unit_tests/bit_lib/bit_lib_test.c index 42b494413e4..239a3b562a6 100644 --- a/applications/debug/unit_tests/bit_lib/bit_lib_test.c +++ b/applications/debug/unit_tests/bit_lib/bit_lib_test.c @@ -734,7 +734,7 @@ MU_TEST_SUITE(test_bit_lib) { MU_RUN_TEST(test_bit_lib_bytes_to_num_bcd); } -int run_minunit_test_bit_lib() { +int run_minunit_test_bit_lib(void) { MU_RUN_SUITE(test_bit_lib); return MU_EXIT_CODE; } \ No newline at end of file diff --git a/applications/debug/unit_tests/bt/bt_test.c b/applications/debug/unit_tests/bt/bt_test.c index 32cf6533f88..a09b9894ba7 100644 --- a/applications/debug/unit_tests/bt/bt_test.c +++ b/applications/debug/unit_tests/bt/bt_test.c @@ -17,7 +17,7 @@ typedef struct { BtTest* bt_test = NULL; -void bt_test_alloc() { +void bt_test_alloc(void) { bt_test = malloc(sizeof(BtTest)); bt_test->storage = furi_record_open(RECORD_STORAGE); bt_test->nvm_ram_buff_dut = malloc(BT_TEST_NVM_RAM_BUFF_SIZE); @@ -27,7 +27,7 @@ void bt_test_alloc() { bt_test->bt_keys_storage, bt_test->nvm_ram_buff_dut, BT_TEST_NVM_RAM_BUFF_SIZE); } -void bt_test_free() { +void bt_test_free(void) { furi_check(bt_test); free(bt_test->nvm_ram_buff_ref); free(bt_test->nvm_ram_buff_dut); @@ -37,7 +37,7 @@ void bt_test_free() { bt_test = NULL; } -static void bt_test_keys_storage_profile() { +static void bt_test_keys_storage_profile(void) { // Emulate nvm change on initial connection const int nvm_change_size_on_connection = 88; for(size_t i = 0; i < nvm_change_size_on_connection; i++) { @@ -82,7 +82,7 @@ static void bt_test_keys_storage_profile() { "Wrong buffer loaded"); } -static void bt_test_keys_remove_test_file() { +static void bt_test_keys_remove_test_file(void) { mu_assert( storage_simply_remove(bt_test->storage, BT_TEST_KEY_STORAGE_FILE_PATH), "Can't remove test file"); @@ -104,7 +104,7 @@ MU_TEST_SUITE(test_bt) { bt_test_free(); } -int run_minunit_test_bt() { +int run_minunit_test_bt(void) { MU_RUN_SUITE(test_bt); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/datetimelib/datetimelib_test.c b/applications/debug/unit_tests/datetimelib/datetimelib_test.c index bf8e6fabd71..c171a4413bb 100644 --- a/applications/debug/unit_tests/datetimelib/datetimelib_test.c +++ b/applications/debug/unit_tests/datetimelib/datetimelib_test.c @@ -182,7 +182,7 @@ MU_TEST_SUITE(test_datetime_datetime_to_timestamp_suite) { MU_RUN_TEST(test_datetime_datetime_to_timestamp_max); } -int run_minunit_test_datetime() { +int run_minunit_test_datetime(void) { MU_RUN_SUITE(test_datetime_timestamp_to_datetime_suite); MU_RUN_SUITE(test_datetime_datetime_to_timestamp_suite); MU_RUN_SUITE(test_datetime_validate_datetime); diff --git a/applications/debug/unit_tests/dialogs/dialogs_file_browser_options.c b/applications/debug/unit_tests/dialogs/dialogs_file_browser_options.c index 2d5bad4c8a5..657b933dfc6 100644 --- a/applications/debug/unit_tests/dialogs/dialogs_file_browser_options.c +++ b/applications/debug/unit_tests/dialogs/dialogs_file_browser_options.c @@ -25,7 +25,7 @@ MU_TEST_SUITE(dialogs_file_browser_options) { MU_RUN_TEST(test_dialog_file_browser_set_basic_options_should_init_all_fields); } -int run_minunit_test_dialogs_file_browser_options() { +int run_minunit_test_dialogs_file_browser_options(void) { MU_RUN_SUITE(dialogs_file_browser_options); return MU_EXIT_CODE; diff --git a/applications/debug/unit_tests/expansion/expansion_test.c b/applications/debug/unit_tests/expansion/expansion_test.c index 50fe1b9f4d7..c6a143ed341 100644 --- a/applications/debug/unit_tests/expansion/expansion_test.c +++ b/applications/debug/unit_tests/expansion/expansion_test.c @@ -194,7 +194,7 @@ MU_TEST_SUITE(test_expansion_suite) { MU_RUN_TEST(test_expansion_garbage_input); } -int run_minunit_test_expansion() { +int run_minunit_test_expansion(void) { MU_RUN_SUITE(test_expansion_suite); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/flipper_format/flipper_format_string_test.c b/applications/debug/unit_tests/flipper_format/flipper_format_string_test.c index 920a22a43bf..99bb5dda597 100644 --- a/applications/debug/unit_tests/flipper_format/flipper_format_string_test.c +++ b/applications/debug/unit_tests/flipper_format/flipper_format_string_test.c @@ -331,7 +331,7 @@ MU_TEST_SUITE(flipper_format_string_suite) { MU_RUN_TEST(flipper_format_file_test); } -int run_minunit_test_flipper_format_string() { +int run_minunit_test_flipper_format_string(void) { MU_RUN_SUITE(flipper_format_string_suite); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/flipper_format/flipper_format_test.c b/applications/debug/unit_tests/flipper_format/flipper_format_test.c index 012e905b690..471055fb0cf 100644 --- a/applications/debug/unit_tests/flipper_format/flipper_format_test.c +++ b/applications/debug/unit_tests/flipper_format/flipper_format_test.c @@ -103,14 +103,14 @@ static bool storage_write_string(const char* path, const char* data) { return result; } -static void tests_setup() { +static void tests_setup(void) { Storage* storage = furi_record_open(RECORD_STORAGE); mu_assert(storage_simply_remove_recursive(storage, TEST_DIR_NAME), "Cannot clean data"); mu_assert(storage_simply_mkdir(storage, TEST_DIR_NAME), "Cannot create dir"); furi_record_close(RECORD_STORAGE); } -static void tests_teardown() { +static void tests_teardown(void) { Storage* storage = furi_record_open(RECORD_STORAGE); mu_assert(storage_simply_remove_recursive(storage, TEST_DIR_NAME), "Cannot clean data"); furi_record_close(RECORD_STORAGE); @@ -545,7 +545,7 @@ MU_TEST_SUITE(flipper_format) { tests_teardown(); } -int run_minunit_test_flipper_format() { +int run_minunit_test_flipper_format(void) { MU_RUN_SUITE(flipper_format); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/float_tools/float_tools_test.c b/applications/debug/unit_tests/float_tools/float_tools_test.c index fc5b4ecfd8b..91ac4693780 100644 --- a/applications/debug/unit_tests/float_tools/float_tools_test.c +++ b/applications/debug/unit_tests/float_tools/float_tools_test.c @@ -54,7 +54,7 @@ MU_TEST_SUITE(float_tools_suite) { MU_RUN_TEST(float_tools_equal_test); } -int run_minunit_test_float_tools() { +int run_minunit_test_float_tools(void) { MU_RUN_SUITE(float_tools_suite); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/furi/furi_memmgr_test.c b/applications/debug/unit_tests/furi/furi_memmgr_test.c index 9012eed7822..01e2c17f66e 100644 --- a/applications/debug/unit_tests/furi/furi_memmgr_test.c +++ b/applications/debug/unit_tests/furi/furi_memmgr_test.c @@ -4,7 +4,7 @@ #include #include -void test_furi_memmgr() { +void test_furi_memmgr(void) { void* ptr; // allocate memory case diff --git a/applications/debug/unit_tests/furi/furi_pubsub_test.c b/applications/debug/unit_tests/furi/furi_pubsub_test.c index ddaeb746d92..8925ff42ecd 100644 --- a/applications/debug/unit_tests/furi/furi_pubsub_test.c +++ b/applications/debug/unit_tests/furi/furi_pubsub_test.c @@ -15,7 +15,7 @@ void test_pubsub_handler(const void* arg, void* ctx) { pubsub_context_value = *(uint32_t*)ctx; } -void test_furi_pubsub() { +void test_furi_pubsub(void) { FuriPubSub* test_pubsub = NULL; FuriPubSubSubscription* test_pubsub_subscription = NULL; diff --git a/applications/debug/unit_tests/furi/furi_record_test.c b/applications/debug/unit_tests/furi/furi_record_test.c index 236e1efc56b..10a5a839332 100644 --- a/applications/debug/unit_tests/furi/furi_record_test.c +++ b/applications/debug/unit_tests/furi/furi_record_test.c @@ -5,7 +5,7 @@ #define TEST_RECORD_NAME "test/holding" -void test_furi_create_open() { +void test_furi_create_open(void) { // Test that record does not exist mu_check(furi_record_exists(TEST_RECORD_NAME) == false); diff --git a/applications/debug/unit_tests/furi/furi_string_test.c b/applications/debug/unit_tests/furi/furi_string_test.c index 6cbcc0dcc7a..853076b67bc 100644 --- a/applications/debug/unit_tests/furi/furi_string_test.c +++ b/applications/debug/unit_tests/furi/furi_string_test.c @@ -462,7 +462,7 @@ MU_TEST_SUITE(test_suite) { MU_RUN_TEST(mu_test_furi_string_utf8); } -int run_minunit_test_furi_string() { +int run_minunit_test_furi_string(void) { MU_RUN_SUITE(test_suite); return MU_EXIT_CODE; diff --git a/applications/debug/unit_tests/furi/furi_test.c b/applications/debug/unit_tests/furi/furi_test.c index 33ec5fd019b..2f271c305c6 100644 --- a/applications/debug/unit_tests/furi/furi_test.c +++ b/applications/debug/unit_tests/furi/furi_test.c @@ -50,7 +50,7 @@ MU_TEST_SUITE(test_suite) { MU_RUN_TEST(mu_test_furi_memmgr); } -int run_minunit_test_furi() { +int run_minunit_test_furi(void) { MU_RUN_SUITE(test_suite); return MU_EXIT_CODE; diff --git a/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c b/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c index b06d51130f9..c2bd6c5f810 100644 --- a/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c +++ b/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c @@ -409,16 +409,16 @@ static const uint8_t tv_gcm_tag_4[16] = { 0x1B, }; -static void furi_hal_crypto_ctr_setup() { +static void furi_hal_crypto_ctr_setup(void) { } -static void furi_hal_crypto_ctr_teardown() { +static void furi_hal_crypto_ctr_teardown(void) { } -static void furi_hal_crypto_gcm_setup() { +static void furi_hal_crypto_gcm_setup(void) { } -static void furi_hal_crypto_gcm_teardown() { +static void furi_hal_crypto_gcm_teardown(void) { } MU_TEST(furi_hal_crypto_ctr_1) { @@ -595,7 +595,7 @@ MU_TEST_SUITE(furi_hal_crypto_gcm_test) { MU_RUN_TEST(furi_hal_crypto_gcm_4); } -int run_minunit_test_furi_hal_crypto() { +int run_minunit_test_furi_hal_crypto(void) { MU_RUN_SUITE(furi_hal_crypto_ctr_test); MU_RUN_SUITE(furi_hal_crypto_gcm_test); return MU_EXIT_CODE; diff --git a/applications/debug/unit_tests/furi_hal/furi_hal_tests.c b/applications/debug/unit_tests/furi_hal/furi_hal_tests.c index a75615d0c0f..0c5cec8a616 100644 --- a/applications/debug/unit_tests/furi_hal/furi_hal_tests.c +++ b/applications/debug/unit_tests/furi_hal/furi_hal_tests.c @@ -14,19 +14,19 @@ #define EEPROM_PAGE_SIZE 16 #define EEPROM_WRITE_DELAY_MS 6 -static void furi_hal_i2c_int_setup() { +static void furi_hal_i2c_int_setup(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); } -static void furi_hal_i2c_int_teardown() { +static void furi_hal_i2c_int_teardown(void) { furi_hal_i2c_release(&furi_hal_i2c_handle_power); } -static void furi_hal_i2c_ext_setup() { +static void furi_hal_i2c_ext_setup(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_external); } -static void furi_hal_i2c_ext_teardown() { +static void furi_hal_i2c_ext_teardown(void) { furi_hal_i2c_release(&furi_hal_i2c_handle_external); } @@ -227,7 +227,7 @@ MU_TEST_SUITE(furi_hal_i2c_ext_suite) { MU_RUN_TEST(furi_hal_i2c_ext_eeprom); } -int run_minunit_test_furi_hal() { +int run_minunit_test_furi_hal(void) { MU_RUN_SUITE(furi_hal_i2c_int_suite); MU_RUN_SUITE(furi_hal_i2c_ext_suite); return MU_EXIT_CODE; diff --git a/applications/debug/unit_tests/infrared/infrared_test.c b/applications/debug/unit_tests/infrared/infrared_test.c index 294c2da9a55..13c5559d1de 100644 --- a/applications/debug/unit_tests/infrared/infrared_test.c +++ b/applications/debug/unit_tests/infrared/infrared_test.c @@ -17,7 +17,7 @@ typedef struct { static InfraredTest* test; -static void infrared_test_alloc() { +static void infrared_test_alloc(void) { Storage* storage = furi_record_open(RECORD_STORAGE); test = malloc(sizeof(InfraredTest)); test->decoder_handler = infrared_alloc_decoder(); @@ -26,7 +26,7 @@ static void infrared_test_alloc() { test->file_path = furi_string_alloc(); } -static void infrared_test_free() { +static void infrared_test_free(void) { furi_check(test); infrared_free_decoder(test->decoder_handler); infrared_free_encoder(test->encoder_handler); @@ -543,7 +543,7 @@ MU_TEST_SUITE(infrared_test) { MU_RUN_TEST(infrared_test_encoder_decoder_all); } -int run_minunit_test_infrared() { +int run_minunit_test_infrared(void) { MU_RUN_SUITE(infrared_test); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/lfrfid/lfrfid_protocols.c b/applications/debug/unit_tests/lfrfid/lfrfid_protocols.c index d5c2433ba04..6a7dbab9cb0 100644 --- a/applications/debug/unit_tests/lfrfid/lfrfid_protocols.c +++ b/applications/debug/unit_tests/lfrfid/lfrfid_protocols.c @@ -547,7 +547,7 @@ MU_TEST_SUITE(test_lfrfid_protocols_suite) { MU_RUN_TEST(test_lfrfid_protocol_fdxb_emulate_simple); } -int run_minunit_test_lfrfid_protocols() { +int run_minunit_test_lfrfid_protocols(void) { MU_RUN_SUITE(test_lfrfid_protocols_suite); return MU_EXIT_CODE; } \ No newline at end of file diff --git a/applications/debug/unit_tests/manifest/manifest.c b/applications/debug/unit_tests/manifest/manifest.c index 19370b0e13f..e8ac93d7c09 100644 --- a/applications/debug/unit_tests/manifest/manifest.c +++ b/applications/debug/unit_tests/manifest/manifest.c @@ -69,7 +69,7 @@ MU_TEST_SUITE(manifest_suite) { MU_RUN_TEST(manifest_iteration_test); } -int run_minunit_test_manifest() { +int run_minunit_test_manifest(void) { MU_RUN_SUITE(manifest_suite); return MU_EXIT_CODE; } \ No newline at end of file diff --git a/applications/debug/unit_tests/nfc/nfc_test.c b/applications/debug/unit_tests/nfc/nfc_test.c index 29b9e80d932..4b6503b7289 100644 --- a/applications/debug/unit_tests/nfc/nfc_test.c +++ b/applications/debug/unit_tests/nfc/nfc_test.c @@ -28,12 +28,12 @@ typedef struct { static NfcTest* nfc_test = NULL; -static void nfc_test_alloc() { +static void nfc_test_alloc(void) { nfc_test = malloc(sizeof(NfcTest)); nfc_test->storage = furi_record_open(RECORD_STORAGE); } -static void nfc_test_free() { +static void nfc_test_free(void) { furi_check(nfc_test); furi_record_close(RECORD_STORAGE); @@ -292,7 +292,7 @@ MU_TEST(ntag_213_locked_reader) { nfc_free(poller); } -static void mf_ultralight_write() { +static void mf_ultralight_write(void) { Nfc* poller = nfc_alloc(); Nfc* listener = nfc_alloc(); @@ -342,7 +342,7 @@ static void mf_ultralight_write() { nfc_free(poller); } -static void mf_classic_reader() { +static void mf_classic_reader(void) { Nfc* poller = nfc_alloc(); Nfc* listener = nfc_alloc(); @@ -368,7 +368,7 @@ static void mf_classic_reader() { nfc_free(poller); } -static void mf_classic_write() { +static void mf_classic_write(void) { Nfc* poller = nfc_alloc(); Nfc* listener = nfc_alloc(); @@ -396,7 +396,7 @@ static void mf_classic_write() { nfc_free(poller); } -static void mf_classic_value_block() { +static void mf_classic_value_block(void) { Nfc* poller = nfc_alloc(); Nfc* listener = nfc_alloc(); @@ -548,7 +548,7 @@ MU_TEST_SUITE(nfc) { nfc_test_free(); } -int run_minunit_test_nfc() { +int run_minunit_test_nfc(void) { MU_RUN_SUITE(nfc); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/nfc/nfc_transport.c b/applications/debug/unit_tests/nfc/nfc_transport.c index e9f4e21341a..6886ef66da3 100644 --- a/applications/debug/unit_tests/nfc/nfc_transport.c +++ b/applications/debug/unit_tests/nfc/nfc_transport.c @@ -115,7 +115,7 @@ static void nfc_prepare_col_res_data( } } -Nfc* nfc_alloc() { +Nfc* nfc_alloc(void) { Nfc* instance = malloc(sizeof(Nfc)); return instance; diff --git a/applications/debug/unit_tests/power/power_test.c b/applications/debug/unit_tests/power/power_test.c index a9b66b22111..03e0ad269f9 100644 --- a/applications/debug/unit_tests/power/power_test.c +++ b/applications/debug/unit_tests/power/power_test.c @@ -63,7 +63,7 @@ MU_TEST_SUITE(test_power_suite) { power_test_deinit(); } -int run_minunit_test_power() { +int run_minunit_test_power(void) { MU_RUN_SUITE(test_power_suite); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/protocol_dict/protocol_dict_test.c b/applications/debug/unit_tests/protocol_dict/protocol_dict_test.c index 73e77ec900c..6ecaa1a52fc 100644 --- a/applications/debug/unit_tests/protocol_dict/protocol_dict_test.c +++ b/applications/debug/unit_tests/protocol_dict/protocol_dict_test.c @@ -18,7 +18,7 @@ typedef struct { static const uint32_t protocol_0_decoder_result = 0xDEADBEEF; -static void* protocol_0_alloc() { +static void* protocol_0_alloc(void) { void* data = malloc(sizeof(Protocol0Data)); return data; } @@ -63,7 +63,7 @@ typedef struct { static const uint64_t protocol_1_decoder_result = 0x1234567890ABCDEF; -static void* protocol_1_alloc() { +static void* protocol_1_alloc(void) { void* data = malloc(sizeof(Protocol1Data)); return data; } @@ -216,7 +216,7 @@ MU_TEST_SUITE(test_protocol_dict_suite) { MU_RUN_TEST(test_protocol_dict); } -int run_minunit_test_protocol_dict() { +int run_minunit_test_protocol_dict(void) { MU_RUN_SUITE(test_protocol_dict_suite); return MU_EXIT_CODE; } \ No newline at end of file diff --git a/applications/debug/unit_tests/rpc/rpc_test.c b/applications/debug/unit_tests/rpc/rpc_test.c index 3faf6157211..cd692d69de6 100644 --- a/applications/debug/unit_tests/rpc/rpc_test.c +++ b/applications/debug/unit_tests/rpc/rpc_test.c @@ -1840,7 +1840,7 @@ MU_TEST_SUITE(test_rpc_session) { furi_record_close(RECORD_STORAGE); } -int run_minunit_test_rpc() { +int run_minunit_test_rpc(void) { Storage* storage = furi_record_open(RECORD_STORAGE); if(storage_sd_status(storage) != FSE_OK) { FURI_LOG_E(TAG, "SD card not mounted - skip storage tests"); diff --git a/applications/debug/unit_tests/storage/dirwalk_test.c b/applications/debug/unit_tests/storage/dirwalk_test.c index 19ac336fffb..415ec7dd434 100644 --- a/applications/debug/unit_tests/storage/dirwalk_test.c +++ b/applications/debug/unit_tests/storage/dirwalk_test.c @@ -266,7 +266,7 @@ MU_TEST_SUITE(test_dirwalk_suite) { furi_record_close(RECORD_STORAGE); } -int run_minunit_test_dirwalk() { +int run_minunit_test_dirwalk(void) { MU_RUN_SUITE(test_dirwalk_suite); return MU_EXIT_CODE; } \ No newline at end of file diff --git a/applications/debug/unit_tests/storage/storage_test.c b/applications/debug/unit_tests/storage/storage_test.c index 5ea36935b13..e4361f06c38 100644 --- a/applications/debug/unit_tests/storage/storage_test.c +++ b/applications/debug/unit_tests/storage/storage_test.c @@ -36,7 +36,7 @@ static bool storage_file_create(Storage* storage, const char* path, const char* return result; } -static void storage_file_open_lock_setup() { +static void storage_file_open_lock_setup(void) { Storage* storage = furi_record_open(RECORD_STORAGE); File* file = storage_file_alloc(storage); storage_simply_remove(storage, STORAGE_LOCKED_FILE); @@ -47,7 +47,7 @@ static void storage_file_open_lock_setup() { furi_record_close(RECORD_STORAGE); } -static void storage_file_open_lock_teardown() { +static void storage_file_open_lock_teardown(void) { Storage* storage = furi_record_open(RECORD_STORAGE); mu_check(storage_simply_remove(storage, STORAGE_LOCKED_FILE)); furi_record_close(RECORD_STORAGE); @@ -702,7 +702,7 @@ MU_TEST_SUITE(test_md5_calc_suite) { MU_RUN_TEST(test_md5_calc); } -int run_minunit_test_storage() { +int run_minunit_test_storage(void) { MU_RUN_SUITE(storage_file); MU_RUN_SUITE(storage_file_64k); MU_RUN_SUITE(storage_dir); diff --git a/applications/debug/unit_tests/stream/stream_test.c b/applications/debug/unit_tests/stream/stream_test.c index 2fa3b21a297..3e31773b4f1 100644 --- a/applications/debug/unit_tests/stream/stream_test.c +++ b/applications/debug/unit_tests/stream/stream_test.c @@ -526,7 +526,7 @@ MU_TEST_SUITE(stream_suite) { MU_RUN_TEST(stream_buffered_large_file_test); } -int run_minunit_test_stream() { +int run_minunit_test_stream(void) { MU_RUN_SUITE(stream_suite); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/subghz/subghz_test.c b/applications/debug/unit_tests/subghz/subghz_test.c index 53894c5514e..a2f00885b43 100644 --- a/applications/debug/unit_tests/subghz/subghz_test.c +++ b/applications/debug/unit_tests/subghz/subghz_test.c @@ -314,7 +314,7 @@ static LevelDuration subghz_hal_async_tx_test_yield(void* context) { furi_crash("Yield after reset"); } } else { - furi_crash("Programming error"); + furi_crash(); } } @@ -904,7 +904,7 @@ MU_TEST_SUITE(subghz) { subghz_test_deinit(); } -int run_minunit_test_subghz() { +int run_minunit_test_subghz(void) { MU_RUN_SUITE(subghz); return MU_EXIT_CODE; } diff --git a/applications/debug/unit_tests/test_index.c b/applications/debug/unit_tests/test_index.c index 60132a16168..eb475fada4f 100644 --- a/applications/debug/unit_tests/test_index.c +++ b/applications/debug/unit_tests/test_index.c @@ -66,7 +66,7 @@ const UnitTest unit_tests[] = { {.name = "expansion", .entry = run_minunit_test_expansion}, }; -void minunit_print_progress() { +void minunit_print_progress(void) { static const char progress[] = {'\\', '|', '/', '-'}; static uint8_t progress_counter = 0; static uint32_t last_tick = 0; @@ -157,7 +157,7 @@ void unit_tests_cli(Cli* cli, FuriString* args, void* context) { furi_record_close(RECORD_LOADER); } -void unit_tests_on_system_start() { +void unit_tests_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); diff --git a/applications/debug/unit_tests/varint/varint_test.c b/applications/debug/unit_tests/varint/varint_test.c index 8faab136883..ac444013d32 100644 --- a/applications/debug/unit_tests/varint/varint_test.c +++ b/applications/debug/unit_tests/varint/varint_test.c @@ -82,7 +82,7 @@ MU_TEST_SUITE(test_varint_suite) { MU_RUN_TEST(test_varint_rand_i); } -int run_minunit_test_varint() { +int run_minunit_test_varint(void) { MU_RUN_SUITE(test_varint_suite); return MU_EXIT_CODE; } \ No newline at end of file diff --git a/applications/debug/usb_test/usb_test.c b/applications/debug/usb_test/usb_test.c index ed86c37a88a..ddec9d9b055 100644 --- a/applications/debug/usb_test/usb_test.c +++ b/applications/debug/usb_test/usb_test.c @@ -55,7 +55,7 @@ uint32_t usb_test_exit(void* context) { return VIEW_NONE; } -UsbTestApp* usb_test_app_alloc() { +UsbTestApp* usb_test_app_alloc(void) { UsbTestApp* app = malloc(sizeof(UsbTestApp)); // Gui diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c index 1242b8857a5..8be60088a94 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c @@ -93,7 +93,7 @@ typedef struct { static SubGhzDeviceCC1101Ext* subghz_device_cc1101_ext = NULL; -static bool subghz_device_cc1101_ext_check_init() { +static bool subghz_device_cc1101_ext_check_init(void) { furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateInit); subghz_device_cc1101_ext->state = SubGhzDeviceCC1101ExtStateIdle; @@ -198,7 +198,7 @@ static bool subghz_device_cc1101_ext_check_init() { return ret; } -bool subghz_device_cc1101_ext_alloc() { +bool subghz_device_cc1101_ext_alloc(void) { furi_assert(subghz_device_cc1101_ext == NULL); subghz_device_cc1101_ext = malloc(sizeof(SubGhzDeviceCC1101Ext)); subghz_device_cc1101_ext->state = SubGhzDeviceCC1101ExtStateInit; @@ -213,7 +213,7 @@ bool subghz_device_cc1101_ext_alloc() { return subghz_device_cc1101_ext_check_init(); } -void subghz_device_cc1101_ext_free() { +void subghz_device_cc1101_ext_free(void) { furi_assert(subghz_device_cc1101_ext != NULL); furi_hal_spi_bus_handle_deinit(subghz_device_cc1101_ext->spi_bus_handle); free(subghz_device_cc1101_ext); @@ -224,11 +224,11 @@ void subghz_device_cc1101_ext_set_async_mirror_pin(const GpioPin* pin) { subghz_device_cc1101_ext->async_mirror_pin = pin; } -const GpioPin* subghz_device_cc1101_ext_get_data_gpio() { +const GpioPin* subghz_device_cc1101_ext_get_data_gpio(void) { return subghz_device_cc1101_ext->g0_pin; } -bool subghz_device_cc1101_ext_is_connect() { +bool subghz_device_cc1101_ext_is_connect(void) { bool ret = false; if(subghz_device_cc1101_ext == NULL) { // not initialized @@ -244,7 +244,7 @@ bool subghz_device_cc1101_ext_is_connect() { return ret; } -void subghz_device_cc1101_ext_sleep() { +void subghz_device_cc1101_ext_sleep(void) { furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateIdle); furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); @@ -259,7 +259,7 @@ void subghz_device_cc1101_ext_sleep() { furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_dump_state() { +void subghz_device_cc1101_ext_dump_state(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); printf( "[subghz_device_cc1101_ext] cc1101 chip %d, version %d\r\n", @@ -324,19 +324,19 @@ void subghz_device_cc1101_ext_write_packet(const uint8_t* data, uint8_t size) { furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_flush_rx() { +void subghz_device_cc1101_ext_flush_rx(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); cc1101_flush_rx(subghz_device_cc1101_ext->spi_bus_handle); furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_flush_tx() { +void subghz_device_cc1101_ext_flush_tx(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); cc1101_flush_tx(subghz_device_cc1101_ext->spi_bus_handle); furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -bool subghz_device_cc1101_ext_rx_pipe_not_empty() { +bool subghz_device_cc1101_ext_rx_pipe_not_empty(void) { CC1101RxBytes status[1]; furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); cc1101_read_reg( @@ -351,7 +351,7 @@ bool subghz_device_cc1101_ext_rx_pipe_not_empty() { } } -bool subghz_device_cc1101_ext_is_rx_data_crc_valid() { +bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); uint8_t data[1]; cc1101_read_reg( @@ -370,14 +370,14 @@ void subghz_device_cc1101_ext_read_packet(uint8_t* data, uint8_t* size) { furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_shutdown() { +void subghz_device_cc1101_ext_shutdown(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); // Reset and shutdown cc1101_shutdown(subghz_device_cc1101_ext->spi_bus_handle); furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_reset() { +void subghz_device_cc1101_ext_reset(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); furi_hal_gpio_init(subghz_device_cc1101_ext->g0_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow); cc1101_switch_to_idle(subghz_device_cc1101_ext->spi_bus_handle); @@ -388,7 +388,7 @@ void subghz_device_cc1101_ext_reset() { furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_idle() { +void subghz_device_cc1101_ext_idle(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); cc1101_switch_to_idle(subghz_device_cc1101_ext->spi_bus_handle); //waiting for the chip to switch to IDLE mode @@ -397,7 +397,7 @@ void subghz_device_cc1101_ext_idle() { furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -void subghz_device_cc1101_ext_rx() { +void subghz_device_cc1101_ext_rx(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); cc1101_switch_to_rx(subghz_device_cc1101_ext->spi_bus_handle); //waiting for the chip to switch to Rx mode @@ -406,7 +406,7 @@ void subghz_device_cc1101_ext_rx() { furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); } -bool subghz_device_cc1101_ext_tx() { +bool subghz_device_cc1101_ext_tx(void) { if(subghz_device_cc1101_ext->regulation != SubGhzDeviceCC1101ExtRegulationTxRx) return false; furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); cc1101_switch_to_tx(subghz_device_cc1101_ext->spi_bus_handle); @@ -417,7 +417,7 @@ bool subghz_device_cc1101_ext_tx() { return true; } -float subghz_device_cc1101_ext_get_rssi() { +float subghz_device_cc1101_ext_get_rssi(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); int32_t rssi_dec = cc1101_get_rssi(subghz_device_cc1101_ext->spi_bus_handle); furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle); @@ -432,7 +432,7 @@ float subghz_device_cc1101_ext_get_rssi() { return rssi; } -uint8_t subghz_device_cc1101_ext_get_lqi() { +uint8_t subghz_device_cc1101_ext_get_lqi(void) { furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle); uint8_t data[1]; cc1101_read_reg( @@ -472,7 +472,7 @@ uint32_t subghz_device_cc1101_ext_set_frequency(uint32_t value) { return real_frequency; } -static bool subghz_device_cc1101_ext_start_debug() { +static bool subghz_device_cc1101_ext_start_debug(void) { bool ret = false; if(subghz_device_cc1101_ext->async_mirror_pin != NULL) { furi_hal_gpio_init( @@ -485,7 +485,7 @@ static bool subghz_device_cc1101_ext_start_debug() { return ret; } -static bool subghz_device_cc1101_ext_stop_debug() { +static bool subghz_device_cc1101_ext_stop_debug(void) { bool ret = false; if(subghz_device_cc1101_ext->async_mirror_pin != NULL) { furi_hal_gpio_init( @@ -567,7 +567,7 @@ void subghz_device_cc1101_ext_start_async_rx( subghz_device_cc1101_ext->async_rx.capture_delta_duration = 0; } -void subghz_device_cc1101_ext_stop_async_rx() { +void subghz_device_cc1101_ext_stop_async_rx(void) { furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncRx); subghz_device_cc1101_ext->state = SubGhzDeviceCC1101ExtStateIdle; @@ -805,13 +805,13 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb return true; } -bool subghz_device_cc1101_ext_is_async_tx_complete() { +bool subghz_device_cc1101_ext_is_async_tx_complete(void) { return ( (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) && (LL_TIM_GetAutoReload(TIM17) == 0)); } -void subghz_device_cc1101_ext_stop_async_tx() { +void subghz_device_cc1101_ext_stop_async_tx(void) { furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx); // Shutdown radio diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext.h b/applications/drivers/subghz/cc1101_ext/cc1101_ext.h index dffb8a46d93..8e8e2befba1 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext.h +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext.h @@ -28,31 +28,31 @@ void subghz_device_cc1101_ext_set_async_mirror_pin(const GpioPin* pin); * * @return pointer to the gpio pin structure */ -const GpioPin* subghz_device_cc1101_ext_get_data_gpio(); +const GpioPin* subghz_device_cc1101_ext_get_data_gpio(void); /** Initialize device * * @return true if success */ -bool subghz_device_cc1101_ext_alloc(); +bool subghz_device_cc1101_ext_alloc(void); /** Deinitialize device */ -void subghz_device_cc1101_ext_free(); +void subghz_device_cc1101_ext_free(void); /** Check and switch to power save mode Used by internal API-HAL * initialization routine Can be used to reinitialize device to safe state and * send it to sleep */ -bool subghz_device_cc1101_ext_is_connect(); +bool subghz_device_cc1101_ext_is_connect(void); /** Send device to sleep mode */ -void subghz_device_cc1101_ext_sleep(); +void subghz_device_cc1101_ext_sleep(void); /** Dump info to stdout */ -void subghz_device_cc1101_ext_dump_state(); +void subghz_device_cc1101_ext_dump_state(void); /** Load custom registers from preset * @@ -83,13 +83,13 @@ void subghz_device_cc1101_ext_write_packet(const uint8_t* data, uint8_t size); * * @return true if not empty */ -bool subghz_device_cc1101_ext_rx_pipe_not_empty(); +bool subghz_device_cc1101_ext_rx_pipe_not_empty(void); /** Check if received data crc is valid * * @return true if valid */ -bool subghz_device_cc1101_ext_is_rx_data_crc_valid(); +bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void); /** Read packet from FIFO * @@ -100,47 +100,47 @@ void subghz_device_cc1101_ext_read_packet(uint8_t* data, uint8_t* size); /** Flush rx FIFO buffer */ -void subghz_device_cc1101_ext_flush_rx(); +void subghz_device_cc1101_ext_flush_rx(void); /** Flush tx FIFO buffer */ -void subghz_device_cc1101_ext_flush_tx(); +void subghz_device_cc1101_ext_flush_tx(void); /** Shutdown Issue SPWD command * @warning registers content will be lost */ -void subghz_device_cc1101_ext_shutdown(); +void subghz_device_cc1101_ext_shutdown(void); /** Reset Issue reset command * @warning registers content will be lost */ -void subghz_device_cc1101_ext_reset(); +void subghz_device_cc1101_ext_reset(void); /** Switch to Idle */ -void subghz_device_cc1101_ext_idle(); +void subghz_device_cc1101_ext_idle(void); /** Switch to Receive */ -void subghz_device_cc1101_ext_rx(); +void subghz_device_cc1101_ext_rx(void); /** Switch to Transmit * * @return true if the transfer is allowed by belonging to the region */ -bool subghz_device_cc1101_ext_tx(); +bool subghz_device_cc1101_ext_tx(void); /** Get RSSI value in dBm * * @return RSSI value */ -float subghz_device_cc1101_ext_get_rssi(); +float subghz_device_cc1101_ext_get_rssi(void); /** Get LQI * * @return LQI value */ -uint8_t subghz_device_cc1101_ext_get_lqi(); +uint8_t subghz_device_cc1101_ext_get_lqi(void); /** Check if frequency is in valid range * @@ -174,7 +174,7 @@ void subghz_device_cc1101_ext_start_async_rx( /** Disable signal timings capture Resets GPIO and TIM2 */ -void subghz_device_cc1101_ext_stop_async_rx(); +void subghz_device_cc1101_ext_stop_async_rx(void); /** Async TX callback type * @param context callback context @@ -195,11 +195,11 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb * * @return true if TX complete */ -bool subghz_device_cc1101_ext_is_async_tx_complete(); +bool subghz_device_cc1101_ext_is_async_tx_complete(void); /** Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1 */ -void subghz_device_cc1101_ext_stop_async_tx(); +void subghz_device_cc1101_ext_stop_async_tx(void); #ifdef __cplusplus } diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c index 1f119315436..68f2b8aff9c 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.c @@ -105,6 +105,6 @@ static const FlipperAppPluginDescriptor subghz_device_cc1101_ext_descriptor = { .entry_point = &subghz_device_cc1101_ext, }; -const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep() { +const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep(void) { return &subghz_device_cc1101_ext_descriptor; } \ No newline at end of file diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h b/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h index cf1ff3ee07f..3fcee45d566 100644 --- a/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h +++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h @@ -5,4 +5,4 @@ typedef struct SubGhzDeviceCC1101Ext SubGhzDeviceCC1101Ext; -const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep(); +const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep(void); diff --git a/applications/examples/example_ble_beacon/ble_beacon_app.c b/applications/examples/example_ble_beacon/ble_beacon_app.c index 20e3e307ab9..af213360278 100644 --- a/applications/examples/example_ble_beacon/ble_beacon_app.c +++ b/applications/examples/example_ble_beacon/ble_beacon_app.c @@ -57,7 +57,7 @@ static void ble_beacon_app_restore_beacon_state(BleBeaconApp* app) { app->beacon_data_len = furi_hal_bt_extra_beacon_get_data(app->beacon_data); } -static BleBeaconApp* ble_beacon_app_alloc() { +static BleBeaconApp* ble_beacon_app_alloc(void) { BleBeaconApp* app = malloc(sizeof(BleBeaconApp)); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/examples/example_plugins/plugin1.c b/applications/examples/example_plugins/plugin1.c index de8041f3435..05036d252ae 100644 --- a/applications/examples/example_plugins/plugin1.c +++ b/applications/examples/example_plugins/plugin1.c @@ -9,7 +9,7 @@ #include -static int example_plugin1_method1() { +static int example_plugin1_method1(void) { return 42; } @@ -32,6 +32,6 @@ static const FlipperAppPluginDescriptor example_plugin1_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* example_plugin1_ep() { +const FlipperAppPluginDescriptor* example_plugin1_ep(void) { return &example_plugin1_descriptor; } diff --git a/applications/examples/example_plugins/plugin2.c b/applications/examples/example_plugins/plugin2.c index a196437f4b7..bff170dde98 100644 --- a/applications/examples/example_plugins/plugin2.c +++ b/applications/examples/example_plugins/plugin2.c @@ -9,7 +9,7 @@ #include -static int example_plugin2_method1() { +static int example_plugin2_method1(void) { return 1337; } @@ -32,6 +32,6 @@ static const FlipperAppPluginDescriptor example_plugin2_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* example_plugin2_ep() { +const FlipperAppPluginDescriptor* example_plugin2_ep(void) { return &example_plugin2_descriptor; } diff --git a/applications/examples/example_plugins/plugin_interface.h b/applications/examples/example_plugins/plugin_interface.h index 85428429eed..fadb9089fef 100644 --- a/applications/examples/example_plugins/plugin_interface.h +++ b/applications/examples/example_plugins/plugin_interface.h @@ -11,6 +11,6 @@ typedef struct { const char* name; - int (*method1)(); + int (*method1)(void); int (*method2)(int, int); } ExamplePlugin; diff --git a/applications/examples/example_plugins_advanced/app_api.c b/applications/examples/example_plugins_advanced/app_api.c index 42b3a1860dd..4f314f4cec7 100644 --- a/applications/examples/example_plugins_advanced/app_api.c +++ b/applications/examples/example_plugins_advanced/app_api.c @@ -8,7 +8,7 @@ void app_api_accumulator_set(uint32_t value) { accumulator = value; } -uint32_t app_api_accumulator_get() { +uint32_t app_api_accumulator_get(void) { return accumulator; } diff --git a/applications/examples/example_plugins_advanced/app_api.h b/applications/examples/example_plugins_advanced/app_api.h index 60a52e6f762..df80455d706 100644 --- a/applications/examples/example_plugins_advanced/app_api.h +++ b/applications/examples/example_plugins_advanced/app_api.h @@ -15,7 +15,7 @@ extern "C" { void app_api_accumulator_set(uint32_t value); -uint32_t app_api_accumulator_get(); +uint32_t app_api_accumulator_get(void); void app_api_accumulator_add(uint32_t value); diff --git a/applications/examples/example_plugins_advanced/plugin1.c b/applications/examples/example_plugins_advanced/plugin1.c index 91308100799..e45122d9586 100644 --- a/applications/examples/example_plugins_advanced/plugin1.c +++ b/applications/examples/example_plugins_advanced/plugin1.c @@ -18,7 +18,7 @@ static void advanced_plugin1_method1(int arg1) { app_api_accumulator_add(arg1); } -static void advanced_plugin1_method2() { +static void advanced_plugin1_method2(void) { /* Accumulator value is stored inside host application */ FURI_LOG_I("TEST", "Plugin 1, accumulator: %lu", app_api_accumulator_get()); } @@ -38,6 +38,6 @@ static const FlipperAppPluginDescriptor advanced_plugin1_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* advanced_plugin1_ep() { +const FlipperAppPluginDescriptor* advanced_plugin1_ep(void) { return &advanced_plugin1_descriptor; } diff --git a/applications/examples/example_plugins_advanced/plugin2.c b/applications/examples/example_plugins_advanced/plugin2.c index 1ea5590b22e..efc8db47839 100644 --- a/applications/examples/example_plugins_advanced/plugin2.c +++ b/applications/examples/example_plugins_advanced/plugin2.c @@ -18,7 +18,7 @@ static void advanced_plugin2_method1(int arg1) { app_api_accumulator_mul(arg1); } -static void advanced_plugin2_method2() { +static void advanced_plugin2_method2(void) { /* Accumulator value is stored inside host application */ FURI_LOG_I("TEST", "Plugin 2, accumulator: %lu", app_api_accumulator_get()); } @@ -38,6 +38,6 @@ static const FlipperAppPluginDescriptor advanced_plugin2_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* advanced_plugin2_ep() { +const FlipperAppPluginDescriptor* advanced_plugin2_ep(void) { return &advanced_plugin2_descriptor; } diff --git a/applications/examples/example_plugins_advanced/plugin_interface.h b/applications/examples/example_plugins_advanced/plugin_interface.h index d78dc9ecc1c..4cef7567bc1 100644 --- a/applications/examples/example_plugins_advanced/plugin_interface.h +++ b/applications/examples/example_plugins_advanced/plugin_interface.h @@ -12,5 +12,5 @@ typedef struct { const char* name; void (*method1)(int); - void (*method2)(); + void (*method2)(void); } AdvancedPlugin; diff --git a/applications/examples/example_thermo/example_thermo.c b/applications/examples/example_thermo/example_thermo.c index 576ece38264..dafe5688631 100644 --- a/applications/examples/example_thermo/example_thermo.c +++ b/applications/examples/example_thermo/example_thermo.c @@ -315,7 +315,7 @@ static void example_thermo_run(ExampleThermoContext* context) { /******************** Initialisation & startup *****************************/ /* Allocate the memory and initialise the variables */ -static ExampleThermoContext* example_thermo_context_alloc() { +static ExampleThermoContext* example_thermo_context_alloc(void) { ExampleThermoContext* context = malloc(sizeof(ExampleThermoContext)); context->view_port = view_port_alloc(); diff --git a/applications/main/archive/archive.c b/applications/main/archive/archive.c index b8609cf2d88..8dd934cc7b9 100644 --- a/applications/main/archive/archive.c +++ b/applications/main/archive/archive.c @@ -12,7 +12,7 @@ bool archive_back_event_callback(void* context) { return scene_manager_handle_back_event(archive->scene_manager); } -ArchiveApp* archive_alloc() { +ArchiveApp* archive_alloc(void) { ArchiveApp* archive = malloc(sizeof(ArchiveApp)); archive->gui = furi_record_open(RECORD_GUI); diff --git a/applications/main/archive/helpers/archive_favorites.c b/applications/main/archive/helpers/archive_favorites.c index 682aa6b3830..351d68c1d28 100644 --- a/applications/main/archive/helpers/archive_favorites.c +++ b/applications/main/archive/helpers/archive_favorites.c @@ -79,7 +79,7 @@ uint16_t archive_favorites_count(void* context) { return lines; } -static bool archive_favourites_rescan() { +static bool archive_favourites_rescan(void) { FuriString* buffer; buffer = furi_string_alloc(); Storage* storage = furi_record_open(RECORD_STORAGE); diff --git a/applications/main/archive/views/archive_browser_view.c b/applications/main/archive/views/archive_browser_view.c index 447941504cd..6cdf12c6257 100644 --- a/applications/main/archive/views/archive_browser_view.c +++ b/applications/main/archive/views/archive_browser_view.c @@ -436,7 +436,7 @@ static void browser_view_exit(void* context) { furi_timer_stop(browser->scroll_timer); } -ArchiveBrowserView* browser_alloc() { +ArchiveBrowserView* browser_alloc(void) { ArchiveBrowserView* browser = malloc(sizeof(ArchiveBrowserView)); browser->view = view_alloc(); view_allocate_model(browser->view, ViewModelTypeLocking, sizeof(ArchiveBrowserViewModel)); diff --git a/applications/main/archive/views/archive_browser_view.h b/applications/main/archive/views/archive_browser_view.h index 25490aedd3e..5fbdaf973c8 100644 --- a/applications/main/archive/views/archive_browser_view.h +++ b/applications/main/archive/views/archive_browser_view.h @@ -111,5 +111,5 @@ void archive_browser_set_callback( View* archive_browser_get_view(ArchiveBrowserView* browser); -ArchiveBrowserView* browser_alloc(); +ArchiveBrowserView* browser_alloc(void); void browser_free(ArchiveBrowserView* browser); diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index c4aa9106229..1b0ea71d544 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -71,7 +71,7 @@ bool ducky_get_number(const char* param, uint32_t* val) { return false; } -void ducky_numlock_on() { +void ducky_numlock_on(void) { if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { furi_hal_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); furi_hal_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); diff --git a/applications/main/bad_usb/views/bad_usb_view.c b/applications/main/bad_usb/views/bad_usb_view.c index 588b260c45e..6ffa0f3c65d 100644 --- a/applications/main/bad_usb/views/bad_usb_view.c +++ b/applications/main/bad_usb/views/bad_usb_view.c @@ -193,7 +193,7 @@ static bool bad_usb_input_callback(InputEvent* event, void* context) { return consumed; } -BadUsb* bad_usb_alloc() { +BadUsb* bad_usb_alloc(void) { BadUsb* bad_usb = malloc(sizeof(BadUsb)); bad_usb->view = view_alloc(); diff --git a/applications/main/bad_usb/views/bad_usb_view.h b/applications/main/bad_usb/views/bad_usb_view.h index 6210835f016..ee58e7bd04c 100644 --- a/applications/main/bad_usb/views/bad_usb_view.h +++ b/applications/main/bad_usb/views/bad_usb_view.h @@ -6,7 +6,7 @@ typedef struct BadUsb BadUsb; typedef void (*BadUsbButtonCallback)(InputKey key, void* context); -BadUsb* bad_usb_alloc(); +BadUsb* bad_usb_alloc(void); void bad_usb_free(BadUsb* bad_usb); diff --git a/applications/main/gpio/gpio_app.c b/applications/main/gpio/gpio_app.c index 06d377d39ff..217423ecc31 100644 --- a/applications/main/gpio/gpio_app.c +++ b/applications/main/gpio/gpio_app.c @@ -21,7 +21,7 @@ static void gpio_app_tick_event_callback(void* context) { scene_manager_handle_tick_event(app->scene_manager); } -GpioApp* gpio_app_alloc() { +GpioApp* gpio_app_alloc(void) { GpioApp* app = malloc(sizeof(GpioApp)); app->expansion = furi_record_open(RECORD_EXPANSION); diff --git a/applications/main/gpio/gpio_items.c b/applications/main/gpio/gpio_items.c index 746abe032ae..f4267695bc8 100644 --- a/applications/main/gpio/gpio_items.c +++ b/applications/main/gpio/gpio_items.c @@ -7,7 +7,7 @@ struct GPIOItems { size_t count; }; -GPIOItems* gpio_items_alloc() { +GPIOItems* gpio_items_alloc(void) { GPIOItems* items = malloc(sizeof(GPIOItems)); items->count = 0; diff --git a/applications/main/gpio/gpio_items.h b/applications/main/gpio/gpio_items.h index 68afbe6934e..717b2991586 100644 --- a/applications/main/gpio/gpio_items.h +++ b/applications/main/gpio/gpio_items.h @@ -8,7 +8,7 @@ extern "C" { typedef struct GPIOItems GPIOItems; -GPIOItems* gpio_items_alloc(); +GPIOItems* gpio_items_alloc(void); void gpio_items_free(GPIOItems* items); diff --git a/applications/main/gpio/views/gpio_usb_uart.c b/applications/main/gpio/views/gpio_usb_uart.c index 3234309a294..f3d047d67d6 100644 --- a/applications/main/gpio/views/gpio_usb_uart.c +++ b/applications/main/gpio/views/gpio_usb_uart.c @@ -101,7 +101,7 @@ static bool gpio_usb_uart_input_callback(InputEvent* event, void* context) { return consumed; } -GpioUsbUart* gpio_usb_uart_alloc() { +GpioUsbUart* gpio_usb_uart_alloc(void) { GpioUsbUart* usb_uart = malloc(sizeof(GpioUsbUart)); usb_uart->view = view_alloc(); diff --git a/applications/main/gpio/views/gpio_usb_uart.h b/applications/main/gpio/views/gpio_usb_uart.h index 854b51f8d7a..531121f2b9f 100644 --- a/applications/main/gpio/views/gpio_usb_uart.h +++ b/applications/main/gpio/views/gpio_usb_uart.h @@ -7,7 +7,7 @@ typedef struct GpioUsbUart GpioUsbUart; typedef void (*GpioUsbUartCallback)(GpioCustomEvent event, void* context); -GpioUsbUart* gpio_usb_uart_alloc(); +GpioUsbUart* gpio_usb_uart_alloc(void); void gpio_usb_uart_free(GpioUsbUart* usb_uart); diff --git a/applications/main/ibutton/ibutton.c b/applications/main/ibutton/ibutton.c index afd51f7c9e1..b6e8a20cf9c 100644 --- a/applications/main/ibutton/ibutton.c +++ b/applications/main/ibutton/ibutton.c @@ -77,7 +77,7 @@ void ibutton_tick_event_callback(void* context) { scene_manager_handle_tick_event(ibutton->scene_manager); } -iButton* ibutton_alloc() { +iButton* ibutton_alloc(void) { iButton* ibutton = malloc(sizeof(iButton)); ibutton->file_path = furi_string_alloc(); diff --git a/applications/main/ibutton/ibutton_cli.c b/applications/main/ibutton/ibutton_cli.c index 54bc808b5ee..98ef308016b 100644 --- a/applications/main/ibutton/ibutton_cli.c +++ b/applications/main/ibutton/ibutton_cli.c @@ -11,7 +11,7 @@ static void ibutton_cli(Cli* cli, FuriString* args, void* context); // app cli function -void ibutton_on_system_start() { +void ibutton_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, "ikey", CliCommandFlagDefault, ibutton_cli, cli); @@ -21,7 +21,7 @@ void ibutton_on_system_start() { #endif } -static void ibutton_cli_print_usage() { +static void ibutton_cli_print_usage(void) { printf("Usage:\r\n"); printf("ikey read\r\n"); printf("ikey emulate \r\n"); diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 50534c660d2..7ccbb6ceafa 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -126,7 +126,7 @@ static void infrared_find_vacant_remote_name(FuriString* name, const char* path) furi_record_close(RECORD_STORAGE); } -static InfraredApp* infrared_alloc() { +static InfraredApp* infrared_alloc(void) { InfraredApp* infrared = malloc(sizeof(InfraredApp)); infrared->task_thread = diff --git a/applications/main/infrared/infrared_brute_force.c b/applications/main/infrared/infrared_brute_force.c index b941a4760fc..b28918489dd 100644 --- a/applications/main/infrared/infrared_brute_force.c +++ b/applications/main/infrared/infrared_brute_force.c @@ -27,7 +27,7 @@ struct InfraredBruteForce { bool is_started; }; -InfraredBruteForce* infrared_brute_force_alloc() { +InfraredBruteForce* infrared_brute_force_alloc(void) { InfraredBruteForce* brute_force = malloc(sizeof(InfraredBruteForce)); brute_force->ff = NULL; brute_force->db_filename = NULL; diff --git a/applications/main/infrared/infrared_brute_force.h b/applications/main/infrared/infrared_brute_force.h index 33677d2ec18..8eda08a63ec 100644 --- a/applications/main/infrared/infrared_brute_force.h +++ b/applications/main/infrared/infrared_brute_force.h @@ -21,7 +21,7 @@ typedef struct InfraredBruteForce InfraredBruteForce; * * @returns pointer to the created instance. */ -InfraredBruteForce* infrared_brute_force_alloc(); +InfraredBruteForce* infrared_brute_force_alloc(void); /** * @brief Delete an InfraredBruteForce instance. diff --git a/applications/main/infrared/infrared_cli.c b/applications/main/infrared/infrared_cli.c index c960ffa2856..b498fc6006b 100644 --- a/applications/main/infrared/infrared_cli.c +++ b/applications/main/infrared/infrared_cli.c @@ -508,7 +508,7 @@ static void infrared_cli_start_ir(Cli* cli, FuriString* args, void* context) { furi_string_free(command); } -void infrared_on_system_start() { +void infrared_on_system_start(void) { #ifdef SRV_CLI Cli* cli = (Cli*)furi_record_open(RECORD_CLI); cli_add_command(cli, "ir", CliCommandFlagDefault, infrared_cli_start_ir, NULL); diff --git a/applications/main/infrared/infrared_remote.c b/applications/main/infrared/infrared_remote.c index cab241c1258..c574d75c76c 100644 --- a/applications/main/infrared/infrared_remote.c +++ b/applications/main/infrared/infrared_remote.c @@ -37,7 +37,7 @@ typedef struct { typedef bool ( *InfraredBatchCallback)(const InfraredBatch* batch, const InfraredBatchTarget* target); -InfraredRemote* infrared_remote_alloc() { +InfraredRemote* infrared_remote_alloc(void) { InfraredRemote* remote = malloc(sizeof(InfraredRemote)); StringArray_init(remote->signal_names); remote->name = furi_string_alloc(); diff --git a/applications/main/infrared/infrared_remote.h b/applications/main/infrared/infrared_remote.h index 7477cd3b5af..4604a25ef0f 100644 --- a/applications/main/infrared/infrared_remote.h +++ b/applications/main/infrared/infrared_remote.h @@ -23,7 +23,7 @@ typedef struct InfraredRemote InfraredRemote; * * @returns pointer to the created instance. */ -InfraredRemote* infrared_remote_alloc(); +InfraredRemote* infrared_remote_alloc(void); /** * @brief Delete an InfraredRemote instance. diff --git a/applications/main/infrared/infrared_signal.c b/applications/main/infrared/infrared_signal.c index eec8c19cb9a..8902fc04c36 100644 --- a/applications/main/infrared/infrared_signal.c +++ b/applications/main/infrared/infrared_signal.c @@ -201,7 +201,7 @@ bool infrared_signal_read_body(InfraredSignal* signal, FlipperFormat* ff) { return success; } -InfraredSignal* infrared_signal_alloc() { +InfraredSignal* infrared_signal_alloc(void) { InfraredSignal* signal = malloc(sizeof(InfraredSignal)); signal->is_raw = false; diff --git a/applications/main/infrared/infrared_signal.h b/applications/main/infrared/infrared_signal.h index 69b677f2376..dcfde6e729a 100644 --- a/applications/main/infrared/infrared_signal.h +++ b/applications/main/infrared/infrared_signal.h @@ -36,7 +36,7 @@ typedef struct { * * @returns pointer to the instance created. */ -InfraredSignal* infrared_signal_alloc(); +InfraredSignal* infrared_signal_alloc(void); /** * @brief Delete an InfraredSignal instance. diff --git a/applications/main/infrared/views/infrared_debug_view.c b/applications/main/infrared/views/infrared_debug_view.c index ec08962813e..4eb58434ced 100644 --- a/applications/main/infrared/views/infrared_debug_view.c +++ b/applications/main/infrared/views/infrared_debug_view.c @@ -30,7 +30,7 @@ static void infrared_debug_view_draw_callback(Canvas* canvas, void* model) { } } -InfraredDebugView* infrared_debug_view_alloc() { +InfraredDebugView* infrared_debug_view_alloc(void) { InfraredDebugView* debug_view = malloc(sizeof(InfraredDebugView)); debug_view->view = view_alloc(); view_allocate_model(debug_view->view, ViewModelTypeLocking, sizeof(InfraredDebugViewModel)); diff --git a/applications/main/infrared/views/infrared_debug_view.h b/applications/main/infrared/views/infrared_debug_view.h index 722850f8d4d..29cb0ff2dad 100644 --- a/applications/main/infrared/views/infrared_debug_view.h +++ b/applications/main/infrared/views/infrared_debug_view.h @@ -4,7 +4,7 @@ typedef struct InfraredDebugView InfraredDebugView; -InfraredDebugView* infrared_debug_view_alloc(); +InfraredDebugView* infrared_debug_view_alloc(void); void infrared_debug_view_free(InfraredDebugView* debug_view); View* infrared_debug_view_get_view(InfraredDebugView* debug_view); diff --git a/applications/main/infrared/views/infrared_progress_view.h b/applications/main/infrared/views/infrared_progress_view.h index e8f76ba1fa6..c44f1a48289 100644 --- a/applications/main/infrared/views/infrared_progress_view.h +++ b/applications/main/infrared/views/infrared_progress_view.h @@ -20,7 +20,7 @@ typedef void (*InfraredProgressViewBackCallback)(void*); * * @retval new allocated instance */ -InfraredProgressView* infrared_progress_view_alloc(); +InfraredProgressView* infrared_progress_view_alloc(void); /** Free previously allocated Progress view module instance * diff --git a/applications/main/lfrfid/lfrfid.c b/applications/main/lfrfid/lfrfid.c index cd0613861fe..3bc7a8b1304 100644 --- a/applications/main/lfrfid/lfrfid.c +++ b/applications/main/lfrfid/lfrfid.c @@ -33,7 +33,7 @@ static void rpc_command_callback(const RpcAppSystemEvent* event, void* context) } } -static LfRfid* lfrfid_alloc() { +static LfRfid* lfrfid_alloc(void) { LfRfid* lfrfid = malloc(sizeof(LfRfid)); lfrfid->storage = furi_record_open(RECORD_STORAGE); diff --git a/applications/main/lfrfid/lfrfid_cli.c b/applications/main/lfrfid/lfrfid_cli.c index af340008a81..2101670fa73 100644 --- a/applications/main/lfrfid/lfrfid_cli.c +++ b/applications/main/lfrfid/lfrfid_cli.c @@ -17,13 +17,13 @@ static void lfrfid_cli(Cli* cli, FuriString* args, void* context); // app cli function -void lfrfid_on_system_start() { +void lfrfid_on_system_start(void) { Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, "rfid", CliCommandFlagDefault, lfrfid_cli, NULL); furi_record_close(RECORD_CLI); } -static void lfrfid_cli_print_usage() { +static void lfrfid_cli_print_usage(void) { printf("Usage:\r\n"); printf("rfid read - read in ASK/PSK mode\r\n"); printf("rfid - write or emulate a card\r\n"); diff --git a/applications/main/lfrfid/views/lfrfid_view_read.c b/applications/main/lfrfid/views/lfrfid_view_read.c index 094afb61758..a1c859af9b8 100644 --- a/applications/main/lfrfid/views/lfrfid_view_read.c +++ b/applications/main/lfrfid/views/lfrfid_view_read.c @@ -66,7 +66,7 @@ void lfrfid_view_read_exit(void* context) { read_view->view, LfRfidReadViewModel * model, { icon_animation_stop(model->icon); }, false); } -LfRfidReadView* lfrfid_view_read_alloc() { +LfRfidReadView* lfrfid_view_read_alloc(void) { LfRfidReadView* read_view = malloc(sizeof(LfRfidReadView)); read_view->view = view_alloc(); view_set_context(read_view->view, read_view); diff --git a/applications/main/lfrfid/views/lfrfid_view_read.h b/applications/main/lfrfid/views/lfrfid_view_read.h index 55bb1f230fa..f647ac3547f 100644 --- a/applications/main/lfrfid/views/lfrfid_view_read.h +++ b/applications/main/lfrfid/views/lfrfid_view_read.h @@ -10,7 +10,7 @@ typedef enum { typedef struct LfRfidReadView LfRfidReadView; -LfRfidReadView* lfrfid_view_read_alloc(); +LfRfidReadView* lfrfid_view_read_alloc(void); void lfrfid_view_read_free(LfRfidReadView* read_view); diff --git a/applications/main/nfc/helpers/mf_classic_key_cache.c b/applications/main/nfc/helpers/mf_classic_key_cache.c index 5127e645209..2c1141e9c69 100644 --- a/applications/main/nfc/helpers/mf_classic_key_cache.c +++ b/applications/main/nfc/helpers/mf_classic_key_cache.c @@ -23,7 +23,7 @@ static void nfc_get_key_cache_file_path(const uint8_t* uid, size_t uid_len, Furi furi_string_cat_printf(path, "%s", NFC_APP_KEYS_EXTENSION); } -MfClassicKeyCache* mf_classic_key_cache_alloc() { +MfClassicKeyCache* mf_classic_key_cache_alloc(void) { MfClassicKeyCache* instance = malloc(sizeof(MfClassicKeyCache)); return instance; diff --git a/applications/main/nfc/helpers/mf_classic_key_cache.h b/applications/main/nfc/helpers/mf_classic_key_cache.h index 407c6e28bd4..b09f4526bab 100644 --- a/applications/main/nfc/helpers/mf_classic_key_cache.h +++ b/applications/main/nfc/helpers/mf_classic_key_cache.h @@ -8,7 +8,7 @@ extern "C" { typedef struct MfClassicKeyCache MfClassicKeyCache; -MfClassicKeyCache* mf_classic_key_cache_alloc(); +MfClassicKeyCache* mf_classic_key_cache_alloc(void); void mf_classic_key_cache_free(MfClassicKeyCache* instance); diff --git a/applications/main/nfc/helpers/mf_ultralight_auth.c b/applications/main/nfc/helpers/mf_ultralight_auth.c index 5e0c67887f6..d954c1f7e91 100644 --- a/applications/main/nfc/helpers/mf_ultralight_auth.c +++ b/applications/main/nfc/helpers/mf_ultralight_auth.c @@ -3,7 +3,7 @@ #include #include -MfUltralightAuth* mf_ultralight_auth_alloc() { +MfUltralightAuth* mf_ultralight_auth_alloc(void) { MfUltralightAuth* instance = malloc(sizeof(MfUltralightAuth)); return instance; diff --git a/applications/main/nfc/helpers/mf_ultralight_auth.h b/applications/main/nfc/helpers/mf_ultralight_auth.h index 2ddfcafe12b..51267b3eab3 100644 --- a/applications/main/nfc/helpers/mf_ultralight_auth.h +++ b/applications/main/nfc/helpers/mf_ultralight_auth.h @@ -20,7 +20,7 @@ typedef struct { MfUltralightAuthPack pack; } MfUltralightAuth; -MfUltralightAuth* mf_ultralight_auth_alloc(); +MfUltralightAuth* mf_ultralight_auth_alloc(void); void mf_ultralight_auth_free(MfUltralightAuth* instance); diff --git a/applications/main/nfc/helpers/nfc_supported_cards.c b/applications/main/nfc/helpers/nfc_supported_cards.c index f5668b506d7..1e0e7ba6bf2 100644 --- a/applications/main/nfc/helpers/nfc_supported_cards.c +++ b/applications/main/nfc/helpers/nfc_supported_cards.c @@ -53,7 +53,7 @@ struct NfcSupportedCards { NfcSupportedCardsLoadContext* load_context; }; -NfcSupportedCards* nfc_supported_cards_alloc() { +NfcSupportedCards* nfc_supported_cards_alloc(void) { NfcSupportedCards* instance = malloc(sizeof(NfcSupportedCards)); instance->api_resolver = composite_api_resolver_alloc(); @@ -81,7 +81,7 @@ void nfc_supported_cards_free(NfcSupportedCards* instance) { free(instance); } -static NfcSupportedCardsLoadContext* nfc_supported_cards_load_context_alloc() { +static NfcSupportedCardsLoadContext* nfc_supported_cards_load_context_alloc(void) { NfcSupportedCardsLoadContext* instance = malloc(sizeof(NfcSupportedCardsLoadContext)); instance->storage = furi_record_open(RECORD_STORAGE); diff --git a/applications/main/nfc/helpers/nfc_supported_cards.h b/applications/main/nfc/helpers/nfc_supported_cards.h index 7778c6f22d7..5eaee360aa6 100644 --- a/applications/main/nfc/helpers/nfc_supported_cards.h +++ b/applications/main/nfc/helpers/nfc_supported_cards.h @@ -25,7 +25,7 @@ typedef struct NfcSupportedCards NfcSupportedCards; * * @return pointer to allocated NfcSupportedCards instance. */ -NfcSupportedCards* nfc_supported_cards_alloc(); +NfcSupportedCards* nfc_supported_cards_alloc(void); /** * @brief Delete an NfcSupportedCards instance diff --git a/applications/main/nfc/helpers/slix_unlock.c b/applications/main/nfc/helpers/slix_unlock.c index 931ec179059..d2306777ebe 100644 --- a/applications/main/nfc/helpers/slix_unlock.c +++ b/applications/main/nfc/helpers/slix_unlock.c @@ -13,7 +13,7 @@ struct SlixUnlock { static const SlixPassword tonie_box_pass_arr[] = {0x5B6EFD7F, 0x0F0F0F0F}; -SlixUnlock* slix_unlock_alloc() { +SlixUnlock* slix_unlock_alloc(void) { SlixUnlock* instance = malloc(sizeof(SlixUnlock)); return instance; diff --git a/applications/main/nfc/helpers/slix_unlock.h b/applications/main/nfc/helpers/slix_unlock.h index c378891e4d9..b5cd30c620a 100644 --- a/applications/main/nfc/helpers/slix_unlock.h +++ b/applications/main/nfc/helpers/slix_unlock.h @@ -13,7 +13,7 @@ typedef enum { typedef struct SlixUnlock SlixUnlock; -SlixUnlock* slix_unlock_alloc(); +SlixUnlock* slix_unlock_alloc(void); void slix_unlock_free(SlixUnlock* instance); diff --git a/applications/main/nfc/nfc_app.c b/applications/main/nfc/nfc_app.c index 8120268e0ea..26821c8f71b 100644 --- a/applications/main/nfc/nfc_app.c +++ b/applications/main/nfc/nfc_app.c @@ -36,7 +36,7 @@ static void nfc_app_rpc_command_callback(const RpcAppSystemEvent* event, void* c } } -NfcApp* nfc_app_alloc() { +NfcApp* nfc_app_alloc(void) { NfcApp* instance = malloc(sizeof(NfcApp)); instance->view_dispatcher = view_dispatcher_alloc(); @@ -457,7 +457,7 @@ void nfc_append_filename_string_when_present(NfcApp* instance, FuriString* strin } } -static bool nfc_is_hal_ready() { +static bool nfc_is_hal_ready(void) { if(furi_hal_nfc_is_hal_ready() != FuriHalNfcErrorNone) { // No connection to the chip, show an error screen DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); diff --git a/applications/main/nfc/nfc_cli.c b/applications/main/nfc/nfc_cli.c index b5a40b122da..90ac26d7c23 100644 --- a/applications/main/nfc/nfc_cli.c +++ b/applications/main/nfc/nfc_cli.c @@ -8,7 +8,7 @@ #define FLAG_EVENT (1 << 10) -static void nfc_cli_print_usage() { +static void nfc_cli_print_usage(void) { printf("Usage:\r\n"); printf("nfc \r\n"); printf("Cmd list:\r\n"); @@ -63,7 +63,7 @@ static void nfc_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void nfc_on_system_start() { +void nfc_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, "nfc", CliCommandFlagDefault, nfc_cli, NULL); diff --git a/applications/main/nfc/plugins/supported_cards/aime.c b/applications/main/nfc/plugins/supported_cards/aime.c index ab122d92b94..fd2afe00c24 100644 --- a/applications/main/nfc/plugins/supported_cards/aime.c +++ b/applications/main/nfc/plugins/supported_cards/aime.c @@ -164,6 +164,6 @@ static const FlipperAppPluginDescriptor aime_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* aime_plugin_ep() { +const FlipperAppPluginDescriptor* aime_plugin_ep(void) { return &aime_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/all_in_one.c b/applications/main/nfc/plugins/supported_cards/all_in_one.c index 1be23d1f332..da153a6f024 100644 --- a/applications/main/nfc/plugins/supported_cards/all_in_one.c +++ b/applications/main/nfc/plugins/supported_cards/all_in_one.c @@ -102,6 +102,6 @@ static const FlipperAppPluginDescriptor all_in_one_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* all_in_one_plugin_ep() { +const FlipperAppPluginDescriptor* all_in_one_plugin_ep(void) { return &all_in_one_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/bip.c b/applications/main/nfc/plugins/supported_cards/bip.c index f6fed6774b1..548afed71f4 100644 --- a/applications/main/nfc/plugins/supported_cards/bip.c +++ b/applications/main/nfc/plugins/supported_cards/bip.c @@ -363,6 +363,6 @@ static const FlipperAppPluginDescriptor bip_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* bip_plugin_ep() { +const FlipperAppPluginDescriptor* bip_plugin_ep(void) { return &bip_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/clipper.c b/applications/main/nfc/plugins/supported_cards/clipper.c index 6560925b047..04a2afcda30 100644 --- a/applications/main/nfc/plugins/supported_cards/clipper.c +++ b/applications/main/nfc/plugins/supported_cards/clipper.c @@ -616,6 +616,6 @@ static const FlipperAppPluginDescriptor clipper_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* clipper_plugin_ep() { +const FlipperAppPluginDescriptor* clipper_plugin_ep(void) { return &clipper_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/gallagher.c b/applications/main/nfc/plugins/supported_cards/gallagher.c index 5772b46d70b..84ac335a49c 100644 --- a/applications/main/nfc/plugins/supported_cards/gallagher.c +++ b/applications/main/nfc/plugins/supported_cards/gallagher.c @@ -83,6 +83,6 @@ static const FlipperAppPluginDescriptor gallagher_plugin_descriptor = { }; /* Plugin entry point */ -const FlipperAppPluginDescriptor* gallagher_plugin_ep() { +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 9f8b0afae2e..f24c1c11a8f 100644 --- a/applications/main/nfc/plugins/supported_cards/hi.c +++ b/applications/main/nfc/plugins/supported_cards/hi.c @@ -220,6 +220,6 @@ static const FlipperAppPluginDescriptor hi_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* hi_plugin_ep() { +const FlipperAppPluginDescriptor* hi_plugin_ep(void) { return &hi_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/hid.c b/applications/main/nfc/plugins/supported_cards/hid.c index 1865f2e7a27..92f23d10fcd 100644 --- a/applications/main/nfc/plugins/supported_cards/hid.c +++ b/applications/main/nfc/plugins/supported_cards/hid.c @@ -148,6 +148,6 @@ static const FlipperAppPluginDescriptor hid_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* hid_plugin_ep() { +const FlipperAppPluginDescriptor* hid_plugin_ep(void) { return &hid_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/itso.c b/applications/main/nfc/plugins/supported_cards/itso.c index d9fefb63c9f..1b61c26e7c7 100644 --- a/applications/main/nfc/plugins/supported_cards/itso.c +++ b/applications/main/nfc/plugins/supported_cards/itso.c @@ -119,6 +119,6 @@ static const FlipperAppPluginDescriptor itso_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* itso_plugin_ep() { +const FlipperAppPluginDescriptor* itso_plugin_ep(void) { return &itso_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/microel.c b/applications/main/nfc/plugins/supported_cards/microel.c index 8a5129f7dc4..fa3be7235e4 100644 --- a/applications/main/nfc/plugins/supported_cards/microel.c +++ b/applications/main/nfc/plugins/supported_cards/microel.c @@ -225,6 +225,6 @@ static const FlipperAppPluginDescriptor microel_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* microel_plugin_ep() { +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 6967c3228b6..0fd1a8f4a90 100644 --- a/applications/main/nfc/plugins/supported_cards/mizip.c +++ b/applications/main/nfc/plugins/supported_cards/mizip.c @@ -251,6 +251,6 @@ static const FlipperAppPluginDescriptor mizip_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* mizip_plugin_ep() { +const FlipperAppPluginDescriptor* mizip_plugin_ep(void) { return &mizip_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/mykey.c b/applications/main/nfc/plugins/supported_cards/mykey.c index e25e1e0a15e..ac5fec97c24 100644 --- a/applications/main/nfc/plugins/supported_cards/mykey.c +++ b/applications/main/nfc/plugins/supported_cards/mykey.c @@ -152,6 +152,6 @@ static const FlipperAppPluginDescriptor mykey_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* mykey_plugin_ep() { +const FlipperAppPluginDescriptor* mykey_plugin_ep(void) { return &mykey_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/myki.c b/applications/main/nfc/plugins/supported_cards/myki.c index 70a6963710f..c4f1625f51e 100644 --- a/applications/main/nfc/plugins/supported_cards/myki.c +++ b/applications/main/nfc/plugins/supported_cards/myki.c @@ -111,6 +111,6 @@ static const FlipperAppPluginDescriptor myki_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* myki_plugin_ep() { +const FlipperAppPluginDescriptor* myki_plugin_ep(void) { return &myki_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/opal.c b/applications/main/nfc/plugins/supported_cards/opal.c index f9c386326d4..15bec852b36 100644 --- a/applications/main/nfc/plugins/supported_cards/opal.c +++ b/applications/main/nfc/plugins/supported_cards/opal.c @@ -228,6 +228,6 @@ static const FlipperAppPluginDescriptor opal_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* opal_plugin_ep() { +const FlipperAppPluginDescriptor* opal_plugin_ep(void) { return &opal_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/plantain.c b/applications/main/nfc/plugins/supported_cards/plantain.c index 2ed02f49c6a..51222840542 100644 --- a/applications/main/nfc/plugins/supported_cards/plantain.c +++ b/applications/main/nfc/plugins/supported_cards/plantain.c @@ -215,6 +215,6 @@ static const FlipperAppPluginDescriptor plantain_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* plantain_plugin_ep() { +const FlipperAppPluginDescriptor* plantain_plugin_ep(void) { return &plantain_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/troika.c b/applications/main/nfc/plugins/supported_cards/troika.c index 758f824b70b..84e92d3e0c9 100644 --- a/applications/main/nfc/plugins/supported_cards/troika.c +++ b/applications/main/nfc/plugins/supported_cards/troika.c @@ -244,6 +244,6 @@ static const FlipperAppPluginDescriptor troika_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* troika_plugin_ep() { +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/two_cities.c b/applications/main/nfc/plugins/supported_cards/two_cities.c index fa1b1c1845b..26f42ba89a5 100644 --- a/applications/main/nfc/plugins/supported_cards/two_cities.c +++ b/applications/main/nfc/plugins/supported_cards/two_cities.c @@ -186,6 +186,6 @@ static const FlipperAppPluginDescriptor two_cities_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* two_cities_plugin_ep() { +const FlipperAppPluginDescriptor* two_cities_plugin_ep(void) { return &two_cities_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/umarsh.c b/applications/main/nfc/plugins/supported_cards/umarsh.c index ba8e481be10..fd0b0968087 100644 --- a/applications/main/nfc/plugins/supported_cards/umarsh.c +++ b/applications/main/nfc/plugins/supported_cards/umarsh.c @@ -148,6 +148,6 @@ static const FlipperAppPluginDescriptor umarsh_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* umarsh_plugin_ep() { +const FlipperAppPluginDescriptor* umarsh_plugin_ep(void) { return &umarsh_plugin_descriptor; } diff --git a/applications/main/nfc/plugins/supported_cards/washcity.c b/applications/main/nfc/plugins/supported_cards/washcity.c index 179b569d7e2..6a8c8c28ba9 100644 --- a/applications/main/nfc/plugins/supported_cards/washcity.c +++ b/applications/main/nfc/plugins/supported_cards/washcity.c @@ -192,6 +192,6 @@ static const FlipperAppPluginDescriptor washcity_plugin_descriptor = { }; /* Plugin entry point - must return a pointer to const descriptor */ -const FlipperAppPluginDescriptor* washcity_plugin_ep() { +const FlipperAppPluginDescriptor* washcity_plugin_ep(void) { return &washcity_plugin_descriptor; } \ No newline at end of file diff --git a/applications/main/nfc/views/detect_reader.c b/applications/main/nfc/views/detect_reader.c index 4d7b324e0a5..132416d9abc 100644 --- a/applications/main/nfc/views/detect_reader.c +++ b/applications/main/nfc/views/detect_reader.c @@ -86,7 +86,7 @@ static bool detect_reader_input_callback(InputEvent* event, void* context) { return consumed; } -DetectReader* detect_reader_alloc() { +DetectReader* detect_reader_alloc(void) { DetectReader* detect_reader = malloc(sizeof(DetectReader)); detect_reader->view = view_alloc(); view_allocate_model(detect_reader->view, ViewModelTypeLocking, sizeof(DetectReaderViewModel)); diff --git a/applications/main/nfc/views/detect_reader.h b/applications/main/nfc/views/detect_reader.h index 6481216b4cf..eda3d4ca38a 100644 --- a/applications/main/nfc/views/detect_reader.h +++ b/applications/main/nfc/views/detect_reader.h @@ -14,7 +14,7 @@ typedef enum { typedef void (*DetectReaderDoneCallback)(void* context); -DetectReader* detect_reader_alloc(); +DetectReader* detect_reader_alloc(void); void detect_reader_free(DetectReader* detect_reader); diff --git a/applications/main/nfc/views/dict_attack.c b/applications/main/nfc/views/dict_attack.c index ce867908838..14298a6aa77 100644 --- a/applications/main/nfc/views/dict_attack.c +++ b/applications/main/nfc/views/dict_attack.c @@ -92,7 +92,7 @@ static bool dict_attack_input_callback(InputEvent* event, void* context) { return consumed; } -DictAttack* dict_attack_alloc() { +DictAttack* dict_attack_alloc(void) { DictAttack* instance = malloc(sizeof(DictAttack)); instance->view = view_alloc(); view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(DictAttackViewModel)); diff --git a/applications/main/nfc/views/dict_attack.h b/applications/main/nfc/views/dict_attack.h index 54a0220fe59..30f3b3c44ae 100644 --- a/applications/main/nfc/views/dict_attack.h +++ b/applications/main/nfc/views/dict_attack.h @@ -15,7 +15,7 @@ typedef enum { typedef void (*DictAttackCallback)(DictAttackEvent event, void* context); -DictAttack* dict_attack_alloc(); +DictAttack* dict_attack_alloc(void); void dict_attack_free(DictAttack* instance); diff --git a/applications/main/onewire/onewire_cli.c b/applications/main/onewire/onewire_cli.c index 5f6cdc670bd..19e58421750 100644 --- a/applications/main/onewire/onewire_cli.c +++ b/applications/main/onewire/onewire_cli.c @@ -8,7 +8,7 @@ static void onewire_cli(Cli* cli, FuriString* args, void* context); -void onewire_on_system_start() { +void onewire_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, "onewire", CliCommandFlagDefault, onewire_cli, cli); @@ -18,7 +18,7 @@ void onewire_on_system_start() { #endif } -static void onewire_cli_print_usage() { +static void onewire_cli_print_usage(void) { printf("Usage:\r\n"); printf("onewire search\r\n"); }; diff --git a/applications/main/subghz/helpers/subghz_txrx.c b/applications/main/subghz/helpers/subghz_txrx.c index e3e06695173..bcc0cc433d9 100644 --- a/applications/main/subghz/helpers/subghz_txrx.c +++ b/applications/main/subghz/helpers/subghz_txrx.c @@ -27,7 +27,7 @@ static void subghz_txrx_radio_device_power_off(SubGhzTxRx* instance) { if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg(); } -SubGhzTxRx* subghz_txrx_alloc() { +SubGhzTxRx* subghz_txrx_alloc(void) { SubGhzTxRx* instance = malloc(sizeof(SubGhzTxRx)); instance->setting = subghz_setting_alloc(); subghz_setting_load(instance->setting, EXT_PATH("subghz/assets/setting_user")); diff --git a/applications/main/subghz/helpers/subghz_txrx.h b/applications/main/subghz/helpers/subghz_txrx.h index e49789206f0..a16625f8b71 100644 --- a/applications/main/subghz/helpers/subghz_txrx.h +++ b/applications/main/subghz/helpers/subghz_txrx.h @@ -24,7 +24,7 @@ typedef enum { * * @return SubGhzTxRx* pointer to SubGhzTxRx */ -SubGhzTxRx* subghz_txrx_alloc(); +SubGhzTxRx* subghz_txrx_alloc(void); /** * Free SubGhzTxRx diff --git a/applications/main/subghz/subghz.c b/applications/main/subghz/subghz.c index 69a72e95d63..b71d271d44c 100644 --- a/applications/main/subghz/subghz.c +++ b/applications/main/subghz/subghz.c @@ -48,7 +48,7 @@ static void subghz_rpc_command_callback(const RpcAppSystemEvent* event, void* co } } -SubGhz* subghz_alloc() { +SubGhz* subghz_alloc(void) { SubGhz* subghz = malloc(sizeof(SubGhz)); subghz->file_path = furi_string_alloc(); diff --git a/applications/main/subghz/subghz_cli.c b/applications/main/subghz/subghz_cli.c index 3400011ecba..679dafaf151 100644 --- a/applications/main/subghz/subghz_cli.c +++ b/applications/main/subghz/subghz_cli.c @@ -30,7 +30,7 @@ #define TAG "SubGhzCli" -static void subghz_cli_radio_device_power_on() { +static void subghz_cli_radio_device_power_on(void) { uint8_t attempts = 5; while(--attempts > 0) { if(furi_hal_power_enable_otg()) break; @@ -45,7 +45,7 @@ static void subghz_cli_radio_device_power_on() { } } -static void subghz_cli_radio_device_power_off() { +static void subghz_cli_radio_device_power_off(void) { if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg(); } @@ -831,7 +831,7 @@ void subghz_cli_command_tx_from_file(Cli* cli, FuriString* args, void* context) subghz_environment_free(environment); } -static void subghz_cli_command_print_usage() { +static void subghz_cli_command_print_usage(void) { printf("Usage:\r\n"); printf("subghz \r\n"); printf("Cmd list:\r\n"); @@ -1242,7 +1242,7 @@ static bool subghz_on_system_start_istream_decode_band( return true; } -void subghz_on_system_start() { +void subghz_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); diff --git a/applications/main/subghz/subghz_cli.h b/applications/main/subghz/subghz_cli.h index 14b97e1ed7a..f6388218f46 100644 --- a/applications/main/subghz/subghz_cli.h +++ b/applications/main/subghz/subghz_cli.h @@ -2,4 +2,4 @@ #include -void subghz_on_system_start(); +void subghz_on_system_start(void); diff --git a/applications/main/subghz/views/receiver.c b/applications/main/subghz/views/receiver.c index 9dfe85d1ecc..ea332f544a6 100644 --- a/applications/main/subghz/views/receiver.c +++ b/applications/main/subghz/views/receiver.c @@ -407,7 +407,7 @@ void subghz_view_receiver_exit(void* context) { furi_timer_stop(subghz_receiver->timer); } -SubGhzViewReceiver* subghz_view_receiver_alloc() { +SubGhzViewReceiver* subghz_view_receiver_alloc(void) { SubGhzViewReceiver* subghz_receiver = malloc(sizeof(SubGhzViewReceiver)); // View allocation and configuration diff --git a/applications/main/subghz/views/receiver.h b/applications/main/subghz/views/receiver.h index c91c069386c..79e233d997c 100644 --- a/applications/main/subghz/views/receiver.h +++ b/applications/main/subghz/views/receiver.h @@ -17,7 +17,7 @@ void subghz_view_receiver_set_callback( SubGhzViewReceiverCallback callback, void* context); -SubGhzViewReceiver* subghz_view_receiver_alloc(); +SubGhzViewReceiver* subghz_view_receiver_alloc(void); void subghz_view_receiver_free(SubGhzViewReceiver* subghz_receiver); diff --git a/applications/main/subghz/views/subghz_frequency_analyzer.c b/applications/main/subghz/views/subghz_frequency_analyzer.c index 5a4afa630d1..133868dde51 100644 --- a/applications/main/subghz/views/subghz_frequency_analyzer.c +++ b/applications/main/subghz/views/subghz_frequency_analyzer.c @@ -433,7 +433,7 @@ void subghz_frequency_analyzer_exit(void* context) { true); } -SubGhzFrequencyAnalyzer* subghz_frequency_analyzer_alloc() { +SubGhzFrequencyAnalyzer* subghz_frequency_analyzer_alloc(void) { SubGhzFrequencyAnalyzer* instance = malloc(sizeof(SubGhzFrequencyAnalyzer)); // View allocation and configuration diff --git a/applications/main/subghz/views/subghz_frequency_analyzer.h b/applications/main/subghz/views/subghz_frequency_analyzer.h index 3de003bf831..b3db401ab68 100644 --- a/applications/main/subghz/views/subghz_frequency_analyzer.h +++ b/applications/main/subghz/views/subghz_frequency_analyzer.h @@ -12,7 +12,7 @@ void subghz_frequency_analyzer_set_callback( SubGhzFrequencyAnalyzerCallback callback, void* context); -SubGhzFrequencyAnalyzer* subghz_frequency_analyzer_alloc(); +SubGhzFrequencyAnalyzer* subghz_frequency_analyzer_alloc(void); void subghz_frequency_analyzer_free(SubGhzFrequencyAnalyzer* subghz_static); diff --git a/applications/main/subghz/views/subghz_read_raw.c b/applications/main/subghz/views/subghz_read_raw.c index cf64567ca76..eff3eb1ab7d 100644 --- a/applications/main/subghz/views/subghz_read_raw.c +++ b/applications/main/subghz/views/subghz_read_raw.c @@ -587,7 +587,7 @@ void subghz_read_raw_exit(void* context) { true); } -SubGhzReadRAW* subghz_read_raw_alloc() { +SubGhzReadRAW* subghz_read_raw_alloc(void) { SubGhzReadRAW* instance = malloc(sizeof(SubGhzReadRAW)); // View allocation and configuration diff --git a/applications/main/subghz/views/subghz_read_raw.h b/applications/main/subghz/views/subghz_read_raw.h index 83403e9750c..1188beb5540 100644 --- a/applications/main/subghz/views/subghz_read_raw.h +++ b/applications/main/subghz/views/subghz_read_raw.h @@ -28,7 +28,7 @@ void subghz_read_raw_set_callback( SubGhzReadRAWCallback callback, void* context); -SubGhzReadRAW* subghz_read_raw_alloc(); +SubGhzReadRAW* subghz_read_raw_alloc(void); void subghz_read_raw_free(SubGhzReadRAW* subghz_static); diff --git a/applications/main/subghz/views/transmitter.c b/applications/main/subghz/views/transmitter.c index 45c07acca71..f9b3f44bac9 100644 --- a/applications/main/subghz/views/transmitter.c +++ b/applications/main/subghz/views/transmitter.c @@ -201,7 +201,7 @@ void subghz_view_transmitter_exit(void* context) { furi_assert(context); } -SubGhzViewTransmitter* subghz_view_transmitter_alloc() { +SubGhzViewTransmitter* subghz_view_transmitter_alloc(void) { SubGhzViewTransmitter* subghz_transmitter = malloc(sizeof(SubGhzViewTransmitter)); // View allocation and configuration diff --git a/applications/main/subghz/views/transmitter.h b/applications/main/subghz/views/transmitter.h index e22898ad7c5..26c990308b4 100644 --- a/applications/main/subghz/views/transmitter.h +++ b/applications/main/subghz/views/transmitter.h @@ -26,7 +26,7 @@ void subghz_view_transmitter_set_model_type( SubGhzViewTransmitter* subghz_transmitter, SubGhzViewTransmitterModelType model_type); -SubGhzViewTransmitter* subghz_view_transmitter_alloc(); +SubGhzViewTransmitter* subghz_view_transmitter_alloc(void); void subghz_view_transmitter_free(SubGhzViewTransmitter* subghz_transmitter); diff --git a/applications/main/u2f/u2f.c b/applications/main/u2f/u2f.c index 3bdafe9185e..2a2e91f2189 100644 --- a/applications/main/u2f/u2f.c +++ b/applications/main/u2f/u2f.c @@ -108,7 +108,7 @@ static int u2f_uecc_random_cb(void* context, uint8_t* dest, unsigned size) { return 0; } -U2fData* u2f_alloc() { +U2fData* u2f_alloc(void) { return malloc(sizeof(U2fData)); } diff --git a/applications/main/u2f/u2f.h b/applications/main/u2f/u2f.h index dcd7c3ff2df..8f28d5f672e 100644 --- a/applications/main/u2f/u2f.h +++ b/applications/main/u2f/u2f.h @@ -20,7 +20,7 @@ typedef struct U2fData U2fData; typedef void (*U2fEvtCallback)(U2fNotifyEvent evt, void* context); -U2fData* u2f_alloc(); +U2fData* u2f_alloc(void); bool u2f_init(U2fData* instance); diff --git a/applications/main/u2f/u2f_app.c b/applications/main/u2f/u2f_app.c index 21648197680..68966390a9c 100644 --- a/applications/main/u2f/u2f_app.c +++ b/applications/main/u2f/u2f_app.c @@ -21,7 +21,7 @@ static void u2f_app_tick_event_callback(void* context) { scene_manager_handle_tick_event(app->scene_manager); } -U2fApp* u2f_app_alloc() { +U2fApp* u2f_app_alloc(void) { U2fApp* app = malloc(sizeof(U2fApp)); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/main/u2f/u2f_data.c b/applications/main/u2f/u2f_data.c index cb9c4c2947d..c6451757b1b 100644 --- a/applications/main/u2f/u2f_data.c +++ b/applications/main/u2f/u2f_data.c @@ -67,7 +67,7 @@ bool u2f_data_check(bool cert_only) { return state; } -bool u2f_data_cert_check() { +bool u2f_data_cert_check(void) { bool state = false; Storage* fs_api = furi_record_open(RECORD_STORAGE); File* file = storage_file_alloc(fs_api); diff --git a/applications/main/u2f/u2f_data.h b/applications/main/u2f/u2f_data.h index 8d3923464a3..9c04bf386c8 100644 --- a/applications/main/u2f/u2f_data.h +++ b/applications/main/u2f/u2f_data.h @@ -8,7 +8,7 @@ extern "C" { bool u2f_data_check(bool cert_only); -bool u2f_data_cert_check(); +bool u2f_data_cert_check(void); uint32_t u2f_data_cert_load(uint8_t* cert); diff --git a/applications/main/u2f/views/u2f_view.c b/applications/main/u2f/views/u2f_view.c index bf220ca2c3a..bdbe8bcecdb 100644 --- a/applications/main/u2f/views/u2f_view.c +++ b/applications/main/u2f/views/u2f_view.c @@ -59,7 +59,7 @@ static bool u2f_view_input_callback(InputEvent* event, void* context) { return consumed; } -U2fView* u2f_view_alloc() { +U2fView* u2f_view_alloc(void) { U2fView* u2f = malloc(sizeof(U2fView)); u2f->view = view_alloc(); diff --git a/applications/main/u2f/views/u2f_view.h b/applications/main/u2f/views/u2f_view.h index 5da3279a440..b0ec1c5e390 100644 --- a/applications/main/u2f/views/u2f_view.h +++ b/applications/main/u2f/views/u2f_view.h @@ -14,7 +14,7 @@ typedef enum { U2fMsgError, } U2fViewMsg; -U2fView* u2f_view_alloc(); +U2fView* u2f_view_alloc(void); void u2f_view_free(U2fView* u2f); diff --git a/applications/services/bt/bt_cli.c b/applications/services/bt/bt_cli.c index e8ba215bfe9..7505c424dde 100644 --- a/applications/services/bt/bt_cli.c +++ b/applications/services/bt/bt_cli.c @@ -165,7 +165,7 @@ static void bt_cli_command_packet_rx(Cli* cli, FuriString* args, void* context) } while(false); } -static void bt_cli_print_usage() { +static void bt_cli_print_usage(void) { printf("Usage:\r\n"); printf("bt \r\n"); printf("Cmd list:\r\n"); @@ -227,7 +227,7 @@ static void bt_cli(Cli* cli, FuriString* args, void* context) { furi_record_close(RECORD_BT); } -void bt_on_system_start() { +void bt_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, RECORD_BT, CliCommandFlagDefault, bt_cli, NULL); diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index 4ef3a15953a..389275b8695 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -133,7 +133,7 @@ static void bt_battery_level_changed_callback(const void* _event, void* context) } } -Bt* bt_alloc() { +Bt* bt_alloc(void) { Bt* bt = malloc(sizeof(Bt)); // Init default maximum packet size bt->max_packet_size = BLE_PROFILE_SERIAL_PACKET_SIZE_MAX; diff --git a/applications/services/bt/bt_service/bt_api.c b/applications/services/bt/bt_service/bt_api.c index ab5d2012814..f0e792d42e7 100644 --- a/applications/services/bt/bt_service/bt_api.c +++ b/applications/services/bt/bt_service/bt_api.c @@ -5,7 +5,7 @@ FuriHalBleProfileBase* bt_profile_start( Bt* bt, const FuriHalBleProfileTemplate* profile_template, FuriHalBleProfileParams params) { - furi_assert(bt); + furi_check(bt); // Send message FuriHalBleProfileBase* profile_instance = NULL; @@ -32,7 +32,7 @@ bool bt_profile_restore_default(Bt* bt) { } void bt_disconnect(Bt* bt) { - furi_assert(bt); + furi_check(bt); // Send message BtMessage message = {.lock = api_lock_alloc_locked(), .type = BtMessageTypeDisconnect}; @@ -43,23 +43,23 @@ void bt_disconnect(Bt* bt) { } void bt_set_status_changed_callback(Bt* bt, BtStatusChangedCallback callback, void* context) { - furi_assert(bt); + furi_check(bt); bt->status_changed_cb = callback; bt->status_changed_ctx = context; } void bt_forget_bonded_devices(Bt* bt) { - furi_assert(bt); + furi_check(bt); BtMessage message = {.type = BtMessageTypeForgetBondedDevices}; furi_check( furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk); } void bt_keys_storage_set_storage_path(Bt* bt, const char* keys_storage_path) { - furi_assert(bt); - furi_assert(bt->keys_storage); - furi_assert(keys_storage_path); + furi_check(bt); + furi_check(bt->keys_storage); + furi_check(keys_storage_path); Storage* storage = furi_record_open(RECORD_STORAGE); FuriString* path = furi_string_alloc_set(keys_storage_path); @@ -72,8 +72,8 @@ void bt_keys_storage_set_storage_path(Bt* bt, const char* keys_storage_path) { } void bt_keys_storage_set_default_path(Bt* bt) { - furi_assert(bt); - furi_assert(bt->keys_storage); + furi_check(bt); + furi_check(bt->keys_storage); bt_keys_storage_set_file_path(bt->keys_storage, BT_KEYS_STORAGE_PATH); } diff --git a/applications/services/cli/cli.c b/applications/services/cli/cli.c index 41e658df16b..7ba70421954 100644 --- a/applications/services/cli/cli.c +++ b/applications/services/cli/cli.c @@ -8,7 +8,7 @@ #define CLI_INPUT_LEN_LIMIT 256 -Cli* cli_alloc() { +Cli* cli_alloc(void) { Cli* cli = malloc(sizeof(Cli)); CliCommandTree_init(cli->commands); @@ -27,14 +27,14 @@ Cli* cli_alloc() { } void cli_putc(Cli* cli, char c) { - furi_assert(cli); + furi_check(cli); if(cli->session != NULL) { cli->session->tx((uint8_t*)&c, 1); } } char cli_getc(Cli* cli) { - furi_assert(cli); + furi_check(cli); char c = 0; if(cli->session != NULL) { if(cli->session->rx((uint8_t*)&c, 1, FuriWaitForever) == 0) { @@ -49,14 +49,14 @@ char cli_getc(Cli* cli) { } void cli_write(Cli* cli, const uint8_t* buffer, size_t size) { - furi_assert(cli); + furi_check(cli); if(cli->session != NULL) { cli->session->tx(buffer, size); } } size_t cli_read(Cli* cli, uint8_t* buffer, size_t size) { - furi_assert(cli); + furi_check(cli); if(cli->session != NULL) { return cli->session->rx(buffer, size, FuriWaitForever); } else { @@ -65,7 +65,7 @@ size_t cli_read(Cli* cli, uint8_t* buffer, size_t size) { } size_t cli_read_timeout(Cli* cli, uint8_t* buffer, size_t size, uint32_t timeout) { - furi_assert(cli); + furi_check(cli); if(cli->session != NULL) { return cli->session->rx(buffer, size, timeout); } else { @@ -74,7 +74,7 @@ size_t cli_read_timeout(Cli* cli, uint8_t* buffer, size_t size, uint32_t timeout } bool cli_is_connected(Cli* cli) { - furi_assert(cli); + furi_check(cli); if(cli->session != NULL) { return (cli->session->is_connected()); } @@ -82,7 +82,7 @@ bool cli_is_connected(Cli* cli) { } bool cli_cmd_interrupt_received(Cli* cli) { - furi_assert(cli); + furi_check(cli); char c = '\0'; if(cli_is_connected(cli)) { if(cli->session->rx((uint8_t*)&c, 1, 0) == 1) { @@ -95,14 +95,14 @@ bool cli_cmd_interrupt_received(Cli* cli) { } void cli_print_usage(const char* cmd, const char* usage, const char* arg) { - furi_assert(cmd); - furi_assert(arg); - furi_assert(usage); + furi_check(cmd); + furi_check(arg); + furi_check(usage); printf("%s: illegal option -- %s\r\nusage: %s %s", cmd, arg, cmd, usage); } -void cli_motd() { +void cli_motd(void) { printf("\r\n" " _.-------.._ -,\r\n" " .-\"```\"--..,,_/ /`-, -, \\ \r\n" @@ -385,6 +385,7 @@ void cli_add_command( CliCommandFlag flags, CliCallback callback, void* context) { + furi_check(cli); FuriString* name_str; name_str = furi_string_alloc_set(name); furi_string_trim(name_str); @@ -407,6 +408,7 @@ void cli_add_command( } void cli_delete_command(Cli* cli, const char* name) { + furi_check(cli); FuriString* name_str; name_str = furi_string_alloc_set(name); furi_string_trim(name_str); @@ -424,7 +426,7 @@ void cli_delete_command(Cli* cli, const char* name) { } void cli_session_open(Cli* cli, void* session) { - furi_assert(cli); + furi_check(cli); furi_check(furi_mutex_acquire(cli->mutex, FuriWaitForever) == FuriStatusOk); cli->session = session; @@ -439,7 +441,7 @@ void cli_session_open(Cli* cli, void* session) { } void cli_session_close(Cli* cli) { - furi_assert(cli); + furi_check(cli); furi_check(furi_mutex_acquire(cli->mutex, FuriWaitForever) == FuriStatusOk); if(cli->session != NULL) { diff --git a/applications/services/cli/cli.h b/applications/services/cli/cli.h index 09f54f056f0..bb84670a739 100644 --- a/applications/services/cli/cli.h +++ b/applications/services/cli/cli.h @@ -121,7 +121,7 @@ char cli_getc(Cli* cli); /** New line Send new ine sequence */ -void cli_nl(); +void cli_nl(Cli* cli); void cli_session_open(Cli* cli, void* session); diff --git a/applications/services/cli/cli_command_gpio.c b/applications/services/cli/cli_command_gpio.c index 67511a194f7..010a7dfbe59 100644 --- a/applications/services/cli/cli_command_gpio.c +++ b/applications/services/cli/cli_command_gpio.c @@ -4,7 +4,7 @@ #include #include -void cli_command_gpio_print_usage() { +void cli_command_gpio_print_usage(void) { printf("Usage:\r\n"); printf("gpio \r\n"); printf("Cmd list:\r\n"); diff --git a/applications/services/cli/cli_commands.c b/applications/services/cli/cli_commands.c index dd60e820ed7..43f1c01c4da 100644 --- a/applications/services/cli/cli_commands.c +++ b/applications/services/cli/cli_commands.c @@ -83,7 +83,7 @@ void cli_command_help(Cli* cli, FuriString* args, void* context) { }; if(furi_string_size(args) > 0) { - cli_nl(); + cli_nl(cli); printf("`"); printf("%s", furi_string_get_cstr(args)); printf("` command not found"); @@ -272,7 +272,7 @@ void cli_command_sysctl_heap_track(Cli* cli, FuriString* args, void* context) { } } -void cli_command_sysctl_print_usage() { +void cli_command_sysctl_print_usage(void) { printf("Usage:\r\n"); printf("sysctl \r\n"); printf("Cmd list:\r\n"); diff --git a/applications/services/cli/cli_i.h b/applications/services/cli/cli_i.h index 858cd0c8f82..8a82d961948 100644 --- a/applications/services/cli/cli_i.h +++ b/applications/services/cli/cli_i.h @@ -54,7 +54,7 @@ struct Cli { size_t cursor_position; }; -Cli* cli_alloc(); +Cli* cli_alloc(void); void cli_reset(Cli* cli); diff --git a/applications/services/cli/cli_vcp.c b/applications/services/cli/cli_vcp.c index 454c99d7a9c..58c5c887ff3 100644 --- a/applications/services/cli/cli_vcp.c +++ b/applications/services/cli/cli_vcp.c @@ -64,7 +64,7 @@ static CliVcp* vcp = NULL; static const uint8_t ascii_soh = 0x01; static const uint8_t ascii_eot = 0x04; -static void cli_vcp_init() { +static void cli_vcp_init(void) { if(vcp == NULL) { vcp = malloc(sizeof(CliVcp)); vcp->tx_stream = furi_stream_buffer_alloc(VCP_TX_BUF_SIZE, 1); @@ -80,7 +80,7 @@ static void cli_vcp_init() { FURI_LOG_I(TAG, "Init OK"); } -static void cli_vcp_deinit() { +static void cli_vcp_deinit(void) { furi_thread_flags_set(furi_thread_get_id(vcp->thread), VcpEvtStop); furi_thread_join(vcp->thread); furi_thread_free(vcp->thread); diff --git a/applications/services/crypto/crypto_cli.c b/applications/services/crypto/crypto_cli.c index af52b84fae3..e1ea83613c8 100644 --- a/applications/services/crypto/crypto_cli.c +++ b/applications/services/crypto/crypto_cli.c @@ -4,7 +4,7 @@ #include #include -void crypto_cli_print_usage() { +void crypto_cli_print_usage(void) { printf("Usage:\r\n"); printf("crypto \r\n"); printf("Cmd list:\r\n"); @@ -316,7 +316,7 @@ static void crypto_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void crypto_on_system_start() { +void crypto_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, "crypto", CliCommandFlagDefault, crypto_cli, NULL); diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index 5fbd83d5b5e..74979d12842 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -267,7 +267,7 @@ void desktop_set_stealth_mode_state(Desktop* desktop, bool enabled) { desktop->in_transition = false; } -Desktop* desktop_alloc() { +Desktop* desktop_alloc(void) { Desktop* desktop = malloc(sizeof(Desktop)); desktop->animation_manager = animation_manager_alloc(); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index bb495c92014..f6eeef6b1b1 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -82,7 +82,7 @@ struct Desktop { bool in_transition : 1; }; -Desktop* desktop_alloc(); +Desktop* desktop_alloc(void); void desktop_free(Desktop* desktop); void desktop_lock(Desktop* desktop); diff --git a/applications/services/desktop/helpers/pin.c b/applications/services/desktop/helpers/pin.c index 8a79a1fb8b6..374b569f051 100644 --- a/applications/services/desktop/helpers/pin.c +++ b/applications/services/desktop/helpers/pin.c @@ -42,13 +42,13 @@ static const uint8_t desktop_helpers_fails_timeout[] = { /* +60 for every next fail */ }; -void desktop_pin_lock_error_notify() { +void desktop_pin_lock_error_notify(void) { NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION); notification_message(notification, &sequence_pin_fail); furi_record_close(RECORD_NOTIFICATION); } -uint32_t desktop_pin_lock_get_fail_timeout() { +uint32_t desktop_pin_lock_get_fail_timeout(void) { uint32_t pin_fails = furi_hal_rtc_get_pin_fails(); uint32_t pin_timeout = 0; uint32_t max_index = COUNT_OF(desktop_helpers_fails_timeout) - 1; diff --git a/applications/services/desktop/helpers/pin.h b/applications/services/desktop/helpers/pin.h index e5410723e5c..23d16b0aa4d 100644 --- a/applications/services/desktop/helpers/pin.h +++ b/applications/services/desktop/helpers/pin.h @@ -4,8 +4,8 @@ #include "../desktop.h" #include -void desktop_pin_lock_error_notify(); +void desktop_pin_lock_error_notify(void); -uint32_t desktop_pin_lock_get_fail_timeout(); +uint32_t desktop_pin_lock_get_fail_timeout(void); bool desktop_pin_compare(const PinCode* pin_code1, const PinCode* pin_code2); diff --git a/applications/services/desktop/helpers/slideshow.c b/applications/services/desktop/helpers/slideshow.c index a8e132779a4..efd02c4bc8e 100644 --- a/applications/services/desktop/helpers/slideshow.c +++ b/applications/services/desktop/helpers/slideshow.c @@ -33,7 +33,7 @@ _Static_assert(sizeof(SlideshowFrameHeader) == 2, "Incorrect SlideshowFrameHeade #pragma pack(pop) -Slideshow* slideshow_alloc() { +Slideshow* slideshow_alloc(void) { Slideshow* ret = malloc(sizeof(Slideshow)); ret->loaded = false; return ret; diff --git a/applications/services/desktop/helpers/slideshow.h b/applications/services/desktop/helpers/slideshow.h index 9083e0dcfa4..cd4d2334f5b 100644 --- a/applications/services/desktop/helpers/slideshow.h +++ b/applications/services/desktop/helpers/slideshow.h @@ -4,7 +4,7 @@ typedef struct Slideshow Slideshow; -Slideshow* slideshow_alloc(); +Slideshow* slideshow_alloc(void); void slideshow_free(Slideshow* slideshow); bool slideshow_load(Slideshow* slideshow, const char* fspath); diff --git a/applications/services/desktop/views/desktop_view_debug.c b/applications/services/desktop/views/desktop_view_debug.c index 35c7dc03886..a5d7a925627 100644 --- a/applications/services/desktop/views/desktop_view_debug.c +++ b/applications/services/desktop/views/desktop_view_debug.c @@ -118,7 +118,7 @@ void desktop_debug_timer(void* context) { view_commit_model(debug_view->view, true); } -DesktopDebugView* desktop_debug_alloc() { +DesktopDebugView* desktop_debug_alloc(void) { DesktopDebugView* debug_view = malloc(sizeof(DesktopDebugView)); debug_view->view = view_alloc(); debug_view->timer = furi_timer_alloc(desktop_debug_timer, FuriTimerTypePeriodic, debug_view); diff --git a/applications/services/desktop/views/desktop_view_debug.h b/applications/services/desktop/views/desktop_view_debug.h index fea0c22a080..c594002af98 100644 --- a/applications/services/desktop/views/desktop_view_debug.h +++ b/applications/services/desktop/views/desktop_view_debug.h @@ -22,6 +22,6 @@ void desktop_debug_set_callback( View* desktop_debug_get_view(DesktopDebugView* debug_view); -DesktopDebugView* desktop_debug_alloc(); +DesktopDebugView* desktop_debug_alloc(void); void desktop_debug_free(DesktopDebugView* debug_view); diff --git a/applications/services/desktop/views/desktop_view_lock_menu.c b/applications/services/desktop/views/desktop_view_lock_menu.c index 1ba8542b4a6..9f8b5f51aea 100644 --- a/applications/services/desktop/views/desktop_view_lock_menu.c +++ b/applications/services/desktop/views/desktop_view_lock_menu.c @@ -149,7 +149,7 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) { return consumed; } -DesktopLockMenuView* desktop_lock_menu_alloc() { +DesktopLockMenuView* desktop_lock_menu_alloc(void) { DesktopLockMenuView* lock_menu = malloc(sizeof(DesktopLockMenuView)); lock_menu->view = view_alloc(); view_allocate_model(lock_menu->view, ViewModelTypeLocking, sizeof(DesktopLockMenuViewModel)); diff --git a/applications/services/desktop/views/desktop_view_lock_menu.h b/applications/services/desktop/views/desktop_view_lock_menu.h index 8ac3a727338..a44e6b13276 100644 --- a/applications/services/desktop/views/desktop_view_lock_menu.h +++ b/applications/services/desktop/views/desktop_view_lock_menu.h @@ -30,5 +30,5 @@ View* desktop_lock_menu_get_view(DesktopLockMenuView* lock_menu); void desktop_lock_menu_set_dummy_mode_state(DesktopLockMenuView* lock_menu, bool dummy_mode); void desktop_lock_menu_set_stealth_mode_state(DesktopLockMenuView* lock_menu, bool stealth_mode); void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx); -DesktopLockMenuView* desktop_lock_menu_alloc(); +DesktopLockMenuView* desktop_lock_menu_alloc(void); void desktop_lock_menu_free(DesktopLockMenuView* lock_menu); diff --git a/applications/services/desktop/views/desktop_view_locked.c b/applications/services/desktop/views/desktop_view_locked.c index 8df889dddd3..47e9802fdf9 100644 --- a/applications/services/desktop/views/desktop_view_locked.c +++ b/applications/services/desktop/views/desktop_view_locked.c @@ -191,7 +191,7 @@ static bool desktop_view_locked_input(InputEvent* event, void* context) { return true; } -DesktopViewLocked* desktop_view_locked_alloc() { +DesktopViewLocked* desktop_view_locked_alloc(void) { DesktopViewLocked* locked_view = malloc(sizeof(DesktopViewLocked)); locked_view->view = view_alloc(); locked_view->timer = diff --git a/applications/services/desktop/views/desktop_view_locked.h b/applications/services/desktop/views/desktop_view_locked.h index ea065e39812..233cc8d5dbf 100644 --- a/applications/services/desktop/views/desktop_view_locked.h +++ b/applications/services/desktop/views/desktop_view_locked.h @@ -14,7 +14,7 @@ void desktop_view_locked_set_callback( void* context); void desktop_view_locked_update(DesktopViewLocked* locked_view); View* desktop_view_locked_get_view(DesktopViewLocked* locked_view); -DesktopViewLocked* desktop_view_locked_alloc(); +DesktopViewLocked* desktop_view_locked_alloc(void); void desktop_view_locked_free(DesktopViewLocked* locked_view); void desktop_view_locked_lock(DesktopViewLocked* locked_view, bool pin_locked); void desktop_view_locked_unlock(DesktopViewLocked* locked_view); diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index 5e16f60862a..0c1160d408e 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -99,7 +99,7 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { return true; } -DesktopMainView* desktop_main_alloc() { +DesktopMainView* desktop_main_alloc(void) { DesktopMainView* main_view = malloc(sizeof(DesktopMainView)); main_view->view = view_alloc(); diff --git a/applications/services/desktop/views/desktop_view_main.h b/applications/services/desktop/views/desktop_view_main.h index b5492b1be98..755d6b2afbc 100644 --- a/applications/services/desktop/views/desktop_view_main.h +++ b/applications/services/desktop/views/desktop_view_main.h @@ -14,5 +14,5 @@ void desktop_main_set_callback( View* desktop_main_get_view(DesktopMainView* main_view); void desktop_main_set_dummy_mode_state(DesktopMainView* main_view, bool dummy_mode); -DesktopMainView* desktop_main_alloc(); +DesktopMainView* desktop_main_alloc(void); void desktop_main_free(DesktopMainView* main_view); diff --git a/applications/services/desktop/views/desktop_view_slideshow.c b/applications/services/desktop/views/desktop_view_slideshow.c index 09e155341c5..84e4d5706ec 100644 --- a/applications/services/desktop/views/desktop_view_slideshow.c +++ b/applications/services/desktop/views/desktop_view_slideshow.c @@ -105,7 +105,7 @@ static void desktop_view_slideshow_exit(void* context) { view_commit_model(instance->view, false); } -DesktopSlideshowView* desktop_view_slideshow_alloc() { +DesktopSlideshowView* desktop_view_slideshow_alloc(void) { DesktopSlideshowView* instance = malloc(sizeof(DesktopSlideshowView)); instance->view = view_alloc(); view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(DesktopSlideshowViewModel)); diff --git a/applications/services/desktop/views/desktop_view_slideshow.h b/applications/services/desktop/views/desktop_view_slideshow.h index 624cbf007d7..b9e610c6231 100644 --- a/applications/services/desktop/views/desktop_view_slideshow.h +++ b/applications/services/desktop/views/desktop_view_slideshow.h @@ -11,7 +11,7 @@ typedef struct DesktopSlideshowView DesktopSlideshowView; typedef void (*DesktopSlideshowViewCallback)(DesktopEvent event, void* context); -DesktopSlideshowView* desktop_view_slideshow_alloc(); +DesktopSlideshowView* desktop_view_slideshow_alloc(void); void desktop_view_slideshow_free(DesktopSlideshowView* main_view); diff --git a/applications/services/dialogs/dialogs.c b/applications/services/dialogs/dialogs.c index 10c08a991b3..ec1289d5b9c 100644 --- a/applications/services/dialogs/dialogs.c +++ b/applications/services/dialogs/dialogs.c @@ -8,6 +8,7 @@ void dialog_file_browser_set_basic_options( DialogsFileBrowserOptions* options, const char* extension, const Icon* icon) { + furi_check(options); options->extension = extension; options->base_path = NULL; options->skip_assets = true; @@ -18,7 +19,7 @@ void dialog_file_browser_set_basic_options( options->item_loader_context = NULL; } -static DialogsApp* dialogs_app_alloc() { +static DialogsApp* dialogs_app_alloc(void) { DialogsApp* app = malloc(sizeof(DialogsApp)); app->message_queue = furi_message_queue_alloc(8, sizeof(DialogsAppMessage)); diff --git a/applications/services/dialogs/dialogs.h b/applications/services/dialogs/dialogs.h index 39b15c67c2e..b8beddc5ee5 100644 --- a/applications/services/dialogs/dialogs.h +++ b/applications/services/dialogs/dialogs.h @@ -87,7 +87,7 @@ typedef struct DialogMessage DialogMessage; * Allocate and fill message * @return DialogMessage* */ -DialogMessage* dialog_message_alloc(); +DialogMessage* dialog_message_alloc(void); /** * Free message struct diff --git a/applications/services/dialogs/dialogs_api.c b/applications/services/dialogs/dialogs_api.c index 4723a1f91a1..73d1d876a61 100644 --- a/applications/services/dialogs/dialogs_api.c +++ b/applications/services/dialogs/dialogs_api.c @@ -65,6 +65,8 @@ bool dialog_file_browser_show( /****************** Message ******************/ DialogMessageButton dialog_message_show(DialogsApp* context, const DialogMessage* dialog_message) { + furi_check(context); + FuriApiLock lock = api_lock_alloc_locked(); furi_check(lock != NULL); @@ -91,6 +93,8 @@ DialogMessageButton dialog_message_show(DialogsApp* context, const DialogMessage /****************** Storage error ******************/ void dialog_message_show_storage_error(DialogsApp* context, const char* error_text) { + furi_check(context); + DialogMessage* message = dialog_message_alloc(); dialog_message_set_text(message, error_text, 88, 32, AlignCenter, AlignCenter); dialog_message_set_icon(message, &I_SDQuestion_35x43, 5, 6); diff --git a/applications/services/dialogs/dialogs_module_message.c b/applications/services/dialogs/dialogs_module_message.c index 879ba9baab5..69d28c405e6 100644 --- a/applications/services/dialogs/dialogs_module_message.c +++ b/applications/services/dialogs/dialogs_module_message.c @@ -101,12 +101,13 @@ DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDa return ret; } -DialogMessage* dialog_message_alloc() { +DialogMessage* dialog_message_alloc(void) { DialogMessage* message = malloc(sizeof(DialogMessage)); return message; } void dialog_message_free(DialogMessage* message) { + furi_check(message); free(message); } @@ -117,6 +118,8 @@ void dialog_message_set_text( uint8_t y, Align horizontal, Align vertical) { + furi_check(message); + message->dialog_text = text; message->dialog_text_x = x; message->dialog_text_y = y; @@ -131,6 +134,8 @@ void dialog_message_set_header( uint8_t y, Align horizontal, Align vertical) { + furi_check(message); + message->header_text = text; message->header_text_x = x; message->header_text_y = y; @@ -139,6 +144,8 @@ void dialog_message_set_header( } void dialog_message_set_icon(DialogMessage* message, const Icon* icon, uint8_t x, uint8_t y) { + furi_check(message); + message->icon = icon; message->icon_x = x; message->icon_y = y; @@ -149,6 +156,8 @@ void dialog_message_set_buttons( const char* left, const char* center, const char* right) { + furi_check(message); + message->left_button_text = left; message->center_button_text = center; message->right_button_text = right; diff --git a/applications/services/dolphin/dolphin.c b/applications/services/dolphin/dolphin.c index e81101ba5b7..5f3d5cb284c 100644 --- a/applications/services/dolphin/dolphin.c +++ b/applications/services/dolphin/dolphin.c @@ -22,7 +22,7 @@ void dolphin_deed(DolphinDeed deed) { } DolphinStats dolphin_stats(Dolphin* dolphin) { - furi_assert(dolphin); + furi_check(dolphin); DolphinStats stats; DolphinEvent event; @@ -36,7 +36,7 @@ DolphinStats dolphin_stats(Dolphin* dolphin) { } void dolphin_flush(Dolphin* dolphin) { - furi_assert(dolphin); + furi_check(dolphin); DolphinEvent event; event.type = DolphinEventTypeFlush; @@ -73,7 +73,7 @@ void dolphin_clear_limits_timer_callback(void* context) { dolphin_event_send_async(dolphin, &event); } -Dolphin* dolphin_alloc() { +Dolphin* dolphin_alloc(void) { Dolphin* dolphin = malloc(sizeof(Dolphin)); dolphin->state = dolphin_state_alloc(); @@ -119,6 +119,7 @@ void dolphin_event_release(Dolphin* dolphin, DolphinEvent* event) { } FuriPubSub* dolphin_get_pubsub(Dolphin* dolphin) { + furi_check(dolphin); return dolphin->pubsub; } @@ -201,6 +202,8 @@ int32_t dolphin_srv(void* p) { } void dolphin_upgrade_level(Dolphin* dolphin) { + furi_check(dolphin); + dolphin_state_increase_level(dolphin->state); dolphin_flush(dolphin); } diff --git a/applications/services/dolphin/dolphin_i.h b/applications/services/dolphin/dolphin_i.h index 2d716c18138..666e039423f 100644 --- a/applications/services/dolphin/dolphin_i.h +++ b/applications/services/dolphin/dolphin_i.h @@ -35,7 +35,7 @@ struct Dolphin { FuriTimer* clear_limits_timer; }; -Dolphin* dolphin_alloc(); +Dolphin* dolphin_alloc(void); void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event); diff --git a/applications/services/dolphin/helpers/dolphin_state.c b/applications/services/dolphin/helpers/dolphin_state.c index 842d6b71573..55c2286d9a9 100644 --- a/applications/services/dolphin/helpers/dolphin_state.c +++ b/applications/services/dolphin/helpers/dolphin_state.c @@ -19,7 +19,7 @@ #define BUTTHURT_MAX 14 #define BUTTHURT_MIN 0 -DolphinState* dolphin_state_alloc() { +DolphinState* dolphin_state_alloc(void) { return malloc(sizeof(DolphinState)); } @@ -73,7 +73,7 @@ bool dolphin_state_load(DolphinState* dolphin_state) { return success; } -uint64_t dolphin_state_timestamp() { +uint64_t dolphin_state_timestamp(void) { DateTime datetime; furi_hal_rtc_get_datetime(&datetime); return datetime_datetime_to_timestamp(&datetime); diff --git a/applications/services/dolphin/helpers/dolphin_state.h b/applications/services/dolphin/helpers/dolphin_state.h index 3e02fb87201..a8d8406bef2 100644 --- a/applications/services/dolphin/helpers/dolphin_state.h +++ b/applications/services/dolphin/helpers/dolphin_state.h @@ -21,7 +21,7 @@ struct DolphinState { bool dirty; }; -DolphinState* dolphin_state_alloc(); +DolphinState* dolphin_state_alloc(void); void dolphin_state_free(DolphinState* dolphin_state); @@ -31,7 +31,7 @@ bool dolphin_state_load(DolphinState* dolphin_state); void dolphin_state_clear_limits(DolphinState* dolphin_state); -uint64_t dolphin_state_timestamp(); +uint64_t dolphin_state_timestamp(void); void dolphin_state_on_deed(DolphinState* dolphin_state, DolphinDeed deed); diff --git a/applications/services/expansion/expansion.c b/applications/services/expansion/expansion.c index 8f260f9154d..0b00753fcf8 100644 --- a/applications/services/expansion/expansion.c +++ b/applications/services/expansion/expansion.c @@ -203,7 +203,7 @@ static int32_t expansion_control(void* context) { return 0; } -static Expansion* expansion_alloc() { +static Expansion* expansion_alloc(void) { Expansion* instance = malloc(sizeof(Expansion)); instance->queue = diff --git a/applications/services/gui/canvas.c b/applications/services/gui/canvas.c index 9c945712304..2c0d1d5a8b7 100644 --- a/applications/services/gui/canvas.c +++ b/applications/services/gui/canvas.c @@ -13,7 +13,7 @@ const CanvasFontParameters canvas_font_params[FontTotalNumber] = { [FontBigNumbers] = {.leading_default = 18, .leading_min = 16, .height = 15, .descender = 0}, }; -Canvas* canvas_init() { +Canvas* canvas_init(void) { Canvas* canvas = malloc(sizeof(Canvas)); canvas->compress_icon = compress_icon_alloc(); @@ -39,7 +39,7 @@ Canvas* canvas_init() { } void canvas_free(Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); compress_icon_free(canvas->compress_icon); CanvasCallbackPairArray_clear(canvas->canvas_callback_pair); furi_mutex_free(canvas->mutex); @@ -57,7 +57,7 @@ static void canvas_unlock(Canvas* canvas) { } void canvas_reset(Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); canvas_clear(canvas); @@ -67,7 +67,7 @@ void canvas_reset(Canvas* canvas) { } void canvas_commit(Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); u8g2_SendBuffer(&canvas->fb); // Iterate over callbacks @@ -84,12 +84,12 @@ void canvas_commit(Canvas* canvas) { } uint8_t* canvas_get_buffer(Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); return u8g2_GetBufferPtr(&canvas->fb); } size_t canvas_get_buffer_size(const Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); return u8g2_GetBufferTileWidth(&canvas->fb) * u8g2_GetBufferTileHeight(&canvas->fb) * 8; } @@ -99,7 +99,7 @@ void canvas_frame_set( uint8_t offset_y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); canvas->offset_x = offset_x; canvas->offset_y = offset_y; canvas->width = width; @@ -107,17 +107,17 @@ void canvas_frame_set( } uint8_t canvas_width(const Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); return canvas->width; } uint8_t canvas_height(const Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); return canvas->height; } uint8_t canvas_current_font_height(const Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); uint8_t font_height = u8g2_GetMaxCharHeight(&canvas->fb); if(canvas->fb.font == u8g2_font_haxrcorp4089_tr) { @@ -128,23 +128,23 @@ uint8_t canvas_current_font_height(const Canvas* canvas) { } const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font font) { - furi_assert(canvas); - furi_assert(font < FontTotalNumber); + furi_check(canvas); + furi_check(font < FontTotalNumber); return &canvas_font_params[font]; } void canvas_clear(Canvas* canvas) { - furi_assert(canvas); + furi_check(canvas); u8g2_ClearBuffer(&canvas->fb); } void canvas_set_color(Canvas* canvas, Color color) { - furi_assert(canvas); + furi_check(canvas); u8g2_SetDrawColor(&canvas->fb, color); } void canvas_set_font_direction(Canvas* canvas, CanvasDirection dir) { - furi_assert(canvas); + furi_check(canvas); u8g2_SetFontDirection(&canvas->fb, dir); } @@ -153,7 +153,7 @@ void canvas_invert_color(Canvas* canvas) { } void canvas_set_font(Canvas* canvas, Font font) { - furi_assert(canvas); + furi_check(canvas); u8g2_SetFontMode(&canvas->fb, 1); if(font == FontPrimary) { u8g2_SetFont(&canvas->fb, u8g2_font_helvB08_tr); @@ -169,13 +169,13 @@ void canvas_set_font(Canvas* canvas, Font font) { } void canvas_set_custom_u8g2_font(Canvas* canvas, const uint8_t* font) { - furi_assert(canvas); + furi_check(canvas); u8g2_SetFontMode(&canvas->fb, 1); u8g2_SetFont(&canvas->fb, font); } void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str) { - furi_assert(canvas); + furi_check(canvas); if(!str) return; x += canvas->offset_x; y += canvas->offset_y; @@ -189,7 +189,7 @@ void canvas_draw_str_aligned( Align horizontal, Align vertical, const char* str) { - furi_assert(canvas); + furi_check(canvas); if(!str) return; x += canvas->offset_x; y += canvas->offset_y; @@ -226,13 +226,13 @@ void canvas_draw_str_aligned( } uint16_t canvas_string_width(Canvas* canvas, const char* str) { - furi_assert(canvas); + furi_check(canvas); if(!str) return 0; return u8g2_GetStrWidth(&canvas->fb, str); } uint8_t canvas_glyph_width(Canvas* canvas, uint16_t symbol) { - furi_assert(canvas); + furi_check(canvas); return u8g2_GetGlyphWidth(&canvas->fb, symbol); } @@ -243,7 +243,7 @@ void canvas_draw_bitmap( uint8_t width, uint8_t height, const uint8_t* compressed_bitmap_data) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; @@ -257,8 +257,8 @@ void canvas_draw_icon_animation( uint8_t x, uint8_t y, IconAnimation* icon_animation) { - furi_assert(canvas); - furi_assert(icon_animation); + furi_check(canvas); + furi_check(icon_animation); x += canvas->offset_x; y += canvas->offset_y; @@ -356,10 +356,6 @@ void canvas_draw_u8g2_bitmap( u8g2_uint_t h, const uint8_t* bitmap, IconRotation rotation) { - u8g2_uint_t blen; - blen = w; - blen += 7; - blen >>= 3; #ifdef U8G2_WITH_INTERSECTION if(u8g2_IsIntersection(u8g2, x, y, x + w, y + h) == 0) return; #endif /* U8G2_WITH_INTERSECTION */ @@ -388,8 +384,8 @@ void canvas_draw_icon_ex( uint8_t y, const Icon* icon, IconRotation rotation) { - furi_assert(canvas); - furi_assert(icon); + furi_check(canvas); + furi_check(icon); x += canvas->offset_x; y += canvas->offset_y; @@ -400,8 +396,8 @@ void canvas_draw_icon_ex( } void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon) { - furi_assert(canvas); - furi_assert(icon); + furi_check(canvas); + furi_check(icon); x += canvas->offset_x; y += canvas->offset_y; @@ -412,14 +408,14 @@ void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon) { } void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawPixel(&canvas->fb, x, y); } void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawBox(&canvas->fb, x, y, width, height); @@ -432,14 +428,14 @@ void canvas_draw_rbox( uint8_t width, uint8_t height, uint8_t radius) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawRBox(&canvas->fb, x, y, width, height, radius); } void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawFrame(&canvas->fb, x, y, width, height); @@ -452,14 +448,14 @@ void canvas_draw_rframe( uint8_t width, uint8_t height, uint8_t radius) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawRFrame(&canvas->fb, x, y, width, height, radius); } void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) { - furi_assert(canvas); + furi_check(canvas); x1 += canvas->offset_x; y1 += canvas->offset_y; x2 += canvas->offset_x; @@ -468,14 +464,14 @@ void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_ } void canvas_draw_circle(Canvas* canvas, uint8_t x, uint8_t y, uint8_t radius) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawCircle(&canvas->fb, x, y, radius, U8G2_DRAW_ALL); } void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t radius) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawDisc(&canvas->fb, x, y, radius, U8G2_DRAW_ALL); @@ -488,7 +484,7 @@ void canvas_draw_triangle( uint8_t base, uint8_t height, CanvasDirection dir) { - furi_assert(canvas); + furi_check(canvas); if(dir == CanvasDirectionBottomToTop) { canvas_draw_line(canvas, x - base / 2, y, x + base / 2, y); canvas_draw_line(canvas, x - base / 2, y, x, y - height + 1); @@ -515,14 +511,14 @@ void canvas_draw_xbm( uint8_t w, uint8_t h, const uint8_t* bitmap) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; canvas_draw_u8g2_bitmap(&canvas->fb, x, y, w, h, bitmap, IconRotation0); } void canvas_draw_glyph(Canvas* canvas, uint8_t x, uint8_t y, uint16_t ch) { - furi_assert(canvas); + furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawGlyph(&canvas->fb, x, y, ch); @@ -533,7 +529,7 @@ void canvas_set_bitmap_mode(Canvas* canvas, bool alpha) { } void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation) { - furi_assert(canvas); + furi_check(canvas); const u8g2_cb_t* rotate_cb = NULL; bool need_swap = false; if(canvas->orientation != orientation) { @@ -573,12 +569,12 @@ CanvasOrientation canvas_get_orientation(const Canvas* canvas) { } void canvas_add_framebuffer_callback(Canvas* canvas, CanvasCommitCallback callback, void* context) { - furi_assert(canvas); + furi_check(canvas); const CanvasCallbackPair p = {callback, context}; canvas_lock(canvas); - furi_assert(!CanvasCallbackPairArray_count(canvas->canvas_callback_pair, p)); + furi_check(!CanvasCallbackPairArray_count(canvas->canvas_callback_pair, p)); CanvasCallbackPairArray_push_back(canvas->canvas_callback_pair, p); canvas_unlock(canvas); } @@ -587,12 +583,12 @@ void canvas_remove_framebuffer_callback( Canvas* canvas, CanvasCommitCallback callback, void* context) { - furi_assert(canvas); + furi_check(canvas); const CanvasCallbackPair p = {callback, context}; canvas_lock(canvas); - furi_assert(CanvasCallbackPairArray_count(canvas->canvas_callback_pair, p) == 1); + furi_check(CanvasCallbackPairArray_count(canvas->canvas_callback_pair, p) == 1); CanvasCallbackPairArray_remove_val(canvas->canvas_callback_pair, p); canvas_unlock(canvas); } \ No newline at end of file diff --git a/applications/services/gui/canvas_i.h b/applications/services/gui/canvas_i.h index 5d2a38ddf79..c31bdd3bb01 100644 --- a/applications/services/gui/canvas_i.h +++ b/applications/services/gui/canvas_i.h @@ -51,7 +51,7 @@ struct Canvas { * * @return Canvas instance */ -Canvas* canvas_init(); +Canvas* canvas_init(void); /** Free canvas memory * diff --git a/applications/services/gui/elements.c b/applications/services/gui/elements.c index e92c2433cda..dfdd6c03465 100644 --- a/applications/services/gui/elements.c +++ b/applications/services/gui/elements.c @@ -28,8 +28,8 @@ typedef struct { } ElementTextBoxLine; void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress) { - furi_assert(canvas); - furi_assert((progress >= 0) && (progress <= 1.0)); + furi_check(canvas); + furi_check((progress >= 0.0f) && (progress <= 1.0f)); uint8_t height = 9; uint8_t progress_length = roundf(progress * (width - 2)); @@ -49,8 +49,8 @@ void elements_progress_bar_with_text( uint8_t width, float progress, const char* text) { - furi_assert(canvas); - furi_assert((progress >= 0.0f) && (progress <= 1.0f)); + furi_check(canvas); + furi_check((progress >= 0.0f) && (progress <= 1.0f)); uint8_t height = 11; uint8_t progress_length = roundf(progress * (width - 2)); @@ -74,7 +74,7 @@ void elements_scrollbar_pos( uint8_t height, uint16_t pos, uint16_t total) { - furi_assert(canvas); + furi_check(canvas); // prevent overflows canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, x - 3, y, 3, height); @@ -91,7 +91,7 @@ void elements_scrollbar_pos( } void elements_scrollbar(Canvas* canvas, uint16_t pos, uint16_t total) { - furi_assert(canvas); + furi_check(canvas); uint8_t width = canvas_width(canvas); uint8_t height = canvas_height(canvas); @@ -111,7 +111,7 @@ void elements_scrollbar(Canvas* canvas, uint16_t pos, uint16_t total) { } void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); canvas_draw_line(canvas, x + 2, y, x + width - 2, y); canvas_draw_line(canvas, x + 1, y + height - 1, x + width, y + height - 1); @@ -125,6 +125,8 @@ void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t } void elements_button_left(Canvas* canvas, const char* str) { + furi_check(canvas); + const uint8_t button_height = 12; const uint8_t vertical_offset = 3; const uint8_t horizontal_offset = 3; @@ -151,6 +153,8 @@ void elements_button_left(Canvas* canvas, const char* str) { } void elements_button_right(Canvas* canvas, const char* str) { + furi_check(canvas); + const uint8_t button_height = 12; const uint8_t vertical_offset = 3; const uint8_t horizontal_offset = 3; @@ -177,6 +181,8 @@ void elements_button_right(Canvas* canvas, const char* str) { } void elements_button_center(Canvas* canvas, const char* str) { + furi_check(canvas); + const uint8_t button_height = 12; const uint8_t vertical_offset = 3; const uint8_t horizontal_offset = 1; @@ -260,8 +266,8 @@ void elements_multiline_text_aligned( Align horizontal, Align vertical, const char* text) { - furi_assert(canvas); - furi_assert(text); + furi_check(canvas); + furi_check(text); uint8_t lines_count = 0; uint8_t font_height = canvas_current_font_height(canvas); @@ -306,8 +312,8 @@ void elements_multiline_text_aligned( } void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* text) { - furi_assert(canvas); - furi_assert(text); + furi_check(canvas); + furi_check(text); uint8_t font_height = canvas_current_font_height(canvas); FuriString* str; @@ -329,8 +335,8 @@ void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* t } void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text) { - furi_assert(canvas); - furi_assert(text); + furi_check(canvas); + furi_check(text); uint8_t font_y = canvas_current_font_height(canvas); uint16_t str_width = canvas_string_width(canvas, text); @@ -359,7 +365,7 @@ void elements_slightly_rounded_frame( uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); canvas_draw_rframe(canvas, x, y, width, height, 1); } @@ -369,7 +375,7 @@ void elements_slightly_rounded_box( uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); canvas_draw_rbox(canvas, x, y, width, height, 1); } @@ -379,7 +385,7 @@ void elements_bold_rounded_frame( uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, x + 2, y + 2, width - 3, height - 3); @@ -415,7 +421,7 @@ void elements_bold_rounded_frame( } void elements_bubble(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { - furi_assert(canvas); + furi_check(canvas); canvas_draw_rframe(canvas, x + 4, y, width, height, 3); uint8_t y_corner = y + height * 2 / 3; canvas_draw_line(canvas, x, y_corner, x + 4, y_corner - 4); @@ -432,8 +438,8 @@ void elements_bubble_str( const char* text, Align horizontal, Align vertical) { - furi_assert(canvas); - furi_assert(text); + furi_check(canvas); + furi_check(text); uint8_t font_y = canvas_current_font_height(canvas); uint16_t str_width = canvas_string_width(canvas, text); @@ -560,8 +566,8 @@ void elements_bubble_str( } void elements_string_fit_width(Canvas* canvas, FuriString* string, uint8_t width) { - furi_assert(canvas); - furi_assert(string); + furi_check(canvas); + furi_check(string); uint16_t len_px = canvas_string_width(canvas, furi_string_get_cstr(string)); if(len_px > width) { @@ -582,6 +588,9 @@ void elements_scrollable_text_line( FuriString* string, size_t scroll, bool ellipsis) { + furi_check(canvas); + furi_check(string); + FuriString* line = furi_string_alloc_set(string); size_t len_px = canvas_string_width(canvas, furi_string_get_cstr(line)); @@ -631,7 +640,7 @@ void elements_text_box( Align vertical, const char* text, bool strip_to_dots) { - furi_assert(canvas); + furi_check(canvas); ElementTextBoxLine line[ELEMENTS_MAX_LINES_NUM]; bool bold = false; diff --git a/applications/services/gui/gui.c b/applications/services/gui/gui.c index 0e29a5a01fd..24ea57bc0bd 100644 --- a/applications/services/gui/gui.c +++ b/applications/services/gui/gui.c @@ -349,9 +349,10 @@ void gui_unlock(Gui* gui) { } void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer) { - furi_assert(gui); - furi_assert(view_port); + furi_check(gui); + furi_check(view_port); furi_check(layer < GuiLayerMAX); + // Only fullscreen supports Vertical orientation for now ViewPortOrientation view_port_orientation = view_port_get_orientation(view_port); furi_check( @@ -379,8 +380,8 @@ void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer) { } void gui_remove_view_port(Gui* gui, ViewPort* view_port) { - furi_assert(gui); - furi_assert(view_port); + furi_check(gui); + furi_check(view_port); gui_lock(gui); view_port_gui_set(view_port, NULL); @@ -405,8 +406,8 @@ void gui_remove_view_port(Gui* gui, ViewPort* view_port) { } void gui_view_port_send_to_front(Gui* gui, ViewPort* view_port) { - furi_assert(gui); - furi_assert(view_port); + furi_check(gui); + furi_check(view_port); gui_lock(gui); // Remove @@ -417,14 +418,14 @@ void gui_view_port_send_to_front(Gui* gui, ViewPort* view_port) { while(!ViewPortArray_end_p(it)) { if(*ViewPortArray_ref(it) == view_port) { ViewPortArray_remove(gui->layers[i], it); - furi_assert(layer == GuiLayerMAX); + furi_check(layer == GuiLayerMAX); layer = i; } else { ViewPortArray_next(it); } } } - furi_assert(layer != GuiLayerMAX); + furi_check(layer != GuiLayerMAX); // Return to the top ViewPortArray_push_back(gui->layers[layer], view_port); gui_unlock(gui); @@ -463,7 +464,7 @@ void gui_view_port_send_to_back(Gui* gui, ViewPort* view_port) { } void gui_add_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback, void* context) { - furi_assert(gui); + furi_check(gui); canvas_add_framebuffer_callback(gui->canvas, callback, context); @@ -472,18 +473,19 @@ void gui_add_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback, vo } void gui_remove_framebuffer_callback(Gui* gui, GuiCanvasCommitCallback callback, void* context) { - furi_assert(gui); + furi_check(gui); canvas_remove_framebuffer_callback(gui->canvas, callback, context); } size_t gui_get_framebuffer_size(const Gui* gui) { - furi_assert(gui); + furi_check(gui); + return canvas_get_buffer_size(gui->canvas); } void gui_set_lockdown(Gui* gui, bool lockdown) { - furi_assert(gui); + furi_check(gui); gui_lock(gui); gui->lockdown = lockdown; @@ -494,7 +496,8 @@ void gui_set_lockdown(Gui* gui, bool lockdown) { } Canvas* gui_direct_draw_acquire(Gui* gui) { - furi_assert(gui); + furi_check(gui); + gui_lock(gui); gui->direct_draw = true; gui_unlock(gui); @@ -508,7 +511,7 @@ Canvas* gui_direct_draw_acquire(Gui* gui) { } void gui_direct_draw_release(Gui* gui) { - furi_assert(gui); + furi_check(gui); canvas_reset(gui->canvas); canvas_commit(gui->canvas); @@ -520,7 +523,7 @@ void gui_direct_draw_release(Gui* gui) { gui_update(gui); } -Gui* gui_alloc() { +Gui* gui_alloc(void) { Gui* gui = malloc(sizeof(Gui)); // Thread ID gui->thread_id = furi_thread_get_current_id(); diff --git a/applications/services/gui/icon.c b/applications/services/gui/icon.c index 98f35b12a1a..e216b925515 100644 --- a/applications/services/gui/icon.c +++ b/applications/services/gui/icon.c @@ -1,13 +1,20 @@ #include "icon_i.h" +#include uint8_t icon_get_width(const Icon* instance) { + furi_check(instance); + return instance->width; } uint8_t icon_get_height(const Icon* instance) { + furi_check(instance); + return instance->height; } const uint8_t* icon_get_data(const Icon* instance) { + furi_check(instance); + return instance->frames[0]; } diff --git a/applications/services/gui/icon_animation.c b/applications/services/gui/icon_animation.c index a39ef2e254e..f887b90ac4c 100644 --- a/applications/services/gui/icon_animation.c +++ b/applications/services/gui/icon_animation.c @@ -4,18 +4,22 @@ #include IconAnimation* icon_animation_alloc(const Icon* icon) { - furi_assert(icon); + furi_check(icon); + IconAnimation* instance = malloc(sizeof(IconAnimation)); instance->icon = icon; instance->timer = furi_timer_alloc(icon_animation_timer_callback, FuriTimerTypePeriodic, instance); + return instance; } void icon_animation_free(IconAnimation* instance) { - furi_assert(instance); + furi_check(instance); + icon_animation_stop(instance); furi_timer_free(instance->timer); + free(instance); } @@ -23,7 +27,8 @@ void icon_animation_set_update_callback( IconAnimation* instance, IconAnimationCallback callback, void* context) { - furi_assert(instance); + furi_check(instance); + instance->callback = callback; instance->callback_context = context; } @@ -51,17 +56,20 @@ void icon_animation_timer_callback(void* context) { } uint8_t icon_animation_get_width(const IconAnimation* instance) { - furi_assert(instance); + furi_check(instance); + return instance->icon->width; } uint8_t icon_animation_get_height(const IconAnimation* instance) { - furi_assert(instance); + furi_check(instance); + return instance->icon->height; } void icon_animation_start(IconAnimation* instance) { - furi_assert(instance); + furi_check(instance); + if(!instance->animating) { instance->animating = true; furi_assert(instance->icon->frame_rate); @@ -73,7 +81,8 @@ void icon_animation_start(IconAnimation* instance) { } void icon_animation_stop(IconAnimation* instance) { - furi_assert(instance); + furi_check(instance); + if(instance->animating) { instance->animating = false; furi_timer_stop(instance->timer); @@ -82,6 +91,7 @@ void icon_animation_stop(IconAnimation* instance) { } bool icon_animation_is_last_frame(const IconAnimation* instance) { - furi_assert(instance); + furi_check(instance); + return instance->icon->frame_count - instance->frame <= 1; } diff --git a/applications/services/gui/modules/button_menu.c b/applications/services/gui/modules/button_menu.c index 6ac786c922e..ed76bd2b3a4 100644 --- a/applications/services/gui/modules/button_menu.c +++ b/applications/services/gui/modules/button_menu.c @@ -300,12 +300,12 @@ static bool button_menu_view_input_callback(InputEvent* event, void* context) { } View* button_menu_get_view(ButtonMenu* button_menu) { - furi_assert(button_menu); + furi_check(button_menu); return button_menu->view; } void button_menu_reset(ButtonMenu* button_menu) { - furi_assert(button_menu); + furi_check(button_menu); with_view_model( button_menu->view, @@ -319,7 +319,7 @@ void button_menu_reset(ButtonMenu* button_menu) { } void button_menu_set_header(ButtonMenu* button_menu, const char* header) { - furi_assert(button_menu); + furi_check(button_menu); with_view_model( button_menu->view, ButtonMenuModel * model, { model->header = header; }, true); @@ -333,8 +333,8 @@ ButtonMenuItem* button_menu_add_item( ButtonMenuItemType type, void* callback_context) { ButtonMenuItem* item = NULL; - furi_assert(label); - furi_assert(button_menu); + furi_check(label); + furi_check(button_menu); with_view_model( button_menu->view, @@ -376,7 +376,7 @@ ButtonMenu* button_menu_alloc(void) { } void button_menu_free(ButtonMenu* button_menu) { - furi_assert(button_menu); + furi_check(button_menu); with_view_model( button_menu->view, @@ -388,7 +388,7 @@ void button_menu_free(ButtonMenu* button_menu) { } void button_menu_set_selected_item(ButtonMenu* button_menu, uint32_t index) { - furi_assert(button_menu); + furi_check(button_menu); with_view_model( button_menu->view, diff --git a/applications/services/gui/modules/button_panel.c b/applications/services/gui/modules/button_panel.c index ded7891e6c5..d768b324a2f 100644 --- a/applications/services/gui/modules/button_panel.c +++ b/applications/services/gui/modules/button_panel.c @@ -67,7 +67,7 @@ static void button_panel_process_ok(ButtonPanel* button_panel); static void button_panel_view_draw_callback(Canvas* canvas, void* _model); static bool button_panel_view_input_callback(InputEvent* event, void* context); -ButtonPanel* button_panel_alloc() { +ButtonPanel* button_panel_alloc(void) { ButtonPanel* button_panel = malloc(sizeof(ButtonPanel)); button_panel->view = view_alloc(); view_set_orientation(button_panel->view, ViewOrientationVertical); @@ -114,7 +114,7 @@ void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t re } void button_panel_free(ButtonPanel* button_panel) { - furi_assert(button_panel); + furi_check(button_panel); button_panel_reset(button_panel); @@ -132,7 +132,7 @@ void button_panel_free(ButtonPanel* button_panel) { } void button_panel_reset(ButtonPanel* button_panel) { - furi_assert(button_panel); + furi_check(button_panel); with_view_model( button_panel->view, @@ -177,7 +177,7 @@ void button_panel_add_item( const Icon* icon_name_selected, ButtonItemCallback callback, void* callback_context) { - furi_assert(button_panel); + furi_check(button_panel); with_view_model( //-V773 button_panel->view, @@ -200,7 +200,7 @@ void button_panel_add_item( } View* button_panel_get_view(ButtonPanel* button_panel) { - furi_assert(button_panel); + furi_check(button_panel); return button_panel->view; } @@ -405,7 +405,7 @@ void button_panel_add_label( uint16_t y, Font font, const char* label_str) { - furi_assert(button_panel); + furi_check(button_panel); with_view_model( button_panel->view, @@ -426,7 +426,7 @@ void button_panel_add_icon( uint16_t x, uint16_t y, const Icon* icon_name) { - furi_assert(button_panel); + furi_check(button_panel); with_view_model( //-V773 button_panel->view, diff --git a/applications/services/gui/modules/byte_input.c b/applications/services/gui/modules/byte_input.c index e9cd78da02b..c33ad3e07f8 100644 --- a/applications/services/gui/modules/byte_input.c +++ b/applications/services/gui/modules/byte_input.c @@ -808,7 +808,7 @@ static void byte_input_reset_model_input_data(ByteInputModel* model) { model->first_visible_byte = 0; } -ByteInput* byte_input_alloc() { +ByteInput* byte_input_alloc(void) { ByteInput* byte_input = malloc(sizeof(ByteInput)); byte_input->view = view_alloc(); view_set_context(byte_input->view, byte_input); @@ -832,13 +832,13 @@ ByteInput* byte_input_alloc() { } void byte_input_free(ByteInput* byte_input) { - furi_assert(byte_input); + furi_check(byte_input); view_free(byte_input->view); free(byte_input); } View* byte_input_get_view(ByteInput* byte_input) { - furi_assert(byte_input); + furi_check(byte_input); return byte_input->view; } @@ -849,6 +849,8 @@ void byte_input_set_result_callback( void* callback_context, uint8_t* bytes, uint8_t bytes_count) { + furi_check(byte_input); + with_view_model( byte_input->view, ByteInputModel * model, @@ -864,6 +866,8 @@ void byte_input_set_result_callback( } void byte_input_set_header_text(ByteInput* byte_input, const char* text) { + furi_check(byte_input); + with_view_model( byte_input->view, ByteInputModel * model, { model->header = text; }, true); } diff --git a/applications/services/gui/modules/byte_input.h b/applications/services/gui/modules/byte_input.h index 42c4b5d65f9..9cca7575e07 100644 --- a/applications/services/gui/modules/byte_input.h +++ b/applications/services/gui/modules/byte_input.h @@ -24,7 +24,7 @@ typedef void (*ByteChangedCallback)(void* context); * * @return ByteInput instance pointer */ -ByteInput* byte_input_alloc(); +ByteInput* byte_input_alloc(void); /** Deinitialize and free byte input * diff --git a/applications/services/gui/modules/dialog_ex.c b/applications/services/gui/modules/dialog_ex.c index 7c3ef9b4522..5fd42be6c6d 100644 --- a/applications/services/gui/modules/dialog_ex.c +++ b/applications/services/gui/modules/dialog_ex.c @@ -143,7 +143,7 @@ static bool dialog_ex_view_input_callback(InputEvent* event, void* context) { return consumed; } -DialogEx* dialog_ex_alloc() { +DialogEx* dialog_ex_alloc(void) { DialogEx* dialog_ex = malloc(sizeof(DialogEx)); dialog_ex->view = view_alloc(); view_set_context(dialog_ex->view, dialog_ex); @@ -180,23 +180,23 @@ DialogEx* dialog_ex_alloc() { } void dialog_ex_free(DialogEx* dialog_ex) { - furi_assert(dialog_ex); + furi_check(dialog_ex); view_free(dialog_ex->view); free(dialog_ex); } View* dialog_ex_get_view(DialogEx* dialog_ex) { - furi_assert(dialog_ex); + furi_check(dialog_ex); return dialog_ex->view; } void dialog_ex_set_result_callback(DialogEx* dialog_ex, DialogExResultCallback callback) { - furi_assert(dialog_ex); + furi_check(dialog_ex); dialog_ex->callback = callback; } void dialog_ex_set_context(DialogEx* dialog_ex, void* context) { - furi_assert(dialog_ex); + furi_check(dialog_ex); dialog_ex->context = context; } @@ -207,7 +207,7 @@ void dialog_ex_set_header( uint8_t y, Align horizontal, Align vertical) { - furi_assert(dialog_ex); + furi_check(dialog_ex); with_view_model( dialog_ex->view, DialogExModel * model, @@ -228,7 +228,7 @@ void dialog_ex_set_text( uint8_t y, Align horizontal, Align vertical) { - furi_assert(dialog_ex); + furi_check(dialog_ex); with_view_model( dialog_ex->view, DialogExModel * model, @@ -243,7 +243,7 @@ void dialog_ex_set_text( } void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* icon) { - furi_assert(dialog_ex); + furi_check(dialog_ex); with_view_model( dialog_ex->view, DialogExModel * model, @@ -256,25 +256,25 @@ void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* i } void dialog_ex_set_left_button_text(DialogEx* dialog_ex, const char* text) { - furi_assert(dialog_ex); + furi_check(dialog_ex); with_view_model( dialog_ex->view, DialogExModel * model, { model->left_text = text; }, true); } void dialog_ex_set_center_button_text(DialogEx* dialog_ex, const char* text) { - furi_assert(dialog_ex); + furi_check(dialog_ex); with_view_model( dialog_ex->view, DialogExModel * model, { model->center_text = text; }, true); } void dialog_ex_set_right_button_text(DialogEx* dialog_ex, const char* text) { - furi_assert(dialog_ex); + furi_check(dialog_ex); with_view_model( dialog_ex->view, DialogExModel * model, { model->right_text = text; }, true); } void dialog_ex_reset(DialogEx* dialog_ex) { - furi_assert(dialog_ex); + furi_check(dialog_ex); TextElement clean_text_el = { .text = NULL, .x = 0, .y = 0, .horizontal = AlignLeft, .vertical = AlignLeft}; IconElement clean_icon_el = {.icon = NULL, .x = 0, .y = 0}; @@ -295,11 +295,11 @@ void dialog_ex_reset(DialogEx* dialog_ex) { } void dialog_ex_enable_extended_events(DialogEx* dialog_ex) { - furi_assert(dialog_ex); + furi_check(dialog_ex); dialog_ex->enable_extended_events = true; } void dialog_ex_disable_extended_events(DialogEx* dialog_ex) { - furi_assert(dialog_ex); + furi_check(dialog_ex); dialog_ex->enable_extended_events = false; } diff --git a/applications/services/gui/modules/dialog_ex.h b/applications/services/gui/modules/dialog_ex.h index 91424f78c0a..aa87097f73d 100644 --- a/applications/services/gui/modules/dialog_ex.h +++ b/applications/services/gui/modules/dialog_ex.h @@ -38,7 +38,7 @@ typedef void (*DialogExResultCallback)(DialogExResult result, void* context); * * @return DialogEx instance */ -DialogEx* dialog_ex_alloc(); +DialogEx* dialog_ex_alloc(void); /** Deinitialize and free dialog * diff --git a/applications/services/gui/modules/empty_screen.c b/applications/services/gui/modules/empty_screen.c index 0a51bc71c6a..1efb1d9106f 100644 --- a/applications/services/gui/modules/empty_screen.c +++ b/applications/services/gui/modules/empty_screen.c @@ -16,7 +16,7 @@ static bool empty_screen_view_input_callback(InputEvent* event, void* context) { return false; } -EmptyScreen* empty_screen_alloc() { +EmptyScreen* empty_screen_alloc(void) { EmptyScreen* empty_screen = malloc(sizeof(EmptyScreen)); empty_screen->view = view_alloc(); view_set_context(empty_screen->view, empty_screen); @@ -26,12 +26,12 @@ EmptyScreen* empty_screen_alloc() { } void empty_screen_free(EmptyScreen* empty_screen) { - furi_assert(empty_screen); + furi_check(empty_screen); view_free(empty_screen->view); free(empty_screen); } View* empty_screen_get_view(EmptyScreen* empty_screen) { - furi_assert(empty_screen); + furi_check(empty_screen); return empty_screen->view; } diff --git a/applications/services/gui/modules/empty_screen.h b/applications/services/gui/modules/empty_screen.h index 23ebeb3a05d..5ca99bda20a 100644 --- a/applications/services/gui/modules/empty_screen.h +++ b/applications/services/gui/modules/empty_screen.h @@ -20,7 +20,7 @@ typedef struct EmptyScreen EmptyScreen; * * @return EmptyScreen instance */ -EmptyScreen* empty_screen_alloc(); +EmptyScreen* empty_screen_alloc(void); /** Deinitialize and free empty screen * diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index 91b03ec8aae..9e0a7560dd7 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -140,14 +140,14 @@ static void static void browser_long_load_cb(void* context); static void file_browser_scroll_timer_callback(void* context) { - furi_assert(context); + furi_check(context); FileBrowser* browser = context; with_view_model( browser->view, FileBrowserModel * model, { model->scroll_counter++; }, true); } static void file_browser_view_enter_callback(void* context) { - furi_assert(context); + furi_check(context); FileBrowser* browser = context; with_view_model( browser->view, FileBrowserModel * model, { model->scroll_counter = 0; }, true); @@ -155,13 +155,14 @@ static void file_browser_view_enter_callback(void* context) { } static void file_browser_view_exit_callback(void* context) { - furi_assert(context); + furi_check(context); FileBrowser* browser = context; furi_timer_stop(browser->scroll_timer); } FileBrowser* file_browser_alloc(FuriString* result_path) { - furi_assert(result_path); + furi_check(result_path); + FileBrowser* browser = malloc(sizeof(FileBrowser)); browser->view = view_alloc(); view_allocate_model(browser->view, ViewModelTypeLocking, sizeof(FileBrowserModel)); @@ -183,7 +184,7 @@ FileBrowser* file_browser_alloc(FuriString* result_path) { } void file_browser_free(FileBrowser* browser) { - furi_assert(browser); + furi_check(browser); furi_timer_free(browser->scroll_timer); @@ -195,7 +196,7 @@ void file_browser_free(FileBrowser* browser) { } View* file_browser_get_view(FileBrowser* browser) { - furi_assert(browser); + furi_check(browser); return browser->view; } @@ -207,7 +208,7 @@ void file_browser_configure( bool hide_dot_files, const Icon* file_icon, bool hide_ext) { - furi_assert(browser); + furi_check(browser); browser->ext_filter = extension; browser->skip_assets = skip_assets; @@ -226,7 +227,7 @@ void file_browser_configure( } void file_browser_start(FileBrowser* browser, FuriString* path) { - furi_assert(browser); + furi_check(browser); browser->worker = file_browser_worker_alloc( path, browser->base_path, @@ -241,7 +242,7 @@ void file_browser_start(FileBrowser* browser, FuriString* path) { } void file_browser_stop(FileBrowser* browser) { - furi_assert(browser); + furi_check(browser); file_browser_worker_free(browser->worker); with_view_model( browser->view, @@ -257,6 +258,7 @@ void file_browser_stop(FileBrowser* browser) { } void file_browser_set_callback(FileBrowser* browser, FileBrowserCallback callback, void* context) { + furi_check(browser); browser->context = context; browser->callback = callback; } @@ -265,6 +267,8 @@ void file_browser_set_item_callback( FileBrowser* browser, FileBrowserLoadItemCallback callback, void* context) { + furi_check(browser); + browser->item_context = context; browser->item_callback = callback; } @@ -310,7 +314,7 @@ static void browser_list_rollover(FileBrowserModel* model) { } static void browser_update_offset(FileBrowser* browser) { - furi_assert(browser); + furi_check(browser); with_view_model( browser->view, @@ -336,7 +340,7 @@ static void browser_update_offset(FileBrowser* browser) { static void browser_folder_open_cb(void* context, uint32_t item_cnt, int32_t file_idx, bool is_root) { - furi_assert(context); + furi_check(context); FileBrowser* browser = (FileBrowser*)context; int32_t load_offset = 0; @@ -370,7 +374,7 @@ static void } static void browser_list_load_cb(void* context, uint32_t list_load_offset) { - furi_assert(context); + furi_check(context); FileBrowser* browser = (FileBrowser*)context; BrowserItem_t back_item; @@ -398,7 +402,7 @@ static void browser_list_load_cb(void* context, uint32_t list_load_offset) { static void browser_list_item_cb(void* context, FuriString* item_path, bool is_folder, bool is_last) { - furi_assert(context); + furi_check(context); FileBrowser* browser = (FileBrowser*)context; BrowserItem_t item; @@ -463,7 +467,7 @@ static void } static void browser_long_load_cb(void* context) { - furi_assert(context); + furi_check(context); FileBrowser* browser = (FileBrowser*)context; with_view_model( @@ -594,7 +598,7 @@ static void file_browser_view_draw_callback(Canvas* canvas, void* _model) { static bool file_browser_view_input_callback(InputEvent* event, void* context) { FileBrowser* browser = context; - furi_assert(browser); + furi_check(browser); bool consumed = false; bool is_loading = false; diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index b5d8aee9ae7..1ca9ac83798 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -300,7 +300,7 @@ static bool static int32_t browser_worker(void* context) { BrowserWorker* browser = (BrowserWorker*)context; - furi_assert(browser); + furi_check(browser); FURI_LOG_D(TAG, "Start"); uint32_t items_cnt = 0; @@ -316,7 +316,7 @@ static int32_t browser_worker(void* context) { while(1) { uint32_t flags = furi_thread_flags_wait(WORKER_FLAGS_ALL, FuriFlagWaitAny, FuriWaitForever); - furi_assert((flags & FuriFlagError) == 0); + furi_check((flags & FuriFlagError) == 0); if(flags & WorkerEvtConfigChange) { // If start path is a path to the file - try finding index of this file in a folder @@ -437,7 +437,7 @@ BrowserWorker* file_browser_worker_alloc( } //-V773 void file_browser_worker_free(BrowserWorker* browser) { - furi_assert(browser); + furi_check(browser); furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtStop); furi_thread_join(browser->thread); @@ -454,35 +454,35 @@ void file_browser_worker_free(BrowserWorker* browser) { } void file_browser_worker_set_callback_context(BrowserWorker* browser, void* context) { - furi_assert(browser); + furi_check(browser); browser->cb_ctx = context; } void file_browser_worker_set_folder_callback( BrowserWorker* browser, BrowserWorkerFolderOpenCallback cb) { - furi_assert(browser); + furi_check(browser); browser->folder_cb = cb; } void file_browser_worker_set_list_callback( BrowserWorker* browser, BrowserWorkerListLoadCallback cb) { - furi_assert(browser); + furi_check(browser); browser->list_load_cb = cb; } void file_browser_worker_set_item_callback( BrowserWorker* browser, BrowserWorkerListItemCallback cb) { - furi_assert(browser); + furi_check(browser); browser->list_item_cb = cb; } void file_browser_worker_set_long_load_callback( BrowserWorker* browser, BrowserWorkerLongLoadCallback cb) { - furi_assert(browser); + furi_check(browser); browser->long_load_cb = cb; } @@ -492,7 +492,7 @@ void file_browser_worker_set_config( const char* ext_filter, bool skip_assets, bool hide_dot_files) { - furi_assert(browser); + furi_check(browser); furi_string_set(browser->path_next, path); browser_parse_ext_filter(browser->ext_filter, ext_filter); browser->skip_assets = skip_assets; @@ -501,30 +501,30 @@ void file_browser_worker_set_config( } void file_browser_worker_folder_enter(BrowserWorker* browser, FuriString* path, int32_t item_idx) { - furi_assert(browser); + furi_check(browser); furi_string_set(browser->path_next, path); browser->item_sel_idx = item_idx; furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtFolderEnter); } bool file_browser_worker_is_in_start_folder(BrowserWorker* browser) { - furi_assert(browser); + furi_check(browser); return (furi_string_cmp(browser->path_start, browser->path_current) == 0); } void file_browser_worker_folder_exit(BrowserWorker* browser) { - furi_assert(browser); + furi_check(browser); furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtFolderExit); } void file_browser_worker_folder_refresh(BrowserWorker* browser, int32_t item_idx) { - furi_assert(browser); + furi_check(browser); browser->item_sel_idx = item_idx; furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtFolderRefresh); } void file_browser_worker_load(BrowserWorker* browser, uint32_t offset, uint32_t count) { - furi_assert(browser); + furi_check(browser); browser->load_offset = offset; browser->load_count = count; furi_thread_flags_set(furi_thread_get_id(browser->thread), WorkerEvtLoad); diff --git a/applications/services/gui/modules/loading.c b/applications/services/gui/modules/loading.c index e64aeb78fb1..7ef4ba8f3fa 100644 --- a/applications/services/gui/modules/loading.c +++ b/applications/services/gui/modules/loading.c @@ -79,6 +79,8 @@ Loading* loading_alloc(void) { } void loading_free(Loading* instance) { + furi_check(instance); + LoadingModel* model = view_get_model(instance->view); icon_animation_free(model->icon); view_commit_model(instance->view, false); @@ -89,7 +91,6 @@ void loading_free(Loading* instance) { } View* loading_get_view(Loading* instance) { - furi_assert(instance); - furi_assert(instance->view); + furi_check(instance); return instance->view; } diff --git a/applications/services/gui/modules/loading.h b/applications/services/gui/modules/loading.h index 1e071c10aec..12eac00d5a8 100644 --- a/applications/services/gui/modules/loading.h +++ b/applications/services/gui/modules/loading.h @@ -14,7 +14,7 @@ typedef struct Loading Loading; * * @return Loading View instance */ -Loading* loading_alloc(); +Loading* loading_alloc(void); /** Deinitialize and free Loading View * diff --git a/applications/services/gui/modules/menu.c b/applications/services/gui/modules/menu.c index afae8b8fa24..f0a3b82b5a0 100644 --- a/applications/services/gui/modules/menu.c +++ b/applications/services/gui/modules/menu.c @@ -129,9 +129,9 @@ static void menu_exit(void* context) { false); } -Menu* menu_alloc() { +Menu* menu_alloc(void) { Menu* menu = malloc(sizeof(Menu)); - menu->view = view_alloc(menu->view); + menu->view = view_alloc(); view_set_context(menu->view, menu); view_allocate_model(menu->view, ViewModelTypeLocking, sizeof(MenuModel)); view_set_draw_callback(menu->view, menu_draw_callback); @@ -152,16 +152,18 @@ Menu* menu_alloc() { } void menu_free(Menu* menu) { - furi_assert(menu); + furi_check(menu); + menu_reset(menu); with_view_model( menu->view, MenuModel * model, { MenuItemArray_clear(model->items); }, false); view_free(menu->view); + free(menu); } View* menu_get_view(Menu* menu) { - furi_assert(menu); + furi_check(menu); return (menu->view); } @@ -172,8 +174,8 @@ void menu_add_item( uint32_t index, MenuItemCallback callback, void* context) { - furi_assert(menu); - furi_assert(label); + furi_check(menu); + furi_check(label); MenuItem* item = NULL; with_view_model( @@ -192,7 +194,7 @@ void menu_add_item( } void menu_reset(Menu* menu) { - furi_assert(menu); + furi_check(menu); with_view_model( menu->view, MenuModel * model, @@ -210,6 +212,8 @@ void menu_reset(Menu* menu) { } void menu_set_selected_item(Menu* menu, uint32_t index) { + furi_check(menu); + with_view_model( menu->view, MenuModel * model, diff --git a/applications/services/gui/modules/menu.h b/applications/services/gui/modules/menu.h index f66514a712e..616bfcebe6b 100644 --- a/applications/services/gui/modules/menu.h +++ b/applications/services/gui/modules/menu.h @@ -21,7 +21,7 @@ typedef void (*MenuItemCallback)(void* context, uint32_t index); * * @return Menu instance */ -Menu* menu_alloc(); +Menu* menu_alloc(void); /** Free menu * diff --git a/applications/services/gui/modules/popup.c b/applications/services/gui/modules/popup.c index 520efceef96..45014f6f4d0 100644 --- a/applications/services/gui/modules/popup.c +++ b/applications/services/gui/modules/popup.c @@ -108,7 +108,7 @@ void popup_stop_timer(void* context) { furi_timer_stop(popup->timer); } -Popup* popup_alloc() { +Popup* popup_alloc(void) { Popup* popup = malloc(sizeof(Popup)); popup->view = view_alloc(); popup->timer = furi_timer_alloc(popup_timer_callback, FuriTimerTypeOnce, popup); @@ -148,24 +148,25 @@ Popup* popup_alloc() { } void popup_free(Popup* popup) { - furi_assert(popup); + furi_check(popup); furi_timer_free(popup->timer); view_free(popup->view); free(popup); } View* popup_get_view(Popup* popup) { - furi_assert(popup); + furi_check(popup); + return popup->view; } void popup_set_callback(Popup* popup, PopupCallback callback) { - furi_assert(popup); + furi_check(popup); popup->callback = callback; } void popup_set_context(Popup* popup, void* context) { - furi_assert(popup); + furi_check(popup); popup->context = context; } @@ -176,7 +177,8 @@ void popup_set_header( uint8_t y, Align horizontal, Align vertical) { - furi_assert(popup); + furi_check(popup); + with_view_model( popup->view, PopupModel * model, @@ -197,7 +199,8 @@ void popup_set_text( uint8_t y, Align horizontal, Align vertical) { - furi_assert(popup); + furi_check(popup); + with_view_model( popup->view, PopupModel * model, @@ -212,7 +215,8 @@ void popup_set_text( } void popup_set_icon(Popup* popup, uint8_t x, uint8_t y, const Icon* icon) { - furi_assert(popup); + furi_check(popup); + with_view_model( popup->view, PopupModel * model, @@ -225,20 +229,24 @@ void popup_set_icon(Popup* popup, uint8_t x, uint8_t y, const Icon* icon) { } void popup_set_timeout(Popup* popup, uint32_t timeout_in_ms) { - furi_assert(popup); + furi_check(popup); popup->timer_period_in_ms = timeout_in_ms; } void popup_enable_timeout(Popup* popup) { + furi_check(popup); + popup->timer_enabled = true; } void popup_disable_timeout(Popup* popup) { + furi_check(popup); + popup->timer_enabled = false; } void popup_reset(Popup* popup) { - furi_assert(popup); + furi_check(popup); with_view_model( popup->view, diff --git a/applications/services/gui/modules/popup.h b/applications/services/gui/modules/popup.h index 13371a05d4a..a3e8dc77321 100644 --- a/applications/services/gui/modules/popup.h +++ b/applications/services/gui/modules/popup.h @@ -25,7 +25,7 @@ typedef void (*PopupCallback)(void* context); * * @return Popup instance */ -Popup* popup_alloc(); +Popup* popup_alloc(void); /** Deinitialize and free popup * diff --git a/applications/services/gui/modules/submenu.c b/applications/services/gui/modules/submenu.c index 3ba35edde07..35916fe236a 100644 --- a/applications/services/gui/modules/submenu.c +++ b/applications/services/gui/modules/submenu.c @@ -150,7 +150,7 @@ static bool submenu_view_input_callback(InputEvent* event, void* context) { return consumed; } -Submenu* submenu_alloc() { +Submenu* submenu_alloc(void) { Submenu* submenu = malloc(sizeof(Submenu)); submenu->view = view_alloc(); view_set_context(submenu->view, submenu); @@ -173,7 +173,7 @@ Submenu* submenu_alloc() { } void submenu_free(Submenu* submenu) { - furi_assert(submenu); + furi_check(submenu); with_view_model( submenu->view, @@ -188,7 +188,7 @@ void submenu_free(Submenu* submenu) { } View* submenu_get_view(Submenu* submenu) { - furi_assert(submenu); + furi_check(submenu); return submenu->view; } @@ -199,8 +199,8 @@ void submenu_add_item( SubmenuItemCallback callback, void* callback_context) { SubmenuItem* item = NULL; - furi_assert(label); - furi_assert(submenu); + furi_check(label); + furi_check(submenu); with_view_model( submenu->view, @@ -216,7 +216,7 @@ void submenu_add_item( } void submenu_reset(Submenu* submenu) { - furi_assert(submenu); + furi_check(submenu); with_view_model( submenu->view, @@ -231,6 +231,7 @@ void submenu_reset(Submenu* submenu) { } void submenu_set_selected_item(Submenu* submenu, uint32_t index) { + furi_check(submenu); with_view_model( submenu->view, SubmenuModel * model, @@ -337,7 +338,7 @@ void submenu_process_ok(Submenu* submenu) { } void submenu_set_header(Submenu* submenu, const char* header) { - furi_assert(submenu); + furi_check(submenu); with_view_model( submenu->view, diff --git a/applications/services/gui/modules/submenu.h b/applications/services/gui/modules/submenu.h index f68abe83a17..6ae148eb5b0 100644 --- a/applications/services/gui/modules/submenu.h +++ b/applications/services/gui/modules/submenu.h @@ -21,7 +21,7 @@ typedef void (*SubmenuItemCallback)(void* context, uint32_t index); * * @return Submenu instance */ -Submenu* submenu_alloc(); +Submenu* submenu_alloc(void); /** Deinitialize and free submenu * diff --git a/applications/services/gui/modules/text_box.c b/applications/services/gui/modules/text_box.c index c0110806a73..f80129eb93b 100644 --- a/applications/services/gui/modules/text_box.c +++ b/applications/services/gui/modules/text_box.c @@ -169,7 +169,7 @@ static bool text_box_view_input_callback(InputEvent* event, void* context) { return consumed; } -TextBox* text_box_alloc() { +TextBox* text_box_alloc(void) { TextBox* text_box = malloc(sizeof(TextBox)); text_box->view = view_alloc(); view_set_context(text_box->view, text_box); @@ -192,7 +192,7 @@ TextBox* text_box_alloc() { } void text_box_free(TextBox* text_box) { - furi_assert(text_box); + furi_check(text_box); with_view_model( text_box->view, TextBoxModel * model, { furi_string_free(model->text_formatted); }, true); @@ -201,12 +201,12 @@ void text_box_free(TextBox* text_box) { } View* text_box_get_view(TextBox* text_box) { - furi_assert(text_box); + furi_check(text_box); return text_box->view; } void text_box_reset(TextBox* text_box) { - furi_assert(text_box); + furi_check(text_box); with_view_model( text_box->view, @@ -222,8 +222,8 @@ void text_box_reset(TextBox* text_box) { } void text_box_set_text(TextBox* text_box, const char* text) { - furi_assert(text_box); - furi_assert(text); + furi_check(text_box); + furi_check(text); size_t str_length = strlen(text); size_t formating_margin = str_length * TEXT_BOX_MAX_SYMBOL_WIDTH / TEXT_BOX_LINE_WIDTH; @@ -240,14 +240,14 @@ void text_box_set_text(TextBox* text_box, const char* text) { } void text_box_set_font(TextBox* text_box, TextBoxFont font) { - furi_assert(text_box); + furi_check(text_box); with_view_model( text_box->view, TextBoxModel * model, { model->font = font; }, true); } void text_box_set_focus(TextBox* text_box, TextBoxFocus focus) { - furi_assert(text_box); + furi_check(text_box); with_view_model( text_box->view, TextBoxModel * model, { model->focus = focus; }, true); diff --git a/applications/services/gui/modules/text_box.h b/applications/services/gui/modules/text_box.h index 2a0548f2ea4..0e30f637018 100644 --- a/applications/services/gui/modules/text_box.h +++ b/applications/services/gui/modules/text_box.h @@ -28,7 +28,7 @@ typedef enum { * * @return TextBox instance */ -TextBox* text_box_alloc(); +TextBox* text_box_alloc(void); /** Deinitialize and free text_box * diff --git a/applications/services/gui/modules/text_input.c b/applications/services/gui/modules/text_input.c index 50453cf22c4..da391628d14 100644 --- a/applications/services/gui/modules/text_input.c +++ b/applications/services/gui/modules/text_input.c @@ -439,7 +439,7 @@ void text_input_timer_callback(void* context) { true); } -TextInput* text_input_alloc() { +TextInput* text_input_alloc(void) { TextInput* text_input = malloc(sizeof(TextInput)); text_input->view = view_alloc(); view_set_context(text_input->view, text_input); @@ -461,7 +461,7 @@ TextInput* text_input_alloc() { } void text_input_free(TextInput* text_input) { - furi_assert(text_input); + furi_check(text_input); with_view_model( text_input->view, TextInputModel * model, @@ -479,7 +479,7 @@ void text_input_free(TextInput* text_input) { } void text_input_reset(TextInput* text_input) { - furi_assert(text_input); + furi_check(text_input); with_view_model( text_input->view, TextInputModel * model, @@ -501,7 +501,7 @@ void text_input_reset(TextInput* text_input) { } View* text_input_get_view(TextInput* text_input) { - furi_assert(text_input); + furi_check(text_input); return text_input->view; } @@ -512,6 +512,7 @@ void text_input_set_result_callback( char* text_buffer, size_t text_buffer_size, bool clear_default_text) { + furi_check(text_input); with_view_model( text_input->view, TextInputModel * model, @@ -534,6 +535,7 @@ void text_input_set_validator( TextInput* text_input, TextInputValidatorCallback callback, void* callback_context) { + furi_check(text_input); with_view_model( text_input->view, TextInputModel * model, @@ -545,6 +547,7 @@ void text_input_set_validator( } TextInputValidatorCallback text_input_get_validator_callback(TextInput* text_input) { + furi_check(text_input); TextInputValidatorCallback validator_callback = NULL; with_view_model( text_input->view, @@ -555,6 +558,7 @@ TextInputValidatorCallback text_input_get_validator_callback(TextInput* text_inp } void* text_input_get_validator_callback_context(TextInput* text_input) { + furi_check(text_input); void* validator_callback_context = NULL; with_view_model( text_input->view, @@ -565,6 +569,7 @@ void* text_input_get_validator_callback_context(TextInput* text_input) { } void text_input_set_header_text(TextInput* text_input, const char* text) { + furi_check(text_input); with_view_model( text_input->view, TextInputModel * model, { model->header = text; }, true); } diff --git a/applications/services/gui/modules/text_input.h b/applications/services/gui/modules/text_input.h index 218df3141df..b6ca6b54f22 100644 --- a/applications/services/gui/modules/text_input.h +++ b/applications/services/gui/modules/text_input.h @@ -23,7 +23,7 @@ typedef bool (*TextInputValidatorCallback)(const char* text, FuriString* error, * * @return TextInput instance */ -TextInput* text_input_alloc(); +TextInput* text_input_alloc(void); /** Deinitialize and free text input * diff --git a/applications/services/gui/modules/validators.c b/applications/services/gui/modules/validators.c index a18cb925f14..407a3aa1ef3 100644 --- a/applications/services/gui/modules/validators.c +++ b/applications/services/gui/modules/validators.c @@ -9,7 +9,7 @@ struct ValidatorIsFile { }; bool validator_is_file_callback(const char* text, FuriString* error, void* context) { - furi_assert(context); + furi_check(context); ValidatorIsFile* instance = context; if(instance->current_name != NULL) { @@ -47,7 +47,7 @@ ValidatorIsFile* validator_is_file_alloc_init( } void validator_is_file_free(ValidatorIsFile* instance) { - furi_assert(instance); + furi_check(instance); free(instance->app_path_folder); free(instance->current_name); free(instance); diff --git a/applications/services/gui/modules/variable_item_list.c b/applications/services/gui/modules/variable_item_list.c index cf7f64ca350..f8110034e53 100644 --- a/applications/services/gui/modules/variable_item_list.c +++ b/applications/services/gui/modules/variable_item_list.c @@ -91,6 +91,7 @@ static void variable_item_list_draw_callback(Canvas* canvas, void* _model) { } void variable_item_list_set_selected_item(VariableItemList* variable_item_list, uint8_t index) { + furi_check(variable_item_list); with_view_model( variable_item_list->view, VariableItemListModel * model, @@ -119,6 +120,7 @@ void variable_item_list_set_selected_item(VariableItemList* variable_item_list, } uint8_t variable_item_list_get_selected_item_index(VariableItemList* variable_item_list) { + furi_check(variable_item_list); VariableItemListModel* model = view_get_model(variable_item_list->view); uint8_t idx = model->position; view_commit_model(variable_item_list->view, false); @@ -286,7 +288,7 @@ void variable_item_list_process_ok(VariableItemList* variable_item_list) { false); } -VariableItemList* variable_item_list_alloc() { +VariableItemList* variable_item_list_alloc(void) { VariableItemList* variable_item_list = malloc(sizeof(VariableItemList)); variable_item_list->view = view_alloc(); view_set_context(variable_item_list->view, variable_item_list); @@ -309,7 +311,7 @@ VariableItemList* variable_item_list_alloc() { } void variable_item_list_free(VariableItemList* variable_item_list) { - furi_assert(variable_item_list); + furi_check(variable_item_list); with_view_model( variable_item_list->view, @@ -328,7 +330,7 @@ void variable_item_list_free(VariableItemList* variable_item_list) { } void variable_item_list_reset(VariableItemList* variable_item_list) { - furi_assert(variable_item_list); + furi_check(variable_item_list); with_view_model( variable_item_list->view, @@ -345,7 +347,7 @@ void variable_item_list_reset(VariableItemList* variable_item_list) { } View* variable_item_list_get_view(VariableItemList* variable_item_list) { - furi_assert(variable_item_list); + furi_check(variable_item_list); return variable_item_list->view; } @@ -356,8 +358,8 @@ VariableItem* variable_item_list_add( VariableItemChangeCallback change_callback, void* context) { VariableItem* item = NULL; - furi_assert(label); - furi_assert(variable_item_list); + furi_check(label); + furi_check(variable_item_list); with_view_model( variable_item_list->view, @@ -380,7 +382,7 @@ void variable_item_list_set_enter_callback( VariableItemList* variable_item_list, VariableItemListEnterCallback callback, void* context) { - furi_assert(callback); + furi_check(callback); with_view_model( variable_item_list->view, VariableItemListModel * model, @@ -393,21 +395,26 @@ void variable_item_list_set_enter_callback( } void variable_item_set_current_value_index(VariableItem* item, uint8_t current_value_index) { + furi_check(item); item->current_value_index = current_value_index; } void variable_item_set_values_count(VariableItem* item, uint8_t values_count) { + furi_check(item); item->values_count = values_count; } void variable_item_set_current_value_text(VariableItem* item, const char* current_value_text) { + furi_check(item); furi_string_set(item->current_value_text, current_value_text); } uint8_t variable_item_get_current_value_index(VariableItem* item) { + furi_check(item); return item->current_value_index; } void* variable_item_get_context(VariableItem* item) { + furi_check(item); return item->context; } diff --git a/applications/services/gui/modules/variable_item_list.h b/applications/services/gui/modules/variable_item_list.h index db2a58993d4..85db6d11992 100644 --- a/applications/services/gui/modules/variable_item_list.h +++ b/applications/services/gui/modules/variable_item_list.h @@ -20,7 +20,7 @@ typedef void (*VariableItemListEnterCallback)(void* context, uint32_t index); * * @return VariableItemList* */ -VariableItemList* variable_item_list_alloc(); +VariableItemList* variable_item_list_alloc(void); /** Deinitialize and free VariableItemList * diff --git a/applications/services/gui/modules/widget.c b/applications/services/gui/modules/widget.c index 21b8e561629..50171e0cc42 100644 --- a/applications/services/gui/modules/widget.c +++ b/applications/services/gui/modules/widget.c @@ -54,7 +54,7 @@ static bool gui_widget_view_input_callback(InputEvent* event, void* context) { return consumed; } -Widget* widget_alloc() { +Widget* widget_alloc(void) { Widget* widget = malloc(sizeof(Widget)); widget->view = view_alloc(); view_set_context(widget->view, widget); @@ -69,7 +69,7 @@ Widget* widget_alloc() { } void widget_reset(Widget* widget) { - furi_assert(widget); + furi_check(widget); with_view_model( widget->view, @@ -89,7 +89,7 @@ void widget_reset(Widget* widget) { } void widget_free(Widget* widget) { - furi_assert(widget); + furi_check(widget); // Free all elements widget_reset(widget); // Free elements container @@ -101,7 +101,7 @@ void widget_free(Widget* widget) { } View* widget_get_view(Widget* widget) { - furi_assert(widget); + furi_check(widget); return widget->view; } @@ -127,7 +127,7 @@ void widget_add_string_multiline_element( Align vertical, Font font, const char* text) { - furi_assert(widget); + furi_check(widget); WidgetElement* string_multiline_element = widget_element_string_multiline_create(x, y, horizontal, vertical, font, text); widget_add_element(widget, string_multiline_element); @@ -141,7 +141,7 @@ void widget_add_string_element( Align vertical, Font font, const char* text) { - furi_assert(widget); + furi_check(widget); WidgetElement* string_element = widget_element_string_create(x, y, horizontal, vertical, font, text); widget_add_element(widget, string_element); @@ -157,7 +157,7 @@ void widget_add_text_box_element( Align vertical, const char* text, bool strip_to_dots) { - furi_assert(widget); + furi_check(widget); WidgetElement* text_box_element = widget_element_text_box_create( x, y, width, height, horizontal, vertical, text, strip_to_dots); widget_add_element(widget, text_box_element); @@ -170,7 +170,7 @@ void widget_add_text_scroll_element( uint8_t width, uint8_t height, const char* text) { - furi_assert(widget); + furi_check(widget); WidgetElement* text_scroll_element = widget_element_text_scroll_create(x, y, width, height, text); widget_add_element(widget, text_scroll_element); @@ -182,15 +182,15 @@ void widget_add_button_element( const char* text, ButtonCallback callback, void* context) { - furi_assert(widget); + furi_check(widget); WidgetElement* button_element = widget_element_button_create(button_type, text, callback, context); widget_add_element(widget, button_element); } void widget_add_icon_element(Widget* widget, uint8_t x, uint8_t y, const Icon* icon) { - furi_assert(widget); - furi_assert(icon); + furi_check(widget); + furi_check(icon); WidgetElement* icon_element = widget_element_icon_create(x, y, icon); widget_add_element(widget, icon_element); } @@ -202,7 +202,7 @@ void widget_add_frame_element( uint8_t width, uint8_t height, uint8_t radius) { - furi_assert(widget); + furi_check(widget); WidgetElement* frame_element = widget_element_frame_create(x, y, width, height, radius); widget_add_element(widget, frame_element); } diff --git a/applications/services/gui/modules/widget.h b/applications/services/gui/modules/widget.h index d998516781b..b3137029601 100644 --- a/applications/services/gui/modules/widget.h +++ b/applications/services/gui/modules/widget.h @@ -18,7 +18,7 @@ typedef struct WidgetElement WidgetElement; * * @return Widget instance */ -Widget* widget_alloc(); +Widget* widget_alloc(void); /** Free Widget * @note this function free allocated Widget Elements diff --git a/applications/services/gui/scene_manager.c b/applications/services/gui/scene_manager.c index 4064dafb662..7a0a2913765 100644 --- a/applications/services/gui/scene_manager.c +++ b/applications/services/gui/scene_manager.c @@ -2,7 +2,7 @@ #include SceneManager* scene_manager_alloc(const SceneManagerHandlers* app_scene_handlers, void* context) { - furi_assert(context); + furi_check(context); SceneManager* scene_manager = malloc(sizeof(SceneManager)); // Set SceneManager context and scene handlers @@ -17,7 +17,7 @@ SceneManager* scene_manager_alloc(const SceneManagerHandlers* app_scene_handlers } void scene_manager_free(SceneManager* scene_manager) { - furi_assert(scene_manager); + furi_check(scene_manager); // Clear ScaneManager array SceneManagerIdStack_clear(scene_manager->scene_id_stack); @@ -28,21 +28,21 @@ void scene_manager_free(SceneManager* scene_manager) { } void scene_manager_set_scene_state(SceneManager* scene_manager, uint32_t scene_id, uint32_t state) { - furi_assert(scene_manager); - furi_assert(scene_id < scene_manager->scene_handlers->scene_num); + furi_check(scene_manager); + furi_check(scene_id < scene_manager->scene_handlers->scene_num); scene_manager->scene[scene_id].state = state; } uint32_t scene_manager_get_scene_state(const SceneManager* scene_manager, uint32_t scene_id) { - furi_assert(scene_manager); - furi_assert(scene_id < scene_manager->scene_handlers->scene_num); + furi_check(scene_manager); + furi_check(scene_id < scene_manager->scene_handlers->scene_num); return scene_manager->scene[scene_id].state; } bool scene_manager_handle_custom_event(SceneManager* scene_manager, uint32_t custom_event) { - furi_assert(scene_manager); + furi_check(scene_manager); SceneManagerEvent event = { .type = SceneManagerEventTypeCustom, @@ -61,7 +61,7 @@ bool scene_manager_handle_custom_event(SceneManager* scene_manager, uint32_t cus } bool scene_manager_handle_back_event(SceneManager* scene_manager) { - furi_assert(scene_manager); + furi_check(scene_manager); SceneManagerEvent event = { .type = SceneManagerEventTypeBack, @@ -82,7 +82,7 @@ bool scene_manager_handle_back_event(SceneManager* scene_manager) { } void scene_manager_handle_tick_event(SceneManager* scene_manager) { - furi_assert(scene_manager); + furi_check(scene_manager); SceneManagerEvent event = { .type = SceneManagerEventTypeTick, @@ -96,8 +96,8 @@ void scene_manager_handle_tick_event(SceneManager* scene_manager) { } void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_id) { - furi_assert(scene_manager); - furi_assert(next_scene_id < scene_manager->scene_handlers->scene_num); + furi_check(scene_manager); + furi_check(next_scene_id < scene_manager->scene_handlers->scene_num); // Check if it is not the first scene if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) { @@ -110,7 +110,7 @@ void scene_manager_next_scene(SceneManager* scene_manager, uint32_t next_scene_i } bool scene_manager_previous_scene(SceneManager* scene_manager) { - furi_assert(scene_manager); + furi_check(scene_manager); if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) { uint32_t cur_scene_id = 0; @@ -133,7 +133,7 @@ bool scene_manager_previous_scene(SceneManager* scene_manager) { bool scene_manager_search_and_switch_to_previous_scene( SceneManager* scene_manager, uint32_t scene_id) { - furi_assert(scene_manager); + furi_check(scene_manager); if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) { uint32_t prev_scene_id = 0; @@ -169,8 +169,8 @@ bool scene_manager_search_and_switch_to_previous_scene_one_of( SceneManager* scene_manager, const uint32_t* scene_ids, size_t scene_ids_size) { - furi_assert(scene_manager); - furi_assert(scene_ids); + furi_check(scene_manager); + furi_check(scene_ids); bool scene_found = false; for(size_t i = 0; i < scene_ids_size; ++i) { @@ -185,7 +185,7 @@ bool scene_manager_search_and_switch_to_previous_scene_one_of( } bool scene_manager_has_previous_scene(const SceneManager* scene_manager, uint32_t scene_id) { - furi_assert(scene_manager); + furi_check(scene_manager); bool scene_found = false; if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) { @@ -211,8 +211,8 @@ bool scene_manager_has_previous_scene(const SceneManager* scene_manager, uint32_ bool scene_manager_search_and_switch_to_another_scene( SceneManager* scene_manager, uint32_t scene_id) { - furi_assert(scene_manager); - furi_assert(scene_id < scene_manager->scene_handlers->scene_num); + furi_check(scene_manager); + furi_check(scene_id < scene_manager->scene_handlers->scene_num); if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) { uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack); @@ -234,7 +234,7 @@ bool scene_manager_search_and_switch_to_another_scene( } void scene_manager_stop(SceneManager* scene_manager) { - furi_assert(scene_manager); + furi_check(scene_manager); if(SceneManagerIdStack_size(scene_manager->scene_id_stack) > 0) { uint32_t cur_scene_id = *SceneManagerIdStack_back(scene_manager->scene_id_stack); diff --git a/applications/services/gui/view.c b/applications/services/gui/view.c index 316f5c612a1..8fc5c269974 100644 --- a/applications/services/gui/view.c +++ b/applications/services/gui/view.c @@ -1,77 +1,77 @@ #include "view_i.h" -View* view_alloc() { +View* view_alloc(void) { View* view = malloc(sizeof(View)); view->orientation = ViewOrientationHorizontal; return view; } void view_free(View* view) { - furi_assert(view); + furi_check(view); view_free_model(view); free(view); } void view_tie_icon_animation(View* view, IconAnimation* icon_animation) { - furi_assert(view); + furi_check(view); icon_animation_set_update_callback(icon_animation, view_icon_animation_callback, view); } void view_set_draw_callback(View* view, ViewDrawCallback callback) { - furi_assert(view); + furi_check(view); view->draw_callback = callback; } void view_set_input_callback(View* view, ViewInputCallback callback) { - furi_assert(view); + furi_check(view); view->input_callback = callback; } void view_set_custom_callback(View* view, ViewCustomCallback callback) { - furi_assert(view); + furi_check(view); view->custom_callback = callback; } void view_set_previous_callback(View* view, ViewNavigationCallback callback) { - furi_assert(view); + furi_check(view); view->previous_callback = callback; } void view_set_enter_callback(View* view, ViewCallback callback) { - furi_assert(view); + furi_check(view); view->enter_callback = callback; } void view_set_exit_callback(View* view, ViewCallback callback) { - furi_assert(view); + furi_check(view); view->exit_callback = callback; } void view_set_update_callback(View* view, ViewUpdateCallback callback) { - furi_assert(view); + furi_check(view); view->update_callback = callback; } void view_set_update_callback_context(View* view, void* context) { - furi_assert(view); + furi_check(view); view->update_callback_context = context; } void view_set_context(View* view, void* context) { - furi_assert(view); + furi_check(view); view->context = context; } void view_set_orientation(View* view, ViewOrientation orientation) { - furi_assert(view); + furi_check(view); view->orientation = orientation; } void view_allocate_model(View* view, ViewModelType type, size_t size) { - furi_assert(view); - furi_assert(size > 0); - furi_assert(view->model_type == ViewModelTypeNone); - furi_assert(view->model == NULL); + furi_check(view); + furi_check(size > 0); + furi_check(view->model_type == ViewModelTypeNone); + furi_check(view->model == NULL); view->model_type = type; if(view->model_type == ViewModelTypeLockFree) { view->model = malloc(size); @@ -87,7 +87,7 @@ void view_allocate_model(View* view, ViewModelType type, size_t size) { } void view_free_model(View* view) { - furi_assert(view); + furi_check(view); if(view->model_type == ViewModelTypeNone) { return; } else if(view->model_type == ViewModelTypeLockFree) { @@ -104,7 +104,7 @@ void view_free_model(View* view) { } void* view_get_model(View* view) { - furi_assert(view); + furi_check(view); if(view->model_type == ViewModelTypeLocking) { ViewModelLocking* model = (ViewModelLocking*)(view->model); furi_check(furi_mutex_acquire(model->mutex, FuriWaitForever) == FuriStatusOk); @@ -114,7 +114,7 @@ void* view_get_model(View* view) { } void view_commit_model(View* view, bool update) { - furi_assert(view); + furi_check(view); view_unlock_model(view); if(update && view->update_callback) { view->update_callback(view, view->update_callback_context); @@ -123,7 +123,7 @@ void view_commit_model(View* view, bool update) { void view_icon_animation_callback(IconAnimation* instance, void* context) { UNUSED(instance); - furi_assert(context); + furi_check(context); View* view = context; if(view->update_callback) { view->update_callback(view, view->update_callback_context); @@ -131,7 +131,7 @@ void view_icon_animation_callback(IconAnimation* instance, void* context) { } void view_unlock_model(View* view) { - furi_assert(view); + furi_check(view); if(view->model_type == ViewModelTypeLocking) { ViewModelLocking* model = (ViewModelLocking*)(view->model); furi_check(furi_mutex_release(model->mutex) == FuriStatusOk); @@ -139,7 +139,7 @@ void view_unlock_model(View* view) { } void view_draw(View* view, Canvas* canvas) { - furi_assert(view); + furi_check(view); if(view->draw_callback) { void* data = view_get_model(view); view->draw_callback(canvas, data); @@ -148,7 +148,7 @@ void view_draw(View* view, Canvas* canvas) { } bool view_input(View* view, InputEvent* event) { - furi_assert(view); + furi_check(view); if(view->input_callback) { return view->input_callback(event, view->context); } else { @@ -157,7 +157,7 @@ bool view_input(View* view, InputEvent* event) { } bool view_custom(View* view, uint32_t event) { - furi_assert(view); + furi_check(view); if(view->custom_callback) { return view->custom_callback(event, view->context); } else { @@ -166,7 +166,7 @@ bool view_custom(View* view, uint32_t event) { } uint32_t view_previous(View* view) { - furi_assert(view); + furi_check(view); if(view->previous_callback) { return view->previous_callback(view->context); } else { @@ -175,11 +175,11 @@ uint32_t view_previous(View* view) { } void view_enter(View* view) { - furi_assert(view); + furi_check(view); if(view->enter_callback) view->enter_callback(view->context); } void view_exit(View* view) { - furi_assert(view); + furi_check(view); if(view->exit_callback) view->exit_callback(view->context); } diff --git a/applications/services/gui/view.h b/applications/services/gui/view.h index eafe445fa18..1cae4cd6cc4 100644 --- a/applications/services/gui/view.h +++ b/applications/services/gui/view.h @@ -93,7 +93,7 @@ typedef enum { /** Allocate and init View * @return View instance */ -View* view_alloc(); +View* view_alloc(void); /** Free View * diff --git a/applications/services/gui/view_dispatcher.c b/applications/services/gui/view_dispatcher.c index 87b07a87c47..222ba817fd1 100644 --- a/applications/services/gui/view_dispatcher.c +++ b/applications/services/gui/view_dispatcher.c @@ -2,7 +2,7 @@ #define TAG "ViewDispatcher" -ViewDispatcher* view_dispatcher_alloc() { +ViewDispatcher* view_dispatcher_alloc(void) { ViewDispatcher* view_dispatcher = malloc(sizeof(ViewDispatcher)); view_dispatcher->view_port = view_port_alloc(); @@ -23,7 +23,7 @@ void view_dispatcher_free(ViewDispatcher* view_dispatcher) { gui_remove_view_port(view_dispatcher->gui, view_dispatcher->view_port); } // Crash if not all views were freed - furi_assert(!ViewDict_size(view_dispatcher->views)); + furi_check(!ViewDict_size(view_dispatcher->views)); ViewDict_clear(view_dispatcher->views); // Free ViewPort @@ -37,29 +37,29 @@ void view_dispatcher_free(ViewDispatcher* view_dispatcher) { } void view_dispatcher_enable_queue(ViewDispatcher* view_dispatcher) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->queue == NULL); + furi_check(view_dispatcher); + furi_check(view_dispatcher->queue == NULL); view_dispatcher->queue = furi_message_queue_alloc(16, sizeof(ViewDispatcherMessage)); } void view_dispatcher_set_event_callback_context(ViewDispatcher* view_dispatcher, void* context) { - furi_assert(view_dispatcher); + furi_check(view_dispatcher); view_dispatcher->event_context = context; } void view_dispatcher_set_navigation_event_callback( ViewDispatcher* view_dispatcher, ViewDispatcherNavigationEventCallback callback) { - furi_assert(view_dispatcher); - furi_assert(callback); + furi_check(view_dispatcher); + furi_check(callback); view_dispatcher->navigation_event_callback = callback; } void view_dispatcher_set_custom_event_callback( ViewDispatcher* view_dispatcher, ViewDispatcherCustomEventCallback callback) { - furi_assert(view_dispatcher); - furi_assert(callback); + furi_check(view_dispatcher); + furi_check(callback); view_dispatcher->custom_event_callback = callback; } @@ -67,15 +67,15 @@ void view_dispatcher_set_tick_event_callback( ViewDispatcher* view_dispatcher, ViewDispatcherTickEventCallback callback, uint32_t tick_period) { - furi_assert(view_dispatcher); - furi_assert(callback); + furi_check(view_dispatcher); + furi_check(callback); view_dispatcher->tick_event_callback = callback; view_dispatcher->tick_period = tick_period; } void view_dispatcher_run(ViewDispatcher* view_dispatcher) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->queue); + furi_check(view_dispatcher); + furi_check(view_dispatcher->queue); uint32_t tick_period = view_dispatcher->tick_period == 0 ? FuriWaitForever : view_dispatcher->tick_period; @@ -109,8 +109,8 @@ void view_dispatcher_run(ViewDispatcher* view_dispatcher) { } void view_dispatcher_stop(ViewDispatcher* view_dispatcher) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->queue); + furi_check(view_dispatcher); + furi_check(view_dispatcher->queue); ViewDispatcherMessage message; message.type = ViewDispatcherMessageTypeStop; furi_check( @@ -118,8 +118,8 @@ void view_dispatcher_stop(ViewDispatcher* view_dispatcher) { } void view_dispatcher_add_view(ViewDispatcher* view_dispatcher, uint32_t view_id, View* view) { - furi_assert(view_dispatcher); - furi_assert(view); + furi_check(view_dispatcher); + furi_check(view); // Check if view id is not used and register view furi_check(ViewDict_get(view_dispatcher->views, view_id) == NULL); @@ -139,7 +139,7 @@ void view_dispatcher_add_view(ViewDispatcher* view_dispatcher, uint32_t view_id, } void view_dispatcher_remove_view(ViewDispatcher* view_dispatcher, uint32_t view_id) { - furi_assert(view_dispatcher); + furi_check(view_dispatcher); // Lock gui if(view_dispatcher->gui) { @@ -169,7 +169,7 @@ void view_dispatcher_remove_view(ViewDispatcher* view_dispatcher, uint32_t view_ } void view_dispatcher_switch_to_view(ViewDispatcher* view_dispatcher, uint32_t view_id) { - furi_assert(view_dispatcher); + furi_check(view_dispatcher); if(view_id == VIEW_NONE) { view_dispatcher_set_current_view(view_dispatcher, NULL); } else if(view_id == VIEW_IGNORE) { @@ -181,14 +181,14 @@ void view_dispatcher_switch_to_view(ViewDispatcher* view_dispatcher, uint32_t vi } void view_dispatcher_send_to_front(ViewDispatcher* view_dispatcher) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->gui); + furi_check(view_dispatcher); + furi_check(view_dispatcher->gui); gui_view_port_send_to_front(view_dispatcher->gui, view_dispatcher->view_port); } void view_dispatcher_send_to_back(ViewDispatcher* view_dispatcher) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->gui); + furi_check(view_dispatcher); + furi_check(view_dispatcher->gui); gui_view_port_send_to_back(view_dispatcher->gui, view_dispatcher->view_port); } @@ -196,9 +196,9 @@ void view_dispatcher_attach_to_gui( ViewDispatcher* view_dispatcher, Gui* gui, ViewDispatcherType type) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->gui == NULL); - furi_assert(gui); + furi_check(view_dispatcher); + furi_check(view_dispatcher->gui == NULL); + furi_check(gui); if(type == ViewDispatcherTypeDesktop) { gui_add_view_port(gui, view_dispatcher->view_port, GuiLayerDesktop); @@ -308,8 +308,8 @@ void view_dispatcher_handle_custom_event(ViewDispatcher* view_dispatcher, uint32 } void view_dispatcher_send_custom_event(ViewDispatcher* view_dispatcher, uint32_t event) { - furi_assert(view_dispatcher); - furi_assert(view_dispatcher->queue); + furi_check(view_dispatcher); + furi_check(view_dispatcher->queue); ViewDispatcherMessage message; message.type = ViewDispatcherMessageTypeCustomEvent; @@ -327,7 +327,7 @@ static const ViewPortOrientation view_dispatcher_view_port_orientation_table[] = }; void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* view) { - furi_assert(view_dispatcher); + furi_check(view_dispatcher); // Dispatch view exit event if(view_dispatcher->current_view) { view_exit(view_dispatcher->current_view); @@ -355,8 +355,8 @@ void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* vie } void view_dispatcher_update(View* view, void* context) { - furi_assert(view); - furi_assert(context); + furi_check(view); + furi_check(context); ViewDispatcher* view_dispatcher = context; diff --git a/applications/services/gui/view_dispatcher.h b/applications/services/gui/view_dispatcher.h index 67a3fc40ba5..80cd9cbb0f8 100644 --- a/applications/services/gui/view_dispatcher.h +++ b/applications/services/gui/view_dispatcher.h @@ -35,7 +35,7 @@ typedef void (*ViewDispatcherTickEventCallback)(void* context); * * @return pointer to ViewDispatcher instance */ -ViewDispatcher* view_dispatcher_alloc(); +ViewDispatcher* view_dispatcher_alloc(void); /** Free ViewDispatcher instance * diff --git a/applications/services/gui/view_holder.c b/applications/services/gui/view_holder.c index 7ab0a8e1a5f..d9b382c17b3 100644 --- a/applications/services/gui/view_holder.c +++ b/applications/services/gui/view_holder.c @@ -20,7 +20,7 @@ struct ViewHolder { static void view_holder_draw_callback(Canvas* canvas, void* context); static void view_holder_input_callback(InputEvent* event, void* context); -ViewHolder* view_holder_alloc() { +ViewHolder* view_holder_alloc(void) { ViewHolder* view_holder = malloc(sizeof(ViewHolder)); view_holder->view_port = view_port_alloc(); diff --git a/applications/services/gui/view_holder.h b/applications/services/gui/view_holder.h index 8e7db3b857f..e4646af9ca7 100644 --- a/applications/services/gui/view_holder.h +++ b/applications/services/gui/view_holder.h @@ -24,7 +24,7 @@ typedef void (*BackCallback)(void* back_context); * @brief Allocate ViewHolder * @return pointer to ViewHolder instance */ -ViewHolder* view_holder_alloc(); +ViewHolder* view_holder_alloc(void); /** * @brief Free ViewHolder and call Free callback diff --git a/applications/services/gui/view_port.c b/applications/services/gui/view_port.c index 25f670a7c15..7f1da3b700e 100644 --- a/applications/services/gui/view_port.c +++ b/applications/services/gui/view_port.c @@ -61,7 +61,7 @@ static const CanvasOrientation view_port_orientation_mapping[ViewPortOrientation // Remaps directional pad buttons on Flipper based on ViewPort orientation static void view_port_map_input(InputEvent* event, ViewPortOrientation orientation) { - furi_assert(orientation < ViewPortOrientationMAX && event->key < InputKeyMAX); + furi_check(orientation < ViewPortOrientationMAX && event->key < InputKeyMAX); if(event->sequence_source != INPUT_SEQUENCE_SOURCE_HARDWARE) { return; @@ -90,7 +90,7 @@ static void view_port_setup_canvas_orientation(const ViewPort* view_port, Canvas canvas_set_orientation(canvas, orientation); } -ViewPort* view_port_alloc() { +ViewPort* view_port_alloc(void) { ViewPort* view_port = malloc(sizeof(ViewPort)); view_port->orientation = ViewPortOrientationHorizontal; view_port->is_enabled = true; @@ -99,7 +99,7 @@ ViewPort* view_port_alloc() { } void view_port_free(ViewPort* view_port) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); furi_check(view_port->gui == NULL); furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); @@ -108,14 +108,14 @@ void view_port_free(ViewPort* view_port) { } void view_port_set_width(ViewPort* view_port, uint8_t width) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); view_port->width = width; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); } uint8_t view_port_get_width(const ViewPort* view_port) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); uint8_t width = view_port->width; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); @@ -123,14 +123,14 @@ uint8_t view_port_get_width(const ViewPort* view_port) { } void view_port_set_height(ViewPort* view_port, uint8_t height) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); view_port->height = height; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); } uint8_t view_port_get_height(const ViewPort* view_port) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); uint8_t height = view_port->height; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); @@ -138,7 +138,7 @@ uint8_t view_port_get_height(const ViewPort* view_port) { } void view_port_enabled_set(ViewPort* view_port, bool enabled) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); if(view_port->is_enabled != enabled) { view_port->is_enabled = enabled; @@ -148,7 +148,7 @@ void view_port_enabled_set(ViewPort* view_port, bool enabled) { } bool view_port_is_enabled(const ViewPort* view_port) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); bool is_enabled = view_port->is_enabled; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); @@ -156,7 +156,7 @@ bool view_port_is_enabled(const ViewPort* view_port) { } void view_port_draw_callback_set(ViewPort* view_port, ViewPortDrawCallback callback, void* context) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); view_port->draw_callback = callback; view_port->draw_callback_context = context; @@ -167,7 +167,7 @@ void view_port_input_callback_set( ViewPort* view_port, ViewPortInputCallback callback, void* context) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); view_port->input_callback = callback; view_port->input_callback_context = context; @@ -175,7 +175,7 @@ void view_port_input_callback_set( } void view_port_update(ViewPort* view_port) { - furi_assert(view_port); + furi_check(view_port); // We are not going to lockup system, but will notify you instead // Make sure that you don't call viewport methods inside of another mutex, especially one that is used in draw call @@ -188,15 +188,15 @@ void view_port_update(ViewPort* view_port) { } void view_port_gui_set(ViewPort* view_port, Gui* gui) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); view_port->gui = gui; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); } void view_port_draw(ViewPort* view_port, Canvas* canvas) { - furi_assert(view_port); - furi_assert(canvas); + furi_check(view_port); + furi_check(canvas); // We are not going to lockup system, but will notify you instead // Make sure that you don't call viewport methods inside of another mutex, especially one that is used in draw call @@ -215,8 +215,8 @@ void view_port_draw(ViewPort* view_port, Canvas* canvas) { } void view_port_input(ViewPort* view_port, InputEvent* event) { - furi_assert(view_port); - furi_assert(event); + furi_check(view_port); + furi_check(event); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); furi_check(view_port->gui); @@ -229,7 +229,7 @@ void view_port_input(ViewPort* view_port, InputEvent* event) { } void view_port_set_orientation(ViewPort* view_port, ViewPortOrientation orientation) { - furi_assert(view_port); + furi_check(view_port); furi_check(furi_mutex_acquire(view_port->mutex, FuriWaitForever) == FuriStatusOk); view_port->orientation = orientation; furi_check(furi_mutex_release(view_port->mutex) == FuriStatusOk); diff --git a/applications/services/gui/view_port.h b/applications/services/gui/view_port.h index 752fc46ba64..bdc8b263341 100644 --- a/applications/services/gui/view_port.h +++ b/applications/services/gui/view_port.h @@ -38,7 +38,7 @@ typedef void (*ViewPortInputCallback)(InputEvent* event, void* context); * * @return ViewPort instance */ -ViewPort* view_port_alloc(); +ViewPort* view_port_alloc(void); /** ViewPort deallocator * diff --git a/applications/services/input/input_cli.c b/applications/services/input/input_cli.c index f7e904b171a..8aa04d6bdbe 100644 --- a/applications/services/input/input_cli.c +++ b/applications/services/input/input_cli.c @@ -4,7 +4,7 @@ #include #include -static void input_cli_usage() { +static void input_cli_usage(void) { printf("Usage:\r\n"); printf("input \r\n"); printf("Cmd list:\r\n"); @@ -40,7 +40,7 @@ static void input_cli_dump(Cli* cli, FuriString* args, Input* input) { furi_message_queue_free(input_queue); } -static void input_cli_send_print_usage() { +static void input_cli_send_print_usage(void) { printf("Invalid arguments. Usage:\r\n"); printf("\tinput send \r\n"); printf("\t\t \t - one of 'up', 'down', 'left', 'right', 'back', 'ok'\r\n"); diff --git a/applications/services/loader/loader.c b/applications/services/loader/loader.c index 1520c1f3daa..5daf99d1de5 100644 --- a/applications/services/loader/loader.c +++ b/applications/services/loader/loader.c @@ -29,6 +29,9 @@ static const char* loader_find_external_application_by_name(const char* app_name LoaderStatus loader_start(Loader* loader, const char* name, const char* args, FuriString* error_message) { + furi_check(loader); + furi_check(name); + LoaderMessage message; LoaderMessageLoaderStatusResult result; @@ -40,10 +43,14 @@ LoaderStatus message.status_value = &result; furi_message_queue_put(loader->queue, &message, FuriWaitForever); api_lock_wait_unlock_and_free(message.api_lock); + return result.value; } LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const char* args) { + furi_check(loader); + furi_check(name); + FuriString* error_message = furi_string_alloc(); LoaderStatus status = loader_start(loader, name, args, error_message); @@ -85,6 +92,8 @@ LoaderStatus loader_start_with_gui_error(Loader* loader, const char* name, const } bool loader_lock(Loader* loader) { + furi_check(loader); + LoaderMessage message; LoaderMessageBoolResult result; message.type = LoaderMessageTypeLock; @@ -92,16 +101,22 @@ bool loader_lock(Loader* loader) { message.bool_value = &result; furi_message_queue_put(loader->queue, &message, FuriWaitForever); api_lock_wait_unlock_and_free(message.api_lock); + return result.value; } void loader_unlock(Loader* loader) { + furi_check(loader); + LoaderMessage message; message.type = LoaderMessageTypeUnlock; + furi_message_queue_put(loader->queue, &message, FuriWaitForever); } bool loader_is_locked(Loader* loader) { + furi_check(loader); + LoaderMessage message; LoaderMessageBoolResult result; message.type = LoaderMessageTypeIsLocked; @@ -109,17 +124,21 @@ bool loader_is_locked(Loader* loader) { message.bool_value = &result; furi_message_queue_put(loader->queue, &message, FuriWaitForever); api_lock_wait_unlock_and_free(message.api_lock); + return result.value; } void loader_show_menu(Loader* loader) { + furi_check(loader); + LoaderMessage message; message.type = LoaderMessageTypeShowMenu; + furi_message_queue_put(loader->queue, &message, FuriWaitForever); } FuriPubSub* loader_get_pubsub(Loader* loader) { - furi_assert(loader); + furi_check(loader); // it's safe to return pubsub without locking // because it's never freed and loader is never exited // also the loader instance cannot be obtained until the pubsub is created @@ -160,7 +179,7 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con // implementation -static Loader* loader_alloc() { +static Loader* loader_alloc(void) { Loader* loader = malloc(sizeof(Loader)); loader->pubsub = furi_pubsub_alloc(); loader->queue = furi_message_queue_alloc(1, sizeof(LoaderMessage)); diff --git a/applications/services/loader/loader_applications.c b/applications/services/loader/loader_applications.c index 235cf20ec01..d52aec097db 100644 --- a/applications/services/loader/loader_applications.c +++ b/applications/services/loader/loader_applications.c @@ -49,7 +49,7 @@ typedef struct { Loading* loading; } LoaderApplicationsApp; -static LoaderApplicationsApp* loader_applications_app_alloc() { +static LoaderApplicationsApp* loader_applications_app_alloc(void) { LoaderApplicationsApp* app = malloc(sizeof(LoaderApplicationsApp)); //-V799 app->file_path = furi_string_alloc_set(EXT_PATH("apps")); app->dialogs = furi_record_open(RECORD_DIALOGS); diff --git a/applications/services/loader/loader_cli.c b/applications/services/loader/loader_cli.c index 489a576e5c0..1fbd0035e79 100644 --- a/applications/services/loader/loader_cli.c +++ b/applications/services/loader/loader_cli.c @@ -4,7 +4,7 @@ #include #include "loader.h" -static void loader_cli_print_usage() { +static void loader_cli_print_usage(void) { printf("Usage:\r\n"); printf("loader \r\n"); printf("Cmd list:\r\n"); @@ -13,7 +13,7 @@ static void loader_cli_print_usage() { printf("\tinfo\t - Show loader state\r\n"); } -static void loader_cli_list() { +static void loader_cli_list(void) { printf("Apps:\r\n"); for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) { printf("\t%s\r\n", FLIPPER_APPS[i].name); @@ -96,7 +96,7 @@ static void loader_cli(Cli* cli, FuriString* args, void* context) { furi_record_close(RECORD_LOADER); } -void loader_on_system_start() { +void loader_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, RECORD_LOADER, CliCommandFlagParallelSafe, loader_cli, NULL); diff --git a/applications/services/locale/locale.c b/applications/services/locale/locale.c index 4f7eb90ecc9..f4ee9c63464 100644 --- a/applications/services/locale/locale.c +++ b/applications/services/locale/locale.c @@ -39,8 +39,8 @@ void locale_format_time( const DateTime* datetime, const LocaleTimeFormat format, const bool show_seconds) { - furi_assert(out_str); - furi_assert(datetime); + furi_check(out_str); + furi_check(datetime); uint8_t hours = datetime->hour; uint8_t am_pm = 0; @@ -72,9 +72,9 @@ void locale_format_date( const DateTime* datetime, const LocaleDateFormat format, const char* separator) { - furi_assert(out_str); - furi_assert(datetime); - furi_assert(separator); + furi_check(out_str); + furi_check(datetime); + furi_check(separator); if(format == LocaleDateFormatDMY) { furi_string_printf( diff --git a/applications/services/locale/locale.h b/applications/services/locale/locale.h index c4f8e78e5ae..0046302df38 100644 --- a/applications/services/locale/locale.h +++ b/applications/services/locale/locale.h @@ -28,7 +28,7 @@ typedef enum { * * @return The locale measurement units. */ -LocaleMeasurementUnits locale_get_measurement_unit(); +LocaleMeasurementUnits locale_get_measurement_unit(void); /** Set locale measurement units * @@ -56,7 +56,7 @@ float locale_celsius_to_fahrenheit(float temp_c); * * @return The locale time format. */ -LocaleTimeFormat locale_get_time_format(); +LocaleTimeFormat locale_get_time_format(void); /** Set Locale Time Format * diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 9baa738b79c..514a37f000b 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -163,7 +163,7 @@ static void notification_vibro_on(bool force) { } } -static void notification_vibro_off() { +static void notification_vibro_off(void) { furi_hal_vibro_on(false); } @@ -175,7 +175,7 @@ static void notification_sound_on(float freq, float volume, bool force) { } } -static void notification_sound_off() { +static void notification_sound_off(void) { if(furi_hal_speaker_is_mine()) { furi_hal_speaker_stop(); furi_hal_speaker_release(); @@ -516,7 +516,7 @@ static void input_event_callback(const void* value, void* context) { } // App alloc -static NotificationApp* notification_app_alloc() { +static NotificationApp* notification_app_alloc(void) { NotificationApp* app = malloc(sizeof(NotificationApp)); app->queue = furi_message_queue_alloc(8, sizeof(NotificationAppMessage)); app->display_timer = furi_timer_alloc(notification_display_timer, FuriTimerTypeOnce, app); diff --git a/applications/services/notification/notification_app_api.c b/applications/services/notification/notification_app_api.c index 9bc06b013b6..9c9a2680ead 100644 --- a/applications/services/notification/notification_app_api.c +++ b/applications/services/notification/notification_app_api.c @@ -5,18 +5,27 @@ #include "notification_app.h" void notification_message(NotificationApp* app, const NotificationSequence* sequence) { + furi_check(app); + furi_check(sequence); + 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); + furi_check(sequence); + 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); + furi_check(sequence); + NotificationAppMessage m = { .type = NotificationLayerMessage, .sequence = sequence, @@ -30,6 +39,9 @@ void notification_message_block(NotificationApp* app, const NotificationSequence void notification_internal_message_block( NotificationApp* app, const NotificationSequence* sequence) { + furi_check(app); + furi_check(sequence); + NotificationAppMessage m = { .type = InternalLayerMessage, .sequence = sequence, .back_event = furi_event_flag_alloc()}; furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk); diff --git a/applications/services/power/power_cli.c b/applications/services/power/power_cli.c index 021ce35536c..6e1e34e67ee 100644 --- a/applications/services/power/power_cli.c +++ b/applications/services/power/power_cli.c @@ -48,7 +48,7 @@ void power_cli_3v3(Cli* cli, FuriString* args) { } } -static void power_cli_command_print_usage() { +static void power_cli_command_print_usage(void) { printf("Usage:\r\n"); printf("power \r\n"); printf("Cmd list:\r\n"); @@ -106,7 +106,7 @@ void power_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void power_on_system_start() { +void power_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); diff --git a/applications/services/power/power_cli.h b/applications/services/power/power_cli.h index 1517c61409f..4056c8300cb 100644 --- a/applications/services/power/power_cli.h +++ b/applications/services/power/power_cli.h @@ -4,7 +4,7 @@ extern "C" { #endif -void power_on_system_start(); +void power_on_system_start(void); #ifdef __cplusplus } diff --git a/applications/services/power/power_service/power.c b/applications/services/power/power_service/power.c index ad3a5114dca..2db9bb1c33c 100644 --- a/applications/services/power/power_service/power.c +++ b/applications/services/power/power_service/power.c @@ -49,7 +49,7 @@ static ViewPort* power_battery_view_port_alloc(Power* power) { return battery_view_port; } -Power* power_alloc() { +Power* power_alloc(void) { Power* power = malloc(sizeof(Power)); // Records diff --git a/applications/services/power/power_service/power_api.c b/applications/services/power/power_service/power_api.c index 8185b7cd528..1bb482bf52d 100644 --- a/applications/services/power/power_service/power_api.c +++ b/applications/services/power/power_service/power_api.c @@ -5,6 +5,8 @@ #include void power_off(Power* power) { + furi_check(power); + furi_hal_power_off(); // Notify user if USB is plugged view_dispatcher_send_to_front(power->view_dispatcher); @@ -20,13 +22,16 @@ void power_reboot(PowerBootMode mode) { furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeDfu); } else if(mode == PowerBootModeUpdateStart) { furi_hal_rtc_set_boot_mode(FuriHalRtcBootModePreUpdate); + } else { + furi_crash(); } + furi_hal_power_reset(); } void power_get_info(Power* power, PowerInfo* info) { - furi_assert(power); - furi_assert(info); + furi_check(power); + furi_check(info); furi_mutex_acquire(power->api_mtx, FuriWaitForever); memcpy(info, &power->info, sizeof(power->info)); @@ -34,12 +39,12 @@ void power_get_info(Power* power, PowerInfo* info) { } FuriPubSub* power_get_pubsub(Power* power) { - furi_assert(power); + furi_check(power); return power->event_pubsub; } bool power_is_battery_healthy(Power* power) { - furi_assert(power); + furi_check(power); bool is_healthy = false; furi_mutex_acquire(power->api_mtx, FuriWaitForever); is_healthy = power->info.health > POWER_BATTERY_HEALTHY_LEVEL; @@ -48,7 +53,7 @@ bool power_is_battery_healthy(Power* power) { } void power_enable_low_battery_level_notification(Power* power, bool enable) { - furi_assert(power); + furi_check(power); furi_mutex_acquire(power->api_mtx, FuriWaitForever); power->show_low_bat_level_message = enable; furi_mutex_release(power->api_mtx); diff --git a/applications/services/power/power_service/views/power_off.c b/applications/services/power/power_service/views/power_off.c index 3a1addbac70..4da374b31aa 100644 --- a/applications/services/power/power_service/views/power_off.c +++ b/applications/services/power/power_service/views/power_off.c @@ -62,7 +62,7 @@ static bool power_off_input_callback(InputEvent* event, void* context) { return true; } -PowerOff* power_off_alloc() { +PowerOff* power_off_alloc(void) { PowerOff* power_off = malloc(sizeof(PowerOff)); power_off->view = view_alloc(); diff --git a/applications/services/power/power_service/views/power_off.h b/applications/services/power/power_service/views/power_off.h index 5137c2e997d..df021fad895 100644 --- a/applications/services/power/power_service/views/power_off.h +++ b/applications/services/power/power_service/views/power_off.h @@ -11,7 +11,7 @@ typedef enum { #include -PowerOff* power_off_alloc(); +PowerOff* power_off_alloc(void); void power_off_free(PowerOff* power_off); diff --git a/applications/services/power/power_service/views/power_unplug_usb.c b/applications/services/power/power_service/views/power_unplug_usb.c index c2d61139e4b..da230d892e2 100644 --- a/applications/services/power/power_service/views/power_unplug_usb.c +++ b/applications/services/power/power_service/views/power_unplug_usb.c @@ -21,7 +21,7 @@ static void power_unplug_usb_draw_callback(Canvas* canvas, void* _model) { canvas, 64, 32, AlignCenter, AlignCenter, "It's now safe to unplug\nthe USB cable"); } -PowerUnplugUsb* power_unplug_usb_alloc() { +PowerUnplugUsb* power_unplug_usb_alloc(void) { PowerUnplugUsb* power_unplug_usb = malloc(sizeof(PowerUnplugUsb)); power_unplug_usb->view = view_alloc(); diff --git a/applications/services/power/power_service/views/power_unplug_usb.h b/applications/services/power/power_service/views/power_unplug_usb.h index e85c6d03b9a..a763cf87cff 100644 --- a/applications/services/power/power_service/views/power_unplug_usb.h +++ b/applications/services/power/power_service/views/power_unplug_usb.h @@ -4,7 +4,7 @@ typedef struct PowerUnplugUsb PowerUnplugUsb; #include -PowerUnplugUsb* power_unplug_usb_alloc(); +PowerUnplugUsb* power_unplug_usb_alloc(void); void power_unplug_usb_free(PowerUnplugUsb* power_unplug_usb); diff --git a/applications/services/rpc/rpc.c b/applications/services/rpc/rpc.c index 53b139dd490..b2700c713e4 100644 --- a/applications/services/rpc/rpc.c +++ b/applications/services/rpc/rpc.c @@ -91,7 +91,7 @@ struct Rpc { }; RpcOwner rpc_session_get_owner(RpcSession* session) { - furi_assert(session); + furi_check(session); return session->owner; } @@ -112,7 +112,7 @@ static void rpc_close_session_process(const PB_Main* request, void* context) { } void rpc_session_set_context(RpcSession* session, void* context) { - furi_assert(session); + furi_check(session); furi_mutex_acquire(session->callbacks_mutex, FuriWaitForever); session->context = context; @@ -120,7 +120,7 @@ void rpc_session_set_context(RpcSession* session, void* context) { } void rpc_session_set_close_callback(RpcSession* session, RpcSessionClosedCallback callback) { - furi_assert(session); + furi_check(session); furi_mutex_acquire(session->callbacks_mutex, FuriWaitForever); session->closed_callback = callback; @@ -128,7 +128,7 @@ void rpc_session_set_close_callback(RpcSession* session, RpcSessionClosedCallbac } void rpc_session_set_send_bytes_callback(RpcSession* session, RpcSendBytesCallback callback) { - furi_assert(session); + furi_check(session); furi_mutex_acquire(session->callbacks_mutex, FuriWaitForever); session->send_bytes_callback = callback; @@ -138,7 +138,7 @@ void rpc_session_set_send_bytes_callback(RpcSession* session, RpcSendBytesCallba void rpc_session_set_buffer_is_empty_callback( RpcSession* session, RpcBufferIsEmptyCallback callback) { - furi_assert(session); + furi_check(session); furi_mutex_acquire(session->callbacks_mutex, FuriWaitForever); session->buffer_is_empty_callback = callback; @@ -148,7 +148,7 @@ void rpc_session_set_buffer_is_empty_callback( void rpc_session_set_terminated_callback( RpcSession* session, RpcSessionTerminatedCallback callback) { - furi_assert(session); + furi_check(session); furi_mutex_acquire(session->callbacks_mutex, FuriWaitForever); session->terminated_callback = callback; @@ -166,8 +166,8 @@ size_t rpc_session_feed( const uint8_t* encoded_bytes, size_t size, uint32_t timeout) { - furi_assert(session); - furi_assert(encoded_bytes); + furi_check(session); + furi_check(encoded_bytes); if(!size) return 0; @@ -179,7 +179,7 @@ size_t rpc_session_feed( } size_t rpc_session_get_available_size(RpcSession* session) { - furi_assert(session); + furi_check(session); return furi_stream_buffer_spaces_available(session->stream); } @@ -383,7 +383,7 @@ static void rpc_session_thread_state_callback(FuriThreadState thread_state, void } RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner) { - furi_assert(rpc); + furi_check(rpc); RpcSession* session = malloc(sizeof(RpcSession)); session->callbacks_mutex = furi_mutex_alloc(FuriMutexTypeNormal); @@ -421,8 +421,8 @@ RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner) { } void rpc_session_close(RpcSession* session) { - furi_assert(session); - furi_assert(session->rpc); + furi_check(session); + furi_check(session->rpc); rpc_session_set_send_bytes_callback(session, NULL); rpc_session_set_close_callback(session, NULL); diff --git a/applications/services/rpc/rpc_app.c b/applications/services/rpc/rpc_app.c index 9af652dae17..aa2a3f64fd6 100644 --- a/applications/services/rpc/rpc_app.c +++ b/applications/services/rpc/rpc_app.c @@ -314,20 +314,20 @@ static void rpc_system_app_data_exchange_process(const PB_Main* request, void* c } void rpc_system_app_send_started(RpcAppSystem* rpc_app) { - furi_assert(rpc_app); + furi_check(rpc_app); rpc_system_app_send_state_response(rpc_app, PB_App_AppState_APP_STARTED, "SendStarted"); } void rpc_system_app_send_exited(RpcAppSystem* rpc_app) { - furi_assert(rpc_app); + furi_check(rpc_app); rpc_system_app_send_state_response(rpc_app, PB_App_AppState_APP_CLOSED, "SendExit"); } void rpc_system_app_confirm(RpcAppSystem* rpc_app, bool result) { - furi_assert(rpc_app); - furi_assert(rpc_app->last_command_id != 0); + furi_check(rpc_app); + furi_check(rpc_app->last_command_id != 0); /* Ensure that only commands of these types can be confirmed */ - furi_assert( + furi_check( rpc_app->last_event_type == RpcAppEventTypeAppExit || rpc_app->last_event_type == RpcAppEventTypeLoadFile || rpc_app->last_event_type == RpcAppEventTypeButtonPress || @@ -353,19 +353,19 @@ void rpc_system_app_confirm(RpcAppSystem* rpc_app, bool result) { } void rpc_system_app_set_callback(RpcAppSystem* rpc_app, RpcAppSystemCallback callback, void* ctx) { - furi_assert(rpc_app); + furi_check(rpc_app); rpc_app->callback = callback; rpc_app->callback_context = ctx; } void rpc_system_app_set_error_code(RpcAppSystem* rpc_app, uint32_t error_code) { - furi_assert(rpc_app); + furi_check(rpc_app); rpc_app->error_code = error_code; } void rpc_system_app_set_error_text(RpcAppSystem* rpc_app, const char* error_text) { - furi_assert(rpc_app); + furi_check(rpc_app); if(rpc_app->error_text) { free(rpc_app->error_text); @@ -375,14 +375,14 @@ void rpc_system_app_set_error_text(RpcAppSystem* rpc_app, const char* error_text } void rpc_system_app_error_reset(RpcAppSystem* rpc_app) { - furi_assert(rpc_app); + furi_check(rpc_app); rpc_system_app_set_error_code(rpc_app, 0); rpc_system_app_set_error_text(rpc_app, NULL); } void rpc_system_app_exchange_data(RpcAppSystem* rpc_app, const uint8_t* data, size_t data_size) { - furi_assert(rpc_app); + furi_check(rpc_app); PB_Main* request = malloc(sizeof(PB_Main)); diff --git a/applications/services/storage/filesystem_api.c b/applications/services/storage/filesystem_api.c index 30b20ede4d7..e6012864d43 100644 --- a/applications/services/storage/filesystem_api.c +++ b/applications/services/storage/filesystem_api.c @@ -1,4 +1,5 @@ #include "filesystem_api_defines.h" +#include const char* filesystem_api_error_get_desc(FS_Error error_id) { const char* result = "unknown error"; @@ -38,5 +39,6 @@ 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 diff --git a/applications/services/storage/storage.c b/applications/services/storage/storage.c index a6229af8191..f43c6e81517 100644 --- a/applications/services/storage/storage.c +++ b/applications/services/storage/storage.c @@ -32,7 +32,7 @@ static void storage_app_sd_icon_draw_callback(Canvas* canvas, void* context) { } } -Storage* storage_app_alloc() { +Storage* storage_app_alloc(void) { Storage* app = malloc(sizeof(Storage)); app->message_queue = furi_message_queue_alloc(8, sizeof(StorageMessage)); app->pubsub = furi_pubsub_alloc(); diff --git a/applications/services/storage/storage_cli.c b/applications/services/storage/storage_cli.c index 52c911c5783..67a7e288b80 100644 --- a/applications/services/storage/storage_cli.c +++ b/applications/services/storage/storage_cli.c @@ -11,7 +11,7 @@ #define MAX_NAME_LENGTH 255 -static void storage_cli_print_usage() { +static void storage_cli_print_usage(void) { printf("Usage:\r\n"); printf("storage \r\n"); printf("The path must start with /int or /ext\r\n"); @@ -611,7 +611,7 @@ static void storage_cli_factory_reset(Cli* cli, FuriString* args, void* context) } } -void storage_on_system_start() { +void storage_on_system_start(void) { #ifdef SRV_CLI Cli* cli = furi_record_open(RECORD_CLI); cli_add_command(cli, RECORD_STORAGE, CliCommandFlagParallelSafe, storage_cli, NULL); diff --git a/applications/services/storage/storage_external_api.c b/applications/services/storage/storage_external_api.c index 666090346a0..a377751ea1e 100644 --- a/applications/services/storage/storage_external_api.c +++ b/applications/services/storage/storage_external_api.c @@ -16,8 +16,9 @@ #define S_API_PROLOGUE FuriApiLock lock = api_lock_alloc_locked(); #define S_FILE_API_PROLOGUE \ + furi_check(file); \ Storage* storage = file->storage; \ - furi_assert(storage); + furi_check(storage); #define S_API_EPILOGUE \ furi_check( \ @@ -92,6 +93,8 @@ bool storage_file_open( const char* path, FS_AccessMode access_mode, FS_OpenMode open_mode) { + furi_check(file); + bool result; FuriEventFlag* event = furi_event_flag_alloc(); FuriPubSubSubscription* subscription = furi_pubsub_subscribe( @@ -198,6 +201,8 @@ size_t storage_file_read(File* file, void* buff, size_t to_read) { } size_t storage_file_write(File* file, const void* buff, size_t to_write) { + furi_check(file); + size_t total = 0; const size_t max_chunk = UINT16_MAX; @@ -276,6 +281,8 @@ bool storage_file_eof(File* file) { } bool storage_file_exists(Storage* storage, const char* path) { + furi_check(storage); + bool exist = false; FileInfo fileinfo; FS_Error error = storage_common_stat(storage, path, &fileinfo); @@ -288,6 +295,9 @@ bool storage_file_exists(Storage* storage, const char* path) { } bool storage_file_copy_to_file(File* source, File* destination, size_t size) { + furi_check(source); + furi_check(destination); + uint8_t* buffer = malloc(FILE_BUFFER_SIZE); while(size) { @@ -328,6 +338,8 @@ static bool storage_dir_open_internal(File* file, const char* path) { } bool storage_dir_open(File* file, const char* path) { + furi_check(file); + bool result; FuriEventFlag* event = furi_event_flag_alloc(); FuriPubSubSubscription* subscription = furi_pubsub_subscribe( @@ -402,6 +414,8 @@ bool storage_dir_rewind(File* file) { } bool storage_dir_exists(Storage* storage, const char* path) { + furi_check(storage); + bool exist = false; FileInfo fileinfo; FS_Error error = storage_common_stat(storage, path, &fileinfo); @@ -415,6 +429,7 @@ bool storage_dir_exists(Storage* storage, const char* path) { /****************** COMMON ******************/ FS_Error storage_common_timestamp(Storage* storage, const char* path, uint32_t* timestamp) { + furi_check(storage); S_API_PROLOGUE; SAData data = { @@ -430,6 +445,8 @@ FS_Error storage_common_timestamp(Storage* storage, const char* path, uint32_t* } FS_Error storage_common_stat(Storage* storage, const char* path, FileInfo* fileinfo) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { .cstat = { @@ -444,6 +461,8 @@ FS_Error storage_common_stat(Storage* storage, const char* path, FileInfo* filei } FS_Error storage_common_remove(Storage* storage, const char* path) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { .path = { @@ -457,6 +476,7 @@ FS_Error storage_common_remove(Storage* storage, const char* path) { } FS_Error storage_common_rename(Storage* storage, const char* old_path, const char* new_path) { + furi_check(storage); FS_Error error; do { @@ -557,6 +577,8 @@ static FS_Error } FS_Error storage_common_copy(Storage* storage, const char* old_path, const char* new_path) { + furi_check(storage); + FS_Error error; FileInfo fileinfo; @@ -650,6 +672,8 @@ static FS_Error } FS_Error storage_common_merge(Storage* storage, const char* old_path, const char* new_path) { + furi_check(storage); + FS_Error error; const char* new_path_tmp = NULL; FuriString* new_path_next = NULL; @@ -718,6 +742,8 @@ FS_Error storage_common_merge(Storage* storage, const char* old_path, const char } FS_Error storage_common_mkdir(Storage* storage, const char* path) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { .path = { @@ -735,6 +761,8 @@ FS_Error storage_common_fs_info( const char* fs_path, uint64_t* total_space, uint64_t* free_space) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { @@ -751,6 +779,8 @@ FS_Error storage_common_fs_info( } void storage_common_resolve_path_and_ensure_app_directory(Storage* storage, FuriString* path) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { @@ -764,6 +794,8 @@ void storage_common_resolve_path_and_ensure_app_directory(Storage* storage, Furi } FS_Error storage_common_migrate(Storage* storage, const char* source, const char* dest) { + furi_check(storage); + if(!storage_common_exists(storage, source)) { return FSE_OK; } @@ -778,6 +810,8 @@ FS_Error storage_common_migrate(Storage* storage, const char* source, const char } bool storage_common_exists(Storage* storage, const char* path) { + furi_check(storage); + FileInfo file_info; return storage_common_stat(storage, path, &file_info) == FSE_OK; } @@ -787,6 +821,8 @@ bool storage_common_equivalent_path( const char* path1, const char* path2, bool truncate) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { @@ -810,23 +846,25 @@ const char* storage_error_get_desc(FS_Error error_id) { } FS_Error storage_file_get_error(File* file) { - furi_check(file != NULL); + furi_check(file); return file->error_id; } int32_t storage_file_get_internal_error(File* file) { - furi_check(file != NULL); + furi_check(file); return file->internal_error_id; } const char* storage_file_get_error_desc(File* file) { - furi_check(file != NULL); + furi_check(file); return filesystem_api_error_get_desc(file->error_id); } /****************** Raw SD API ******************/ FS_Error storage_sd_format(Storage* storage) { + furi_check(storage); + S_API_PROLOGUE; SAData data = {}; S_API_MESSAGE(StorageCommandSDFormat); @@ -835,6 +873,8 @@ FS_Error storage_sd_format(Storage* storage) { } FS_Error storage_sd_unmount(Storage* storage) { + furi_check(storage); + S_API_PROLOGUE; SAData data = {}; S_API_MESSAGE(StorageCommandSDUnmount); @@ -843,6 +883,8 @@ FS_Error storage_sd_unmount(Storage* storage) { } FS_Error storage_sd_mount(Storage* storage) { + furi_check(storage); + S_API_PROLOGUE; SAData data = {}; S_API_MESSAGE(StorageCommandSDMount); @@ -851,6 +893,8 @@ FS_Error storage_sd_mount(Storage* storage) { } FS_Error storage_sd_info(Storage* storage, SDInfo* info) { + furi_check(storage); + S_API_PROLOGUE; SAData data = { .sdinfo = { @@ -862,6 +906,8 @@ FS_Error storage_sd_info(Storage* storage, SDInfo* info) { } FS_Error storage_sd_status(Storage* storage) { + furi_check(storage); + S_API_PROLOGUE; SAData data = {}; S_API_MESSAGE(StorageCommandSDStatus); @@ -870,6 +916,8 @@ FS_Error storage_sd_status(Storage* storage) { } File* storage_file_alloc(Storage* storage) { + furi_check(storage); + File* file = malloc(sizeof(File)); file->type = FileTypeClosed; file->storage = storage; @@ -880,14 +928,18 @@ File* storage_file_alloc(Storage* storage) { } bool storage_file_is_open(File* file) { + furi_check(file); return (file->type != FileTypeClosed); } bool storage_file_is_dir(File* file) { + furi_check(file); return (file->type == FileTypeOpenDir); } void storage_file_free(File* file) { + furi_check(file); + if(storage_file_is_open(file)) { if(storage_file_is_dir(file)) { storage_dir_close(file); @@ -901,13 +953,13 @@ void storage_file_free(File* file) { } FuriPubSub* storage_get_pubsub(Storage* storage) { - furi_assert(storage); + furi_check(storage); return storage->pubsub; } bool storage_simply_remove_recursive(Storage* storage, const char* path) { - furi_assert(storage); - furi_assert(path); + furi_check(storage); + furi_check(path); FileInfo fileinfo; bool result = false; FuriString* fullname; @@ -967,12 +1019,16 @@ bool storage_simply_remove_recursive(Storage* storage, const char* path) { } //-V773 bool storage_simply_remove(Storage* storage, const char* path) { + furi_check(storage); + FS_Error result; result = storage_common_remove(storage, path); return result == FSE_OK || result == FSE_NOT_EXIST; } bool storage_simply_mkdir(Storage* storage, const char* path) { + furi_check(storage); + FS_Error result; result = storage_common_mkdir(storage, path); return result == FSE_OK || result == FSE_EXIST; @@ -985,6 +1041,8 @@ void storage_get_next_filename( const char* fileextension, FuriString* nextfilename, uint8_t max_len) { + furi_check(storage); + FuriString* temp_str; uint16_t num = 0; diff --git a/applications/services/storage/storage_internal_api.c b/applications/services/storage/storage_internal_api.c index d91c71c0ec9..37ea4a2a513 100644 --- a/applications/services/storage/storage_internal_api.c +++ b/applications/services/storage/storage_internal_api.c @@ -3,6 +3,8 @@ #include FS_Error storage_int_backup(Storage* storage, const char* dstname) { + furi_check(storage); + TarArchive* archive = tar_archive_alloc(storage); bool success = tar_archive_open(archive, dstname, TAR_OPEN_MODE_WRITE) && tar_archive_add_dir(archive, STORAGE_INT_PATH_PREFIX, "") && @@ -13,6 +15,8 @@ FS_Error storage_int_backup(Storage* storage, const char* dstname) { FS_Error storage_int_restore(Storage* storage, const char* srcname, Storage_name_converter converter) { + furi_check(storage); + TarArchive* archive = tar_archive_alloc(storage); bool success = tar_archive_open(archive, srcname, TAR_OPEN_MODE_READ) && tar_archive_unpack_to(archive, STORAGE_INT_PATH_PREFIX, converter); diff --git a/applications/services/storage/storages/storage_int.c b/applications/services/storage/storages/storage_int.c index ea6fa68efae..8c3827fe5da 100644 --- a/applications/services/storage/storages/storage_int.c +++ b/applications/services/storage/storages/storage_int.c @@ -23,13 +23,13 @@ typedef struct { bool open; } LFSHandle; -static LFSHandle* lfs_handle_alloc_file() { +static LFSHandle* lfs_handle_alloc_file(void) { LFSHandle* handle = malloc(sizeof(LFSHandle)); handle->data = malloc(sizeof(lfs_file_t)); return handle; } -static LFSHandle* lfs_handle_alloc_dir() { +static LFSHandle* lfs_handle_alloc_dir(void) { LFSHandle* handle = malloc(sizeof(LFSHandle)); handle->data = malloc(sizeof(lfs_dir_t)); return handle; @@ -134,7 +134,7 @@ static int storage_int_device_sync(const struct lfs_config* c) { return 0; } -static LFSData* storage_int_lfs_data_alloc() { +static LFSData* storage_int_lfs_data_alloc(void) { LFSData* lfs_data = malloc(sizeof(LFSData)); // Internal storage start address diff --git a/applications/settings/bt_settings_app/bt_settings_app.c b/applications/settings/bt_settings_app/bt_settings_app.c index f211c712865..d86c9df6478 100644 --- a/applications/settings/bt_settings_app/bt_settings_app.c +++ b/applications/settings/bt_settings_app/bt_settings_app.c @@ -12,7 +12,7 @@ static bool bt_settings_back_event_callback(void* context) { return scene_manager_handle_back_event(app->scene_manager); } -BtSettingsApp* bt_settings_app_alloc() { +BtSettingsApp* bt_settings_app_alloc(void) { BtSettingsApp* app = malloc(sizeof(BtSettingsApp)); // Load settings diff --git a/applications/settings/desktop_settings/desktop_settings_app.c b/applications/settings/desktop_settings/desktop_settings_app.c index afb5d59ec69..b030656f7fc 100644 --- a/applications/settings/desktop_settings/desktop_settings_app.c +++ b/applications/settings/desktop_settings/desktop_settings_app.c @@ -18,7 +18,7 @@ static bool desktop_settings_back_event_callback(void* context) { return scene_manager_handle_back_event(app->scene_manager); } -DesktopSettingsApp* desktop_settings_app_alloc() { +DesktopSettingsApp* desktop_settings_app_alloc(void) { DesktopSettingsApp* app = malloc(sizeof(DesktopSettingsApp)); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c index 26aa7c3e15a..537acb8d59f 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c @@ -54,7 +54,7 @@ void desktop_settings_view_pin_setup_howto_set_callback( instance->context = context; } -DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc() { +DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc(void) { DesktopSettingsViewPinSetupHowto* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto)); view->view = view_alloc(); view_set_context(view->view, view); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.h b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.h index 0f62cb433a3..8a62018de4e 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.h +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.h @@ -10,6 +10,6 @@ void desktop_settings_view_pin_setup_howto_set_callback( DesktopSettingsViewPinSetupHowto* instance, DesktopSettingsViewPinSetupHowtoDoneCallback callback, void* context); -DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc(); +DesktopSettingsViewPinSetupHowto* desktop_settings_view_pin_setup_howto_alloc(void); void desktop_settings_view_pin_setup_howto_free(DesktopSettingsViewPinSetupHowto* instance); View* desktop_settings_view_pin_setup_howto_get_view(DesktopSettingsViewPinSetupHowto* instance); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c index c28826e628a..b09b0b95f19 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.c @@ -76,7 +76,7 @@ void desktop_settings_view_pin_setup_howto2_set_ok_callback( instance->ok_callback = callback; } -DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc() { +DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc(void) { DesktopSettingsViewPinSetupHowto2* view = malloc(sizeof(DesktopSettingsViewPinSetupHowto2)); view->view = view_alloc(); view_set_context(view->view, view); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.h b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.h index 8e3018d9809..760e7bae1c7 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.h +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto2.h @@ -6,7 +6,7 @@ typedef struct DesktopSettingsViewPinSetupHowto2 DesktopSettingsViewPinSetupHowt typedef void (*DesktopSettingsViewPinSetupHowto2Callback)(void*); -DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc(); +DesktopSettingsViewPinSetupHowto2* desktop_settings_view_pin_setup_howto2_alloc(void); void desktop_settings_view_pin_setup_howto2_free(DesktopSettingsViewPinSetupHowto2* instance); View* desktop_settings_view_pin_setup_howto2_get_view(DesktopSettingsViewPinSetupHowto2* instance); void desktop_settings_view_pin_setup_howto2_set_context( diff --git a/applications/settings/expansion_settings_app/expansion_settings_app.c b/applications/settings/expansion_settings_app/expansion_settings_app.c index 05e5f22e428..2b8208cabbf 100644 --- a/applications/settings/expansion_settings_app/expansion_settings_app.c +++ b/applications/settings/expansion_settings_app/expansion_settings_app.c @@ -24,7 +24,7 @@ static uint32_t expansion_settings_app_exit(void* context) { return VIEW_NONE; } -static ExpansionSettingsApp* expansion_settings_app_alloc() { +static ExpansionSettingsApp* expansion_settings_app_alloc(void) { ExpansionSettingsApp* app = malloc(sizeof(ExpansionSettingsApp)); if(!expansion_settings_load(&app->settings)) { diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c index 450aaee144f..2a7aa97e600 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -161,7 +161,7 @@ static uint32_t notification_app_settings_exit(void* context) { return VIEW_NONE; } -static NotificationAppSettings* alloc_settings() { +static NotificationAppSettings* alloc_settings(void) { NotificationAppSettings* app = malloc(sizeof(NotificationAppSettings)); app->notification = furi_record_open(RECORD_NOTIFICATION); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/settings/power_settings_app/views/battery_info.c b/applications/settings/power_settings_app/views/battery_info.c index 8add60db5ab..dd2ec2dbc99 100644 --- a/applications/settings/power_settings_app/views/battery_info.c +++ b/applications/settings/power_settings_app/views/battery_info.c @@ -127,7 +127,7 @@ static void battery_info_draw_callback(Canvas* canvas, void* context) { draw_stat(canvas, 104, 42, &I_Health_16x16, health); } -BatteryInfo* battery_info_alloc() { +BatteryInfo* battery_info_alloc(void) { BatteryInfo* battery_info = malloc(sizeof(BatteryInfo)); battery_info->view = view_alloc(); view_set_context(battery_info->view, battery_info); diff --git a/applications/settings/power_settings_app/views/battery_info.h b/applications/settings/power_settings_app/views/battery_info.h index e52d1844c8d..97130cb46ae 100644 --- a/applications/settings/power_settings_app/views/battery_info.h +++ b/applications/settings/power_settings_app/views/battery_info.h @@ -14,7 +14,7 @@ typedef struct { uint8_t health; } BatteryInfoModel; -BatteryInfo* battery_info_alloc(); +BatteryInfo* battery_info_alloc(void); void battery_info_free(BatteryInfo* battery_info); diff --git a/applications/settings/storage_settings/storage_settings.c b/applications/settings/storage_settings/storage_settings.c index 77a8f0f2269..0508e8e0faf 100644 --- a/applications/settings/storage_settings/storage_settings.c +++ b/applications/settings/storage_settings/storage_settings.c @@ -12,7 +12,7 @@ static bool storage_settings_back_event_callback(void* context) { return scene_manager_handle_back_event(app->scene_manager); } -static StorageSettings* storage_settings_alloc() { +static StorageSettings* storage_settings_alloc(void) { StorageSettings* app = malloc(sizeof(StorageSettings)); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/settings/system/system_settings.c b/applications/settings/system/system_settings.c index 832bc126c57..73969de31ec 100644 --- a/applications/settings/system/system_settings.c +++ b/applications/settings/system/system_settings.c @@ -213,7 +213,7 @@ static uint32_t system_settings_exit(void* context) { return VIEW_NONE; } -SystemSettings* system_settings_alloc() { +SystemSettings* system_settings_alloc(void) { SystemSettings* app = malloc(sizeof(SystemSettings)); // Load settings diff --git a/applications/system/hid_app/hid.c b/applications/system/hid_app/hid.c index b712027e2c6..fcb99ec71c0 100644 --- a/applications/system/hid_app/hid.c +++ b/applications/system/hid_app/hid.c @@ -107,7 +107,7 @@ static uint32_t hid_exit(void* context) { return VIEW_NONE; } -Hid* hid_alloc() { +Hid* hid_alloc(void) { Hid* app = malloc(sizeof(Hid)); // Gui diff --git a/applications/system/hid_app/views/hid_media.h b/applications/system/hid_app/views/hid_media.h index 4aa51dc173b..2356734b3e5 100644 --- a/applications/system/hid_app/views/hid_media.h +++ b/applications/system/hid_app/views/hid_media.h @@ -2,9 +2,11 @@ #include +typedef struct Hid Hid; + typedef struct HidMedia HidMedia; -HidMedia* hid_media_alloc(); +HidMedia* hid_media_alloc(Hid* hid); void hid_media_free(HidMedia* hid_media); 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 5d1e694bca4..12a77eafadd 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 @@ -101,7 +101,7 @@ static void storage_move_to_sd_unmount_callback(const void* message, void* conte } } -static StorageMoveToSd* storage_move_to_sd_alloc() { +static StorageMoveToSd* storage_move_to_sd_alloc(void) { StorageMoveToSd* app = malloc(sizeof(StorageMoveToSd)); app->gui = furi_record_open(RECORD_GUI); diff --git a/applications/system/updater/cli/updater_cli.c b/applications/system/updater/cli/updater_cli.c index cebdc4d7cab..0b734c0f497 100644 --- a/applications/system/updater/cli/updater_cli.c +++ b/applications/system/updater/cli/updater_cli.c @@ -103,7 +103,7 @@ static void updater_start_app(void* context, uint32_t arg) { furi_record_close(RECORD_LOADER); } -void updater_on_system_start() { +void updater_on_system_start(void) { #ifdef SRV_CLI Cli* cli = (Cli*)furi_record_open(RECORD_CLI); cli_add_command(cli, "update", CliCommandFlagDefault, updater_cli_ep, NULL); diff --git a/applications/system/updater/scenes/updater_scene_main.c b/applications/system/updater/scenes/updater_scene_main.c index 9fd68161f50..3f55b7c33ef 100644 --- a/applications/system/updater/scenes/updater_scene_main.c +++ b/applications/system/updater/scenes/updater_scene_main.c @@ -45,7 +45,7 @@ void updater_scene_main_on_enter(void* context) { view_dispatcher_switch_to_view(updater->view_dispatcher, UpdaterViewMain); } -static void updater_scene_cancel_update() { +static void updater_scene_cancel_update(void) { update_operation_disarm(); furi_hal_power_reset(); } diff --git a/applications/system/updater/util/update_task.c b/applications/system/updater/util/update_task.c index df1793a8009..c0ea6421c50 100644 --- a/applications/system/updater/util/update_task.c +++ b/applications/system/updater/util/update_task.c @@ -387,7 +387,7 @@ static void update_task_worker_thread_cb(FuriThreadState state, void* context) { } } -UpdateTask* update_task_alloc() { +UpdateTask* update_task_alloc(void) { UpdateTask* update_task = malloc(sizeof(UpdateTask)); update_task->state.stage = UpdateTaskStageProgress; diff --git a/applications/system/updater/util/update_task.h b/applications/system/updater/util/update_task.h index b3ac3f2f825..a3c47429ecb 100644 --- a/applications/system/updater/util/update_task.h +++ b/applications/system/updater/util/update_task.h @@ -69,7 +69,7 @@ typedef struct UpdateTask UpdateTask; typedef void ( *updateProgressCb)(const char* status, const uint8_t stage_pct, bool failed, void* state); -UpdateTask* update_task_alloc(); +UpdateTask* update_task_alloc(void); void update_task_free(UpdateTask* update_task); diff --git a/applications/system/updater/views/updater_main.c b/applications/system/updater/views/updater_main.c index d32d51b7c0b..4e018d41991 100644 --- a/applications/system/updater/views/updater_main.c +++ b/applications/system/updater/views/updater_main.c @@ -102,7 +102,7 @@ static void updater_main_draw_callback(Canvas* canvas, void* _model) { } } -UpdaterMainView* updater_main_alloc() { +UpdaterMainView* updater_main_alloc(void) { UpdaterMainView* main_view = malloc(sizeof(UpdaterMainView)); main_view->view = view_alloc(); diff --git a/applications/system/updater/views/updater_main.h b/applications/system/updater/views/updater_main.h index 81a0e86c914..4d2b9b03cf1 100644 --- a/applications/system/updater/views/updater_main.h +++ b/applications/system/updater/views/updater_main.h @@ -9,7 +9,7 @@ typedef void (*UpdaterMainInputCallback)(InputType type, void* context); View* updater_main_get_view(UpdaterMainView* main_view); -UpdaterMainView* updater_main_alloc(); +UpdaterMainView* updater_main_alloc(void); void updater_main_free(UpdaterMainView* main_view); diff --git a/furi/core/check.c b/furi/core/check.c index 8025961699d..90989474a3d 100644 --- a/furi/core/check.c +++ b/furi/core/check.c @@ -67,7 +67,7 @@ static void __furi_put_uint32_as_hex(uint32_t data) { furi_log_puts(tmp_str); } -static void __furi_print_register_info() { +static void __furi_print_register_info(void) { // Print registers for(uint8_t i = 0; i < 12; i++) { furi_log_puts("\r\n\tr"); @@ -80,12 +80,12 @@ static void __furi_print_register_info() { __furi_put_uint32_as_hex(__furi_check_registers[12]); } -static void __furi_print_stack_info() { +static void __furi_print_stack_info(void) { furi_log_puts("\r\n\tstack watermark: "); __furi_put_uint32_as_text(uxTaskGetStackHighWaterMark(NULL) * 4); } -static void __furi_print_bt_stack_info() { +static void __furi_print_bt_stack_info(void) { const BleGlueHardfaultInfo* fault_info = ble_glue_get_hardfault_info(); if(fault_info == NULL) { furi_log_puts("\r\n\tcore2: not faulted"); @@ -99,7 +99,7 @@ static void __furi_print_bt_stack_info() { } } -static void __furi_print_heap_info() { +static void __furi_print_heap_info(void) { furi_log_puts("\r\n\t heap total: "); __furi_put_uint32_as_text(xPortGetTotalHeapSize()); furi_log_puts("\r\n\t heap free: "); @@ -125,7 +125,7 @@ static void __furi_print_name(bool isr) { } } -FURI_NORETURN void __furi_crash_implementation() { +FURI_NORETURN void __furi_crash_implementation(void) { __disable_irq(); GET_MESSAGE_AND_STORE_REGISTERS(); @@ -176,7 +176,7 @@ FURI_NORETURN void __furi_crash_implementation() { __builtin_unreachable(); } -FURI_NORETURN void __furi_halt_implementation() { +FURI_NORETURN void __furi_halt_implementation(void) { __disable_irq(); GET_MESSAGE_AND_STORE_REGISTERS(); diff --git a/furi/core/check.h b/furi/core/check.h index e782380fdda..13b3fd51bc6 100644 --- a/furi/core/check.h +++ b/furi/core/check.h @@ -14,13 +14,10 @@ #pragma once #include +#include "common_defines.h" #ifdef __cplusplus extern "C" { -#define FURI_NORETURN [[noreturn]] -#else -#include -#define FURI_NORETURN noreturn #endif // Flags instead of pointers will save ~4 bytes on furi_assert and furi_check calls. @@ -28,10 +25,10 @@ extern "C" { #define __FURI_CHECK_MESSAGE_FLAG (0x02) /** Crash system */ -FURI_NORETURN void __furi_crash_implementation(); +FURI_NORETURN void __furi_crash_implementation(void); /** Halt system */ -FURI_NORETURN void __furi_halt_implementation(); +FURI_NORETURN void __furi_halt_implementation(void); /** Crash system with message. Show message after reboot. */ #define __furi_crash(message) \ diff --git a/furi/core/common_defines.h b/furi/core/common_defines.h index 82029786338..beb9f6519ca 100644 --- a/furi/core/common_defines.h +++ b/furi/core/common_defines.h @@ -5,6 +5,10 @@ #ifdef __cplusplus extern "C" { +#define FURI_NORETURN [[noreturn]] +#else +#include +#define FURI_NORETURN noreturn #endif #include diff --git a/furi/core/event_flag.c b/furi/core/event_flag.c index 96b9591877e..ccbee93d66b 100644 --- a/furi/core/event_flag.c +++ b/furi/core/event_flag.c @@ -8,8 +8,8 @@ #define FURI_EVENT_FLAG_MAX_BITS_EVENT_GROUPS 24U #define FURI_EVENT_FLAG_INVALID_BITS (~((1UL << FURI_EVENT_FLAG_MAX_BITS_EVENT_GROUPS) - 1U)) -FuriEventFlag* furi_event_flag_alloc() { - furi_assert(!FURI_IS_IRQ_MODE()); +FuriEventFlag* furi_event_flag_alloc(void) { + furi_check(!FURI_IS_IRQ_MODE()); EventGroupHandle_t handle = xEventGroupCreate(); furi_check(handle); @@ -18,13 +18,13 @@ FuriEventFlag* furi_event_flag_alloc() { } void furi_event_flag_free(FuriEventFlag* instance) { - furi_assert(!FURI_IS_IRQ_MODE()); + furi_check(!FURI_IS_IRQ_MODE()); vEventGroupDelete((EventGroupHandle_t)instance); } uint32_t furi_event_flag_set(FuriEventFlag* instance, uint32_t flags) { - furi_assert(instance); - furi_assert((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U); + furi_check(instance); + furi_check((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U); EventGroupHandle_t hEventGroup = (EventGroupHandle_t)instance; uint32_t rflags; @@ -47,8 +47,8 @@ uint32_t furi_event_flag_set(FuriEventFlag* instance, uint32_t flags) { } uint32_t furi_event_flag_clear(FuriEventFlag* instance, uint32_t flags) { - furi_assert(instance); - furi_assert((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U); + furi_check(instance); + furi_check((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U); EventGroupHandle_t hEventGroup = (EventGroupHandle_t)instance; uint32_t rflags; @@ -73,7 +73,7 @@ uint32_t furi_event_flag_clear(FuriEventFlag* instance, uint32_t flags) { } uint32_t furi_event_flag_get(FuriEventFlag* instance) { - furi_assert(instance); + furi_check(instance); EventGroupHandle_t hEventGroup = (EventGroupHandle_t)instance; uint32_t rflags; @@ -93,9 +93,9 @@ uint32_t furi_event_flag_wait( uint32_t flags, uint32_t options, uint32_t timeout) { - furi_assert(!FURI_IS_IRQ_MODE()); - furi_assert(instance); - furi_assert((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U); + furi_check(!FURI_IS_IRQ_MODE()); + furi_check(instance); + furi_check((flags & FURI_EVENT_FLAG_INVALID_BITS) == 0U); EventGroupHandle_t hEventGroup = (EventGroupHandle_t)instance; BaseType_t wait_all; diff --git a/furi/core/event_flag.h b/furi/core/event_flag.h index 133c95e7b19..7200144cde2 100644 --- a/furi/core/event_flag.h +++ b/furi/core/event_flag.h @@ -16,7 +16,7 @@ typedef void FuriEventFlag; * * @return pointer to FuriEventFlag */ -FuriEventFlag* furi_event_flag_alloc(); +FuriEventFlag* furi_event_flag_alloc(void); /** Deallocate FuriEventFlag * diff --git a/furi/core/kernel.c b/furi/core/kernel.c index 89a50a9b52f..db3d6a7160e 100644 --- a/furi/core/kernel.c +++ b/furi/core/kernel.c @@ -10,7 +10,7 @@ #include CMSIS_device_header -bool furi_kernel_is_irq_or_masked() { +bool furi_kernel_is_irq_or_masked(void) { bool irq = false; BaseType_t state; @@ -34,12 +34,12 @@ bool furi_kernel_is_irq_or_masked() { return (irq); } -bool furi_kernel_is_running() { +bool furi_kernel_is_running(void) { return xTaskGetSchedulerState() != taskSCHEDULER_RUNNING; } -int32_t furi_kernel_lock() { - furi_assert(!furi_kernel_is_irq_or_masked()); +int32_t furi_kernel_lock(void) { + furi_check(!furi_kernel_is_irq_or_masked()); int32_t lock; @@ -63,8 +63,8 @@ int32_t furi_kernel_lock() { return (lock); } -int32_t furi_kernel_unlock() { - furi_assert(!furi_kernel_is_irq_or_masked()); +int32_t furi_kernel_unlock(void) { + furi_check(!furi_kernel_is_irq_or_masked()); int32_t lock; @@ -94,7 +94,7 @@ int32_t furi_kernel_unlock() { } int32_t furi_kernel_restore_lock(int32_t lock) { - furi_assert(!furi_kernel_is_irq_or_masked()); + furi_check(!furi_kernel_is_irq_or_masked()); switch(xTaskGetSchedulerState()) { case taskSCHEDULER_SUSPENDED: @@ -124,13 +124,13 @@ int32_t furi_kernel_restore_lock(int32_t lock) { return (lock); } -uint32_t furi_kernel_get_tick_frequency() { +uint32_t furi_kernel_get_tick_frequency(void) { /* Return frequency in hertz */ return (configTICK_RATE_HZ_RAW); } void furi_delay_tick(uint32_t ticks) { - furi_assert(!furi_kernel_is_irq_or_masked()); + furi_check(!furi_kernel_is_irq_or_masked()); if(ticks == 0U) { taskYIELD(); } else { @@ -139,7 +139,7 @@ void furi_delay_tick(uint32_t ticks) { } FuriStatus furi_delay_until_tick(uint32_t tick) { - furi_assert(!furi_kernel_is_irq_or_masked()); + furi_check(!furi_kernel_is_irq_or_masked()); TickType_t tcnt, delay; FuriStatus stat; @@ -165,7 +165,7 @@ FuriStatus furi_delay_until_tick(uint32_t tick) { return (stat); } -uint32_t furi_get_tick() { +uint32_t furi_get_tick(void) { TickType_t ticks; if(furi_kernel_is_irq_or_masked() != 0U) { diff --git a/furi/core/kernel.h b/furi/core/kernel.h index 592f01d57d2..2973a90e577 100644 --- a/furi/core/kernel.h +++ b/furi/core/kernel.h @@ -25,13 +25,13 @@ extern "C" { * * @return true if CPU is in IRQ or kernel running and IRQ is masked */ -bool furi_kernel_is_irq_or_masked(); +bool furi_kernel_is_irq_or_masked(void); /** Check if kernel is running * * @return true if running, false otherwise */ -bool furi_kernel_is_running(); +bool furi_kernel_is_running(void); /** Lock kernel, pause process scheduling * @@ -39,7 +39,7 @@ bool furi_kernel_is_running(); * * @return previous lock state(0 - unlocked, 1 - locked) */ -int32_t furi_kernel_lock(); +int32_t furi_kernel_lock(void); /** Unlock kernel, resume process scheduling * @@ -47,7 +47,7 @@ int32_t furi_kernel_lock(); * * @return previous lock state(0 - unlocked, 1 - locked) */ -int32_t furi_kernel_unlock(); +int32_t furi_kernel_unlock(void); /** Restore kernel lock state * @@ -63,7 +63,7 @@ int32_t furi_kernel_restore_lock(int32_t lock); * * @return systick counts per second */ -uint32_t furi_kernel_get_tick_frequency(); +uint32_t furi_kernel_get_tick_frequency(void); /** Delay execution * diff --git a/furi/core/log.c b/furi/core/log.c index 3d270816c5f..f8110b46ac7 100644 --- a/furi/core/log.c +++ b/furi/core/log.c @@ -31,7 +31,7 @@ static const FuriLogLevelDescription FURI_LOG_LEVEL_DESCRIPTIONS[] = { {"trace", FuriLogLevelTrace}, }; -void furi_log_init() { +void furi_log_init(void) { // Set default logging parameters furi_log.log_level = FURI_LOG_LEVEL_DEFAULT; furi_log.mutex = furi_mutex_alloc(FuriMutexTypeRecursive); @@ -178,6 +178,8 @@ void furi_log_print_raw_format(FuriLogLevel level, const char* format, ...) { } void furi_log_set_level(FuriLogLevel level) { + furi_check(level <= FuriLogLevelTrace); + if(level == FuriLogLevelDefault) { level = FURI_LOG_LEVEL_DEFAULT; } diff --git a/furi/core/memmgr_heap.c b/furi/core/memmgr_heap.c index c0ab46ebcd6..24bd327fd2b 100644 --- a/furi/core/memmgr_heap.c +++ b/furi/core/memmgr_heap.c @@ -133,7 +133,7 @@ static MemmgrHeapThreadDict_t memmgr_heap_thread_dict = {0}; static volatile uint32_t memmgr_heap_thread_trace_depth = 0; /* Initialize tracing storage on start */ -void memmgr_heap_init() { +void memmgr_heap_init(void) { MemmgrHeapThreadDict_init(memmgr_heap_thread_dict); } @@ -224,7 +224,7 @@ static inline void traceFREE(void* pointer, size_t size) { } } -size_t memmgr_heap_get_max_free_block() { +size_t memmgr_heap_get_max_free_block(void) { size_t max_free_size = 0; BlockLink_t* pxBlock; vTaskSuspendAll(); @@ -241,7 +241,7 @@ size_t memmgr_heap_get_max_free_block() { return max_free_size; } -void memmgr_heap_printf_free_blocks() { +void memmgr_heap_printf_free_blocks(void) { BlockLink_t* pxBlock; //TODO enable when we can do printf with a locked scheduler //vTaskSuspendAll(); @@ -283,7 +283,7 @@ char* ultoa(unsigned long num, char* str, int radix) { return str; } -static void print_heap_init() { +static void print_heap_init(void) { char tmp_str[33]; size_t heap_start = (size_t)&__heap_start__; size_t heap_end = (size_t)&__heap_end__; diff --git a/furi/core/memmgr_heap.h b/furi/core/memmgr_heap.h index 660c5c6bf00..7d889f1520e 100644 --- a/furi/core/memmgr_heap.h +++ b/furi/core/memmgr_heap.h @@ -38,11 +38,11 @@ size_t memmgr_heap_get_thread_memory(FuriThreadId thread_id); * * @return size_t max contiguous block size */ -size_t memmgr_heap_get_max_free_block(); +size_t memmgr_heap_get_max_free_block(void); /** Print the address and size of all free blocks to stdout */ -void memmgr_heap_printf_free_blocks(); +void memmgr_heap_printf_free_blocks(void); #ifdef __cplusplus } diff --git a/furi/core/message_queue.c b/furi/core/message_queue.c index e20fa420a08..6e8ab186987 100644 --- a/furi/core/message_queue.c +++ b/furi/core/message_queue.c @@ -6,7 +6,7 @@ #include FuriMessageQueue* furi_message_queue_alloc(uint32_t msg_count, uint32_t msg_size) { - furi_assert((furi_kernel_is_irq_or_masked() == 0U) && (msg_count > 0U) && (msg_size > 0U)); + furi_check((furi_kernel_is_irq_or_masked() == 0U) && (msg_count > 0U) && (msg_size > 0U)); QueueHandle_t handle = xQueueCreate(msg_count, msg_size); furi_check(handle); @@ -15,14 +15,16 @@ FuriMessageQueue* furi_message_queue_alloc(uint32_t msg_count, uint32_t msg_size } void furi_message_queue_free(FuriMessageQueue* instance) { - furi_assert(furi_kernel_is_irq_or_masked() == 0U); - furi_assert(instance); + furi_check(furi_kernel_is_irq_or_masked() == 0U); + furi_check(instance); vQueueDelete((QueueHandle_t)instance); } FuriStatus furi_message_queue_put(FuriMessageQueue* instance, const void* msg_ptr, uint32_t timeout) { + furi_check(instance); + QueueHandle_t hQueue = (QueueHandle_t)instance; FuriStatus stat; BaseType_t yield; @@ -30,7 +32,7 @@ FuriStatus stat = FuriStatusOk; if(furi_kernel_is_irq_or_masked() != 0U) { - if((hQueue == NULL) || (msg_ptr == NULL) || (timeout != 0U)) { + if((msg_ptr == NULL) || (timeout != 0U)) { stat = FuriStatusErrorParameter; } else { yield = pdFALSE; @@ -42,7 +44,7 @@ FuriStatus } } } else { - if((hQueue == NULL) || (msg_ptr == NULL)) { + if(msg_ptr == NULL) { stat = FuriStatusErrorParameter; } else { if(xQueueSendToBack(hQueue, msg_ptr, (TickType_t)timeout) != pdPASS) { @@ -60,6 +62,8 @@ FuriStatus } FuriStatus furi_message_queue_get(FuriMessageQueue* instance, void* msg_ptr, uint32_t timeout) { + furi_check(instance); + QueueHandle_t hQueue = (QueueHandle_t)instance; FuriStatus stat; BaseType_t yield; @@ -67,7 +71,7 @@ FuriStatus furi_message_queue_get(FuriMessageQueue* instance, void* msg_ptr, uin stat = FuriStatusOk; if(furi_kernel_is_irq_or_masked() != 0U) { - if((hQueue == NULL) || (msg_ptr == NULL) || (timeout != 0U)) { + if((msg_ptr == NULL) || (timeout != 0U)) { stat = FuriStatusErrorParameter; } else { yield = pdFALSE; @@ -79,7 +83,7 @@ FuriStatus furi_message_queue_get(FuriMessageQueue* instance, void* msg_ptr, uin } } } else { - if((hQueue == NULL) || (msg_ptr == NULL)) { + if(msg_ptr == NULL) { stat = FuriStatusErrorParameter; } else { if(xQueueReceive(hQueue, msg_ptr, (TickType_t)timeout) != pdPASS) { @@ -92,47 +96,42 @@ FuriStatus furi_message_queue_get(FuriMessageQueue* instance, void* msg_ptr, uin } } - /* Return execution status */ return (stat); } uint32_t furi_message_queue_get_capacity(FuriMessageQueue* instance) { + furi_check(instance); + StaticQueue_t* mq = (StaticQueue_t*)instance; uint32_t capacity; - if(mq == NULL) { - capacity = 0U; - } else { - /* capacity = pxQueue->uxLength */ - capacity = mq->uxDummy4[1]; - } + /* capacity = pxQueue->uxLength */ + capacity = mq->uxDummy4[1]; /* Return maximum number of messages */ return (capacity); } uint32_t furi_message_queue_get_message_size(FuriMessageQueue* instance) { + furi_check(instance); + StaticQueue_t* mq = (StaticQueue_t*)instance; uint32_t size; - if(mq == NULL) { - size = 0U; - } else { - /* size = pxQueue->uxItemSize */ - size = mq->uxDummy4[2]; - } + /* size = pxQueue->uxItemSize */ + size = mq->uxDummy4[2]; /* Return maximum message size */ return (size); } uint32_t furi_message_queue_get_count(FuriMessageQueue* instance) { + furi_check(instance); + QueueHandle_t hQueue = (QueueHandle_t)instance; UBaseType_t count; - if(hQueue == NULL) { - count = 0U; - } else if(furi_kernel_is_irq_or_masked() != 0U) { + if(furi_kernel_is_irq_or_masked() != 0U) { count = uxQueueMessagesWaitingFromISR(hQueue); } else { count = uxQueueMessagesWaiting(hQueue); @@ -143,13 +142,13 @@ uint32_t furi_message_queue_get_count(FuriMessageQueue* instance) { } uint32_t furi_message_queue_get_space(FuriMessageQueue* instance) { + furi_check(instance); + StaticQueue_t* mq = (StaticQueue_t*)instance; uint32_t space; uint32_t isrm; - if(mq == NULL) { - space = 0U; - } else if(furi_kernel_is_irq_or_masked() != 0U) { + if(furi_kernel_is_irq_or_masked() != 0U) { isrm = taskENTER_CRITICAL_FROM_ISR(); /* space = pxQueue->uxLength - pxQueue->uxMessagesWaiting; */ @@ -165,13 +164,13 @@ uint32_t furi_message_queue_get_space(FuriMessageQueue* instance) { } FuriStatus furi_message_queue_reset(FuriMessageQueue* instance) { + furi_check(instance); + QueueHandle_t hQueue = (QueueHandle_t)instance; FuriStatus stat; if(furi_kernel_is_irq_or_masked() != 0U) { stat = FuriStatusErrorISR; - } else if(hQueue == NULL) { - stat = FuriStatusErrorParameter; } else { stat = FuriStatusOk; (void)xQueueReset(hQueue); diff --git a/furi/core/mutex.c b/furi/core/mutex.c index f18fb1681df..e32be1a3969 100644 --- a/furi/core/mutex.c +++ b/furi/core/mutex.c @@ -6,7 +6,7 @@ #include FuriMutex* furi_mutex_alloc(FuriMutexType type) { - furi_assert(!FURI_IS_IRQ_MODE()); + furi_check(!FURI_IS_IRQ_MODE()); SemaphoreHandle_t hMutex = NULL; @@ -15,7 +15,7 @@ FuriMutex* furi_mutex_alloc(FuriMutexType type) { } else if(type == FuriMutexTypeRecursive) { hMutex = xSemaphoreCreateRecursiveMutex(); } else { - furi_crash("Programming error"); + furi_crash(); } furi_check(hMutex != NULL); @@ -30,13 +30,15 @@ FuriMutex* furi_mutex_alloc(FuriMutexType type) { } void furi_mutex_free(FuriMutex* instance) { - furi_assert(!FURI_IS_IRQ_MODE()); - furi_assert(instance); + furi_check(!FURI_IS_IRQ_MODE()); + furi_check(instance); vSemaphoreDelete((SemaphoreHandle_t)((uint32_t)instance & ~1U)); } FuriStatus furi_mutex_acquire(FuriMutex* instance, uint32_t timeout) { + furi_check(instance); + SemaphoreHandle_t hMutex; FuriStatus stat; uint32_t rmtx; @@ -77,6 +79,8 @@ FuriStatus furi_mutex_acquire(FuriMutex* instance, uint32_t timeout) { } FuriStatus furi_mutex_release(FuriMutex* instance) { + furi_check(instance); + SemaphoreHandle_t hMutex; FuriStatus stat; uint32_t rmtx; @@ -109,6 +113,8 @@ FuriStatus furi_mutex_release(FuriMutex* instance) { } FuriThreadId furi_mutex_get_owner(FuriMutex* instance) { + furi_check(instance); + SemaphoreHandle_t hMutex; FuriThreadId owner; diff --git a/furi/core/pubsub.c b/furi/core/pubsub.c index 44ef20c716c..bcabc74a76c 100644 --- a/furi/core/pubsub.c +++ b/furi/core/pubsub.c @@ -17,7 +17,7 @@ struct FuriPubSub { FuriMutex* mutex; }; -FuriPubSub* furi_pubsub_alloc() { +FuriPubSub* furi_pubsub_alloc(void) { FuriPubSub* pubsub = malloc(sizeof(FuriPubSub)); pubsub->mutex = furi_mutex_alloc(FuriMutexTypeNormal); @@ -42,6 +42,9 @@ void furi_pubsub_free(FuriPubSub* pubsub) { FuriPubSubSubscription* furi_pubsub_subscribe(FuriPubSub* pubsub, FuriPubSubCallback callback, void* callback_context) { + furi_check(pubsub); + furi_check(callback); + furi_check(furi_mutex_acquire(pubsub->mutex, FuriWaitForever) == FuriStatusOk); // put uninitialized item to the list FuriPubSubSubscription* item = FuriPubSubSubscriptionList_push_raw(pubsub->items); @@ -81,6 +84,8 @@ void furi_pubsub_unsubscribe(FuriPubSub* pubsub, FuriPubSubSubscription* pubsub_ } void furi_pubsub_publish(FuriPubSub* pubsub, void* message) { + furi_check(pubsub); + furi_check(furi_mutex_acquire(pubsub->mutex, FuriWaitForever) == FuriStatusOk); // iterate over subscribers diff --git a/furi/core/pubsub.h b/furi/core/pubsub.h index 69ca574ac93..097ff0190ca 100644 --- a/furi/core/pubsub.h +++ b/furi/core/pubsub.h @@ -23,7 +23,7 @@ typedef struct FuriPubSubSubscription FuriPubSubSubscription; * * @return pointer to FuriPubSub instance */ -FuriPubSub* furi_pubsub_alloc(); +FuriPubSub* furi_pubsub_alloc(void); /** Free FuriPubSub * diff --git a/furi/core/record.c b/furi/core/record.c index 773585e7efc..e9bd8edcd63 100644 --- a/furi/core/record.c +++ b/furi/core/record.c @@ -37,7 +37,7 @@ static void furi_record_erase(const char* name, FuriRecordData* record_data) { FuriRecordDataDict_erase(furi_record->records, name); } -void furi_record_init() { +void furi_record_init(void) { furi_record = malloc(sizeof(FuriRecord)); furi_record->mutex = furi_mutex_alloc(FuriMutexTypeNormal); furi_check(furi_record->mutex); @@ -45,7 +45,7 @@ void furi_record_init() { } static FuriRecordData* furi_record_data_get_or_create(const char* name) { - furi_assert(furi_record); + furi_check(furi_record); FuriRecordData* record_data = furi_record_get(name); if(!record_data) { FuriRecordData new_record; @@ -58,17 +58,17 @@ static FuriRecordData* furi_record_data_get_or_create(const char* name) { return record_data; } -static void furi_record_lock() { +static void furi_record_lock(void) { furi_check(furi_mutex_acquire(furi_record->mutex, FuriWaitForever) == FuriStatusOk); } -static void furi_record_unlock() { +static void furi_record_unlock(void) { furi_check(furi_mutex_release(furi_record->mutex) == FuriStatusOk); } bool furi_record_exists(const char* name) { - furi_assert(furi_record); - furi_assert(name); + furi_check(furi_record); + furi_check(name); bool ret = false; @@ -80,13 +80,14 @@ bool furi_record_exists(const char* name) { } void furi_record_create(const char* name, void* data) { - furi_assert(furi_record); + furi_check(furi_record); + furi_check(name); furi_record_lock(); // Get record data and fill it FuriRecordData* record_data = furi_record_data_get_or_create(name); - furi_assert(record_data->data == NULL); + furi_check(record_data->data == NULL); record_data->data = data; furi_event_flag_set(record_data->flags, FURI_RECORD_FLAG_READY); @@ -94,14 +95,15 @@ void furi_record_create(const char* name, void* data) { } bool furi_record_destroy(const char* name) { - furi_assert(furi_record); + furi_check(furi_record); + furi_check(name); bool ret = false; furi_record_lock(); FuriRecordData* record_data = furi_record_get(name); - furi_assert(record_data); + furi_check(record_data); if(record_data->holders_count == 0) { furi_record_erase(name, record_data); ret = true; @@ -113,7 +115,8 @@ bool furi_record_destroy(const char* name) { } void* furi_record_open(const char* name) { - furi_assert(furi_record); + furi_check(furi_record); + furi_check(name); furi_record_lock(); @@ -134,12 +137,13 @@ void* furi_record_open(const char* name) { } void furi_record_close(const char* name) { - furi_assert(furi_record); + furi_check(furi_record); + furi_check(name); furi_record_lock(); FuriRecordData* record_data = furi_record_get(name); - furi_assert(record_data); + furi_check(record_data); record_data->holders_count--; furi_record_unlock(); diff --git a/furi/core/record.h b/furi/core/record.h index 4819123e277..a269484f043 100644 --- a/furi/core/record.h +++ b/furi/core/record.h @@ -14,7 +14,7 @@ extern "C" { /** Initialize record storage For internal use only. */ -void furi_record_init(); +void furi_record_init(void); /** Check if record exists * diff --git a/furi/core/semaphore.c b/furi/core/semaphore.c index 1f1a07780cd..503eec472b0 100644 --- a/furi/core/semaphore.c +++ b/furi/core/semaphore.c @@ -6,8 +6,8 @@ #include FuriSemaphore* furi_semaphore_alloc(uint32_t max_count, uint32_t initial_count) { - furi_assert(!FURI_IS_IRQ_MODE()); - furi_assert((max_count > 0U) && (initial_count <= max_count)); + furi_check(!FURI_IS_IRQ_MODE()); + furi_check((max_count > 0U) && (initial_count <= max_count)); SemaphoreHandle_t hSemaphore = NULL; if(max_count == 1U) { @@ -29,8 +29,8 @@ FuriSemaphore* furi_semaphore_alloc(uint32_t max_count, uint32_t initial_count) } void furi_semaphore_free(FuriSemaphore* instance) { - furi_assert(instance); - furi_assert(!FURI_IS_IRQ_MODE()); + furi_check(instance); + furi_check(!FURI_IS_IRQ_MODE()); SemaphoreHandle_t hSemaphore = (SemaphoreHandle_t)instance; @@ -38,7 +38,7 @@ void furi_semaphore_free(FuriSemaphore* instance) { } FuriStatus furi_semaphore_acquire(FuriSemaphore* instance, uint32_t timeout) { - furi_assert(instance); + furi_check(instance); SemaphoreHandle_t hSemaphore = (SemaphoreHandle_t)instance; FuriStatus stat; @@ -73,7 +73,7 @@ FuriStatus furi_semaphore_acquire(FuriSemaphore* instance, uint32_t timeout) { } FuriStatus furi_semaphore_release(FuriSemaphore* instance) { - furi_assert(instance); + furi_check(instance); SemaphoreHandle_t hSemaphore = (SemaphoreHandle_t)instance; FuriStatus stat; @@ -100,7 +100,7 @@ FuriStatus furi_semaphore_release(FuriSemaphore* instance) { } uint32_t furi_semaphore_get_count(FuriSemaphore* instance) { - furi_assert(instance); + furi_check(instance); SemaphoreHandle_t hSemaphore = (SemaphoreHandle_t)instance; uint32_t count; diff --git a/furi/core/stream_buffer.c b/furi/core/stream_buffer.c index a13d256b110..8bd00d91c57 100644 --- a/furi/core/stream_buffer.c +++ b/furi/core/stream_buffer.c @@ -7,7 +7,7 @@ #include FuriStreamBuffer* furi_stream_buffer_alloc(size_t size, size_t trigger_level) { - furi_assert(size != 0); + furi_check(size != 0); StreamBufferHandle_t handle = xStreamBufferCreate(size, trigger_level); furi_check(handle); @@ -16,12 +16,13 @@ FuriStreamBuffer* furi_stream_buffer_alloc(size_t size, size_t trigger_level) { }; void furi_stream_buffer_free(FuriStreamBuffer* stream_buffer) { - furi_assert(stream_buffer); + furi_check(stream_buffer); + vStreamBufferDelete(stream_buffer); }; bool furi_stream_set_trigger_level(FuriStreamBuffer* stream_buffer, size_t trigger_level) { - furi_assert(stream_buffer); + furi_check(stream_buffer); return xStreamBufferSetTriggerLevel(stream_buffer, trigger_level) == pdTRUE; }; @@ -30,6 +31,8 @@ size_t furi_stream_buffer_send( const void* data, size_t length, uint32_t timeout) { + furi_check(stream_buffer); + size_t ret; if(FURI_IS_IRQ_MODE()) { @@ -48,6 +51,8 @@ size_t furi_stream_buffer_receive( void* data, size_t length, uint32_t timeout) { + furi_check(stream_buffer); + size_t ret; if(FURI_IS_IRQ_MODE()) { @@ -62,22 +67,32 @@ size_t furi_stream_buffer_receive( } size_t furi_stream_buffer_bytes_available(FuriStreamBuffer* stream_buffer) { + furi_check(stream_buffer); + return xStreamBufferBytesAvailable(stream_buffer); }; size_t furi_stream_buffer_spaces_available(FuriStreamBuffer* stream_buffer) { + furi_check(stream_buffer); + return xStreamBufferSpacesAvailable(stream_buffer); }; bool furi_stream_buffer_is_full(FuriStreamBuffer* stream_buffer) { + furi_check(stream_buffer); + return xStreamBufferIsFull(stream_buffer) == pdTRUE; }; bool furi_stream_buffer_is_empty(FuriStreamBuffer* stream_buffer) { + furi_check(stream_buffer); + return (xStreamBufferIsEmpty(stream_buffer) == pdTRUE); }; FuriStatus furi_stream_buffer_reset(FuriStreamBuffer* stream_buffer) { + furi_check(stream_buffer); + if(xStreamBufferReset(stream_buffer) == pdPASS) { return FuriStatusOk; } else { diff --git a/furi/core/string.c b/furi/core/string.c index a09ff953f92..f3e40fe5eb6 100644 --- a/furi/core/string.c +++ b/furi/core/string.c @@ -22,7 +22,7 @@ struct FuriString { #undef furi_string_trim #undef furi_string_cat -FuriString* furi_string_alloc() { +FuriString* furi_string_alloc(void) { FuriString* string = malloc(sizeof(FuriString)); string_init(string->string); return string; diff --git a/furi/core/string.h b/furi/core/string.h index 77ae9da6dcf..324135e96d7 100644 --- a/furi/core/string.h +++ b/furi/core/string.h @@ -32,7 +32,7 @@ typedef struct FuriString FuriString; * @brief Allocate new FuriString. * @return FuriString* */ -FuriString* furi_string_alloc(); +FuriString* furi_string_alloc(void); /** * @brief Allocate new FuriString and set it to string. diff --git a/furi/core/thread.c b/furi/core/thread.c index 3c1a17258d4..f9f73b4f75a 100644 --- a/furi/core/thread.c +++ b/furi/core/thread.c @@ -4,7 +4,6 @@ #include "memmgr_heap.h" #include "check.h" #include "common_defines.h" -#include "mutex.h" #include "string.h" #include "log.h" @@ -57,7 +56,7 @@ static size_t __furi_thread_stdout_write(FuriThread* thread, const char* data, s static int32_t __furi_thread_stdout_flush(FuriThread* thread); /** Catch threads that are trying to exit wrong way */ -__attribute__((__noreturn__)) void furi_thread_catch() { //-V1082 +__attribute__((__noreturn__)) void furi_thread_catch(void) { //-V1082 // If you're here it means you're probably doing something wrong // with critical sections or with scheduler state asm volatile("nop"); // extra magic @@ -74,14 +73,14 @@ static void furi_thread_set_state(FuriThread* thread, FuriThreadState state) { } static void furi_thread_body(void* context) { - furi_assert(context); + furi_check(context); FuriThread* thread = context; // store thread instance to thread local storage - furi_assert(pvTaskGetThreadLocalStoragePointer(NULL, 0) == NULL); + furi_check(pvTaskGetThreadLocalStoragePointer(NULL, 0) == NULL); vTaskSetThreadLocalStoragePointer(NULL, 0, thread); - furi_assert(thread->state == FuriThreadStateStarting); + furi_check(thread->state == FuriThreadStateStarting); furi_thread_set_state(thread, FuriThreadStateRunning); TaskHandle_t task_handle = xTaskGetCurrentTaskHandle(); @@ -103,7 +102,7 @@ static void furi_thread_body(void* context) { memmgr_heap_disable_thread_trace((FuriThreadId)task_handle); } - furi_assert(thread->state == FuriThreadStateRunning); + furi_check(thread->state == FuriThreadStateRunning); if(thread->is_service) { FURI_LOG_W( @@ -121,7 +120,7 @@ static void furi_thread_body(void* context) { furi_thread_catch(); } -FuriThread* furi_thread_alloc() { +FuriThread* furi_thread_alloc(void) { FuriThread* thread = malloc(sizeof(FuriThread)); thread->output.buffer = furi_string_alloc(); thread->is_service = false; @@ -167,11 +166,11 @@ FuriThread* furi_thread_alloc_ex( } void furi_thread_free(FuriThread* thread) { - furi_assert(thread); + furi_check(thread); // Ensure that use join before free - furi_assert(thread->state == FuriThreadStateStopped); - furi_assert(thread->task_handle == NULL); + furi_check(thread->state == FuriThreadStateStopped); + furi_check(thread->task_handle == NULL); if(thread->name) free(thread->name); if(thread->appid) free(thread->appid); @@ -181,15 +180,17 @@ void furi_thread_free(FuriThread* thread) { } void furi_thread_set_name(FuriThread* thread, const char* name) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); + if(thread->name) free(thread->name); + thread->name = name ? strdup(name) : NULL; } void furi_thread_set_appid(FuriThread* thread, const char* appid) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); if(thread->appid) free(thread->appid); thread->appid = appid ? strdup(appid) : NULL; } @@ -199,68 +200,70 @@ void furi_thread_mark_as_service(FuriThread* thread) { } void furi_thread_set_stack_size(FuriThread* thread, size_t stack_size) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); - furi_assert(stack_size % 4 == 0); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); + furi_check(stack_size % 4 == 0); thread->stack_size = stack_size; } void furi_thread_set_callback(FuriThread* thread, FuriThreadCallback callback) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); thread->callback = callback; } void furi_thread_set_context(FuriThread* thread, void* context) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); thread->context = context; } void furi_thread_set_priority(FuriThread* thread, FuriThreadPriority priority) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); - furi_assert(priority >= FuriThreadPriorityIdle && priority <= FuriThreadPriorityIsr); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); + furi_check(priority >= FuriThreadPriorityIdle && priority <= FuriThreadPriorityIsr); thread->priority = priority; } FuriThreadPriority furi_thread_get_priority(FuriThread* thread) { - furi_assert(thread); + furi_check(thread); TaskHandle_t hTask = furi_thread_get_id(thread); return (FuriThreadPriority)uxTaskPriorityGet(hTask); } void furi_thread_set_current_priority(FuriThreadPriority priority) { + furi_check(priority <= FuriThreadPriorityIsr); + UBaseType_t new_priority = priority ? priority : FuriThreadPriorityNormal; vTaskPrioritySet(NULL, new_priority); } -FuriThreadPriority furi_thread_get_current_priority() { +FuriThreadPriority furi_thread_get_current_priority(void) { return (FuriThreadPriority)uxTaskPriorityGet(NULL); } void furi_thread_set_state_callback(FuriThread* thread, FuriThreadStateCallback callback) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); thread->state_callback = callback; } void furi_thread_set_state_context(FuriThread* thread, void* context) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); thread->state_context = context; } FuriThreadState furi_thread_get_state(FuriThread* thread) { - furi_assert(thread); + furi_check(thread); return thread->state; } void furi_thread_start(FuriThread* thread) { - furi_assert(thread); - furi_assert(thread->callback); - furi_assert(thread->state == FuriThreadStateStopped); - furi_assert(thread->stack_size > 0 && thread->stack_size < (UINT16_MAX * sizeof(StackType_t))); + furi_check(thread); + furi_check(thread->callback); + furi_check(thread->state == FuriThreadStateStopped); + furi_check(thread->stack_size > 0 && thread->stack_size < (UINT16_MAX * sizeof(StackType_t))); furi_thread_set_state(thread, FuriThreadStateStarting); @@ -289,13 +292,13 @@ void furi_thread_cleanup_tcb_event(TaskHandle_t task) { if(thread) { // clear thread local storage vTaskSetThreadLocalStoragePointer(task, 0, NULL); - furi_assert(thread->task_handle == task); + furi_check(thread->task_handle == task); thread->task_handle = NULL; } } bool furi_thread_join(FuriThread* thread) { - furi_assert(thread); + furi_check(thread); furi_check(furi_thread_get_current() != thread); @@ -311,45 +314,45 @@ bool furi_thread_join(FuriThread* thread) { } FuriThreadId furi_thread_get_id(FuriThread* thread) { - furi_assert(thread); + furi_check(thread); return thread->task_handle; } void furi_thread_enable_heap_trace(FuriThread* thread) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); thread->heap_trace_enabled = true; } void furi_thread_disable_heap_trace(FuriThread* thread) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); thread->heap_trace_enabled = false; } size_t furi_thread_get_heap_size(FuriThread* thread) { - furi_assert(thread); - furi_assert(thread->heap_trace_enabled == true); + furi_check(thread); + furi_check(thread->heap_trace_enabled == true); return thread->heap_size; } int32_t furi_thread_get_return_code(FuriThread* thread) { - furi_assert(thread); - furi_assert(thread->state == FuriThreadStateStopped); + furi_check(thread); + furi_check(thread->state == FuriThreadStateStopped); return thread->ret; } -FuriThreadId furi_thread_get_current_id() { +FuriThreadId furi_thread_get_current_id(void) { return xTaskGetCurrentTaskHandle(); } -FuriThread* furi_thread_get_current() { +FuriThread* furi_thread_get_current(void) { FuriThread* thread = pvTaskGetThreadLocalStoragePointer(NULL, 0); return thread; } -void furi_thread_yield() { - furi_assert(!FURI_IS_IRQ_MODE()); +void furi_thread_yield(void) { + furi_check(!FURI_IS_IRQ_MODE()); taskYIELD(); } @@ -594,20 +597,21 @@ static int32_t __furi_thread_stdout_flush(FuriThread* thread) { void furi_thread_set_stdout_callback(FuriThreadStdoutWriteCallback callback) { FuriThread* thread = furi_thread_get_current(); - furi_assert(thread); + furi_check(thread); __furi_thread_stdout_flush(thread); thread->output.write_callback = callback; } -FuriThreadStdoutWriteCallback furi_thread_get_stdout_callback() { +FuriThreadStdoutWriteCallback furi_thread_get_stdout_callback(void) { FuriThread* thread = furi_thread_get_current(); - furi_assert(thread); + furi_check(thread); return thread->output.write_callback; } size_t furi_thread_stdout_write(const char* data, size_t size) { FuriThread* thread = furi_thread_get_current(); - furi_assert(thread); + furi_check(thread); + if(size == 0 || data == NULL) { return __furi_thread_stdout_flush(thread); } else { @@ -629,19 +633,26 @@ size_t furi_thread_stdout_write(const char* data, size_t size) { return size; } -int32_t furi_thread_stdout_flush() { +int32_t furi_thread_stdout_flush(void) { FuriThread* thread = furi_thread_get_current(); - furi_assert(thread); + furi_check(thread); + return __furi_thread_stdout_flush(thread); } void furi_thread_suspend(FuriThreadId thread_id) { + furi_check(thread_id); + TaskHandle_t hTask = (TaskHandle_t)thread_id; + vTaskSuspend(hTask); } void furi_thread_resume(FuriThreadId thread_id) { + furi_check(thread_id); + TaskHandle_t hTask = (TaskHandle_t)thread_id; + if(FURI_IS_IRQ_MODE()) { xTaskResumeFromISR(hTask); } else { @@ -650,6 +661,9 @@ void furi_thread_resume(FuriThreadId thread_id) { } bool furi_thread_is_suspended(FuriThreadId thread_id) { + furi_check(thread_id); + TaskHandle_t hTask = (TaskHandle_t)thread_id; + return eTaskGetState(hTask) == eSuspended; } diff --git a/furi/core/thread.h b/furi/core/thread.h index 489a4684480..f21ee9df3e4 100644 --- a/furi/core/thread.h +++ b/furi/core/thread.h @@ -62,7 +62,7 @@ typedef void (*FuriThreadStateCallback)(FuriThreadState state, void* context); * * @return FuriThread instance */ -FuriThread* furi_thread_alloc(); +FuriThread* furi_thread_alloc(void); /** Allocate FuriThread, shortcut version * @@ -155,7 +155,7 @@ void furi_thread_set_current_priority(FuriThreadPriority priority); * * @return FuriThreadPriority value */ -FuriThreadPriority furi_thread_get_current_priority(); +FuriThreadPriority furi_thread_get_current_priority(void); /** Set FuriThread state change callback * @@ -238,16 +238,16 @@ int32_t furi_thread_get_return_code(FuriThread* thread); * * @return FuriThreadId or NULL */ -FuriThreadId furi_thread_get_current_id(); +FuriThreadId furi_thread_get_current_id(void); /** Get FuriThread instance for current thread * * @return pointer to FuriThread or NULL if this thread doesn't belongs to Furi */ -FuriThread* furi_thread_get_current(); +FuriThread* furi_thread_get_current(void); /** Return control to scheduler */ -void furi_thread_yield(); +void furi_thread_yield(void); uint32_t furi_thread_flags_set(FuriThreadId thread_id, uint32_t flags); @@ -294,7 +294,7 @@ uint32_t furi_thread_get_stack_space(FuriThreadId thread_id); * * @return STDOUT callback */ -FuriThreadStdoutWriteCallback furi_thread_get_stdout_callback(); +FuriThreadStdoutWriteCallback furi_thread_get_stdout_callback(void); /** Set STDOUT callback for thread * @@ -315,7 +315,7 @@ size_t furi_thread_stdout_write(const char* data, size_t size); * * @return int32_t error code */ -int32_t furi_thread_stdout_flush(); +int32_t furi_thread_stdout_flush(void); /** Suspend thread * diff --git a/furi/core/timer.c b/furi/core/timer.c index f667aae964a..2e688dcc321 100644 --- a/furi/core/timer.c +++ b/furi/core/timer.c @@ -26,7 +26,7 @@ static void TimerCallback(TimerHandle_t hTimer) { } FuriTimer* furi_timer_alloc(FuriTimerCallback func, FuriTimerType type, void* context) { - furi_assert((furi_kernel_is_irq_or_masked() == 0U) && (func != NULL)); + furi_check((furi_kernel_is_irq_or_masked() == 0U) && (func != NULL)); TimerHandle_t hTimer; TimerCallback_t* callb; @@ -59,8 +59,8 @@ FuriTimer* furi_timer_alloc(FuriTimerCallback func, FuriTimerType type, void* co } void furi_timer_free(FuriTimer* instance) { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(instance); + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(instance); TimerHandle_t hTimer = (TimerHandle_t)instance; TimerCallback_t* callb; @@ -86,9 +86,9 @@ void furi_timer_free(FuriTimer* instance) { } FuriStatus furi_timer_start(FuriTimer* instance, uint32_t ticks) { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(instance); - furi_assert(ticks < portMAX_DELAY); + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(instance); + furi_check(ticks < portMAX_DELAY); TimerHandle_t hTimer = (TimerHandle_t)instance; FuriStatus stat; @@ -104,9 +104,9 @@ FuriStatus furi_timer_start(FuriTimer* instance, uint32_t ticks) { } FuriStatus furi_timer_restart(FuriTimer* instance, uint32_t ticks) { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(instance); - furi_assert(ticks < portMAX_DELAY); + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(instance); + furi_check(ticks < portMAX_DELAY); TimerHandle_t hTimer = (TimerHandle_t)instance; FuriStatus stat; @@ -123,8 +123,8 @@ FuriStatus furi_timer_restart(FuriTimer* instance, uint32_t ticks) { } FuriStatus furi_timer_stop(FuriTimer* instance) { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(instance); + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(instance); TimerHandle_t hTimer = (TimerHandle_t)instance; @@ -134,8 +134,8 @@ FuriStatus furi_timer_stop(FuriTimer* instance) { } uint32_t furi_timer_is_running(FuriTimer* instance) { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(instance); + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(instance); TimerHandle_t hTimer = (TimerHandle_t)instance; @@ -144,8 +144,8 @@ uint32_t furi_timer_is_running(FuriTimer* instance) { } uint32_t furi_timer_get_expire_time(FuriTimer* instance) { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(instance); + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(instance); TimerHandle_t hTimer = (TimerHandle_t)instance; @@ -153,17 +153,20 @@ uint32_t furi_timer_get_expire_time(FuriTimer* instance) { } void furi_timer_pending_callback(FuriTimerPendigCallback callback, void* context, uint32_t arg) { + furi_check(callback); + BaseType_t ret = pdFAIL; if(furi_kernel_is_irq_or_masked()) { ret = xTimerPendFunctionCallFromISR(callback, context, arg, NULL); } else { ret = xTimerPendFunctionCall(callback, context, arg, FuriWaitForever); } + furi_check(ret == pdPASS); } void furi_timer_set_thread_priority(FuriTimerThreadPriority priority) { - furi_assert(!furi_kernel_is_irq_or_masked()); + furi_check(!furi_kernel_is_irq_or_masked()); TaskHandle_t task_handle = xTimerGetTimerDaemonTaskHandle(); furi_check(task_handle); // Don't call this method before timer task start diff --git a/furi/flipper.c b/furi/flipper.c index b29424a9f4f..c7ba3b4fb1b 100644 --- a/furi/flipper.c +++ b/furi/flipper.c @@ -29,7 +29,7 @@ static void flipper_print_version(const char* target, const Version* version) { } } -void flipper_init() { +void flipper_init(void) { flipper_print_version("Firmware", furi_hal_version_get_firmware_version()); FURI_LOG_I(TAG, "Boot mode %d, starting services", furi_hal_rtc_get_boot_mode()); diff --git a/furi/flipper.h b/furi/flipper.h index 5b277fac6e4..674cccf887f 100644 --- a/furi/flipper.h +++ b/furi/flipper.h @@ -1,3 +1,3 @@ #pragma once -void flipper_init(); +void flipper_init(void); diff --git a/furi/furi.c b/furi/furi.c index 6247e259fb9..628c47ea24b 100644 --- a/furi/furi.c +++ b/furi/furi.c @@ -4,17 +4,17 @@ #include #include -void furi_init() { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); +void furi_init(void) { + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); furi_log_init(); furi_record_init(); } -void furi_run() { - furi_assert(!furi_kernel_is_irq_or_masked()); - furi_assert(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); +void furi_run(void) { + furi_check(!furi_kernel_is_irq_or_masked()); + furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED); #if(__ARM_ARCH_7A__ == 0U) /* Service Call interrupt might be configured before kernel start */ diff --git a/furi/furi.h b/furi/furi.h index 422509055f7..d8aec91c0f7 100644 --- a/furi/furi.h +++ b/furi/furi.h @@ -28,9 +28,9 @@ extern "C" { #endif -void furi_init(); +void furi_init(void); -void furi_run(); +void furi_run(void); #ifdef __cplusplus } diff --git a/lib/app-scened-template/text_store.h b/lib/app-scened-template/text_store.h index a01784fdee8..3fe58ed1dff 100644 --- a/lib/app-scened-template/text_store.h +++ b/lib/app-scened-template/text_store.h @@ -4,7 +4,7 @@ class TextStore { public: TextStore(uint8_t text_size); - ~TextStore(); + ~TextStore(void); void set(const char* text...); const uint8_t text_size; diff --git a/lib/app-scened-template/view_modules/byte_input_vm.h b/lib/app-scened-template/view_modules/byte_input_vm.h index 9a16101277c..69031fbee62 100644 --- a/lib/app-scened-template/view_modules/byte_input_vm.h +++ b/lib/app-scened-template/view_modules/byte_input_vm.h @@ -4,7 +4,7 @@ class ByteInputVM : public GenericViewModule { public: - ByteInputVM(); + ByteInputVM(void); ~ByteInputVM() final; View* get_view() final; void clean() final; diff --git a/lib/app-scened-template/view_modules/dialog_ex_vm.h b/lib/app-scened-template/view_modules/dialog_ex_vm.h index 66c2b760a01..cb63ccdbc21 100644 --- a/lib/app-scened-template/view_modules/dialog_ex_vm.h +++ b/lib/app-scened-template/view_modules/dialog_ex_vm.h @@ -4,7 +4,7 @@ class DialogExVM : public GenericViewModule { public: - DialogExVM(); + DialogExVM(void); ~DialogExVM() final; View* get_view() final; void clean() final; diff --git a/lib/app-scened-template/view_modules/popup_vm.h b/lib/app-scened-template/view_modules/popup_vm.h index 2665056393a..234f337746c 100644 --- a/lib/app-scened-template/view_modules/popup_vm.h +++ b/lib/app-scened-template/view_modules/popup_vm.h @@ -4,7 +4,7 @@ class PopupVM : public GenericViewModule { public: - PopupVM(); + PopupVM(void); ~PopupVM() final; View* get_view() final; void clean() final; @@ -56,12 +56,12 @@ class PopupVM : public GenericViewModule { /** * Enable popup timeout */ - void enable_timeout(); + void enable_timeout(void); /** * Disable popup timeout */ - void disable_timeout(); + void disable_timeout(void); private: Popup* popup; diff --git a/lib/app-scened-template/view_modules/submenu_vm.h b/lib/app-scened-template/view_modules/submenu_vm.h index 06541527a06..223fbd531e1 100644 --- a/lib/app-scened-template/view_modules/submenu_vm.h +++ b/lib/app-scened-template/view_modules/submenu_vm.h @@ -4,7 +4,7 @@ class SubmenuVM : public GenericViewModule { public: - SubmenuVM(); + SubmenuVM(void); ~SubmenuVM() final; View* get_view() final; void clean() final; diff --git a/lib/app-scened-template/view_modules/text_input_vm.h b/lib/app-scened-template/view_modules/text_input_vm.h index 81799e48cee..5c71c4318f8 100644 --- a/lib/app-scened-template/view_modules/text_input_vm.h +++ b/lib/app-scened-template/view_modules/text_input_vm.h @@ -4,7 +4,7 @@ class TextInputVM : public GenericViewModule { public: - TextInputVM(); + TextInputVM(void); ~TextInputVM() final; View* get_view() final; void clean() final; @@ -34,7 +34,7 @@ class TextInputVM : public GenericViewModule { void set_validator(TextInputValidatorCallback callback, void* callback_context); - void* get_validator_callback_context(); + void* get_validator_callback_context(void); private: TextInput* text_input; diff --git a/lib/bit_lib/bit_lib.c b/lib/bit_lib/bit_lib.c index e13ca95d48b..8122b1cc453 100644 --- a/lib/bit_lib/bit_lib.c +++ b/lib/bit_lib/bit_lib.c @@ -418,8 +418,8 @@ uint16_t bit_lib_crc16( } void bit_lib_num_to_bytes_be(uint64_t src, uint8_t len, uint8_t* dest) { - furi_assert(dest); - furi_assert(len <= 8); + furi_check(dest); + furi_check(len <= 8); while(len--) { dest[len] = (uint8_t)src; @@ -428,8 +428,8 @@ void bit_lib_num_to_bytes_be(uint64_t src, uint8_t len, uint8_t* dest) { } void bit_lib_num_to_bytes_le(uint64_t src, uint8_t len, uint8_t* dest) { - furi_assert(dest); - furi_assert(len <= 8); + furi_check(dest); + furi_check(len <= 8); for(int i = 0; i < len; i++) { dest[i] = (uint8_t)(src >> (8 * i)); @@ -437,8 +437,8 @@ void bit_lib_num_to_bytes_le(uint64_t src, uint8_t len, uint8_t* dest) { } uint64_t bit_lib_bytes_to_num_be(const uint8_t* src, uint8_t len) { - furi_assert(src); - furi_assert(len <= 8); + furi_check(src); + furi_check(len <= 8); uint64_t res = 0; while(len--) { @@ -449,8 +449,8 @@ uint64_t bit_lib_bytes_to_num_be(const uint8_t* src, uint8_t len) { } uint64_t bit_lib_bytes_to_num_le(const uint8_t* src, uint8_t len) { - furi_assert(src); - furi_assert(len <= 8); + furi_check(src); + furi_check(len <= 8); uint64_t res = 0; uint8_t shift = 0; @@ -462,8 +462,8 @@ uint64_t bit_lib_bytes_to_num_le(const uint8_t* src, uint8_t len) { } uint64_t bit_lib_bytes_to_num_bcd(const uint8_t* src, uint8_t len, bool* is_bcd) { - furi_assert(src); - furi_assert(len <= 9); + furi_check(src); + furi_check(len <= 9); uint64_t res = 0; uint8_t nibble_1, nibble_2; diff --git a/lib/ble_profile/extra_services/hid_service.c b/lib/ble_profile/extra_services/hid_service.c index d9ea09c1400..92422d5d505 100644 --- a/lib/ble_profile/extra_services/hid_service.c +++ b/lib/ble_profile/extra_services/hid_service.c @@ -169,7 +169,7 @@ static BleEventAckStatus ble_svc_hid_event_handler(void* event, void* context) { return ret; } -BleServiceHid* ble_svc_hid_start() { +BleServiceHid* ble_svc_hid_start(void) { BleServiceHid* hid_svc = malloc(sizeof(BleServiceHid)); // Register event handler diff --git a/lib/ble_profile/extra_services/hid_service.h b/lib/ble_profile/extra_services/hid_service.h index 8e9cc297507..9bbb8361124 100644 --- a/lib/ble_profile/extra_services/hid_service.h +++ b/lib/ble_profile/extra_services/hid_service.h @@ -9,7 +9,7 @@ extern "C" { typedef struct BleServiceHid BleServiceHid; -BleServiceHid* ble_svc_hid_start(); +BleServiceHid* ble_svc_hid_start(void); void ble_svc_hid_stop(BleServiceHid* service); diff --git a/lib/datetime/datetime.c b/lib/datetime/datetime.c index 73044fae60d..9c2194d968a 100644 --- a/lib/datetime/datetime.c +++ b/lib/datetime/datetime.c @@ -1,4 +1,5 @@ #include "datetime.h" +#include #define TAG "DateTime" @@ -37,6 +38,8 @@ bool datetime_validate_datetime(DateTime* datetime) { } uint32_t datetime_datetime_to_timestamp(DateTime* datetime) { + furi_check(datetime); + uint32_t timestamp = 0; uint8_t years = 0; uint8_t leap_years = 0; @@ -67,6 +70,7 @@ uint32_t datetime_datetime_to_timestamp(DateTime* datetime) { } void datetime_timestamp_to_datetime(uint32_t timestamp, DateTime* datetime) { + furi_check(datetime); uint32_t days = timestamp / SECONDS_PER_DAY; uint32_t seconds_in_day = timestamp % SECONDS_PER_DAY; diff --git a/lib/digital_signal/digital_sequence.c b/lib/digital_signal/digital_sequence.c index c85aae8c062..24dddb77de2 100644 --- a/lib/digital_signal/digital_sequence.c +++ b/lib/digital_signal/digital_sequence.c @@ -115,17 +115,17 @@ void digital_sequence_register_signal( DigitalSequence* sequence, uint8_t signal_index, const DigitalSignal* signal) { - furi_assert(sequence); - furi_assert(signal); - furi_assert(signal_index < DIGITAL_SEQUENCE_BANK_SIZE); + furi_check(sequence); + furi_check(signal); + furi_check(signal_index < DIGITAL_SEQUENCE_BANK_SIZE); sequence->signals[signal_index] = signal; } void digital_sequence_add_signal(DigitalSequence* sequence, uint8_t signal_index) { - furi_assert(sequence); - furi_assert(signal_index < DIGITAL_SEQUENCE_BANK_SIZE); - furi_assert(sequence->size < sequence->max_size); + furi_check(sequence); + furi_check(signal_index < DIGITAL_SEQUENCE_BANK_SIZE); + furi_check(sequence->size < sequence->max_size); sequence->data[sequence->size++] = signal_index; } @@ -140,14 +140,14 @@ static inline void digital_sequence_start_dma(DigitalSequence* sequence) { LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_2); } -static inline void digital_sequence_stop_dma() { +static inline void digital_sequence_stop_dma(void) { LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_1); LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_2); LL_DMA_ClearFlag_TC1(DMA1); LL_DMA_ClearFlag_TC2(DMA1); } -static inline void digital_sequence_start_timer() { +static inline void digital_sequence_start_timer(void) { furi_hal_bus_enable(FuriHalBusTIM2); LL_TIM_SetCounterMode(TIM2, LL_TIM_COUNTERMODE_UP); @@ -162,7 +162,7 @@ static inline void digital_sequence_start_timer() { LL_TIM_GenerateEvent_UPDATE(TIM2); } -static void digital_sequence_stop_timer() { +static void digital_sequence_stop_timer(void) { LL_TIM_DisableCounter(TIM2); LL_TIM_DisableUpdateEvent(TIM2); LL_TIM_DisableDMAReq_UPDATE(TIM2); @@ -280,9 +280,9 @@ static inline void digital_sequence_timer_buffer_reset(DigitalSequence* sequence } void digital_sequence_transmit(DigitalSequence* sequence) { - furi_assert(sequence); - furi_assert(sequence->size); - furi_assert(sequence->state == DigitalSequenceStateIdle); + furi_check(sequence); + furi_check(sequence->size); + furi_check(sequence->state == DigitalSequenceStateIdle); FURI_CRITICAL_ENTER(); diff --git a/lib/digital_signal/digital_signal.c b/lib/digital_signal/digital_signal.c index a0408900de8..585250c2614 100644 --- a/lib/digital_signal/digital_signal.c +++ b/lib/digital_signal/digital_signal.c @@ -15,33 +15,33 @@ DigitalSignal* digital_signal_alloc(uint32_t max_size) { } void digital_signal_free(DigitalSignal* signal) { - furi_assert(signal); + furi_check(signal); free(signal->data); free(signal); } bool digital_signal_get_start_level(const DigitalSignal* signal) { - furi_assert(signal); + furi_check(signal); return signal->start_level; } void digital_signal_set_start_level(DigitalSignal* signal, bool level) { - furi_assert(signal); + furi_check(signal); signal->start_level = level; } uint32_t digital_signal_get_size(const DigitalSignal* signal) { - furi_assert(signal); + furi_check(signal); return signal->size; } void digital_signal_add_period(DigitalSignal* signal, uint32_t ticks) { - furi_assert(signal); - furi_assert(signal->size < signal->max_size); + furi_check(signal); + furi_check(signal->size < signal->max_size); const uint32_t duration = ticks + signal->remainder; @@ -80,7 +80,7 @@ static void digital_signal_extend_last_period(DigitalSignal* signal, uint32_t ti } void digital_signal_add_period_with_level(DigitalSignal* signal, uint32_t ticks, bool level) { - furi_assert(signal); + furi_check(signal); if(signal->size == 0) { signal->start_level = level; diff --git a/lib/drivers/st25r3916_reg.c b/lib/drivers/st25r3916_reg.c index 8ac4672383c..76a8827557d 100644 --- a/lib/drivers/st25r3916_reg.c +++ b/lib/drivers/st25r3916_reg.c @@ -34,7 +34,7 @@ static void st25r3916_reg_tx_byte(FuriHalSpiBusHandle* handle, uint8_t byte) { } void st25r3916_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val) { - furi_assert(handle); + furi_check(handle); st25r3916_read_burst_regs(handle, reg, val, 1); } @@ -43,9 +43,9 @@ void st25r3916_read_burst_regs( uint8_t reg_start, uint8_t* values, uint8_t length) { - furi_assert(handle); - furi_assert(values); - furi_assert(length); + furi_check(handle); + furi_check(values); + furi_check(length); furi_hal_gpio_write(handle->cs, false); @@ -60,7 +60,7 @@ void st25r3916_read_burst_regs( } void st25r3916_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val) { - furi_assert(handle); + furi_check(handle); uint8_t reg_val = val; st25r3916_write_burst_regs(handle, reg, ®_val, 1); } @@ -70,9 +70,9 @@ void st25r3916_write_burst_regs( uint8_t reg_start, const uint8_t* values, uint8_t length) { - furi_assert(handle); - furi_assert(values); - furi_assert(length); + furi_check(handle); + furi_check(values); + furi_check(length); furi_hal_gpio_write(handle->cs, false); @@ -87,10 +87,10 @@ void st25r3916_write_burst_regs( } void st25r3916_reg_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, size_t length) { - furi_assert(handle); - furi_assert(buff); - furi_assert(length); - furi_assert(length <= ST25R3916_FIFO_DEPTH); + furi_check(handle); + furi_check(buff); + furi_check(length); + furi_check(length <= ST25R3916_FIFO_DEPTH); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_FIFO_LOAD); @@ -99,10 +99,10 @@ void st25r3916_reg_write_fifo(FuriHalSpiBusHandle* handle, const uint8_t* buff, } void st25r3916_reg_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) { - furi_assert(handle); - furi_assert(buff); - furi_assert(length); - furi_assert(length <= ST25R3916_FIFO_DEPTH); + furi_check(handle); + furi_check(buff); + furi_check(length); + furi_check(length <= ST25R3916_FIFO_DEPTH); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_FIFO_READ); @@ -111,10 +111,10 @@ void st25r3916_reg_read_fifo(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t } void st25r3916_write_pta_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, size_t length) { - furi_assert(handle); - furi_assert(values); - furi_assert(length); - furi_assert(length <= ST25R3916_PTM_LEN); + furi_check(handle); + furi_check(values); + furi_check(length); + furi_check(length <= ST25R3916_PTM_LEN); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_PT_A_CONFIG_LOAD); @@ -123,10 +123,10 @@ void st25r3916_write_pta_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, } void st25r3916_read_pta_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) { - furi_assert(handle); - furi_assert(buff); - furi_assert(length); - furi_assert(length <= ST25R3916_PTM_LEN); + furi_check(handle); + furi_check(buff); + furi_check(length); + furi_check(length <= ST25R3916_PTM_LEN); uint8_t tmp_buff[ST25R3916_PTM_LEN + 1]; furi_hal_gpio_write(handle->cs, false); @@ -137,8 +137,8 @@ void st25r3916_read_pta_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t l } void st25r3916_write_ptf_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, size_t length) { - furi_assert(handle); - furi_assert(values); + furi_check(handle); + furi_check(values); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_PT_F_CONFIG_LOAD); @@ -147,8 +147,8 @@ void st25r3916_write_ptf_mem(FuriHalSpiBusHandle* handle, const uint8_t* values, } void st25r3916_write_pttsn_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_t length) { - furi_assert(handle); - furi_assert(buff); + furi_check(handle); + furi_check(buff); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_PT_TSN_DATA_LOAD); @@ -157,7 +157,7 @@ void st25r3916_write_pttsn_mem(FuriHalSpiBusHandle* handle, uint8_t* buff, size_ } void st25r3916_direct_cmd(FuriHalSpiBusHandle* handle, uint8_t cmd) { - furi_assert(handle); + furi_check(handle); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, cmd | ST25R3916_CMD_MODE); @@ -165,7 +165,7 @@ void st25r3916_direct_cmd(FuriHalSpiBusHandle* handle, uint8_t cmd) { } void st25r3916_read_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* val) { - furi_assert(handle); + furi_check(handle); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_CMD_TEST_ACCESS); @@ -175,7 +175,7 @@ void st25r3916_read_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* } void st25r3916_write_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t val) { - furi_assert(handle); + furi_check(handle); furi_hal_gpio_write(handle->cs, false); st25r3916_reg_tx_byte(handle, ST25R3916_CMD_TEST_ACCESS); @@ -185,7 +185,7 @@ void st25r3916_write_test_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t } void st25r3916_clear_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t clr_mask) { - furi_assert(handle); + furi_check(handle); uint8_t reg_val = 0; st25r3916_read_reg(handle, reg, ®_val); @@ -196,7 +196,7 @@ void st25r3916_clear_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t } void st25r3916_set_reg_bits(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t set_mask) { - furi_assert(handle); + furi_check(handle); uint8_t reg_val = 0; st25r3916_read_reg(handle, reg, ®_val); @@ -211,7 +211,7 @@ void st25r3916_change_reg_bits( uint8_t reg, uint8_t mask, uint8_t value) { - furi_assert(handle); + furi_check(handle); st25r3916_modify_reg(handle, reg, mask, (mask & value)); } @@ -221,7 +221,7 @@ void st25r3916_modify_reg( uint8_t reg, uint8_t clr_mask, uint8_t set_mask) { - furi_assert(handle); + furi_check(handle); uint8_t reg_val = 0; uint8_t new_val = 0; @@ -237,7 +237,7 @@ void st25r3916_change_test_reg_bits( uint8_t reg, uint8_t mask, uint8_t value) { - furi_assert(handle); + furi_check(handle); uint8_t reg_val = 0; uint8_t new_val = 0; @@ -249,7 +249,7 @@ void st25r3916_change_test_reg_bits( } bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask, uint8_t val) { - furi_assert(handle); + furi_check(handle); uint8_t reg_val = 0; st25r3916_read_reg(handle, reg, ®_val); diff --git a/lib/flipper_application/api_hashtable/api_hashtable.cpp b/lib/flipper_application/api_hashtable/api_hashtable.cpp index 11f2d7ecfbf..861eece795e 100644 --- a/lib/flipper_application/api_hashtable/api_hashtable.cpp +++ b/lib/flipper_application/api_hashtable/api_hashtable.cpp @@ -9,6 +9,10 @@ bool elf_resolve_from_hashtable( const ElfApiInterface* interface, uint32_t hash, Elf32_Addr* address) { + + furi_check(interface); + furi_check(address); + bool result = false; const HashtableApiInterface* hashtable_interface = static_cast(interface); @@ -33,5 +37,6 @@ bool elf_resolve_from_hashtable( } uint32_t elf_symbolname_hash(const char* s) { + furi_check(s); return elf_gnu_hash(s); } \ No newline at end of file diff --git a/lib/flipper_application/application_manifest.c b/lib/flipper_application/application_manifest.c index addbd5e4cb1..dfe18e24921 100644 --- a/lib/flipper_application/application_manifest.c +++ b/lib/flipper_application/application_manifest.c @@ -1,8 +1,11 @@ #include "application_manifest.h" #include +#include bool flipper_application_manifest_is_valid(const FlipperApplicationManifest* manifest) { + furi_check(manifest); + if((manifest->base.manifest_magic != FAP_MANIFEST_MAGIC) || (manifest->base.manifest_version != FAP_MANIFEST_SUPPORTED_VERSION)) { return false; @@ -14,6 +17,9 @@ bool flipper_application_manifest_is_valid(const FlipperApplicationManifest* man bool flipper_application_manifest_is_too_old( const FlipperApplicationManifest* manifest, const ElfApiInterface* api_interface) { + furi_check(manifest); + furi_check(api_interface); + if(manifest->base.api_version.major < api_interface->api_version_major /* || manifest->base.api_version.minor > app->api_interface->api_version_minor */) { return false; @@ -25,6 +31,9 @@ bool flipper_application_manifest_is_too_old( bool flipper_application_manifest_is_too_new( const FlipperApplicationManifest* manifest, const ElfApiInterface* api_interface) { + furi_check(manifest); + furi_check(api_interface); + if(manifest->base.api_version.major > api_interface->api_version_major /* || manifest->base.api_version.minor > app->api_interface->api_version_minor */) { return false; @@ -34,6 +43,8 @@ bool flipper_application_manifest_is_too_new( } bool flipper_application_manifest_is_target_compatible(const FlipperApplicationManifest* manifest) { + furi_check(manifest); + const Version* version = furi_hal_version_get_firmware_version(); return version_get_target(version) == manifest->base.hardware_target_id; } \ No newline at end of file diff --git a/lib/flipper_application/flipper_application.c b/lib/flipper_application/flipper_application.c index d56a8a7ef06..3c4a07f2f97 100644 --- a/lib/flipper_application/flipper_application.c +++ b/lib/flipper_application/flipper_application.c @@ -24,7 +24,7 @@ FlipperApplicationList_t flipper_application_loaded_app_list = {0}; static bool flipper_application_loaded_app_list_initialized = false; static void flipper_application_list_add_app(const FlipperApplication* app) { - furi_assert(app); + furi_check(app); if(!flipper_application_loaded_app_list_initialized) { FlipperApplicationList_init(flipper_application_loaded_app_list); @@ -34,8 +34,8 @@ static void flipper_application_list_add_app(const FlipperApplication* app) { } static void flipper_application_list_remove_app(const FlipperApplication* app) { - furi_assert(flipper_application_loaded_app_list_initialized); - furi_assert(app); + furi_check(flipper_application_loaded_app_list_initialized); + furi_check(app); FlipperApplicationList_it_t it; for(FlipperApplicationList_it(it, flipper_application_loaded_app_list); @@ -52,19 +52,24 @@ static void flipper_application_list_remove_app(const FlipperApplication* app) { FlipperApplication* flipper_application_alloc(Storage* storage, const ElfApiInterface* api_interface) { + furi_check(storage); + furi_check(api_interface); + FlipperApplication* app = malloc(sizeof(FlipperApplication)); app->elf = elf_file_alloc(storage, api_interface); app->thread = NULL; app->ep_thread_args = NULL; + return app; } bool flipper_application_is_plugin(FlipperApplication* app) { + furi_check(app); return app->manifest.stack_size == 0; } void flipper_application_free(FlipperApplication* app) { - furi_assert(app); + furi_check(app); if(app->thread) { furi_thread_join(app->thread); @@ -184,20 +189,29 @@ static FlipperApplicationPreloadStatus /* Parse headers, load manifest */ FlipperApplicationPreloadStatus flipper_application_preload_manifest(FlipperApplication* app, const char* path) { + furi_check(app); + furi_check(path); + return flipper_application_load(app, path, false); } /* Parse headers, load full file */ FlipperApplicationPreloadStatus flipper_application_preload(FlipperApplication* app, const char* path) { + furi_check(app); + furi_check(path); + return flipper_application_load(app, path, true); } const FlipperApplicationManifest* flipper_application_get_manifest(FlipperApplication* app) { + furi_check(app); return &app->manifest; } FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplication* app) { + furi_check(app); + ELFFileLoadStatus status = elf_file_load_sections(app->elf); switch(status) { @@ -215,7 +229,7 @@ FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplicatio } static int32_t flipper_application_thread(void* context) { - furi_assert(context); + furi_check(context); FlipperApplication* app = (FlipperApplication*)context; elf_file_call_init(app->elf); @@ -237,6 +251,7 @@ static int32_t flipper_application_thread(void* context) { } FuriThread* flipper_application_alloc_thread(FlipperApplication* app, const char* args) { + furi_check(app); furi_check(app->thread == NULL); furi_check(!flipper_application_is_plugin(app)); @@ -290,6 +305,8 @@ const char* flipper_application_load_status_to_string(FlipperApplicationLoadStat const FlipperAppPluginDescriptor* flipper_application_plugin_get_descriptor(FlipperApplication* app) { + furi_check(app); + if(!flipper_application_is_plugin(app)) { return NULL; } @@ -318,6 +335,11 @@ bool flipper_application_load_name_and_icon( Storage* storage, uint8_t** icon_ptr, FuriString* item_name) { + furi_check(path); + furi_check(storage); + furi_check(icon_ptr); + furi_check(item_name); + FlipperApplication* app = flipper_application_alloc(storage, firmware_api_interface); FlipperApplicationPreloadStatus preload_res = diff --git a/lib/flipper_application/plugins/composite_resolver.c b/lib/flipper_application/plugins/composite_resolver.c index 7cc2b340a96..03dcd95e7a7 100644 --- a/lib/flipper_application/plugins/composite_resolver.c +++ b/lib/flipper_application/plugins/composite_resolver.c @@ -1,5 +1,6 @@ #include "composite_resolver.h" +#include #include #include @@ -25,21 +26,28 @@ static bool composite_api_resolver_callback( return false; } -CompositeApiResolver* composite_api_resolver_alloc() { +CompositeApiResolver* composite_api_resolver_alloc(void) { CompositeApiResolver* resolver = malloc(sizeof(CompositeApiResolver)); + resolver->api_interface.api_version_major = 0; resolver->api_interface.api_version_minor = 0; resolver->api_interface.resolver_callback = &composite_api_resolver_callback; ElfApiInterfaceList_init(resolver->interfaces); + return resolver; } void composite_api_resolver_free(CompositeApiResolver* resolver) { + furi_check(resolver); + ElfApiInterfaceList_clear(resolver->interfaces); free(resolver); } void composite_api_resolver_add(CompositeApiResolver* resolver, const ElfApiInterface* interface) { + furi_check(resolver); + furi_check(interface); + if(ElfApiInterfaceList_empty_p(resolver->interfaces)) { resolver->api_interface.api_version_major = interface->api_version_major; resolver->api_interface.api_version_minor = interface->api_version_minor; @@ -48,5 +56,6 @@ void composite_api_resolver_add(CompositeApiResolver* resolver, const ElfApiInte } const ElfApiInterface* composite_api_resolver_get(CompositeApiResolver* resolver) { + furi_check(resolver); return &resolver->api_interface; } diff --git a/lib/flipper_application/plugins/composite_resolver.h b/lib/flipper_application/plugins/composite_resolver.h index a2d4bab25e8..d8a22887f8e 100644 --- a/lib/flipper_application/plugins/composite_resolver.h +++ b/lib/flipper_application/plugins/composite_resolver.h @@ -19,7 +19,7 @@ typedef struct CompositeApiResolver CompositeApiResolver; * @brief Allocate composite API resolver * @return CompositeApiResolver* instance */ -CompositeApiResolver* composite_api_resolver_alloc(); +CompositeApiResolver* composite_api_resolver_alloc(void); /** * @brief Free composite API resolver diff --git a/lib/flipper_application/plugins/plugin_manager.c b/lib/flipper_application/plugins/plugin_manager.c index 8f30ed13ec5..d0e294220e8 100644 --- a/lib/flipper_application/plugins/plugin_manager.c +++ b/lib/flipper_application/plugins/plugin_manager.c @@ -36,6 +36,8 @@ PluginManager* plugin_manager_alloc( } void plugin_manager_free(PluginManager* manager) { + furi_check(manager); + for M_EACH(loaded_lib, manager->libs, FlipperApplicationList_t) { flipper_application_free(*loaded_lib); @@ -46,6 +48,7 @@ void plugin_manager_free(PluginManager* manager) { } PluginManagerError plugin_manager_load_single(PluginManager* manager, const char* path) { + furi_check(manager); FlipperApplication* lib = flipper_application_alloc(manager->storage, manager->api_interface); PluginManagerError error = PluginManagerErrorNone; @@ -103,6 +106,7 @@ PluginManagerError plugin_manager_load_single(PluginManager* manager, const char } PluginManagerError plugin_manager_load_all(PluginManager* manager, const char* path) { + furi_check(manager); File* directory = storage_file_alloc(manager->storage); char file_name_buffer[256]; FuriString* file_name = furi_string_alloc(); @@ -139,15 +143,21 @@ PluginManagerError plugin_manager_load_all(PluginManager* manager, const char* p } uint32_t plugin_manager_get_count(PluginManager* manager) { + furi_check(manager); + return FlipperApplicationList_size(manager->libs); } const FlipperAppPluginDescriptor* plugin_manager_get(PluginManager* manager, uint32_t index) { + furi_check(manager); + FlipperApplication* app = *FlipperApplicationList_get(manager->libs, index); return flipper_application_plugin_get_descriptor(app); } const void* plugin_manager_get_ep(PluginManager* manager, uint32_t index) { + furi_check(manager); + const FlipperAppPluginDescriptor* lib_descr = plugin_manager_get(manager, index); furi_check(lib_descr); return lib_descr->entry_point; diff --git a/lib/flipper_format/flipper_format.c b/lib/flipper_format/flipper_format.c index bb1aa59f586..8992247d1fb 100644 --- a/lib/flipper_format/flipper_format.c +++ b/lib/flipper_format/flipper_format.c @@ -23,7 +23,7 @@ Stream* flipper_format_get_raw_stream(FlipperFormat* flipper_format) { /********************************** Public **********************************/ -FlipperFormat* flipper_format_string_alloc() { +FlipperFormat* flipper_format_string_alloc(void) { FlipperFormat* flipper_format = malloc(sizeof(FlipperFormat)); flipper_format->stream = string_stream_alloc(); flipper_format->strict_mode = false; @@ -45,18 +45,18 @@ FlipperFormat* flipper_format_buffered_file_alloc(Storage* storage) { } bool flipper_format_file_open_existing(FlipperFormat* flipper_format, const char* path) { - furi_assert(flipper_format); + furi_check(flipper_format); return file_stream_open(flipper_format->stream, path, FSAM_READ_WRITE, FSOM_OPEN_EXISTING); } bool flipper_format_buffered_file_open_existing(FlipperFormat* flipper_format, const char* path) { - furi_assert(flipper_format); + furi_check(flipper_format); return buffered_file_stream_open( flipper_format->stream, path, FSAM_READ_WRITE, FSOM_OPEN_EXISTING); } bool flipper_format_file_open_append(FlipperFormat* flipper_format, const char* path) { - furi_assert(flipper_format); + furi_check(flipper_format); bool result = file_stream_open(flipper_format->stream, path, FSAM_READ_WRITE, FSOM_OPEN_APPEND); @@ -87,33 +87,33 @@ bool flipper_format_file_open_append(FlipperFormat* flipper_format, const char* } bool flipper_format_file_open_always(FlipperFormat* flipper_format, const char* path) { - furi_assert(flipper_format); + furi_check(flipper_format); return file_stream_open(flipper_format->stream, path, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS); } bool flipper_format_buffered_file_open_always(FlipperFormat* flipper_format, const char* path) { - furi_assert(flipper_format); + furi_check(flipper_format); return buffered_file_stream_open( flipper_format->stream, path, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS); } bool flipper_format_file_open_new(FlipperFormat* flipper_format, const char* path) { - furi_assert(flipper_format); + furi_check(flipper_format); return file_stream_open(flipper_format->stream, path, FSAM_READ_WRITE, FSOM_CREATE_NEW); } bool flipper_format_file_close(FlipperFormat* flipper_format) { - furi_assert(flipper_format); + furi_check(flipper_format); return file_stream_close(flipper_format->stream); } bool flipper_format_buffered_file_close(FlipperFormat* flipper_format) { - furi_assert(flipper_format); + furi_check(flipper_format); return buffered_file_stream_close(flipper_format->stream); } void flipper_format_free(FlipperFormat* flipper_format) { - furi_assert(flipper_format); + furi_check(flipper_format); stream_free(flipper_format->stream); free(flipper_format); } @@ -123,12 +123,12 @@ void flipper_format_set_strict_mode(FlipperFormat* flipper_format, bool strict_m } bool flipper_format_rewind(FlipperFormat* flipper_format) { - furi_assert(flipper_format); + furi_check(flipper_format); return stream_rewind(flipper_format->stream); } bool flipper_format_seek_to_end(FlipperFormat* flipper_format) { - furi_assert(flipper_format); + furi_check(flipper_format); return stream_seek(flipper_format->stream, 0, StreamOffsetFromEnd); } @@ -145,7 +145,7 @@ bool flipper_format_read_header( FlipperFormat* flipper_format, FuriString* filetype, uint32_t* version) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_read_string(flipper_format, flipper_format_filetype_key, filetype) && flipper_format_read_uint32(flipper_format, flipper_format_version_key, version, 1); } @@ -154,7 +154,7 @@ bool flipper_format_write_header( FlipperFormat* flipper_format, FuriString* filetype, const uint32_t version) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_write_header_cstr( flipper_format, furi_string_get_cstr(filetype), version); } @@ -163,7 +163,7 @@ bool flipper_format_write_header_cstr( FlipperFormat* flipper_format, const char* filetype, const uint32_t version) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_write_string_cstr( flipper_format, flipper_format_filetype_key, filetype) && flipper_format_write_uint32(flipper_format, flipper_format_version_key, &version, 1); @@ -173,19 +173,19 @@ bool flipper_format_get_value_count( FlipperFormat* flipper_format, const char* key, uint32_t* count) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_stream_get_value_count( flipper_format->stream, key, count, flipper_format->strict_mode); } bool flipper_format_read_string(FlipperFormat* flipper_format, const char* key, FuriString* data) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_stream_read_value_line( flipper_format->stream, key, FlipperStreamValueStr, data, 1, flipper_format->strict_mode); } bool flipper_format_write_string(FlipperFormat* flipper_format, const char* key, FuriString* data) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueStr, @@ -200,7 +200,7 @@ bool flipper_format_write_string_cstr( FlipperFormat* flipper_format, const char* key, const char* data) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueStr, @@ -216,7 +216,7 @@ bool flipper_format_read_hex_uint64( const char* key, uint64_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_stream_read_value_line( flipper_format->stream, key, @@ -231,7 +231,7 @@ bool flipper_format_write_hex_uint64( const char* key, const uint64_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueHexUint64, @@ -247,7 +247,7 @@ bool flipper_format_read_uint32( const char* key, uint32_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_stream_read_value_line( flipper_format->stream, key, @@ -262,7 +262,7 @@ bool flipper_format_write_uint32( const char* key, const uint32_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueUint32, @@ -292,7 +292,7 @@ bool flipper_format_write_int32( const char* key, const int32_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueInt32, @@ -322,7 +322,7 @@ bool flipper_format_write_bool( const char* key, const bool* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueBool, @@ -352,7 +352,7 @@ bool flipper_format_write_float( const char* key, const float* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueFloat, @@ -382,7 +382,7 @@ bool flipper_format_write_hex( const char* key, const uint8_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueHex, @@ -394,17 +394,17 @@ bool flipper_format_write_hex( } bool flipper_format_write_comment(FlipperFormat* flipper_format, FuriString* data) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_write_comment_cstr(flipper_format, furi_string_get_cstr(data)); } bool flipper_format_write_comment_cstr(FlipperFormat* flipper_format, const char* data) { - furi_assert(flipper_format); + furi_check(flipper_format); return flipper_format_stream_write_comment_cstr(flipper_format->stream, data); } bool flipper_format_delete_key(FlipperFormat* flipper_format, const char* key) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueIgnore, @@ -417,7 +417,7 @@ bool flipper_format_delete_key(FlipperFormat* flipper_format, const char* key) { } bool flipper_format_update_string(FlipperFormat* flipper_format, const char* key, FuriString* data) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueStr, @@ -433,7 +433,7 @@ bool flipper_format_update_string_cstr( FlipperFormat* flipper_format, const char* key, const char* data) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueStr, @@ -450,7 +450,7 @@ bool flipper_format_update_uint32( const char* key, const uint32_t* data, const uint16_t data_size) { - furi_assert(flipper_format); + furi_check(flipper_format); FlipperStreamWriteData write_data = { .key = key, .type = FlipperStreamValueUint32, diff --git a/lib/flipper_format/flipper_format.h b/lib/flipper_format/flipper_format.h index 671ff6fa0cc..c8f5278ed78 100644 --- a/lib/flipper_format/flipper_format.h +++ b/lib/flipper_format/flipper_format.h @@ -106,7 +106,7 @@ typedef struct FlipperFormat FlipperFormat; * Allocate FlipperFormat as string. * @return FlipperFormat* pointer to a FlipperFormat instance */ -FlipperFormat* flipper_format_string_alloc(); +FlipperFormat* flipper_format_string_alloc(void); /** * Allocate FlipperFormat as file. diff --git a/lib/ibutton/ibutton_key.c b/lib/ibutton/ibutton_key.c index 926a826a26e..cf98ea313f3 100644 --- a/lib/ibutton/ibutton_key.c +++ b/lib/ibutton/ibutton_key.c @@ -1,4 +1,5 @@ #include "ibutton_key_i.h" +#include struct iButtonKey { iButtonProtocolId protocol_id; @@ -17,20 +18,28 @@ iButtonKey* ibutton_key_alloc(size_t data_size) { } void ibutton_key_free(iButtonKey* key) { + furi_check(key); + free(key->protocol_data); free(key); } void ibutton_key_reset(iButtonKey* key) { + furi_check(key); + key->protocol_id = iButtonProtocolIdInvalid; + memset(key->protocol_data, 0, key->protocol_data_size); } iButtonProtocolId ibutton_key_get_protocol_id(const iButtonKey* key) { + furi_check(key); + return key->protocol_id; } void ibutton_key_set_protocol_id(iButtonKey* key, iButtonProtocolId protocol_id) { + furi_check(key); key->protocol_id = protocol_id; } diff --git a/lib/ibutton/ibutton_protocols.c b/lib/ibutton/ibutton_protocols.c index df74126708c..ce4392475b8 100644 --- a/lib/ibutton/ibutton_protocols.c +++ b/lib/ibutton/ibutton_protocols.c @@ -51,7 +51,7 @@ static void ibutton_protocols_get_group_by_id( furi_crash(); } -iButtonProtocols* ibutton_protocols_alloc() { +iButtonProtocols* ibutton_protocols_alloc(void) { iButtonProtocols* protocols = malloc(sizeof(iButtonProtocols*)); protocols->group_datas = malloc(sizeof(iButtonProtocolGroupData*) * iButtonProtocolGroupMax); @@ -64,6 +64,8 @@ iButtonProtocols* ibutton_protocols_alloc() { } void ibutton_protocols_free(iButtonProtocols* protocols) { + furi_check(protocols); + for(iButtonProtocolGroupId i = 0; i < iButtonProtocolGroupMax; ++i) { ibutton_protocol_groups[i]->free(protocols->group_datas[i]); } @@ -72,7 +74,7 @@ void ibutton_protocols_free(iButtonProtocols* protocols) { free(protocols); } -uint32_t ibutton_protocols_get_protocol_count() { +uint32_t ibutton_protocols_get_protocol_count(void) { uint32_t count = 0; for(iButtonProtocolGroupId i = 0; i < iButtonProtocolGroupMax; ++i) { @@ -83,6 +85,9 @@ uint32_t ibutton_protocols_get_protocol_count() { } iButtonProtocolId ibutton_protocols_get_id_by_name(iButtonProtocols* protocols, const char* name) { + furi_check(protocols); + furi_check(name); + iButtonProtocolLocalId offset = 0; for(iButtonProtocolGroupId i = 0; i < iButtonProtocolGroupMax; ++i) { @@ -96,11 +101,16 @@ iButtonProtocolId ibutton_protocols_get_id_by_name(iButtonProtocols* protocols, } uint32_t ibutton_protocols_get_features(iButtonProtocols* protocols, iButtonProtocolId id) { + furi_check(protocols); + GET_PROTOCOL_GROUP(id); + return GROUP_BASE->get_features(GROUP_DATA, PROTOCOL_ID); } size_t ibutton_protocols_get_max_data_size(iButtonProtocols* protocols) { + furi_check(protocols); + size_t max_size = 0; for(iButtonProtocolGroupId i = 0; i < iButtonProtocolGroupMax; ++i) { @@ -115,16 +125,25 @@ size_t ibutton_protocols_get_max_data_size(iButtonProtocols* protocols) { } const char* ibutton_protocols_get_manufacturer(iButtonProtocols* protocols, iButtonProtocolId id) { + furi_check(protocols); + GET_PROTOCOL_GROUP(id); + return GROUP_BASE->get_manufacturer(GROUP_DATA, PROTOCOL_ID); } const char* ibutton_protocols_get_name(iButtonProtocols* protocols, iButtonProtocolId id) { + furi_check(protocols); + GET_PROTOCOL_GROUP(id); + return GROUP_BASE->get_name(GROUP_DATA, PROTOCOL_ID); } bool ibutton_protocols_read(iButtonProtocols* protocols, iButtonKey* key) { + furi_check(protocols); + furi_check(key); + iButtonProtocolLocalId id = iButtonProtocolIdInvalid; iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -142,6 +161,9 @@ bool ibutton_protocols_read(iButtonProtocols* protocols, iButtonKey* key) { } bool ibutton_protocols_write_blank(iButtonProtocols* protocols, iButtonKey* key) { + furi_check(protocols); + furi_check(key); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -150,6 +172,9 @@ bool ibutton_protocols_write_blank(iButtonProtocols* protocols, iButtonKey* key) } bool ibutton_protocols_write_copy(iButtonProtocols* protocols, iButtonKey* key) { + furi_check(protocols); + furi_check(key); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -158,6 +183,9 @@ bool ibutton_protocols_write_copy(iButtonProtocols* protocols, iButtonKey* key) } void ibutton_protocols_emulate_start(iButtonProtocols* protocols, iButtonKey* key) { + furi_check(protocols); + furi_check(key); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -166,6 +194,9 @@ void ibutton_protocols_emulate_start(iButtonProtocols* protocols, iButtonKey* ke } void ibutton_protocols_emulate_stop(iButtonProtocols* protocols, iButtonKey* key) { + furi_check(protocols); + furi_check(key); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -177,6 +208,10 @@ bool ibutton_protocols_save( iButtonProtocols* protocols, const iButtonKey* key, const char* file_name) { + furi_check(protocols); + furi_check(key); + furi_check(file_name); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); const iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -207,6 +242,10 @@ bool ibutton_protocols_save( } bool ibutton_protocols_load(iButtonProtocols* protocols, iButtonKey* key, const char* file_name) { + furi_check(protocols); + furi_check(key); + furi_check(file_name); + iButtonProtocolData* data = ibutton_key_get_protocol_data(key); bool success = false; @@ -252,6 +291,10 @@ void ibutton_protocols_render_data( iButtonProtocols* protocols, const iButtonKey* key, FuriString* result) { + furi_check(protocols); + furi_check(key); + furi_check(result); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); const iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -263,6 +306,10 @@ void ibutton_protocols_render_brief_data( iButtonProtocols* protocols, const iButtonKey* key, FuriString* result) { + furi_check(protocols); + furi_check(key); + furi_check(result); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); const iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -274,6 +321,10 @@ void ibutton_protocols_render_error( iButtonProtocols* protocols, const iButtonKey* key, FuriString* result) { + furi_check(protocols); + furi_check(key); + furi_check(result); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); const iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -282,6 +333,9 @@ void ibutton_protocols_render_error( } bool ibutton_protocols_is_valid(iButtonProtocols* protocols, const iButtonKey* key) { + furi_check(protocols); + furi_check(key); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); const iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -293,6 +347,10 @@ void ibutton_protocols_get_editable_data( iButtonProtocols* protocols, const iButtonKey* key, iButtonEditableData* editable) { + furi_check(protocols); + furi_check(key); + furi_check(editable); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); iButtonProtocolData* data = ibutton_key_get_protocol_data(key); @@ -301,6 +359,9 @@ void ibutton_protocols_get_editable_data( } void ibutton_protocols_apply_edits(iButtonProtocols* protocols, const iButtonKey* key) { + furi_check(protocols); + furi_check(key); + const iButtonProtocolId id = ibutton_key_get_protocol_id(key); iButtonProtocolData* data = ibutton_key_get_protocol_data(key); diff --git a/lib/ibutton/ibutton_protocols.h b/lib/ibutton/ibutton_protocols.h index 0e7ed0a804a..ec4a9fc7239 100644 --- a/lib/ibutton/ibutton_protocols.h +++ b/lib/ibutton/ibutton_protocols.h @@ -23,7 +23,7 @@ typedef struct iButtonProtocols iButtonProtocols; * Allocate an iButtonProtocols object * @return pointer to an iButtonProtocols object */ -iButtonProtocols* ibutton_protocols_alloc(); +iButtonProtocols* ibutton_protocols_alloc(void); /** * Destroy an iButtonProtocols object, free resources @@ -34,7 +34,7 @@ void ibutton_protocols_free(iButtonProtocols* protocols); /** * Get the total number of available protocols */ -uint32_t ibutton_protocols_get_protocol_count(); +uint32_t ibutton_protocols_get_protocol_count(void); /** * Get maximum data size out of all protocols available diff --git a/lib/ibutton/ibutton_worker.c b/lib/ibutton/ibutton_worker.c index d40dba71aeb..2874f120ff4 100644 --- a/lib/ibutton/ibutton_worker.c +++ b/lib/ibutton/ibutton_worker.c @@ -23,6 +23,8 @@ typedef struct { static int32_t ibutton_worker_thread(void* thread_context); iButtonWorker* ibutton_worker_alloc(iButtonProtocols* protocols) { + furi_check(protocols); + iButtonWorker* worker = malloc(sizeof(iButtonWorker)); worker->protocols = protocols; @@ -38,7 +40,9 @@ void ibutton_worker_read_set_callback( iButtonWorker* worker, iButtonWorkerReadCallback callback, void* context) { + furi_check(worker); furi_check(worker->mode_index == iButtonWorkerModeIdle); + worker->read_cb = callback; worker->cb_ctx = context; } @@ -47,7 +51,9 @@ void ibutton_worker_write_set_callback( iButtonWorker* worker, iButtonWorkerWriteCallback callback, void* context) { + furi_check(worker); furi_check(worker->mode_index == iButtonWorkerModeIdle); + worker->write_cb = callback; worker->cb_ctx = context; } @@ -56,55 +62,83 @@ void ibutton_worker_emulate_set_callback( iButtonWorker* worker, iButtonWorkerEmulateCallback callback, void* context) { + furi_check(worker); furi_check(worker->mode_index == iButtonWorkerModeIdle); + worker->emulate_cb = callback; worker->cb_ctx = context; } void ibutton_worker_read_start(iButtonWorker* worker, iButtonKey* key) { + furi_check(worker); + iButtonMessage message = {.type = iButtonMessageRead, .data.key = key}; + furi_check( furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk); } void ibutton_worker_write_blank_start(iButtonWorker* worker, iButtonKey* key) { + furi_check(worker); + furi_check(key); + iButtonMessage message = {.type = iButtonMessageWriteBlank, .data.key = key}; + furi_check( furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk); } void ibutton_worker_write_copy_start(iButtonWorker* worker, iButtonKey* key) { + furi_check(worker); + furi_check(key); + iButtonMessage message = {.type = iButtonMessageWriteCopy, .data.key = key}; + furi_check( furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk); } void ibutton_worker_emulate_start(iButtonWorker* worker, iButtonKey* key) { + furi_check(worker); + iButtonMessage message = {.type = iButtonMessageEmulate, .data.key = key}; + furi_check( furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk); } void ibutton_worker_stop(iButtonWorker* worker) { + furi_check(worker); + iButtonMessage message = {.type = iButtonMessageStop}; + furi_check( furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk); } void ibutton_worker_free(iButtonWorker* worker) { + furi_check(worker); + furi_message_queue_free(worker->messages); furi_thread_free(worker->thread); + free(worker); } void ibutton_worker_start_thread(iButtonWorker* worker) { + furi_check(worker); + furi_thread_start(worker->thread); } void ibutton_worker_stop_thread(iButtonWorker* worker) { + furi_check(worker); + iButtonMessage message = {.type = iButtonMessageEnd}; + furi_check( furi_message_queue_put(worker->messages, &message, FuriWaitForever) == FuriStatusOk); + furi_thread_join(worker->thread); } diff --git a/lib/ibutton/protocols/dallas/protocol_group_dallas.c b/lib/ibutton/protocols/dallas/protocol_group_dallas.c index 63ec97855ab..39cabbeb45e 100644 --- a/lib/ibutton/protocols/dallas/protocol_group_dallas.c +++ b/lib/ibutton/protocols/dallas/protocol_group_dallas.c @@ -11,7 +11,7 @@ typedef struct { OneWireSlave* bus; } iButtonProtocolGroupDallas; -static iButtonProtocolGroupDallas* ibutton_protocol_group_dallas_alloc() { +static iButtonProtocolGroupDallas* ibutton_protocol_group_dallas_alloc(void) { iButtonProtocolGroupDallas* group = malloc(sizeof(iButtonProtocolGroupDallas)); group->host = onewire_host_alloc(&gpio_ibutton); diff --git a/lib/ibutton/protocols/misc/protocol_group_misc.c b/lib/ibutton/protocols/misc/protocol_group_misc.c index dad1ef3cfee..20534602d1e 100644 --- a/lib/ibutton/protocols/misc/protocol_group_misc.c +++ b/lib/ibutton/protocols/misc/protocol_group_misc.c @@ -16,7 +16,7 @@ typedef struct { ProtocolId emulate_id; } iButtonProtocolGroupMisc; -static iButtonProtocolGroupMisc* ibutton_protocol_group_misc_alloc() { +static iButtonProtocolGroupMisc* ibutton_protocol_group_misc_alloc(void) { iButtonProtocolGroupMisc* group = malloc(sizeof(iButtonProtocolGroupMisc)); group->dict = protocol_dict_alloc(ibutton_protocols_misc, iButtonProtocolMiscMax); diff --git a/lib/infrared/encoder_decoder/infrared.c b/lib/infrared/encoder_decoder/infrared.c index 56f2c3f9ee6..d0bdaaef6cc 100644 --- a/lib/infrared/encoder_decoder/infrared.c +++ b/lib/infrared/encoder_decoder/infrared.c @@ -149,7 +149,7 @@ static const InfraredProtocolVariant* infrared_get_variant_by_protocol(InfraredP const InfraredMessage* infrared_decode(InfraredDecoderHandler* handler, bool level, uint32_t duration) { - furi_assert(handler); + furi_check(handler); InfraredMessage* message = NULL; InfraredMessage* result = NULL; @@ -181,8 +181,8 @@ InfraredDecoderHandler* infrared_alloc_decoder(void) { } void infrared_free_decoder(InfraredDecoderHandler* handler) { - furi_assert(handler); - furi_assert(handler->ctx); + furi_check(handler); + furi_check(handler->ctx); for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) { if(infrared_encoder_decoder[i].decoder.free) @@ -194,6 +194,8 @@ void infrared_free_decoder(InfraredDecoderHandler* handler) { } void infrared_reset_decoder(InfraredDecoderHandler* handler) { + furi_check(handler); + for(size_t i = 0; i < COUNT_OF(infrared_encoder_decoder); ++i) { if(infrared_encoder_decoder[i].decoder.reset) infrared_encoder_decoder[i].decoder.reset(handler->ctx[i]); @@ -201,7 +203,7 @@ void infrared_reset_decoder(InfraredDecoderHandler* handler) { } const InfraredMessage* infrared_check_decoder_ready(InfraredDecoderHandler* handler) { - furi_assert(handler); + furi_check(handler); InfraredMessage* message = NULL; InfraredMessage* result = NULL; @@ -226,13 +228,13 @@ InfraredEncoderHandler* infrared_alloc_encoder(void) { } void infrared_free_encoder(InfraredEncoderHandler* handler) { - furi_assert(handler); + furi_check(handler); const InfraredEncoders* encoder = handler->encoder; if(encoder || handler->handler) { - furi_assert(encoder); - furi_assert(handler->handler); - furi_assert(encoder->free); + furi_check(encoder); + furi_check(handler->handler); + furi_check(encoder->free); encoder->free(handler->handler); } @@ -250,20 +252,20 @@ static int infrared_find_index_by_protocol(InfraredProtocol protocol) { } void infrared_reset_encoder(InfraredEncoderHandler* handler, const InfraredMessage* message) { - furi_assert(handler); - furi_assert(message); + furi_check(handler); + furi_check(message); int index = infrared_find_index_by_protocol(message->protocol); furi_check(index >= 0); const InfraredEncoders* required_encoder = &infrared_encoder_decoder[index].encoder; - furi_assert(required_encoder); - furi_assert(required_encoder->reset); - furi_assert(required_encoder->alloc); + furi_check(required_encoder); + furi_check(required_encoder->reset); + furi_check(required_encoder->alloc); /* Realloc encoder if different protocol set */ if(required_encoder != handler->encoder) { if(handler->handler != NULL) { - furi_assert(handler->encoder->free); + furi_check(handler->encoder->free); handler->encoder->free(handler->handler); } handler->encoder = required_encoder; @@ -274,15 +276,16 @@ void infrared_reset_encoder(InfraredEncoderHandler* handler, const InfraredMessa } InfraredStatus infrared_encode(InfraredEncoderHandler* handler, uint32_t* duration, bool* level) { - furi_assert(handler); - furi_assert(duration); - furi_assert(level); + furi_check(handler); + furi_check(duration); + furi_check(level); + const InfraredEncoders* encoder = handler->encoder; - furi_assert(encoder); - furi_assert(encoder->encode); + furi_check(encoder); + furi_check(encoder->encode); InfraredStatus status = encoder->encode(handler->handler, duration, level); - furi_assert(status != InfraredStatusError); + furi_check(status != InfraredStatusError); return status; } @@ -292,6 +295,8 @@ bool infrared_is_protocol_valid(InfraredProtocol protocol) { } InfraredProtocol infrared_get_protocol_by_name(const char* protocol_name) { + furi_check(protocol_name); + for(InfraredProtocol protocol = 0; protocol < InfraredProtocolMAX; ++protocol) { const char* name = infrared_get_protocol_name(protocol); if(!strcmp(name, protocol_name)) return protocol; @@ -306,7 +311,7 @@ static const InfraredProtocolVariant* infrared_get_variant_by_protocol(InfraredP variant = infrared_encoder_decoder[index].get_protocol_variant(protocol); } - furi_assert(variant); + furi_check(variant); return variant; } diff --git a/lib/infrared/worker/infrared_transmit.c b/lib/infrared/worker/infrared_transmit.c index 8f99c006621..5756da65100 100644 --- a/lib/infrared/worker/infrared_transmit.c +++ b/lib/infrared/worker/infrared_transmit.c @@ -42,7 +42,7 @@ void infrared_send_raw_ext( bool start_from_mark, uint32_t frequency, float duty_cycle) { - furi_assert(timings); + furi_check(timings); infrared_tx_raw_start_from_mark = start_from_mark; infrared_tx_raw_timings_index = 0; @@ -53,7 +53,7 @@ void infrared_send_raw_ext( furi_hal_infrared_async_tx_start(frequency, duty_cycle); furi_hal_infrared_async_tx_wait_termination(); - furi_assert(!furi_hal_infrared_is_busy()); + furi_check(!furi_hal_infrared_is_busy()); } void infrared_send_raw(const uint32_t timings[], uint32_t timings_cnt, bool start_from_mark) { @@ -95,9 +95,9 @@ FuriHalInfraredTxGetDataState } void infrared_send(const InfraredMessage* message, int times) { - furi_assert(message); - furi_assert(times); - furi_assert(infrared_is_protocol_valid(message->protocol)); + furi_check(message); + furi_check(times); + furi_check(infrared_is_protocol_valid(message->protocol)); InfraredEncoderHandler* handler = infrared_alloc_encoder(); infrared_reset_encoder(handler, message); @@ -113,5 +113,5 @@ void infrared_send(const InfraredMessage* message, int times) { infrared_free_encoder(handler); - furi_assert(!furi_hal_infrared_is_busy()); + furi_check(!furi_hal_infrared_is_busy()); } diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index 38392fc06ed..a867542e013 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -217,12 +217,13 @@ void infrared_worker_rx_set_received_signal_callback( InfraredWorker* instance, InfraredWorkerReceivedSignalCallback callback, void* context) { - furi_assert(instance); + furi_check(instance); + instance->rx.received_signal_callback = callback; instance->rx.received_signal_context = context; } -InfraredWorker* infrared_worker_alloc() { +InfraredWorker* infrared_worker_alloc(void) { InfraredWorker* instance = malloc(sizeof(InfraredWorker)); instance->thread = furi_thread_alloc_ex("InfraredWorker", 2048, NULL, instance); @@ -242,8 +243,8 @@ InfraredWorker* infrared_worker_alloc() { } void infrared_worker_free(InfraredWorker* instance) { - furi_assert(instance); - furi_assert(instance->state == InfraredWorkerStateIdle); + furi_check(instance); + furi_check(instance->state == InfraredWorkerStateIdle); furi_record_close(RECORD_NOTIFICATION); infrared_free_decoder(instance->infrared_decoder); @@ -255,8 +256,8 @@ void infrared_worker_free(InfraredWorker* instance) { } void infrared_worker_rx_start(InfraredWorker* instance) { - furi_assert(instance); - furi_assert(instance->state == InfraredWorkerStateIdle); + furi_check(instance); + furi_check(instance->state == InfraredWorkerStateIdle); furi_stream_set_trigger_level(instance->stream, sizeof(LevelDuration)); @@ -274,8 +275,8 @@ void infrared_worker_rx_start(InfraredWorker* instance) { } void infrared_worker_rx_stop(InfraredWorker* instance) { - furi_assert(instance); - furi_assert(instance->state == InfraredWorkerStateRunRx); + furi_check(instance); + furi_check(instance->state == InfraredWorkerStateRunRx); furi_hal_infrared_async_rx_set_timeout_isr_callback(NULL, NULL); furi_hal_infrared_async_rx_set_capture_isr_callback(NULL, NULL); @@ -284,15 +285,14 @@ void infrared_worker_rx_stop(InfraredWorker* instance) { furi_thread_flags_set(furi_thread_get_id(instance->thread), INFRARED_WORKER_EXIT); furi_thread_join(instance->thread); - FuriStatus status = furi_stream_buffer_reset(instance->stream); - furi_assert(status == FuriStatusOk); - (void)status; + furi_check(furi_stream_buffer_reset(instance->stream) == FuriStatusOk); instance->state = InfraredWorkerStateIdle; } bool infrared_worker_signal_is_decoded(const InfraredWorkerSignal* signal) { - furi_assert(signal); + furi_check(signal); + return signal->decoded; } @@ -300,33 +300,36 @@ void infrared_worker_get_raw_signal( const InfraredWorkerSignal* signal, const uint32_t** timings, size_t* timings_cnt) { - furi_assert(signal); - furi_assert(timings); - furi_assert(timings_cnt); + furi_check(signal); + furi_check(timings); + furi_check(timings_cnt); *timings = signal->raw.timings; *timings_cnt = signal->timings_cnt; } const InfraredMessage* infrared_worker_get_decoded_signal(const InfraredWorkerSignal* signal) { - furi_assert(signal); + furi_check(signal); + return &signal->message; } void infrared_worker_rx_enable_blink_on_receiving(InfraredWorker* instance, bool enable) { - furi_assert(instance); + furi_check(instance); + instance->blink_enable = enable; } void infrared_worker_rx_enable_signal_decoding(InfraredWorker* instance, bool enable) { - furi_assert(instance); + furi_check(instance); + instance->decode_enable = enable; } void infrared_worker_tx_start(InfraredWorker* instance) { - furi_assert(instance); - furi_assert(instance->state == InfraredWorkerStateIdle); - furi_assert(instance->tx.get_signal_callback); + furi_check(instance); + furi_check(instance->state == InfraredWorkerStateIdle); + furi_check(instance->tx.get_signal_callback); // size have to be greater than api hal infrared async tx buffer size furi_stream_set_trigger_level(instance->stream, sizeof(InfraredWorkerTiming)); @@ -560,7 +563,8 @@ void infrared_worker_tx_set_get_signal_callback( InfraredWorker* instance, InfraredWorkerGetSignalCallback callback, void* context) { - furi_assert(instance); + furi_check(instance); + instance->tx.get_signal_callback = callback; instance->tx.get_signal_context = context; } @@ -569,14 +573,15 @@ void infrared_worker_tx_set_signal_sent_callback( InfraredWorker* instance, InfraredWorkerMessageSentCallback callback, void* context) { - furi_assert(instance); + furi_check(instance); + instance->tx.message_sent_callback = callback; instance->tx.message_sent_context = context; } void infrared_worker_tx_stop(InfraredWorker* instance) { - furi_assert(instance); - furi_assert(instance->state != InfraredWorkerStateRunRx); + furi_check(instance); + furi_check(instance->state != InfraredWorkerStateRunRx); furi_thread_flags_set(furi_thread_get_id(instance->thread), INFRARED_WORKER_EXIT); furi_thread_join(instance->thread); @@ -584,15 +589,14 @@ void infrared_worker_tx_stop(InfraredWorker* instance) { furi_hal_infrared_async_tx_set_signal_sent_isr_callback(NULL, NULL); instance->signal.timings_cnt = 0; - FuriStatus status = furi_stream_buffer_reset(instance->stream); - furi_assert(status == FuriStatusOk); - (void)status; + furi_check(furi_stream_buffer_reset(instance->stream) == FuriStatusOk); + instance->state = InfraredWorkerStateIdle; } void infrared_worker_set_decoded_signal(InfraredWorker* instance, const InfraredMessage* message) { - furi_assert(instance); - furi_assert(message); + furi_check(instance); + furi_check(message); instance->signal.decoded = true; instance->signal.message = *message; @@ -604,11 +608,12 @@ void infrared_worker_set_raw_signal( size_t timings_cnt, uint32_t frequency, float duty_cycle) { - furi_assert(instance); - furi_assert(timings); - furi_assert(timings_cnt > 0); - furi_assert((frequency <= INFRARED_MAX_FREQUENCY) && (frequency >= INFRARED_MIN_FREQUENCY)); - furi_assert((duty_cycle < 1.0f) && (duty_cycle > 0.0f)); + furi_check(instance); + furi_check(timings); + furi_check(timings_cnt > 0); + furi_check((frequency <= INFRARED_MAX_FREQUENCY) && (frequency >= INFRARED_MIN_FREQUENCY)); + furi_check((duty_cycle < 1.0f) && (duty_cycle > 0.0f)); + size_t max_copy_num = COUNT_OF(instance->signal.raw.timings) - 1; furi_check(timings_cnt <= max_copy_num); @@ -623,6 +628,8 @@ void infrared_worker_set_raw_signal( InfraredWorkerGetSignalResponse infrared_worker_tx_get_signal_steady_callback(void* context, InfraredWorker* instance) { UNUSED(context); + furi_check(instance); + InfraredWorkerGetSignalResponse response = instance->tx.steady_signal_sent ? InfraredWorkerGetSignalResponseSame : InfraredWorkerGetSignalResponseNew; diff --git a/lib/infrared/worker/infrared_worker.h b/lib/infrared/worker/infrared_worker.h index e0e86198309..2edb19227f9 100644 --- a/lib/infrared/worker/infrared_worker.h +++ b/lib/infrared/worker/infrared_worker.h @@ -37,7 +37,7 @@ typedef void ( * * @return just created instance of InfraredWorker */ -InfraredWorker* infrared_worker_alloc(); +InfraredWorker* infrared_worker_alloc(void); /** Free InfraredWorker * diff --git a/lib/lfrfid/lfrfid_dict_file.c b/lib/lfrfid/lfrfid_dict_file.c index 33a3b09db5c..367150812b2 100644 --- a/lib/lfrfid/lfrfid_dict_file.c +++ b/lib/lfrfid/lfrfid_dict_file.c @@ -6,7 +6,10 @@ #define LFRFID_DICT_FILETYPE "Flipper RFID key" bool lfrfid_dict_file_save(ProtocolDict* dict, ProtocolId protocol, const char* filename) { + furi_check(dict); furi_check(protocol != PROTOCOL_NO); + furi_check(filename); + Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* file = flipper_format_file_alloc(storage); size_t data_size = protocol_dict_get_data_size(dict, protocol); @@ -139,6 +142,9 @@ static ProtocolId lfrfid_dict_protocol_fallback( } ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) { + furi_check(dict); + furi_check(filename); + Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* file = flipper_format_file_alloc(storage); ProtocolId result = PROTOCOL_NO; diff --git a/lib/lfrfid/lfrfid_raw_file.c b/lib/lfrfid/lfrfid_raw_file.c index ca29770f189..441cf7333b0 100644 --- a/lib/lfrfid/lfrfid_raw_file.c +++ b/lib/lfrfid/lfrfid_raw_file.c @@ -26,6 +26,8 @@ struct LFRFIDRawFile { }; LFRFIDRawFile* lfrfid_raw_file_alloc(Storage* storage) { + furi_check(storage); + LFRFIDRawFile* file = malloc(sizeof(LFRFIDRawFile)); file->stream = file_stream_alloc(storage); file->buffer = NULL; @@ -33,16 +35,24 @@ LFRFIDRawFile* lfrfid_raw_file_alloc(Storage* storage) { } void lfrfid_raw_file_free(LFRFIDRawFile* file) { + furi_check(file); + if(file->buffer) free(file->buffer); stream_free(file->stream); free(file); } bool lfrfid_raw_file_open_write(LFRFIDRawFile* file, const char* file_path) { + furi_check(file); + furi_check(file_path); + return file_stream_open(file->stream, file_path, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS); } bool lfrfid_raw_file_open_read(LFRFIDRawFile* file, const char* file_path) { + furi_check(file); + furi_check(file_path); + return file_stream_open(file->stream, file_path, FSAM_READ, FSOM_OPEN_EXISTING); } @@ -51,6 +61,8 @@ bool lfrfid_raw_file_write_header( float frequency, float duty_cycle, uint32_t max_buffer_size) { + furi_check(file); + LFRFIDRawFileHeader header = { .magic = LFRFID_RAW_FILE_MAGIC, .version = LFRFID_RAW_FILE_VERSION, @@ -63,6 +75,10 @@ bool lfrfid_raw_file_write_header( } bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, size_t buffer_size) { + furi_check(file); + furi_check(buffer_data); + furi_check(buffer_size); + size_t size; size = stream_write(file->stream, (uint8_t*)&buffer_size, sizeof(size_t)); if(size != sizeof(size_t)) return false; @@ -74,6 +90,10 @@ bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, siz } bool lfrfid_raw_file_read_header(LFRFIDRawFile* file, float* frequency, float* duty_cycle) { + furi_check(file); + furi_check(frequency); + furi_check(duty_cycle); + LFRFIDRawFileHeader header; size_t size = stream_read(file->stream, (uint8_t*)&header, sizeof(LFRFIDRawFileHeader)); if(size == sizeof(LFRFIDRawFileHeader)) { @@ -98,6 +118,10 @@ bool lfrfid_raw_file_read_pair( uint32_t* duration, uint32_t* pulse, bool* pass_end) { + furi_check(file); + furi_check(duration); + furi_check(pulse); + size_t length = 0; if(file->buffer_counter >= file->buffer_size) { if(stream_eof(file->stream)) { diff --git a/lib/lfrfid/lfrfid_raw_worker.c b/lib/lfrfid/lfrfid_raw_worker.c index 344c2afa240..7c04b9dfad6 100644 --- a/lib/lfrfid/lfrfid_raw_worker.c +++ b/lib/lfrfid/lfrfid_raw_worker.c @@ -58,21 +58,23 @@ typedef enum { static int32_t lfrfid_raw_read_worker_thread(void* thread_context); static int32_t lfrfid_raw_emulate_worker_thread(void* thread_context); -LFRFIDRawWorker* lfrfid_raw_worker_alloc() { +LFRFIDRawWorker* lfrfid_raw_worker_alloc(void) { LFRFIDRawWorker* worker = malloc(sizeof(LFRFIDRawWorker)); worker->thread = furi_thread_alloc_ex("LfrfidRawWorker", 2048, NULL, worker); - - worker->events = furi_event_flag_alloc(NULL); - + worker->events = furi_event_flag_alloc(); worker->file_path = furi_string_alloc(); + return worker; } void lfrfid_raw_worker_free(LFRFIDRawWorker* worker) { + furi_check(worker); + furi_thread_free(worker->thread); furi_event_flag_free(worker->events); furi_string_free(worker->file_path); + free(worker); } @@ -83,6 +85,8 @@ void lfrfid_raw_worker_start_read( float duty_cycle, LFRFIDWorkerReadRawCallback callback, void* context) { + furi_check(worker); + furi_check(file_path); furi_check(furi_thread_get_state(worker->thread) == FuriThreadStateStopped); furi_string_set(worker->file_path, file_path); @@ -102,7 +106,10 @@ void lfrfid_raw_worker_start_emulate( const char* file_path, LFRFIDWorkerEmulateRawCallback callback, void* context) { + furi_check(worker); + furi_check(file_path); furi_check(furi_thread_get_state(worker->thread) == FuriThreadStateStopped); + furi_string_set(worker->file_path, file_path); worker->emulate_callback = callback; worker->context = context; @@ -111,6 +118,8 @@ void lfrfid_raw_worker_start_emulate( } void lfrfid_raw_worker_stop(LFRFIDRawWorker* worker) { + furi_check(worker); + worker->emulate_callback = NULL; worker->context = NULL; worker->read_callback = NULL; diff --git a/lib/lfrfid/lfrfid_raw_worker.h b/lib/lfrfid/lfrfid_raw_worker.h index 1195dd58790..e145dcaa348 100644 --- a/lib/lfrfid/lfrfid_raw_worker.h +++ b/lib/lfrfid/lfrfid_raw_worker.h @@ -15,7 +15,7 @@ typedef struct LFRFIDRawWorker LFRFIDRawWorker; * * @return LFRFIDRawWorker* */ -LFRFIDRawWorker* lfrfid_raw_worker_alloc(); +LFRFIDRawWorker* lfrfid_raw_worker_alloc(void); /** * @brief Free a LFRFIDRawWorker instance diff --git a/lib/lfrfid/lfrfid_worker.c b/lib/lfrfid/lfrfid_worker.c index ffaa8ee925f..3a0841cac4e 100644 --- a/lib/lfrfid/lfrfid_worker.c +++ b/lib/lfrfid/lfrfid_worker.c @@ -19,7 +19,7 @@ typedef enum { static int32_t lfrfid_worker_thread(void* thread_context); LFRFIDWorker* lfrfid_worker_alloc(ProtocolDict* dict) { - furi_assert(dict); + furi_check(dict); LFRFIDWorker* worker = malloc(sizeof(LFRFIDWorker)); worker->mode_index = LFRFIDWorkerIdle; @@ -37,6 +37,8 @@ LFRFIDWorker* lfrfid_worker_alloc(ProtocolDict* dict) { } void lfrfid_worker_free(LFRFIDWorker* worker) { + furi_check(worker); + if(worker->raw_filename) { free(worker->raw_filename); } @@ -50,7 +52,9 @@ void lfrfid_worker_read_start( LFRFIDWorkerReadType type, LFRFIDWorkerReadCallback callback, void* context) { - furi_assert(worker->mode_index == LFRFIDWorkerIdle); + furi_check(worker); + furi_check(worker->mode_index == LFRFIDWorkerIdle); + worker->read_type = type; worker->read_cb = callback; worker->cb_ctx = context; @@ -62,7 +66,7 @@ void lfrfid_worker_write_start( LFRFIDProtocol protocol, LFRFIDWorkerWriteCallback callback, void* context) { - furi_assert(worker->mode_index == LFRFIDWorkerIdle); + furi_check(worker->mode_index == LFRFIDWorkerIdle); worker->protocol = protocol; worker->write_cb = callback; worker->cb_ctx = context; @@ -70,7 +74,9 @@ void lfrfid_worker_write_start( } void lfrfid_worker_emulate_start(LFRFIDWorker* worker, LFRFIDProtocol protocol) { - furi_assert(worker->mode_index == LFRFIDWorkerIdle); + furi_check(worker); + furi_check(worker->mode_index == LFRFIDWorkerIdle); + worker->protocol = protocol; furi_thread_flags_set(furi_thread_get_id(worker->thread), LFRFIDEventEmulate); } @@ -89,7 +95,9 @@ void lfrfid_worker_read_raw_start( LFRFIDWorkerReadType type, LFRFIDWorkerReadRawCallback callback, void* context) { - furi_assert(worker->mode_index == LFRFIDWorkerIdle); + furi_check(worker); + furi_check(worker->mode_index == LFRFIDWorkerIdle); + worker->read_type = type; worker->read_raw_cb = callback; worker->cb_ctx = context; @@ -102,7 +110,9 @@ void lfrfid_worker_emulate_raw_start( const char* filename, LFRFIDWorkerEmulateRawCallback callback, void* context) { - furi_assert(worker->mode_index == LFRFIDWorkerIdle); + furi_check(worker); + furi_check(worker->mode_index == LFRFIDWorkerIdle); + lfrfid_worker_set_filename(worker, filename); worker->emulate_raw_cb = callback; worker->cb_ctx = context; @@ -110,14 +120,20 @@ void lfrfid_worker_emulate_raw_start( } void lfrfid_worker_stop(LFRFIDWorker* worker) { + furi_check(worker); + furi_thread_flags_set(furi_thread_get_id(worker->thread), LFRFIDEventStopMode); } void lfrfid_worker_start_thread(LFRFIDWorker* worker) { + furi_check(worker); + furi_thread_start(worker->thread); } void lfrfid_worker_stop_thread(LFRFIDWorker* worker) { + furi_check(worker); + furi_thread_flags_set(furi_thread_get_id(worker->thread), LFRFIDEventStopThread); furi_thread_join(worker->thread); } diff --git a/lib/lfrfid/tools/t5577.c b/lib/lfrfid/tools/t5577.c index 9b078fe3a15..9d0d28fc51b 100644 --- a/lib/lfrfid/tools/t5577.c +++ b/lib/lfrfid/tools/t5577.c @@ -16,14 +16,14 @@ #define T5577_BLOCKS_IN_PAGE_0 8 #define T5577_BLOCKS_IN_PAGE_1 4 -static void t5577_start() { +static void t5577_start(void) { furi_hal_rfid_tim_read_start(125000, 0.5); // do not ground the antenna furi_hal_rfid_pin_pull_release(); } -static void t5577_stop() { +static void t5577_stop(void) { furi_hal_rfid_tim_read_stop(); furi_hal_rfid_pins_reset(); } @@ -48,7 +48,7 @@ static void t5577_write_opcode(uint8_t value) { t5577_write_bit((value >> 0) & 1); } -static void t5577_write_reset() { +static void t5577_write_reset(void) { t5577_write_gap(T5577_TIMING_START_GAP); t5577_write_bit(1); t5577_write_bit(0); diff --git a/lib/lfrfid/tools/varint_pair.c b/lib/lfrfid/tools/varint_pair.c index 1e6c82eeea4..48e0e4a138c 100644 --- a/lib/lfrfid/tools/varint_pair.c +++ b/lib/lfrfid/tools/varint_pair.c @@ -8,7 +8,7 @@ struct VarintPair { uint8_t data[VARINT_PAIR_SIZE]; }; -VarintPair* varint_pair_alloc() { +VarintPair* varint_pair_alloc(void) { VarintPair* pair = malloc(sizeof(VarintPair)); pair->data_length = 0; return pair; diff --git a/lib/lfrfid/tools/varint_pair.h b/lib/lfrfid/tools/varint_pair.h index 3c8386423e4..12697a7a6ad 100644 --- a/lib/lfrfid/tools/varint_pair.h +++ b/lib/lfrfid/tools/varint_pair.h @@ -15,7 +15,7 @@ typedef struct VarintPair VarintPair; * VarintPair is a buffer that holds pair of varint values * @return VarintPair* */ -VarintPair* varint_pair_alloc(); +VarintPair* varint_pair_alloc(void); /** * @brief Free a VarintPair instance diff --git a/lib/music_worker/music_worker.c b/lib/music_worker/music_worker.c index 279d1267376..3225134b702 100644 --- a/lib/music_worker/music_worker.c +++ b/lib/music_worker/music_worker.c @@ -97,7 +97,7 @@ static int32_t music_worker_thread_callback(void* context) { return 0; } -MusicWorker* music_worker_alloc() { +MusicWorker* music_worker_alloc(void) { MusicWorker* instance = malloc(sizeof(MusicWorker)); NoteBlockArray_init(instance->notes); diff --git a/lib/music_worker/music_worker.h b/lib/music_worker/music_worker.h index 5a7cb4936a9..26c5dee0ae5 100644 --- a/lib/music_worker/music_worker.h +++ b/lib/music_worker/music_worker.h @@ -12,7 +12,7 @@ typedef void (*MusicWorkerCallback)( typedef struct MusicWorker MusicWorker; -MusicWorker* music_worker_alloc(); +MusicWorker* music_worker_alloc(void); void music_worker_clear(MusicWorker* instance); diff --git a/lib/nfc/helpers/iso13239_crc.c b/lib/nfc/helpers/iso13239_crc.c index c54fbcfb21c..c1affba4686 100644 --- a/lib/nfc/helpers/iso13239_crc.c +++ b/lib/nfc/helpers/iso13239_crc.c @@ -33,6 +33,8 @@ static uint16_t } void iso13239_crc_append(Iso13239CrcType type, BitBuffer* buf) { + furi_check(buf); + const uint8_t* data = bit_buffer_get_data(buf); const size_t data_size = bit_buffer_get_size_bytes(buf); @@ -41,6 +43,8 @@ void iso13239_crc_append(Iso13239CrcType type, BitBuffer* buf) { } bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) { + furi_check(buf); + const size_t data_size = bit_buffer_get_size_bytes(buf); if(data_size <= ISO13239_CRC_SIZE) return false; @@ -55,6 +59,8 @@ bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) { } void iso13239_crc_trim(BitBuffer* buf) { + furi_check(buf); + const size_t data_size = bit_buffer_get_size_bytes(buf); furi_assert(data_size > ISO13239_CRC_SIZE); diff --git a/lib/nfc/helpers/iso14443_4_layer.c b/lib/nfc/helpers/iso14443_4_layer.c index 26f4dc3b7b4..d5b0d32defc 100644 --- a/lib/nfc/helpers/iso14443_4_layer.c +++ b/lib/nfc/helpers/iso14443_4_layer.c @@ -17,7 +17,7 @@ static inline void iso14443_4_layer_update_pcb(Iso14443_4Layer* instance) { instance->pcb ^= (uint8_t)0x01; } -Iso14443_4Layer* iso14443_4_layer_alloc() { +Iso14443_4Layer* iso14443_4_layer_alloc(void) { Iso14443_4Layer* instance = malloc(sizeof(Iso14443_4Layer)); iso14443_4_layer_reset(instance); diff --git a/lib/nfc/helpers/iso14443_4_layer.h b/lib/nfc/helpers/iso14443_4_layer.h index 712173ce1b1..437c2e8a651 100644 --- a/lib/nfc/helpers/iso14443_4_layer.h +++ b/lib/nfc/helpers/iso14443_4_layer.h @@ -8,7 +8,7 @@ extern "C" { typedef struct Iso14443_4Layer Iso14443_4Layer; -Iso14443_4Layer* iso14443_4_layer_alloc(); +Iso14443_4Layer* iso14443_4_layer_alloc(void); void iso14443_4_layer_free(Iso14443_4Layer* instance); diff --git a/lib/nfc/helpers/iso14443_crc.c b/lib/nfc/helpers/iso14443_crc.c index fda9871aa99..33789bd71f8 100644 --- a/lib/nfc/helpers/iso14443_crc.c +++ b/lib/nfc/helpers/iso14443_crc.c @@ -28,6 +28,8 @@ static uint16_t } void iso14443_crc_append(Iso14443CrcType type, BitBuffer* buf) { + furi_check(buf); + const uint8_t* data = bit_buffer_get_data(buf); const size_t data_size = bit_buffer_get_size_bytes(buf); @@ -36,6 +38,8 @@ void iso14443_crc_append(Iso14443CrcType type, BitBuffer* buf) { } bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) { + furi_check(buf); + const size_t data_size = bit_buffer_get_size_bytes(buf); if(data_size <= ISO14443_CRC_SIZE) return false; @@ -50,8 +54,9 @@ bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) { } void iso14443_crc_trim(BitBuffer* buf) { + furi_check(buf); const size_t data_size = bit_buffer_get_size_bytes(buf); - furi_assert(data_size > ISO14443_CRC_SIZE); + furi_check(data_size > ISO14443_CRC_SIZE); bit_buffer_set_size_bytes(buf, data_size - ISO14443_CRC_SIZE); } diff --git a/lib/nfc/helpers/nfc_data_generator.c b/lib/nfc/helpers/nfc_data_generator.c index 0ecccc3ac44..c10e8fd946d 100644 --- a/lib/nfc/helpers/nfc_data_generator.c +++ b/lib/nfc/helpers/nfc_data_generator.c @@ -552,9 +552,14 @@ static const NfcDataGenerator nfc_data_generator[NfcDataGeneratorTypeNum] = { }; const char* nfc_data_generator_get_name(NfcDataGeneratorType type) { + furi_check(type < NfcDataGeneratorTypeNum); + return nfc_data_generator[type].name; } void nfc_data_generator_fill_data(NfcDataGeneratorType type, NfcDevice* nfc_device) { + furi_check(type < NfcDataGeneratorTypeNum); + furi_check(nfc_device); + nfc_data_generator[type].handler(nfc_device); } diff --git a/lib/nfc/helpers/nfc_util.c b/lib/nfc/helpers/nfc_util.c index 7bbc9d62156..31ade8fc7a0 100644 --- a/lib/nfc/helpers/nfc_util.c +++ b/lib/nfc/helpers/nfc_util.c @@ -25,8 +25,8 @@ uint8_t nfc_util_odd_parity8(uint8_t data) { } void nfc_util_odd_parity(const uint8_t* src, uint8_t* dst, uint8_t len) { - furi_assert(src); - furi_assert(dst); + furi_check(src); + furi_check(dst); uint8_t parity = 0; uint8_t bit = 0; diff --git a/lib/nfc/nfc.c b/lib/nfc/nfc.c index 22a21c9d2fe..59d254592cc 100644 --- a/lib/nfc/nfc.c +++ b/lib/nfc/nfc.c @@ -235,7 +235,7 @@ static int32_t nfc_worker_poller(void* context) { return 0; } -Nfc* nfc_alloc() { +Nfc* nfc_alloc(void) { furi_check(furi_hal_nfc_acquire() == FuriHalNfcErrorNone); Nfc* instance = malloc(sizeof(Nfc)); @@ -253,8 +253,8 @@ Nfc* nfc_alloc() { } void nfc_free(Nfc* instance) { - furi_assert(instance); - furi_assert(instance->state == NfcStateIdle); + furi_check(instance); + furi_check(instance->state == NfcStateIdle); furi_thread_free(instance->worker_thread); free(instance); @@ -263,10 +263,10 @@ void nfc_free(Nfc* instance) { } void nfc_config(Nfc* instance, NfcMode mode, NfcTech tech) { - furi_assert(instance); - furi_assert(mode < NfcModeNum); - furi_assert(tech < NfcTechNum); - furi_assert(instance->config_state == NfcConfigurationStateIdle); + furi_check(instance); + furi_check(mode < NfcModeNum); + furi_check(tech < NfcTechNum); + furi_check(instance->config_state == NfcConfigurationStateIdle); FuriHalNfcTech hal_tech = nfc_tech_table[mode][tech]; if(hal_tech == FuriHalNfcTechInvalid) { @@ -282,35 +282,35 @@ void nfc_config(Nfc* instance, NfcMode mode, NfcTech tech) { } void nfc_set_fdt_poll_fc(Nfc* instance, uint32_t fdt_poll_fc) { - furi_assert(instance); + furi_check(instance); instance->fdt_poll_fc = fdt_poll_fc; } void nfc_set_fdt_listen_fc(Nfc* instance, uint32_t fdt_listen_fc) { - furi_assert(instance); + furi_check(instance); instance->fdt_listen_fc = fdt_listen_fc; } void nfc_set_fdt_poll_poll_us(Nfc* instance, uint32_t fdt_poll_poll_us) { - furi_assert(instance); + furi_check(instance); instance->fdt_poll_poll_us = fdt_poll_poll_us; } void nfc_set_guard_time_us(Nfc* instance, uint32_t guard_time_us) { - furi_assert(instance); + furi_check(instance); instance->guard_time_us = guard_time_us; } void nfc_set_mask_receive_time_fc(Nfc* instance, uint32_t mask_rx_time_fc) { - furi_assert(instance); + furi_check(instance); instance->mask_rx_time_fc = mask_rx_time_fc; } void nfc_start(Nfc* instance, NfcEventCallback callback, void* context) { - furi_assert(instance); - furi_assert(instance->worker_thread); - furi_assert(callback); - furi_assert(instance->config_state == NfcConfigurationStateDone); + furi_check(instance); + furi_check(instance->worker_thread); + furi_check(callback); + furi_check(instance->config_state == NfcConfigurationStateDone); instance->callback = callback; instance->context = context; @@ -324,8 +324,8 @@ void nfc_start(Nfc* instance, NfcEventCallback callback, void* context) { } void nfc_stop(Nfc* instance) { - furi_assert(instance); - furi_assert(instance->state == NfcStateRunning); + furi_check(instance); + furi_check(instance->state == NfcStateRunning); if(instance->mode == NfcModeListener) { furi_hal_nfc_abort(); @@ -336,8 +336,8 @@ void nfc_stop(Nfc* instance) { } NfcError nfc_listener_tx(Nfc* instance, const BitBuffer* tx_buffer) { - furi_assert(instance); - furi_assert(tx_buffer); + furi_check(instance); + furi_check(tx_buffer); NfcError ret = NfcErrorNone; @@ -409,11 +409,11 @@ NfcError nfc_iso14443a_poller_trx_custom_parity( const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); - furi_assert(instance->poller_state == NfcPollerStateReady); + furi_check(instance->poller_state == NfcPollerStateReady); NfcError ret = NfcErrorNone; FuriHalNfcError error = FuriHalNfcErrorNone; @@ -462,11 +462,11 @@ NfcError nfc_iso14443a_poller_trx_custom_parity( NfcError nfc_poller_trx(Nfc* instance, const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); - furi_assert(instance->poller_state == NfcPollerStateReady); + furi_check(instance->poller_state == NfcPollerStateReady); NfcError ret = NfcErrorNone; FuriHalNfcError error = FuriHalNfcErrorNone; @@ -511,7 +511,7 @@ NfcError nfc_iso14443a_listener_set_col_res_data( uint8_t uid_len, uint8_t* atqa, uint8_t sak) { - furi_assert(instance); + furi_check(instance); FuriHalNfcError error = furi_hal_nfc_iso14443a_listener_set_col_res_data(uid, uid_len, atqa, sak); @@ -524,14 +524,14 @@ NfcError nfc_iso14443a_poller_trx_short_frame( NfcIso14443aShortFrame frame, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(rx_buffer); FuriHalNfcaShortFrame short_frame = (frame == NfcIso14443aShortFrameAllReqa) ? FuriHalNfcaShortFrameAllReq : FuriHalNfcaShortFrameSensReq; - furi_assert(instance->poller_state == NfcPollerStateReady); + furi_check(instance->poller_state == NfcPollerStateReady); NfcError ret = NfcErrorNone; FuriHalNfcError error = FuriHalNfcErrorNone; @@ -574,11 +574,11 @@ NfcError nfc_iso14443a_poller_trx_sdd_frame( const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); - furi_assert(instance->poller_state == NfcPollerStateReady); + furi_check(instance->poller_state == NfcPollerStateReady); NfcError ret = NfcErrorNone; FuriHalNfcError error = FuriHalNfcErrorNone; @@ -618,8 +618,8 @@ NfcError nfc_iso14443a_poller_trx_sdd_frame( } NfcError nfc_iso14443a_listener_tx_custom_parity(Nfc* instance, const BitBuffer* tx_buffer) { - furi_assert(instance); - furi_assert(tx_buffer); + furi_check(instance); + furi_check(tx_buffer); NfcError ret = NfcErrorNone; FuriHalNfcError error = FuriHalNfcErrorNone; @@ -635,7 +635,7 @@ NfcError nfc_iso14443a_listener_tx_custom_parity(Nfc* instance, const BitBuffer* } NfcError nfc_iso15693_listener_tx_sof(Nfc* instance) { - furi_assert(instance); + furi_check(instance); while(furi_hal_nfc_timer_block_tx_is_running()) { } @@ -652,9 +652,7 @@ NfcError nfc_felica_listener_set_sensf_res_data( const uint8_t idm_len, const uint8_t* pmm, const uint8_t pmm_len) { - furi_assert(instance); - furi_assert(idm); - furi_assert(pmm); + furi_check(instance); FuriHalNfcError error = furi_hal_nfc_felica_listener_set_sensf_res_data(idm, idm_len, pmm, pmm_len); diff --git a/lib/nfc/nfc.h b/lib/nfc/nfc.h index 6f3e25a5d03..959bd018f9a 100644 --- a/lib/nfc/nfc.h +++ b/lib/nfc/nfc.h @@ -128,7 +128,7 @@ typedef enum { * * @returns pointer to the allocated Nfc instance. */ -Nfc* nfc_alloc(); +Nfc* nfc_alloc(void); /** * @brief Delete an Nfc instance. diff --git a/lib/nfc/nfc_device.c b/lib/nfc/nfc_device.c index 267824d16ec..9f95dfc151d 100644 --- a/lib/nfc/nfc_device.c +++ b/lib/nfc/nfc_device.c @@ -14,7 +14,7 @@ #define NFC_DEVICE_UID_MAX_LEN (10U) -NfcDevice* nfc_device_alloc() { +NfcDevice* nfc_device_alloc(void) { NfcDevice* instance = malloc(sizeof(NfcDevice)); instance->protocol = NfcProtocolInvalid; @@ -22,14 +22,14 @@ NfcDevice* nfc_device_alloc() { } void nfc_device_free(NfcDevice* instance) { - furi_assert(instance); + furi_check(instance); nfc_device_clear(instance); free(instance); } void nfc_device_clear(NfcDevice* instance) { - furi_assert(instance); + furi_check(instance); if(instance->protocol == NfcProtocolInvalid) { furi_assert(instance->protocol_data == NULL); @@ -43,8 +43,8 @@ void nfc_device_clear(NfcDevice* instance) { } void nfc_device_reset(NfcDevice* instance) { - furi_assert(instance); - furi_assert(instance->protocol < NfcProtocolNum); + furi_check(instance); + furi_check(instance->protocol < NfcProtocolNum); if(instance->protocol_data) { nfc_devices[instance->protocol]->reset(instance->protocol_data); @@ -52,37 +52,40 @@ void nfc_device_reset(NfcDevice* instance) { } NfcProtocol nfc_device_get_protocol(const NfcDevice* instance) { - furi_assert(instance); + furi_check(instance); return instance->protocol; } const NfcDeviceData* nfc_device_get_data(const NfcDevice* instance, NfcProtocol protocol) { + furi_check(instance); return nfc_device_get_data_ptr(instance, protocol); } const char* nfc_device_get_protocol_name(NfcProtocol protocol) { - furi_assert(protocol < NfcProtocolNum); + furi_check(protocol < NfcProtocolNum); return nfc_devices[protocol]->protocol_name; } const char* nfc_device_get_name(const NfcDevice* instance, NfcDeviceNameType name_type) { - furi_assert(instance); - furi_assert(instance->protocol < NfcProtocolNum); + furi_check(instance); + furi_check(instance->protocol < NfcProtocolNum); return nfc_devices[instance->protocol]->get_name(instance->protocol_data, name_type); } const uint8_t* nfc_device_get_uid(const NfcDevice* instance, size_t* uid_len) { - furi_assert(instance); - furi_assert(instance->protocol < NfcProtocolNum); + furi_check(instance); + furi_check(uid_len); + furi_check(instance->protocol < NfcProtocolNum); return nfc_devices[instance->protocol]->get_uid(instance->protocol_data, uid_len); } bool nfc_device_set_uid(NfcDevice* instance, const uint8_t* uid, size_t uid_len) { - furi_assert(instance); - furi_assert(instance->protocol < NfcProtocolNum); + furi_check(instance); + furi_check(uid); + furi_check(instance->protocol < NfcProtocolNum); return nfc_devices[instance->protocol]->set_uid(instance->protocol_data, uid, uid_len); } @@ -91,8 +94,9 @@ void nfc_device_set_data( NfcDevice* instance, NfcProtocol protocol, const NfcDeviceData* protocol_data) { - furi_assert(instance); - furi_assert(protocol < NfcProtocolNum); + furi_check(instance); + furi_check(protocol_data); + furi_check(protocol < NfcProtocolNum); nfc_device_clear(instance); @@ -106,9 +110,9 @@ void nfc_device_copy_data( const NfcDevice* instance, NfcProtocol protocol, NfcDeviceData* protocol_data) { - furi_assert(instance); - furi_assert(protocol < NfcProtocolNum); - furi_assert(protocol_data); + furi_check(instance); + furi_check(protocol < NfcProtocolNum); + furi_check(protocol_data); if(instance->protocol != protocol) { furi_crash(NFC_DEV_TYPE_ERROR); @@ -121,17 +125,17 @@ bool nfc_device_is_equal_data( const NfcDevice* instance, NfcProtocol protocol, const NfcDeviceData* protocol_data) { - furi_assert(instance); - furi_assert(protocol < NfcProtocolNum); - furi_assert(protocol_data); + furi_check(instance); + furi_check(protocol < NfcProtocolNum); + furi_check(protocol_data); return instance->protocol == protocol && nfc_devices[protocol]->is_equal(instance->protocol_data, protocol_data); } bool nfc_device_is_equal(const NfcDevice* instance, const NfcDevice* other) { - furi_assert(instance); - furi_assert(other); + furi_check(instance); + furi_check(other); return nfc_device_is_equal_data(instance, other->protocol, other->protocol_data); } @@ -140,17 +144,17 @@ void nfc_device_set_loading_callback( NfcDevice* instance, NfcLoadingCallback callback, void* context) { - furi_assert(instance); - furi_assert(callback); + furi_check(instance); + furi_check(callback); instance->loading_callback = callback; instance->loading_callback_context = context; } bool nfc_device_save(NfcDevice* instance, const char* path) { - furi_assert(instance); - furi_assert(instance->protocol < NfcProtocolNum); - furi_assert(path); + furi_check(instance); + furi_check(instance->protocol < NfcProtocolNum); + furi_check(path); bool saved = false; Storage* storage = furi_record_open(RECORD_STORAGE); @@ -313,8 +317,8 @@ static bool nfc_device_load_legacy(NfcDevice* instance, FlipperFormat* ff, uint3 } bool nfc_device_load(NfcDevice* instance, const char* path) { - furi_assert(instance); - furi_assert(path); + furi_check(instance); + furi_check(path); bool loaded = false; Storage* storage = furi_record_open(RECORD_STORAGE); diff --git a/lib/nfc/nfc_device.h b/lib/nfc/nfc_device.h index 6636e7c7683..055acec0a61 100644 --- a/lib/nfc/nfc_device.h +++ b/lib/nfc/nfc_device.h @@ -47,7 +47,7 @@ typedef void (*NfcLoadingCallback)(void* context, bool state); * * @returns pointer to the allocated instance. */ -NfcDevice* nfc_device_alloc(); +NfcDevice* nfc_device_alloc(void); /** * @brief Delete an NfcDevice instance. diff --git a/lib/nfc/nfc_listener.c b/lib/nfc/nfc_listener.c index 57b00a8755a..4f711d62d50 100644 --- a/lib/nfc/nfc_listener.c +++ b/lib/nfc/nfc_listener.c @@ -73,10 +73,10 @@ static void nfc_listener_list_free(NfcListener* instance) { } NfcListener* nfc_listener_alloc(Nfc* nfc, NfcProtocol protocol, const NfcDeviceData* data) { - furi_assert(nfc); - furi_assert(protocol < NfcProtocolNum); - furi_assert(data); - furi_assert(nfc_listeners_api[protocol]); + furi_check(nfc); + furi_check(protocol < NfcProtocolNum); + furi_check(data); + furi_check(nfc_listeners_api[protocol]); NfcListener* instance = malloc(sizeof(NfcListener)); instance->nfc = nfc; @@ -89,7 +89,7 @@ NfcListener* nfc_listener_alloc(Nfc* nfc, NfcProtocol protocol, const NfcDeviceD } void nfc_listener_free(NfcListener* instance) { - furi_assert(instance); + furi_check(instance); nfc_listener_list_free(instance); nfc_device_free(instance->nfc_dev); @@ -116,7 +116,7 @@ NfcCommand nfc_listener_start_callback(NfcEvent event, void* context) { } void nfc_listener_start(NfcListener* instance, NfcGenericCallback callback, void* context) { - furi_assert(instance); + furi_check(instance); NfcListenerListElement* tail_element = instance->list.tail; tail_element->listener_api->set_callback(tail_element->listener, callback, context); @@ -124,20 +124,20 @@ void nfc_listener_start(NfcListener* instance, NfcGenericCallback callback, void } void nfc_listener_stop(NfcListener* instance) { - furi_assert(instance); + furi_check(instance); nfc_stop(instance->nfc); } NfcProtocol nfc_listener_get_protocol(const NfcListener* instance) { - furi_assert(instance); + furi_check(instance); return instance->protocol; } const NfcDeviceData* nfc_listener_get_data(const NfcListener* instance, NfcProtocol protocol) { - furi_assert(instance); - furi_assert(instance->protocol == protocol); + furi_check(instance); + furi_check(instance->protocol == protocol); NfcListenerListElement* tail_element = instance->list.tail; return tail_element->listener_api->get_data(tail_element->listener); diff --git a/lib/nfc/nfc_poller.c b/lib/nfc/nfc_poller.c index 48be37d9259..114ff369519 100644 --- a/lib/nfc/nfc_poller.c +++ b/lib/nfc/nfc_poller.c @@ -75,8 +75,8 @@ static void nfc_poller_list_free(NfcPoller* instance) { } NfcPoller* nfc_poller_alloc(Nfc* nfc, NfcProtocol protocol) { - furi_assert(nfc); - furi_assert(protocol < NfcProtocolNum); + furi_check(nfc); + furi_check(protocol < NfcProtocolNum); NfcPoller* instance = malloc(sizeof(NfcPoller)); instance->session_state = NfcPollerSessionStateIdle; @@ -88,7 +88,7 @@ NfcPoller* nfc_poller_alloc(Nfc* nfc, NfcProtocol protocol) { } void nfc_poller_free(NfcPoller* instance) { - furi_assert(instance); + furi_check(instance); nfc_poller_list_free(instance); free(instance); @@ -119,9 +119,9 @@ static NfcCommand nfc_poller_start_callback(NfcEvent event, void* context) { } void nfc_poller_start(NfcPoller* instance, NfcGenericCallback callback, void* context) { - furi_assert(instance); - furi_assert(callback); - furi_assert(instance->session_state == NfcPollerSessionStateIdle); + furi_check(instance); + furi_check(callback); + furi_check(instance->session_state == NfcPollerSessionStateIdle); NfcPollerListElement* tail_poller = instance->list.tail; tail_poller->poller_api->set_callback(tail_poller->poller, callback, context); @@ -180,9 +180,9 @@ static NfcCommand nfc_poller_start_ex_head_callback(NfcEvent event, void* contex } void nfc_poller_start_ex(NfcPoller* instance, NfcGenericCallbackEx callback, void* context) { - furi_assert(instance); - furi_assert(callback); - furi_assert(instance->session_state == NfcPollerSessionStateIdle); + furi_check(instance); + furi_check(callback); + furi_check(instance->session_state == NfcPollerSessionStateIdle); instance->callback = callback; instance->context = context; @@ -200,8 +200,8 @@ void nfc_poller_start_ex(NfcPoller* instance, NfcGenericCallbackEx callback, voi } void nfc_poller_stop(NfcPoller* instance) { - furi_assert(instance); - furi_assert(instance->nfc); + furi_check(instance); + furi_check(instance->nfc); instance->session_state = NfcPollerSessionStateStopRequest; nfc_stop(instance->nfc); @@ -246,8 +246,8 @@ static NfcCommand nfc_poller_detect_head_callback(NfcEvent event, void* context) } bool nfc_poller_detect(NfcPoller* instance) { - furi_assert(instance); - furi_assert(instance->session_state == NfcPollerSessionStateIdle); + furi_check(instance); + furi_check(instance->session_state == NfcPollerSessionStateIdle); instance->session_state = NfcPollerSessionStateActive; NfcPollerListElement* tail_poller = instance->list.tail; @@ -270,13 +270,13 @@ bool nfc_poller_detect(NfcPoller* instance) { } NfcProtocol nfc_poller_get_protocol(const NfcPoller* instance) { - furi_assert(instance); + furi_check(instance); return instance->protocol; } const NfcDeviceData* nfc_poller_get_data(const NfcPoller* instance) { - furi_assert(instance); + furi_check(instance); NfcPollerListElement* tail_poller = instance->list.tail; return tail_poller->poller_api->get_data(tail_poller->poller); diff --git a/lib/nfc/nfc_scanner.c b/lib/nfc/nfc_scanner.c index 0056dfb1ccc..23922a82957 100644 --- a/lib/nfc/nfc_scanner.c +++ b/lib/nfc/nfc_scanner.c @@ -218,7 +218,7 @@ static int32_t nfc_scanner_worker(void* context) { } NfcScanner* nfc_scanner_alloc(Nfc* nfc) { - furi_assert(nfc); + furi_check(nfc); NfcScanner* instance = malloc(sizeof(NfcScanner)); instance->nfc = nfc; @@ -227,16 +227,17 @@ NfcScanner* nfc_scanner_alloc(Nfc* nfc) { } void nfc_scanner_free(NfcScanner* instance) { - furi_assert(instance); + furi_check(instance); + furi_check(instance->state == NfcScannerStateIdle); free(instance); } void nfc_scanner_start(NfcScanner* instance, NfcScannerCallback callback, void* context) { - furi_assert(instance); - furi_assert(callback); - furi_assert(instance->session_state == NfcScannerSessionStateIdle); - furi_assert(instance->scan_worker == NULL); + furi_check(instance); + furi_check(callback); + furi_check(instance->state == NfcScannerStateIdle); + furi_check(instance->scan_worker == NULL); instance->callback = callback; instance->context = context; @@ -252,8 +253,8 @@ void nfc_scanner_start(NfcScanner* instance, NfcScannerCallback callback, void* } void nfc_scanner_stop(NfcScanner* instance) { - furi_assert(instance); - furi_assert(instance->scan_worker); + furi_check(instance); + furi_check(instance->scan_worker); instance->session_state = NfcScannerSessionStateStopRequest; furi_thread_join(instance->scan_worker); diff --git a/lib/nfc/protocols/felica/felica.c b/lib/nfc/protocols/felica/felica.c index 4b7c91fb64e..7de1310bf90 100644 --- a/lib/nfc/protocols/felica/felica.c +++ b/lib/nfc/protocols/felica/felica.c @@ -29,7 +29,7 @@ const NfcDeviceBase nfc_device_felica = { .get_base_data = (NfcDeviceGetBaseData)felica_get_base_data, }; -FelicaData* felica_alloc() { +FelicaData* felica_alloc(void) { FelicaData* data = malloc(sizeof(FelicaData)); return data; } diff --git a/lib/nfc/protocols/felica/felica.h b/lib/nfc/protocols/felica/felica.h index 31e040b8a1e..e1820d4dc52 100644 --- a/lib/nfc/protocols/felica/felica.h +++ b/lib/nfc/protocols/felica/felica.h @@ -50,7 +50,7 @@ typedef struct { extern const NfcDeviceBase nfc_device_felica; -FelicaData* felica_alloc(); +FelicaData* felica_alloc(void); void felica_free(FelicaData* data); diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a.c b/lib/nfc/protocols/iso14443_3a/iso14443_3a.c index 96d0b39537e..96e30e5c8d1 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a.c +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a.c @@ -28,36 +28,40 @@ const NfcDeviceBase nfc_device_iso14443_3a = { .get_base_data = (NfcDeviceGetBaseData)iso14443_3a_get_base_data, }; -Iso14443_3aData* iso14443_3a_alloc() { +Iso14443_3aData* iso14443_3a_alloc(void) { Iso14443_3aData* data = malloc(sizeof(Iso14443_3aData)); return data; } void iso14443_3a_free(Iso14443_3aData* data) { - furi_assert(data); + furi_check(data); free(data); } void iso14443_3a_reset(Iso14443_3aData* data) { - furi_assert(data); + furi_check(data); + memset(data, 0, sizeof(Iso14443_3aData)); } void iso14443_3a_copy(Iso14443_3aData* data, const Iso14443_3aData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); *data = *other; } bool iso14443_3a_verify(Iso14443_3aData* data, const FuriString* device_type) { UNUSED(data); + furi_check(device_type); + return furi_string_equal(device_type, ISO14443_3A_PROTOCOL_NAME_LEGACY); } bool iso14443_3a_load(Iso14443_3aData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool parsed = false; @@ -78,7 +82,8 @@ bool iso14443_3a_load(Iso14443_3aData* data, FlipperFormat* ff, uint32_t version } bool iso14443_3a_save(const Iso14443_3aData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool saved = false; @@ -98,8 +103,8 @@ bool iso14443_3a_save(const Iso14443_3aData* data, FlipperFormat* ff) { } bool iso14443_3a_is_equal(const Iso14443_3aData* data, const Iso14443_3aData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); return memcmp(data, other, sizeof(Iso14443_3aData)) == 0; } @@ -111,7 +116,7 @@ const char* iso14443_3a_get_device_name(const Iso14443_3aData* data, NfcDeviceNa } const uint8_t* iso14443_3a_get_uid(const Iso14443_3aData* data, size_t* uid_len) { - furi_assert(data); + furi_check(data); if(uid_len) { *uid_len = data->uid_len; @@ -121,7 +126,8 @@ const uint8_t* iso14443_3a_get_uid(const Iso14443_3aData* data, size_t* uid_len) } bool iso14443_3a_set_uid(Iso14443_3aData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); + furi_check(uid); const bool uid_valid = uid_len == ISO14443_3A_UID_4_BYTES || uid_len == ISO14443_3A_UID_7_BYTES || @@ -141,7 +147,7 @@ Iso14443_3aData* iso14443_3a_get_base_data(const Iso14443_3aData* data) { } uint32_t iso14443_3a_get_cuid(const Iso14443_3aData* data) { - furi_assert(data); + furi_check(data); uint32_t cuid = 0; const uint8_t* cuid_start = data->uid; @@ -154,33 +160,33 @@ uint32_t iso14443_3a_get_cuid(const Iso14443_3aData* data) { } bool iso14443_3a_supports_iso14443_4(const Iso14443_3aData* data) { - furi_assert(data); + furi_check(data); return data->sak & ISO14443A_ATS_BIT; } uint8_t iso14443_3a_get_sak(const Iso14443_3aData* data) { - furi_assert(data); + furi_check(data); return data->sak; } void iso14443_3a_get_atqa(const Iso14443_3aData* data, uint8_t atqa[2]) { - furi_assert(data); - furi_assert(atqa); + furi_check(data); + furi_check(atqa); memcpy(atqa, data->atqa, sizeof(data->atqa)); } void iso14443_3a_set_sak(Iso14443_3aData* data, uint8_t sak) { - furi_assert(data); + furi_check(data); data->sak = sak; } void iso14443_3a_set_atqa(Iso14443_3aData* data, const uint8_t atqa[2]) { - furi_assert(data); - furi_assert(atqa); + furi_check(data); + furi_check(atqa); memcpy(data->atqa, atqa, sizeof(data->atqa)); } diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a.h b/lib/nfc/protocols/iso14443_3a/iso14443_3a.h index 005626e6285..714c1dadafb 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a.h +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a.h @@ -62,7 +62,7 @@ typedef struct { uint8_t sak; } Iso14443_3aData; -Iso14443_3aData* iso14443_3a_alloc(); +Iso14443_3aData* iso14443_3a_alloc(void); void iso14443_3a_free(Iso14443_3aData* data); diff --git a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.c b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.c index 2be88bc515d..2cf66edba57 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.c +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.c @@ -55,8 +55,8 @@ static Iso14443_3aError iso14443_3a_poller_standard_frame_exchange( } Iso14443_3aError iso14443_3a_poller_check_presence(Iso14443_3aPoller* instance) { - furi_assert(instance); - furi_assert(instance->nfc); + furi_check(instance); + furi_check(instance->nfc); NfcError error = NfcErrorNone; Iso14443_3aError ret = Iso14443_3aErrorNone; @@ -80,9 +80,9 @@ Iso14443_3aError iso14443_3a_poller_check_presence(Iso14443_3aPoller* instance) } Iso14443_3aError iso14443_3a_poller_halt(Iso14443_3aPoller* instance) { - furi_assert(instance); - furi_assert(instance->nfc); - furi_assert(instance->tx_buffer); + furi_check(instance); + furi_check(instance->nfc); + furi_check(instance->tx_buffer); uint8_t halt_cmd[2] = {0x50, 0x00}; bit_buffer_copy_bytes(instance->tx_buffer, halt_cmd, sizeof(halt_cmd)); @@ -96,10 +96,10 @@ Iso14443_3aError iso14443_3a_poller_halt(Iso14443_3aPoller* instance) { Iso14443_3aError iso14443_3a_poller_activate(Iso14443_3aPoller* instance, Iso14443_3aData* iso14443_3a_data) { - furi_assert(instance); - furi_assert(instance->nfc); - furi_assert(instance->tx_buffer); - furi_assert(instance->rx_buffer); + furi_check(instance); + furi_check(instance->nfc); + furi_check(instance->tx_buffer); + furi_check(instance->rx_buffer); // Reset Iso14443_3a poller state memset(&instance->col_res, 0, sizeof(instance->col_res)); @@ -244,9 +244,9 @@ Iso14443_3aError iso14443_3a_poller_txrx_custom_parity( const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); Iso14443_3aError ret = Iso14443_3aErrorNone; NfcError error = @@ -263,9 +263,9 @@ Iso14443_3aError iso14443_3a_poller_txrx( const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); Iso14443_3aError ret = Iso14443_3aErrorNone; NfcError error = nfc_poller_trx(instance->nfc, tx_buffer, rx_buffer, fwt); @@ -281,9 +281,9 @@ Iso14443_3aError iso14443_3a_poller_send_standard_frame( const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); Iso14443_3aError ret = iso14443_3a_poller_standard_frame_exchange(instance, tx_buffer, rx_buffer, fwt); 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 ea7a6ae156a..751a1c4ff84 100644 --- a/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_sync.c +++ b/lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_sync.c @@ -35,8 +35,8 @@ NfcCommand iso14443_3a_poller_read_callback(NfcGenericEvent event, void* context } Iso14443_3aError iso14443_3a_poller_sync_read(Nfc* nfc, Iso14443_3aData* iso14443_3a_data) { - furi_assert(nfc); - furi_assert(iso14443_3a_data); + furi_check(nfc); + furi_check(iso14443_3a_data); Iso14443_3aPollerContext poller_context = {}; poller_context.thread_id = furi_thread_get_current_id(); diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b.c b/lib/nfc/protocols/iso14443_3b/iso14443_3b.c index fd81e390da7..c2dc7e5a061 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b.c +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b.c @@ -30,24 +30,26 @@ const NfcDeviceBase nfc_device_iso14443_3b = { .get_base_data = (NfcDeviceGetBaseData)iso14443_3b_get_base_data, }; -Iso14443_3bData* iso14443_3b_alloc() { +Iso14443_3bData* iso14443_3b_alloc(void) { Iso14443_3bData* data = malloc(sizeof(Iso14443_3bData)); return data; } void iso14443_3b_free(Iso14443_3bData* data) { - furi_assert(data); + furi_check(data); free(data); } void iso14443_3b_reset(Iso14443_3bData* data) { + furi_check(data); + memset(data, 0, sizeof(Iso14443_3bData)); } void iso14443_3b_copy(Iso14443_3bData* data, const Iso14443_3bData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); *data = *other; } @@ -60,7 +62,8 @@ bool iso14443_3b_verify(Iso14443_3bData* data, const FuriString* device_type) { } bool iso14443_3b_load(Iso14443_3bData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool parsed = false; @@ -84,7 +87,8 @@ bool iso14443_3b_load(Iso14443_3bData* data, FlipperFormat* ff, uint32_t version } bool iso14443_3b_save(const Iso14443_3bData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool saved = false; @@ -107,8 +111,8 @@ bool iso14443_3b_save(const Iso14443_3bData* data, FlipperFormat* ff) { } bool iso14443_3b_is_equal(const Iso14443_3bData* data, const Iso14443_3bData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); return memcmp(data, other, sizeof(Iso14443_3bData)) == 0; } @@ -121,15 +125,16 @@ const char* iso14443_3b_get_device_name(const Iso14443_3bData* data, NfcDeviceNa } const uint8_t* iso14443_3b_get_uid(const Iso14443_3bData* data, size_t* uid_len) { - furi_assert(data); - furi_assert(uid_len); + furi_check(data); + furi_check(uid_len); *uid_len = ISO14443_3B_UID_SIZE; return data->uid; } bool iso14443_3b_set_uid(Iso14443_3bData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); + furi_check(uid); const bool uid_valid = uid_len == ISO14443_3B_UID_SIZE; @@ -146,13 +151,13 @@ Iso14443_3bData* iso14443_3b_get_base_data(const Iso14443_3bData* data) { } bool iso14443_3b_supports_iso14443_4(const Iso14443_3bData* data) { - furi_assert(data); + furi_check(data); return data->protocol_info.protocol_type == 0x01; } bool iso14443_3b_supports_bit_rate(const Iso14443_3bData* data, Iso14443_3bBitRate bit_rate) { - furi_assert(data); + furi_check(data); const uint8_t capability = data->protocol_info.bit_rate_capability; @@ -177,7 +182,7 @@ bool iso14443_3b_supports_bit_rate(const Iso14443_3bData* data, Iso14443_3bBitRa } bool iso14443_3b_supports_frame_option(const Iso14443_3bData* data, Iso14443_3bFrameOption option) { - furi_assert(data); + furi_check(data); switch(option) { case Iso14443_3bFrameOptionNad: @@ -190,15 +195,15 @@ bool iso14443_3b_supports_frame_option(const Iso14443_3bData* data, Iso14443_3bF } const uint8_t* iso14443_3b_get_application_data(const Iso14443_3bData* data, size_t* data_size) { - furi_assert(data); - furi_assert(data_size); + furi_check(data); + furi_check(data_size); *data_size = ISO14443_3B_APP_DATA_SIZE; return data->app_data; } uint16_t iso14443_3b_get_frame_size_max(const Iso14443_3bData* data) { - furi_assert(data); + furi_check(data); const uint8_t fs_bits = data->protocol_info.max_frame_size; @@ -216,7 +221,7 @@ uint16_t iso14443_3b_get_frame_size_max(const Iso14443_3bData* data) { } uint32_t iso14443_3b_get_fwt_fc_max(const Iso14443_3bData* data) { - furi_assert(data); + furi_check(data); const uint8_t fwi = data->protocol_info.fwi; return fwi < 0x0F ? 4096UL << fwi : ISO14443_3B_FDT_POLL_DEFAULT_FC; diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b.h b/lib/nfc/protocols/iso14443_3b/iso14443_3b.h index 848e610c3e8..7281dc62bb1 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b.h +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b.h @@ -40,7 +40,7 @@ typedef struct Iso14443_3bData Iso14443_3bData; // Virtual methods -Iso14443_3bData* iso14443_3b_alloc(); +Iso14443_3bData* iso14443_3b_alloc(void); void iso14443_3b_free(Iso14443_3bData* data); diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c b/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c index 1266e248258..e20a49d2451 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c @@ -64,8 +64,9 @@ static Iso14443_3bError iso14443_3b_poller_frame_exchange( } Iso14443_3bError iso14443_3b_poller_activate(Iso14443_3bPoller* instance, Iso14443_3bData* data) { - furi_assert(instance); - furi_assert(instance->nfc); + furi_check(instance); + furi_check(instance->nfc); + furi_check(data); iso14443_3b_reset(data); @@ -155,7 +156,7 @@ Iso14443_3bError iso14443_3b_poller_activate(Iso14443_3bPoller* instance, Iso144 } Iso14443_3bError iso14443_3b_poller_halt(Iso14443_3bPoller* instance) { - furi_assert(instance); + furi_check(instance); bit_buffer_reset(instance->tx_buffer); bit_buffer_reset(instance->rx_buffer); @@ -188,6 +189,10 @@ Iso14443_3bError iso14443_3b_poller_send_frame( Iso14443_3bPoller* instance, const BitBuffer* tx_buffer, BitBuffer* rx_buffer) { + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); + Iso14443_3bError ret; do { diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a.c b/lib/nfc/protocols/iso14443_4a/iso14443_4a.c index bfa2e71c643..756c3508489 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a.c +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a.c @@ -35,7 +35,7 @@ const NfcDeviceBase nfc_device_iso14443_4a = { .get_base_data = (NfcDeviceGetBaseData)iso14443_4a_get_base_data, }; -Iso14443_4aData* iso14443_4a_alloc() { +Iso14443_4aData* iso14443_4a_alloc(void) { Iso14443_4aData* data = malloc(sizeof(Iso14443_4aData)); data->iso14443_3a_data = iso14443_3a_alloc(); @@ -45,7 +45,7 @@ Iso14443_4aData* iso14443_4a_alloc() { } void iso14443_4a_free(Iso14443_4aData* data) { - furi_assert(data); + furi_check(data); simple_array_free(data->ats_data.t1_tk); iso14443_3a_free(data->iso14443_3a_data); @@ -54,7 +54,7 @@ void iso14443_4a_free(Iso14443_4aData* data) { } void iso14443_4a_reset(Iso14443_4aData* data) { - furi_assert(data); + furi_check(data); iso14443_3a_reset(data->iso14443_3a_data); @@ -68,8 +68,8 @@ void iso14443_4a_reset(Iso14443_4aData* data) { } void iso14443_4a_copy(Iso14443_4aData* data, const Iso14443_4aData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); iso14443_3a_copy(data->iso14443_3a_data, other->iso14443_3a_data); @@ -91,7 +91,8 @@ bool iso14443_4a_verify(Iso14443_4aData* data, const FuriString* device_type) { } bool iso14443_4a_load(Iso14443_4aData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool parsed = false; @@ -145,7 +146,8 @@ bool iso14443_4a_load(Iso14443_4aData* data, FlipperFormat* ff, uint32_t version } bool iso14443_4a_save(const Iso14443_4aData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool saved = false; @@ -186,6 +188,9 @@ bool iso14443_4a_save(const Iso14443_4aData* data, FlipperFormat* ff) { } bool iso14443_4a_is_equal(const Iso14443_4aData* data, const Iso14443_4aData* other) { + furi_check(data); + furi_check(other); + return iso14443_3a_is_equal(data->iso14443_3a_data, other->iso14443_3a_data); } @@ -196,23 +201,26 @@ const char* iso14443_4a_get_device_name(const Iso14443_4aData* data, NfcDeviceNa } const uint8_t* iso14443_4a_get_uid(const Iso14443_4aData* data, size_t* uid_len) { + furi_check(data); + furi_check(uid_len); + return iso14443_3a_get_uid(data->iso14443_3a_data, uid_len); } bool iso14443_4a_set_uid(Iso14443_4aData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); return iso14443_3a_set_uid(data->iso14443_3a_data, uid, uid_len); } Iso14443_3aData* iso14443_4a_get_base_data(const Iso14443_4aData* data) { - furi_assert(data); + furi_check(data); return data->iso14443_3a_data; } uint16_t iso14443_4a_get_frame_size_max(const Iso14443_4aData* data) { - furi_assert(data); + furi_check(data); const uint8_t fsci = data->ats_data.t0 & 0x0F; @@ -230,7 +238,7 @@ uint16_t iso14443_4a_get_frame_size_max(const Iso14443_4aData* data) { } uint32_t iso14443_4a_get_fwt_fc_max(const Iso14443_4aData* data) { - furi_assert(data); + furi_check(data); uint32_t fwt_fc_max = ISO14443_4A_FDT_DEFAULT_FC; @@ -248,8 +256,8 @@ uint32_t iso14443_4a_get_fwt_fc_max(const Iso14443_4aData* data) { } const uint8_t* iso14443_4a_get_historical_bytes(const Iso14443_4aData* data, uint32_t* count) { - furi_assert(data); - furi_assert(count); + furi_check(data); + furi_check(count); *count = simple_array_get_count(data->ats_data.t1_tk); const uint8_t* hist_bytes = NULL; @@ -261,7 +269,7 @@ const uint8_t* iso14443_4a_get_historical_bytes(const Iso14443_4aData* data, uin } bool iso14443_4a_supports_bit_rate(const Iso14443_4aData* data, Iso14443_4aBitRate bit_rate) { - furi_assert(data); + furi_check(data); if(!(data->ats_data.t0 & ISO14443_4A_ATS_T0_TA1)) return bit_rate == Iso14443_4aBitRateBoth106Kbit; @@ -289,7 +297,7 @@ bool iso14443_4a_supports_bit_rate(const Iso14443_4aData* data, Iso14443_4aBitRa } bool iso14443_4a_supports_frame_option(const Iso14443_4aData* data, Iso14443_4aFrameOption option) { - furi_assert(data); + furi_check(data); const Iso14443_4aAtsData* ats_data = &data->ats_data; if(!(ats_data->t0 & ISO14443_4A_ATS_T0_TC1)) return false; diff --git a/lib/nfc/protocols/iso14443_4a/iso14443_4a.h b/lib/nfc/protocols/iso14443_4a/iso14443_4a.h index df212152de1..1136a20a8a2 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a.h +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a.h @@ -46,7 +46,7 @@ typedef struct { // Virtual methods -Iso14443_4aData* iso14443_4a_alloc(); +Iso14443_4aData* iso14443_4a_alloc(void); void iso14443_4a_free(Iso14443_4aData* data); 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 938e4e715fd..a4b39859501 100644 --- a/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c +++ b/lib/nfc/protocols/iso14443_4a/iso14443_4a_poller_i.c @@ -9,7 +9,7 @@ #define ISO14443_4A_FSDI_256 (0x8U) Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance) { - furi_assert(instance); + furi_check(instance); iso14443_3a_poller_halt(instance->iso14443_3a_poller); instance->poller_state = Iso14443_4aPollerStateIdle; @@ -19,7 +19,8 @@ Iso14443_4aError iso14443_4a_poller_halt(Iso14443_4aPoller* instance) { Iso14443_4aError iso14443_4a_poller_read_ats(Iso14443_4aPoller* instance, Iso14443_4aAtsData* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->tx_buffer); bit_buffer_append_byte(instance->tx_buffer, ISO14443_4A_CMD_READ_ATS); @@ -54,7 +55,9 @@ Iso14443_4aError iso14443_4a_poller_send_block( Iso14443_4aPoller* instance, const BitBuffer* tx_buffer, BitBuffer* rx_buffer) { - furi_assert(instance); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); bit_buffer_reset(instance->tx_buffer); iso14443_4_layer_encode_block(instance->iso14443_4_layer, tx_buffer, instance->tx_buffer); diff --git a/lib/nfc/protocols/iso14443_4b/iso14443_4b.c b/lib/nfc/protocols/iso14443_4b/iso14443_4b.c index 19f2939da06..b859f9b8e47 100644 --- a/lib/nfc/protocols/iso14443_4b/iso14443_4b.c +++ b/lib/nfc/protocols/iso14443_4b/iso14443_4b.c @@ -22,7 +22,7 @@ const NfcDeviceBase nfc_device_iso14443_4b = { .get_base_data = (NfcDeviceGetBaseData)iso14443_4b_get_base_data, }; -Iso14443_4bData* iso14443_4b_alloc() { +Iso14443_4bData* iso14443_4b_alloc(void) { Iso14443_4bData* data = malloc(sizeof(Iso14443_4bData)); data->iso14443_3b_data = iso14443_3b_alloc(); @@ -30,21 +30,21 @@ Iso14443_4bData* iso14443_4b_alloc() { } void iso14443_4b_free(Iso14443_4bData* data) { - furi_assert(data); + furi_check(data); iso14443_3b_free(data->iso14443_3b_data); free(data); } void iso14443_4b_reset(Iso14443_4bData* data) { - furi_assert(data); + furi_check(data); iso14443_3b_reset(data->iso14443_3b_data); } void iso14443_4b_copy(Iso14443_4bData* data, const Iso14443_4bData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); iso14443_3b_copy(data->iso14443_3b_data, other->iso14443_3b_data); } @@ -58,16 +58,21 @@ bool iso14443_4b_verify(Iso14443_4bData* data, const FuriString* device_type) { } bool iso14443_4b_load(Iso14443_4bData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); return iso14443_3b_load(data->iso14443_3b_data, ff, version); } bool iso14443_4b_save(const Iso14443_4bData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); return iso14443_3b_save(data->iso14443_3b_data, ff); } bool iso14443_4b_is_equal(const Iso14443_4bData* data, const Iso14443_4bData* other) { + furi_check(data); + furi_check(other); + return iso14443_3b_is_equal(data->iso14443_3b_data, other->iso14443_3b_data); } @@ -78,17 +83,21 @@ const char* iso14443_4b_get_device_name(const Iso14443_4bData* data, NfcDeviceNa } const uint8_t* iso14443_4b_get_uid(const Iso14443_4bData* data, size_t* uid_len) { + furi_check(data); + furi_check(uid_len); + return iso14443_3b_get_uid(data->iso14443_3b_data, uid_len); } bool iso14443_4b_set_uid(Iso14443_4bData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); + furi_check(uid); return iso14443_3b_set_uid(data->iso14443_3b_data, uid, uid_len); } Iso14443_3bData* iso14443_4b_get_base_data(const Iso14443_4bData* data) { - furi_assert(data); + furi_check(data); return data->iso14443_3b_data; } diff --git a/lib/nfc/protocols/iso14443_4b/iso14443_4b.h b/lib/nfc/protocols/iso14443_4b/iso14443_4b.h index 1f269ed9144..c7a2ae882a5 100644 --- a/lib/nfc/protocols/iso14443_4b/iso14443_4b.h +++ b/lib/nfc/protocols/iso14443_4b/iso14443_4b.h @@ -17,7 +17,7 @@ typedef struct Iso14443_4bData Iso14443_4bData; // Virtual methods -Iso14443_4bData* iso14443_4b_alloc(); +Iso14443_4bData* iso14443_4b_alloc(void); void iso14443_4b_free(Iso14443_4bData* data); diff --git a/lib/nfc/protocols/iso14443_4b/iso14443_4b_poller_i.c b/lib/nfc/protocols/iso14443_4b/iso14443_4b_poller_i.c index 82de1d538a3..da82e14170d 100644 --- a/lib/nfc/protocols/iso14443_4b/iso14443_4b_poller_i.c +++ b/lib/nfc/protocols/iso14443_4b/iso14443_4b_poller_i.c @@ -7,7 +7,7 @@ #define TAG "Iso14443_4bPoller" Iso14443_4bError iso14443_4b_poller_halt(Iso14443_4bPoller* instance) { - furi_assert(instance); + furi_check(instance); iso14443_3b_poller_halt(instance->iso14443_3b_poller); instance->poller_state = Iso14443_4bPollerStateIdle; @@ -19,7 +19,9 @@ Iso14443_4bError iso14443_4b_poller_send_block( Iso14443_4bPoller* instance, const BitBuffer* tx_buffer, BitBuffer* rx_buffer) { - furi_assert(instance); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); bit_buffer_reset(instance->tx_buffer); iso14443_4_layer_encode_block(instance->iso14443_4_layer, tx_buffer, instance->tx_buffer); diff --git a/lib/nfc/protocols/iso15693_3/iso15693_3.c b/lib/nfc/protocols/iso15693_3/iso15693_3.c index 3203cbad000..1c94ac81142 100644 --- a/lib/nfc/protocols/iso15693_3/iso15693_3.c +++ b/lib/nfc/protocols/iso15693_3/iso15693_3.c @@ -36,7 +36,7 @@ const NfcDeviceBase nfc_device_iso15693_3 = { .get_base_data = (NfcDeviceGetBaseData)iso15693_3_get_base_data, }; -Iso15693_3Data* iso15693_3_alloc() { +Iso15693_3Data* iso15693_3_alloc(void) { Iso15693_3Data* data = malloc(sizeof(Iso15693_3Data)); data->block_data = simple_array_alloc(&simple_array_config_uint8_t); @@ -46,7 +46,7 @@ Iso15693_3Data* iso15693_3_alloc() { } void iso15693_3_free(Iso15693_3Data* data) { - furi_assert(data); + furi_check(data); simple_array_free(data->block_data); simple_array_free(data->block_security); @@ -54,7 +54,7 @@ void iso15693_3_free(Iso15693_3Data* data) { } void iso15693_3_reset(Iso15693_3Data* data) { - furi_assert(data); + furi_check(data); memset(data->uid, 0, ISO15693_3_UID_SIZE); memset(&data->system_info, 0, sizeof(Iso15693_3SystemInfo)); @@ -65,8 +65,8 @@ void iso15693_3_reset(Iso15693_3Data* data) { } void iso15693_3_copy(Iso15693_3Data* data, const Iso15693_3Data* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); memcpy(data->uid, other->uid, ISO15693_3_UID_SIZE); @@ -79,6 +79,8 @@ void iso15693_3_copy(Iso15693_3Data* data, const Iso15693_3Data* other) { bool iso15693_3_verify(Iso15693_3Data* data, const FuriString* device_type) { UNUSED(data); + furi_check(device_type); + return furi_string_equal(device_type, ISO15693_3_PROTOCOL_NAME_LEGACY); } @@ -136,7 +138,8 @@ static inline bool iso15693_3_load_security(Iso15693_3Data* data, FlipperFormat* } bool iso15693_3_load(Iso15693_3Data* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); UNUSED(version); bool loaded = false; @@ -207,7 +210,8 @@ bool iso15693_3_load(Iso15693_3Data* data, FlipperFormat* ff, uint32_t version) } bool iso15693_3_save(const Iso15693_3Data* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool saved = false; @@ -280,12 +284,15 @@ bool iso15693_3_save(const Iso15693_3Data* data, FlipperFormat* ff) { } bool iso15693_3_is_equal(const Iso15693_3Data* data, const Iso15693_3Data* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); return memcmp(data->uid, other->uid, ISO15693_3_UID_SIZE) == 0 && memcmp(&data->settings, &other->settings, sizeof(Iso15693_3Settings)) == 0 && - memcmp(&data->system_info, &other->system_info, sizeof(Iso15693_3SystemInfo)) == 0 && + memcmp( //-V1103 + &data->system_info, + &other->system_info, + sizeof(Iso15693_3SystemInfo)) == 0 && simple_array_is_equal(data->block_data, other->block_data) && simple_array_is_equal(data->block_security, other->block_security); } @@ -298,15 +305,15 @@ const char* iso15693_3_get_device_name(const Iso15693_3Data* data, NfcDeviceName } const uint8_t* iso15693_3_get_uid(const Iso15693_3Data* data, size_t* uid_len) { - furi_assert(data); + furi_check(data); if(uid_len) *uid_len = ISO15693_3_UID_SIZE; return data->uid; } bool iso15693_3_set_uid(Iso15693_3Data* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); - furi_assert(uid); + furi_check(data); + furi_check(uid); bool uid_valid = uid_len == ISO15693_3_UID_SIZE; @@ -325,33 +332,33 @@ Iso15693_3Data* iso15693_3_get_base_data(const Iso15693_3Data* data) { } bool iso15693_3_is_block_locked(const Iso15693_3Data* data, uint8_t block_index) { - furi_assert(data); - furi_assert(block_index < data->system_info.block_count); + furi_check(data); + furi_check(block_index < data->system_info.block_count); return *(const uint8_t*)simple_array_cget(data->block_security, block_index); } uint8_t iso15693_3_get_manufacturer_id(const Iso15693_3Data* data) { - furi_assert(data); + furi_check(data); return data->uid[1]; } uint16_t iso15693_3_get_block_count(const Iso15693_3Data* data) { - furi_assert(data); + furi_check(data); return data->system_info.block_count; } uint8_t iso15693_3_get_block_size(const Iso15693_3Data* data) { - furi_assert(data); + furi_check(data); return data->system_info.block_size; } const uint8_t* iso15693_3_get_block_data(const Iso15693_3Data* data, uint8_t block_index) { - furi_assert(data); - furi_assert(data->system_info.block_count > block_index); + furi_check(data); + furi_check(data->system_info.block_count > block_index); return (const uint8_t*)simple_array_cget( data->block_data, block_index * data->system_info.block_size); diff --git a/lib/nfc/protocols/iso15693_3/iso15693_3.h b/lib/nfc/protocols/iso15693_3/iso15693_3.h index 5d4158ab9e3..1120ac56e86 100644 --- a/lib/nfc/protocols/iso15693_3/iso15693_3.h +++ b/lib/nfc/protocols/iso15693_3/iso15693_3.h @@ -122,7 +122,7 @@ typedef struct { SimpleArray* block_security; } Iso15693_3Data; -Iso15693_3Data* iso15693_3_alloc(); +Iso15693_3Data* iso15693_3_alloc(void); void iso15693_3_free(Iso15693_3Data* data); diff --git a/lib/nfc/protocols/iso15693_3/iso15693_3_poller_i.c b/lib/nfc/protocols/iso15693_3/iso15693_3_poller_i.c index 94939030547..6aee84a3f1e 100644 --- a/lib/nfc/protocols/iso15693_3/iso15693_3_poller_i.c +++ b/lib/nfc/protocols/iso15693_3/iso15693_3_poller_i.c @@ -38,6 +38,8 @@ Iso15693_3Error iso15693_3_poller_send_frame( BitBuffer* rx_buffer, uint32_t fwt) { furi_assert(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); Iso15693_3Error ret = Iso15693_3ErrorNone; diff --git a/lib/nfc/protocols/mf_classic/crypto1.c b/lib/nfc/protocols/mf_classic/crypto1.c index e06eae3707a..938d2765a31 100644 --- a/lib/nfc/protocols/mf_classic/crypto1.c +++ b/lib/nfc/protocols/mf_classic/crypto1.c @@ -13,7 +13,7 @@ #define BEBIT(x, n) FURI_BIT(x, (n) ^ 24) -Crypto1* crypto1_alloc() { +Crypto1* crypto1_alloc(void) { Crypto1* instance = malloc(sizeof(Crypto1)); return instance; diff --git a/lib/nfc/protocols/mf_classic/crypto1.h b/lib/nfc/protocols/mf_classic/crypto1.h index 7cc16fcffde..e71ab9a4089 100644 --- a/lib/nfc/protocols/mf_classic/crypto1.h +++ b/lib/nfc/protocols/mf_classic/crypto1.h @@ -11,7 +11,7 @@ typedef struct { uint32_t even; } Crypto1; -Crypto1* crypto1_alloc(); +Crypto1* crypto1_alloc(void); void crypto1_free(Crypto1* instance); diff --git a/lib/nfc/protocols/mf_classic/mf_classic.c b/lib/nfc/protocols/mf_classic/mf_classic.c index 361c53c3d8b..5fee3eb7b41 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic.c +++ b/lib/nfc/protocols/mf_classic/mf_classic.c @@ -56,28 +56,28 @@ const NfcDeviceBase nfc_device_mf_classic = { .get_base_data = (NfcDeviceGetBaseData)mf_classic_get_base_data, }; -MfClassicData* mf_classic_alloc() { +MfClassicData* mf_classic_alloc(void) { MfClassicData* data = malloc(sizeof(MfClassicData)); data->iso14443_3a_data = iso14443_3a_alloc(); return data; } void mf_classic_free(MfClassicData* data) { - furi_assert(data); + furi_check(data); iso14443_3a_free(data->iso14443_3a_data); free(data); } void mf_classic_reset(MfClassicData* data) { - furi_assert(data); + furi_check(data); iso14443_3a_reset(data->iso14443_3a_data); } void mf_classic_copy(MfClassicData* data, const MfClassicData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); iso14443_3a_copy(data->iso14443_3a_data, other->iso14443_3a_data); for(size_t i = 0; i < COUNT_OF(data->block); i++) { @@ -92,7 +92,9 @@ void mf_classic_copy(MfClassicData* data, const MfClassicData* other) { } bool mf_classic_verify(MfClassicData* data, const FuriString* device_type) { + furi_check(device_type); UNUSED(data); + return furi_string_equal_str(device_type, "Mifare Classic"); } @@ -146,7 +148,8 @@ static void mf_classic_parse_block(FuriString* block_str, MfClassicData* data, u } bool mf_classic_load(MfClassicData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* temp_str = furi_string_alloc(); bool parsed = false; @@ -255,7 +258,8 @@ static void } bool mf_classic_save(const MfClassicData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* temp_str = furi_string_alloc(); bool saved = false; @@ -297,6 +301,9 @@ bool mf_classic_save(const MfClassicData* data, FlipperFormat* ff) { } bool mf_classic_is_equal(const MfClassicData* data, const MfClassicData* other) { + furi_check(data); + furi_check(other); + bool is_equal = false; bool data_array_is_equal = true; @@ -329,8 +336,8 @@ bool mf_classic_is_equal(const MfClassicData* data, const MfClassicData* other) } const char* mf_classic_get_device_name(const MfClassicData* data, NfcDeviceNameType name_type) { - furi_assert(data); - furi_assert(data->type < MfClassicTypeNum); + furi_check(data); + furi_check(data->type < MfClassicTypeNum); if(name_type == NfcDeviceNameTypeFull) { return mf_classic_features[data->type].full_name; @@ -340,13 +347,13 @@ const char* mf_classic_get_device_name(const MfClassicData* data, NfcDeviceNameT } const uint8_t* mf_classic_get_uid(const MfClassicData* data, size_t* uid_len) { - furi_assert(data); + furi_check(data); return iso14443_3a_get_uid(data->iso14443_3a_data, uid_len); } bool mf_classic_set_uid(MfClassicData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); bool uid_valid = iso14443_3a_set_uid(data->iso14443_3a_data, uid, uid_len); @@ -370,16 +377,18 @@ bool mf_classic_set_uid(MfClassicData* data, const uint8_t* uid, size_t uid_len) } Iso14443_3aData* mf_classic_get_base_data(const MfClassicData* data) { - furi_assert(data); + furi_check(data); return data->iso14443_3a_data; } uint8_t mf_classic_get_total_sectors_num(MfClassicType type) { + furi_check(type < MfClassicTypeNum); return mf_classic_features[type].sectors_total; } uint16_t mf_classic_get_total_block_num(MfClassicType type) { + furi_check(type < MfClassicTypeNum); return mf_classic_features[type].blocks_total; } @@ -411,7 +420,7 @@ uint8_t mf_classic_get_sector_trailer_num_by_block(uint8_t block) { MfClassicSectorTrailer* mf_classic_get_sector_trailer_by_sector(const MfClassicData* data, uint8_t sector_num) { - furi_assert(data); + furi_check(data); uint8_t sec_tr_block = mf_classic_get_sector_trailer_num_by_sector(sector_num); MfClassicSectorTrailer* sec_trailer = (MfClassicSectorTrailer*)&data->block[sec_tr_block]; @@ -436,7 +445,8 @@ uint8_t mf_classic_get_sector_by_block(uint8_t block) { } bool mf_classic_block_to_value(const MfClassicBlock* block, int32_t* value, uint8_t* addr) { - furi_assert(block); + furi_check(block); + furi_check(value); uint32_t v = *(uint32_t*)&block->data[0]; uint32_t v_inv = *(uint32_t*)&block->data[sizeof(uint32_t)]; @@ -445,9 +455,7 @@ bool mf_classic_block_to_value(const MfClassicBlock* block, int32_t* value, uint bool val_checks = ((v == v1) && (v == ~v_inv) && (block->data[12] == (~block->data[13] & 0xFF)) && (block->data[14] == (~block->data[15] & 0xFF)) && (block->data[12] == block->data[14])); - if(value) { - *value = (int32_t)v; - } + *value = (int32_t)v; if(addr) { *addr = block->data[12]; } @@ -455,7 +463,7 @@ bool mf_classic_block_to_value(const MfClassicBlock* block, int32_t* value, uint } void mf_classic_value_to_block(int32_t value, uint8_t addr, MfClassicBlock* block) { - furi_assert(block); + furi_check(block); uint32_t v_inv = ~((uint32_t)value); @@ -473,7 +481,7 @@ bool mf_classic_is_key_found( const MfClassicData* data, uint8_t sector_num, MfClassicKeyType key_type) { - furi_assert(data); + furi_check(data); bool key_found = false; if(key_type == MfClassicKeyTypeA) { @@ -490,7 +498,7 @@ void mf_classic_set_key_found( uint8_t sector_num, MfClassicKeyType key_type, uint64_t key) { - furi_assert(data); + furi_check(data); uint8_t key_arr[6] = {}; MfClassicSectorTrailer* sec_trailer = @@ -509,7 +517,7 @@ void mf_classic_set_key_not_found( MfClassicData* data, uint8_t sector_num, MfClassicKeyType key_type) { - furi_assert(data); + furi_check(data); if(key_type == MfClassicKeyTypeA) { FURI_BIT_CLEAR(data->key_a_mask, sector_num); @@ -519,13 +527,14 @@ void mf_classic_set_key_not_found( } bool mf_classic_is_block_read(const MfClassicData* data, uint8_t block_num) { - furi_assert(data); + furi_check(data); 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) { - furi_assert(data); + furi_check(data); + furi_check(block_data); if(mf_classic_is_sector_trailer(block_num)) { memcpy(&data->block[block_num].data[6], &block_data->data[6], 4); @@ -536,7 +545,7 @@ void mf_classic_set_block_read(MfClassicData* data, uint8_t block_num, MfClassic } uint8_t mf_classic_get_first_block_num_of_sector(uint8_t sector) { - furi_assert(sector < 40); + furi_check(sector < 40); uint8_t block = 0; if(sector < 32) { @@ -549,7 +558,8 @@ uint8_t mf_classic_get_first_block_num_of_sector(uint8_t sector) { } uint8_t mf_classic_get_blocks_num_in_sector(uint8_t sector) { - furi_assert(sector < 40); + furi_check(sector < 40); + return sector < 32 ? 4 : 16; } @@ -557,9 +567,9 @@ void mf_classic_get_read_sectors_and_keys( const MfClassicData* data, uint8_t* sectors_read, uint8_t* keys_found) { - furi_assert(data); - furi_assert(sectors_read); - furi_assert(keys_found); + furi_check(data); + furi_check(sectors_read); + furi_check(keys_found); *sectors_read = 0; *keys_found = 0; @@ -585,7 +595,7 @@ void mf_classic_get_read_sectors_and_keys( } bool mf_classic_is_card_read(const MfClassicData* data) { - furi_assert(data); + furi_check(data); uint8_t sectors_total = mf_classic_get_total_sectors_num(data->type); uint8_t sectors_read = 0; @@ -597,7 +607,7 @@ bool mf_classic_is_card_read(const MfClassicData* data) { } bool mf_classic_is_sector_read(const MfClassicData* data, uint8_t sector_num) { - furi_assert(data); + furi_check(data); bool sector_read = false; do { @@ -662,7 +672,7 @@ bool mf_classic_is_allowed_access_data_block( uint8_t block_num, MfClassicKeyType key_type, MfClassicAction action) { - furi_assert(sec_tr); + furi_check(sec_tr); uint8_t* access_bits_arr = sec_tr->access_bits.data; @@ -732,7 +742,7 @@ bool mf_classic_is_allowed_access( uint8_t block_num, MfClassicKeyType key_type, MfClassicAction action) { - furi_assert(data); + furi_check(data); bool access_allowed = false; if(mf_classic_is_sector_trailer(block_num)) { @@ -749,7 +759,7 @@ bool mf_classic_is_allowed_access( } bool mf_classic_is_value_block(MfClassicSectorTrailer* sec_tr, uint8_t block_num) { - furi_assert(sec_tr); + furi_check(sec_tr); // Check if key A can write, if it can, it's transport configuration, not data block return !mf_classic_is_allowed_access_data_block( diff --git a/lib/nfc/protocols/mf_classic/mf_classic.h b/lib/nfc/protocols/mf_classic/mf_classic.h index 755c457d167..b42e09ab1d3 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic.h +++ b/lib/nfc/protocols/mf_classic/mf_classic.h @@ -143,7 +143,7 @@ typedef struct { extern const NfcDeviceBase nfc_device_mf_classic; -MfClassicData* mf_classic_alloc(); +MfClassicData* mf_classic_alloc(void); void mf_classic_free(MfClassicData* data); diff --git a/lib/nfc/protocols/mf_classic/mf_classic_poller_i.c b/lib/nfc/protocols/mf_classic/mf_classic_poller_i.c index 3f8b9348294..2b01e74eedb 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic_poller_i.c +++ b/lib/nfc/protocols/mf_classic/mf_classic_poller_i.c @@ -90,6 +90,8 @@ MfClassicError mf_classic_poller_get_nt( uint8_t block_num, MfClassicKeyType key_type, MfClassicNt* nt) { + furi_check(instance); + return mf_classic_poller_get_nt_common(instance, block_num, key_type, nt, false); } @@ -98,6 +100,8 @@ MfClassicError mf_classic_poller_get_nt_nested( uint8_t block_num, MfClassicKeyType key_type, MfClassicNt* nt) { + furi_check(instance); + return mf_classic_poller_get_nt_common(instance, block_num, key_type, nt, true); } @@ -179,6 +183,8 @@ MfClassicError mf_classic_poller_auth( MfClassicKey* key, MfClassicKeyType key_type, MfClassicAuthContext* data) { + furi_check(instance); + furi_check(key); return mf_classic_poller_auth_common(instance, block_num, key, key_type, data, false); } @@ -188,10 +194,14 @@ MfClassicError mf_classic_poller_auth_nested( MfClassicKey* key, MfClassicKeyType key_type, MfClassicAuthContext* data) { + furi_check(instance); + furi_check(key); return mf_classic_poller_auth_common(instance, block_num, key, key_type, data, true); } MfClassicError mf_classic_poller_halt(MfClassicPoller* instance) { + furi_check(instance); + MfClassicError ret = MfClassicErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -223,6 +233,9 @@ MfClassicError mf_classic_poller_read_block( MfClassicPoller* instance, uint8_t block_num, MfClassicBlock* data) { + furi_check(instance); + furi_check(data); + MfClassicError ret = MfClassicErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -269,6 +282,9 @@ MfClassicError mf_classic_poller_write_block( MfClassicPoller* instance, uint8_t block_num, MfClassicBlock* data) { + furi_check(instance); + furi_check(data); + MfClassicError ret = MfClassicErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -341,6 +357,8 @@ MfClassicError mf_classic_poller_value_cmd( uint8_t block_num, MfClassicValueCommand cmd, int32_t data) { + furi_check(instance); + MfClassicError ret = MfClassicErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -407,6 +425,8 @@ MfClassicError mf_classic_poller_value_cmd( } MfClassicError mf_classic_poller_value_transfer(MfClassicPoller* instance, uint8_t block_num) { + furi_check(instance); + MfClassicError ret = MfClassicErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; diff --git a/lib/nfc/protocols/mf_classic/mf_classic_poller_sync.c b/lib/nfc/protocols/mf_classic/mf_classic_poller_sync.c index 8566a861254..cc6bc090855 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic_poller_sync.c +++ b/lib/nfc/protocols/mf_classic/mf_classic_poller_sync.c @@ -225,7 +225,7 @@ MfClassicError mf_classic_poller_sync_collect_nt( uint8_t block_num, MfClassicKeyType key_type, MfClassicNt* nt) { - furi_assert(nfc); + furi_check(nfc); MfClassicPollerContext poller_context = { .cmd_type = MfClassicPollerCmdTypeCollectNt, @@ -250,8 +250,8 @@ MfClassicError mf_classic_poller_sync_auth( MfClassicKey* key, MfClassicKeyType key_type, MfClassicAuthContext* data) { - furi_assert(nfc); - furi_assert(key); + furi_check(nfc); + furi_check(key); MfClassicPollerContext poller_context = { .cmd_type = MfClassicPollerCmdTypeAuth, @@ -277,9 +277,9 @@ MfClassicError mf_classic_poller_sync_read_block( MfClassicKey* key, MfClassicKeyType key_type, MfClassicBlock* data) { - furi_assert(nfc); - furi_assert(key); - furi_assert(data); + furi_check(nfc); + furi_check(key); + furi_check(data); MfClassicPollerContext poller_context = { .cmd_type = MfClassicPollerCmdTypeReadBlock, @@ -303,9 +303,9 @@ MfClassicError mf_classic_poller_sync_write_block( MfClassicKey* key, MfClassicKeyType key_type, MfClassicBlock* data) { - furi_assert(nfc); - furi_assert(key); - furi_assert(data); + furi_check(nfc); + furi_check(key); + furi_check(data); MfClassicPollerContext poller_context = { .cmd_type = MfClassicPollerCmdTypeWriteBlock, @@ -326,9 +326,9 @@ MfClassicError mf_classic_poller_sync_read_value( MfClassicKey* key, MfClassicKeyType key_type, int32_t* value) { - furi_assert(nfc); - furi_assert(key); - furi_assert(value); + furi_check(nfc); + furi_check(key); + furi_check(value); MfClassicPollerContext poller_context = { .cmd_type = MfClassicPollerCmdTypeReadValue, @@ -353,9 +353,9 @@ MfClassicError mf_classic_poller_sync_change_value( MfClassicKeyType key_type, int32_t data, int32_t* new_value) { - furi_assert(nfc); - furi_assert(key); - furi_assert(new_value); + furi_check(nfc); + furi_check(key); + furi_check(new_value); MfClassicValueCommand command = MfClassicValueCommandRestore; int32_t command_data = 0; @@ -459,9 +459,9 @@ NfcCommand mf_classic_poller_read_callback(NfcGenericEvent event, void* context) MfClassicError mf_classic_poller_sync_read(Nfc* nfc, const MfClassicDeviceKeys* keys, MfClassicData* data) { - furi_assert(nfc); - furi_assert(keys); - furi_assert(data); + furi_check(nfc); + furi_check(keys); + furi_check(data); MfClassicError error = MfClassicErrorNone; MfClassicPollerContext poller_context = {}; @@ -493,8 +493,8 @@ MfClassicError } MfClassicError mf_classic_poller_sync_detect_type(Nfc* nfc, MfClassicType* type) { - furi_assert(nfc); - furi_assert(type); + furi_check(nfc); + furi_check(type); MfClassicError error = MfClassicErrorNone; diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire.c b/lib/nfc/protocols/mf_desfire/mf_desfire.c index b83198a25e6..4d54a2c0e16 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire.c @@ -20,7 +20,7 @@ const NfcDeviceBase nfc_device_mf_desfire = { .get_base_data = (NfcDeviceGetBaseData)mf_desfire_get_base_data, }; -MfDesfireData* mf_desfire_alloc() { +MfDesfireData* mf_desfire_alloc(void) { MfDesfireData* data = malloc(sizeof(MfDesfireData)); data->iso14443_4a_data = iso14443_4a_alloc(); data->master_key_versions = simple_array_alloc(&mf_desfire_key_version_array_config); @@ -31,7 +31,7 @@ MfDesfireData* mf_desfire_alloc() { } void mf_desfire_free(MfDesfireData* data) { - furi_assert(data); + furi_check(data); mf_desfire_reset(data); simple_array_free(data->applications); @@ -42,7 +42,7 @@ void mf_desfire_free(MfDesfireData* data) { } void mf_desfire_reset(MfDesfireData* data) { - furi_assert(data); + furi_check(data); iso14443_4a_reset(data->iso14443_4a_data); @@ -55,8 +55,8 @@ void mf_desfire_reset(MfDesfireData* data) { } void mf_desfire_copy(MfDesfireData* data, const MfDesfireData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); mf_desfire_reset(data); @@ -77,7 +77,8 @@ bool mf_desfire_verify(MfDesfireData* data, const FuriString* device_type) { } bool mf_desfire_load(MfDesfireData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* prefix = furi_string_alloc(); @@ -143,7 +144,8 @@ bool mf_desfire_load(MfDesfireData* data, FlipperFormat* ff, uint32_t version) { } bool mf_desfire_save(const MfDesfireData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* prefix = furi_string_alloc(); @@ -208,12 +210,15 @@ bool mf_desfire_save(const MfDesfireData* data, FlipperFormat* ff) { } bool mf_desfire_is_equal(const MfDesfireData* data, const MfDesfireData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); return iso14443_4a_is_equal(data->iso14443_4a_data, other->iso14443_4a_data) && memcmp(&data->version, &other->version, sizeof(MfDesfireVersion)) == 0 && - memcmp(&data->free_memory, &other->free_memory, sizeof(MfDesfireFreeMemory)) == 0 && + memcmp( //-V1103 + &data->free_memory, + &other->free_memory, + sizeof(MfDesfireFreeMemory)) == 0 && memcmp( &data->master_key_settings, &other->master_key_settings, @@ -230,25 +235,29 @@ const char* mf_desfire_get_device_name(const MfDesfireData* data, NfcDeviceNameT } const uint8_t* mf_desfire_get_uid(const MfDesfireData* data, size_t* uid_len) { - furi_assert(data); + furi_check(data); + furi_check(uid_len); return iso14443_4a_get_uid(data->iso14443_4a_data, uid_len); } bool mf_desfire_set_uid(MfDesfireData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); return iso14443_4a_set_uid(data->iso14443_4a_data, uid, uid_len); } Iso14443_4aData* mf_desfire_get_base_data(const MfDesfireData* data) { - furi_assert(data); + furi_check(data); return data->iso14443_4a_data; } const MfDesfireApplication* mf_desfire_get_application(const MfDesfireData* data, const MfDesfireApplicationId* app_id) { + furi_check(data); + furi_check(app_id); + MfDesfireApplication* app = NULL; for(uint32_t i = 0; i < simple_array_get_count(data->application_ids); ++i) { @@ -263,6 +272,9 @@ const MfDesfireApplication* const MfDesfireFileSettings* mf_desfire_get_file_settings(const MfDesfireApplication* data, const MfDesfireFileId* file_id) { + furi_check(data); + furi_check(file_id); + MfDesfireFileSettings* file_settings = NULL; for(uint32_t i = 0; i < simple_array_get_count(data->file_ids); ++i) { @@ -277,6 +289,9 @@ const MfDesfireFileSettings* const MfDesfireFileData* mf_desfire_get_file_data(const MfDesfireApplication* data, const MfDesfireFileId* file_id) { + furi_check(data); + furi_check(file_id); + MfDesfireFileData* file_data = NULL; for(uint32_t i = 0; i < simple_array_get_count(data->file_ids); ++i) { diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire.h b/lib/nfc/protocols/mf_desfire/mf_desfire.h index 8505b792aa5..4c307538606 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire.h +++ b/lib/nfc/protocols/mf_desfire/mf_desfire.h @@ -152,7 +152,7 @@ extern const NfcDeviceBase nfc_device_mf_desfire; // Virtual methods -MfDesfireData* mf_desfire_alloc(); +MfDesfireData* mf_desfire_alloc(void); void mf_desfire_free(MfDesfireData* data); diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c index 0b2d8413828..4990e0c0686 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c @@ -23,12 +23,12 @@ MfDesfireError mf_desfire_send_chunks( MfDesfirePoller* instance, const BitBuffer* tx_buffer, BitBuffer* rx_buffer) { - furi_assert(instance); - furi_assert(instance->iso14443_4a_poller); - furi_assert(instance->tx_buffer); - furi_assert(instance->rx_buffer); - furi_assert(tx_buffer); - furi_assert(rx_buffer); + furi_check(instance); + furi_check(instance->iso14443_4a_poller); + furi_check(instance->tx_buffer); + furi_check(instance->rx_buffer); + furi_check(tx_buffer); + furi_check(rx_buffer); MfDesfireError error = MfDesfireErrorNone; @@ -75,7 +75,7 @@ MfDesfireError mf_desfire_send_chunks( } MfDesfireError mf_desfire_poller_read_version(MfDesfirePoller* instance, MfDesfireVersion* data) { - furi_assert(instance); + furi_check(instance); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_VERSION); @@ -97,7 +97,7 @@ MfDesfireError mf_desfire_poller_read_version(MfDesfirePoller* instance, MfDesfi MfDesfireError mf_desfire_poller_read_free_memory(MfDesfirePoller* instance, MfDesfireFreeMemory* data) { - furi_assert(instance); + furi_check(instance); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_FREE_MEMORY); @@ -119,7 +119,7 @@ MfDesfireError MfDesfireError mf_desfire_poller_read_key_settings(MfDesfirePoller* instance, MfDesfireKeySettings* data) { - furi_assert(instance); + furi_check(instance); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_KEY_SETTINGS); @@ -143,8 +143,8 @@ MfDesfireError mf_desfire_poller_read_key_versions( MfDesfirePoller* instance, SimpleArray* data, uint32_t count) { - furi_assert(instance); - furi_assert(count > 0); + furi_check(instance); + furi_check(count > 0); simple_array_init(data, count); @@ -171,7 +171,8 @@ MfDesfireError mf_desfire_poller_read_key_versions( MfDesfireError mf_desfire_poller_read_application_ids(MfDesfirePoller* instance, SimpleArray* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_APPLICATION_IDS); @@ -204,7 +205,7 @@ MfDesfireError MfDesfireError mf_desfire_poller_select_application( MfDesfirePoller* instance, const MfDesfireApplicationId* id) { - furi_assert(instance); + furi_check(instance); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_SELECT_APPLICATION); @@ -218,7 +219,8 @@ MfDesfireError mf_desfire_poller_select_application( } MfDesfireError mf_desfire_poller_read_file_ids(MfDesfirePoller* instance, SimpleArray* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_FILE_IDS); @@ -251,7 +253,8 @@ MfDesfireError mf_desfire_poller_read_file_settings( MfDesfirePoller* instance, MfDesfireFileId id, MfDesfireFileSettings* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_FILE_SETTINGS); @@ -276,7 +279,9 @@ MfDesfireError mf_desfire_poller_read_file_settings_multi( MfDesfirePoller* instance, const SimpleArray* file_ids, SimpleArray* data) { - furi_assert(instance); + furi_check(instance); + furi_check(file_ids); + furi_check(data); MfDesfireError error = MfDesfireErrorNone; @@ -300,7 +305,8 @@ MfDesfireError mf_desfire_poller_read_file_data( uint32_t offset, size_t size, MfDesfireFileData* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_READ_DATA); @@ -327,7 +333,8 @@ MfDesfireError mf_desfire_poller_read_file_value( MfDesfirePoller* instance, MfDesfireFileId id, MfDesfireFileData* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_GET_VALUE); @@ -354,7 +361,8 @@ MfDesfireError mf_desfire_poller_read_file_records( uint32_t offset, size_t size, MfDesfireFileData* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); bit_buffer_reset(instance->input_buffer); bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_READ_RECORDS); @@ -382,8 +390,11 @@ MfDesfireError mf_desfire_poller_read_file_data_multi( const SimpleArray* file_ids, const SimpleArray* file_settings, SimpleArray* data) { - furi_assert(instance); - furi_assert(simple_array_get_count(file_ids) == simple_array_get_count(file_settings)); + furi_check(instance); + furi_check(file_ids); + furi_check(file_settings); + furi_check(data); + furi_check(simple_array_get_count(file_ids) == simple_array_get_count(file_settings)); MfDesfireError error = MfDesfireErrorNone; @@ -419,8 +430,8 @@ MfDesfireError mf_desfire_poller_read_file_data_multi( MfDesfireError mf_desfire_poller_read_application(MfDesfirePoller* instance, MfDesfireApplication* data) { - furi_assert(instance); - furi_assert(data); + furi_check(instance); + furi_check(data); MfDesfireError error; @@ -452,7 +463,8 @@ MfDesfireError mf_desfire_poller_read_applications( MfDesfirePoller* instance, const SimpleArray* app_ids, SimpleArray* data) { - furi_assert(instance); + furi_check(instance); + furi_check(data); MfDesfireError error = MfDesfireErrorNone; diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c index d4c5ba103f3..74436dc0895 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight.c @@ -168,28 +168,28 @@ const NfcDeviceBase nfc_device_mf_ultralight = { .get_base_data = (NfcDeviceGetBaseData)mf_ultralight_get_base_data, }; -MfUltralightData* mf_ultralight_alloc() { +MfUltralightData* mf_ultralight_alloc(void) { MfUltralightData* data = malloc(sizeof(MfUltralightData)); data->iso14443_3a_data = iso14443_3a_alloc(); return data; } void mf_ultralight_free(MfUltralightData* data) { - furi_assert(data); + furi_check(data); iso14443_3a_free(data->iso14443_3a_data); free(data); } void mf_ultralight_reset(MfUltralightData* data) { - furi_assert(data); + furi_check(data); iso14443_3a_reset(data->iso14443_3a_data); } void mf_ultralight_copy(MfUltralightData* data, const MfUltralightData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); iso14443_3a_copy(data->iso14443_3a_data, other->iso14443_3a_data); for(size_t i = 0; i < COUNT_OF(data->counter); i++) { @@ -222,7 +222,8 @@ static const char* } bool mf_ultralight_verify(MfUltralightData* data, const FuriString* device_type) { - furi_assert(data); + furi_check(data); + furi_check(device_type); bool verified = false; @@ -239,7 +240,8 @@ bool mf_ultralight_verify(MfUltralightData* data, const FuriString* device_type) } bool mf_ultralight_load(MfUltralightData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* temp_str = furi_string_alloc(); bool parsed = false; @@ -338,7 +340,8 @@ bool mf_ultralight_load(MfUltralightData* data, FlipperFormat* ff, uint32_t vers } bool mf_ultralight_save(const MfUltralightData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* temp_str = furi_string_alloc(); bool saved = false; @@ -419,6 +422,9 @@ bool mf_ultralight_save(const MfUltralightData* data, FlipperFormat* ff) { } bool mf_ultralight_is_equal(const MfUltralightData* data, const MfUltralightData* other) { + furi_check(data); + furi_check(other); + bool is_equal = false; bool data_array_is_equal = true; @@ -467,20 +473,20 @@ bool mf_ultralight_is_equal(const MfUltralightData* data, const MfUltralightData const char* mf_ultralight_get_device_name(const MfUltralightData* data, NfcDeviceNameType name_type) { - furi_assert(data); - furi_assert(data->type < MfUltralightTypeNum); + furi_check(data); + furi_check(data->type < MfUltralightTypeNum); return mf_ultralight_get_device_name_by_type(data->type, name_type); } const uint8_t* mf_ultralight_get_uid(const MfUltralightData* data, size_t* uid_len) { - furi_assert(data); + furi_check(data); return iso14443_3a_get_uid(data->iso14443_3a_data, uid_len); } bool mf_ultralight_set_uid(MfUltralightData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); bool uid_valid = iso14443_3a_set_uid(data->iso14443_3a_data, uid, uid_len); @@ -498,13 +504,13 @@ bool mf_ultralight_set_uid(MfUltralightData* data, const uint8_t* uid, size_t ui } Iso14443_3aData* mf_ultralight_get_base_data(const MfUltralightData* data) { - furi_assert(data); + furi_check(data); return data->iso14443_3a_data; } MfUltralightType mf_ultralight_get_type_by_version(MfUltralightVersion* version) { - furi_assert(version); + furi_check(version); MfUltralightType type = MfUltralightTypeUnknown; @@ -538,15 +544,19 @@ MfUltralightType mf_ultralight_get_type_by_version(MfUltralightVersion* version) } uint16_t mf_ultralight_get_pages_total(MfUltralightType type) { + furi_check(type < MfUltralightTypeNum); + return mf_ultralight_features[type].total_pages; } uint32_t mf_ultralight_get_feature_support_set(MfUltralightType type) { + furi_check(type < MfUltralightTypeNum); + return mf_ultralight_features[type].feature_set; } bool mf_ultralight_detect_protocol(const Iso14443_3aData* iso14443_3a_data) { - furi_assert(iso14443_3a_data); + furi_check(iso14443_3a_data); bool mfu_detected = (iso14443_3a_data->atqa[0] == 0x44) && (iso14443_3a_data->atqa[1] == 0x00) && (iso14443_3a_data->sak == 0x00); @@ -555,10 +565,14 @@ bool mf_ultralight_detect_protocol(const Iso14443_3aData* iso14443_3a_data) { } uint16_t mf_ultralight_get_config_page_num(MfUltralightType type) { + furi_check(type < MfUltralightTypeNum); + return mf_ultralight_features[type].config_page; } uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) { + furi_check(type < MfUltralightTypeNum); + uint8_t config_page = mf_ultralight_features[type].config_page; return (config_page != 0) ? config_page + 2 : 0; } @@ -574,8 +588,8 @@ bool mf_ultralight_support_feature(const uint32_t feature_set, const uint32_t fe } bool mf_ultralight_get_config_page(const MfUltralightData* data, MfUltralightConfigPages** config) { - furi_assert(data); - furi_assert(config); + furi_check(data); + furi_check(config); bool config_pages_found = false; @@ -589,7 +603,7 @@ bool mf_ultralight_get_config_page(const MfUltralightData* data, MfUltralightCon } bool mf_ultralight_is_all_data_read(const MfUltralightData* data) { - furi_assert(data); + furi_check(data); bool all_read = false; if(data->pages_read == data->pages_total || @@ -616,7 +630,7 @@ bool mf_ultralight_is_all_data_read(const MfUltralightData* data) { } bool mf_ultralight_is_counter_configured(const MfUltralightData* data) { - furi_assert(data); + furi_check(data); MfUltralightConfigPages* config = NULL; bool configured = false; diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight.h b/lib/nfc/protocols/mf_ultralight/mf_ultralight.h index 4786b18253c..5e348a0c91a 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight.h +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight.h @@ -177,7 +177,7 @@ typedef struct { extern const NfcDeviceBase nfc_device_mf_ultralight; -MfUltralightData* mf_ultralight_alloc(); +MfUltralightData* mf_ultralight_alloc(void); void mf_ultralight_free(MfUltralightData* data); diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.c index 2d88db3e598..cc3433f7318 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_i.c @@ -33,6 +33,9 @@ MfUltralightError mf_ultralight_process_error(Iso14443_3aError error) { MfUltralightError mf_ultralight_poller_auth_pwd( MfUltralightPoller* instance, MfUltralightPollerAuthContext* data) { + furi_check(instance); + furi_check(data); + uint8_t auth_cmd[5] = {MF_ULTRALIGHT_CMD_PWD_AUTH}; //-V1009 memccpy(&auth_cmd[1], data->password.data, 0, MF_ULTRALIGHT_AUTH_PASSWORD_SIZE); bit_buffer_copy_bytes(instance->tx_buffer, auth_cmd, sizeof(auth_cmd)); @@ -60,6 +63,8 @@ MfUltralightError mf_ultralight_poller_auth_pwd( } MfUltralightError mf_ultralight_poller_authenticate(MfUltralightPoller* instance) { + furi_check(instance); + uint8_t auth_cmd[2] = {MF_ULTRALIGHT_CMD_AUTH, 0x00}; bit_buffer_copy_bytes(instance->tx_buffer, auth_cmd, sizeof(auth_cmd)); @@ -91,6 +96,9 @@ MfUltralightError mf_ultralight_poller_read_page_from_sector( uint8_t sector, uint8_t tag, MfUltralightPageReadCommandData* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -132,6 +140,9 @@ MfUltralightError mf_ultralight_poller_read_page( MfUltralightPoller* instance, uint8_t start_page, MfUltralightPageReadCommandData* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -162,6 +173,9 @@ MfUltralightError mf_ultralight_poller_write_page( MfUltralightPoller* instance, uint8_t page, const MfUltralightPage* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -193,6 +207,9 @@ MfUltralightError mf_ultralight_poller_write_page( MfUltralightError mf_ultralight_poller_read_version(MfUltralightPoller* instance, MfUltralightVersion* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -222,6 +239,9 @@ MfUltralightError MfUltralightError mf_ultralight_poller_read_signature(MfUltralightPoller* instance, MfUltralightSignature* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -251,6 +271,9 @@ MfUltralightError mf_ultralight_poller_read_counter( MfUltralightPoller* instance, uint8_t counter_num, MfUltralightCounter* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; @@ -280,6 +303,9 @@ MfUltralightError mf_ultralight_poller_read_tearing_flag( MfUltralightPoller* instance, uint8_t tearing_falg_num, MfUltralightTearingFlag* data) { + furi_check(instance); + furi_check(data); + MfUltralightError ret = MfUltralightErrorNone; Iso14443_3aError error = Iso14443_3aErrorNone; diff --git a/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_sync.c b/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_sync.c index c4833facf0f..157e2bdef7b 100644 --- a/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_sync.c +++ b/lib/nfc/protocols/mf_ultralight/mf_ultralight_poller_sync.c @@ -119,8 +119,8 @@ static MfUltralightError MfUltralightError mf_ultralight_poller_sync_read_page(Nfc* nfc, uint16_t page, MfUltralightPage* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = { .cmd_type = MfUltralightPollerCmdTypeReadPage, @@ -138,8 +138,8 @@ MfUltralightError MfUltralightError mf_ultralight_poller_sync_write_page(Nfc* nfc, uint16_t page, MfUltralightPage* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = { .cmd_type = MfUltralightPollerCmdTypeWritePage, @@ -156,8 +156,8 @@ MfUltralightError } MfUltralightError mf_ultralight_poller_sync_read_version(Nfc* nfc, MfUltralightVersion* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = { .cmd_type = MfUltralightPollerCmdTypeReadVersion, @@ -173,8 +173,8 @@ MfUltralightError mf_ultralight_poller_sync_read_version(Nfc* nfc, MfUltralightV } MfUltralightError mf_ultralight_poller_sync_read_signature(Nfc* nfc, MfUltralightSignature* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = { .cmd_type = MfUltralightPollerCmdTypeReadSignature, @@ -193,8 +193,8 @@ MfUltralightError mf_ultralight_poller_sync_read_counter( Nfc* nfc, uint8_t counter_num, MfUltralightCounter* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = { .cmd_type = MfUltralightPollerCmdTypeReadCounter, @@ -214,8 +214,8 @@ MfUltralightError mf_ultralight_poller_sync_read_tearing_flag( Nfc* nfc, uint8_t flag_num, MfUltralightTearingFlag* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = { .cmd_type = MfUltralightPollerCmdTypeReadTearingFlag, @@ -261,8 +261,8 @@ static NfcCommand mf_ultralight_poller_read_callback(NfcGenericEvent event, void } MfUltralightError mf_ultralight_poller_sync_read_card(Nfc* nfc, MfUltralightData* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); MfUltralightPollerContext poller_context = {}; poller_context.thread_id = furi_thread_get_current_id(); diff --git a/lib/nfc/protocols/nfc_device_base_i.h b/lib/nfc/protocols/nfc_device_base_i.h index 946ae76dcc0..c440e7b9392 100644 --- a/lib/nfc/protocols/nfc_device_base_i.h +++ b/lib/nfc/protocols/nfc_device_base_i.h @@ -20,7 +20,7 @@ extern "C" { * * @returns pointer to the allocated instance. */ -typedef NfcDeviceData* (*NfcDeviceAlloc)(); +typedef NfcDeviceData* (*NfcDeviceAlloc)(void); /** * @brief Delete the protocol-specific NFC device data instance. diff --git a/lib/nfc/protocols/nfc_protocol.c b/lib/nfc/protocols/nfc_protocol.c index 2ea9b39820a..63f05c8d9e4 100644 --- a/lib/nfc/protocols/nfc_protocol.c +++ b/lib/nfc/protocols/nfc_protocol.c @@ -150,14 +150,14 @@ static const NfcProtocolTreeNode nfc_protocol_nodes[NfcProtocolNum] = { }; NfcProtocol nfc_protocol_get_parent(NfcProtocol protocol) { - furi_assert(protocol < NfcProtocolNum); + furi_check(protocol < NfcProtocolNum); return nfc_protocol_nodes[protocol].parent_protocol; } bool nfc_protocol_has_parent(NfcProtocol protocol, NfcProtocol parent_protocol) { - furi_assert(protocol < NfcProtocolNum); - furi_assert(parent_protocol < NfcProtocolNum); + furi_check(protocol < NfcProtocolNum); + furi_check(parent_protocol < NfcProtocolNum); bool parent_found = false; const NfcProtocolTreeNode* iter = &nfc_protocol_nodes[protocol]; diff --git a/lib/nfc/protocols/slix/slix.c b/lib/nfc/protocols/slix/slix.c index b575baa728f..41d19beb7e1 100644 --- a/lib/nfc/protocols/slix/slix.c +++ b/lib/nfc/protocols/slix/slix.c @@ -89,7 +89,7 @@ static void slix_password_set_defaults(SlixPassword* passwords) { } } -SlixData* slix_alloc() { +SlixData* slix_alloc(void) { SlixData* data = malloc(sizeof(SlixData)); data->iso15693_3_data = iso15693_3_alloc(); @@ -99,7 +99,7 @@ SlixData* slix_alloc() { } void slix_free(SlixData* data) { - furi_assert(data); + furi_check(data); iso15693_3_free(data->iso15693_3_data); @@ -107,7 +107,7 @@ void slix_free(SlixData* data) { } void slix_reset(SlixData* data) { - furi_assert(data); + furi_check(data); iso15693_3_reset(data->iso15693_3_data); slix_password_set_defaults(data->passwords); @@ -119,8 +119,8 @@ void slix_reset(SlixData* data) { } void slix_copy(SlixData* data, const SlixData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); iso15693_3_copy(data->iso15693_3_data, other->iso15693_3_data); @@ -160,7 +160,8 @@ static bool slix_load_passwords(SlixPassword* passwords, SlixType slix_type, Fli } bool slix_load(SlixData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool loaded = false; @@ -238,7 +239,8 @@ static bool } bool slix_save(const SlixData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool saved = false; @@ -303,6 +305,9 @@ bool slix_save(const SlixData* data, FlipperFormat* ff) { } bool slix_is_equal(const SlixData* data, const SlixData* other) { + furi_check(data); + furi_check(other); + return iso15693_3_is_equal(data->iso15693_3_data, other->iso15693_3_data) && memcmp(&data->system_info, &other->system_info, sizeof(SlixSystemInfo)) == 0 && memcmp( @@ -313,6 +318,7 @@ bool slix_is_equal(const SlixData* data, const SlixData* other) { } const char* slix_get_device_name(const SlixData* data, NfcDeviceNameType name_type) { + furi_check(data); UNUSED(name_type); const SlixType slix_type = slix_get_type(data); @@ -322,22 +328,25 @@ const char* slix_get_device_name(const SlixData* data, NfcDeviceNameType name_ty } const uint8_t* slix_get_uid(const SlixData* data, size_t* uid_len) { + furi_check(data); return iso15693_3_get_uid(data->iso15693_3_data, uid_len); } bool slix_set_uid(SlixData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); return iso15693_3_set_uid(data->iso15693_3_data, uid, uid_len); } const Iso15693_3Data* slix_get_base_data(const SlixData* data) { - furi_assert(data); + furi_check(data); return data->iso15693_3_data; } SlixType slix_get_type(const SlixData* data) { + furi_check(data); + SlixType type = SlixTypeUnknown; do { @@ -364,14 +373,14 @@ SlixType slix_get_type(const SlixData* data) { } SlixPassword slix_get_password(const SlixData* data, SlixPasswordType password_type) { - furi_assert(data); - furi_assert(password_type < SlixPasswordTypeCount); + furi_check(data); + furi_check(password_type < SlixPasswordTypeCount); return data->passwords[password_type]; } uint16_t slix_get_counter(const SlixData* data) { - furi_assert(data); + furi_check(data); const SlixCounter* counter = (const SlixCounter*)iso15693_3_get_block_data( data->iso15693_3_data, SLIX_COUNTER_BLOCK_NUM); @@ -379,7 +388,7 @@ uint16_t slix_get_counter(const SlixData* data) { } bool slix_is_privacy_mode(const SlixData* data) { - furi_assert(data); + furi_check(data); return data->privacy; } @@ -388,8 +397,8 @@ bool slix_is_block_protected( const SlixData* data, SlixPasswordType password_type, uint8_t block_num) { - furi_assert(data); - furi_assert(password_type < SlixPasswordTypeCount); + furi_check(data); + furi_check(password_type < SlixPasswordTypeCount); bool ret = false; @@ -411,7 +420,7 @@ bool slix_is_block_protected( } bool slix_is_counter_increment_protected(const SlixData* data) { - furi_assert(data); + furi_check(data); const SlixCounter* counter = (const SlixCounter*)iso15693_3_get_block_data( data->iso15693_3_data, SLIX_COUNTER_BLOCK_NUM); @@ -420,14 +429,14 @@ bool slix_is_counter_increment_protected(const SlixData* data) { } bool slix_type_has_features(SlixType slix_type, SlixTypeFeatures features) { - furi_assert(slix_type < SlixTypeCount); + furi_check(slix_type < SlixTypeCount); return (slix_type_features[slix_type] & features) == features; } bool slix_type_supports_password(SlixType slix_type, SlixPasswordType password_type) { - furi_assert(slix_type < SlixTypeCount); - furi_assert(password_type < SlixPasswordTypeCount); + furi_check(slix_type < SlixTypeCount); + furi_check(password_type < SlixPasswordTypeCount); return slix_type_features[slix_type] & slix_password_configs[password_type].feature_flag; } diff --git a/lib/nfc/protocols/slix/slix.h b/lib/nfc/protocols/slix/slix.h index 26341072b2a..2de26847a0b 100644 --- a/lib/nfc/protocols/slix/slix.h +++ b/lib/nfc/protocols/slix/slix.h @@ -99,7 +99,7 @@ typedef struct { SlixPrivacy privacy; } SlixData; -SlixData* slix_alloc(); +SlixData* slix_alloc(void); void slix_free(SlixData* data); diff --git a/lib/nfc/protocols/st25tb/st25tb.c b/lib/nfc/protocols/st25tb/st25tb.c index 2b3eebf9e14..8b1e9be2e9e 100644 --- a/lib/nfc/protocols/st25tb/st25tb.c +++ b/lib/nfc/protocols/st25tb/st25tb.c @@ -79,35 +79,39 @@ const NfcDeviceBase nfc_device_st25tb = { .get_base_data = (NfcDeviceGetBaseData)st25tb_get_base_data, }; -St25tbData* st25tb_alloc() { +St25tbData* st25tb_alloc(void) { St25tbData* data = malloc(sizeof(St25tbData)); return data; } void st25tb_free(St25tbData* data) { - furi_assert(data); + furi_check(data); free(data); } void st25tb_reset(St25tbData* data) { + furi_check(data); memset(data, 0, sizeof(St25tbData)); } void st25tb_copy(St25tbData* data, const St25tbData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); *data = *other; } bool st25tb_verify(St25tbData* data, const FuriString* device_type) { + furi_check(device_type); UNUSED(data); + return furi_string_equal_str(device_type, ST25TB_PROTOCOL_NAME); } bool st25tb_load(St25tbData* data, FlipperFormat* ff, uint32_t version) { - furi_assert(data); + furi_check(data); + furi_check(ff); bool parsed = false; @@ -150,7 +154,8 @@ bool st25tb_load(St25tbData* data, FlipperFormat* ff, uint32_t version) { } bool st25tb_save(const St25tbData* data, FlipperFormat* ff) { - furi_assert(data); + furi_check(data); + furi_check(ff); FuriString* temp_str = furi_string_alloc(); bool saved = false; @@ -184,19 +189,21 @@ bool st25tb_save(const St25tbData* data, FlipperFormat* ff) { } bool st25tb_is_equal(const St25tbData* data, const St25tbData* other) { - furi_assert(data); - furi_assert(other); + furi_check(data); + furi_check(other); - return memcmp(data, other, sizeof(St25tbData)) == 0; + return memcmp(data, other, sizeof(St25tbData)) == 0; //-V1103 } uint8_t st25tb_get_block_count(St25tbType type) { + furi_check(type < St25tbTypeNum); + return st25tb_features[type].blocks_total; } const char* st25tb_get_device_name(const St25tbData* data, NfcDeviceNameType name_type) { - furi_assert(data); - furi_assert(data->type < St25tbTypeNum); + furi_check(data); + furi_check(data->type < St25tbTypeNum); if(name_type == NfcDeviceNameTypeFull) { return st25tb_features[data->type].full_name; @@ -206,7 +213,7 @@ const char* st25tb_get_device_name(const St25tbData* data, NfcDeviceNameType nam } const uint8_t* st25tb_get_uid(const St25tbData* data, size_t* uid_len) { - furi_assert(data); + furi_check(data); if(uid_len) { *uid_len = ST25TB_UID_SIZE; @@ -216,7 +223,8 @@ const uint8_t* st25tb_get_uid(const St25tbData* data, size_t* uid_len) { } bool st25tb_set_uid(St25tbData* data, const uint8_t* uid, size_t uid_len) { - furi_assert(data); + furi_check(data); + furi_check(uid); const bool uid_valid = uid_len == ST25TB_UID_SIZE; @@ -233,6 +241,8 @@ St25tbData* st25tb_get_base_data(const St25tbData* data) { } St25tbType st25tb_get_type_from_uid(const uint8_t* uid) { + furi_check(uid); + switch(uid[2] >> 2) { case 0x0: case 0x3: diff --git a/lib/nfc/protocols/st25tb/st25tb.h b/lib/nfc/protocols/st25tb/st25tb.h index ed02dc2b207..67d733315fc 100644 --- a/lib/nfc/protocols/st25tb/st25tb.h +++ b/lib/nfc/protocols/st25tb/st25tb.h @@ -48,7 +48,7 @@ typedef struct { extern const NfcDeviceBase nfc_device_st25tb; -St25tbData* st25tb_alloc(); +St25tbData* st25tb_alloc(void); void st25tb_free(St25tbData* data); diff --git a/lib/nfc/protocols/st25tb/st25tb_poller_i.c b/lib/nfc/protocols/st25tb/st25tb_poller_i.c index adb8626a30f..2bf02556342 100644 --- a/lib/nfc/protocols/st25tb/st25tb_poller_i.c +++ b/lib/nfc/protocols/st25tb/st25tb_poller_i.c @@ -20,7 +20,9 @@ St25tbError st25tb_poller_send_frame( const BitBuffer* tx_buffer, BitBuffer* rx_buffer, uint32_t fwt) { - furi_assert(instance); + furi_check(instance); + furi_check(tx_buffer); + furi_check(rx_buffer); const size_t tx_bytes = bit_buffer_get_size_bytes(tx_buffer); furi_assert( @@ -54,8 +56,8 @@ St25tbError st25tb_poller_send_frame( St25tbError st25tb_poller_initiate(St25tbPoller* instance, uint8_t* chip_id_ptr) { // Send Initiate() - furi_assert(instance); - furi_assert(instance->nfc); + furi_check(instance); + furi_check(instance->nfc); bit_buffer_reset(instance->tx_buffer); bit_buffer_reset(instance->rx_buffer); @@ -86,8 +88,8 @@ St25tbError st25tb_poller_initiate(St25tbPoller* instance, uint8_t* chip_id_ptr) } St25tbError st25tb_poller_select(St25tbPoller* instance, uint8_t* chip_id_ptr) { - furi_assert(instance); - furi_assert(instance->nfc); + furi_check(instance); + furi_check(instance->nfc); St25tbError ret; @@ -169,8 +171,9 @@ St25tbError st25tb_poller_read(St25tbPoller* instance, St25tbData* data) { } St25tbError st25tb_poller_get_uid(St25tbPoller* instance, uint8_t* uid) { - furi_assert(instance); - furi_assert(instance->nfc); + furi_check(instance); + furi_check(instance->nfc); + furi_check(uid); St25tbError ret; @@ -213,10 +216,10 @@ St25tbError st25tb_poller_get_uid(St25tbPoller* instance, uint8_t* uid) { St25tbError st25tb_poller_read_block(St25tbPoller* instance, uint32_t* block, uint8_t block_number) { - furi_assert(instance); - furi_assert(instance->nfc); - furi_assert(block); - furi_assert( + furi_check(instance); + furi_check(instance->nfc); + furi_check(block); + furi_check( (block_number <= st25tb_get_block_count(instance->data->type)) || block_number == ST25TB_SYSTEM_OTP_BLOCK); FURI_LOG_T(TAG, "reading block %d", block_number); @@ -248,9 +251,9 @@ St25tbError St25tbError st25tb_poller_write_block(St25tbPoller* instance, uint32_t block, uint8_t block_number) { - furi_assert(instance); - furi_assert(instance->nfc); - furi_assert( + furi_check(instance); + furi_check(instance->nfc); + furi_check( (block_number <= st25tb_get_block_count(instance->data->type)) || block_number == ST25TB_SYSTEM_OTP_BLOCK); FURI_LOG_T(TAG, "writing block %d", block_number); @@ -292,7 +295,7 @@ St25tbError } St25tbError st25tb_poller_halt(St25tbPoller* instance) { - furi_assert(instance); + furi_check(instance); bit_buffer_reset(instance->tx_buffer); bit_buffer_reset(instance->rx_buffer); diff --git a/lib/nfc/protocols/st25tb/st25tb_poller_sync.c b/lib/nfc/protocols/st25tb/st25tb_poller_sync.c index 3cd0b379290..359435034ef 100644 --- a/lib/nfc/protocols/st25tb/st25tb_poller_sync.c +++ b/lib/nfc/protocols/st25tb/st25tb_poller_sync.c @@ -109,7 +109,8 @@ static St25tbError st25tb_poller_cmd_execute(Nfc* nfc, St25tbPollerSyncContext* } St25tbError st25tb_poller_sync_read_block(Nfc* nfc, uint8_t block_num, uint32_t* block) { - furi_assert(block); + furi_check(nfc); + furi_check(block); St25tbPollerSyncContext poller_context = { .cmd_type = St25tbPollerCmdTypeReadBlock, .cmd_data = @@ -125,6 +126,7 @@ St25tbError st25tb_poller_sync_read_block(Nfc* nfc, uint8_t block_num, uint32_t* } St25tbError st25tb_poller_sync_write_block(Nfc* nfc, uint8_t block_num, uint32_t block) { + furi_check(nfc); St25tbPollerSyncContext poller_context = { .cmd_type = St25tbPollerCmdTypeWriteBlock, .cmd_data = @@ -140,7 +142,8 @@ St25tbError st25tb_poller_sync_write_block(Nfc* nfc, uint8_t block_num, uint32_t } St25tbError st25tb_poller_sync_detect_type(Nfc* nfc, St25tbType* type) { - furi_assert(type); + furi_check(nfc); + furi_check(type); St25tbPollerSyncContext poller_context = { .cmd_type = St25tbPollerCmdTypeDetectType, .cmd_data = @@ -185,8 +188,8 @@ static NfcCommand nfc_scene_read_poller_callback_st25tb(NfcGenericEvent event, v } St25tbError st25tb_poller_sync_read(Nfc* nfc, St25tbData* data) { - furi_assert(nfc); - furi_assert(data); + furi_check(nfc); + furi_check(data); St25tbPollerSyncContext poller_context = { .thread_id = furi_thread_get_current_id(), diff --git a/lib/one_wire/maxim_crc.c b/lib/one_wire/maxim_crc.c index a5d099b10fe..ee60163e7d8 100644 --- a/lib/one_wire/maxim_crc.c +++ b/lib/one_wire/maxim_crc.c @@ -1,6 +1,9 @@ #include "maxim_crc.h" +#include uint8_t maxim_crc8(const uint8_t* data, const uint8_t data_size, const uint8_t crc_init) { + furi_check(data); + uint8_t crc = crc_init; for(uint8_t index = 0; index < data_size; ++index) { diff --git a/lib/one_wire/one_wire_host.c b/lib/one_wire/one_wire_host.c index 678812105c3..9383e0f15da 100644 --- a/lib/one_wire/one_wire_host.c +++ b/lib/one_wire/one_wire_host.c @@ -56,19 +56,26 @@ struct OneWireHost { }; OneWireHost* onewire_host_alloc(const GpioPin* gpio_pin) { + furi_check(gpio_pin); + OneWireHost* host = malloc(sizeof(OneWireHost)); host->gpio_pin = gpio_pin; onewire_host_reset_search(host); onewire_host_set_overdrive(host, false); + return host; } void onewire_host_free(OneWireHost* host) { + furi_check(host); + onewire_host_stop(host); free(host); } bool onewire_host_reset(OneWireHost* host) { + furi_check(host); + uint8_t r; uint8_t retries = 125; @@ -100,6 +107,8 @@ bool onewire_host_reset(OneWireHost* host) { } bool onewire_host_read_bit(OneWireHost* host) { + furi_check(host); + bool result; const OneWireHostTimings* timings = host->timings; @@ -120,6 +129,8 @@ bool onewire_host_read_bit(OneWireHost* host) { } uint8_t onewire_host_read(OneWireHost* host) { + furi_check(host); + uint8_t result = 0; for(uint8_t bitMask = 0x01; bitMask; bitMask <<= 1) { @@ -132,12 +143,17 @@ uint8_t onewire_host_read(OneWireHost* host) { } void onewire_host_read_bytes(OneWireHost* host, uint8_t* buffer, uint16_t count) { + furi_check(host); + furi_check(buffer); + for(uint16_t i = 0; i < count; i++) { buffer[i] = onewire_host_read(host); } } void onewire_host_write_bit(OneWireHost* host, bool value) { + furi_check(host); + const OneWireHostTimings* timings = host->timings; if(value) { @@ -160,6 +176,8 @@ void onewire_host_write_bit(OneWireHost* host, bool value) { } void onewire_host_write(OneWireHost* host, uint8_t value) { + furi_check(host); + uint8_t bitMask; for(bitMask = 0x01; bitMask; bitMask <<= 1) { @@ -168,22 +186,31 @@ void onewire_host_write(OneWireHost* host, uint8_t value) { } void onewire_host_write_bytes(OneWireHost* host, const uint8_t* buffer, uint16_t count) { + furi_check(host); + furi_check(buffer); + for(uint16_t i = 0; i < count; ++i) { onewire_host_write(host, buffer[i]); } } void onewire_host_start(OneWireHost* host) { + furi_check(host); + furi_hal_gpio_write(host->gpio_pin, true); furi_hal_gpio_init(host->gpio_pin, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow); } void onewire_host_stop(OneWireHost* host) { + furi_check(host); + furi_hal_gpio_write(host->gpio_pin, true); furi_hal_gpio_init(host->gpio_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow); } void onewire_host_reset_search(OneWireHost* host) { + furi_check(host); + host->last_discrepancy = 0; host->last_device_flag = false; host->last_family_discrepancy = 0; @@ -194,6 +221,8 @@ void onewire_host_reset_search(OneWireHost* host) { } void onewire_host_target_search(OneWireHost* host, uint8_t family_code) { + furi_check(host); + host->saved_rom[0] = family_code; for(uint8_t i = 1; i < 8; i++) host->saved_rom[i] = 0; host->last_discrepancy = 64; @@ -202,6 +231,8 @@ void onewire_host_target_search(OneWireHost* host, uint8_t family_code) { } bool onewire_host_search(OneWireHost* host, uint8_t* new_addr, OneWireHostSearchMode mode) { + furi_check(host); + uint8_t id_bit_number; uint8_t last_zero, rom_byte_number, search_result; uint8_t id_bit, cmp_id_bit; @@ -317,5 +348,7 @@ bool onewire_host_search(OneWireHost* host, uint8_t* new_addr, OneWireHostSearch } void onewire_host_set_overdrive(OneWireHost* host, bool set) { + furi_check(host); + host->timings = set ? &onewire_host_timings_overdrive : &onewire_host_timings_normal; } diff --git a/lib/one_wire/one_wire_slave.c b/lib/one_wire/one_wire_slave.c index 733b36e30e2..f426582cfb7 100644 --- a/lib/one_wire/one_wire_slave.c +++ b/lib/one_wire/one_wire_slave.c @@ -205,6 +205,7 @@ static void onewire_slave_exti_callback(void* context) { /*********************** PUBLIC ***********************/ OneWireSlave* onewire_slave_alloc(const GpioPin* gpio_pin) { + furi_check(gpio_pin); OneWireSlave* bus = malloc(sizeof(OneWireSlave)); bus->gpio_pin = gpio_pin; @@ -215,17 +216,23 @@ OneWireSlave* onewire_slave_alloc(const GpioPin* gpio_pin) { } void onewire_slave_free(OneWireSlave* bus) { + furi_check(bus); + onewire_slave_stop(bus); free(bus); } void onewire_slave_start(OneWireSlave* bus) { + furi_check(bus); + furi_hal_gpio_add_int_callback(bus->gpio_pin, onewire_slave_exti_callback, bus); furi_hal_gpio_write(bus->gpio_pin, true); furi_hal_gpio_init(bus->gpio_pin, GpioModeInterruptRiseFall, GpioPullNo, GpioSpeedLow); } void onewire_slave_stop(OneWireSlave* bus) { + furi_check(bus); + furi_hal_gpio_write(bus->gpio_pin, true); furi_hal_gpio_init(bus->gpio_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow); furi_hal_gpio_remove_int_callback(bus->gpio_pin); @@ -235,6 +242,7 @@ void onewire_slave_set_reset_callback( OneWireSlave* bus, OneWireSlaveResetCallback callback, void* context) { + furi_check(bus); bus->reset_callback = callback; bus->reset_callback_context = context; } @@ -243,6 +251,8 @@ void onewire_slave_set_command_callback( OneWireSlave* bus, OneWireSlaveCommandCallback callback, void* context) { + furi_check(bus); + bus->command_callback = callback; bus->command_callback_context = context; } @@ -251,11 +261,14 @@ void onewire_slave_set_result_callback( OneWireSlave* bus, OneWireSlaveResultCallback result_cb, void* context) { + furi_check(bus); bus->result_callback = result_cb; bus->result_callback_context = context; } bool onewire_slave_receive_bit(OneWireSlave* bus) { + furi_check(bus); + const OneWireSlaveTimings* timings = bus->timings; // wait while bus is low if(!onewire_slave_wait_while_gpio_is(bus, timings->tslot_max, false)) { @@ -274,6 +287,8 @@ bool onewire_slave_receive_bit(OneWireSlave* bus) { } bool onewire_slave_send_bit(OneWireSlave* bus, bool value) { + furi_check(bus); + const OneWireSlaveTimings* timings = bus->timings; // wait while bus is low if(!onewire_slave_wait_while_gpio_is(bus, timings->tslot_max, false)) { @@ -305,6 +320,8 @@ bool onewire_slave_send_bit(OneWireSlave* bus, bool value) { } bool onewire_slave_send(OneWireSlave* bus, const uint8_t* data, size_t data_size) { + furi_check(bus); + furi_hal_gpio_write(bus->gpio_pin, true); size_t bytes_sent = 0; @@ -324,6 +341,8 @@ bool onewire_slave_send(OneWireSlave* bus, const uint8_t* data, size_t data_size } bool onewire_slave_receive(OneWireSlave* bus, uint8_t* data, size_t data_size) { + furi_check(bus); + furi_hal_gpio_write(bus->gpio_pin, true); size_t bytes_received = 0; @@ -347,6 +366,7 @@ bool onewire_slave_receive(OneWireSlave* bus, uint8_t* data, size_t data_size) { } void onewire_slave_set_overdrive(OneWireSlave* bus, bool set) { + furi_check(bus); const OneWireSlaveTimings* new_timings = set ? &onewire_slave_timings_overdrive : &onewire_slave_timings_normal; if(bus->timings != new_timings) { diff --git a/lib/signal_reader/signal_reader.c b/lib/signal_reader/signal_reader.c index c06c7a5c0e5..f457cd29c7d 100644 --- a/lib/signal_reader/signal_reader.c +++ b/lib/signal_reader/signal_reader.c @@ -86,9 +86,9 @@ SignalReader* signal_reader_alloc(const GpioPin* gpio_pin, uint32_t size) { } void signal_reader_free(SignalReader* instance) { - furi_assert(instance); - furi_assert(instance->gpio_buffer); - furi_assert(instance->bitstream_buffer); + furi_check(instance); + furi_check(instance->gpio_buffer); + furi_check(instance->bitstream_buffer); free(instance->gpio_buffer); free(instance->bitstream_buffer); @@ -96,13 +96,13 @@ void signal_reader_free(SignalReader* instance) { } void signal_reader_set_pull(SignalReader* instance, GpioPull pull) { - furi_assert(instance); + furi_check(instance); instance->pull = pull; } void signal_reader_set_polarity(SignalReader* instance, SignalReaderPolarity polarity) { - furi_assert(instance); + furi_check(instance); instance->polarity = polarity; } @@ -111,14 +111,14 @@ void signal_reader_set_sample_rate( SignalReader* instance, SignalReaderTimeUnit time_unit, uint32_t time) { - furi_assert(instance); + furi_check(instance); UNUSED(time_unit); instance->tim_arr = time; } void signal_reader_set_trigger(SignalReader* instance, SignalReaderTrigger trigger) { - furi_assert(instance); + furi_check(instance); instance->trigger = trigger; } @@ -186,8 +186,8 @@ static void furi_hal_sw_digital_pin_dma_rx_isr(void* context) { } void signal_reader_start(SignalReader* instance, SignalReaderCallback callback, void* context) { - furi_assert(instance); - furi_assert(callback); + furi_check(instance); + furi_check(callback); instance->callback = callback; instance->context = context; @@ -306,7 +306,7 @@ void signal_reader_start(SignalReader* instance, SignalReaderCallback callback, } void signal_reader_stop(SignalReader* instance) { - furi_assert(instance); + furi_check(instance); furi_hal_interrupt_set_isr(SIGNAL_READER_DMA_GPIO_IRQ, NULL, NULL); diff --git a/lib/subghz/blocks/encoder.c b/lib/subghz/blocks/encoder.c index 49ec4f17701..4968c5e402b 100644 --- a/lib/subghz/blocks/encoder.c +++ b/lib/subghz/blocks/encoder.c @@ -2,8 +2,6 @@ #include "math.h" #include -#include "furi.h" - #define TAG "SubGhzBlockEncoder" void subghz_protocol_blocks_set_bit_array( @@ -11,7 +9,7 @@ void subghz_protocol_blocks_set_bit_array( uint8_t data_array[], size_t set_index_bit, size_t max_size_array) { - furi_assert(set_index_bit < max_size_array * 8); + furi_check(set_index_bit < max_size_array * 8); bit_write(data_array[set_index_bit >> 3], 7 - (set_index_bit & 0x7), bit_value); } diff --git a/lib/subghz/blocks/generic.c b/lib/subghz/blocks/generic.c index f59323da377..06be6b3d5d0 100644 --- a/lib/subghz/blocks/generic.c +++ b/lib/subghz/blocks/generic.c @@ -24,7 +24,7 @@ SubGhzProtocolStatus subghz_block_generic_serialize( SubGhzBlockGeneric* instance, FlipperFormat* flipper_format, SubGhzRadioPreset* preset) { - furi_assert(instance); + furi_check(instance); SubGhzProtocolStatus res = SubGhzProtocolStatusError; FuriString* temp_str; temp_str = furi_string_alloc(); @@ -94,7 +94,8 @@ SubGhzProtocolStatus subghz_block_generic_serialize( SubGhzProtocolStatus subghz_block_generic_deserialize(SubGhzBlockGeneric* instance, FlipperFormat* flipper_format) { - furi_assert(instance); + furi_check(instance); + SubGhzProtocolStatus res = SubGhzProtocolStatusError; FuriString* temp_str; temp_str = furi_string_alloc(); @@ -135,6 +136,7 @@ SubGhzProtocolStatus subghz_block_generic_deserialize_check_count_bit( SubGhzBlockGeneric* instance, FlipperFormat* flipper_format, uint16_t count_bit) { + furi_check(instance); SubGhzProtocolStatus ret = SubGhzProtocolStatusError; do { ret = subghz_block_generic_deserialize(instance, flipper_format); diff --git a/lib/subghz/devices/devices.c b/lib/subghz/devices/devices.c index 55db61e1188..86bcb5872d4 100644 --- a/lib/subghz/devices/devices.c +++ b/lib/subghz/devices/devices.c @@ -2,7 +2,7 @@ #include "registry.h" -void subghz_devices_init() { +void subghz_devices_init(void) { furi_check(!subghz_device_registry_is_valid()); subghz_device_registry_init(); } @@ -27,8 +27,8 @@ const char* subghz_devices_get_name(const SubGhzDevice* device) { } bool subghz_devices_begin(const SubGhzDevice* device) { + furi_check(device); bool ret = false; - furi_assert(device); if(device->interconnect->begin) { ret = device->interconnect->begin(); } @@ -36,15 +36,15 @@ bool subghz_devices_begin(const SubGhzDevice* device) { } void subghz_devices_end(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->end) { device->interconnect->end(); } } bool subghz_devices_is_connect(const SubGhzDevice* device) { + furi_check(device); bool ret = false; - furi_assert(device); if(device->interconnect->is_connect) { ret = device->interconnect->is_connect(); } @@ -52,21 +52,21 @@ bool subghz_devices_is_connect(const SubGhzDevice* device) { } void subghz_devices_reset(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->reset) { device->interconnect->reset(); } } void subghz_devices_sleep(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->sleep) { device->interconnect->sleep(); } } void subghz_devices_idle(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->idle) { device->interconnect->idle(); } @@ -76,15 +76,15 @@ void subghz_devices_load_preset( const SubGhzDevice* device, FuriHalSubGhzPreset preset, uint8_t* preset_data) { - furi_assert(device); + furi_check(device); if(device->interconnect->load_preset) { device->interconnect->load_preset(preset, preset_data); } } uint32_t subghz_devices_set_frequency(const SubGhzDevice* device, uint32_t frequency) { + furi_check(device); uint32_t ret = 0; - furi_assert(device); if(device->interconnect->set_frequency) { ret = device->interconnect->set_frequency(frequency); } @@ -93,7 +93,7 @@ uint32_t subghz_devices_set_frequency(const SubGhzDevice* device, uint32_t frequ bool subghz_devices_is_frequency_valid(const SubGhzDevice* device, uint32_t frequency) { bool ret = false; - furi_assert(device); + furi_check(device); if(device->interconnect->is_frequency_valid) { ret = device->interconnect->is_frequency_valid(frequency); } @@ -101,15 +101,15 @@ bool subghz_devices_is_frequency_valid(const SubGhzDevice* device, uint32_t freq } void subghz_devices_set_async_mirror_pin(const SubGhzDevice* device, const GpioPin* gpio) { - furi_assert(device); + furi_check(device); if(device->interconnect->set_async_mirror_pin) { device->interconnect->set_async_mirror_pin(gpio); } } const GpioPin* subghz_devices_get_data_gpio(const SubGhzDevice* device) { + furi_check(device); const GpioPin* ret = NULL; - furi_assert(device); if(device->interconnect->get_data_gpio) { ret = device->interconnect->get_data_gpio(); } @@ -118,7 +118,7 @@ const GpioPin* subghz_devices_get_data_gpio(const SubGhzDevice* device) { bool subghz_devices_set_tx(const SubGhzDevice* device) { bool ret = 0; - furi_assert(device); + furi_check(device); if(device->interconnect->set_tx) { ret = device->interconnect->set_tx(); } @@ -126,7 +126,7 @@ bool subghz_devices_set_tx(const SubGhzDevice* device) { } void subghz_devices_flush_tx(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->flush_tx) { device->interconnect->flush_tx(); } @@ -134,7 +134,7 @@ void subghz_devices_flush_tx(const SubGhzDevice* device) { bool subghz_devices_start_async_tx(const SubGhzDevice* device, void* callback, void* context) { bool ret = false; - furi_assert(device); + furi_check(device); if(device->interconnect->start_async_tx) { ret = device->interconnect->start_async_tx(callback, context); } @@ -143,7 +143,7 @@ bool subghz_devices_start_async_tx(const SubGhzDevice* device, void* callback, v bool subghz_devices_is_async_complete_tx(const SubGhzDevice* device) { bool ret = false; - furi_assert(device); + furi_check(device); if(device->interconnect->is_async_complete_tx) { ret = device->interconnect->is_async_complete_tx(); } @@ -151,35 +151,35 @@ bool subghz_devices_is_async_complete_tx(const SubGhzDevice* device) { } void subghz_devices_stop_async_tx(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->stop_async_tx) { device->interconnect->stop_async_tx(); } } void subghz_devices_set_rx(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->set_rx) { device->interconnect->set_rx(); } } void subghz_devices_flush_rx(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->flush_rx) { device->interconnect->flush_rx(); } } void subghz_devices_start_async_rx(const SubGhzDevice* device, void* callback, void* context) { - furi_assert(device); + furi_check(device); if(device->interconnect->start_async_rx) { device->interconnect->start_async_rx(callback, context); } } void subghz_devices_stop_async_rx(const SubGhzDevice* device) { - furi_assert(device); + furi_check(device); if(device->interconnect->stop_async_rx) { device->interconnect->stop_async_rx(); } @@ -187,7 +187,7 @@ void subghz_devices_stop_async_rx(const SubGhzDevice* device) { float subghz_devices_get_rssi(const SubGhzDevice* device) { float ret = 0; - furi_assert(device); + furi_check(device); if(device->interconnect->get_rssi) { ret = device->interconnect->get_rssi(); } @@ -195,8 +195,8 @@ float subghz_devices_get_rssi(const SubGhzDevice* device) { } uint8_t subghz_devices_get_lqi(const SubGhzDevice* device) { + furi_check(device); uint8_t ret = 0; - furi_assert(device); if(device->interconnect->get_lqi) { ret = device->interconnect->get_lqi(); } @@ -204,8 +204,8 @@ uint8_t subghz_devices_get_lqi(const SubGhzDevice* device) { } bool subghz_devices_rx_pipe_not_empty(const SubGhzDevice* device) { + furi_check(device); bool ret = false; - furi_assert(device); if(device->interconnect->rx_pipe_not_empty) { ret = device->interconnect->rx_pipe_not_empty(); } @@ -214,7 +214,7 @@ bool subghz_devices_rx_pipe_not_empty(const SubGhzDevice* device) { bool subghz_devices_is_rx_data_crc_valid(const SubGhzDevice* device) { bool ret = false; - furi_assert(device); + furi_check(device); if(device->interconnect->is_rx_data_crc_valid) { ret = device->interconnect->is_rx_data_crc_valid(); } @@ -222,14 +222,14 @@ bool subghz_devices_is_rx_data_crc_valid(const SubGhzDevice* device) { } void subghz_devices_read_packet(const SubGhzDevice* device, uint8_t* data, uint8_t* size) { - furi_assert(device); + furi_check(device); if(device->interconnect->read_packet) { device->interconnect->read_packet(data, size); } } void subghz_devices_write_packet(const SubGhzDevice* device, const uint8_t* data, uint8_t size) { - furi_assert(device); + furi_check(device); if(device->interconnect->write_packet) { device->interconnect->write_packet(data, size); } diff --git a/lib/subghz/devices/devices.h b/lib/subghz/devices/devices.h index dad3c9aeb53..9d6b7dbe579 100644 --- a/lib/subghz/devices/devices.h +++ b/lib/subghz/devices/devices.h @@ -8,7 +8,7 @@ extern "C" { typedef struct SubGhzDevice SubGhzDevice; -void subghz_devices_init(); +void subghz_devices_init(void); void subghz_devices_deinit(void); const SubGhzDevice* subghz_devices_get_by_name(const char* device_name); diff --git a/lib/subghz/environment.c b/lib/subghz/environment.c index 3794dbad841..1df598dc3d4 100644 --- a/lib/subghz/environment.c +++ b/lib/subghz/environment.c @@ -9,7 +9,7 @@ struct SubGhzEnvironment { const char* alutech_at_4n_rainbow_table_file_name; }; -SubGhzEnvironment* subghz_environment_alloc() { +SubGhzEnvironment* subghz_environment_alloc(void) { SubGhzEnvironment* instance = malloc(sizeof(SubGhzEnvironment)); instance->keystore = subghz_keystore_alloc(); @@ -22,7 +22,7 @@ SubGhzEnvironment* subghz_environment_alloc() { } void subghz_environment_free(SubGhzEnvironment* instance) { - furi_assert(instance); + furi_check(instance); instance->protocol_registry = NULL; instance->came_atomo_rainbow_table_file_name = NULL; @@ -34,13 +34,13 @@ void subghz_environment_free(SubGhzEnvironment* instance) { } bool subghz_environment_load_keystore(SubGhzEnvironment* instance, const char* filename) { - furi_assert(instance); + furi_check(instance); return subghz_keystore_load(instance->keystore, filename); } SubGhzKeystore* subghz_environment_get_keystore(SubGhzEnvironment* instance) { - furi_assert(instance); + furi_check(instance); return instance->keystore; } @@ -48,14 +48,14 @@ SubGhzKeystore* subghz_environment_get_keystore(SubGhzEnvironment* instance) { void subghz_environment_set_came_atomo_rainbow_table_file_name( SubGhzEnvironment* instance, const char* filename) { - furi_assert(instance); + furi_check(instance); instance->came_atomo_rainbow_table_file_name = filename; } const char* subghz_environment_get_came_atomo_rainbow_table_file_name(SubGhzEnvironment* instance) { - furi_assert(instance); + furi_check(instance); return instance->came_atomo_rainbow_table_file_name; } @@ -63,14 +63,14 @@ const char* void subghz_environment_set_alutech_at_4n_rainbow_table_file_name( SubGhzEnvironment* instance, const char* filename) { - furi_assert(instance); + furi_check(instance); instance->alutech_at_4n_rainbow_table_file_name = filename; } const char* subghz_environment_get_alutech_at_4n_rainbow_table_file_name(SubGhzEnvironment* instance) { - furi_assert(instance); + furi_check(instance); return instance->alutech_at_4n_rainbow_table_file_name; } @@ -78,14 +78,14 @@ const char* void subghz_environment_set_nice_flor_s_rainbow_table_file_name( SubGhzEnvironment* instance, const char* filename) { - furi_assert(instance); + furi_check(instance); instance->nice_flor_s_rainbow_table_file_name = filename; } const char* subghz_environment_get_nice_flor_s_rainbow_table_file_name(SubGhzEnvironment* instance) { - furi_assert(instance); + furi_check(instance); return instance->nice_flor_s_rainbow_table_file_name; } @@ -93,22 +93,22 @@ const char* void subghz_environment_set_protocol_registry( SubGhzEnvironment* instance, const SubGhzProtocolRegistry* protocol_registry_items) { - furi_assert(instance); + furi_check(instance); const SubGhzProtocolRegistry* protocol_registry = protocol_registry_items; instance->protocol_registry = protocol_registry; } const SubGhzProtocolRegistry* subghz_environment_get_protocol_registry(SubGhzEnvironment* instance) { - furi_assert(instance); - furi_assert(instance->protocol_registry); + furi_check(instance); + furi_check(instance->protocol_registry); return instance->protocol_registry; } const char* subghz_environment_get_protocol_name_registry(SubGhzEnvironment* instance, size_t idx) { - furi_assert(instance); - furi_assert(instance->protocol_registry); + furi_check(instance); + furi_check(instance->protocol_registry); const SubGhzProtocol* protocol = subghz_protocol_registry_get_by_index(instance->protocol_registry, idx); if(protocol != NULL) { diff --git a/lib/subghz/environment.h b/lib/subghz/environment.h index c15b8b211b0..8b0f9e4a5b7 100644 --- a/lib/subghz/environment.h +++ b/lib/subghz/environment.h @@ -16,7 +16,7 @@ typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry; * Allocate SubGhzEnvironment. * @return SubGhzEnvironment* pointer to a SubGhzEnvironment instance */ -SubGhzEnvironment* subghz_environment_alloc(); +SubGhzEnvironment* subghz_environment_alloc(void); /** * Free SubGhzEnvironment. diff --git a/lib/subghz/protocols/base.c b/lib/subghz/protocols/base.c index 37d1a308f06..99af45bb279 100644 --- a/lib/subghz/protocols/base.c +++ b/lib/subghz/protocols/base.c @@ -5,6 +5,8 @@ void subghz_protocol_decoder_base_set_decoder_callback( SubGhzProtocolDecoderBase* decoder_base, SubGhzProtocolDecoderBaseRxCallback callback, void* context) { + furi_check(decoder_base); + decoder_base->callback = callback; decoder_base->context = context; } @@ -12,6 +14,9 @@ void subghz_protocol_decoder_base_set_decoder_callback( bool subghz_protocol_decoder_base_get_string( SubGhzProtocolDecoderBase* decoder_base, FuriString* output) { + furi_check(decoder_base); + furi_check(output); + bool status = false; if(decoder_base->protocol && decoder_base->protocol->decoder && @@ -27,6 +32,9 @@ SubGhzProtocolStatus subghz_protocol_decoder_base_serialize( SubGhzProtocolDecoderBase* decoder_base, FlipperFormat* flipper_format, SubGhzRadioPreset* preset) { + furi_check(decoder_base); + furi_check(flipper_format); + SubGhzProtocolStatus status = SubGhzProtocolStatusError; if(decoder_base->protocol && decoder_base->protocol->decoder && @@ -40,6 +48,8 @@ SubGhzProtocolStatus subghz_protocol_decoder_base_serialize( SubGhzProtocolStatus subghz_protocol_decoder_base_deserialize( SubGhzProtocolDecoderBase* decoder_base, FlipperFormat* flipper_format) { + furi_check(decoder_base); + SubGhzProtocolStatus status = SubGhzProtocolStatusError; if(decoder_base->protocol && decoder_base->protocol->decoder && @@ -51,6 +61,8 @@ SubGhzProtocolStatus subghz_protocol_decoder_base_deserialize( } uint8_t subghz_protocol_decoder_base_get_hash_data(SubGhzProtocolDecoderBase* decoder_base) { + furi_check(decoder_base); + uint8_t hash = 0; if(decoder_base->protocol && decoder_base->protocol->decoder && diff --git a/lib/subghz/protocols/bin_raw.c b/lib/subghz/protocols/bin_raw.c index 80a34c55f72..a5332ee4e25 100644 --- a/lib/subghz/protocols/bin_raw.c +++ b/lib/subghz/protocols/bin_raw.c @@ -882,7 +882,7 @@ static bool void subghz_protocol_decoder_bin_raw_data_input_rssi( SubGhzProtocolDecoderBinRAW* instance, float rssi) { - furi_assert(instance); + furi_check(instance); switch(instance->decoder.parser_step) { case BinRAWDecoderStepReset: diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c index cfd8388799f..51f7d35906f 100644 --- a/lib/subghz/protocols/keeloq.c +++ b/lib/subghz/protocols/keeloq.c @@ -175,7 +175,7 @@ bool subghz_protocol_keeloq_create_data( uint16_t cnt, const char* manufacture_name, SubGhzRadioPreset* preset) { - furi_assert(context); + furi_check(context); SubGhzProtocolEncoderKeeloq* instance = context; instance->generic.serial = serial; instance->generic.cnt = cnt; diff --git a/lib/subghz/protocols/raw.c b/lib/subghz/protocols/raw.c index 95dff309355..12599891d54 100644 --- a/lib/subghz/protocols/raw.c +++ b/lib/subghz/protocols/raw.c @@ -87,7 +87,7 @@ bool subghz_protocol_raw_save_to_file_init( SubGhzProtocolDecoderRAW* instance, const char* dev_name, SubGhzRadioPreset* preset) { - furi_assert(instance); + furi_check(instance); instance->storage = furi_record_open(RECORD_STORAGE); instance->flipper_file = flipper_format_file_alloc(instance->storage); @@ -189,7 +189,7 @@ static bool subghz_protocol_raw_save_to_file_write(SubGhzProtocolDecoderRAW* ins } void subghz_protocol_raw_save_to_file_stop(SubGhzProtocolDecoderRAW* instance) { - furi_assert(instance); + furi_check(instance); if(instance->file_is_open == RAWFileIsOpenWrite && instance->ind_write) subghz_protocol_raw_save_to_file_write(instance); @@ -205,7 +205,7 @@ void subghz_protocol_raw_save_to_file_stop(SubGhzProtocolDecoderRAW* instance) { } void subghz_protocol_raw_save_to_file_pause(SubGhzProtocolDecoderRAW* instance, bool pause) { - furi_assert(instance); + furi_check(instance); if(instance->pause != pause) { instance->pause = pause; @@ -213,6 +213,7 @@ void subghz_protocol_raw_save_to_file_pause(SubGhzProtocolDecoderRAW* instance, } size_t subghz_protocol_raw_get_sample_write(SubGhzProtocolDecoderRAW* instance) { + furi_check(instance); return instance->sample_write + instance->ind_write; } @@ -230,21 +231,21 @@ void* subghz_protocol_decoder_raw_alloc(SubGhzEnvironment* environment) { } void subghz_protocol_decoder_raw_free(void* context) { - furi_assert(context); + furi_check(context); SubGhzProtocolDecoderRAW* instance = context; furi_string_free(instance->file_name); free(instance); } void subghz_protocol_decoder_raw_reset(void* context) { - furi_assert(context); + furi_check(context); SubGhzProtocolDecoderRAW* instance = context; instance->ind_write = 0; instance->last_level = false; } void subghz_protocol_decoder_raw_feed(void* context, bool level, uint32_t duration) { - furi_assert(context); + furi_check(context); SubGhzProtocolDecoderRAW* instance = context; if(!instance->pause && (instance->upload_raw != NULL)) { @@ -263,7 +264,7 @@ void subghz_protocol_decoder_raw_feed(void* context, bool level, uint32_t durati SubGhzProtocolStatus subghz_protocol_decoder_raw_deserialize(void* context, FlipperFormat* flipper_format) { - furi_assert(context); + furi_check(context); UNUSED(context); UNUSED(flipper_format); // stub, for backwards compatibility @@ -271,7 +272,7 @@ SubGhzProtocolStatus } void subghz_protocol_decoder_raw_get_string(void* context, FuriString* output) { - furi_assert(context); + furi_check(context); //SubGhzProtocolDecoderRAW* instance = context; UNUSED(context); furi_string_cat_printf(output, "RAW Date"); @@ -289,6 +290,7 @@ void* subghz_protocol_encoder_raw_alloc(SubGhzEnvironment* environment) { } void subghz_protocol_encoder_raw_stop(void* context) { + furi_check(context); SubGhzProtocolEncoderRAW* instance = context; instance->is_running = false; if(subghz_file_encoder_worker_is_running(instance->file_worker_encoder)) { @@ -298,7 +300,7 @@ void subghz_protocol_encoder_raw_stop(void* context) { } void subghz_protocol_encoder_raw_free(void* context) { - furi_assert(context); + furi_check(context); SubGhzProtocolEncoderRAW* instance = context; subghz_protocol_encoder_raw_stop(instance); furi_string_free(instance->file_name); @@ -310,8 +312,8 @@ void subghz_protocol_raw_file_encoder_worker_set_callback_end( SubGhzProtocolEncoderRAW* instance, SubGhzProtocolEncoderRAWCallbackEnd callback_end, void* context_end) { - furi_assert(instance); - furi_assert(callback_end); + furi_check(instance); + furi_check(callback_end); subghz_file_encoder_worker_callback_end( instance->file_worker_encoder, callback_end, context_end); } @@ -337,6 +339,8 @@ void subghz_protocol_raw_gen_fff_data( FlipperFormat* flipper_format, const char* file_path, const char* radio_device_name) { + furi_check(flipper_format); + do { stream_clean(flipper_format_get_raw_stream(flipper_format)); if(!flipper_format_write_string_cstr(flipper_format, "Protocol", "RAW")) { @@ -359,7 +363,7 @@ void subghz_protocol_raw_gen_fff_data( SubGhzProtocolStatus subghz_protocol_encoder_raw_deserialize(void* context, FlipperFormat* flipper_format) { - furi_assert(context); + furi_check(context); SubGhzProtocolEncoderRAW* instance = context; SubGhzProtocolStatus res = SubGhzProtocolStatusError; FuriString* temp_str; @@ -396,6 +400,7 @@ SubGhzProtocolStatus } LevelDuration subghz_protocol_encoder_raw_yield(void* context) { + furi_check(context); SubGhzProtocolEncoderRAW* instance = context; if(!instance->is_running) return level_duration_reset(); diff --git a/lib/subghz/protocols/secplus_v2.c b/lib/subghz/protocols/secplus_v2.c index 374c407b034..08d5c84f6ab 100644 --- a/lib/subghz/protocols/secplus_v2.c +++ b/lib/subghz/protocols/secplus_v2.c @@ -590,7 +590,8 @@ bool subghz_protocol_secplus_v2_create_data( uint8_t btn, uint32_t cnt, SubGhzRadioPreset* preset) { - furi_assert(context); + furi_check(context); + SubGhzProtocolEncoderSecPlus_v2* instance = context; instance->generic.serial = serial; instance->generic.cnt = cnt; diff --git a/lib/subghz/receiver.c b/lib/subghz/receiver.c index 698fe098ecd..c70229a12dd 100644 --- a/lib/subghz/receiver.c +++ b/lib/subghz/receiver.c @@ -42,7 +42,7 @@ SubGhzReceiver* subghz_receiver_alloc_init(SubGhzEnvironment* environment) { } void subghz_receiver_free(SubGhzReceiver* instance) { - furi_assert(instance); + furi_check(instance); instance->callback = NULL; instance->context = NULL; @@ -59,8 +59,8 @@ void subghz_receiver_free(SubGhzReceiver* instance) { } void subghz_receiver_decode(SubGhzReceiver* instance, bool level, uint32_t duration) { - furi_assert(instance); - furi_assert(instance->slots); + furi_check(instance); + furi_check(instance->slots); for M_EACH(slot, instance->slots, SubGhzReceiverSlotArray_t) { @@ -71,8 +71,8 @@ void subghz_receiver_decode(SubGhzReceiver* instance, bool level, uint32_t durat } void subghz_receiver_reset(SubGhzReceiver* instance) { - furi_assert(instance); - furi_assert(instance->slots); + furi_check(instance); + furi_check(instance->slots); for M_EACH(slot, instance->slots, SubGhzReceiverSlotArray_t) { @@ -91,7 +91,7 @@ void subghz_receiver_set_rx_callback( SubGhzReceiver* instance, SubGhzReceiverCallback callback, void* context) { - furi_assert(instance); + furi_check(instance); for M_EACH(slot, instance->slots, SubGhzReceiverSlotArray_t) { @@ -104,13 +104,15 @@ void subghz_receiver_set_rx_callback( } void subghz_receiver_set_filter(SubGhzReceiver* instance, SubGhzProtocolFlag filter) { - furi_assert(instance); + furi_check(instance); instance->filter = filter; } SubGhzProtocolDecoderBase* subghz_receiver_search_decoder_base_by_name( SubGhzReceiver* instance, const char* decoder_name) { + furi_check(instance); + SubGhzProtocolDecoderBase* result = NULL; for diff --git a/lib/subghz/registry.c b/lib/subghz/registry.c index d0c22ea8c4a..be62b4649e1 100644 --- a/lib/subghz/registry.c +++ b/lib/subghz/registry.c @@ -3,7 +3,7 @@ const SubGhzProtocol* subghz_protocol_registry_get_by_name( const SubGhzProtocolRegistry* protocol_registry, const char* name) { - furi_assert(protocol_registry); + furi_check(protocol_registry); for(size_t i = 0; i < subghz_protocol_registry_count(protocol_registry); i++) { if(strcmp(name, protocol_registry->items[i]->name) == 0) { @@ -16,7 +16,7 @@ const SubGhzProtocol* subghz_protocol_registry_get_by_name( const SubGhzProtocol* subghz_protocol_registry_get_by_index( const SubGhzProtocolRegistry* protocol_registry, size_t index) { - furi_assert(protocol_registry); + furi_check(protocol_registry); if(index < subghz_protocol_registry_count(protocol_registry)) { return protocol_registry->items[index]; } else { @@ -25,6 +25,6 @@ const SubGhzProtocol* subghz_protocol_registry_get_by_index( } size_t subghz_protocol_registry_count(const SubGhzProtocolRegistry* protocol_registry) { - furi_assert(protocol_registry); + furi_check(protocol_registry); return protocol_registry->size; } diff --git a/lib/subghz/subghz_file_encoder_worker.c b/lib/subghz/subghz_file_encoder_worker.c index 239e02985fa..1ccde73a4d7 100644 --- a/lib/subghz/subghz_file_encoder_worker.c +++ b/lib/subghz/subghz_file_encoder_worker.c @@ -166,7 +166,7 @@ static int32_t subghz_file_encoder_worker_thread(void* context) { return 0; } -SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc() { +SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc(void) { SubGhzFileEncoderWorker* instance = malloc(sizeof(SubGhzFileEncoderWorker)); instance->thread = diff --git a/lib/subghz/subghz_file_encoder_worker.h b/lib/subghz/subghz_file_encoder_worker.h index e66c66d76ea..ae2f4a2a090 100644 --- a/lib/subghz/subghz_file_encoder_worker.h +++ b/lib/subghz/subghz_file_encoder_worker.h @@ -20,7 +20,7 @@ void subghz_file_encoder_worker_callback_end( * Allocate SubGhzFileEncoderWorker. * @return SubGhzFileEncoderWorker* pointer to a SubGhzFileEncoderWorker instance */ -SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc(); +SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc(void); /** * Free SubGhzFileEncoderWorker. diff --git a/lib/subghz/subghz_keystore.c b/lib/subghz/subghz_keystore.c index 4f602d2e276..c5c676a607f 100644 --- a/lib/subghz/subghz_keystore.c +++ b/lib/subghz/subghz_keystore.c @@ -30,7 +30,7 @@ struct SubGhzKeystore { SubGhzKeyArray_t data; }; -SubGhzKeystore* subghz_keystore_alloc() { +SubGhzKeystore* subghz_keystore_alloc(void) { SubGhzKeystore* instance = malloc(sizeof(SubGhzKeystore)); SubGhzKeyArray_init(instance->data); diff --git a/lib/subghz/subghz_keystore.h b/lib/subghz/subghz_keystore.h index 06ae8adae4d..6138651eb2d 100644 --- a/lib/subghz/subghz_keystore.h +++ b/lib/subghz/subghz_keystore.h @@ -24,7 +24,7 @@ typedef struct SubGhzKeystore SubGhzKeystore; * Allocate SubGhzKeystore. * @return SubGhzKeystore* pointer to a SubGhzKeystore instance */ -SubGhzKeystore* subghz_keystore_alloc(); +SubGhzKeystore* subghz_keystore_alloc(void); /** * Free SubGhzKeystore. diff --git a/lib/subghz/subghz_setting.c b/lib/subghz/subghz_setting.c index c0216913fbf..aacf2b4fec4 100644 --- a/lib/subghz/subghz_setting.c +++ b/lib/subghz/subghz_setting.c @@ -202,7 +202,7 @@ static void subghz_setting_preset_reset(SubGhzSetting* instance) { } void subghz_setting_free(SubGhzSetting* instance) { - furi_assert(instance); + furi_check(instance); FrequencyList_clear(instance->frequencies); FrequencyList_clear(instance->hopper_frequencies); for @@ -295,7 +295,7 @@ void subghz_setting_load_default(SubGhzSetting* instance) { } void subghz_setting_load(SubGhzSetting* instance, const char* file_path) { - furi_assert(instance); + furi_check(instance); Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); @@ -409,29 +409,29 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) { } size_t subghz_setting_get_frequency_count(SubGhzSetting* instance) { - furi_assert(instance); + furi_check(instance); return FrequencyList_size(instance->frequencies); } size_t subghz_setting_get_hopper_frequency_count(SubGhzSetting* instance) { - furi_assert(instance); + furi_check(instance); return FrequencyList_size(instance->hopper_frequencies); } size_t subghz_setting_get_preset_count(SubGhzSetting* instance) { - furi_assert(instance); + furi_check(instance); return SubGhzSettingCustomPresetItemArray_size(instance->preset->data); } const char* subghz_setting_get_preset_name(SubGhzSetting* instance, size_t idx) { - furi_assert(instance); + furi_check(instance); SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_get(instance->preset->data, idx); return furi_string_get_cstr(item->custom_preset_name); } int subghz_setting_get_inx_preset_by_name(SubGhzSetting* instance, const char* preset_name) { - furi_assert(instance); + furi_check(instance); size_t idx = 0; for M_EACH(item, instance->preset->data, SubGhzSettingCustomPresetItemArray_t) { @@ -448,8 +448,8 @@ bool subghz_setting_load_custom_preset( SubGhzSetting* instance, const char* preset_name, FlipperFormat* fff_data_file) { - furi_assert(instance); - furi_assert(preset_name); + furi_check(instance); + furi_check(preset_name); uint32_t temp_data32; SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_push_raw(instance->preset->data); @@ -478,8 +478,8 @@ bool subghz_setting_load_custom_preset( } bool subghz_setting_delete_custom_preset(SubGhzSetting* instance, const char* preset_name) { - furi_assert(instance); - furi_assert(preset_name); + furi_check(instance); + furi_check(preset_name); SubGhzSettingCustomPresetItemArray_it_t it; SubGhzSettingCustomPresetItemArray_it_last(it, instance->preset->data); while(!SubGhzSettingCustomPresetItemArray_end_p(it)) { @@ -496,28 +496,28 @@ bool subghz_setting_delete_custom_preset(SubGhzSetting* instance, const char* pr } uint8_t* subghz_setting_get_preset_data(SubGhzSetting* instance, size_t idx) { - furi_assert(instance); + furi_check(instance); SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_get(instance->preset->data, idx); return item->custom_preset_data; } size_t subghz_setting_get_preset_data_size(SubGhzSetting* instance, size_t idx) { - furi_assert(instance); + furi_check(instance); SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_get(instance->preset->data, idx); return item->custom_preset_data_size; } uint8_t* subghz_setting_get_preset_data_by_name(SubGhzSetting* instance, const char* preset_name) { - furi_assert(instance); + furi_check(instance); SubGhzSettingCustomPresetItem* item = SubGhzSettingCustomPresetItemArray_get( instance->preset->data, subghz_setting_get_inx_preset_by_name(instance, preset_name)); return item->custom_preset_data; } uint32_t subghz_setting_get_frequency(SubGhzSetting* instance, size_t idx) { - furi_assert(instance); + furi_check(instance); if(idx < FrequencyList_size(instance->frequencies)) { return (*FrequencyList_get(instance->frequencies, idx)) & FREQUENCY_MASK; } else { @@ -526,7 +526,7 @@ uint32_t subghz_setting_get_frequency(SubGhzSetting* instance, size_t idx) { } uint32_t subghz_setting_get_hopper_frequency(SubGhzSetting* instance, size_t idx) { - furi_assert(instance); + furi_check(instance); if(idx < FrequencyList_size(instance->hopper_frequencies)) { return *FrequencyList_get(instance->hopper_frequencies, idx); } else { @@ -535,7 +535,7 @@ uint32_t subghz_setting_get_hopper_frequency(SubGhzSetting* instance, size_t idx } uint32_t subghz_setting_get_frequency_default_index(SubGhzSetting* instance) { - furi_assert(instance); + furi_check(instance); for(size_t i = 0; i < FrequencyList_size(instance->frequencies); i++) { uint32_t frequency = *FrequencyList_get(instance->frequencies, i); if(frequency & FREQUENCY_FLAG_DEFAULT) { @@ -546,7 +546,7 @@ uint32_t subghz_setting_get_frequency_default_index(SubGhzSetting* instance) { } uint32_t subghz_setting_get_default_frequency(SubGhzSetting* instance) { - furi_assert(instance); + furi_check(instance); return subghz_setting_get_frequency( instance, subghz_setting_get_frequency_default_index(instance)); } diff --git a/lib/subghz/subghz_tx_rx_worker.c b/lib/subghz/subghz_tx_rx_worker.c index daf046f4431..edef84caf10 100644 --- a/lib/subghz/subghz_tx_rx_worker.c +++ b/lib/subghz/subghz_tx_rx_worker.c @@ -29,7 +29,7 @@ struct SubGhzTxRxWorker { }; bool subghz_tx_rx_worker_write(SubGhzTxRxWorker* instance, uint8_t* data, size_t size) { - furi_assert(instance); + furi_check(instance); bool ret = false; size_t stream_tx_free_byte = furi_stream_buffer_spaces_available(instance->stream_tx); if(size && (stream_tx_free_byte >= size)) { @@ -43,12 +43,12 @@ bool subghz_tx_rx_worker_write(SubGhzTxRxWorker* instance, uint8_t* data, size_t } size_t subghz_tx_rx_worker_available(SubGhzTxRxWorker* instance) { - furi_assert(instance); + furi_check(instance); return furi_stream_buffer_bytes_available(instance->stream_rx); } size_t subghz_tx_rx_worker_read(SubGhzTxRxWorker* instance, uint8_t* data, size_t size) { - furi_assert(instance); + furi_check(instance); return furi_stream_buffer_receive(instance->stream_rx, data, size, 0); } @@ -56,9 +56,9 @@ void subghz_tx_rx_worker_set_callback_have_read( SubGhzTxRxWorker* instance, SubGhzTxRxWorkerCallbackHaveRead callback, void* context) { - furi_assert(instance); - furi_assert(callback); - furi_assert(context); + furi_check(instance); + furi_check(callback); + furi_check(context); instance->callback_have_read = callback; instance->context_have_read = context; } @@ -132,7 +132,7 @@ void subghz_tx_rx_worker_tx(SubGhzTxRxWorker* instance, uint8_t* data, size_t si */ static int32_t subghz_tx_rx_worker_thread(void* context) { SubGhzTxRxWorker* instance = context; - furi_assert(instance->device); + furi_check(instance->device); FURI_LOG_I(TAG, "Worker start"); subghz_devices_begin(instance->device); @@ -203,7 +203,7 @@ static int32_t subghz_tx_rx_worker_thread(void* context) { return 0; } -SubGhzTxRxWorker* subghz_tx_rx_worker_alloc() { +SubGhzTxRxWorker* subghz_tx_rx_worker_alloc(void) { SubGhzTxRxWorker* instance = malloc(sizeof(SubGhzTxRxWorker)); instance->thread = @@ -220,8 +220,8 @@ SubGhzTxRxWorker* subghz_tx_rx_worker_alloc() { } void subghz_tx_rx_worker_free(SubGhzTxRxWorker* instance) { - furi_assert(instance); - furi_assert(!instance->worker_running); + furi_check(instance); + furi_check(!instance->worker_running); furi_stream_buffer_free(instance->stream_tx); furi_stream_buffer_free(instance->stream_rx); furi_thread_free(instance->thread); @@ -233,8 +233,8 @@ bool subghz_tx_rx_worker_start( SubGhzTxRxWorker* instance, const SubGhzDevice* device, uint32_t frequency) { - furi_assert(instance); - furi_assert(!instance->worker_running); + furi_check(instance); + furi_check(!instance->worker_running); bool res = false; furi_stream_buffer_reset(instance->stream_tx); furi_stream_buffer_reset(instance->stream_rx); @@ -253,8 +253,8 @@ bool subghz_tx_rx_worker_start( } void subghz_tx_rx_worker_stop(SubGhzTxRxWorker* instance) { - furi_assert(instance); - furi_assert(instance->worker_running); + furi_check(instance); + furi_check(instance->worker_running); instance->worker_running = false; @@ -262,6 +262,6 @@ void subghz_tx_rx_worker_stop(SubGhzTxRxWorker* instance) { } bool subghz_tx_rx_worker_is_running(SubGhzTxRxWorker* instance) { - furi_assert(instance); + furi_check(instance); return instance->worker_running; } diff --git a/lib/subghz/subghz_tx_rx_worker.h b/lib/subghz/subghz_tx_rx_worker.h index 56bdb0a1feb..a8d547ab2d7 100644 --- a/lib/subghz/subghz_tx_rx_worker.h +++ b/lib/subghz/subghz_tx_rx_worker.h @@ -57,7 +57,7 @@ void subghz_tx_rx_worker_set_callback_have_read( * Allocate SubGhzTxRxWorker * @return SubGhzTxRxWorker* Pointer to a SubGhzTxRxWorker instance */ -SubGhzTxRxWorker* subghz_tx_rx_worker_alloc(); +SubGhzTxRxWorker* subghz_tx_rx_worker_alloc(void); /** * Free SubGhzTxRxWorker diff --git a/lib/subghz/subghz_worker.c b/lib/subghz/subghz_worker.c index 50b5aba5116..fe68d5e2d15 100644 --- a/lib/subghz/subghz_worker.c +++ b/lib/subghz/subghz_worker.c @@ -79,7 +79,7 @@ static int32_t subghz_worker_thread_callback(void* context) { return 0; } -SubGhzWorker* subghz_worker_alloc() { +SubGhzWorker* subghz_worker_alloc(void) { SubGhzWorker* instance = malloc(sizeof(SubGhzWorker)); instance->thread = @@ -95,7 +95,7 @@ SubGhzWorker* subghz_worker_alloc() { } void subghz_worker_free(SubGhzWorker* instance) { - furi_assert(instance); + furi_check(instance); furi_stream_buffer_free(instance->stream); furi_thread_free(instance->thread); @@ -106,23 +106,23 @@ void subghz_worker_free(SubGhzWorker* instance) { void subghz_worker_set_overrun_callback( SubGhzWorker* instance, SubGhzWorkerOverrunCallback callback) { - furi_assert(instance); + furi_check(instance); instance->overrun_callback = callback; } void subghz_worker_set_pair_callback(SubGhzWorker* instance, SubGhzWorkerPairCallback callback) { - furi_assert(instance); + furi_check(instance); instance->pair_callback = callback; } void subghz_worker_set_context(SubGhzWorker* instance, void* context) { - furi_assert(instance); + furi_check(instance); instance->context = context; } void subghz_worker_start(SubGhzWorker* instance) { - furi_assert(instance); - furi_assert(!instance->running); + furi_check(instance); + furi_check(!instance->running); instance->running = true; @@ -130,8 +130,8 @@ void subghz_worker_start(SubGhzWorker* instance) { } void subghz_worker_stop(SubGhzWorker* instance) { - furi_assert(instance); - furi_assert(instance->running); + furi_check(instance); + furi_check(instance->running); instance->running = false; @@ -139,11 +139,11 @@ void subghz_worker_stop(SubGhzWorker* instance) { } bool subghz_worker_is_running(SubGhzWorker* instance) { - furi_assert(instance); + furi_check(instance); return instance->running; } void subghz_worker_set_filter(SubGhzWorker* instance, uint16_t timeout) { - furi_assert(instance); + furi_check(instance); instance->filter_duration = timeout; } \ No newline at end of file diff --git a/lib/subghz/subghz_worker.h b/lib/subghz/subghz_worker.h index 657278f5053..87ea3fc7cf2 100644 --- a/lib/subghz/subghz_worker.h +++ b/lib/subghz/subghz_worker.h @@ -18,7 +18,7 @@ void subghz_worker_rx_callback(bool level, uint32_t duration, void* context); * Allocate SubGhzWorker. * @return SubGhzWorker* Pointer to a SubGhzWorker instance */ -SubGhzWorker* subghz_worker_alloc(); +SubGhzWorker* subghz_worker_alloc(void); /** * Free SubGhzWorker. diff --git a/lib/subghz/transmitter.c b/lib/subghz/transmitter.c index 81be143b53d..4f7922c353e 100644 --- a/lib/subghz/transmitter.c +++ b/lib/subghz/transmitter.c @@ -27,18 +27,18 @@ SubGhzTransmitter* } void subghz_transmitter_free(SubGhzTransmitter* instance) { - furi_assert(instance); + furi_check(instance); instance->protocol->encoder->free(instance->protocol_instance); free(instance); } SubGhzProtocolEncoderBase* subghz_transmitter_get_protocol_instance(SubGhzTransmitter* instance) { - furi_assert(instance); + furi_check(instance); return instance->protocol_instance; } bool subghz_transmitter_stop(SubGhzTransmitter* instance) { - furi_assert(instance); + furi_check(instance); bool ret = false; if(instance->protocol && instance->protocol->encoder && instance->protocol->encoder->stop) { instance->protocol->encoder->stop(instance->protocol_instance); @@ -49,7 +49,7 @@ bool subghz_transmitter_stop(SubGhzTransmitter* instance) { SubGhzProtocolStatus subghz_transmitter_deserialize(SubGhzTransmitter* instance, FlipperFormat* flipper_format) { - furi_assert(instance); + furi_check(instance); SubGhzProtocolStatus ret = SubGhzProtocolStatusError; if(instance->protocol && instance->protocol->encoder && instance->protocol->encoder->deserialize) { diff --git a/lib/toolbox/bit_buffer.c b/lib/toolbox/bit_buffer.c index 1943ee833dc..85a52e79d60 100644 --- a/lib/toolbox/bit_buffer.c +++ b/lib/toolbox/bit_buffer.c @@ -12,7 +12,7 @@ struct BitBuffer { }; BitBuffer* bit_buffer_alloc(size_t capacity_bytes) { - furi_assert(capacity_bytes); + furi_check(capacity_bytes); BitBuffer* buf = malloc(sizeof(BitBuffer)); @@ -26,7 +26,7 @@ BitBuffer* bit_buffer_alloc(size_t capacity_bytes) { } void bit_buffer_free(BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); free(buf->data); free(buf->parity); @@ -34,7 +34,7 @@ void bit_buffer_free(BitBuffer* buf) { } void bit_buffer_reset(BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); memset(buf->data, 0, buf->capacity_bytes); size_t parity_buf_size = (buf->capacity_bytes + BITS_IN_BYTE - 1) / BITS_IN_BYTE; @@ -43,50 +43,50 @@ void bit_buffer_reset(BitBuffer* buf) { } void bit_buffer_copy(BitBuffer* buf, const BitBuffer* other) { - furi_assert(buf); - furi_assert(other); + furi_check(buf); + furi_check(other); if(buf == other) return; - furi_assert(buf->capacity_bytes * BITS_IN_BYTE >= other->size_bits); + furi_check(buf->capacity_bytes * BITS_IN_BYTE >= other->size_bits); memcpy(buf->data, other->data, bit_buffer_get_size_bytes(other)); buf->size_bits = other->size_bits; } void bit_buffer_copy_right(BitBuffer* buf, const BitBuffer* other, size_t start_index) { - furi_assert(buf); - furi_assert(other); - furi_assert(bit_buffer_get_size_bytes(other) > start_index); - furi_assert(buf->capacity_bytes >= bit_buffer_get_size_bytes(other) - start_index); + furi_check(buf); + furi_check(other); + furi_check(bit_buffer_get_size_bytes(other) > start_index); + furi_check(buf->capacity_bytes >= bit_buffer_get_size_bytes(other) - start_index); memcpy(buf->data, other->data + start_index, bit_buffer_get_size_bytes(other) - start_index); buf->size_bits = other->size_bits - start_index * BITS_IN_BYTE; } void bit_buffer_copy_left(BitBuffer* buf, const BitBuffer* other, size_t end_index) { - furi_assert(buf); - furi_assert(other); - furi_assert(bit_buffer_get_capacity_bytes(buf) >= end_index); - furi_assert(bit_buffer_get_size_bytes(other) >= end_index); + furi_check(buf); + furi_check(other); + furi_check(bit_buffer_get_capacity_bytes(buf) >= end_index); + furi_check(bit_buffer_get_size_bytes(other) >= end_index); memcpy(buf->data, other->data, end_index); buf->size_bits = end_index * BITS_IN_BYTE; } void bit_buffer_copy_bytes(BitBuffer* buf, const uint8_t* data, size_t size_bytes) { - furi_assert(buf); - furi_assert(data); - furi_assert(buf->capacity_bytes >= size_bytes); + furi_check(buf); + furi_check(data); + furi_check(buf->capacity_bytes >= size_bytes); memcpy(buf->data, data, size_bytes); buf->size_bits = size_bytes * BITS_IN_BYTE; } void bit_buffer_copy_bits(BitBuffer* buf, const uint8_t* data, size_t size_bits) { - furi_assert(buf); - furi_assert(data); - furi_assert(buf->capacity_bytes * BITS_IN_BYTE >= size_bits); + furi_check(buf); + furi_check(data); + furi_check(buf->capacity_bytes * BITS_IN_BYTE >= size_bits); size_t size_bytes = (size_bits + BITS_IN_BYTE - 1) / BITS_IN_BYTE; memcpy(buf->data, data, size_bytes); @@ -94,8 +94,8 @@ void bit_buffer_copy_bits(BitBuffer* buf, const uint8_t* data, size_t size_bits) } void bit_buffer_copy_bytes_with_parity(BitBuffer* buf, const uint8_t* data, size_t size_bits) { - furi_assert(buf); - furi_assert(data); + furi_check(buf); + furi_check(data); size_t bits_processed = 0; size_t curr_byte = 0; @@ -104,7 +104,7 @@ void bit_buffer_copy_bytes_with_parity(BitBuffer* buf, const uint8_t* data, size buf->size_bits = size_bits; buf->data[0] = data[0]; } else { - furi_assert(size_bits % (BITS_IN_BYTE + 1) == 0); + furi_check(size_bits % (BITS_IN_BYTE + 1) == 0); while(bits_processed < size_bits) { buf->data[curr_byte] = data[bits_processed / BITS_IN_BYTE] >> (bits_processed % BITS_IN_BYTE); @@ -126,9 +126,9 @@ void bit_buffer_copy_bytes_with_parity(BitBuffer* buf, const uint8_t* data, size } void bit_buffer_write_bytes(const BitBuffer* buf, void* dest, size_t size_bytes) { - furi_assert(buf); - furi_assert(dest); - furi_assert(bit_buffer_get_size_bytes(buf) <= size_bytes); + furi_check(buf); + furi_check(dest); + furi_check(bit_buffer_get_size_bytes(buf) <= size_bytes); memcpy(dest, buf->data, bit_buffer_get_size_bytes(buf)); } @@ -138,14 +138,14 @@ void bit_buffer_write_bytes_with_parity( void* dest, size_t size_bytes, size_t* bits_written) { - furi_assert(buf); - furi_assert(dest); - furi_assert(bits_written); + furi_check(buf); + furi_check(dest); + furi_check(bits_written); size_t buf_size_bytes = bit_buffer_get_size_bytes(buf); size_t buf_size_with_parity_bytes = (buf_size_bytes * (BITS_IN_BYTE + 1) + BITS_IN_BYTE) / BITS_IN_BYTE; - furi_assert(buf_size_with_parity_bytes <= size_bytes); + furi_check(buf_size_with_parity_bytes <= size_bytes); uint8_t next_par_bit = 0; uint16_t curr_bit_pos = 0; @@ -177,53 +177,53 @@ void bit_buffer_write_bytes_mid( void* dest, size_t start_index, size_t size_bytes) { - furi_assert(buf); - furi_assert(dest); - furi_assert(start_index + size_bytes <= bit_buffer_get_size_bytes(buf)); + furi_check(buf); + furi_check(dest); + furi_check(start_index + size_bytes <= bit_buffer_get_size_bytes(buf)); memcpy(dest, buf->data + start_index, size_bytes); } bool bit_buffer_has_partial_byte(const BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); return (buf->size_bits % BITS_IN_BYTE) != 0; } bool bit_buffer_starts_with_byte(const BitBuffer* buf, uint8_t byte) { - furi_assert(buf); + furi_check(buf); return bit_buffer_get_size_bytes(buf) && (buf->data[0] == byte); } size_t bit_buffer_get_capacity_bytes(const BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); return buf->capacity_bytes; } size_t bit_buffer_get_size(const BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); return buf->size_bits; } size_t bit_buffer_get_size_bytes(const BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); return (buf->size_bits / BITS_IN_BYTE) + (buf->size_bits % BITS_IN_BYTE ? 1 : 0); } uint8_t bit_buffer_get_byte(const BitBuffer* buf, size_t index) { - furi_assert(buf); - furi_assert(buf->capacity_bytes > index); + furi_check(buf); + furi_check(buf->capacity_bytes > index); return buf->data[index]; } uint8_t bit_buffer_get_byte_from_bit(const BitBuffer* buf, size_t index_bits) { - furi_assert(buf); - furi_assert(buf->capacity_bytes * BITS_IN_BYTE > index_bits); + furi_check(buf); + furi_check(buf->capacity_bytes * BITS_IN_BYTE > index_bits); const size_t byte_index = index_bits / BITS_IN_BYTE; const size_t bit_offset = index_bits % BITS_IN_BYTE; @@ -235,29 +235,29 @@ uint8_t bit_buffer_get_byte_from_bit(const BitBuffer* buf, size_t index_bits) { } const uint8_t* bit_buffer_get_data(const BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); return buf->data; } const uint8_t* bit_buffer_get_parity(const BitBuffer* buf) { - furi_assert(buf); + furi_check(buf); return buf->parity; } void bit_buffer_set_byte(BitBuffer* buf, size_t index, uint8_t byte) { - furi_assert(buf); + furi_check(buf); const size_t size_bytes = bit_buffer_get_size_bytes(buf); - furi_assert(size_bytes > index); + furi_check(size_bytes > index); buf->data[index] = byte; } void bit_buffer_set_byte_with_parity(BitBuffer* buff, size_t index, uint8_t byte, bool parity) { - furi_assert(buff); - furi_assert(buff->size_bits / BITS_IN_BYTE > index); + furi_check(buff); + furi_check(buff->size_bits / BITS_IN_BYTE > index); buff->data[index] = byte; if((index % BITS_IN_BYTE) == 0) { @@ -268,15 +268,15 @@ void bit_buffer_set_byte_with_parity(BitBuffer* buff, size_t index, uint8_t byte } void bit_buffer_set_size(BitBuffer* buf, size_t new_size) { - furi_assert(buf); - furi_assert(buf->capacity_bytes * BITS_IN_BYTE >= new_size); + furi_check(buf); + furi_check(buf->capacity_bytes * BITS_IN_BYTE >= new_size); buf->size_bits = new_size; } void bit_buffer_set_size_bytes(BitBuffer* buf, size_t new_size_bytes) { - furi_assert(buf); - furi_assert(buf->capacity_bytes >= new_size_bytes); + furi_check(buf); + furi_check(buf->capacity_bytes >= new_size_bytes); buf->size_bits = new_size_bytes * BITS_IN_BYTE; } @@ -286,43 +286,43 @@ void bit_buffer_append(BitBuffer* buf, const BitBuffer* other) { } void bit_buffer_append_right(BitBuffer* buf, const BitBuffer* other, size_t start_index) { - furi_assert(buf); - furi_assert(other); + furi_check(buf); + furi_check(other); const size_t size_bytes = bit_buffer_get_size_bytes(buf); const size_t other_size_bytes = bit_buffer_get_size_bytes(other) - start_index; - furi_assert(buf->capacity_bytes >= size_bytes + other_size_bytes); + furi_check(buf->capacity_bytes >= size_bytes + other_size_bytes); memcpy(buf->data + size_bytes, other->data + start_index, other_size_bytes); buf->size_bits += other->size_bits - start_index * BITS_IN_BYTE; } void bit_buffer_append_byte(BitBuffer* buf, uint8_t byte) { - furi_assert(buf); + furi_check(buf); const size_t data_size_bytes = bit_buffer_get_size_bytes(buf); const size_t new_data_size_bytes = data_size_bytes + 1; - furi_assert(new_data_size_bytes <= buf->capacity_bytes); + furi_check(new_data_size_bytes <= buf->capacity_bytes); buf->data[data_size_bytes] = byte; buf->size_bits = new_data_size_bytes * BITS_IN_BYTE; } void bit_buffer_append_bytes(BitBuffer* buf, const uint8_t* data, size_t size_bytes) { - furi_assert(buf); - furi_assert(data); + furi_check(buf); + furi_check(data); const size_t buf_size_bytes = bit_buffer_get_size_bytes(buf); - furi_assert(buf->capacity_bytes >= buf_size_bytes + size_bytes); + furi_check(buf->capacity_bytes >= buf_size_bytes + size_bytes); memcpy(&buf->data[buf_size_bytes], data, size_bytes); buf->size_bits += size_bytes * BITS_IN_BYTE; } void bit_buffer_append_bit(BitBuffer* buf, bool bit) { - furi_assert(buf); - furi_assert( + furi_check(buf); + furi_check( bit_buffer_get_size_bytes(buf) <= (buf->capacity_bytes - (bit_buffer_has_partial_byte(buf) ? 0 : 1))); diff --git a/lib/toolbox/compress.c b/lib/toolbox/compress.c index 0d5e1c654d7..70db4796801 100644 --- a/lib/toolbox/compress.c +++ b/lib/toolbox/compress.c @@ -27,7 +27,7 @@ struct CompressIcon { uint8_t decoded_buff[COMPRESS_ICON_DECODED_BUFF_SIZE]; }; -CompressIcon* compress_icon_alloc() { +CompressIcon* compress_icon_alloc(void) { CompressIcon* instance = malloc(sizeof(CompressIcon)); instance->decoder = heatshrink_decoder_alloc( COMPRESS_ICON_ENCODED_BUFF_SIZE, @@ -40,15 +40,15 @@ CompressIcon* compress_icon_alloc() { } void compress_icon_free(CompressIcon* instance) { - furi_assert(instance); + furi_check(instance); heatshrink_decoder_free(instance->decoder); free(instance); } void compress_icon_decode(CompressIcon* instance, const uint8_t* icon_data, uint8_t** decoded_buff) { - furi_assert(instance); - furi_assert(icon_data); - furi_assert(decoded_buff); + furi_check(instance); + furi_check(icon_data); + furi_check(decoded_buff); CompressHeader* header = (CompressHeader*)icon_data; if(header->is_compressed) { @@ -64,7 +64,7 @@ void compress_icon_decode(CompressIcon* instance, const uint8_t* icon_data, uint instance->decoded_buff, sizeof(instance->decoded_buff), &data_processed); - furi_assert((res == HSDR_POLL_EMPTY) || (res == HSDR_POLL_MORE)); + furi_check((res == HSDR_POLL_EMPTY) || (res == HSDR_POLL_MORE)); if(res != HSDR_POLL_MORE) { break; } @@ -98,7 +98,7 @@ Compress* compress_alloc(uint16_t compress_buff_size) { } void compress_free(Compress* compress) { - furi_assert(compress); + furi_check(compress); heatshrink_encoder_free(compress->encoder); heatshrink_decoder_free(compress->decoder); diff --git a/lib/toolbox/compress.h b/lib/toolbox/compress.h index a18551d7f9a..b61bdb0227d 100644 --- a/lib/toolbox/compress.h +++ b/lib/toolbox/compress.h @@ -19,7 +19,7 @@ typedef struct CompressIcon CompressIcon; * * @return Compress Icon instance */ -CompressIcon* compress_icon_alloc(); +CompressIcon* compress_icon_alloc(void); /** Free icon compressor * diff --git a/lib/toolbox/dir_walk.c b/lib/toolbox/dir_walk.c index 509ceb5b42d..ed8c658661a 100644 --- a/lib/toolbox/dir_walk.c +++ b/lib/toolbox/dir_walk.c @@ -14,6 +14,8 @@ struct DirWalk { }; DirWalk* dir_walk_alloc(Storage* storage) { + furi_check(storage); + DirWalk* dir_walk = malloc(sizeof(DirWalk)); dir_walk->path = furi_string_alloc(); dir_walk->file = storage_file_alloc(storage); @@ -24,6 +26,8 @@ DirWalk* dir_walk_alloc(Storage* storage) { } void dir_walk_free(DirWalk* dir_walk) { + furi_check(dir_walk); + storage_file_free(dir_walk->file); furi_string_free(dir_walk->path); DirIndexList_clear(dir_walk->index_list); @@ -31,15 +35,18 @@ void dir_walk_free(DirWalk* dir_walk) { } void dir_walk_set_recursive(DirWalk* dir_walk, bool recursive) { + furi_check(dir_walk); dir_walk->recursive = recursive; } void dir_walk_set_filter_cb(DirWalk* dir_walk, DirWalkFilterCb cb, void* context) { + furi_check(dir_walk); dir_walk->filter_cb = cb; dir_walk->filter_context = context; } bool dir_walk_open(DirWalk* dir_walk, const char* path) { + furi_check(dir_walk); furi_string_set(dir_walk->path, path); dir_walk->current_index = 0; return storage_dir_open(dir_walk->file, path); @@ -139,14 +146,17 @@ static DirWalkResult } FS_Error dir_walk_get_error(DirWalk* dir_walk) { + furi_check(dir_walk); return storage_file_get_error(dir_walk->file); } DirWalkResult dir_walk_read(DirWalk* dir_walk, FuriString* return_path, FileInfo* fileinfo) { + furi_check(dir_walk); return dir_walk_iter(dir_walk, return_path, fileinfo); } void dir_walk_close(DirWalk* dir_walk) { + furi_check(dir_walk); if(storage_file_is_open(dir_walk->file)) { storage_dir_close(dir_walk->file); } diff --git a/lib/toolbox/hex.c b/lib/toolbox/hex.c index 25dcb09500e..e5cdfff17c1 100644 --- a/lib/toolbox/hex.c +++ b/lib/toolbox/hex.c @@ -1,6 +1,9 @@ #include "hex.h" +#include bool hex_char_to_hex_nibble(char c, uint8_t* nibble) { + furi_check(nibble); + if((c >= '0' && c <= '9')) { *nibble = c - '0'; return true; @@ -16,6 +19,8 @@ bool hex_char_to_hex_nibble(char c, uint8_t* nibble) { } bool hex_char_to_uint8(char hi, char low, uint8_t* value) { + furi_check(value); + uint8_t hi_nibble_value, low_nibble_value; if(hex_char_to_hex_nibble(hi, &hi_nibble_value) && @@ -28,6 +33,9 @@ bool hex_char_to_uint8(char hi, char low, uint8_t* value) { } bool hex_chars_to_uint8(const char* value_str, uint8_t* value) { + furi_check(value_str); + furi_check(value); + bool parse_success = false; while(*value_str && value_str[1]) { parse_success = hex_char_to_uint8(*value_str, value_str[1], value++); @@ -38,6 +46,9 @@ bool hex_chars_to_uint8(const char* value_str, uint8_t* value) { } bool hex_chars_to_uint64(const char* value_str, uint64_t* value) { + furi_check(value_str); + furi_check(value); + uint8_t* _value = (uint8_t*)value; bool parse_success = false; @@ -45,10 +56,14 @@ bool hex_chars_to_uint64(const char* value_str, uint64_t* value) { parse_success = hex_char_to_uint8(value_str[i * 2], value_str[i * 2 + 1], &_value[7 - i]); if(!parse_success) break; } + return parse_success; } void uint8_to_hex_chars(const uint8_t* src, uint8_t* target, int length) { + furi_check(src); + furi_check(target); + const char chars[] = "0123456789ABCDEF"; while(--length >= 0) target[length] = chars[(src[length >> 1] >> ((1 - (length & 1)) << 2)) & 0xF]; diff --git a/lib/toolbox/keys_dict.c b/lib/toolbox/keys_dict.c index 8d6f8c84689..09fc241eebb 100644 --- a/lib/toolbox/keys_dict.c +++ b/lib/toolbox/keys_dict.c @@ -53,7 +53,7 @@ static bool keys_dict_read_key_line(KeysDict* instance, FuriString* line, bool* } bool keys_dict_check_presence(const char* path) { - furi_assert(path); + furi_check(path); Storage* storage = furi_record_open(RECORD_STORAGE); @@ -65,16 +65,13 @@ bool keys_dict_check_presence(const char* path) { } KeysDict* keys_dict_alloc(const char* path, KeysDictMode mode, size_t key_size) { - furi_assert(path); - furi_assert(key_size > 0); + furi_check(path); + furi_check(key_size > 0); KeysDict* instance = malloc(sizeof(KeysDict)); Storage* storage = furi_record_open(RECORD_STORAGE); - furi_assert(storage); - instance->stream = buffered_file_stream_alloc(storage); - furi_assert(instance->stream); FS_OpenMode open_mode = (mode == KeysDictModeOpenAlways) ? FSOM_OPEN_ALWAYS : FSOM_OPEN_EXISTING; @@ -116,8 +113,8 @@ KeysDict* keys_dict_alloc(const char* path, KeysDictMode mode, size_t key_size) } void keys_dict_free(KeysDict* instance) { - furi_assert(instance); - furi_assert(instance->stream); + furi_check(instance); + furi_check(instance->stream); buffered_file_stream_close(instance->stream); stream_free(instance->stream); @@ -157,14 +154,14 @@ static void keys_dict_str_to_int(KeysDict* instance, FuriString* key_str, uint64 } size_t keys_dict_get_total_keys(KeysDict* instance) { - furi_assert(instance); + furi_check(instance); return instance->total_keys; } bool keys_dict_rewind(KeysDict* instance) { - furi_assert(instance); - furi_assert(instance->stream); + furi_check(instance); + furi_check(instance->stream); return stream_rewind(instance->stream); } @@ -185,10 +182,10 @@ static bool keys_dict_get_next_key_str(KeysDict* instance, FuriString* key) { } bool keys_dict_get_next_key(KeysDict* instance, uint8_t* key, size_t key_size) { - furi_assert(instance); - furi_assert(instance->stream); - furi_assert(instance->key_size == key_size); - furi_assert(key); + furi_check(instance); + furi_check(instance->stream); + furi_check(instance->key_size == key_size); + furi_check(key); FuriString* temp_key = furi_string_alloc(); @@ -237,10 +234,10 @@ static bool keys_dict_is_key_present_str(KeysDict* instance, FuriString* key) { } bool keys_dict_is_key_present(KeysDict* instance, const uint8_t* key, size_t key_size) { - furi_assert(instance); - furi_assert(instance->stream); - furi_assert(instance->key_size == key_size); - furi_assert(key); + furi_check(instance); + furi_check(instance->stream); + furi_check(instance->key_size == key_size); + furi_check(key); FuriString* temp_key = furi_string_alloc(); @@ -274,13 +271,12 @@ static bool keys_dict_add_key_str(KeysDict* instance, FuriString* key) { } bool keys_dict_add_key(KeysDict* instance, const uint8_t* key, size_t key_size) { - furi_assert(instance); - furi_assert(instance->stream); - furi_assert(instance->key_size == key_size); - furi_assert(key); + furi_check(instance); + furi_check(instance->stream); + furi_check(instance->key_size == key_size); + furi_check(key); FuriString* temp_key = furi_string_alloc(); - furi_assert(temp_key); keys_dict_int_to_str(instance, key, temp_key); bool key_added = keys_dict_add_key_str(instance, temp_key); @@ -293,10 +289,10 @@ bool keys_dict_add_key(KeysDict* instance, const uint8_t* key, size_t key_size) } bool keys_dict_delete_key(KeysDict* instance, const uint8_t* key, size_t key_size) { - furi_assert(instance); - furi_assert(instance->stream); - furi_assert(instance->key_size == key_size); - furi_assert(key); + furi_check(instance); + furi_check(instance->stream); + furi_check(instance->key_size == key_size); + furi_check(key); bool key_removed = false; diff --git a/lib/toolbox/manchester_encoder.c b/lib/toolbox/manchester_encoder.c index c22e4a177cc..38b94eb86ac 100644 --- a/lib/toolbox/manchester_encoder.c +++ b/lib/toolbox/manchester_encoder.c @@ -1,7 +1,9 @@ #include "manchester_encoder.h" #include +#include void manchester_encoder_reset(ManchesterEncoderState* state) { + furi_check(state); state->step = 0; } @@ -9,6 +11,9 @@ bool manchester_encoder_advance( ManchesterEncoderState* state, const bool curr_bit, ManchesterEncoderResult* result) { + furi_check(state); + furi_check(result); + bool advance = false; switch(state->step) { case 0: @@ -41,14 +46,16 @@ bool manchester_encoder_advance( advance = true; break; default: - printf("DO CRASH HERE\r\n"); - // furi_crash + furi_crash(); break; } return advance; } ManchesterEncoderResult manchester_encoder_finish(ManchesterEncoderState* state) { + furi_check(state); + state->step = 0; + return (state->prev_bit << 1) + state->prev_bit; } diff --git a/lib/toolbox/name_generator.c b/lib/toolbox/name_generator.c index 04fcab07cf7..ba9b747f2b3 100644 --- a/lib/toolbox/name_generator.c +++ b/lib/toolbox/name_generator.c @@ -37,8 +37,8 @@ void name_generator_make_auto(char* name, size_t max_name_size, const char* pref } void name_generator_make_random(char* name, size_t max_name_size) { - furi_assert(name); - furi_assert(max_name_size); + furi_check(name); + furi_check(max_name_size); uint8_t name_generator_left_i = rand() % COUNT_OF(name_generator_left); uint8_t name_generator_right_i = rand() % COUNT_OF(name_generator_right); @@ -55,9 +55,9 @@ void name_generator_make_random(char* name, size_t max_name_size) { } void name_generator_make_detailed(char* name, size_t max_name_size, const char* prefix) { - furi_assert(name); - furi_assert(max_name_size); - furi_assert(prefix); + furi_check(name); + furi_check(max_name_size); + furi_check(prefix); DateTime dateTime; furi_hal_rtc_get_datetime(&dateTime); diff --git a/lib/toolbox/path.c b/lib/toolbox/path.c index 3d161a19630..37bacd65a89 100644 --- a/lib/toolbox/path.c +++ b/lib/toolbox/path.c @@ -2,6 +2,9 @@ #include void path_extract_filename_no_ext(const char* path, FuriString* filename) { + furi_check(path); + furi_check(filename); + furi_string_set(filename, path); size_t start_position = furi_string_search_rchar(filename, '/'); @@ -21,6 +24,9 @@ void path_extract_filename_no_ext(const char* path, FuriString* filename) { } void path_extract_filename(FuriString* path, FuriString* name, bool trim_ext) { + furi_check(path); + furi_check(name); + size_t filename_start = furi_string_search_rchar(path, '/'); if(filename_start > 0) { filename_start++; @@ -35,6 +41,9 @@ void path_extract_filename(FuriString* path, FuriString* name, bool trim_ext) { } void path_extract_extension(FuriString* path, char* ext, size_t ext_len_max) { + furi_check(path); + furi_check(ext); + size_t dot = furi_string_search_rchar(path, '.'); size_t filename_start = furi_string_search_rchar(path, '/'); @@ -51,6 +60,9 @@ static inline void path_cleanup(FuriString* path) { } void path_extract_basename(const char* path, FuriString* basename) { + furi_check(path); + furi_check(basename); + furi_string_set(basename, path); path_cleanup(basename); size_t pos = furi_string_search_rchar(basename, '/'); @@ -60,6 +72,9 @@ void path_extract_basename(const char* path, FuriString* basename) { } void path_extract_dirname(const char* path, FuriString* dirname) { + furi_check(path); + furi_check(dirname); + furi_string_set(dirname, path); path_cleanup(dirname); size_t pos = furi_string_search_rchar(dirname, '/'); @@ -69,6 +84,9 @@ void path_extract_dirname(const char* path, FuriString* dirname) { } void path_append(FuriString* path, const char* suffix) { + furi_check(path); + furi_check(suffix); + path_cleanup(path); FuriString* suffix_str; suffix_str = furi_string_alloc_set(suffix); @@ -79,6 +97,10 @@ void path_append(FuriString* path, const char* suffix) { } void path_concat(const char* path, const char* suffix, FuriString* out_path) { + furi_check(path); + furi_check(suffix); + furi_check(out_path); + furi_string_set(out_path, path); path_append(out_path, suffix); } diff --git a/lib/toolbox/pretty_format.c b/lib/toolbox/pretty_format.c index d5ba10381a4..2dcfdb6d9f3 100644 --- a/lib/toolbox/pretty_format.c +++ b/lib/toolbox/pretty_format.c @@ -11,7 +11,7 @@ void pretty_format_bytes_hex_canonical( const char* line_prefix, const uint8_t* data, size_t data_size) { - furi_assert(data); + furi_check(data); bool is_truncated = false; diff --git a/lib/toolbox/profiler.c b/lib/toolbox/profiler.c index 96f38dce2c5..4e7cade1a13 100644 --- a/lib/toolbox/profiler.c +++ b/lib/toolbox/profiler.c @@ -17,7 +17,7 @@ struct Profiler { ProfilerRecordDict_t records; }; -Profiler* profiler_alloc() { +Profiler* profiler_alloc(void) { Profiler* profiler = malloc(sizeof(Profiler)); ProfilerRecordDict_init(profiler->records); return profiler; diff --git a/lib/toolbox/profiler.h b/lib/toolbox/profiler.h index 840146332c5..037711a8ff8 100644 --- a/lib/toolbox/profiler.h +++ b/lib/toolbox/profiler.h @@ -6,7 +6,7 @@ extern "C" { typedef struct Profiler Profiler; -Profiler* profiler_alloc(); +Profiler* profiler_alloc(void); void profiler_free(Profiler* profiler); diff --git a/lib/toolbox/property.c b/lib/toolbox/property.c index c258cdd6a0a..900948b454f 100644 --- a/lib/toolbox/property.c +++ b/lib/toolbox/property.c @@ -3,7 +3,7 @@ #include void property_value_out(PropertyValueContext* ctx, const char* fmt, unsigned int nparts, ...) { - furi_assert(ctx); + furi_check(ctx); furi_string_reset(ctx->key); va_list args; diff --git a/lib/toolbox/protocols/protocol_dict.c b/lib/toolbox/protocols/protocol_dict.c index 136dc137216..e8da4b1cd06 100644 --- a/lib/toolbox/protocols/protocol_dict.c +++ b/lib/toolbox/protocols/protocol_dict.c @@ -8,6 +8,8 @@ struct ProtocolDict { }; ProtocolDict* protocol_dict_alloc(const ProtocolBase** protocols, size_t count) { + furi_check(protocols); + ProtocolDict* dict = malloc(sizeof(ProtocolDict)); dict->base = protocols; dict->count = count; @@ -21,6 +23,8 @@ ProtocolDict* protocol_dict_alloc(const ProtocolBase** protocols, size_t count) } void protocol_dict_free(ProtocolDict* dict) { + furi_check(dict); + for(size_t i = 0; i < dict->count; i++) { dict->base[i]->free(dict->data[i]); } @@ -34,8 +38,9 @@ void protocol_dict_set_data( size_t protocol_index, const uint8_t* data, size_t data_size) { - furi_assert(protocol_index < dict->count); - furi_assert(dict->base[protocol_index]->get_data != NULL); + furi_check(protocol_index < dict->count); + furi_check(dict->base[protocol_index]->get_data != NULL); + uint8_t* protocol_data = dict->base[protocol_index]->get_data(dict->data[protocol_index]); size_t protocol_data_size = dict->base[protocol_index]->data_size; furi_check(data_size >= protocol_data_size); @@ -47,8 +52,9 @@ void protocol_dict_get_data( size_t protocol_index, uint8_t* data, size_t data_size) { - furi_assert(protocol_index < dict->count); - furi_assert(dict->base[protocol_index]->get_data != NULL); + furi_check(protocol_index < dict->count); + furi_check(dict->base[protocol_index]->get_data != NULL); + uint8_t* protocol_data = dict->base[protocol_index]->get_data(dict->data[protocol_index]); size_t protocol_data_size = dict->base[protocol_index]->data_size; furi_check(data_size >= protocol_data_size); @@ -56,11 +62,12 @@ void protocol_dict_get_data( } size_t protocol_dict_get_data_size(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); return dict->base[protocol_index]->data_size; } size_t protocol_dict_get_max_data_size(ProtocolDict* dict) { + furi_check(dict); size_t max_data_size = 0; for(size_t i = 0; i < dict->count; i++) { size_t data_size = dict->base[i]->data_size; @@ -73,16 +80,18 @@ size_t protocol_dict_get_max_data_size(ProtocolDict* dict) { } const char* protocol_dict_get_name(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); return dict->base[protocol_index]->name; } const char* protocol_dict_get_manufacturer(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); return dict->base[protocol_index]->manufacturer; } void protocol_dict_decoders_start(ProtocolDict* dict) { + furi_check(dict); + for(size_t i = 0; i < dict->count; i++) { ProtocolDecoderStart fn = dict->base[i]->decoder.start; @@ -93,11 +102,13 @@ void protocol_dict_decoders_start(ProtocolDict* dict) { } uint32_t protocol_dict_get_features(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); return dict->base[protocol_index]->features; } ProtocolId protocol_dict_decoders_feed(ProtocolDict* dict, bool level, uint32_t duration) { + furi_check(dict); + bool done = false; ProtocolId ready_protocol_id = PROTOCOL_NO; @@ -122,6 +133,8 @@ ProtocolId protocol_dict_decoders_feed_by_feature( uint32_t feature, bool level, uint32_t duration) { + furi_check(dict); + bool done = false; ProtocolId ready_protocol_id = PROTOCOL_NO; @@ -149,7 +162,7 @@ ProtocolId protocol_dict_decoders_feed_by_id( size_t protocol_index, bool level, uint32_t duration) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); ProtocolId ready_protocol_id = PROTOCOL_NO; ProtocolDecoderFeed fn = dict->base[protocol_index]->decoder.feed; @@ -164,7 +177,7 @@ ProtocolId protocol_dict_decoders_feed_by_id( } bool protocol_dict_encoder_start(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); ProtocolEncoderStart fn = dict->base[protocol_index]->encoder.start; if(fn) { @@ -175,7 +188,7 @@ bool protocol_dict_encoder_start(ProtocolDict* dict, size_t protocol_index) { } LevelDuration protocol_dict_encoder_yield(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); ProtocolEncoderYield fn = dict->base[protocol_index]->encoder.yield; if(fn) { @@ -186,7 +199,7 @@ LevelDuration protocol_dict_encoder_yield(ProtocolDict* dict, size_t protocol_in } void protocol_dict_render_data(ProtocolDict* dict, FuriString* result, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); ProtocolRenderData fn = dict->base[protocol_index]->render_data; if(fn) { @@ -195,7 +208,7 @@ void protocol_dict_render_data(ProtocolDict* dict, FuriString* result, size_t pr } void protocol_dict_render_brief_data(ProtocolDict* dict, FuriString* result, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); ProtocolRenderData fn = dict->base[protocol_index]->render_brief_data; if(fn) { @@ -204,11 +217,13 @@ void protocol_dict_render_brief_data(ProtocolDict* dict, FuriString* result, siz } uint32_t protocol_dict_get_validate_count(ProtocolDict* dict, size_t protocol_index) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); return dict->base[protocol_index]->validate_count; } ProtocolId protocol_dict_get_protocol_by_name(ProtocolDict* dict, const char* name) { + furi_check(dict); + furi_check(name); for(size_t i = 0; i < dict->count; i++) { if(strcmp(name, protocol_dict_get_name(dict, i)) == 0) { return i; @@ -218,9 +233,9 @@ ProtocolId protocol_dict_get_protocol_by_name(ProtocolDict* dict, const char* na } bool protocol_dict_get_write_data(ProtocolDict* dict, size_t protocol_index, void* data) { - furi_assert(protocol_index < dict->count); + furi_check(protocol_index < dict->count); ProtocolWriteData fn = dict->base[protocol_index]->write_data; - furi_assert(fn); + furi_check(fn); return fn(dict->data[protocol_index], data); } \ No newline at end of file diff --git a/lib/toolbox/pulse_joiner.c b/lib/toolbox/pulse_joiner.c index b6206486c95..dce63b82338 100644 --- a/lib/toolbox/pulse_joiner.c +++ b/lib/toolbox/pulse_joiner.c @@ -13,7 +13,7 @@ struct PulseJoiner { Pulse pulses[PULSE_MAX_COUNT]; }; -PulseJoiner* pulse_joiner_alloc() { +PulseJoiner* pulse_joiner_alloc(void) { PulseJoiner* pulse_joiner = malloc(sizeof(PulseJoiner)); pulse_joiner->pulse_index = 0; diff --git a/lib/toolbox/pulse_joiner.h b/lib/toolbox/pulse_joiner.h index 25f702e7297..f9597280f15 100644 --- a/lib/toolbox/pulse_joiner.h +++ b/lib/toolbox/pulse_joiner.h @@ -13,7 +13,7 @@ typedef struct PulseJoiner PulseJoiner; * * @return PulseJoiner* */ -PulseJoiner* pulse_joiner_alloc(); +PulseJoiner* pulse_joiner_alloc(void); /** * @brief Free PulseJoiner diff --git a/lib/toolbox/pulse_protocols/pulse_glue.c b/lib/toolbox/pulse_protocols/pulse_glue.c index 9cb914db5c9..f8574691d73 100644 --- a/lib/toolbox/pulse_protocols/pulse_glue.c +++ b/lib/toolbox/pulse_protocols/pulse_glue.c @@ -6,7 +6,7 @@ struct PulseGlue { int32_t next_hi_period; }; -PulseGlue* pulse_glue_alloc() { +PulseGlue* pulse_glue_alloc(void) { PulseGlue* pulse_glue = malloc(sizeof(PulseGlue)); pulse_glue_reset(pulse_glue); return pulse_glue; diff --git a/lib/toolbox/pulse_protocols/pulse_glue.h b/lib/toolbox/pulse_protocols/pulse_glue.h index 4954e2719b2..9f707d0c216 100644 --- a/lib/toolbox/pulse_protocols/pulse_glue.h +++ b/lib/toolbox/pulse_protocols/pulse_glue.h @@ -14,7 +14,7 @@ extern "C" { typedef struct PulseGlue PulseGlue; -PulseGlue* pulse_glue_alloc(); +PulseGlue* pulse_glue_alloc(void); void pulse_glue_free(PulseGlue* pulse_glue); void pulse_glue_reset(PulseGlue* pulse_glue); diff --git a/lib/toolbox/saved_struct.c b/lib/toolbox/saved_struct.c index 2f1c09c8eb5..e96d5b6cbf5 100644 --- a/lib/toolbox/saved_struct.c +++ b/lib/toolbox/saved_struct.c @@ -14,9 +14,9 @@ typedef struct { } SavedStructHeader; bool saved_struct_save(const char* path, void* data, size_t size, uint8_t magic, uint8_t version) { - furi_assert(path); - furi_assert(data); - furi_assert(size); + furi_check(path); + furi_check(data); + furi_check(size); SavedStructHeader header; FURI_LOG_I(TAG, "Saving \"%s\"", path); @@ -131,8 +131,8 @@ bool saved_struct_get_payload_size( uint8_t magic, uint8_t version, size_t* payload_size) { - furi_assert(path); - furi_assert(payload_size); + furi_check(path); + furi_check(payload_size); SavedStructHeader header; Storage* storage = furi_record_open(RECORD_STORAGE); diff --git a/lib/toolbox/simple_array.c b/lib/toolbox/simple_array.c index 7aed8e34be3..af20444dfe9 100644 --- a/lib/toolbox/simple_array.c +++ b/lib/toolbox/simple_array.c @@ -15,15 +15,15 @@ SimpleArray* simple_array_alloc(const SimpleArrayConfig* config) { } void simple_array_free(SimpleArray* instance) { - furi_assert(instance); + furi_check(instance); simple_array_reset(instance); free(instance); } void simple_array_init(SimpleArray* instance, uint32_t count) { - furi_assert(instance); - furi_assert(count > 0); + furi_check(instance); + furi_check(count > 0); simple_array_reset(instance); @@ -39,7 +39,7 @@ void simple_array_init(SimpleArray* instance, uint32_t count) { } void simple_array_reset(SimpleArray* instance) { - furi_assert(instance); + furi_check(instance); if(instance->data) { SimpleArrayReset reset = instance->config->reset; @@ -58,9 +58,9 @@ void simple_array_reset(SimpleArray* instance) { } void simple_array_copy(SimpleArray* instance, const SimpleArray* other) { - furi_assert(instance); - furi_assert(other); - furi_assert(instance->config == other->config); + furi_check(instance); + furi_check(other); + furi_check(instance->config == other->config); simple_array_reset(instance); @@ -81,8 +81,8 @@ void simple_array_copy(SimpleArray* instance, const SimpleArray* other) { } bool simple_array_is_equal(const SimpleArray* instance, const SimpleArray* other) { - furi_assert(instance); - furi_assert(other); + furi_check(instance); + furi_check(other); // Equal if the same object if(instance == other) return true; @@ -93,29 +93,31 @@ bool simple_array_is_equal(const SimpleArray* instance, const SimpleArray* other } uint32_t simple_array_get_count(const SimpleArray* instance) { - furi_assert(instance); + furi_check(instance); return instance->count; } SimpleArrayElement* simple_array_get(SimpleArray* instance, uint32_t index) { - furi_assert(instance); - furi_assert(index < instance->count); + furi_check(instance); + furi_check(index < instance->count); return instance->data + index * instance->config->type_size; } const SimpleArrayElement* simple_array_cget(const SimpleArray* instance, uint32_t index) { + furi_check(instance); return simple_array_get((SimpleArrayElement*)instance, index); } SimpleArrayData* simple_array_get_data(SimpleArray* instance) { - furi_assert(instance); - furi_assert(instance->data); + furi_check(instance); + furi_check(instance->data); return instance->data; } const SimpleArrayData* simple_array_cget_data(const SimpleArray* instance) { + furi_check(instance); return simple_array_get_data((SimpleArray*)instance); } diff --git a/lib/toolbox/stream/buffered_file_stream.c b/lib/toolbox/stream/buffered_file_stream.c index 3b485e80df9..819e499c155 100644 --- a/lib/toolbox/stream/buffered_file_stream.c +++ b/lib/toolbox/stream/buffered_file_stream.c @@ -58,14 +58,14 @@ bool buffered_file_stream_open( const char* path, FS_AccessMode access_mode, FS_OpenMode open_mode) { - furi_assert(_stream); + furi_check(_stream); BufferedFileStream* stream = (BufferedFileStream*)_stream; furi_check(stream->stream_base.vtable == &buffered_file_stream_vtable); return file_stream_open(stream->file_stream, path, access_mode, open_mode); } bool buffered_file_stream_close(Stream* _stream) { - furi_assert(_stream); + furi_check(_stream); BufferedFileStream* stream = (BufferedFileStream*)_stream; furi_check(stream->stream_base.vtable == &buffered_file_stream_vtable); bool success = false; @@ -80,21 +80,21 @@ bool buffered_file_stream_close(Stream* _stream) { } bool buffered_file_stream_sync(Stream* _stream) { - furi_assert(_stream); + furi_check(_stream); BufferedFileStream* stream = (BufferedFileStream*)_stream; furi_check(stream->stream_base.vtable == &buffered_file_stream_vtable); return stream->sync_pending ? buffered_file_stream_flush(stream) : true; } FS_Error buffered_file_stream_get_error(Stream* _stream) { - furi_assert(_stream); + furi_check(_stream); BufferedFileStream* stream = (BufferedFileStream*)_stream; furi_check(stream->stream_base.vtable == &buffered_file_stream_vtable); return file_stream_get_error(stream->file_stream); } static void buffered_file_stream_free(BufferedFileStream* stream) { - furi_assert(stream); + furi_check(stream); buffered_file_stream_sync((Stream*)stream); stream_free(stream->file_stream); stream_cache_free(stream->cache); diff --git a/lib/toolbox/stream/file_stream.c b/lib/toolbox/stream/file_stream.c index 2b5348b3e85..80cbb7d5f77 100644 --- a/lib/toolbox/stream/file_stream.c +++ b/lib/toolbox/stream/file_stream.c @@ -35,6 +35,8 @@ const StreamVTable file_stream_vtable = { }; Stream* file_stream_alloc(Storage* storage) { + furi_check(storage); + FileStream* stream = malloc(sizeof(FileStream)); stream->file = storage_file_alloc(storage); stream->storage = storage; @@ -48,21 +50,21 @@ bool file_stream_open( const char* path, FS_AccessMode access_mode, FS_OpenMode open_mode) { - furi_assert(_stream); + furi_check(_stream); FileStream* stream = (FileStream*)_stream; furi_check(stream->stream_base.vtable == &file_stream_vtable); return storage_file_open(stream->file, path, access_mode, open_mode); } bool file_stream_close(Stream* _stream) { - furi_assert(_stream); + furi_check(_stream); FileStream* stream = (FileStream*)_stream; furi_check(stream->stream_base.vtable == &file_stream_vtable); return storage_file_close(stream->file); } FS_Error file_stream_get_error(Stream* _stream) { - furi_assert(_stream); + furi_check(_stream); FileStream* stream = (FileStream*)_stream; furi_check(stream->stream_base.vtable == &file_stream_vtable); return storage_file_get_error(stream->file); diff --git a/lib/toolbox/stream/stream.c b/lib/toolbox/stream/stream.c index 407da0f2c19..9aff8bd4fb6 100644 --- a/lib/toolbox/stream/stream.c +++ b/lib/toolbox/stream/stream.c @@ -7,22 +7,22 @@ #define STREAM_BUFFER_SIZE (32U) void stream_free(Stream* stream) { - furi_assert(stream); + furi_check(stream); stream->vtable->free(stream); } void stream_clean(Stream* stream) { - furi_assert(stream); + furi_check(stream); stream->vtable->clean(stream); } bool stream_eof(Stream* stream) { - furi_assert(stream); + furi_check(stream); return stream->vtable->eof(stream); } bool stream_seek(Stream* stream, int32_t offset, StreamOffset offset_type) { - furi_assert(stream); + furi_check(stream); return stream->vtable->seek(stream, offset, offset_type); } @@ -85,6 +85,8 @@ static bool stream_seek_to_char_backward(Stream* stream, char c) { } bool stream_seek_to_char(Stream* stream, char c, StreamDirection direction) { + furi_check(stream); + const size_t old_position = stream_tell(stream); bool result = false; @@ -103,22 +105,22 @@ bool stream_seek_to_char(Stream* stream, char c, StreamDirection direction) { } size_t stream_tell(Stream* stream) { - furi_assert(stream); + furi_check(stream); return stream->vtable->tell(stream); } size_t stream_size(Stream* stream) { - furi_assert(stream); + furi_check(stream); return stream->vtable->size(stream); } size_t stream_write(Stream* stream, const uint8_t* data, size_t size) { - furi_assert(stream); + furi_check(stream); return stream->vtable->write(stream, data, size); } size_t stream_read(Stream* stream, uint8_t* data, size_t size) { - furi_assert(stream); + furi_check(stream); return stream->vtable->read(stream, data, size); } @@ -127,7 +129,7 @@ bool stream_delete_and_insert( size_t delete_size, StreamWriteCB write_callback, const void* ctx) { - furi_assert(stream); + furi_check(stream); return stream->vtable->delete_and_insert(stream, delete_size, write_callback, ctx); } @@ -139,13 +141,16 @@ typedef struct { } StreamWriteData; static bool stream_write_struct(Stream* stream, const void* context) { - furi_assert(stream); - furi_assert(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); } bool stream_read_line(Stream* stream, FuriString* str_result) { + furi_check(stream); + furi_check(str_result); + furi_string_reset(str_result); uint8_t buffer[STREAM_BUFFER_SIZE]; @@ -180,28 +185,28 @@ bool stream_read_line(Stream* stream, FuriString* str_result) { } bool stream_rewind(Stream* stream) { - furi_assert(stream); + furi_check(stream); return stream_seek(stream, 0, StreamOffsetFromStart); } size_t stream_write_char(Stream* stream, char c) { - furi_assert(stream); + furi_check(stream); return stream_write(stream, (const uint8_t*)&c, 1); } size_t stream_write_string(Stream* stream, FuriString* string) { - furi_assert(stream); + furi_check(stream); return stream_write( stream, (const uint8_t*)furi_string_get_cstr(string), furi_string_size(string)); } size_t stream_write_cstring(Stream* stream, const char* string) { - furi_assert(stream); + furi_check(stream); return stream_write(stream, (const uint8_t*)string, strlen(string)); } size_t stream_write_format(Stream* stream, const char* format, ...) { - furi_assert(stream); + furi_check(stream); size_t size; va_list args; va_start(args, format); @@ -211,7 +216,7 @@ size_t stream_write_format(Stream* stream, const char* format, ...) { } size_t stream_write_vaformat(Stream* stream, const char* format, va_list args) { - furi_assert(stream); + furi_check(stream); FuriString* data; data = furi_string_alloc_vprintf(format, args); size_t size = stream_write_string(stream, data); @@ -221,28 +226,28 @@ size_t stream_write_vaformat(Stream* stream, const char* format, va_list args) { } bool stream_insert(Stream* stream, const uint8_t* data, size_t size) { - furi_assert(stream); + furi_check(stream); StreamWriteData write_data = {.data = data, .size = size}; return stream_delete_and_insert(stream, 0, stream_write_struct, &write_data); } bool stream_insert_char(Stream* stream, char c) { - furi_assert(stream); + furi_check(stream); return stream_delete_and_insert_char(stream, 0, c); } bool stream_insert_string(Stream* stream, FuriString* string) { - furi_assert(stream); + furi_check(stream); return stream_delete_and_insert_string(stream, 0, string); } bool stream_insert_cstring(Stream* stream, const char* string) { - furi_assert(stream); + furi_check(stream); return stream_delete_and_insert_cstring(stream, 0, string); } bool stream_insert_format(Stream* stream, const char* format, ...) { - furi_assert(stream); + furi_check(stream); va_list args; va_start(args, format); bool result = stream_insert_vaformat(stream, format, args); @@ -252,31 +257,31 @@ bool stream_insert_format(Stream* stream, const char* format, ...) { } bool stream_insert_vaformat(Stream* stream, const char* format, va_list args) { - furi_assert(stream); + furi_check(stream); return stream_delete_and_insert_vaformat(stream, 0, format, args); } bool stream_delete_and_insert_char(Stream* stream, size_t delete_size, char c) { - furi_assert(stream); + furi_check(stream); StreamWriteData write_data = {.data = (uint8_t*)&c, .size = 1}; return stream_delete_and_insert(stream, delete_size, stream_write_struct, &write_data); } bool stream_delete_and_insert_string(Stream* stream, size_t delete_size, FuriString* string) { - furi_assert(stream); + furi_check(stream); StreamWriteData write_data = { .data = (uint8_t*)furi_string_get_cstr(string), .size = furi_string_size(string)}; return stream_delete_and_insert(stream, delete_size, stream_write_struct, &write_data); } bool stream_delete_and_insert_cstring(Stream* stream, size_t delete_size, const char* string) { - furi_assert(stream); + furi_check(stream); StreamWriteData write_data = {.data = (uint8_t*)string, .size = strlen(string)}; return stream_delete_and_insert(stream, delete_size, stream_write_struct, &write_data); } bool stream_delete_and_insert_format(Stream* stream, size_t delete_size, const char* format, ...) { - furi_assert(stream); + furi_check(stream); va_list args; va_start(args, format); bool result = stream_delete_and_insert_vaformat(stream, delete_size, format, args); @@ -290,9 +295,9 @@ bool stream_delete_and_insert_vaformat( size_t delete_size, const char* format, va_list args) { - furi_assert(stream); - FuriString* data; - data = furi_string_alloc_vprintf(format, args); + furi_check(stream); + + FuriString* data = furi_string_alloc_vprintf(format, args); StreamWriteData write_data = { .data = (uint8_t*)furi_string_get_cstr(data), .size = furi_string_size(data)}; bool result = stream_delete_and_insert(stream, delete_size, stream_write_struct, &write_data); @@ -302,11 +307,14 @@ bool stream_delete_and_insert_vaformat( } bool stream_delete(Stream* stream, size_t size) { - furi_assert(stream); + furi_check(stream); return stream_delete_and_insert(stream, size, NULL, NULL); } size_t stream_copy(Stream* stream_from, Stream* stream_to, size_t size) { + furi_check(stream_from); + furi_check(stream_to); + uint8_t* buffer = malloc(STREAM_CACHE_SIZE); size_t copied = 0; @@ -330,6 +338,9 @@ size_t stream_copy(Stream* stream_from, Stream* stream_to, size_t size) { } size_t stream_copy_full(Stream* stream_from, Stream* stream_to) { + furi_check(stream_from); + furi_check(stream_to); + size_t was_written = 0; do { @@ -342,6 +353,8 @@ size_t stream_copy_full(Stream* stream_from, Stream* stream_to) { } bool stream_split(Stream* stream, Stream* stream_left, Stream* stream_right) { + furi_check(stream); + bool result = false; size_t size = stream_size(stream); size_t tell = stream_tell(stream); @@ -363,6 +376,9 @@ bool stream_split(Stream* stream, Stream* stream_left, Stream* stream_right) { } size_t stream_load_from_file(Stream* stream, Storage* storage, const char* path) { + furi_check(stream); + furi_check(storage); + size_t was_written = 0; Stream* file = file_stream_alloc(storage); @@ -376,6 +392,9 @@ size_t stream_load_from_file(Stream* stream, Storage* storage, const char* path) } size_t stream_save_to_file(Stream* stream, Storage* storage, const char* path, FS_OpenMode mode) { + furi_check(stream); + furi_check(storage); + size_t was_written = 0; Stream* file = file_stream_alloc(storage); @@ -389,6 +408,8 @@ size_t stream_save_to_file(Stream* stream, Storage* storage, const char* path, F } void stream_dump_data(Stream* stream) { + furi_check(stream); + size_t size = stream_size(stream); size_t tell = stream_tell(stream); printf("stream %p\r\n", stream); diff --git a/lib/toolbox/stream/stream_cache.c b/lib/toolbox/stream/stream_cache.c index f5e147dfe3b..d38a2f7b728 100644 --- a/lib/toolbox/stream/stream_cache.c +++ b/lib/toolbox/stream/stream_cache.c @@ -8,7 +8,7 @@ struct StreamCache { size_t position; }; -StreamCache* stream_cache_alloc() { +StreamCache* stream_cache_alloc(void) { StreamCache* cache = malloc(sizeof(StreamCache)); cache->data_size = 0; cache->position = 0; diff --git a/lib/toolbox/stream/stream_cache.h b/lib/toolbox/stream/stream_cache.h index f61e5e8f2fa..b00538ae36e 100644 --- a/lib/toolbox/stream/stream_cache.h +++ b/lib/toolbox/stream/stream_cache.h @@ -12,7 +12,7 @@ typedef struct StreamCache StreamCache; * Allocate stream cache. * @return StreamCache* pointer to a StreamCache instance */ -StreamCache* stream_cache_alloc(); +StreamCache* stream_cache_alloc(void); /** * Free stream cache. diff --git a/lib/toolbox/stream/string_stream.c b/lib/toolbox/stream/string_stream.c index f8a360c03ea..742547fb780 100644 --- a/lib/toolbox/stream/string_stream.c +++ b/lib/toolbox/stream/string_stream.c @@ -37,7 +37,7 @@ const StreamVTable string_stream_vtable = { .delete_and_insert = (StreamDeleteAndInsertFn)string_stream_delete_and_insert, }; -Stream* string_stream_alloc() { +Stream* string_stream_alloc(void) { StringStream* stream = malloc(sizeof(StringStream)); stream->string = furi_string_alloc(); stream->index = 0; diff --git a/lib/toolbox/stream/string_stream.h b/lib/toolbox/stream/string_stream.h index f882a246b3e..279f053f245 100644 --- a/lib/toolbox/stream/string_stream.h +++ b/lib/toolbox/stream/string_stream.h @@ -10,7 +10,7 @@ extern "C" { * Allocate string stream * @return Stream* */ -Stream* string_stream_alloc(); +Stream* string_stream_alloc(void); #ifdef __cplusplus } diff --git a/lib/toolbox/tar/tar_archive.c b/lib/toolbox/tar/tar_archive.c index fcfc22a7035..639f2eaec7a 100644 --- a/lib/toolbox/tar/tar_archive.c +++ b/lib/toolbox/tar/tar_archive.c @@ -59,7 +59,7 @@ TarArchive* tar_archive_alloc(Storage* storage) { } bool tar_archive_open(TarArchive* archive, const char* path, TarOpenMode mode) { - furi_assert(archive); + furi_check(archive); FS_AccessMode access_mode; FS_OpenMode open_mode; int mtar_access = 0; @@ -90,7 +90,7 @@ bool tar_archive_open(TarArchive* archive, const char* path, TarOpenMode mode) { } void tar_archive_free(TarArchive* archive) { - furi_assert(archive); + furi_check(archive); if(mtar_is_open(&archive->tar)) { mtar_close(&archive->tar); } @@ -98,7 +98,7 @@ void tar_archive_free(TarArchive* archive) { } void tar_archive_set_file_callback(TarArchive* archive, tar_unpack_file_cb callback, void* context) { - furi_assert(archive); + furi_check(archive); archive->unpack_cb = callback; archive->unpack_cb_context = context; } @@ -113,6 +113,7 @@ static int tar_archive_entry_counter(mtar_t* tar, const mtar_header_t* header, v } int32_t tar_archive_get_entries_count(TarArchive* archive) { + furi_check(archive); int32_t counter = 0; if(mtar_foreach(&archive->tar, tar_archive_entry_counter, &counter) != MTAR_ESUCCESS) { counter = -1; @@ -121,12 +122,12 @@ int32_t tar_archive_get_entries_count(TarArchive* archive) { } bool tar_archive_dir_add_element(TarArchive* archive, const char* dirpath) { - furi_assert(archive); + furi_check(archive); return (mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS); } bool tar_archive_finalize(TarArchive* archive) { - furi_assert(archive); + furi_check(archive); return (mtar_finalize(&archive->tar) == MTAR_ESUCCESS); } @@ -135,7 +136,7 @@ bool tar_archive_store_data( const char* path, const uint8_t* data, const int32_t data_len) { - furi_assert(archive); + furi_check(archive); return ( tar_archive_file_add_header(archive, path, data_len) && @@ -144,7 +145,7 @@ bool tar_archive_store_data( } bool tar_archive_file_add_header(TarArchive* archive, const char* path, const int32_t data_len) { - furi_assert(archive); + furi_check(archive); return (mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS); } @@ -153,13 +154,13 @@ bool tar_archive_file_add_data_block( TarArchive* archive, const uint8_t* data_block, const int32_t block_len) { - furi_assert(archive); + furi_check(archive); return (mtar_write_data(&archive->tar, data_block, block_len) == block_len); } bool tar_archive_file_finalize(TarArchive* archive) { - furi_assert(archive); + furi_check(archive); return (mtar_end_data(&archive->tar) == MTAR_ESUCCESS); } @@ -259,7 +260,7 @@ bool tar_archive_unpack_to( TarArchive* archive, const char* destination, Storage_name_converter converter) { - furi_assert(archive); + furi_check(archive); TarArchiveDirectoryOpParams param = { .archive = archive, .work_dir = destination, @@ -276,7 +277,7 @@ bool tar_archive_add_file( const char* fs_file_path, const char* archive_fname, const int32_t file_size) { - furi_assert(archive); + furi_check(archive); uint8_t* file_buffer = malloc(FILE_BLOCK_SIZE); bool success = false; File* src_file = storage_file_alloc(archive->storage); @@ -314,8 +315,9 @@ bool tar_archive_add_file( } bool tar_archive_add_dir(TarArchive* archive, const char* fs_full_path, const char* path_prefix) { - furi_assert(archive); + furi_check(archive); furi_check(path_prefix); + File* directory = storage_file_alloc(archive->storage); FileInfo file_info; @@ -376,9 +378,9 @@ bool tar_archive_unpack_file( TarArchive* archive, const char* archive_fname, const char* destination) { - furi_assert(archive); - furi_assert(archive_fname); - furi_assert(destination); + furi_check(archive); + furi_check(archive_fname); + furi_check(destination); if(mtar_find(&archive->tar, archive_fname) != MTAR_ESUCCESS) { return false; } diff --git a/lib/update_util/update_manifest.c b/lib/update_util/update_manifest.c index 42ab073b04c..eef27cb4291 100644 --- a/lib/update_util/update_manifest.c +++ b/lib/update_util/update_manifest.c @@ -19,7 +19,7 @@ #define MANIFEST_KEY_OB_WRITE_MASK "OB write mask" #define MANIFEST_KEY_SPLASH_FILE "Splashscreen" -UpdateManifest* update_manifest_alloc() { +UpdateManifest* update_manifest_alloc(void) { UpdateManifest* update_manifest = malloc(sizeof(UpdateManifest)); update_manifest->version = furi_string_alloc(); update_manifest->firmware_dfu_image = furi_string_alloc(); diff --git a/lib/update_util/update_manifest.h b/lib/update_util/update_manifest.h index c26e4f87bc1..0c6284516cf 100644 --- a/lib/update_util/update_manifest.h +++ b/lib/update_util/update_manifest.h @@ -45,7 +45,7 @@ typedef struct { bool valid; } UpdateManifest; -UpdateManifest* update_manifest_alloc(); +UpdateManifest* update_manifest_alloc(void); void update_manifest_free(UpdateManifest* update_manifest); diff --git a/lib/update_util/update_operation.c b/lib/update_util/update_operation.c index 39a7ea07526..cb603abe042 100644 --- a/lib/update_util/update_operation.c +++ b/lib/update_util/update_operation.c @@ -218,7 +218,7 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) { return result; } -bool update_operation_is_armed() { +bool update_operation_is_armed(void) { FuriHalRtcBootMode boot_mode = furi_hal_rtc_get_boot_mode(); const uint32_t rtc_upd_index = furi_hal_rtc_get_register(FuriHalRtcRegisterUpdateFolderFSIndex); @@ -231,7 +231,7 @@ bool update_operation_is_armed() { ((rtc_upd_index != INT_MAX) || upd_fn_ptr_exists); } -void update_operation_disarm() { +void update_operation_disarm(void) { furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeNormal); furi_hal_rtc_set_register(FuriHalRtcRegisterUpdateFolderFSIndex, INT_MAX); Storage* storage = furi_record_open(RECORD_STORAGE); diff --git a/lib/update_util/update_operation.h b/lib/update_util/update_operation.h index 8e36b5a1370..063f577e247 100644 --- a/lib/update_util/update_operation.h +++ b/lib/update_util/update_operation.h @@ -56,12 +56,12 @@ bool update_operation_get_current_package_manifest_path(Storage* storage, FuriSt /* * Checks if an update operation step is pending after reset */ -bool update_operation_is_armed(); +bool update_operation_is_armed(void); /* * Cancels pending update operation */ -void update_operation_disarm(); +void update_operation_disarm(void); #ifdef __cplusplus } diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index bdfa8c7a4ee..cc7d414a8f8 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,58.0,, +Version,+,59.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -756,7 +756,7 @@ Function,+,cli_cmd_interrupt_received,_Bool,Cli* Function,+,cli_delete_command,void,"Cli*, const char*" Function,+,cli_getc,char,Cli* Function,+,cli_is_connected,_Bool,Cli* -Function,+,cli_nl,void, +Function,+,cli_nl,void,Cli* Function,+,cli_print_usage,void,"const char*, const char*, const char*" Function,+,cli_read,size_t,"Cli*, uint8_t*, size_t" Function,+,cli_read_timeout,size_t,"Cli*, uint8_t*, size_t, uint32_t" diff --git a/targets/f18/furi_hal/furi_hal.c b/targets/f18/furi_hal/furi_hal.c index 957d9d6733c..6e0a254c138 100644 --- a/targets/f18/furi_hal/furi_hal.c +++ b/targets/f18/furi_hal/furi_hal.c @@ -6,7 +6,7 @@ #define TAG "FuriHal" -void furi_hal_init_early() { +void furi_hal_init_early(void) { furi_hal_cortex_init_early(); furi_hal_clock_init_early(); furi_hal_bus_init_early(); @@ -19,7 +19,7 @@ void furi_hal_init_early() { furi_hal_rtc_init_early(); } -void furi_hal_deinit_early() { +void furi_hal_deinit_early(void) { furi_hal_rtc_deinit_early(); furi_hal_i2c_deinit_early(); furi_hal_spi_config_deinit_early(); @@ -29,7 +29,7 @@ void furi_hal_deinit_early() { furi_hal_clock_deinit_early(); } -void furi_hal_init() { +void furi_hal_init(void) { furi_hal_mpu_init(); furi_hal_clock_init(); furi_hal_random_init(); diff --git a/targets/f18/furi_hal/furi_hal_resources.c b/targets/f18/furi_hal/furi_hal_resources.c index 11893587485..9935d4124cf 100644 --- a/targets/f18/furi_hal/furi_hal_resources.c +++ b/targets/f18/furi_hal/furi_hal_resources.c @@ -144,7 +144,7 @@ static void furi_hal_resources_init_gpio_pins(GpioMode mode) { } } -void furi_hal_resources_init_early() { +void furi_hal_resources_init_early(void) { furi_hal_bus_enable(FuriHalBusGPIOA); furi_hal_bus_enable(FuriHalBusGPIOB); furi_hal_bus_enable(FuriHalBusGPIOC); @@ -190,7 +190,7 @@ void furi_hal_resources_init_early() { furi_hal_resources_init_gpio_pins(GpioModeAnalog); } -void furi_hal_resources_deinit_early() { +void furi_hal_resources_deinit_early(void) { furi_hal_resources_init_input_pins(GpioModeAnalog); furi_hal_bus_disable(FuriHalBusGPIOA); furi_hal_bus_disable(FuriHalBusGPIOB); @@ -200,7 +200,7 @@ void furi_hal_resources_deinit_early() { furi_hal_bus_disable(FuriHalBusGPIOH); } -void furi_hal_resources_init() { +void furi_hal_resources_init(void) { // Button pins furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall); diff --git a/targets/f18/furi_hal/furi_hal_resources.h b/targets/f18/furi_hal/furi_hal_resources.h index fed7802a585..3d45ad885e2 100644 --- a/targets/f18/furi_hal/furi_hal_resources.h +++ b/targets/f18/furi_hal/furi_hal_resources.h @@ -109,11 +109,11 @@ extern const GpioPin gpio_periph_power; extern const GpioPin gpio_usb_dm; extern const GpioPin gpio_usb_dp; -void furi_hal_resources_init_early(); +void furi_hal_resources_init_early(void); -void furi_hal_resources_deinit_early(); +void furi_hal_resources_deinit_early(void); -void furi_hal_resources_init(); +void furi_hal_resources_init(void); /** * Get a corresponding external connector pin number for a gpio diff --git a/targets/f18/furi_hal/furi_hal_spi_config.c b/targets/f18/furi_hal/furi_hal_spi_config.c index 5ac84906f82..8957bfe3a2c 100644 --- a/targets/f18/furi_hal/furi_hal_spi_config.c +++ b/targets/f18/furi_hal/furi_hal_spi_config.c @@ -77,17 +77,17 @@ const LL_SPI_InitTypeDef furi_hal_spi_preset_1edge_low_2m = { FuriMutex* furi_hal_spi_bus_r_mutex = NULL; -void furi_hal_spi_config_init_early() { +void furi_hal_spi_config_init_early(void) { furi_hal_spi_bus_init(&furi_hal_spi_bus_d); furi_hal_spi_bus_handle_init(&furi_hal_spi_bus_handle_display); } -void furi_hal_spi_config_deinit_early() { +void furi_hal_spi_config_deinit_early(void) { furi_hal_spi_bus_handle_deinit(&furi_hal_spi_bus_handle_display); furi_hal_spi_bus_deinit(&furi_hal_spi_bus_d); } -void furi_hal_spi_config_init() { +void furi_hal_spi_config_init(void) { furi_hal_spi_bus_handle_init(&furi_hal_spi_bus_handle_sd_fast); furi_hal_spi_bus_handle_init(&furi_hal_spi_bus_handle_sd_slow); diff --git a/targets/f18/furi_hal/furi_hal_version_device.c b/targets/f18/furi_hal/furi_hal_version_device.c index 198ceb3f19f..8b85260314e 100644 --- a/targets/f18/furi_hal/furi_hal_version_device.c +++ b/targets/f18/furi_hal/furi_hal_version_device.c @@ -1,33 +1,33 @@ #include -bool furi_hal_version_do_i_belong_here() { +bool furi_hal_version_do_i_belong_here(void) { return (furi_hal_version_get_hw_target() == 18) || (furi_hal_version_get_hw_target() == 0); } -const char* furi_hal_version_get_model_name() { +const char* furi_hal_version_get_model_name(void) { return "Flipper Nano"; } -const char* furi_hal_version_get_model_code() { +const char* furi_hal_version_get_model_code(void) { return "FN.1"; } -const char* furi_hal_version_get_fcc_id() { +const char* furi_hal_version_get_fcc_id(void) { return "Pending"; } -const char* furi_hal_version_get_ic_id() { +const char* furi_hal_version_get_ic_id(void) { return "Pending"; } -const char* furi_hal_version_get_mic_id() { +const char* furi_hal_version_get_mic_id(void) { return "Pending"; } -const char* furi_hal_version_get_srrc_id() { +const char* furi_hal_version_get_srrc_id(void) { return "Pending"; } -const char* furi_hal_version_get_ncc_id() { +const char* furi_hal_version_get_ncc_id(void) { return "Pending"; } \ No newline at end of file diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index d856dc6948a..878d22e2671 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,58.0,, +Version,+,59.0,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, @@ -824,7 +824,7 @@ Function,+,cli_cmd_interrupt_received,_Bool,Cli* Function,+,cli_delete_command,void,"Cli*, const char*" Function,+,cli_getc,char,Cli* Function,+,cli_is_connected,_Bool,Cli* -Function,+,cli_nl,void, +Function,+,cli_nl,void,Cli* Function,+,cli_print_usage,void,"const char*, const char*, const char*" Function,+,cli_read,size_t,"Cli*, uint8_t*, size_t" Function,+,cli_read_timeout,size_t,"Cli*, uint8_t*, size_t, uint32_t" diff --git a/targets/f7/ble_glue/app_debug.c b/targets/f7/ble_glue/app_debug.c index fe76687b9aa..eab17e5b79c 100644 --- a/targets/f7/ble_glue/app_debug.c +++ b/targets/f7/ble_glue/app_debug.c @@ -110,7 +110,7 @@ static const APPD_GpioConfig_t aRfConfigList[GPIO_NBR_OF_RF_SIGNALS] = { static void APPD_SetCPU2GpioConfig(void); static void APPD_BleDtbCfg(void); -void APPD_Init() { +void APPD_Init(void) { APPD_SetCPU2GpioConfig(); APPD_BleDtbCfg(); } diff --git a/targets/f7/ble_glue/ble_glue.c b/targets/f7/ble_glue/ble_glue.c index 91cb020d72e..b2e42b8daa0 100644 --- a/targets/f7/ble_glue/ble_glue.c +++ b/targets/f7/ble_glue/ble_glue.c @@ -54,8 +54,8 @@ static void ble_glue_clear_shared_memory(); void ble_glue_set_key_storage_changed_callback( BleGlueKeyStorageChangedCallback callback, void* context) { - furi_assert(ble_glue); - furi_assert(callback); + furi_check(ble_glue); + furi_check(callback); ble_glue->callback = callback; ble_glue->context = context; } diff --git a/targets/f7/ble_glue/ble_glue.h b/targets/f7/ble_glue/ble_glue.h index 05c34148cf9..94821cc889b 100644 --- a/targets/f7/ble_glue/ble_glue.h +++ b/targets/f7/ble_glue/ble_glue.h @@ -100,7 +100,7 @@ void ble_glue_set_key_storage_changed_callback( BleGlueKeyStorageChangedCallback callback, void* context); -bool ble_glue_reinit_c2(); +bool ble_glue_reinit_c2(void); typedef enum { BleGlueCommandResultUnknown, diff --git a/targets/f7/ble_glue/extra_beacon.c b/targets/f7/ble_glue/extra_beacon.c index 446b31380fb..2ef3e056fb7 100644 --- a/targets/f7/ble_glue/extra_beacon.c +++ b/targets/f7/ble_glue/extra_beacon.c @@ -21,7 +21,7 @@ typedef struct { static ExtraBeacon extra_beacon = {0}; -void gap_extra_beacon_init() { +void gap_extra_beacon_init(void) { if(extra_beacon.state_mutex) { // Already initialized - restore state if needed FURI_LOG_I(TAG, "Restoring state"); @@ -62,7 +62,7 @@ bool gap_extra_beacon_set_config(const GapExtraBeaconConfig* config) { return true; } -bool gap_extra_beacon_start() { +bool gap_extra_beacon_start(void) { furi_check(extra_beacon.state_mutex); furi_check(extra_beacon.last_config.min_adv_interval_ms >= GAP_MIN_ADV_INTERVAL_MS); @@ -91,7 +91,7 @@ bool gap_extra_beacon_start() { return true; } -bool gap_extra_beacon_stop() { +bool gap_extra_beacon_stop(void) { furi_check(extra_beacon.state_mutex); if(extra_beacon.extra_beacon_state != GapExtraBeaconStateStarted) { @@ -144,13 +144,13 @@ uint8_t gap_extra_beacon_get_data(uint8_t* data) { return extra_beacon.extra_beacon_data_len; } -GapExtraBeaconState gap_extra_beacon_get_state() { +GapExtraBeaconState gap_extra_beacon_get_state(void) { furi_check(extra_beacon.state_mutex); return extra_beacon.extra_beacon_state; } -const GapExtraBeaconConfig* gap_extra_beacon_get_config() { +const GapExtraBeaconConfig* gap_extra_beacon_get_config(void) { furi_check(extra_beacon.state_mutex); if(extra_beacon.last_config.min_adv_interval_ms < GAP_MIN_ADV_INTERVAL_MS) { diff --git a/targets/f7/ble_glue/extra_beacon.h b/targets/f7/ble_glue/extra_beacon.h index 675ea538c93..d011bbeb858 100644 --- a/targets/f7/ble_glue/extra_beacon.h +++ b/targets/f7/ble_glue/extra_beacon.h @@ -76,17 +76,17 @@ typedef enum { GapExtraBeaconStateStarted, } GapExtraBeaconState; -void gap_extra_beacon_init(); +void gap_extra_beacon_init(void); -GapExtraBeaconState gap_extra_beacon_get_state(); +GapExtraBeaconState gap_extra_beacon_get_state(void); -bool gap_extra_beacon_start(); +bool gap_extra_beacon_start(void); -bool gap_extra_beacon_stop(); +bool gap_extra_beacon_stop(void); bool gap_extra_beacon_set_config(const GapExtraBeaconConfig* config); -const GapExtraBeaconConfig* gap_extra_beacon_get_config(); +const GapExtraBeaconConfig* gap_extra_beacon_get_config(void); bool gap_extra_beacon_set_data(const uint8_t* data, uint8_t length); diff --git a/targets/f7/ble_glue/furi_ble/gatt.c b/targets/f7/ble_glue/furi_ble/gatt.c index dcea5f98730..4603f4be090 100644 --- a/targets/f7/ble_glue/furi_ble/gatt.c +++ b/targets/f7/ble_glue/furi_ble/gatt.c @@ -11,8 +11,8 @@ void ble_gatt_characteristic_init( uint16_t svc_handle, const BleGattCharacteristicParams* char_descriptor, BleGattCharacteristicInstance* char_instance) { - furi_assert(char_descriptor); - furi_assert(char_instance); + furi_check(char_descriptor); + furi_check(char_instance); // Copy the descriptor to the instance, since it may point to stack memory char_instance->characteristic = malloc(sizeof(BleGattCharacteristicParams)); diff --git a/targets/f7/ble_glue/hw_ipcc.c b/targets/f7/ble_glue/hw_ipcc.c index c2397f35109..6a3aace5a00 100644 --- a/targets/f7/ble_glue/hw_ipcc.c +++ b/targets/f7/ble_glue/hw_ipcc.c @@ -24,7 +24,7 @@ static void HW_IPCC_SYS_CmdEvtHandler(); static void HW_IPCC_SYS_EvtHandler(); static void HW_IPCC_TRACES_EvtHandler(); -void HW_IPCC_Rx_Handler() { +void HW_IPCC_Rx_Handler(void) { if(HW_IPCC_RX_PENDING(HW_IPCC_SYSTEM_EVENT_CHANNEL)) { HW_IPCC_SYS_EvtHandler(); } else if(HW_IPCC_RX_PENDING(HW_IPCC_BLE_EVENT_CHANNEL)) { @@ -34,7 +34,7 @@ void HW_IPCC_Rx_Handler() { } } -void HW_IPCC_Tx_Handler() { +void HW_IPCC_Tx_Handler(void) { if(HW_IPCC_TX_PENDING(HW_IPCC_SYSTEM_CMD_RSP_CHANNEL)) { HW_IPCC_SYS_CmdEvtHandler(); } else if(HW_IPCC_TX_PENDING(HW_IPCC_SYSTEM_CMD_RSP_CHANNEL)) { @@ -46,7 +46,7 @@ void HW_IPCC_Tx_Handler() { } } -void HW_IPCC_Enable() { +void HW_IPCC_Enable(void) { /** * Such as IPCC IP available to the CPU2, it is required to keep the IPCC clock running when FUS is running on CPU2 and CPU1 enters deep sleep mode @@ -71,7 +71,7 @@ void HW_IPCC_Enable() { LL_PWR_EnableBootC2(); } -void HW_IPCC_Init() { +void HW_IPCC_Init(void) { LL_C1_IPCC_EnableIT_RXO(IPCC); LL_C1_IPCC_EnableIT_TXF(IPCC); @@ -81,36 +81,36 @@ void HW_IPCC_Init() { NVIC_EnableIRQ(IPCC_C1_TX_IRQn); } -void HW_IPCC_BLE_Init() { +void HW_IPCC_BLE_Init(void) { LL_C1_IPCC_EnableReceiveChannel(IPCC, HW_IPCC_BLE_EVENT_CHANNEL); } -void HW_IPCC_BLE_SendCmd() { +void HW_IPCC_BLE_SendCmd(void) { LL_C1_IPCC_SetFlag_CHx(IPCC, HW_IPCC_BLE_CMD_CHANNEL); } -static void HW_IPCC_BLE_EvtHandler() { +static void HW_IPCC_BLE_EvtHandler(void) { HW_IPCC_BLE_RxEvtNot(); LL_C1_IPCC_ClearFlag_CHx(IPCC, HW_IPCC_BLE_EVENT_CHANNEL); } -void HW_IPCC_BLE_SendAclData() { +void HW_IPCC_BLE_SendAclData(void) { LL_C1_IPCC_SetFlag_CHx(IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL); LL_C1_IPCC_EnableTransmitChannel(IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL); } -static void HW_IPCC_BLE_AclDataEvtHandler() { +static void HW_IPCC_BLE_AclDataEvtHandler(void) { LL_C1_IPCC_DisableTransmitChannel(IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL); HW_IPCC_BLE_AclDataAckNot(); } -void HW_IPCC_SYS_Init() { +void HW_IPCC_SYS_Init(void) { LL_C1_IPCC_EnableReceiveChannel(IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL); } -void HW_IPCC_SYS_SendCmd() { +void HW_IPCC_SYS_SendCmd(void) { LL_C1_IPCC_SetFlag_CHx(IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL); FuriHalCortexTimer timer = furi_hal_cortex_timer_get(33000000); @@ -122,13 +122,13 @@ void HW_IPCC_SYS_SendCmd() { HW_IPCC_SYS_CmdEvtHandler(); } -static void HW_IPCC_SYS_CmdEvtHandler() { +static void HW_IPCC_SYS_CmdEvtHandler(void) { LL_C1_IPCC_DisableTransmitChannel(IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL); HW_IPCC_SYS_CmdEvtNot(); } -static void HW_IPCC_SYS_EvtHandler() { +static void HW_IPCC_SYS_EvtHandler(void) { HW_IPCC_SYS_EvtNot(); LL_C1_IPCC_ClearFlag_CHx(IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL); @@ -145,7 +145,7 @@ void HW_IPCC_MM_SendFreeBuf(void (*cb)()) { } } -static void HW_IPCC_MM_FreeBufHandler() { +static void HW_IPCC_MM_FreeBufHandler(void) { LL_C1_IPCC_DisableTransmitChannel(IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL); FreeBufCb(); @@ -153,11 +153,11 @@ static void HW_IPCC_MM_FreeBufHandler() { LL_C1_IPCC_SetFlag_CHx(IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL); } -void HW_IPCC_TRACES_Init() { +void HW_IPCC_TRACES_Init(void) { LL_C1_IPCC_EnableReceiveChannel(IPCC, HW_IPCC_TRACES_CHANNEL); } -static void HW_IPCC_TRACES_EvtHandler() { +static void HW_IPCC_TRACES_EvtHandler(void) { HW_IPCC_TRACES_EvtNot(); LL_C1_IPCC_ClearFlag_CHx(IPCC, HW_IPCC_TRACES_CHANNEL); diff --git a/targets/f7/ble_glue/services/battery_service.c b/targets/f7/ble_glue/services/battery_service.c index f4bc1ff7bba..4250b356c9c 100644 --- a/targets/f7/ble_glue/services/battery_service.c +++ b/targets/f7/ble_glue/services/battery_service.c @@ -114,7 +114,7 @@ BleServiceBattery* ble_svc_battery_start(bool auto_update) { } void ble_svc_battery_stop(BleServiceBattery* battery_svc) { - furi_assert(battery_svc); + furi_check(battery_svc); if(battery_svc->auto_update) { BatterySvcInstanceList_it_t it; for(BatterySvcInstanceList_it(it, instances); !BatterySvcInstanceList_end_p(it); diff --git a/targets/f7/ble_glue/services/dev_info_service.c b/targets/f7/ble_glue/services/dev_info_service.c index 37caa8c90b4..ae2b976b649 100644 --- a/targets/f7/ble_glue/services/dev_info_service.c +++ b/targets/f7/ble_glue/services/dev_info_service.c @@ -137,7 +137,7 @@ BleServiceDevInfo* ble_svc_dev_info_start(void) { } void ble_svc_dev_info_stop(BleServiceDevInfo* dev_info_svc) { - furi_assert(dev_info_svc); + furi_check(dev_info_svc); /* Delete service characteristics */ for(size_t i = 0; i < DevInfoSvcGattCharacteristicCount; i++) { ble_gatt_characteristic_delete( diff --git a/targets/f7/ble_glue/services/serial_service.c b/targets/f7/ble_glue/services/serial_service.c index a8f10e6d7b7..6fe6a71300c 100644 --- a/targets/f7/ble_glue/services/serial_service.c +++ b/targets/f7/ble_glue/services/serial_service.c @@ -179,7 +179,7 @@ void ble_svc_serial_set_callbacks( uint16_t buff_size, SerialServiceEventCallback callback, void* context) { - furi_assert(serial_svc); + furi_check(serial_svc); serial_svc->callback = callback; serial_svc->context = context; serial_svc->buff_size = buff_size; @@ -193,8 +193,8 @@ void ble_svc_serial_set_callbacks( } void ble_svc_serial_notify_buffer_is_empty(BleServiceSerial* serial_svc) { - furi_assert(serial_svc); - furi_assert(serial_svc->buff_size_mtx); + furi_check(serial_svc); + furi_check(serial_svc->buff_size_mtx); furi_check(furi_mutex_acquire(serial_svc->buff_size_mtx, FuriWaitForever) == FuriStatusOk); if(serial_svc->bytes_ready_to_receive == 0) { @@ -253,7 +253,7 @@ bool ble_svc_serial_update_tx(BleServiceSerial* serial_svc, uint8_t* data, uint1 } void ble_svc_serial_set_rpc_active(BleServiceSerial* serial_svc, bool active) { - furi_assert(serial_svc); + furi_check(serial_svc); ble_svc_serial_update_rpc_char( serial_svc, active ? SerialServiceRpcStatusActive : SerialServiceRpcStatusNotActive); } diff --git a/targets/f7/fatfs/fatfs.c b/targets/f7/fatfs/fatfs.c index 0e17f75c16d..fa791f12252 100644 --- a/targets/f7/fatfs/fatfs.c +++ b/targets/f7/fatfs/fatfs.c @@ -14,7 +14,7 @@ void fatfs_init(void) { * * @return Time in DWORD (toasters per square washing machine) */ -DWORD get_fattime() { +DWORD get_fattime(void) { DateTime furi_time; furi_hal_rtc_get_datetime(&furi_time); diff --git a/targets/f7/fatfs/sector_cache.c b/targets/f7/fatfs/sector_cache.c index efb520ec842..319dd21732d 100644 --- a/targets/f7/fatfs/sector_cache.c +++ b/targets/f7/fatfs/sector_cache.c @@ -17,7 +17,7 @@ typedef struct { static SectorCache* cache = NULL; -void sector_cache_init() { +void sector_cache_init(void) { if(cache == NULL) { cache = memmgr_alloc_from_pool(sizeof(SectorCache)); } diff --git a/targets/f7/fatfs/sector_cache.h b/targets/f7/fatfs/sector_cache.h index 5fe4a2ed86b..6792408a3a9 100644 --- a/targets/f7/fatfs/sector_cache.h +++ b/targets/f7/fatfs/sector_cache.h @@ -8,7 +8,7 @@ extern "C" { /** * @brief Init sector cache system */ -void sector_cache_init(); +void sector_cache_init(void); /** * @brief Get sector data from cache diff --git a/targets/f7/furi_hal/furi_hal.c b/targets/f7/furi_hal/furi_hal.c index 88401429e63..1fe8b241b81 100644 --- a/targets/f7/furi_hal/furi_hal.c +++ b/targets/f7/furi_hal/furi_hal.c @@ -6,7 +6,7 @@ #define TAG "FuriHal" -void furi_hal_init_early() { +void furi_hal_init_early(void) { furi_hal_cortex_init_early(); furi_hal_clock_init_early(); furi_hal_bus_init_early(); @@ -19,7 +19,7 @@ void furi_hal_init_early() { furi_hal_rtc_init_early(); } -void furi_hal_deinit_early() { +void furi_hal_deinit_early(void) { furi_hal_rtc_deinit_early(); furi_hal_i2c_deinit_early(); furi_hal_spi_config_deinit_early(); @@ -29,7 +29,7 @@ void furi_hal_deinit_early() { furi_hal_clock_deinit_early(); } -void furi_hal_init() { +void furi_hal_init(void) { furi_hal_mpu_init(); furi_hal_clock_init(); furi_hal_random_init(); diff --git a/targets/f7/furi_hal/furi_hal_bt.c b/targets/f7/furi_hal/furi_hal_bt.c index c276b5cf4e7..3d4e417315d 100644 --- a/targets/f7/furi_hal/furi_hal_bt.c +++ b/targets/f7/furi_hal/furi_hal_bt.c @@ -37,7 +37,7 @@ static FuriHalBt furi_hal_bt = { .stack = FuriHalBtStackUnknown, }; -void furi_hal_bt_init() { +void furi_hal_bt_init(void) { FURI_LOG_I(TAG, "Start BT initialization"); furi_hal_bus_enable(FuriHalBusHSEM); furi_hal_bus_enable(FuriHalBusIPCC); @@ -47,7 +47,7 @@ void furi_hal_bt_init() { if(!furi_hal_bt.core2_mtx) { furi_hal_bt.core2_mtx = furi_mutex_alloc(FuriMutexTypeNormal); - furi_assert(furi_hal_bt.core2_mtx); + furi_check(furi_hal_bt.core2_mtx); } // Explicitly tell that we are in charge of CLK48 domain @@ -57,13 +57,13 @@ void furi_hal_bt_init() { ble_glue_init(); } -void furi_hal_bt_lock_core2() { - furi_assert(furi_hal_bt.core2_mtx); +void furi_hal_bt_lock_core2(void) { + furi_check(furi_hal_bt.core2_mtx); furi_check(furi_mutex_acquire(furi_hal_bt.core2_mtx, FuriWaitForever) == FuriStatusOk); } -void furi_hal_bt_unlock_core2() { - furi_assert(furi_hal_bt.core2_mtx); +void furi_hal_bt_unlock_core2(void) { + furi_check(furi_hal_bt.core2_mtx); furi_check(furi_mutex_release(furi_hal_bt.core2_mtx) == FuriStatusOk); } @@ -87,9 +87,9 @@ static bool furi_hal_bt_radio_stack_is_supported(const BleGlueC2Info* info) { return supported; } -bool furi_hal_bt_start_radio_stack() { +bool furi_hal_bt_start_radio_stack(void) { bool res = false; - furi_assert(furi_hal_bt.core2_mtx); + furi_check(furi_hal_bt.core2_mtx); furi_mutex_acquire(furi_hal_bt.core2_mtx, FuriWaitForever); @@ -130,11 +130,11 @@ bool furi_hal_bt_start_radio_stack() { return res; } -FuriHalBtStack furi_hal_bt_get_radio_stack() { +FuriHalBtStack furi_hal_bt_get_radio_stack(void) { return furi_hal_bt.stack; } -bool furi_hal_bt_is_gatt_gap_supported() { +bool furi_hal_bt_is_gatt_gap_supported(void) { if(furi_hal_bt.stack == FuriHalBtStackLight || furi_hal_bt.stack == FuriHalBtStackFull) { return true; } else { @@ -142,7 +142,7 @@ bool furi_hal_bt_is_gatt_gap_supported() { } } -bool furi_hal_bt_is_testing_supported() { +bool furi_hal_bt_is_testing_supported(void) { if(furi_hal_bt.stack == FuriHalBtStackFull) { return true; } else { @@ -168,7 +168,7 @@ FuriHalBleProfileBase* furi_hal_bt_start_app( FuriHalBleProfileParams params, GapEventCallback event_cb, void* context) { - furi_assert(event_cb); + furi_check(event_cb); furi_check(profile_template); furi_check(current_profile == NULL); @@ -198,7 +198,7 @@ FuriHalBleProfileBase* furi_hal_bt_start_app( return current_profile; } -void furi_hal_bt_reinit() { +void furi_hal_bt_reinit(void) { furi_hal_power_insomnia_enter(); FURI_LOG_I(TAG, "Disconnect and stop advertising"); furi_hal_bt_stop_advertising(); @@ -239,23 +239,23 @@ FuriHalBleProfileBase* furi_hal_bt_change_app( FuriHalBleProfileParams profile_params, GapEventCallback event_cb, void* context) { - furi_assert(event_cb); + furi_check(event_cb); furi_hal_bt_reinit(); return furi_hal_bt_start_app(profile_template, profile_params, event_cb, context); } -bool furi_hal_bt_is_active() { +bool furi_hal_bt_is_active(void) { return gap_get_state() > GapStateIdle; } -void furi_hal_bt_start_advertising() { +void furi_hal_bt_start_advertising(void) { if(gap_get_state() == GapStateIdle) { gap_start_advertising(); } } -void furi_hal_bt_stop_advertising() { +void furi_hal_bt_stop_advertising(void) { if(furi_hal_bt_is_active()) { gap_stop_advertising(); while(furi_hal_bt_is_active()) { @@ -279,21 +279,21 @@ void furi_hal_bt_get_key_storage_buff(uint8_t** key_buff_addr, uint16_t* key_buf void furi_hal_bt_set_key_storage_change_callback( BleGlueKeyStorageChangedCallback callback, void* context) { - furi_assert(callback); + furi_check(callback); ble_glue_set_key_storage_changed_callback(callback, context); } -void furi_hal_bt_nvm_sram_sem_acquire() { +void furi_hal_bt_nvm_sram_sem_acquire(void) { while(LL_HSEM_1StepLock(HSEM, CFG_HW_BLE_NVM_SRAM_SEMID)) { furi_thread_yield(); } } -void furi_hal_bt_nvm_sram_sem_release() { +void furi_hal_bt_nvm_sram_sem_release(void) { LL_HSEM_ReleaseLock(HSEM, CFG_HW_BLE_NVM_SRAM_SEMID, 0); } -bool furi_hal_bt_clear_white_list() { +bool furi_hal_bt_clear_white_list(void) { furi_hal_bt_nvm_sram_sem_acquire(); tBleStatus status = aci_gap_clear_security_db(); if(status) { @@ -304,6 +304,8 @@ bool furi_hal_bt_clear_white_list() { } void furi_hal_bt_dump_state(FuriString* buffer) { + furi_check(buffer); + if(furi_hal_bt_is_alive()) { uint8_t HCI_Version; uint16_t HCI_Revision; @@ -328,7 +330,7 @@ void furi_hal_bt_dump_state(FuriString* buffer) { } } -bool furi_hal_bt_is_alive() { +bool furi_hal_bt_is_alive(void) { return ble_glue_is_alive(); } @@ -337,7 +339,7 @@ void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power) { aci_hal_tone_start(channel, 0); } -void furi_hal_bt_stop_tone_tx() { +void furi_hal_bt_stop_tone_tx(void) { aci_hal_tone_stop(); } @@ -349,7 +351,7 @@ void furi_hal_bt_start_packet_rx(uint8_t channel, uint8_t datarate) { hci_le_enhanced_receiver_test(channel, datarate, 0); } -uint16_t furi_hal_bt_stop_packet_test() { +uint16_t furi_hal_bt_stop_packet_test(void) { uint16_t num_of_packets = 0; hci_le_test_end(&num_of_packets); return num_of_packets; @@ -359,7 +361,7 @@ void furi_hal_bt_start_rx(uint8_t channel) { aci_hal_rx_start(channel); } -float furi_hal_bt_get_rssi() { +float furi_hal_bt_get_rssi(void) { float val; uint8_t rssi_raw[3]; @@ -383,13 +385,13 @@ float furi_hal_bt_get_rssi() { return val; } -uint32_t furi_hal_bt_get_transmitted_packets() { +uint32_t furi_hal_bt_get_transmitted_packets(void) { uint32_t packets = 0; aci_hal_le_tx_test_packet_number(&packets); return packets; } -void furi_hal_bt_stop_rx() { +void furi_hal_bt_stop_rx(void) { aci_hal_rx_stop(); } @@ -420,18 +422,18 @@ bool furi_hal_bt_extra_beacon_set_config(const GapExtraBeaconConfig* config) { return gap_extra_beacon_set_config(config); } -const GapExtraBeaconConfig* furi_hal_bt_extra_beacon_get_config() { +const GapExtraBeaconConfig* furi_hal_bt_extra_beacon_get_config(void) { return gap_extra_beacon_get_config(); } -bool furi_hal_bt_extra_beacon_start() { +bool furi_hal_bt_extra_beacon_start(void) { return gap_extra_beacon_start(); } -bool furi_hal_bt_extra_beacon_stop() { +bool furi_hal_bt_extra_beacon_stop(void) { return gap_extra_beacon_stop(); } -bool furi_hal_bt_extra_beacon_is_active() { +bool furi_hal_bt_extra_beacon_is_active(void) { return gap_extra_beacon_get_state() == GapExtraBeaconStateStarted; } diff --git a/targets/f7/furi_hal/furi_hal_bus.c b/targets/f7/furi_hal/furi_hal_bus.c index 2c6f1f1ebc9..85b121dc44a 100644 --- a/targets/f7/furi_hal/furi_hal_bus.c +++ b/targets/f7/furi_hal/furi_hal_bus.c @@ -143,7 +143,7 @@ static const uint32_t furi_hal_bus[] = { [FuriHalBusRF] = LL_APB3_GRP1_PERIPH_RF, }; -void furi_hal_bus_init_early() { +void furi_hal_bus_init_early(void) { FURI_CRITICAL_ENTER(); // FURI_HAL_BUS_PERIPH_DISABLE(AHB1, FURI_HAL_BUS_AHB1_GRP1, 1); @@ -158,7 +158,7 @@ void furi_hal_bus_init_early() { FURI_CRITICAL_EXIT(); } -void furi_hal_bus_deinit_early() { +void furi_hal_bus_deinit_early(void) { FURI_CRITICAL_ENTER(); // FURI_HAL_BUS_PERIPH_ENABLE(AHB1, FURI_HAL_BUS_AHB1_GRP1, 1); diff --git a/targets/f7/furi_hal/furi_hal_bus.h b/targets/f7/furi_hal/furi_hal_bus.h index ad4bbec3249..7c4fe6a0368 100644 --- a/targets/f7/furi_hal/furi_hal_bus.h +++ b/targets/f7/furi_hal/furi_hal_bus.h @@ -68,10 +68,10 @@ typedef enum { } FuriHalBus; /** Early initialization */ -void furi_hal_bus_init_early(); +void furi_hal_bus_init_early(void); /** Early de-initialization */ -void furi_hal_bus_deinit_early(); +void furi_hal_bus_deinit_early(void); /** * Enable a peripheral by turning the clocking on and deasserting the reset. diff --git a/targets/f7/furi_hal/furi_hal_clock.c b/targets/f7/furi_hal/furi_hal_clock.c index 945dc323b2f..ad21031fe68 100644 --- a/targets/f7/furi_hal/furi_hal_clock.c +++ b/targets/f7/furi_hal/furi_hal_clock.c @@ -22,15 +22,15 @@ #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()) -void furi_hal_clock_init_early() { +void furi_hal_clock_init_early(void) { LL_SetSystemCoreClock(CPU_CLOCK_EARLY_HZ); LL_Init1msTick(SystemCoreClock); } -void furi_hal_clock_deinit_early() { +void furi_hal_clock_deinit_early(void) { } -void furi_hal_clock_init() { +void furi_hal_clock_init(void) { /* HSE and HSI configuration and activation */ LL_RCC_HSE_SetCapacitorTuning(0x26); LL_RCC_HSE_Enable(); @@ -125,7 +125,7 @@ void furi_hal_clock_init() { FURI_LOG_I(TAG, "Init OK"); } -void furi_hal_clock_switch_hse2hsi() { +void furi_hal_clock_switch_hse2hsi(void) { LL_RCC_HSI_Enable(); while(!LL_RCC_HSI_IsReady()) @@ -142,7 +142,7 @@ void furi_hal_clock_switch_hse2hsi() { ; } -void furi_hal_clock_switch_hsi2hse() { +void furi_hal_clock_switch_hsi2hse(void) { #ifdef FURI_HAL_CLOCK_TRACK_STARTUP uint32_t clock_start_time = DWT->CYCCNT; #endif @@ -168,7 +168,7 @@ void furi_hal_clock_switch_hsi2hse() { #endif } -bool furi_hal_clock_switch_hse2pll() { +bool furi_hal_clock_switch_hse2pll(void) { furi_assert(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSE); LL_RCC_PLL_Enable(); @@ -191,7 +191,7 @@ bool furi_hal_clock_switch_hse2pll() { return true; } -bool furi_hal_clock_switch_pll2hse() { +bool furi_hal_clock_switch_pll2hse(void) { furi_assert(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_PLL); LL_RCC_HSE_Enable(); @@ -210,11 +210,11 @@ bool furi_hal_clock_switch_pll2hse() { return true; } -void furi_hal_clock_suspend_tick() { +void furi_hal_clock_suspend_tick(void) { CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_ENABLE_Msk); } -void furi_hal_clock_resume_tick() { +void furi_hal_clock_resume_tick(void) { SET_BIT(SysTick->CTRL, SysTick_CTRL_ENABLE_Msk); } @@ -271,7 +271,7 @@ void furi_hal_clock_mco_enable(FuriHalClockMcoSourceId source, FuriHalClockMcoDi } } -void furi_hal_clock_mco_disable() { +void furi_hal_clock_mco_disable(void) { LL_RCC_ConfigMCO(LL_RCC_MCO1SOURCE_NOCLOCK, FuriHalClockMcoDiv1); LL_RCC_MSI_Disable(); while(LL_RCC_MSI_IsReady() != 0) diff --git a/targets/f7/furi_hal/furi_hal_clock.h b/targets/f7/furi_hal/furi_hal_clock.h index 3100b619f60..302e3d174af 100644 --- a/targets/f7/furi_hal/furi_hal_clock.h +++ b/targets/f7/furi_hal/furi_hal_clock.h @@ -33,37 +33,37 @@ typedef enum { } FuriHalClockMcoDivisorId; /** Early initialization */ -void furi_hal_clock_init_early(); +void furi_hal_clock_init_early(void); /** Early deinitialization */ -void furi_hal_clock_deinit_early(); +void furi_hal_clock_deinit_early(void); /** Initialize clocks */ -void furi_hal_clock_init(); +void furi_hal_clock_init(void); /** Switch clock from HSE to HSI */ -void furi_hal_clock_switch_hse2hsi(); +void furi_hal_clock_switch_hse2hsi(void); /** Switch clock from HSI to HSE */ -void furi_hal_clock_switch_hsi2hse(); +void furi_hal_clock_switch_hsi2hse(void); /** Switch clock from HSE to PLL * * @return true if changed, false if failed or not possible at this moment */ -bool furi_hal_clock_switch_hse2pll(); +bool furi_hal_clock_switch_hse2pll(void); /** Switch clock from PLL to HSE * * @return true if changed, false if failed or not possible at this moment */ -bool furi_hal_clock_switch_pll2hse(); +bool furi_hal_clock_switch_pll2hse(void); /** Stop SysTick counter without resetting */ -void furi_hal_clock_suspend_tick(); +void furi_hal_clock_suspend_tick(void); /** Continue SysTick counter operation */ -void furi_hal_clock_resume_tick(); +void furi_hal_clock_resume_tick(void); /** Enable clock output on MCO pin * @@ -73,7 +73,7 @@ void furi_hal_clock_resume_tick(); void furi_hal_clock_mco_enable(FuriHalClockMcoSourceId source, FuriHalClockMcoDivisorId div); /** Disable clock output on MCO pin */ -void furi_hal_clock_mco_disable(); +void furi_hal_clock_mco_disable(void); #ifdef __cplusplus } diff --git a/targets/f7/furi_hal/furi_hal_cortex.c b/targets/f7/furi_hal/furi_hal_cortex.c index 9865e6ef893..9e184a59760 100644 --- a/targets/f7/furi_hal/furi_hal_cortex.c +++ b/targets/f7/furi_hal/furi_hal_cortex.c @@ -5,7 +5,7 @@ #define FURI_HAL_CORTEX_INSTRUCTIONS_PER_MICROSECOND (SystemCoreClock / 1000000) -void furi_hal_cortex_init_early() { +void furi_hal_cortex_init_early(void) { CoreDebug->DEMCR |= (CoreDebug_DEMCR_TRCENA_Msk | CoreDebug_DEMCR_MON_EN_Msk); DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; DWT->CYCCNT = 0U; @@ -24,7 +24,7 @@ void furi_hal_cortex_delay_us(uint32_t microseconds) { }; } -uint32_t furi_hal_cortex_instructions_per_microsecond() { +uint32_t furi_hal_cortex_instructions_per_microsecond(void) { return FURI_HAL_CORTEX_INSTRUCTIONS_PER_MICROSECOND; } diff --git a/targets/f7/furi_hal/furi_hal_crypto.c b/targets/f7/furi_hal/furi_hal_crypto.c index a897648a354..236573bca8d 100644 --- a/targets/f7/furi_hal/furi_hal_crypto.c +++ b/targets/f7/furi_hal/furi_hal_crypto.c @@ -80,7 +80,7 @@ static const uint8_t enclave_signature_expected[ENCLAVE_FACTORY_KEY_SLOTS][ENCLA {0xc9, 0xf7, 0x03, 0xf1, 0x6c, 0x65, 0xad, 0x49, 0x74, 0xbe, 0x00, 0x54, 0xfd, 0xa6, 0x9c, 0x32}, }; -void furi_hal_crypto_init() { +void furi_hal_crypto_init(void) { furi_hal_crypto_mutex = furi_mutex_alloc(FuriMutexTypeNormal); FURI_LOG_I(TAG, "Init OK"); } @@ -129,8 +129,8 @@ bool furi_hal_crypto_enclave_ensure_key(uint8_t key_slot) { } bool furi_hal_crypto_enclave_verify(uint8_t* keys_nb, uint8_t* valid_keys_nb) { - furi_assert(keys_nb); - furi_assert(valid_keys_nb); + furi_check(keys_nb); + furi_check(valid_keys_nb); uint8_t keys = 0; uint8_t keys_valid = 0; uint8_t buffer[ENCLAVE_SIGNATURE_SIZE]; @@ -155,8 +155,8 @@ bool furi_hal_crypto_enclave_verify(uint8_t* keys_nb, uint8_t* valid_keys_nb) { } bool furi_hal_crypto_enclave_store_key(FuriHalCryptoKey* key, uint8_t* slot) { - furi_assert(key); - furi_assert(slot); + furi_check(key); + furi_check(slot); furi_check(furi_mutex_acquire(furi_hal_crypto_mutex, FuriWaitForever) == FuriStatusOk); @@ -256,8 +256,8 @@ static bool crypto_process_block(uint32_t* in, uint32_t* out, uint8_t blk_len) { } bool furi_hal_crypto_enclave_load_key(uint8_t slot, const uint8_t* iv) { - furi_assert(slot > 0 && slot <= 100); - furi_assert(furi_hal_crypto_mutex); + furi_check(slot > 0 && slot <= 100); + furi_check(furi_hal_crypto_mutex); furi_check(furi_mutex_acquire(furi_hal_crypto_mutex, FuriWaitForever) == FuriStatusOk); furi_hal_bus_enable(FuriHalBusAES1); @@ -286,16 +286,16 @@ bool furi_hal_crypto_enclave_unload_key(uint8_t slot) { CLEAR_BIT(AES1->CR, AES_CR_EN); SHCI_CmdStatus_t shci_state = SHCI_C2_FUS_UnloadUsrKey(slot); - furi_assert(shci_state == SHCI_Success); furi_hal_bus_disable(FuriHalBusAES1); furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk); + return (shci_state == SHCI_Success); } bool furi_hal_crypto_load_key(const uint8_t* key, const uint8_t* iv) { - furi_assert(furi_hal_crypto_mutex); + furi_check(furi_hal_crypto_mutex); furi_check(furi_mutex_acquire(furi_hal_crypto_mutex, FuriWaitForever) == FuriStatusOk); furi_hal_bus_enable(FuriHalBusAES1); @@ -400,7 +400,7 @@ static void crypto_key_init_bswap(uint32_t* key, uint32_t* iv, uint32_t chaining static bool furi_hal_crypto_load_key_bswap(const uint8_t* key, const uint8_t* iv, uint32_t chaining_mode) { - furi_assert(furi_hal_crypto_mutex); + furi_check(furi_hal_crypto_mutex); furi_check(furi_mutex_acquire(furi_hal_crypto_mutex, FuriWaitForever) == FuriStatusOk); furi_hal_bus_enable(FuriHalBusAES1); diff --git a/targets/f7/furi_hal/furi_hal_debug.c b/targets/f7/furi_hal/furi_hal_debug.c index 3dc03ea69d7..7d1488fa521 100644 --- a/targets/f7/furi_hal/furi_hal_debug.c +++ b/targets/f7/furi_hal/furi_hal_debug.c @@ -8,7 +8,7 @@ volatile bool furi_hal_debug_gdb_session_active = false; -void furi_hal_debug_enable() { +void furi_hal_debug_enable(void) { // Low power mode debug LL_DBGMCU_EnableDBGSleepMode(); LL_DBGMCU_EnableDBGStopMode(); @@ -25,7 +25,7 @@ void furi_hal_debug_enable() { &gpio_swclk, GpioModeAltFunctionPushPull, GpioPullDown, GpioSpeedLow, GpioAltFn0JTCK_SWCLK); } -void furi_hal_debug_disable() { +void furi_hal_debug_disable(void) { // Low power mode debug LL_DBGMCU_DisableDBGSleepMode(); LL_DBGMCU_DisableDBGStopMode(); @@ -36,6 +36,6 @@ void furi_hal_debug_disable() { furi_hal_gpio_init_simple(&gpio_swclk, GpioModeAnalog); } -bool furi_hal_debug_is_gdb_session_active() { +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_dma.c b/targets/f7/furi_hal/furi_hal_dma.c index a6a30d906da..e9bef960549 100644 --- a/targets/f7/furi_hal/furi_hal_dma.c +++ b/targets/f7/furi_hal/furi_hal_dma.c @@ -1,13 +1,13 @@ #include #include -void furi_hal_dma_init_early() { +void furi_hal_dma_init_early(void) { furi_hal_bus_enable(FuriHalBusDMA1); furi_hal_bus_enable(FuriHalBusDMA2); furi_hal_bus_enable(FuriHalBusDMAMUX1); } -void furi_hal_dma_deinit_early() { +void furi_hal_dma_deinit_early(void) { furi_hal_bus_disable(FuriHalBusDMA1); furi_hal_bus_disable(FuriHalBusDMA2); furi_hal_bus_disable(FuriHalBusDMAMUX1); diff --git a/targets/f7/furi_hal/furi_hal_dma.h b/targets/f7/furi_hal/furi_hal_dma.h index cadcc7733e0..281a8ff1bb6 100644 --- a/targets/f7/furi_hal/furi_hal_dma.h +++ b/targets/f7/furi_hal/furi_hal_dma.h @@ -5,10 +5,10 @@ extern "C" { #endif /** Early initialization */ -void furi_hal_dma_init_early(); +void furi_hal_dma_init_early(void); /** Early de-initialization */ -void furi_hal_dma_deinit_early(); +void furi_hal_dma_deinit_early(void); #ifdef __cplusplus } diff --git a/targets/f7/furi_hal/furi_hal_flash.c b/targets/f7/furi_hal/furi_hal_flash.c index 37eec744c41..138e07eab79 100644 --- a/targets/f7/furi_hal/furi_hal_flash.c +++ b/targets/f7/furi_hal/furi_hal_flash.c @@ -51,37 +51,37 @@ /* Free flash space borders, exported by linker */ extern const void __free_flash_start__; -size_t furi_hal_flash_get_base() { +size_t furi_hal_flash_get_base(void) { return FLASH_BASE; } -size_t furi_hal_flash_get_read_block_size() { +size_t furi_hal_flash_get_read_block_size(void) { return FURI_HAL_FLASH_READ_BLOCK; } -size_t furi_hal_flash_get_write_block_size() { +size_t furi_hal_flash_get_write_block_size(void) { return FURI_HAL_FLASH_WRITE_BLOCK; } -size_t furi_hal_flash_get_page_size() { +size_t furi_hal_flash_get_page_size(void) { return FURI_HAL_FLASH_PAGE_SIZE; } -size_t furi_hal_flash_get_cycles_count() { +size_t furi_hal_flash_get_cycles_count(void) { return FURI_HAL_FLASH_CYCLES_COUNT; } -const void* furi_hal_flash_get_free_start_address() { +const void* furi_hal_flash_get_free_start_address(void) { return &__free_flash_start__; } -const void* furi_hal_flash_get_free_end_address() { +const void* furi_hal_flash_get_free_end_address(void) { uint32_t sfr_reg_val = READ_REG(FLASH->SFR); uint32_t sfsa = (READ_BIT(sfr_reg_val, FLASH_SFR_SFSA) >> FLASH_SFR_SFSA_Pos); return (const void*)((sfsa * FURI_HAL_FLASH_PAGE_SIZE) + FLASH_BASE); } -size_t furi_hal_flash_get_free_page_start_address() { +size_t furi_hal_flash_get_free_page_start_address(void) { size_t start = (size_t)furi_hal_flash_get_free_start_address(); size_t page_start = start - start % FURI_HAL_FLASH_PAGE_SIZE; if(page_start != start) { @@ -90,13 +90,13 @@ size_t furi_hal_flash_get_free_page_start_address() { return page_start; } -size_t furi_hal_flash_get_free_page_count() { +size_t furi_hal_flash_get_free_page_count(void) { size_t end = (size_t)furi_hal_flash_get_free_end_address(); size_t page_start = (size_t)furi_hal_flash_get_free_page_start_address(); return (end - page_start) / FURI_HAL_FLASH_PAGE_SIZE; } -void furi_hal_flash_init() { +void furi_hal_flash_init(void) { /* Errata 2.2.9, Flash OPTVERR flag is always set after system reset */ // WRITE_REG(FLASH->SR, FLASH_SR_OPTVERR); /* Actually, reset all error flags on start */ @@ -106,7 +106,7 @@ void furi_hal_flash_init() { } } -static void furi_hal_flash_unlock() { +static void furi_hal_flash_unlock(void) { /* verify Flash is locked */ furi_check(READ_BIT(FLASH->CR, FLASH_CR_LOCK) != 0U); @@ -450,7 +450,7 @@ uint32_t furi_hal_flash_ob_get_word(size_t word_idx, bool complementary) { return ob_data[raw_word_idx]; } -void furi_hal_flash_ob_unlock() { +void furi_hal_flash_ob_unlock(void) { furi_check(READ_BIT(FLASH->CR, FLASH_CR_OPTLOCK) != 0U); furi_hal_flash_begin(true); WRITE_REG(FLASH->OPTKEYR, FURI_HAL_FLASH_OPT_KEY1); @@ -460,7 +460,7 @@ void furi_hal_flash_ob_unlock() { furi_check(READ_BIT(FLASH->CR, FLASH_CR_OPTLOCK) == 0U); } -void furi_hal_flash_ob_lock() { +void furi_hal_flash_ob_lock(void) { furi_check(READ_BIT(FLASH->CR, FLASH_CR_OPTLOCK) == 0U); SET_BIT(FLASH->CR, FLASH_CR_OPTLOCK); furi_hal_flash_end(true); @@ -511,7 +511,7 @@ static const FuriHalFlashObMapping furi_hal_flash_ob_reg_map[FURI_HAL_FLASH_OB_T }; #undef OB_REG_DEF -void furi_hal_flash_ob_apply() { +void furi_hal_flash_ob_apply(void) { furi_hal_flash_ob_unlock(); /* OBL_LAUNCH: When set to 1, this bit forces the option byte reloading. * It cannot be written if OPTLOCK is set */ @@ -558,6 +558,6 @@ bool furi_hal_flash_ob_set_word(size_t word_idx, const uint32_t value) { return true; } -const FuriHalFlashRawOptionByteData* furi_hal_flash_ob_get_raw_ptr() { +const FuriHalFlashRawOptionByteData* furi_hal_flash_ob_get_raw_ptr(void) { return (const FuriHalFlashRawOptionByteData*)OPTION_BYTE_BASE; } diff --git a/targets/f7/furi_hal/furi_hal_flash.h b/targets/f7/furi_hal/furi_hal_flash.h index 9fa8f94af9d..6a5d4222268 100644 --- a/targets/f7/furi_hal/furi_hal_flash.h +++ b/targets/f7/furi_hal/furi_hal_flash.h @@ -29,61 +29,61 @@ _Static_assert( /** Init flash, applying necessary workarounds */ -void furi_hal_flash_init(); +void furi_hal_flash_init(void); /** Get flash base address * * @return pointer to flash base */ -size_t furi_hal_flash_get_base(); +size_t furi_hal_flash_get_base(void); /** Get flash read block size * * @return size in bytes */ -size_t furi_hal_flash_get_read_block_size(); +size_t furi_hal_flash_get_read_block_size(void); /** Get flash write block size * * @return size in bytes */ -size_t furi_hal_flash_get_write_block_size(); +size_t furi_hal_flash_get_write_block_size(void); /** Get flash page size * * @return size in bytes */ -size_t furi_hal_flash_get_page_size(); +size_t furi_hal_flash_get_page_size(void); /** Get expected flash cycles count * * @return count of erase-write operations */ -size_t furi_hal_flash_get_cycles_count(); +size_t furi_hal_flash_get_cycles_count(void); /** Get free flash start address * * @return pointer to free region start */ -const void* furi_hal_flash_get_free_start_address(); +const void* furi_hal_flash_get_free_start_address(void); /** Get free flash end address * * @return pointer to free region end */ -const void* furi_hal_flash_get_free_end_address(); +const void* furi_hal_flash_get_free_end_address(void); /** Get first free page start address * * @return first free page memory address */ -size_t furi_hal_flash_get_free_page_start_address(); +size_t furi_hal_flash_get_free_page_start_address(void); /** Get free page count * * @return free page count */ -size_t furi_hal_flash_get_free_page_count(); +size_t furi_hal_flash_get_free_page_count(void); /** Erase Flash * @@ -133,13 +133,13 @@ bool furi_hal_flash_ob_set_word(size_t word_idx, const uint32_t value); * @warning Initializes system restart * */ -void furi_hal_flash_ob_apply(); +void furi_hal_flash_ob_apply(void); /** Get raw OB storage data * * @return pointer to read-only data of OB (raw + complementary values) */ -const FuriHalFlashRawOptionByteData* furi_hal_flash_ob_get_raw_ptr(); +const FuriHalFlashRawOptionByteData* furi_hal_flash_ob_get_raw_ptr(void); #ifdef __cplusplus } diff --git a/targets/f7/furi_hal/furi_hal_gpio.c b/targets/f7/furi_hal/furi_hal_gpio.c index da195bdca05..ec3e725c595 100644 --- a/targets/f7/furi_hal/furi_hal_gpio.c +++ b/targets/f7/furi_hal/furi_hal_gpio.c @@ -5,7 +5,7 @@ #include #include -static uint32_t furi_hal_gpio_invalid_argument_crash() { +static uint32_t furi_hal_gpio_invalid_argument_crash(void) { furi_crash("Invalid argument"); return 0; } @@ -194,8 +194,8 @@ void furi_hal_gpio_init_ex( } void furi_hal_gpio_add_int_callback(const GpioPin* gpio, GpioExtiCallback cb, void* ctx) { - furi_assert(gpio); - furi_assert(cb); + furi_check(gpio); + furi_check(cb); FURI_CRITICAL_ENTER(); @@ -211,7 +211,7 @@ void furi_hal_gpio_add_int_callback(const GpioPin* gpio, GpioExtiCallback cb, vo } void furi_hal_gpio_enable_int_callback(const GpioPin* gpio) { - furi_assert(gpio); + furi_check(gpio); FURI_CRITICAL_ENTER(); @@ -222,7 +222,7 @@ void furi_hal_gpio_enable_int_callback(const GpioPin* gpio) { } void furi_hal_gpio_disable_int_callback(const GpioPin* gpio) { - furi_assert(gpio); + furi_check(gpio); FURI_CRITICAL_ENTER(); @@ -234,7 +234,7 @@ void furi_hal_gpio_disable_int_callback(const GpioPin* gpio) { } void furi_hal_gpio_remove_int_callback(const GpioPin* gpio) { - furi_assert(gpio); + furi_check(gpio); FURI_CRITICAL_ENTER(); diff --git a/targets/f7/furi_hal/furi_hal_i2c.c b/targets/f7/furi_hal/furi_hal_i2c.c index 8c7b054e3e4..71e1a581409 100644 --- a/targets/f7/furi_hal/furi_hal_i2c.c +++ b/targets/f7/furi_hal/furi_hal_i2c.c @@ -9,15 +9,15 @@ #define TAG "FuriHalI2c" -void furi_hal_i2c_init_early() { +void furi_hal_i2c_init_early(void) { furi_hal_i2c_bus_power.callback(&furi_hal_i2c_bus_power, FuriHalI2cBusEventInit); } -void furi_hal_i2c_deinit_early() { +void furi_hal_i2c_deinit_early(void) { furi_hal_i2c_bus_power.callback(&furi_hal_i2c_bus_power, FuriHalI2cBusEventDeinit); } -void furi_hal_i2c_init() { +void furi_hal_i2c_init(void) { furi_hal_i2c_bus_external.callback(&furi_hal_i2c_bus_external, FuriHalI2cBusEventInit); FURI_LOG_I(TAG, "Init OK"); } @@ -235,7 +235,7 @@ bool furi_hal_i2c_tx( const uint8_t* data, size_t size, uint32_t timeout) { - furi_assert(timeout > 0); + furi_check(timeout > 0); return furi_hal_i2c_tx_ext( handle, address, false, data, size, FuriHalI2cBeginStart, FuriHalI2cEndStop, timeout); @@ -247,7 +247,7 @@ bool furi_hal_i2c_rx( uint8_t* data, size_t size, uint32_t timeout) { - furi_assert(timeout > 0); + furi_check(timeout > 0); return furi_hal_i2c_rx_ext( handle, address, false, data, size, FuriHalI2cBeginStart, FuriHalI2cEndStop, timeout); @@ -284,7 +284,7 @@ bool furi_hal_i2c_trx( bool furi_hal_i2c_is_device_ready(FuriHalI2cBusHandle* handle, uint8_t i2c_addr, uint32_t timeout) { furi_check(handle); furi_check(handle->bus->current_handle == handle); - furi_assert(timeout > 0); + furi_check(timeout > 0); bool ret = true; FuriHalCortexTimer timer = furi_hal_cortex_timer_get(timeout * 1000); @@ -393,7 +393,7 @@ bool furi_hal_i2c_write_mem( uint32_t timeout) { furi_check(handle); furi_check(handle->bus->current_handle == handle); - furi_assert(timeout > 0); + furi_check(timeout > 0); return furi_hal_i2c_tx_ext( handle, diff --git a/targets/f7/furi_hal/furi_hal_ibutton.c b/targets/f7/furi_hal/furi_hal_ibutton.c index bf1127a857c..07cf8de6e21 100644 --- a/targets/f7/furi_hal/furi_hal_ibutton.c +++ b/targets/f7/furi_hal/furi_hal_ibutton.c @@ -33,7 +33,7 @@ static void furi_hal_ibutton_emulate_isr(void* context) { } } -void furi_hal_ibutton_init() { +void furi_hal_ibutton_init(void) { furi_hal_ibutton = malloc(sizeof(FuriHalIbutton)); furi_hal_ibutton->state = FuriHalIbuttonStateIdle; @@ -44,8 +44,8 @@ void furi_hal_ibutton_emulate_start( uint32_t period, FuriHalIbuttonEmulateCallback callback, void* context) { - furi_assert(furi_hal_ibutton); - furi_assert(furi_hal_ibutton->state == FuriHalIbuttonStateIdle); + furi_check(furi_hal_ibutton); + furi_check(furi_hal_ibutton->state == FuriHalIbuttonStateIdle); furi_hal_ibutton->state = FuriHalIbuttonStateRunning; furi_hal_ibutton->callback = callback; @@ -74,8 +74,8 @@ void furi_hal_ibutton_emulate_set_next(uint32_t period) { LL_TIM_SetAutoReload(FURI_HAL_IBUTTON_TIMER, period); } -void furi_hal_ibutton_emulate_stop() { - furi_assert(furi_hal_ibutton); +void furi_hal_ibutton_emulate_stop(void) { + furi_check(furi_hal_ibutton); if(furi_hal_ibutton->state == FuriHalIbuttonStateRunning) { furi_hal_ibutton->state = FuriHalIbuttonStateIdle; @@ -89,12 +89,12 @@ void furi_hal_ibutton_emulate_stop() { } } -void furi_hal_ibutton_pin_configure() { +void furi_hal_ibutton_pin_configure(void) { furi_hal_gpio_write(&gpio_ibutton, true); furi_hal_gpio_init(&gpio_ibutton, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow); } -void furi_hal_ibutton_pin_reset() { +void furi_hal_ibutton_pin_reset(void) { furi_hal_gpio_write(&gpio_ibutton, true); furi_hal_gpio_init(&gpio_ibutton, GpioModeAnalog, GpioPullNo, GpioSpeedLow); } diff --git a/targets/f7/furi_hal/furi_hal_ibutton.h b/targets/f7/furi_hal/furi_hal_ibutton.h index b723fe17686..ae676f8b5e3 100644 --- a/targets/f7/furi_hal/furi_hal_ibutton.h +++ b/targets/f7/furi_hal/furi_hal_ibutton.h @@ -15,7 +15,7 @@ extern "C" { typedef void (*FuriHalIbuttonEmulateCallback)(void* context); /** Initialize */ -void furi_hal_ibutton_init(); +void furi_hal_ibutton_init(void); /** * Start emulation timer @@ -37,17 +37,17 @@ void furi_hal_ibutton_emulate_set_next(uint32_t period); /** * Stop emulation timer */ -void furi_hal_ibutton_emulate_stop(); +void furi_hal_ibutton_emulate_stop(void); /** * Set the pin to normal mode (open collector), and sets it to float */ -void furi_hal_ibutton_pin_configure(); +void furi_hal_ibutton_pin_configure(void); /** * Sets the pin to analog mode, and sets it to float */ -void furi_hal_ibutton_pin_reset(); +void furi_hal_ibutton_pin_reset(void); /** * iButton write pin diff --git a/targets/f7/furi_hal/furi_hal_infrared.c b/targets/f7/furi_hal/furi_hal_infrared.c index af3c8fc6b3d..6ace2ed7f21 100644 --- a/targets/f7/furi_hal/furi_hal_infrared.c +++ b/targets/f7/furi_hal/furi_hal_infrared.c @@ -102,7 +102,7 @@ static void furi_hal_infrared_tim_rx_isr(void* context) { /* Timeout */ if(LL_TIM_IsActiveFlag_CC3(INFRARED_RX_TIMER)) { LL_TIM_ClearFlag_CC3(INFRARED_RX_TIMER); - furi_assert(furi_hal_infrared_state == InfraredStateAsyncRx); + furi_check(furi_hal_infrared_state == InfraredStateAsyncRx); /* Timers CNT register starts to counting from 0 to ARR, but it is * reseted when Channel 1 catches interrupt. It is not reseted by @@ -119,7 +119,7 @@ static void furi_hal_infrared_tim_rx_isr(void* context) { /* Rising Edge */ if(LL_TIM_IsActiveFlag_CC1(INFRARED_RX_TIMER)) { LL_TIM_ClearFlag_CC1(INFRARED_RX_TIMER); - furi_assert(furi_hal_infrared_state == InfraredStateAsyncRx); + furi_check(furi_hal_infrared_state == InfraredStateAsyncRx); if(READ_BIT(INFRARED_RX_TIMER->CCMR1, TIM_CCMR1_CC1S)) { /* Low pin level is a Mark state of INFRARED signal. Invert level for further processing. */ @@ -134,7 +134,7 @@ static void furi_hal_infrared_tim_rx_isr(void* context) { /* Falling Edge */ if(LL_TIM_IsActiveFlag_CC2(INFRARED_RX_TIMER)) { LL_TIM_ClearFlag_CC2(INFRARED_RX_TIMER); - furi_assert(furi_hal_infrared_state == InfraredStateAsyncRx); + furi_check(furi_hal_infrared_state == InfraredStateAsyncRx); if(READ_BIT(INFRARED_RX_TIMER->CCMR1, TIM_CCMR1_CC2S)) { /* High pin level is a Space state of INFRARED signal. Invert level for further processing. */ @@ -149,7 +149,7 @@ static void furi_hal_infrared_tim_rx_isr(void* context) { } void furi_hal_infrared_async_rx_start(void) { - furi_assert(furi_hal_infrared_state == InfraredStateIdle); + furi_check(furi_hal_infrared_state == InfraredStateIdle); furi_hal_gpio_init_ex( &gpio_infrared_rx, @@ -198,7 +198,7 @@ void furi_hal_infrared_async_rx_start(void) { } void furi_hal_infrared_async_rx_stop(void) { - furi_assert(furi_hal_infrared_state == InfraredStateAsyncRx); + furi_check(furi_hal_infrared_state == InfraredStateAsyncRx); FURI_CRITICAL_ENTER(); furi_hal_bus_disable(INFRARED_RX_TIMER_BUS); @@ -237,7 +237,7 @@ static void furi_hal_infrared_tx_dma_terminate(void) { LL_DMA_DisableIT_HT(INFRARED_DMA_CH2_DEF); LL_DMA_DisableIT_TC(INFRARED_DMA_CH2_DEF); - furi_assert(furi_hal_infrared_state == InfraredStateAsyncTxStopInProgress); + furi_check(furi_hal_infrared_state == InfraredStateAsyncTxStopInProgress); LL_DMA_DisableIT_TC(INFRARED_DMA_CH1_DEF); LL_DMA_DisableChannel(INFRARED_DMA_CH2_DEF); @@ -447,14 +447,14 @@ static void furi_hal_infrared_configure_tim_rcr_dma_tx(void) { } static void furi_hal_infrared_tx_fill_buffer_last(uint8_t buf_num) { - furi_assert(buf_num < 2); - furi_assert(furi_hal_infrared_state != InfraredStateAsyncRx); - furi_assert(furi_hal_infrared_state < InfraredStateMAX); - furi_assert(infrared_tim_tx.data_callback); + furi_check(buf_num < 2); + furi_check(furi_hal_infrared_state != InfraredStateAsyncRx); + furi_check(furi_hal_infrared_state < InfraredStateMAX); + furi_check(infrared_tim_tx.data_callback); InfraredTxBuf* buffer = &infrared_tim_tx.buffer[buf_num]; - furi_assert(buffer->data != NULL); + furi_check(buffer->data != NULL); (void)buffer->data; - furi_assert(buffer->polarity != NULL); + furi_check(buffer->polarity != NULL); (void)buffer->polarity; infrared_tim_tx.buffer[buf_num].data[0] = 0; // 1 pulse @@ -467,13 +467,13 @@ static void furi_hal_infrared_tx_fill_buffer_last(uint8_t buf_num) { } static void furi_hal_infrared_tx_fill_buffer(uint8_t buf_num, uint8_t polarity_shift) { - furi_assert(buf_num < 2); - furi_assert(furi_hal_infrared_state != InfraredStateAsyncRx); - furi_assert(furi_hal_infrared_state < InfraredStateMAX); - furi_assert(infrared_tim_tx.data_callback); + furi_check(buf_num < 2); + furi_check(furi_hal_infrared_state != InfraredStateAsyncRx); + furi_check(furi_hal_infrared_state < InfraredStateMAX); + furi_check(infrared_tim_tx.data_callback); InfraredTxBuf* buffer = &infrared_tim_tx.buffer[buf_num]; - furi_assert(buffer->data != NULL); - furi_assert(buffer->polarity != NULL); + furi_check(buffer->data != NULL); + furi_check(buffer->polarity != NULL); FuriHalInfraredTxGetDataState status = FuriHalInfraredTxGetDataStateOk; uint32_t duration = 0; @@ -539,10 +539,10 @@ static void furi_hal_infrared_tx_fill_buffer(uint8_t buf_num, uint8_t polarity_s } static void furi_hal_infrared_tx_dma_set_polarity(uint8_t buf_num, uint8_t polarity_shift) { - furi_assert(buf_num < 2); - furi_assert(furi_hal_infrared_state < InfraredStateMAX); + furi_check(buf_num < 2); + furi_check(furi_hal_infrared_state < InfraredStateMAX); InfraredTxBuf* buffer = &infrared_tim_tx.buffer[buf_num]; - furi_assert(buffer->polarity != NULL); + furi_check(buffer->polarity != NULL); FURI_CRITICAL_ENTER(); bool channel_enabled = LL_DMA_IsEnabledChannel(INFRARED_DMA_CH1_DEF); @@ -558,10 +558,10 @@ static void furi_hal_infrared_tx_dma_set_polarity(uint8_t buf_num, uint8_t polar } static void furi_hal_infrared_tx_dma_set_buffer(uint8_t buf_num) { - furi_assert(buf_num < 2); - furi_assert(furi_hal_infrared_state < InfraredStateMAX); + furi_check(buf_num < 2); + furi_check(furi_hal_infrared_state < InfraredStateMAX); InfraredTxBuf* buffer = &infrared_tim_tx.buffer[buf_num]; - furi_assert(buffer->data != NULL); + furi_check(buffer->data != NULL); /* non-circular mode requires disabled channel before setup */ FURI_CRITICAL_ENTER(); @@ -578,7 +578,7 @@ static void furi_hal_infrared_tx_dma_set_buffer(uint8_t buf_num) { } static void furi_hal_infrared_async_tx_free_resources(void) { - furi_assert( + furi_check( (furi_hal_infrared_state == InfraredStateIdle) || (furi_hal_infrared_state == InfraredStateAsyncTxStopped)); @@ -606,11 +606,11 @@ void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle) { furi_crash(); } - furi_assert(furi_hal_infrared_state == InfraredStateIdle); - furi_assert(infrared_tim_tx.buffer[0].data == NULL); - furi_assert(infrared_tim_tx.buffer[1].data == NULL); - furi_assert(infrared_tim_tx.buffer[0].polarity == NULL); - furi_assert(infrared_tim_tx.buffer[1].polarity == NULL); + furi_check(furi_hal_infrared_state == InfraredStateIdle); + furi_check(infrared_tim_tx.buffer[0].data == NULL); + furi_check(infrared_tim_tx.buffer[1].data == NULL); + furi_check(infrared_tim_tx.buffer[0].polarity == NULL); + furi_check(infrared_tim_tx.buffer[1].polarity == NULL); size_t alloc_size_data = INFRARED_TIM_TX_DMA_BUFFER_SIZE * sizeof(uint16_t); infrared_tim_tx.buffer[0].data = malloc(alloc_size_data); @@ -655,8 +655,8 @@ void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle) { } void furi_hal_infrared_async_tx_wait_termination(void) { - furi_assert(furi_hal_infrared_state >= InfraredStateAsyncTx); - furi_assert(furi_hal_infrared_state < InfraredStateMAX); + furi_check(furi_hal_infrared_state >= InfraredStateAsyncTx); + furi_check(furi_hal_infrared_state < InfraredStateMAX); FuriStatus status; status = furi_semaphore_acquire(infrared_tim_tx.stop_semaphore, FuriWaitForever); @@ -666,8 +666,8 @@ void furi_hal_infrared_async_tx_wait_termination(void) { } void furi_hal_infrared_async_tx_stop(void) { - furi_assert(furi_hal_infrared_state >= InfraredStateAsyncTx); - furi_assert(furi_hal_infrared_state < InfraredStateMAX); + furi_check(furi_hal_infrared_state >= InfraredStateAsyncTx); + furi_check(furi_hal_infrared_state < InfraredStateMAX); FURI_CRITICAL_ENTER(); if(furi_hal_infrared_state == InfraredStateAsyncTx) @@ -680,7 +680,7 @@ void furi_hal_infrared_async_tx_stop(void) { void furi_hal_infrared_async_tx_set_data_isr_callback( FuriHalInfraredTxGetDataISRCallback callback, void* context) { - furi_assert(furi_hal_infrared_state == InfraredStateIdle); + furi_check(furi_hal_infrared_state == InfraredStateIdle); infrared_tim_tx.data_callback = callback; infrared_tim_tx.data_context = context; } diff --git a/targets/f7/furi_hal/furi_hal_interrupt.c b/targets/f7/furi_hal/furi_hal_interrupt.c index a9cd4e7aa6a..a0ce2f6656f 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.c +++ b/targets/f7/furi_hal/furi_hal_interrupt.c @@ -101,7 +101,7 @@ __attribute__((always_inline)) static inline void NVIC_DisableIRQ(furi_hal_interrupt_irqn[index]); } -void furi_hal_interrupt_init() { +void furi_hal_interrupt_init(void) { NVIC_SetPriority( TAMP_STAMP_LSECSS_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0)); NVIC_EnableIRQ(TAMP_STAMP_LSECSS_IRQn); @@ -165,82 +165,82 @@ void furi_hal_interrupt_set_isr_ex( } /* Timer 2 */ -void TIM2_IRQHandler() { +void TIM2_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdTIM2); } /* Timer 1 Update */ -void TIM1_UP_TIM16_IRQHandler() { +void TIM1_UP_TIM16_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdTim1UpTim16); } -void TIM1_TRG_COM_TIM17_IRQHandler() { +void TIM1_TRG_COM_TIM17_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdTim1TrgComTim17); } -void TIM1_CC_IRQHandler() { +void TIM1_CC_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdTim1Cc); } /* DMA 1 */ -void DMA1_Channel1_IRQHandler() { +void DMA1_Channel1_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch1); } -void DMA1_Channel2_IRQHandler() { +void DMA1_Channel2_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch2); } -void DMA1_Channel3_IRQHandler() { +void DMA1_Channel3_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch3); } -void DMA1_Channel4_IRQHandler() { +void DMA1_Channel4_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch4); } -void DMA1_Channel5_IRQHandler() { +void DMA1_Channel5_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch5); } -void DMA1_Channel6_IRQHandler() { +void DMA1_Channel6_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch6); } -void DMA1_Channel7_IRQHandler() { +void DMA1_Channel7_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma1Ch7); } /* DMA 2 */ -void DMA2_Channel1_IRQHandler() { +void DMA2_Channel1_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch1); } -void DMA2_Channel2_IRQHandler() { +void DMA2_Channel2_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch2); } -void DMA2_Channel3_IRQHandler() { +void DMA2_Channel3_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch3); } -void DMA2_Channel4_IRQHandler() { +void DMA2_Channel4_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch4); } -void DMA2_Channel5_IRQHandler() { +void DMA2_Channel5_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch5); } -void DMA2_Channel6_IRQHandler() { +void DMA2_Channel6_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch6); } -void DMA2_Channel7_IRQHandler() { +void DMA2_Channel7_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdDma2Ch7); } -void HSEM_IRQHandler() { +void HSEM_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdHsem); } @@ -256,11 +256,11 @@ void TAMP_STAMP_LSECSS_IRQHandler(void) { } } -void RCC_IRQHandler() { +void RCC_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdRcc); } -void NMI_Handler() { +void NMI_Handler(void) { if(LL_RCC_IsActiveFlag_HSECSS()) { LL_RCC_ClearFlag_HSECSS(); FURI_LOG_E(TAG, "HSE CSS fired: resetting system"); @@ -268,11 +268,11 @@ void NMI_Handler() { } } -void HardFault_Handler() { +void HardFault_Handler(void) { furi_crash("HardFault"); } -void MemManage_Handler() { +void MemManage_Handler(void) { if(FURI_BIT(SCB->CFSR, SCB_CFSR_MMARVALID_Pos)) { uint32_t memfault_address = SCB->MMFAR; if(memfault_address < (1024 * 1024)) { @@ -290,15 +290,15 @@ void MemManage_Handler() { furi_crash("MemManage"); } -void BusFault_Handler() { +void BusFault_Handler(void) { furi_crash("BusFault"); } -void UsageFault_Handler() { +void UsageFault_Handler(void) { furi_crash("UsageFault"); } -void DebugMon_Handler() { +void DebugMon_Handler(void) { } #include "usbd_core.h" @@ -308,36 +308,36 @@ extern usbd_device udev; extern void HW_IPCC_Tx_Handler(); extern void HW_IPCC_Rx_Handler(); -void SysTick_Handler() { +void SysTick_Handler(void) { furi_hal_os_tick(); } -void USB_LP_IRQHandler() { +void USB_LP_IRQHandler(void) { #ifndef FURI_RAM_EXEC usbd_poll(&udev); #endif } -void USB_HP_IRQHandler() { +void USB_HP_IRQHandler(void) { } -void IPCC_C1_TX_IRQHandler() { +void IPCC_C1_TX_IRQHandler(void) { HW_IPCC_Tx_Handler(); } -void IPCC_C1_RX_IRQHandler() { +void IPCC_C1_RX_IRQHandler(void) { HW_IPCC_Rx_Handler(); } -void FPU_IRQHandler() { +void FPU_IRQHandler(void) { furi_crash("FpuFault"); } -void LPTIM1_IRQHandler() { +void LPTIM1_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdLpTim1); } -void LPTIM2_IRQHandler() { +void LPTIM2_IRQHandler(void) { furi_hal_interrupt_call(FuriHalInterruptIdLpTim2); } diff --git a/targets/f7/furi_hal/furi_hal_interrupt.h b/targets/f7/furi_hal/furi_hal_interrupt.h index 03d7850f94d..74bb768ce7d 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.h +++ b/targets/f7/furi_hal/furi_hal_interrupt.h @@ -81,7 +81,7 @@ typedef enum { } FuriHalInterruptPriority; /** Initialize interrupt subsystem */ -void furi_hal_interrupt_init(); +void furi_hal_interrupt_init(void); /** Set ISR and enable interrupt with default priority * diff --git a/targets/f7/furi_hal/furi_hal_light.c b/targets/f7/furi_hal/furi_hal_light.c index 83e1603b75a..b44342b5229 100644 --- a/targets/f7/furi_hal/furi_hal_light.c +++ b/targets/f7/furi_hal/furi_hal_light.c @@ -4,12 +4,12 @@ #include #include -#define LED_CURRENT_RED 50 -#define LED_CURRENT_GREEN 50 -#define LED_CURRENT_BLUE 50 -#define LED_CURRENT_WHITE 150 +#define LED_CURRENT_RED (50u) +#define LED_CURRENT_GREEN (50u) +#define LED_CURRENT_BLUE (50u) +#define LED_CURRENT_WHITE (150u) -void furi_hal_light_init() { +void furi_hal_light_init(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); lp5562_reset(&furi_hal_i2c_handle_power); @@ -64,7 +64,7 @@ void furi_hal_light_blink_start(Light light, uint8_t brightness, uint16_t on_tim furi_hal_i2c_release(&furi_hal_i2c_handle_power); } -void furi_hal_light_blink_stop() { +void furi_hal_light_blink_stop(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); lp5562_set_channel_src( &furi_hal_i2c_handle_power, diff --git a/targets/f7/furi_hal/furi_hal_memory.c b/targets/f7/furi_hal/furi_hal_memory.c index 0d60a3af5b6..780a9d743d8 100644 --- a/targets/f7/furi_hal/furi_hal_memory.c +++ b/targets/f7/furi_hal/furi_hal_memory.c @@ -25,7 +25,7 @@ extern const void __sram2a_start__; extern const void __sram2a_free__; extern const void __sram2b_start__; -void furi_hal_memory_init() { +void furi_hal_memory_init(void) { if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) { return; } @@ -106,7 +106,7 @@ void* furi_hal_memory_alloc(size_t size) { return allocated_memory; } -size_t furi_hal_memory_get_free() { +size_t furi_hal_memory_get_free(void) { if(furi_hal_memory == NULL) return 0; size_t free = 0; @@ -116,7 +116,7 @@ size_t furi_hal_memory_get_free() { return free; } -size_t furi_hal_memory_max_pool_block() { +size_t furi_hal_memory_max_pool_block(void) { if(furi_hal_memory == NULL) return 0; size_t max = 0; diff --git a/targets/f7/furi_hal/furi_hal_mpu.c b/targets/f7/furi_hal/furi_hal_mpu.c index ea6cd55be92..16724c97557 100644 --- a/targets/f7/furi_hal/furi_hal_mpu.c +++ b/targets/f7/furi_hal/furi_hal_mpu.c @@ -7,18 +7,18 @@ #define FURI_HAL_MPU_STACK_PROTECT_REGION FuriHalMPURegionSize32B -void furi_hal_mpu_init() { +void furi_hal_mpu_init(void) { furi_hal_mpu_enable(); // NULL pointer dereference protection furi_hal_mpu_protect_no_access(FuriHalMpuRegionNULL, 0x00, FuriHalMPURegionSize1MB); } -void furi_hal_mpu_enable() { +void furi_hal_mpu_enable(void) { LL_MPU_Enable(LL_MPU_CTRL_PRIVILEGED_DEFAULT); } -void furi_hal_mpu_disable() { +void furi_hal_mpu_disable(void) { LL_MPU_Disable(); } diff --git a/targets/f7/furi_hal/furi_hal_nfc.c b/targets/f7/furi_hal/furi_hal_nfc.c index e8a1033d515..550f1b16efd 100644 --- a/targets/f7/furi_hal/furi_hal_nfc.c +++ b/targets/f7/furi_hal/furi_hal_nfc.c @@ -46,7 +46,7 @@ static FuriHalNfcError furi_hal_nfc_turn_on_osc(FuriHalSpiBusHandle* handle) { return error; } -FuriHalNfcError furi_hal_nfc_is_hal_ready() { +FuriHalNfcError furi_hal_nfc_is_hal_ready(void) { FuriHalNfcError error = FuriHalNfcErrorNone; do { @@ -68,8 +68,8 @@ FuriHalNfcError furi_hal_nfc_is_hal_ready() { return error; } -FuriHalNfcError furi_hal_nfc_init() { - furi_assert(furi_hal_nfc.mutex == NULL); +FuriHalNfcError furi_hal_nfc_init(void) { + furi_check(furi_hal_nfc.mutex == NULL); furi_hal_nfc.mutex = furi_mutex_alloc(FuriMutexTypeNormal); FuriHalNfcError error = FuriHalNfcErrorNone; @@ -252,11 +252,11 @@ FuriHalNfcError furi_hal_nfc_init() { return error; } -static bool furi_hal_nfc_is_mine() { +static bool furi_hal_nfc_is_mine(void) { return (furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id()); } -FuriHalNfcError furi_hal_nfc_acquire() { +FuriHalNfcError furi_hal_nfc_acquire(void) { furi_check(furi_hal_nfc.mutex); furi_hal_spi_acquire(&furi_hal_spi_bus_handle_nfc); @@ -270,7 +270,7 @@ FuriHalNfcError furi_hal_nfc_acquire() { return error; } -FuriHalNfcError furi_hal_nfc_release() { +FuriHalNfcError furi_hal_nfc_release(void) { furi_check(furi_hal_nfc.mutex); furi_check(furi_hal_nfc_is_mine()); furi_check(furi_mutex_release(furi_hal_nfc.mutex) == FuriStatusOk); @@ -280,7 +280,7 @@ FuriHalNfcError furi_hal_nfc_release() { return FuriHalNfcErrorNone; } -FuriHalNfcError furi_hal_nfc_low_power_mode_start() { +FuriHalNfcError furi_hal_nfc_low_power_mode_start(void) { FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -298,7 +298,7 @@ FuriHalNfcError furi_hal_nfc_low_power_mode_start() { return error; } -FuriHalNfcError furi_hal_nfc_low_power_mode_stop() { +FuriHalNfcError furi_hal_nfc_low_power_mode_stop(void) { FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -346,8 +346,8 @@ static FuriHalNfcError furi_hal_nfc_listener_init_common(FuriHalSpiBusHandle* ha } FuriHalNfcError furi_hal_nfc_set_mode(FuriHalNfcMode mode, FuriHalNfcTech tech) { - furi_assert(mode < FuriHalNfcModeNum); - furi_assert(tech < FuriHalNfcTechNum); + furi_check(mode < FuriHalNfcModeNum); + furi_check(tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -373,7 +373,7 @@ FuriHalNfcError furi_hal_nfc_set_mode(FuriHalNfcMode mode, FuriHalNfcTech tech) return error; } -FuriHalNfcError furi_hal_nfc_reset_mode() { +FuriHalNfcError furi_hal_nfc_reset_mode(void) { FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -413,7 +413,7 @@ FuriHalNfcError furi_hal_nfc_reset_mode() { return error; } -FuriHalNfcError furi_hal_nfc_field_detect_start() { +FuriHalNfcError furi_hal_nfc_field_detect_start(void) { FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -427,7 +427,7 @@ FuriHalNfcError furi_hal_nfc_field_detect_start() { return error; } -FuriHalNfcError furi_hal_nfc_field_detect_stop() { +FuriHalNfcError furi_hal_nfc_field_detect_stop(void) { FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -439,7 +439,7 @@ FuriHalNfcError furi_hal_nfc_field_detect_stop() { return error; } -bool furi_hal_nfc_field_is_present() { +bool furi_hal_nfc_field_is_present(void) { bool is_present = false; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -454,7 +454,7 @@ bool furi_hal_nfc_field_is_present() { return is_present; } -FuriHalNfcError furi_hal_nfc_poller_field_on() { +FuriHalNfcError furi_hal_nfc_poller_field_on(void) { FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -479,7 +479,7 @@ FuriHalNfcError furi_hal_nfc_poller_tx_common( FuriHalSpiBusHandle* handle, const uint8_t* tx_data, size_t tx_bits) { - furi_assert(tx_data); + furi_check(tx_data); FuriHalNfcError err = FuriHalNfcErrorNone; @@ -521,40 +521,40 @@ FuriHalNfcError furi_hal_nfc_common_fifo_tx( } FuriHalNfcError furi_hal_nfc_poller_tx(const uint8_t* tx_data, size_t tx_bits) { - furi_assert(furi_hal_nfc.mode == FuriHalNfcModePoller); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); + furi_check(furi_hal_nfc.mode == FuriHalNfcModePoller); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; return furi_hal_nfc_tech[furi_hal_nfc.tech]->poller.tx(handle, tx_data, tx_bits); } FuriHalNfcError furi_hal_nfc_poller_rx(uint8_t* rx_data, size_t rx_data_size, size_t* rx_bits) { - furi_assert(furi_hal_nfc.mode == FuriHalNfcModePoller); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); + furi_check(furi_hal_nfc.mode == FuriHalNfcModePoller); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; return furi_hal_nfc_tech[furi_hal_nfc.tech]->poller.rx(handle, rx_data, rx_data_size, rx_bits); } FuriHalNfcEvent furi_hal_nfc_poller_wait_event(uint32_t timeout_ms) { - furi_assert(furi_hal_nfc.mode == FuriHalNfcModePoller); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); + furi_check(furi_hal_nfc.mode == FuriHalNfcModePoller); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); return furi_hal_nfc_tech[furi_hal_nfc.tech]->poller.wait_event(timeout_ms); } FuriHalNfcEvent furi_hal_nfc_listener_wait_event(uint32_t timeout_ms) { - furi_assert(furi_hal_nfc.mode == FuriHalNfcModeListener); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); + furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.wait_event(timeout_ms); } FuriHalNfcError furi_hal_nfc_listener_tx(const uint8_t* tx_data, size_t tx_bits) { - furi_assert(tx_data); + furi_check(tx_data); - furi_assert(furi_hal_nfc.mode == FuriHalNfcModeListener); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); + furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.tx(handle, tx_data, tx_bits); @@ -575,18 +575,18 @@ FuriHalNfcError furi_hal_nfc_common_fifo_rx( } FuriHalNfcError furi_hal_nfc_listener_rx(uint8_t* rx_data, size_t rx_data_size, size_t* rx_bits) { - furi_assert(rx_data); - furi_assert(rx_bits); + furi_check(rx_data); + furi_check(rx_bits); - furi_assert(furi_hal_nfc.mode == FuriHalNfcModeListener); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); + furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.rx( handle, rx_data, rx_data_size, rx_bits); } -FuriHalNfcError furi_hal_nfc_trx_reset() { +FuriHalNfcError furi_hal_nfc_trx_reset(void) { FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; st25r3916_direct_cmd(handle, ST25R3916_CMD_STOP); @@ -594,25 +594,25 @@ FuriHalNfcError furi_hal_nfc_trx_reset() { return FuriHalNfcErrorNone; } -FuriHalNfcError furi_hal_nfc_listener_sleep() { - furi_assert(furi_hal_nfc.mode == FuriHalNfcModeListener); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); +FuriHalNfcError furi_hal_nfc_listener_sleep(void) { + furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.sleep(handle); } -FuriHalNfcError furi_hal_nfc_listener_idle() { - furi_assert(furi_hal_nfc.mode == FuriHalNfcModeListener); - furi_assert(furi_hal_nfc.tech < FuriHalNfcTechNum); +FuriHalNfcError furi_hal_nfc_listener_idle(void) { + furi_check(furi_hal_nfc.mode == FuriHalNfcModeListener); + furi_check(furi_hal_nfc.tech < FuriHalNfcTechNum); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; return furi_hal_nfc_tech[furi_hal_nfc.tech]->listener.idle(handle); } -FuriHalNfcError furi_hal_nfc_listener_enable_rx() { +FuriHalNfcError furi_hal_nfc_listener_enable_rx(void) { FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; st25r3916_direct_cmd(handle, ST25R3916_CMD_UNMASK_RECEIVE_DATA); diff --git a/targets/f7/furi_hal/furi_hal_nfc_event.c b/targets/f7/furi_hal/furi_hal_nfc_event.c index 266b606fd1b..e434e6a3562 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_event.c +++ b/targets/f7/furi_hal/furi_hal_nfc_event.c @@ -2,12 +2,12 @@ FuriHalNfcEventInternal* furi_hal_nfc_event = NULL; -void furi_hal_nfc_event_init() { +void furi_hal_nfc_event_init(void) { furi_hal_nfc_event = malloc(sizeof(FuriHalNfcEventInternal)); } -FuriHalNfcError furi_hal_nfc_event_start() { - furi_assert(furi_hal_nfc_event); +FuriHalNfcError furi_hal_nfc_event_start(void) { + furi_check(furi_hal_nfc_event); furi_hal_nfc_event->thread = furi_thread_get_current_id(); furi_thread_flags_clear(FURI_HAL_NFC_EVENT_INTERNAL_ALL); @@ -15,8 +15,8 @@ FuriHalNfcError furi_hal_nfc_event_start() { return FuriHalNfcErrorNone; } -FuriHalNfcError furi_hal_nfc_event_stop() { - furi_assert(furi_hal_nfc_event); +FuriHalNfcError furi_hal_nfc_event_stop(void) { + furi_check(furi_hal_nfc_event); furi_hal_nfc_event->thread = NULL; @@ -24,21 +24,21 @@ FuriHalNfcError furi_hal_nfc_event_stop() { } void furi_hal_nfc_event_set(FuriHalNfcEventInternalType event) { - furi_assert(furi_hal_nfc_event); + furi_check(furi_hal_nfc_event); if(furi_hal_nfc_event->thread) { furi_thread_flags_set(furi_hal_nfc_event->thread, event); } } -FuriHalNfcError furi_hal_nfc_abort() { +FuriHalNfcError furi_hal_nfc_abort(void) { furi_hal_nfc_event_set(FuriHalNfcEventInternalTypeAbort); return FuriHalNfcErrorNone; } FuriHalNfcEvent furi_hal_nfc_wait_event_common(uint32_t timeout_ms) { - furi_assert(furi_hal_nfc_event); - furi_assert(furi_hal_nfc_event->thread); + furi_check(furi_hal_nfc_event); + furi_check(furi_hal_nfc_event->thread); FuriHalNfcEvent event = 0; uint32_t event_timeout = timeout_ms == FURI_HAL_NFC_EVENT_WAIT_FOREVER ? FuriWaitForever : @@ -101,8 +101,8 @@ bool furi_hal_nfc_event_wait_for_specific_irq( FuriHalSpiBusHandle* handle, uint32_t mask, uint32_t timeout_ms) { - furi_assert(furi_hal_nfc_event); - furi_assert(furi_hal_nfc_event->thread); + furi_check(furi_hal_nfc_event); + furi_check(furi_hal_nfc_event->thread); bool irq_received = false; uint32_t event_flag = diff --git a/targets/f7/furi_hal/furi_hal_nfc_felica.c b/targets/f7/furi_hal/furi_hal_nfc_felica.c index f762a0ed32b..82239fbc124 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_felica.c +++ b/targets/f7/furi_hal/furi_hal_nfc_felica.c @@ -163,6 +163,9 @@ FuriHalNfcError furi_hal_nfc_felica_listener_set_sensf_res_data( const uint8_t idm_len, const uint8_t* pmm, const uint8_t pmm_len) { + furi_check(idm); + furi_check(pmm); + FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; // Write PT Memory uint8_t pt_memory[19] = {}; diff --git a/targets/f7/furi_hal/furi_hal_nfc_i.h b/targets/f7/furi_hal/furi_hal_nfc_i.h index 53a25644d0d..084196451bd 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_i.h +++ b/targets/f7/furi_hal/furi_hal_nfc_i.h @@ -69,7 +69,7 @@ extern FuriHalNfc furi_hal_nfc; /** * @brief Initialise NFC HAL event system. */ -void furi_hal_nfc_event_init(); +void furi_hal_nfc_event_init(void); /** * @brief Forcibly emit (a) particular internal event(s). @@ -81,22 +81,22 @@ void furi_hal_nfc_event_set(FuriHalNfcEventInternalType event); /** * @brief Initialise GPIO to generate an interrupt from the NFC hardware. */ -void furi_hal_nfc_init_gpio_isr(); +void furi_hal_nfc_init_gpio_isr(void); /** * @brief Disable interrupts from the NFC hardware. */ -void furi_hal_nfc_deinit_gpio_isr(); +void furi_hal_nfc_deinit_gpio_isr(void); /** * @brief Initialise all NFC timers. */ -void furi_hal_nfc_timers_init(); +void furi_hal_nfc_timers_init(void); /** * @brief Disable all NFC timers. */ -void furi_hal_nfc_timers_deinit(); +void furi_hal_nfc_timers_deinit(void); /** * @brief Get the interrupt bitmask from the NFC hardware. diff --git a/targets/f7/furi_hal/furi_hal_nfc_irq.c b/targets/f7/furi_hal/furi_hal_nfc_irq.c index edacc52bfca..90373955f38 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_irq.c +++ b/targets/f7/furi_hal/furi_hal_nfc_irq.c @@ -16,14 +16,14 @@ uint32_t furi_hal_nfc_get_irq(FuriHalSpiBusHandle* handle) { return irq; } -void furi_hal_nfc_init_gpio_isr() { +void furi_hal_nfc_init_gpio_isr(void) { furi_hal_gpio_init( &gpio_nfc_irq_rfid_pull, GpioModeInterruptRise, GpioPullDown, GpioSpeedVeryHigh); furi_hal_gpio_add_int_callback(&gpio_nfc_irq_rfid_pull, furi_hal_nfc_int_callback, NULL); furi_hal_gpio_enable_int_callback(&gpio_nfc_irq_rfid_pull); } -void furi_hal_nfc_deinit_gpio_isr() { +void furi_hal_nfc_deinit_gpio_isr(void) { furi_hal_gpio_remove_int_callback(&gpio_nfc_irq_rfid_pull); furi_hal_gpio_init(&gpio_nfc_irq_rfid_pull, GpioModeAnalog, GpioPullNo, GpioSpeedLow); } diff --git a/targets/f7/furi_hal/furi_hal_nfc_iso14443a.c b/targets/f7/furi_hal/furi_hal_nfc_iso14443a.c index 278ecf38496..1ef23dfa4c5 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_iso14443a.c +++ b/targets/f7/furi_hal/furi_hal_nfc_iso14443a.c @@ -182,7 +182,7 @@ FuriHalNfcError FuriHalNfcError furi_hal_nfc_iso14443a_poller_tx_custom_parity(const uint8_t* tx_data, size_t tx_bits) { - furi_assert(tx_data); + furi_check(tx_data); FuriHalNfcError err = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -215,10 +215,9 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_set_col_res_data( uint8_t uid_len, uint8_t* atqa, uint8_t sak) { - furi_assert(uid); - furi_assert(atqa); - UNUSED(uid_len); - UNUSED(sak); + furi_check(uid); + furi_check(atqa); + FuriHalNfcError error = FuriHalNfcErrorNone; FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; @@ -280,10 +279,10 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_tx_custom_parity( const uint8_t* tx_data, const uint8_t* tx_parity, size_t tx_bits) { - furi_assert(tx_data); - furi_assert(tx_parity); + furi_check(tx_data); + furi_check(tx_parity); - furi_assert(iso14443_3a_signal); + furi_check(iso14443_3a_signal); FuriHalSpiBusHandle* handle = &furi_hal_spi_bus_handle_nfc; diff --git a/targets/f7/furi_hal/furi_hal_nfc_iso15693.c b/targets/f7/furi_hal/furi_hal_nfc_iso15693.c index cc936644b4e..9ab3532f95c 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_iso15693.c +++ b/targets/f7/furi_hal/furi_hal_nfc_iso15693.c @@ -43,7 +43,7 @@ typedef struct { static FuriHalNfcIso15693Listener* furi_hal_nfc_iso15693_listener = NULL; static FuriHalNfcIso15693Poller* furi_hal_nfc_iso15693_poller = NULL; -static FuriHalNfcIso15693Listener* furi_hal_nfc_iso15693_listener_alloc() { +static FuriHalNfcIso15693Listener* furi_hal_nfc_iso15693_listener_alloc(void) { FuriHalNfcIso15693Listener* instance = malloc(sizeof(FuriHalNfcIso15693Listener)); instance->signal = iso15693_signal_alloc(&gpio_spi_r_mosi); @@ -54,7 +54,7 @@ static FuriHalNfcIso15693Listener* furi_hal_nfc_iso15693_listener_alloc() { } static void furi_hal_nfc_iso15693_listener_free(FuriHalNfcIso15693Listener* instance) { - furi_assert(instance); + furi_check(instance); iso15693_signal_free(instance->signal); iso15693_parser_free(instance->parser); @@ -62,14 +62,14 @@ static void furi_hal_nfc_iso15693_listener_free(FuriHalNfcIso15693Listener* inst free(instance); } -static FuriHalNfcIso15693Poller* furi_hal_nfc_iso15693_poller_alloc() { +static FuriHalNfcIso15693Poller* furi_hal_nfc_iso15693_poller_alloc(void) { FuriHalNfcIso15693Poller* instance = malloc(sizeof(FuriHalNfcIso15693Poller)); return instance; } static void furi_hal_nfc_iso15693_poller_free(FuriHalNfcIso15693Poller* instance) { - furi_assert(instance); + furi_check(instance); free(instance); } @@ -113,7 +113,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_common_init(FuriHalSpiBusHandle* ha } static FuriHalNfcError furi_hal_nfc_iso15693_poller_init(FuriHalSpiBusHandle* handle) { - furi_assert(furi_hal_nfc_iso15693_poller == NULL); + furi_check(furi_hal_nfc_iso15693_poller == NULL); furi_hal_nfc_iso15693_poller = furi_hal_nfc_iso15693_poller_alloc(); @@ -143,7 +143,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_poller_init(FuriHalSpiBusHandle* ha static FuriHalNfcError furi_hal_nfc_iso15693_poller_deinit(FuriHalSpiBusHandle* handle) { UNUSED(handle); - furi_assert(furi_hal_nfc_iso15693_poller); + furi_check(furi_hal_nfc_iso15693_poller); furi_hal_nfc_iso15693_poller_free(furi_hal_nfc_iso15693_poller); furi_hal_nfc_iso15693_poller = NULL; @@ -159,7 +159,7 @@ static void iso15693_3_poller_encode_frame( size_t* frame_buf_bits) { static const uint8_t bit_patterns_1_out_of_4[] = {0x02, 0x08, 0x20, 0x80}; size_t frame_buf_size_calc = (tx_bits / 2) + 2; - furi_assert(frame_buf_size >= frame_buf_size_calc); + furi_check(frame_buf_size >= frame_buf_size_calc); // Add SOF 1 out of 4 frame_buf[0] = 0x21; @@ -300,7 +300,7 @@ static void furi_hal_nfc_iso15693_listener_transparent_mode_exit(FuriHalSpiBusHa } static FuriHalNfcError furi_hal_nfc_iso15693_listener_init(FuriHalSpiBusHandle* handle) { - furi_assert(furi_hal_nfc_iso15693_listener == NULL); + furi_check(furi_hal_nfc_iso15693_listener == NULL); furi_hal_nfc_iso15693_listener = furi_hal_nfc_iso15693_listener_alloc(); @@ -329,7 +329,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_listener_init(FuriHalSpiBusHandle* } static FuriHalNfcError furi_hal_nfc_iso15693_listener_deinit(FuriHalSpiBusHandle* handle) { - furi_assert(furi_hal_nfc_iso15693_listener); + furi_check(furi_hal_nfc_iso15693_listener); furi_hal_nfc_iso15693_listener_transparent_mode_exit(handle); @@ -348,7 +348,7 @@ static FuriHalNfcError } static void furi_hal_nfc_iso15693_parser_callback(Iso15693ParserEvent event, void* context) { - furi_assert(context); + furi_check(context); if(event == Iso15693ParserEventDataReceived) { FuriThreadId thread_id = context; @@ -391,7 +391,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_listener_tx( const uint8_t* tx_data, size_t tx_bits) { UNUSED(handle); - furi_assert(furi_hal_nfc_iso15693_listener); + furi_check(furi_hal_nfc_iso15693_listener); FuriHalNfcError error = FuriHalNfcErrorNone; @@ -400,7 +400,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_listener_tx( return error; } -FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof() { +FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof(void) { iso15693_signal_tx_sof(furi_hal_nfc_iso15693_listener->signal, Iso15693SignalDataRateHi); return FuriHalNfcErrorNone; @@ -411,7 +411,7 @@ static FuriHalNfcError furi_hal_nfc_iso15693_listener_rx( uint8_t* rx_data, size_t rx_data_size, size_t* rx_bits) { - furi_assert(furi_hal_nfc_iso15693_listener); + furi_check(furi_hal_nfc_iso15693_listener); UNUSED(handle); if(rx_data_size < diff --git a/targets/f7/furi_hal/furi_hal_nfc_timer.c b/targets/f7/furi_hal/furi_hal_nfc_timer.c index c9de9dfe856..dfc96bf1ad7 100644 --- a/targets/f7/furi_hal/furi_hal_nfc_timer.c +++ b/targets/f7/furi_hal/furi_hal_nfc_timer.c @@ -192,13 +192,13 @@ static void furi_hal_nfc_timer_stop(FuriHalNfcTimer timer) { #endif } -void furi_hal_nfc_timers_init() { +void furi_hal_nfc_timers_init(void) { for(size_t i = 0; i < FuriHalNfcTimerCount; i++) { furi_hal_nfc_timer_init(i); } } -void furi_hal_nfc_timers_deinit() { +void furi_hal_nfc_timers_deinit(void) { for(size_t i = 0; i < FuriHalNfcTimerCount; i++) { furi_hal_nfc_timer_deinit(i); } @@ -208,7 +208,7 @@ void furi_hal_nfc_timer_fwt_start(uint32_t time_fc) { furi_hal_nfc_timer_start_fc(FuriHalNfcTimerFwt, time_fc); } -void furi_hal_nfc_timer_fwt_stop() { +void furi_hal_nfc_timer_fwt_stop(void) { furi_hal_nfc_timer_stop(FuriHalNfcTimerFwt); } @@ -220,10 +220,10 @@ void furi_hal_nfc_timer_block_tx_start_us(uint32_t time_us) { furi_hal_nfc_timer_start_us(FuriHalNfcTimerBlockTx, time_us); } -void furi_hal_nfc_timer_block_tx_stop() { +void furi_hal_nfc_timer_block_tx_stop(void) { furi_hal_nfc_timer_stop(FuriHalNfcTimerBlockTx); } -bool furi_hal_nfc_timer_block_tx_is_running() { +bool furi_hal_nfc_timer_block_tx_is_running(void) { return furi_hal_nfc_timer_is_running(FuriHalNfcTimerBlockTx); } diff --git a/targets/f7/furi_hal/furi_hal_os.c b/targets/f7/furi_hal/furi_hal_os.c index efa760b470d..4738faa7cce 100644 --- a/targets/f7/furi_hal/furi_hal_os.c +++ b/targets/f7/furi_hal/furi_hal_os.c @@ -45,7 +45,7 @@ #ifdef FURI_HAL_OS_DEBUG #include -void furi_hal_os_timer_callback() { +void furi_hal_os_timer_callback(void) { furi_hal_gpio_write( FURI_HAL_OS_DEBUG_SECOND_GPIO, !furi_hal_gpio_read(FURI_HAL_OS_DEBUG_SECOND_GPIO)); } @@ -55,7 +55,7 @@ extern void xPortSysTickHandler(); static volatile uint32_t furi_hal_os_skew; -void furi_hal_os_init() { +void furi_hal_os_init(void) { furi_hal_idle_timer_init(); #ifdef FURI_HAL_OS_DEBUG @@ -72,7 +72,7 @@ void furi_hal_os_init() { FURI_LOG_I(TAG, "Init OK"); } -void furi_hal_os_tick() { +void furi_hal_os_tick(void) { if(xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) { #ifdef FURI_HAL_OS_DEBUG furi_hal_gpio_write( @@ -84,7 +84,7 @@ void furi_hal_os_tick() { #ifdef FURI_HAL_OS_DEBUG // Find out the IRQ number while debugging -static void furi_hal_os_nvic_dbg_trap() { +static void furi_hal_os_nvic_dbg_trap(void) { for(int32_t i = WWDG_IRQn; i <= DMAMUX1_OVR_IRQn; i++) { if(NVIC_GetPendingIRQ(i)) { (void)i; @@ -107,7 +107,7 @@ static void furi_hal_os_exti_dbg_trap(uint32_t exti, uint32_t val) { } #endif -static inline bool furi_hal_os_is_pending_irq() { +static inline bool furi_hal_os_is_pending_irq(void) { if(FURI_HAL_OS_NVIC_IS_PENDING()) { #ifdef FURI_HAL_OS_DEBUG furi_hal_os_nvic_dbg_trap(); diff --git a/targets/f7/furi_hal/furi_hal_os.h b/targets/f7/furi_hal/furi_hal_os.h index e13b2c258c8..f14a3da15eb 100644 --- a/targets/f7/furi_hal/furi_hal_os.h +++ b/targets/f7/furi_hal/furi_hal_os.h @@ -9,11 +9,11 @@ extern "C" { /* Initialize OS helpers * Configure and start tick timer */ -void furi_hal_os_init(); +void furi_hal_os_init(void); /* Advance OS tick counter */ -void furi_hal_os_tick(); +void furi_hal_os_tick(void); #ifdef __cplusplus } diff --git a/targets/f7/furi_hal/furi_hal_power.c b/targets/f7/furi_hal/furi_hal_power.c index f03aea75f75..ccbc521a696 100644 --- a/targets/f7/furi_hal/furi_hal_power.c +++ b/targets/f7/furi_hal/furi_hal_power.c @@ -51,7 +51,7 @@ static volatile FuriHalPower furi_hal_power = { extern const BQ27220DMData furi_hal_power_gauge_data_memory[]; -void furi_hal_power_init() { +void furi_hal_power_init(void) { #ifdef FURI_HAL_POWER_DEBUG furi_hal_gpio_init_simple(FURI_HAL_POWER_DEBUG_WFI_GPIO, GpioModeOutputPushPull); furi_hal_gpio_init_simple(FURI_HAL_POWER_DEBUG_STOP_GPIO, GpioModeOutputPushPull); @@ -107,7 +107,7 @@ void furi_hal_power_init() { FURI_LOG_I(TAG, "Init OK"); } -bool furi_hal_power_gauge_is_ok() { +bool furi_hal_power_gauge_is_ok(void) { bool ret = true; BatteryStatus battery_status; @@ -129,7 +129,7 @@ bool furi_hal_power_gauge_is_ok() { return ret; } -bool furi_hal_power_is_shutdown_requested() { +bool furi_hal_power_is_shutdown_requested(void) { bool ret = false; BatteryStatus battery_status; @@ -145,34 +145,34 @@ bool furi_hal_power_is_shutdown_requested() { return ret; } -uint16_t furi_hal_power_insomnia_level() { +uint16_t furi_hal_power_insomnia_level(void) { return furi_hal_power.insomnia; } -void furi_hal_power_insomnia_enter() { +void furi_hal_power_insomnia_enter(void) { FURI_CRITICAL_ENTER(); - furi_assert(furi_hal_power.insomnia < UINT8_MAX); + furi_check(furi_hal_power.insomnia < UINT8_MAX); furi_hal_power.insomnia++; FURI_CRITICAL_EXIT(); } -void furi_hal_power_insomnia_exit() { +void furi_hal_power_insomnia_exit(void) { FURI_CRITICAL_ENTER(); - furi_assert(furi_hal_power.insomnia > 0); + furi_check(furi_hal_power.insomnia > 0); furi_hal_power.insomnia--; FURI_CRITICAL_EXIT(); } -bool furi_hal_power_sleep_available() { +bool furi_hal_power_sleep_available(void) { return furi_hal_power.insomnia == 0; } -static inline bool furi_hal_power_deep_sleep_available() { +static inline bool furi_hal_power_deep_sleep_available(void) { return furi_hal_bt_is_alive() && !furi_hal_rtc_is_flag_set(FuriHalRtcFlagLegacySleep) && !furi_hal_debug_is_gdb_session_active(); } -static inline void furi_hal_power_light_sleep() { +static inline void furi_hal_power_light_sleep(void) { #ifdef FURI_HAL_POWER_DEBUG furi_hal_gpio_write(FURI_HAL_POWER_DEBUG_WFI_GPIO, 1); #endif @@ -182,17 +182,17 @@ static inline void furi_hal_power_light_sleep() { #endif } -static inline void furi_hal_power_suspend_aux_periphs() { +static inline void furi_hal_power_suspend_aux_periphs(void) { // Disable USART furi_hal_serial_control_suspend(); } -static inline void furi_hal_power_resume_aux_periphs() { +static inline void furi_hal_power_resume_aux_periphs(void) { // Re-enable USART furi_hal_serial_control_resume(); } -static inline void furi_hal_power_deep_sleep() { +static inline void furi_hal_power_deep_sleep(void) { furi_hal_power_suspend_aux_periphs(); if(!furi_hal_clock_switch_pll2hse()) { @@ -260,7 +260,7 @@ static inline void furi_hal_power_deep_sleep() { furi_hal_rtc_sync_shadow(); } -void furi_hal_power_sleep() { +void furi_hal_power_sleep(void) { if(furi_hal_power_deep_sleep_available()) { furi_hal_power_deep_sleep(); } else { @@ -268,35 +268,35 @@ void furi_hal_power_sleep() { } } -uint8_t furi_hal_power_get_pct() { +uint8_t furi_hal_power_get_pct(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); uint8_t ret = bq27220_get_state_of_charge(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -uint8_t furi_hal_power_get_bat_health_pct() { +uint8_t furi_hal_power_get_bat_health_pct(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); uint8_t ret = bq27220_get_state_of_health(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -bool furi_hal_power_is_charging() { +bool furi_hal_power_is_charging(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); bool ret = bq25896_is_charging(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -bool furi_hal_power_is_charging_done() { +bool furi_hal_power_is_charging_done(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); bool ret = bq25896_is_charging_done(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -void furi_hal_power_shutdown() { +void furi_hal_power_shutdown(void) { furi_hal_power_insomnia_enter(); furi_hal_bt_reinit(); @@ -328,7 +328,7 @@ void furi_hal_power_shutdown() { furi_crash("Insomniac core2"); } -void furi_hal_power_off() { +void furi_hal_power_off(void) { // Crutch: shutting down with ext 3V3 off is causing LSE to stop furi_hal_power_enable_external_3_3v(); furi_hal_vibro_on(true); @@ -340,11 +340,11 @@ void furi_hal_power_off() { furi_hal_vibro_on(false); } -void furi_hal_power_reset() { +FURI_NORETURN void furi_hal_power_reset(void) { NVIC_SystemReset(); } -bool furi_hal_power_enable_otg() { +bool furi_hal_power_enable_otg(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); bq25896_set_boost_lim(&furi_hal_i2c_handle_power, BoostLim_2150); bq25896_enable_otg(&furi_hal_i2c_handle_power); @@ -355,20 +355,20 @@ bool furi_hal_power_enable_otg() { return ret; } -void furi_hal_power_disable_otg() { +void furi_hal_power_disable_otg(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); bq25896_disable_otg(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); } -bool furi_hal_power_is_otg_enabled() { +bool furi_hal_power_is_otg_enabled(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); bool ret = bq25896_is_otg_enabled(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -float furi_hal_power_get_battery_charge_voltage_limit() { +float furi_hal_power_get_battery_charge_voltage_limit(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); float ret = (float)bq25896_get_vreg_voltage(&furi_hal_i2c_handle_power) / 1000.0f; furi_hal_i2c_release(&furi_hal_i2c_handle_power); @@ -382,35 +382,35 @@ void furi_hal_power_set_battery_charge_voltage_limit(float voltage) { furi_hal_i2c_release(&furi_hal_i2c_handle_power); } -bool furi_hal_power_check_otg_fault() { +bool furi_hal_power_check_otg_fault(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); bool ret = bq25896_check_otg_fault(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -void furi_hal_power_check_otg_status() { +void furi_hal_power_check_otg_status(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); if(bq25896_check_otg_fault(&furi_hal_i2c_handle_power)) bq25896_disable_otg(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); } -uint32_t furi_hal_power_get_battery_remaining_capacity() { +uint32_t furi_hal_power_get_battery_remaining_capacity(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); uint32_t ret = bq27220_get_remaining_capacity(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -uint32_t furi_hal_power_get_battery_full_capacity() { +uint32_t furi_hal_power_get_battery_full_capacity(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); uint32_t ret = bq27220_get_full_charge_capacity(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -uint32_t furi_hal_power_get_battery_design_capacity() { +uint32_t furi_hal_power_get_battery_design_capacity(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); uint32_t ret = bq27220_get_design_capacity(&furi_hal_i2c_handle_power); furi_hal_i2c_release(&furi_hal_i2c_handle_power); @@ -425,6 +425,8 @@ float furi_hal_power_get_battery_voltage(FuriHalPowerIC ic) { ret = (float)bq25896_get_vbat_voltage(&furi_hal_i2c_handle_power) / 1000.0f; } else if(ic == FuriHalPowerICFuelGauge) { ret = (float)bq27220_get_voltage(&furi_hal_i2c_handle_power) / 1000.0f; + } else { + furi_crash(); } furi_hal_i2c_release(&furi_hal_i2c_handle_power); @@ -439,6 +441,8 @@ float furi_hal_power_get_battery_current(FuriHalPowerIC ic) { ret = (float)bq25896_get_vbat_current(&furi_hal_i2c_handle_power) / 1000.0f; } else if(ic == FuriHalPowerICFuelGauge) { ret = (float)bq27220_get_current(&furi_hal_i2c_handle_power) / 1000.0f; + } else { + furi_crash(); } furi_hal_i2c_release(&furi_hal_i2c_handle_power); @@ -466,22 +470,22 @@ float furi_hal_power_get_battery_temperature(FuriHalPowerIC ic) { return ret; } -float furi_hal_power_get_usb_voltage() { +float furi_hal_power_get_usb_voltage(void) { furi_hal_i2c_acquire(&furi_hal_i2c_handle_power); float ret = (float)bq25896_get_vbus_voltage(&furi_hal_i2c_handle_power) / 1000.0f; furi_hal_i2c_release(&furi_hal_i2c_handle_power); return ret; } -void furi_hal_power_enable_external_3_3v() { +void furi_hal_power_enable_external_3_3v(void) { furi_hal_gpio_write(&gpio_periph_power, 1); } -void furi_hal_power_disable_external_3_3v() { +void furi_hal_power_disable_external_3_3v(void) { furi_hal_gpio_write(&gpio_periph_power, 0); } -void furi_hal_power_suppress_charge_enter() { +void furi_hal_power_suppress_charge_enter(void) { FURI_CRITICAL_ENTER(); bool disable_charging = furi_hal_power.suppress_charge == 0; furi_hal_power.suppress_charge++; @@ -494,7 +498,7 @@ void furi_hal_power_suppress_charge_enter() { } } -void furi_hal_power_suppress_charge_exit() { +void furi_hal_power_suppress_charge_exit(void) { FURI_CRITICAL_ENTER(); furi_hal_power.suppress_charge--; bool enable_charging = furi_hal_power.suppress_charge == 0; @@ -508,7 +512,7 @@ void furi_hal_power_suppress_charge_exit() { } void furi_hal_power_info_get(PropertyValueCallback out, char sep, void* context) { - furi_assert(out); + furi_check(out); FuriString* value = furi_string_alloc(); FuriString* key = furi_string_alloc(); @@ -581,7 +585,7 @@ void furi_hal_power_info_get(PropertyValueCallback out, char sep, void* context) } void furi_hal_power_debug_get(PropertyValueCallback out, void* context) { - furi_assert(out); + furi_check(out); FuriString* value = furi_string_alloc(); FuriString* key = furi_string_alloc(); diff --git a/targets/f7/furi_hal/furi_hal_pwm.c b/targets/f7/furi_hal/furi_hal_pwm.c index 879460e6bd5..4828cefbb9f 100644 --- a/targets/f7/furi_hal/furi_hal_pwm.c +++ b/targets/f7/furi_hal/furi_hal_pwm.c @@ -69,6 +69,8 @@ void furi_hal_pwm_start(FuriHalPwmOutputId channel, uint32_t freq, uint8_t duty) furi_hal_pwm_set_params(channel, freq, duty); LL_LPTIM_StartCounter(LPTIM2, LL_LPTIM_OPERATING_MODE_CONTINUOUS); + } else { + furi_crash(); } } @@ -79,6 +81,8 @@ void furi_hal_pwm_stop(FuriHalPwmOutputId channel) { } else if(channel == FuriHalPwmOutputIdLptim2PA4) { furi_hal_gpio_init_simple(&gpio_ext_pa4, GpioModeAnalog); furi_hal_bus_disable(FuriHalBusLPTIM2); + } else { + furi_crash(); } } @@ -88,7 +92,8 @@ bool furi_hal_pwm_is_running(FuriHalPwmOutputId channel) { } else if(channel == FuriHalPwmOutputIdLptim2PA4) { return furi_hal_bus_is_enabled(FuriHalBusLPTIM2); } - return false; + + furi_crash(); } void furi_hal_pwm_set_params(FuriHalPwmOutputId channel, uint32_t freq, uint8_t duty) { @@ -134,5 +139,7 @@ void furi_hal_pwm_set_params(FuriHalPwmOutputId channel, uint32_t freq, uint8_t } else { LL_RCC_SetLPTIMClockSource(LL_RCC_LPTIM2_CLKSOURCE_PCLK1); } + } else { + furi_crash(); } } diff --git a/targets/f7/furi_hal/furi_hal_random.c b/targets/f7/furi_hal/furi_hal_random.c index 225519303b1..fd557fa98fd 100644 --- a/targets/f7/furi_hal/furi_hal_random.c +++ b/targets/f7/furi_hal/furi_hal_random.c @@ -10,7 +10,7 @@ #define TAG "FuriHalRandom" -static uint32_t furi_hal_random_read_rng() { +static uint32_t furi_hal_random_read_rng(void) { while(LL_RNG_IsActiveFlag_CECS(RNG) && LL_RNG_IsActiveFlag_SECS(RNG) && !LL_RNG_IsActiveFlag_DRDY(RNG)) { /* Error handling as described in RM0434, pg. 582-583 */ @@ -33,12 +33,12 @@ static uint32_t furi_hal_random_read_rng() { return LL_RNG_ReadRandData32(RNG); } -void furi_hal_random_init() { +void furi_hal_random_init(void) { furi_hal_bus_enable(FuriHalBusRNG); LL_RCC_SetRNGClockSource(LL_RCC_RNG_CLKSOURCE_CLK48); } -uint32_t furi_hal_random_get() { +uint32_t furi_hal_random_get(void) { while(LL_HSEM_1StepLock(HSEM, CFG_HW_RNG_SEMID)) ; LL_RNG_Enable(RNG); @@ -53,6 +53,9 @@ uint32_t furi_hal_random_get() { } void furi_hal_random_fill_buf(uint8_t* buf, uint32_t len) { + furi_check(buf); + furi_check(len); + while(LL_HSEM_1StepLock(HSEM, CFG_HW_RNG_SEMID)) ; LL_RNG_Enable(RNG); @@ -71,10 +74,10 @@ void srand(unsigned seed) { UNUSED(seed); } -int rand() { +int rand(void) { return (furi_hal_random_get() & RAND_MAX); } -long random() { +long random(void) { return (furi_hal_random_get() & RAND_MAX); } diff --git a/targets/f7/furi_hal/furi_hal_region.c b/targets/f7/furi_hal/furi_hal_region.c index 143d5c18c2f..26eda5b7b8a 100644 --- a/targets/f7/furi_hal/furi_hal_region.c +++ b/targets/f7/furi_hal/furi_hal_region.c @@ -1,5 +1,6 @@ #include #include +#include const FuriHalRegion furi_hal_region_zero = { .country_code = "00", @@ -72,7 +73,7 @@ const FuriHalRegion furi_hal_region_jp = { static const FuriHalRegion* furi_hal_region = NULL; -void furi_hal_region_init() { +void furi_hal_region_init(void) { FuriHalVersionRegion region = furi_hal_version_get_hw_region(); if(region == FuriHalVersionRegionUnknown) { @@ -86,19 +87,21 @@ void furi_hal_region_init() { } } -const FuriHalRegion* furi_hal_region_get() { +const FuriHalRegion* furi_hal_region_get(void) { return furi_hal_region; } void furi_hal_region_set(FuriHalRegion* region) { + furi_check(region); + furi_hal_region = region; } -bool furi_hal_region_is_provisioned() { +bool furi_hal_region_is_provisioned(void) { return furi_hal_region != NULL; } -const char* furi_hal_region_get_name() { +const char* furi_hal_region_get_name(void) { if(furi_hal_region) { return furi_hal_region->country_code; } else { diff --git a/targets/f7/furi_hal/furi_hal_resources.c b/targets/f7/furi_hal/furi_hal_resources.c index fe4640d5bb1..b98d93769d9 100644 --- a/targets/f7/furi_hal/furi_hal_resources.c +++ b/targets/f7/furi_hal/furi_hal_resources.c @@ -125,7 +125,7 @@ static void furi_hal_resources_init_gpio_pins(GpioMode mode) { } } -void furi_hal_resources_init_early() { +void furi_hal_resources_init_early(void) { furi_hal_bus_enable(FuriHalBusGPIOA); furi_hal_bus_enable(FuriHalBusGPIOB); furi_hal_bus_enable(FuriHalBusGPIOC); @@ -172,7 +172,7 @@ void furi_hal_resources_init_early() { furi_hal_resources_init_gpio_pins(GpioModeAnalog); } -void furi_hal_resources_deinit_early() { +void furi_hal_resources_deinit_early(void) { furi_hal_resources_init_input_pins(GpioModeAnalog); furi_hal_bus_disable(FuriHalBusGPIOA); furi_hal_bus_disable(FuriHalBusGPIOB); @@ -182,7 +182,7 @@ void furi_hal_resources_deinit_early() { furi_hal_bus_disable(FuriHalBusGPIOH); } -void furi_hal_resources_init() { +void furi_hal_resources_init(void) { // Button pins furi_hal_resources_init_input_pins(GpioModeInterruptRiseFall); diff --git a/targets/f7/furi_hal/furi_hal_resources.h b/targets/f7/furi_hal/furi_hal_resources.h index 6ca6f9df015..bb01b9bcdd7 100644 --- a/targets/f7/furi_hal/furi_hal_resources.h +++ b/targets/f7/furi_hal/furi_hal_resources.h @@ -214,11 +214,11 @@ extern const GpioPin gpio_usb_dp; #define NFC_IRQ_Pin RFID_PULL_Pin #define NFC_IRQ_GPIO_Port RFID_PULL_GPIO_Port -void furi_hal_resources_init_early(); +void furi_hal_resources_init_early(void); -void furi_hal_resources_deinit_early(); +void furi_hal_resources_deinit_early(void); -void furi_hal_resources_init(); +void furi_hal_resources_init(void); /** * Get a corresponding external connector pin number for a gpio diff --git a/targets/f7/furi_hal/furi_hal_rfid.c b/targets/f7/furi_hal/furi_hal_rfid.c index c409329227a..07ea5ab0a7c 100644 --- a/targets/f7/furi_hal/furi_hal_rfid.c +++ b/targets/f7/furi_hal/furi_hal_rfid.c @@ -67,8 +67,8 @@ FuriHalRfid* furi_hal_rfid = NULL; #define LFRFID_LL_EMULATE_TIM TIM2 #define LFRFID_LL_EMULATE_CHANNEL LL_TIM_CHANNEL_CH3 -void furi_hal_rfid_init() { - furi_assert(furi_hal_rfid == NULL); +void furi_hal_rfid_init(void) { + furi_check(furi_hal_rfid == NULL); furi_hal_rfid = malloc(sizeof(FuriHalRfid)); furi_hal_rfid->field.counter = 0; furi_hal_rfid->field.set_tim_counter_cnt = 0; @@ -95,7 +95,7 @@ void furi_hal_rfid_init() { NVIC_EnableIRQ(COMP_IRQn); } -void furi_hal_rfid_pins_reset() { +void furi_hal_rfid_pins_reset(void) { // ibutton bus disable furi_hal_ibutton_pin_reset(); @@ -112,7 +112,7 @@ void furi_hal_rfid_pins_reset() { furi_hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioPullNo, GpioSpeedLow); } -static void furi_hal_rfid_pins_emulate() { +static void furi_hal_rfid_pins_emulate(void) { // ibutton low furi_hal_ibutton_pin_configure(); furi_hal_ibutton_pin_write(false); @@ -133,7 +133,7 @@ static void furi_hal_rfid_pins_emulate() { &gpio_rfid_carrier, GpioModeAltFunctionPushPull, GpioPullNo, GpioSpeedLow, GpioAltFn2TIM2); } -static void furi_hal_rfid_pins_read() { +static void furi_hal_rfid_pins_read(void) { // ibutton low furi_hal_ibutton_pin_configure(); furi_hal_ibutton_pin_write(false); @@ -154,7 +154,7 @@ static void furi_hal_rfid_pins_read() { furi_hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioPullNo, GpioSpeedLow); } -static void furi_hal_rfid_pins_field() { +static void furi_hal_rfid_pins_field(void) { // ibutton low furi_hal_ibutton_pin_configure(); furi_hal_ibutton_pin_write(false); @@ -171,11 +171,11 @@ static void furi_hal_rfid_pins_field() { &gpio_rfid_carrier, GpioModeAltFunctionPushPull, GpioPullNo, GpioSpeedLow, GpioAltFn2TIM2); } -void furi_hal_rfid_pin_pull_release() { +void furi_hal_rfid_pin_pull_release(void) { furi_hal_gpio_write(&gpio_nfc_irq_rfid_pull, true); } -void furi_hal_rfid_pin_pull_pulldown() { +void furi_hal_rfid_pin_pull_pulldown(void) { furi_hal_gpio_write(&gpio_nfc_irq_rfid_pull, false); } @@ -201,19 +201,19 @@ void furi_hal_rfid_tim_read_start(float freq, float duty_cycle) { furi_hal_rfid_tim_read_continue(); } -void furi_hal_rfid_tim_read_continue() { +void furi_hal_rfid_tim_read_continue(void) { LL_TIM_EnableAllOutputs(FURI_HAL_RFID_READ_TIMER); } -void furi_hal_rfid_tim_read_pause() { +void furi_hal_rfid_tim_read_pause(void) { LL_TIM_DisableAllOutputs(FURI_HAL_RFID_READ_TIMER); } -void furi_hal_rfid_tim_read_stop() { +void furi_hal_rfid_tim_read_stop(void) { furi_hal_bus_disable(FURI_HAL_RFID_READ_TIMER_BUS); } -static void furi_hal_rfid_tim_emulate() { +static void furi_hal_rfid_tim_emulate(void) { LL_TIM_SetPrescaler(FURI_HAL_RFID_EMULATE_TIMER, 0); LL_TIM_SetCounterMode(FURI_HAL_RFID_EMULATE_TIMER, LL_TIM_COUNTERMODE_UP); LL_TIM_SetAutoReload(FURI_HAL_RFID_EMULATE_TIMER, 1); @@ -258,7 +258,7 @@ static void furi_hal_capture_dma_isr(void* context) { } void furi_hal_rfid_tim_read_capture_start(FuriHalRfidReadCaptureCallback callback, void* context) { - furi_assert(furi_hal_rfid); + furi_check(furi_hal_rfid); furi_hal_rfid->read_capture_callback = callback; furi_hal_rfid->context = context; @@ -308,7 +308,7 @@ void furi_hal_rfid_tim_read_capture_start(FuriHalRfidReadCaptureCallback callbac furi_hal_rfid_comp_start(); } -void furi_hal_rfid_tim_read_capture_stop() { +void furi_hal_rfid_tim_read_capture_stop(void) { furi_hal_rfid_comp_stop(); furi_hal_interrupt_set_isr(FURI_HAL_RFID_EMULATE_TIMER_IRQ, NULL, NULL); @@ -338,7 +338,7 @@ void furi_hal_rfid_tim_emulate_dma_start( size_t length, FuriHalRfidDMACallback callback, void* context) { - furi_assert(furi_hal_rfid); + furi_check(furi_hal_rfid); // setup interrupts furi_hal_rfid->dma_callback = callback; @@ -401,7 +401,7 @@ void furi_hal_rfid_tim_emulate_dma_start( LL_TIM_EnableCounter(FURI_HAL_RFID_EMULATE_TIMER); } -void furi_hal_rfid_tim_emulate_dma_stop() { +void furi_hal_rfid_tim_emulate_dma_stop(void) { LL_TIM_DisableCounter(FURI_HAL_RFID_EMULATE_TIMER); LL_TIM_DisableAllOutputs(FURI_HAL_RFID_EMULATE_TIMER); @@ -431,7 +431,7 @@ void furi_hal_rfid_set_read_pulse(uint32_t pulse) { #endif } -void furi_hal_rfid_comp_start() { +void furi_hal_rfid_comp_start(void) { LL_COMP_Enable(COMP1); // Magic uint32_t wait_loop_index = ((80 / 10UL) * ((SystemCoreClock / (100000UL * 2UL)) + 1UL)); @@ -440,7 +440,7 @@ void furi_hal_rfid_comp_start() { } } -void furi_hal_rfid_comp_stop() { +void furi_hal_rfid_comp_stop(void) { LL_COMP_Disable(COMP1); } @@ -456,7 +456,7 @@ void furi_hal_rfid_comp_set_callback(FuriHalRfidCompCallback callback, void* con } /* Comparator trigger event */ -void COMP_IRQHandler() { +void COMP_IRQHandler(void) { if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_20)) { LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_20); } @@ -467,7 +467,7 @@ void COMP_IRQHandler() { } } -static void furi_hal_rfid_field_tim_setup() { +static void furi_hal_rfid_field_tim_setup(void) { // setup timer counter furi_hal_bus_enable(FURI_HAL_RFID_FIELD_COUNTER_TIMER_BUS); @@ -582,6 +582,8 @@ void furi_hal_rfid_field_detect_stop(void) { } 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) && diff --git a/targets/f7/furi_hal/furi_hal_rfid.h b/targets/f7/furi_hal/furi_hal_rfid.h index 7087ba991fa..216e0d98c71 100644 --- a/targets/f7/furi_hal/furi_hal_rfid.h +++ b/targets/f7/furi_hal/furi_hal_rfid.h @@ -15,19 +15,19 @@ extern "C" { /** Initialize RFID subsystem */ -void furi_hal_rfid_init(); +void furi_hal_rfid_init(void); /** Config rfid pins to reset state */ -void furi_hal_rfid_pins_reset(); +void furi_hal_rfid_pins_reset(void); /** Release rfid pull pin */ -void furi_hal_rfid_pin_pull_release(); +void furi_hal_rfid_pin_pull_release(void); /** Pulldown rfid pull pin */ -void furi_hal_rfid_pin_pull_pulldown(); +void furi_hal_rfid_pin_pull_pulldown(void); /** Start read timer * @param freq timer frequency @@ -37,21 +37,21 @@ void furi_hal_rfid_tim_read_start(float freq, float duty_cycle); /** Pause read timer, to be able to continue later */ -void furi_hal_rfid_tim_read_pause(); +void furi_hal_rfid_tim_read_pause(void); /** Continue read timer */ -void furi_hal_rfid_tim_read_continue(); +void furi_hal_rfid_tim_read_continue(void); /** Stop read timer */ -void furi_hal_rfid_tim_read_stop(); +void furi_hal_rfid_tim_read_stop(void); typedef void (*FuriHalRfidReadCaptureCallback)(bool level, uint32_t duration, void* context); void furi_hal_rfid_tim_read_capture_start(FuriHalRfidReadCaptureCallback callback, void* context); -void furi_hal_rfid_tim_read_capture_stop(); +void furi_hal_rfid_tim_read_capture_stop(void); typedef void (*FuriHalRfidDMACallback)(bool half, void* context); @@ -62,7 +62,7 @@ void furi_hal_rfid_tim_emulate_dma_start( FuriHalRfidDMACallback callback, void* context); -void furi_hal_rfid_tim_emulate_dma_stop(); +void furi_hal_rfid_tim_emulate_dma_stop(void); /** Set read timer period * @@ -77,10 +77,10 @@ void furi_hal_rfid_set_read_period(uint32_t period); void furi_hal_rfid_set_read_pulse(uint32_t pulse); /** Start/Enable comparator */ -void furi_hal_rfid_comp_start(); +void furi_hal_rfid_comp_start(void); /** Stop/Disable comparator */ -void furi_hal_rfid_comp_stop(); +void furi_hal_rfid_comp_stop(void); typedef void (*FuriHalRfidCompCallback)(bool level, void* context); @@ -88,10 +88,10 @@ typedef void (*FuriHalRfidCompCallback)(bool level, void* context); void furi_hal_rfid_comp_set_callback(FuriHalRfidCompCallback callback, void* context); /** Start/Enable Field Presence detect */ -void furi_hal_rfid_field_detect_start(); +void furi_hal_rfid_field_detect_start(void); /** Stop/Disable Field Presence detect */ -void furi_hal_rfid_field_detect_stop(); +void furi_hal_rfid_field_detect_stop(void); /** Check Field Presence * diff --git a/targets/f7/furi_hal/furi_hal_rtc.c b/targets/f7/furi_hal/furi_hal_rtc.c index cd4fa8b9b30..a1c8b46c348 100644 --- a/targets/f7/furi_hal/furi_hal_rtc.c +++ b/targets/f7/furi_hal/furi_hal_rtc.c @@ -60,12 +60,12 @@ static const uint32_t furi_hal_rtc_log_baud_rates[] = { [FuriHalRtcLogBaudRate1843200] = 1843200, }; -static void furi_hal_rtc_reset() { +static void furi_hal_rtc_reset(void) { LL_RCC_ForceBackupDomainReset(); LL_RCC_ReleaseBackupDomainReset(); } -static bool furi_hal_rtc_start_clock_and_switch() { +static bool furi_hal_rtc_start_clock_and_switch(void) { // Clock operation require access to Backup Domain LL_PWR_EnableBkUpAccess(); @@ -90,7 +90,7 @@ static bool furi_hal_rtc_start_clock_and_switch() { } } -static void furi_hal_rtc_recover() { +static void furi_hal_rtc_recover(void) { DateTime datetime = {0}; // Handle fixable LSE failure @@ -127,7 +127,7 @@ static void furi_hal_rtc_recover() { } } -void furi_hal_rtc_init_early() { +void furi_hal_rtc_init_early(void) { // Enable RTCAPB clock LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_RTCAPB); @@ -151,10 +151,10 @@ void furi_hal_rtc_init_early() { } } -void furi_hal_rtc_deinit_early() { +void furi_hal_rtc_deinit_early(void) { } -void furi_hal_rtc_init() { +void furi_hal_rtc_init(void) { LL_RTC_InitTypeDef RTC_InitStruct; RTC_InitStruct.HourFormat = LL_RTC_HOURFORMAT_24HOUR; RTC_InitStruct.AsynchPrescaler = 127; @@ -169,7 +169,7 @@ void furi_hal_rtc_init() { FURI_LOG_I(TAG, "Init OK"); } -void furi_hal_rtc_sync_shadow() { +void furi_hal_rtc_sync_shadow(void) { if(!LL_RTC_IsShadowRegBypassEnabled(RTC)) { LL_RTC_ClearFlag_RS(RTC); while(!LL_RTC_IsActiveFlag_RS(RTC)) { @@ -177,7 +177,7 @@ void furi_hal_rtc_sync_shadow() { } } -void furi_hal_rtc_reset_registers() { +void furi_hal_rtc_reset_registers(void) { for(size_t i = 0; i < RTC_BKP_NUMBER; i++) { furi_hal_rtc_set_register(i, 0); } @@ -205,7 +205,7 @@ void furi_hal_rtc_set_log_level(uint8_t level) { furi_log_set_level(level); } -uint8_t furi_hal_rtc_get_log_level() { +uint8_t furi_hal_rtc_get_log_level(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->log_level; @@ -222,7 +222,7 @@ void furi_hal_rtc_set_log_device(FuriHalRtcLogDevice device) { furi_hal_rtc_log_baud_rates[furi_hal_rtc_get_log_baud_rate()]); } -FuriHalRtcLogDevice furi_hal_rtc_get_log_device() { +FuriHalRtcLogDevice furi_hal_rtc_get_log_device(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->log_device; @@ -239,7 +239,7 @@ void furi_hal_rtc_set_log_baud_rate(FuriHalRtcLogBaudRate baud_rate) { furi_hal_rtc_log_baud_rates[furi_hal_rtc_get_log_baud_rate()]); } -FuriHalRtcLogBaudRate furi_hal_rtc_get_log_baud_rate() { +FuriHalRtcLogBaudRate furi_hal_rtc_get_log_baud_rate(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->log_baud_rate; @@ -280,7 +280,7 @@ void furi_hal_rtc_set_boot_mode(FuriHalRtcBootMode mode) { furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } -FuriHalRtcBootMode furi_hal_rtc_get_boot_mode() { +FuriHalRtcBootMode furi_hal_rtc_get_boot_mode(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->boot_mode; @@ -293,7 +293,7 @@ void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode) { furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } -FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode() { +FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->heap_track_mode; @@ -306,7 +306,7 @@ void furi_hal_rtc_set_locale_units(FuriHalRtcLocaleUnits value) { furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } -FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units() { +FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->locale_units; @@ -319,7 +319,7 @@ void furi_hal_rtc_set_locale_timeformat(FuriHalRtcLocaleTimeFormat value) { furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } -FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat() { +FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->locale_timeformat; @@ -332,7 +332,7 @@ void furi_hal_rtc_set_locale_dateformat(FuriHalRtcLocaleDateFormat value) { furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg); } -FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat() { +FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat(void) { uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem); SystemReg* data = (SystemReg*)&data_reg; return data->locale_dateformat; @@ -340,7 +340,7 @@ FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat() { void furi_hal_rtc_set_datetime(DateTime* datetime) { furi_check(!FURI_IS_IRQ_MODE()); - furi_assert(datetime); + furi_check(datetime); FURI_CRITICAL_ENTER(); /* Disable write protection */ @@ -379,7 +379,7 @@ void furi_hal_rtc_set_datetime(DateTime* datetime) { void furi_hal_rtc_get_datetime(DateTime* datetime) { furi_check(!FURI_IS_IRQ_MODE()); - furi_assert(datetime); + furi_check(datetime); FURI_CRITICAL_ENTER(); uint32_t time = LL_RTC_TIME_Get(RTC); // 0x00HHMMSS @@ -399,7 +399,7 @@ void furi_hal_rtc_set_fault_data(uint32_t value) { furi_hal_rtc_set_register(FuriHalRtcRegisterFaultData, value); } -uint32_t furi_hal_rtc_get_fault_data() { +uint32_t furi_hal_rtc_get_fault_data(void) { return furi_hal_rtc_get_register(FuriHalRtcRegisterFaultData); } @@ -407,11 +407,11 @@ void furi_hal_rtc_set_pin_fails(uint32_t value) { furi_hal_rtc_set_register(FuriHalRtcRegisterPinFails, value); } -uint32_t furi_hal_rtc_get_pin_fails() { +uint32_t furi_hal_rtc_get_pin_fails(void) { return furi_hal_rtc_get_register(FuriHalRtcRegisterPinFails); } -uint32_t furi_hal_rtc_get_timestamp() { +uint32_t furi_hal_rtc_get_timestamp(void) { DateTime datetime = {0}; furi_hal_rtc_get_datetime(&datetime); return datetime_datetime_to_timestamp(&datetime); diff --git a/targets/f7/furi_hal/furi_hal_rtc.h b/targets/f7/furi_hal/furi_hal_rtc.h index 353bd349464..3bdbb0c7290 100644 --- a/targets/f7/furi_hal/furi_hal_rtc.h +++ b/targets/f7/furi_hal/furi_hal_rtc.h @@ -100,7 +100,7 @@ void furi_hal_rtc_init(void); void furi_hal_rtc_sync_shadow(void); /** Reset ALL RTC registers content */ -void furi_hal_rtc_reset_registers(); +void furi_hal_rtc_reset_registers(void); /** Get RTC register content * diff --git a/targets/f7/furi_hal/furi_hal_sd.c b/targets/f7/furi_hal/furi_hal_sd.c index 619f6f890df..fb7f43ec8d4 100644 --- a/targets/f7/furi_hal/furi_hal_sd.c +++ b/targets/f7/furi_hal/furi_hal_sd.c @@ -206,17 +206,17 @@ typedef struct { /** Pointer to currently used SPI Handle */ FuriHalSpiBusHandle* furi_hal_sd_spi_handle = NULL; -static inline void sd_spi_select_card() { +static inline void sd_spi_select_card(void) { furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, false); furi_delay_us(10); // Entry guard time for some SD cards } -static inline void sd_spi_deselect_card() { +static inline void sd_spi_deselect_card(void) { furi_delay_us(10); // Exit guard time for some SD cards furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, true); } -static void sd_spi_bus_to_ground() { +static void sd_spi_bus_to_ground(void) { furi_hal_gpio_init_ex( furi_hal_sd_spi_handle->miso, GpioModeOutputPushPull, @@ -242,7 +242,7 @@ static void sd_spi_bus_to_ground() { furi_hal_gpio_write(furi_hal_sd_spi_handle->sck, false); } -static void sd_spi_bus_rise_up() { +static void sd_spi_bus_rise_up(void) { sd_spi_deselect_card(); furi_hal_gpio_init_ex( @@ -329,12 +329,12 @@ static FuriStatus sd_spi_wait_for_data(uint8_t data, uint32_t timeout_ms) { return FuriStatusOk; } -static inline void sd_spi_deselect_card_and_purge() { +static inline void sd_spi_deselect_card_and_purge(void) { sd_spi_deselect_card(); sd_spi_read_byte(); } -static inline void sd_spi_purge_crc() { +static inline void sd_spi_purge_crc(void) { sd_spi_read_byte(); sd_spi_read_byte(); } @@ -833,7 +833,7 @@ static inline void sd_cache_invalidate_range(uint32_t start_sector, uint32_t end sector_cache_invalidate_range(start_sector, end_sector); } -static inline void sd_cache_invalidate_all() { +static inline void sd_cache_invalidate_all(void) { sector_cache_init(); } @@ -907,7 +907,7 @@ bool furi_hal_sd_is_present(void) { return result; } -uint8_t furi_hal_sd_max_mount_retry_count() { +uint8_t furi_hal_sd_max_mount_retry_count(void) { return 10; } @@ -972,6 +972,8 @@ FuriStatus furi_hal_sd_get_card_state(void) { } FuriStatus furi_hal_sd_read_blocks(uint32_t* buff, uint32_t sector, uint32_t count) { + furi_check(buff); + FuriStatus status; bool single_sector = count == 1; @@ -1009,6 +1011,8 @@ FuriStatus furi_hal_sd_read_blocks(uint32_t* buff, uint32_t sector, uint32_t cou } FuriStatus furi_hal_sd_write_blocks(const uint32_t* buff, uint32_t sector, uint32_t count) { + furi_check(buff); + FuriStatus status; sd_cache_invalidate_range(sector, sector + count); @@ -1037,6 +1041,8 @@ FuriStatus furi_hal_sd_write_blocks(const uint32_t* buff, uint32_t sector, uint3 } FuriStatus furi_hal_sd_info(FuriHalSdInfo* info) { + furi_check(info); + FuriStatus status; SD_CSD csd; SD_CID cid; diff --git a/targets/f7/furi_hal/furi_hal_serial.c b/targets/f7/furi_hal/furi_hal_serial.c index e0e2d8d52b9..f26b412d2d5 100644 --- a/targets/f7/furi_hal/furi_hal_serial.c +++ b/targets/f7/furi_hal/furi_hal_serial.c @@ -658,6 +658,7 @@ void furi_hal_serial_resume(FuriHalSerialHandle* handle) { void furi_hal_serial_tx(FuriHalSerialHandle* handle, const uint8_t* buffer, size_t buffer_size) { furi_check(handle); + if(handle->id == FuriHalSerialIdUsart) { if(LL_USART_IsEnabled(USART1) == 0) return; @@ -787,7 +788,7 @@ void furi_hal_serial_async_rx_stop(FuriHalSerialHandle* handle) { bool furi_hal_serial_async_rx_available(FuriHalSerialHandle* handle) { furi_check(FURI_IS_IRQ_MODE()); - furi_assert(handle->id < FuriHalSerialIdMax); + furi_check(handle->id < FuriHalSerialIdMax); if(handle->id == FuriHalSerialIdUsart) { return LL_USART_IsActiveFlag_RXNE_RXFNE(USART1); @@ -798,7 +799,7 @@ bool furi_hal_serial_async_rx_available(FuriHalSerialHandle* handle) { uint8_t furi_hal_serial_async_rx(FuriHalSerialHandle* handle) { furi_check(FURI_IS_IRQ_MODE()); - furi_assert(handle->id < FuriHalSerialIdMax); + furi_check(handle->id < FuriHalSerialIdMax); if(handle->id == FuriHalSerialIdUsart) { return LL_USART_ReceiveData8(USART1); @@ -841,7 +842,7 @@ static uint8_t furi_hal_serial_dma_rx_read_byte(FuriHalSerialHandle* handle) { size_t furi_hal_serial_dma_rx(FuriHalSerialHandle* handle, uint8_t* data, size_t len) { furi_check(FURI_IS_IRQ_MODE()); - furi_assert(furi_hal_serial[handle->id].buffer_rx_ptr != NULL); + furi_check(furi_hal_serial[handle->id].buffer_rx_ptr != NULL); size_t i = 0; size_t available = furi_hal_serial_dma_bytes_available(handle->id); if(available < len) { diff --git a/targets/f7/furi_hal/furi_hal_speaker.c b/targets/f7/furi_hal/furi_hal_speaker.c index ad7ed994af2..0aa8ce951a2 100644 --- a/targets/f7/furi_hal/furi_hal_speaker.c +++ b/targets/f7/furi_hal/furi_hal_speaker.c @@ -18,13 +18,13 @@ static FuriMutex* furi_hal_speaker_mutex = NULL; // #define FURI_HAL_SPEAKER_NEW_VOLUME -void furi_hal_speaker_init() { +void furi_hal_speaker_init(void) { furi_assert(furi_hal_speaker_mutex == NULL); furi_hal_speaker_mutex = furi_mutex_alloc(FuriMutexTypeNormal); FURI_LOG_I(TAG, "Init OK"); } -void furi_hal_speaker_deinit() { +void furi_hal_speaker_deinit(void) { furi_check(furi_hal_speaker_mutex != NULL); furi_mutex_free(furi_hal_speaker_mutex); furi_hal_speaker_mutex = NULL; @@ -44,7 +44,7 @@ bool furi_hal_speaker_acquire(uint32_t timeout) { } } -void furi_hal_speaker_release() { +void furi_hal_speaker_release(void) { furi_check(!FURI_IS_IRQ_MODE()); furi_check(furi_hal_speaker_is_mine()); @@ -57,7 +57,7 @@ void furi_hal_speaker_release() { furi_check(furi_mutex_release(furi_hal_speaker_mutex) == FuriStatusOk); } -bool furi_hal_speaker_is_mine() { +bool furi_hal_speaker_is_mine(void) { return (FURI_IS_IRQ_MODE()) || (furi_mutex_get_owner(furi_hal_speaker_mutex) == furi_thread_get_current_id()); } @@ -132,7 +132,7 @@ void furi_hal_speaker_set_volume(float volume) { #endif } -void furi_hal_speaker_stop() { +void furi_hal_speaker_stop(void) { furi_check(furi_hal_speaker_is_mine()); LL_TIM_DisableAllOutputs(FURI_HAL_SPEAKER_TIMER); LL_TIM_DisableCounter(FURI_HAL_SPEAKER_TIMER); diff --git a/targets/f7/furi_hal/furi_hal_spi.c b/targets/f7/furi_hal/furi_hal_spi.c index d295ad19686..e2892572fa1 100644 --- a/targets/f7/furi_hal/furi_hal_spi.c +++ b/targets/f7/furi_hal/furi_hal_spi.c @@ -23,48 +23,48 @@ static FuriSemaphore* spi_dma_lock = NULL; static FuriSemaphore* spi_dma_completed = NULL; -void furi_hal_spi_dma_init() { +void furi_hal_spi_dma_init(void) { spi_dma_lock = furi_semaphore_alloc(1, 1); spi_dma_completed = furi_semaphore_alloc(1, 1); } void furi_hal_spi_bus_init(FuriHalSpiBus* bus) { - furi_assert(bus); + furi_check(bus); bus->callback(bus, FuriHalSpiBusEventInit); } void furi_hal_spi_bus_deinit(FuriHalSpiBus* bus) { - furi_assert(bus); + furi_check(bus); bus->callback(bus, FuriHalSpiBusEventDeinit); } void furi_hal_spi_bus_handle_init(FuriHalSpiBusHandle* handle) { - furi_assert(handle); + furi_check(handle); handle->callback(handle, FuriHalSpiBusHandleEventInit); } void furi_hal_spi_bus_handle_deinit(FuriHalSpiBusHandle* handle) { - furi_assert(handle); + furi_check(handle); handle->callback(handle, FuriHalSpiBusHandleEventDeinit); } void furi_hal_spi_acquire(FuriHalSpiBusHandle* handle) { - furi_assert(handle); + furi_check(handle); furi_hal_power_insomnia_enter(); handle->bus->callback(handle->bus, FuriHalSpiBusEventLock); handle->bus->callback(handle->bus, FuriHalSpiBusEventActivate); - furi_assert(handle->bus->current_handle == NULL); + furi_check(handle->bus->current_handle == NULL); handle->bus->current_handle = handle; handle->callback(handle, FuriHalSpiBusHandleEventActivate); } void furi_hal_spi_release(FuriHalSpiBusHandle* handle) { - furi_assert(handle); - furi_assert(handle->bus->current_handle == handle); + furi_check(handle); + furi_check(handle->bus->current_handle == handle); // Handle event and unset handle handle->callback(handle, FuriHalSpiBusHandleEventDeactivate); @@ -93,10 +93,10 @@ bool furi_hal_spi_bus_rx( uint8_t* buffer, size_t size, uint32_t timeout) { - furi_assert(handle); - furi_assert(handle->bus->current_handle == handle); - furi_assert(buffer); - furi_assert(size > 0); + furi_check(handle); + furi_check(handle->bus->current_handle == handle); + furi_check(buffer); + furi_check(size > 0); return furi_hal_spi_bus_trx(handle, buffer, buffer, size, timeout); } @@ -106,10 +106,11 @@ bool furi_hal_spi_bus_tx( const uint8_t* buffer, size_t size, uint32_t timeout) { - furi_assert(handle); - furi_assert(handle->bus->current_handle == handle); - furi_assert(buffer); - furi_assert(size > 0); + furi_check(handle); + furi_check(handle->bus->current_handle == handle); + furi_check(buffer); + furi_check(size > 0); + bool ret = true; while(size > 0) { @@ -132,9 +133,9 @@ bool furi_hal_spi_bus_trx( uint8_t* rx_buffer, size_t size, uint32_t timeout) { - furi_assert(handle); - furi_assert(handle->bus->current_handle == handle); - furi_assert(size > 0); + furi_check(handle); + furi_check(handle->bus->current_handle == handle); + furi_check(size > 0); bool ret = true; size_t tx_size = size; @@ -196,9 +197,9 @@ bool furi_hal_spi_bus_trx_dma( uint8_t* rx_buffer, size_t size, uint32_t timeout_ms) { - furi_assert(handle); - furi_assert(handle->bus->current_handle == handle); - furi_assert(size > 0); + furi_check(handle); + furi_check(handle->bus->current_handle == handle); + furi_check(size > 0); // If scheduler is not running, use blocking mode if(furi_kernel_is_running()) { diff --git a/targets/f7/furi_hal/furi_hal_spi_config.c b/targets/f7/furi_hal/furi_hal_spi_config.c index 757ac23661d..8a694961abd 100644 --- a/targets/f7/furi_hal/furi_hal_spi_config.c +++ b/targets/f7/furi_hal/furi_hal_spi_config.c @@ -77,17 +77,17 @@ const LL_SPI_InitTypeDef furi_hal_spi_preset_1edge_low_2m = { FuriMutex* furi_hal_spi_bus_r_mutex = NULL; -void furi_hal_spi_config_init_early() { +void furi_hal_spi_config_init_early(void) { furi_hal_spi_bus_init(&furi_hal_spi_bus_d); furi_hal_spi_bus_handle_init(&furi_hal_spi_bus_handle_display); } -void furi_hal_spi_config_deinit_early() { +void furi_hal_spi_config_deinit_early(void) { furi_hal_spi_bus_handle_deinit(&furi_hal_spi_bus_handle_display); furi_hal_spi_bus_deinit(&furi_hal_spi_bus_d); } -void furi_hal_spi_config_init() { +void furi_hal_spi_config_init(void) { furi_hal_spi_bus_init(&furi_hal_spi_bus_r); furi_hal_spi_bus_handle_init(&furi_hal_spi_bus_handle_subghz); diff --git a/targets/f7/furi_hal/furi_hal_subghz.c b/targets/f7/furi_hal/furi_hal_subghz.c index 392345b0ca9..c5670f73e21 100644 --- a/targets/f7/furi_hal/furi_hal_subghz.c +++ b/targets/f7/furi_hal/furi_hal_subghz.c @@ -62,12 +62,12 @@ void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin) { furi_hal_subghz.async_mirror_pin = pin; } -const GpioPin* furi_hal_subghz_get_data_gpio() { +const GpioPin* furi_hal_subghz_get_data_gpio(void) { return &gpio_cc1101_g0; } -void furi_hal_subghz_init() { - furi_assert(furi_hal_subghz.state == SubGhzStateInit); +void furi_hal_subghz_init(void) { + furi_check(furi_hal_subghz.state == SubGhzStateInit); furi_hal_subghz.state = SubGhzStateBroken; furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); @@ -135,8 +135,9 @@ void furi_hal_subghz_init() { } } -void furi_hal_subghz_sleep() { - furi_assert(furi_hal_subghz.state == SubGhzStateIdle); +void furi_hal_subghz_sleep(void) { + furi_check(furi_hal_subghz.state == SubGhzStateIdle); + furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_switch_to_idle(&furi_hal_spi_bus_handle_subghz); @@ -149,7 +150,7 @@ void furi_hal_subghz_sleep() { furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_dump_state() { +void furi_hal_subghz_dump_state(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); printf( "[furi_hal_subghz] cc1101 chip %d, version %d\r\n", @@ -159,6 +160,8 @@ void furi_hal_subghz_dump_state() { } void furi_hal_subghz_load_custom_preset(const uint8_t* preset_data) { + furi_check(preset_data); + //load config furi_hal_subghz_reset(); furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); @@ -189,6 +192,8 @@ void furi_hal_subghz_load_custom_preset(const uint8_t* preset_data) { } void furi_hal_subghz_load_registers(const uint8_t* data) { + furi_check(data); + furi_hal_subghz_reset(); furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); uint32_t i = 0; @@ -200,12 +205,17 @@ void furi_hal_subghz_load_registers(const uint8_t* data) { } void furi_hal_subghz_load_patable(const uint8_t data[8]) { + furi_check(data); + furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_set_pa_table(&furi_hal_spi_bus_handle_subghz, data); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size) { + furi_check(data); + furi_check(size); + furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_flush_tx(&furi_hal_spi_bus_handle_subghz); cc1101_write_reg(&furi_hal_spi_bus_handle_subghz, CC1101_FIFO, size); @@ -213,19 +223,19 @@ void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size) { furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_flush_rx() { +void furi_hal_subghz_flush_rx(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_flush_rx(&furi_hal_spi_bus_handle_subghz); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_flush_tx() { +void furi_hal_subghz_flush_tx(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_flush_tx(&furi_hal_spi_bus_handle_subghz); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -bool furi_hal_subghz_rx_pipe_not_empty() { +bool furi_hal_subghz_rx_pipe_not_empty(void) { CC1101RxBytes status[1]; furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_read_reg( @@ -238,7 +248,7 @@ bool furi_hal_subghz_rx_pipe_not_empty() { } } -bool furi_hal_subghz_is_rx_data_crc_valid() { +bool furi_hal_subghz_is_rx_data_crc_valid(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); uint8_t data[1]; cc1101_read_reg(&furi_hal_spi_bus_handle_subghz, CC1101_STATUS_LQI | CC1101_BURST, data); @@ -251,19 +261,22 @@ bool furi_hal_subghz_is_rx_data_crc_valid() { } void furi_hal_subghz_read_packet(uint8_t* data, uint8_t* size) { + furi_check(data); + furi_check(size); + furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_read_fifo(&furi_hal_spi_bus_handle_subghz, data, size); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_shutdown() { +void furi_hal_subghz_shutdown(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); // Reset and shutdown cc1101_shutdown(&furi_hal_spi_bus_handle_subghz); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_reset() { +void furi_hal_subghz_reset(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeAnalog, GpioPullNo, GpioSpeedLow); cc1101_switch_to_idle(&furi_hal_spi_bus_handle_subghz); @@ -273,7 +286,7 @@ void furi_hal_subghz_reset() { furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_idle() { +void furi_hal_subghz_idle(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_switch_to_idle(&furi_hal_spi_bus_handle_subghz); //waiting for the chip to switch to IDLE mode @@ -281,7 +294,7 @@ void furi_hal_subghz_idle() { furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -void furi_hal_subghz_rx() { +void furi_hal_subghz_rx(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_switch_to_rx(&furi_hal_spi_bus_handle_subghz); //waiting for the chip to switch to Rx mode @@ -289,7 +302,7 @@ void furi_hal_subghz_rx() { furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -bool furi_hal_subghz_tx() { +bool furi_hal_subghz_tx(void) { if(furi_hal_subghz.regulation != SubGhzRegulationTxRx) return false; furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); cc1101_switch_to_tx(&furi_hal_spi_bus_handle_subghz); @@ -299,7 +312,7 @@ bool furi_hal_subghz_tx() { return true; } -float furi_hal_subghz_get_rssi() { +float furi_hal_subghz_get_rssi(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); int32_t rssi_dec = cc1101_get_rssi(&furi_hal_spi_bus_handle_subghz); furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); @@ -314,7 +327,7 @@ float furi_hal_subghz_get_rssi() { return rssi; } -uint8_t furi_hal_subghz_get_lqi() { +uint8_t furi_hal_subghz_get_lqi(void) { furi_hal_spi_acquire(&furi_hal_spi_bus_handle_subghz); uint8_t data[1]; cc1101_read_reg(&furi_hal_spi_bus_handle_subghz, CC1101_STATUS_LQI | CC1101_BURST, data); @@ -385,7 +398,7 @@ void furi_hal_subghz_set_path(FuriHalSubGhzPath path) { furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz); } -static bool furi_hal_subghz_start_debug() { +static bool furi_hal_subghz_start_debug(void) { bool ret = false; if(furi_hal_subghz.async_mirror_pin != NULL) { furi_hal_gpio_write(furi_hal_subghz.async_mirror_pin, false); @@ -399,7 +412,7 @@ static bool furi_hal_subghz_start_debug() { return ret; } -static bool furi_hal_subghz_stop_debug() { +static bool furi_hal_subghz_stop_debug(void) { bool ret = false; if(furi_hal_subghz.async_mirror_pin != NULL) { furi_hal_gpio_init( @@ -445,7 +458,9 @@ static void furi_hal_subghz_capture_ISR(void* context) { } void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void* context) { - furi_assert(furi_hal_subghz.state == SubGhzStateIdle); + furi_check(furi_hal_subghz.state == SubGhzStateIdle); + furi_check(callback); + furi_hal_subghz.state = SubGhzStateAsyncRx; furi_hal_subghz_capture_callback = callback; @@ -511,8 +526,8 @@ void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void* furi_hal_subghz_capture_delta_duration = 0; } -void furi_hal_subghz_stop_async_rx() { - furi_assert(furi_hal_subghz.state == SubGhzStateAsyncRx); +void furi_hal_subghz_stop_async_rx(void) { + furi_check(furi_hal_subghz.state == SubGhzStateAsyncRx); furi_hal_subghz.state = SubGhzStateIdle; // Shutdown radio @@ -610,7 +625,7 @@ static inline uint32_t furi_hal_subghz_async_tx_middleware_get_duration( } static void furi_hal_subghz_async_tx_refill(uint32_t* buffer, size_t samples) { - furi_assert(furi_hal_subghz.state == SubGhzStateAsyncTx); + furi_check(furi_hal_subghz.state == SubGhzStateAsyncTx); while(samples > 0) { volatile uint32_t duration = furi_hal_subghz_async_tx_middleware_get_duration( @@ -650,7 +665,7 @@ static void furi_hal_subghz_async_tx_refill(uint32_t* buffer, size_t samples) { static void furi_hal_subghz_async_tx_dma_isr(void* context) { UNUSED(context); - furi_assert(furi_hal_subghz.state == SubGhzStateAsyncTx); + furi_check(furi_hal_subghz.state == SubGhzStateAsyncTx); #if SUBGHZ_DMA_CH1_CHANNEL == LL_DMA_CHANNEL_1 if(LL_DMA_IsActiveFlag_HT1(SUBGHZ_DMA)) { @@ -670,8 +685,8 @@ static void furi_hal_subghz_async_tx_dma_isr(void* context) { } bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* context) { - furi_assert(furi_hal_subghz.state == SubGhzStateIdle); - furi_assert(callback); + furi_check(furi_hal_subghz.state == SubGhzStateIdle); + furi_check(callback); //If transmission is prohibited by regional settings if(furi_hal_subghz.regulation != SubGhzRegulationTxRx) return false; @@ -773,12 +788,12 @@ bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* return true; } -bool furi_hal_subghz_is_async_tx_complete() { +bool furi_hal_subghz_is_async_tx_complete(void) { return (furi_hal_subghz.state == SubGhzStateAsyncTx) && (LL_TIM_GetAutoReload(TIM2) == 0); } -void furi_hal_subghz_stop_async_tx() { - furi_assert(furi_hal_subghz.state == SubGhzStateAsyncTx); +void furi_hal_subghz_stop_async_tx(void) { + furi_check(furi_hal_subghz.state == SubGhzStateAsyncTx); // Shutdown radio furi_hal_subghz_idle(); diff --git a/targets/f7/furi_hal/furi_hal_subghz.h b/targets/f7/furi_hal/furi_hal_subghz.h index 757f7089ac5..0a0ee7667a8 100644 --- a/targets/f7/furi_hal/furi_hal_subghz.h +++ b/targets/f7/furi_hal/furi_hal_subghz.h @@ -43,21 +43,21 @@ void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin); * * @return pointer to the gpio pin structure */ -const GpioPin* furi_hal_subghz_get_data_gpio(); +const GpioPin* furi_hal_subghz_get_data_gpio(void); /** Initialize and switch to power save mode Used by internal API-HAL * initialization routine Can be used to reinitialize device to safe state and * send it to sleep */ -void furi_hal_subghz_init(); +void furi_hal_subghz_init(void); /** Send device to sleep mode */ -void furi_hal_subghz_sleep(); +void furi_hal_subghz_sleep(void); /** Dump info to stdout */ -void furi_hal_subghz_dump_state(); +void furi_hal_subghz_dump_state(void); /** Load custom registers from preset * @@ -88,13 +88,13 @@ void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size); * * @return true if not empty */ -bool furi_hal_subghz_rx_pipe_not_empty(); +bool furi_hal_subghz_rx_pipe_not_empty(void); /** Check if received data crc is valid * * @return true if valid */ -bool furi_hal_subghz_is_rx_data_crc_valid(); +bool furi_hal_subghz_is_rx_data_crc_valid(void); /** Read packet from FIFO * @@ -105,47 +105,47 @@ void furi_hal_subghz_read_packet(uint8_t* data, uint8_t* size); /** Flush rx FIFO buffer */ -void furi_hal_subghz_flush_rx(); +void furi_hal_subghz_flush_rx(void); /** Flush tx FIFO buffer */ -void furi_hal_subghz_flush_tx(); +void furi_hal_subghz_flush_tx(void); /** Shutdown Issue SPWD command * @warning registers content will be lost */ -void furi_hal_subghz_shutdown(); +void furi_hal_subghz_shutdown(void); /** Reset Issue reset command * @warning registers content will be lost */ -void furi_hal_subghz_reset(); +void furi_hal_subghz_reset(void); /** Switch to Idle */ -void furi_hal_subghz_idle(); +void furi_hal_subghz_idle(void); /** Switch to Receive */ -void furi_hal_subghz_rx(); +void furi_hal_subghz_rx(void); /** Switch to Transmit * * @return true if the transfer is allowed by belonging to the region */ -bool furi_hal_subghz_tx(); +bool furi_hal_subghz_tx(void); /** Get RSSI value in dBm * * @return RSSI value */ -float furi_hal_subghz_get_rssi(); +float furi_hal_subghz_get_rssi(void); /** Get LQI * * @return LQI value */ -uint8_t furi_hal_subghz_get_lqi(); +uint8_t furi_hal_subghz_get_lqi(void); /** Check if frequency is in valid range * @@ -192,7 +192,7 @@ void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void* /** Disable signal timings capture Resets GPIO and TIM2 */ -void furi_hal_subghz_stop_async_rx(); +void furi_hal_subghz_stop_async_rx(void); /** Async TX callback type * @param context callback context @@ -213,11 +213,11 @@ bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* * * @return true if TX complete */ -bool furi_hal_subghz_is_async_tx_complete(); +bool furi_hal_subghz_is_async_tx_complete(void); /** Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1 */ -void furi_hal_subghz_stop_async_tx(); +void furi_hal_subghz_stop_async_tx(void); #ifdef __cplusplus } diff --git a/targets/f7/furi_hal/furi_hal_usb.c b/targets/f7/furi_hal/furi_hal_usb.c index b88168d5d0c..a482940e216 100644 --- a/targets/f7/furi_hal/furi_hal_usb.c +++ b/targets/f7/furi_hal/furi_hal_usb.c @@ -153,7 +153,7 @@ bool furi_hal_usb_set_config(FuriHalUsbInterface* new_if, void* ctx) { return return_data.bool_value; } -FuriHalUsbInterface* furi_hal_usb_get_config() { +FuriHalUsbInterface* furi_hal_usb_get_config(void) { UsbApiEventReturnData return_data = { .void_value = NULL, }; @@ -168,7 +168,7 @@ FuriHalUsbInterface* furi_hal_usb_get_config() { return return_data.void_value; } -void furi_hal_usb_lock() { +void furi_hal_usb_lock(void) { UsbApiEventMessage msg = { .lock = api_lock_alloc_locked(), .type = UsbApiEventTypeLock, @@ -177,7 +177,7 @@ void furi_hal_usb_lock() { furi_hal_usb_send_message(&msg); } -void furi_hal_usb_unlock() { +void furi_hal_usb_unlock(void) { UsbApiEventMessage msg = { .lock = api_lock_alloc_locked(), .type = UsbApiEventTypeUnlock, @@ -186,7 +186,7 @@ void furi_hal_usb_unlock() { furi_hal_usb_send_message(&msg); } -bool furi_hal_usb_is_locked() { +bool furi_hal_usb_is_locked(void) { UsbApiEventReturnData return_data = { .bool_value = false, }; @@ -201,7 +201,7 @@ bool furi_hal_usb_is_locked() { return return_data.bool_value; } -void furi_hal_usb_disable() { +void furi_hal_usb_disable(void) { UsbApiEventMessage msg = { .lock = api_lock_alloc_locked(), .type = UsbApiEventTypeDisable, @@ -210,7 +210,7 @@ void furi_hal_usb_disable() { furi_hal_usb_send_message(&msg); } -void furi_hal_usb_enable() { +void furi_hal_usb_enable(void) { UsbApiEventMessage msg = { .lock = api_lock_alloc_locked(), .type = UsbApiEventTypeEnable, @@ -219,7 +219,7 @@ void furi_hal_usb_enable() { furi_hal_usb_send_message(&msg); } -void furi_hal_usb_reinit() { +void furi_hal_usb_reinit(void) { UsbApiEventMessage msg = { .lock = api_lock_alloc_locked(), .type = UsbApiEventTypeReinit, @@ -358,7 +358,7 @@ static void usb_process_mode_change(FuriHalUsbInterface* interface, void* contex } } -static void usb_process_mode_reinit() { +static void usb_process_mode_reinit(void) { // Temporary disable callback to avoid getting false reset events usbd_reg_event(&udev, usbd_evt_reset, NULL); FURI_LOG_I(TAG, "USB Reinit"); diff --git a/targets/f7/furi_hal/furi_hal_usb_ccid.c b/targets/f7/furi_hal/furi_hal_usb_ccid.c index e24713ced52..d8b43fc6c7b 100644 --- a/targets/f7/furi_hal/furi_hal_usb_ccid.c +++ b/targets/f7/furi_hal/furi_hal_usb_ccid.c @@ -186,7 +186,7 @@ static bool smartcard_inserted = true; static CcidCallbacks* callbacks[CCID_TOTAL_SLOTS] = {NULL}; static void* ccid_set_string_descr(char* str) { - furi_assert(str); + furi_check(str); size_t len = strlen(str); struct usb_string_descriptor* dev_str_desc = malloc(len * 2 + 2); @@ -292,7 +292,7 @@ void CALLBACK_CCID_GetSlotStatus( void CALLBACK_CCID_SetParametersT0( struct pc_to_rdr_set_parameters_t0* requestSetParametersT0, struct rdr_to_pc_parameters_t0* responseSetParametersT0) { - furi_assert(requestSetParametersT0->bProtocolNum == 0x00); //T0 + furi_check(requestSetParametersT0->bProtocolNum == 0x00); //T0 responseSetParametersT0->bMessageType = RDR_TO_PC_PARAMETERS; responseSetParametersT0->bSlot = requestSetParametersT0->bSlot; responseSetParametersT0->bSeq = requestSetParametersT0->bSeq; @@ -381,11 +381,11 @@ void CALLBACK_CCID_XfrBlock( } } -void furi_hal_ccid_ccid_insert_smartcard() { +void furi_hal_ccid_ccid_insert_smartcard(void) { smartcard_inserted = true; } -void furi_hal_ccid_ccid_remove_smartcard() { +void furi_hal_ccid_ccid_remove_smartcard(void) { smartcard_inserted = false; } @@ -410,7 +410,7 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { int32_t bytes_read = usbd_ep_read( usb_dev, ep, &ReceiveBuffer, sizeof(ccid_bulk_message_header_t) + CCID_DATABLOCK_SIZE); //minimum request size is header size - furi_assert((uint16_t)bytes_read >= sizeof(ccid_bulk_message_header_t)); + furi_check((uint16_t)bytes_read >= sizeof(ccid_bulk_message_header_t)); ccid_bulk_message_header_t* message = (ccid_bulk_message_header_t*)&ReceiveBuffer; //-V641 if(message->bMessageType == PC_TO_RDR_ICCPOWERON) { @@ -455,14 +455,14 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { struct rdr_to_pc_data_block* responseDataBlock = (struct rdr_to_pc_data_block*)&SendBuffer; - furi_assert(receivedXfrBlock->dwLength <= CCID_DATABLOCK_SIZE); - furi_assert( + furi_check(receivedXfrBlock->dwLength <= CCID_DATABLOCK_SIZE); + furi_check( (uint16_t)bytes_read >= sizeof(ccid_bulk_message_header_t) + receivedXfrBlock->dwLength); CALLBACK_CCID_XfrBlock(receivedXfrBlock, responseDataBlock); - furi_assert(responseDataBlock->dwLength <= CCID_DATABLOCK_SIZE); + furi_check(responseDataBlock->dwLength <= CCID_DATABLOCK_SIZE); usbd_ep_write( usb_dev, @@ -476,8 +476,8 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) { struct rdr_to_pc_parameters_t0* responseSetParametersT0 = (struct rdr_to_pc_parameters_t0*)&SendBuffer; //-V641 - furi_assert(requestSetParametersT0->dwLength <= CCID_DATABLOCK_SIZE); - furi_assert( + furi_check(requestSetParametersT0->dwLength <= CCID_DATABLOCK_SIZE); + furi_check( (uint16_t)bytes_read >= sizeof(ccid_bulk_message_header_t) + requestSetParametersT0->dwLength); diff --git a/targets/f7/furi_hal/furi_hal_usb_cdc.c b/targets/f7/furi_hal/furi_hal_usb_cdc.c index 014c98bad17..4679df14fb8 100644 --- a/targets/f7/furi_hal/furi_hal_usb_cdc.c +++ b/targets/f7/furi_hal/furi_hal_usb_cdc.c @@ -472,7 +472,7 @@ static void cdc_deinit(usbd_device* dev) { } void furi_hal_cdc_set_callbacks(uint8_t if_num, CdcCallbacks* cb, void* context) { - furi_assert(if_num < IF_NUM_MAX); + furi_check(if_num < IF_NUM_MAX); if(callbacks[if_num] != NULL) { if(callbacks[if_num]->state_callback != NULL) { @@ -494,12 +494,12 @@ void furi_hal_cdc_set_callbacks(uint8_t if_num, CdcCallbacks* cb, void* context) } struct usb_cdc_line_coding* furi_hal_cdc_get_port_settings(uint8_t if_num) { - furi_assert(if_num < IF_NUM_MAX); + furi_check(if_num < IF_NUM_MAX); return &cdc_config[if_num]; } uint8_t furi_hal_cdc_get_ctrl_line_state(uint8_t if_num) { - furi_assert(if_num < IF_NUM_MAX); + furi_check(if_num < IF_NUM_MAX); return cdc_ctrl_line_state[if_num]; } diff --git a/targets/f7/furi_hal/furi_hal_usb_hid.c b/targets/f7/furi_hal/furi_hal_usb_hid.c index b744e5ef72e..f48c4a7813f 100644 --- a/targets/f7/furi_hal/furi_hal_usb_hid.c +++ b/targets/f7/furi_hal/furi_hal_usb_hid.c @@ -257,11 +257,11 @@ static void* cb_ctx; static uint8_t led_state; static bool boot_protocol = false; -bool furi_hal_hid_is_connected() { +bool furi_hal_hid_is_connected(void) { return hid_connected; } -uint8_t furi_hal_hid_get_led_state() { +uint8_t furi_hal_hid_get_led_state(void) { return led_state; } @@ -300,7 +300,7 @@ bool furi_hal_hid_kb_release(uint16_t button) { return hid_send_report(ReportIdKeyboard); } -bool furi_hal_hid_kb_release_all() { +bool furi_hal_hid_kb_release_all(void) { for(uint8_t key_nb = 0; key_nb < HID_KB_MAX_KEYS; key_nb++) { hid_report.keyboard.boot.btn[key_nb] = 0; } diff --git a/targets/f7/furi_hal/furi_hal_usb_u2f.c b/targets/f7/furi_hal/furi_hal_usb_u2f.c index cc7e23b77e3..2a014093e91 100644 --- a/targets/f7/furi_hal/furi_hal_usb_u2f.c +++ b/targets/f7/furi_hal/furi_hal_usb_u2f.c @@ -153,7 +153,7 @@ static bool hid_u2f_connected = false; static HidU2fCallback callback; static void* cb_ctx; -bool furi_hal_hid_u2f_is_connected() { +bool furi_hal_hid_u2f_is_connected(void) { return hid_u2f_connected; } diff --git a/targets/f7/furi_hal/furi_hal_version.c b/targets/f7/furi_hal/furi_hal_version.c index e4364a51892..c7656a8df5c 100644 --- a/targets/f7/furi_hal/furi_hal_version.c +++ b/targets/f7/furi_hal/furi_hal_version.c @@ -116,11 +116,11 @@ static void furi_hal_version_set_name(const char* name) { furi_hal_version.ble_mac[5] = (uint8_t)((company_id & 0x0000FF00) >> 8); } -static void furi_hal_version_load_otp_default() { +static void furi_hal_version_load_otp_default(void) { furi_hal_version_set_name(NULL); } -static void furi_hal_version_load_otp_v0() { +static void furi_hal_version_load_otp_v0(void) { const FuriHalVersionOTPv0* otp = (FuriHalVersionOTPv0*)FURI_HAL_VERSION_OTP_ADDRESS; furi_hal_version.timestamp = otp->header_timestamp; @@ -132,7 +132,7 @@ static void furi_hal_version_load_otp_v0() { furi_hal_version_set_name(otp->name); } -static void furi_hal_version_load_otp_v1() { +static void furi_hal_version_load_otp_v1(void) { const FuriHalVersionOTPv1* otp = (FuriHalVersionOTPv1*)FURI_HAL_VERSION_OTP_ADDRESS; furi_hal_version.timestamp = otp->header_timestamp; @@ -146,7 +146,7 @@ static void furi_hal_version_load_otp_v1() { furi_hal_version_set_name(otp->name); } -static void furi_hal_version_load_otp_v2() { +static void furi_hal_version_load_otp_v2(void) { const FuriHalVersionOTPv2* otp = (FuriHalVersionOTPv2*)FURI_HAL_VERSION_OTP_ADDRESS; // 1st block, programmed afer baking @@ -171,7 +171,7 @@ static void furi_hal_version_load_otp_v2() { } } -void furi_hal_version_init() { +void furi_hal_version_init(void) { switch(furi_hal_version_get_otp_version()) { case FuriHalVersionOtpVersionUnknown: case FuriHalVersionOtpVersionEmpty: @@ -195,7 +195,7 @@ void furi_hal_version_init() { FURI_LOG_I(TAG, "Init OK"); } -FuriHalVersionOtpVersion furi_hal_version_get_otp_version() { +FuriHalVersionOtpVersion furi_hal_version_get_otp_version(void) { if(*(uint64_t*)FURI_HAL_VERSION_OTP_ADDRESS == 0xFFFFFFFF) { return FuriHalVersionOtpVersionEmpty; } else { @@ -218,31 +218,31 @@ FuriHalVersionOtpVersion furi_hal_version_get_otp_version() { } } -uint8_t furi_hal_version_get_hw_version() { +uint8_t furi_hal_version_get_hw_version(void) { return furi_hal_version.board_version; } -uint8_t furi_hal_version_get_hw_target() { +uint8_t furi_hal_version_get_hw_target(void) { return furi_hal_version.board_target; } -uint8_t furi_hal_version_get_hw_body() { +uint8_t furi_hal_version_get_hw_body(void) { return furi_hal_version.board_body; } -FuriHalVersionColor furi_hal_version_get_hw_color() { +FuriHalVersionColor furi_hal_version_get_hw_color(void) { return furi_hal_version.board_color; } -uint8_t furi_hal_version_get_hw_connect() { +uint8_t furi_hal_version_get_hw_connect(void) { return furi_hal_version.board_connect; } -FuriHalVersionRegion furi_hal_version_get_hw_region() { +FuriHalVersionRegion furi_hal_version_get_hw_region(void) { return furi_hal_version.board_region; } -const char* furi_hal_version_get_hw_region_name() { +const char* furi_hal_version_get_hw_region_name(void) { switch(furi_hal_version_get_hw_region()) { case FuriHalVersionRegionUnknown: return "R00"; @@ -258,27 +258,27 @@ const char* furi_hal_version_get_hw_region_name() { return "R??"; } -FuriHalVersionDisplay furi_hal_version_get_hw_display() { +FuriHalVersionDisplay furi_hal_version_get_hw_display(void) { return furi_hal_version.board_display; } -uint32_t furi_hal_version_get_hw_timestamp() { +uint32_t furi_hal_version_get_hw_timestamp(void) { return furi_hal_version.timestamp; } -const char* furi_hal_version_get_name_ptr() { +const char* furi_hal_version_get_name_ptr(void) { return *furi_hal_version.name == 0x00 ? NULL : furi_hal_version.name; } -const char* furi_hal_version_get_device_name_ptr() { +const char* furi_hal_version_get_device_name_ptr(void) { return furi_hal_version.device_name + 1; } -const char* furi_hal_version_get_ble_local_device_name_ptr() { +const char* furi_hal_version_get_ble_local_device_name_ptr(void) { return furi_hal_version.device_name; } -const uint8_t* furi_hal_version_get_ble_mac() { +const uint8_t* furi_hal_version_get_ble_mac(void) { return furi_hal_version.ble_mac; } @@ -286,10 +286,10 @@ const struct Version* furi_hal_version_get_firmware_version(void) { return version_get(); } -size_t furi_hal_version_uid_size() { +size_t furi_hal_version_uid_size(void) { return 64 / 8; } -const uint8_t* furi_hal_version_uid() { +const uint8_t* furi_hal_version_uid(void) { return (const uint8_t*)UID64_BASE; } diff --git a/targets/f7/furi_hal/furi_hal_version_device.c b/targets/f7/furi_hal/furi_hal_version_device.c index 89728998402..af88c067190 100644 --- a/targets/f7/furi_hal/furi_hal_version_device.c +++ b/targets/f7/furi_hal/furi_hal_version_device.c @@ -1,33 +1,33 @@ #include -bool furi_hal_version_do_i_belong_here() { +bool furi_hal_version_do_i_belong_here(void) { return (furi_hal_version_get_hw_target() == 7) || (furi_hal_version_get_hw_target() == 0); } -const char* furi_hal_version_get_model_name() { +const char* furi_hal_version_get_model_name(void) { return "Flipper Zero"; } -const char* furi_hal_version_get_model_code() { +const char* furi_hal_version_get_model_code(void) { return "FZ.1"; } -const char* furi_hal_version_get_fcc_id() { +const char* furi_hal_version_get_fcc_id(void) { return "2A2V6-FZ"; } -const char* furi_hal_version_get_ic_id() { +const char* furi_hal_version_get_ic_id(void) { return "27624-FZ"; } -const char* furi_hal_version_get_mic_id() { +const char* furi_hal_version_get_mic_id(void) { return "210-175991"; } -const char* furi_hal_version_get_srrc_id() { +const char* furi_hal_version_get_srrc_id(void) { return "2023DJ16420"; } -const char* furi_hal_version_get_ncc_id() { +const char* furi_hal_version_get_ncc_id(void) { return "CCAJ23LP34D0T3"; } \ No newline at end of file diff --git a/targets/f7/furi_hal/furi_hal_vibro.c b/targets/f7/furi_hal/furi_hal_vibro.c index f4678467750..33ff865494e 100644 --- a/targets/f7/furi_hal/furi_hal_vibro.c +++ b/targets/f7/furi_hal/furi_hal_vibro.c @@ -3,7 +3,7 @@ #define TAG "FuriHalVibro" -void furi_hal_vibro_init() { +void furi_hal_vibro_init(void) { furi_hal_gpio_init(&gpio_vibro, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); furi_hal_gpio_write(&gpio_vibro, false); FURI_LOG_I(TAG, "Init OK"); diff --git a/targets/f7/inc/FreeRTOSConfig.h b/targets/f7/inc/FreeRTOSConfig.h index 6a68bbae736..36800565c32 100644 --- a/targets/f7/inc/FreeRTOSConfig.h +++ b/targets/f7/inc/FreeRTOSConfig.h @@ -89,7 +89,7 @@ to exclude the API function. */ /* Furi-specific */ #define configTASK_NOTIFICATION_ARRAY_ENTRIES 2 -extern __attribute__((__noreturn__)) void furi_thread_catch(); +extern __attribute__((__noreturn__)) void furi_thread_catch(void); #define configTASK_RETURN_ADDRESS (furi_thread_catch + 2) /* diff --git a/targets/f7/inc/alt_boot.h b/targets/f7/inc/alt_boot.h index d8be3aa487d..23d7a46a86b 100644 --- a/targets/f7/inc/alt_boot.h +++ b/targets/f7/inc/alt_boot.h @@ -4,11 +4,11 @@ extern "C" { #endif -void flipper_boot_update_exec(); +void flipper_boot_update_exec(void); -void flipper_boot_dfu_exec(); +void flipper_boot_dfu_exec(void); -void flipper_boot_recovery_exec(); +void flipper_boot_recovery_exec(void); #ifdef __cplusplus } diff --git a/targets/f7/platform_specific/cxx_virtual_stub.c b/targets/f7/platform_specific/cxx_virtual_stub.c index a81e5a5e0e2..74bd254788f 100644 --- a/targets/f7/platform_specific/cxx_virtual_stub.c +++ b/targets/f7/platform_specific/cxx_virtual_stub.c @@ -1,6 +1,6 @@ #include "cxx_virtual_stub.h" #include -void __cxa_pure_virtual() { +void __cxa_pure_virtual(void) { furi_crash("C++ pure virtual call"); } diff --git a/targets/f7/platform_specific/cxx_virtual_stub.h b/targets/f7/platform_specific/cxx_virtual_stub.h index 46211030e3f..43eea59667b 100644 --- a/targets/f7/platform_specific/cxx_virtual_stub.h +++ b/targets/f7/platform_specific/cxx_virtual_stub.h @@ -6,7 +6,7 @@ extern "C" { #endif -void __cxa_pure_virtual(); +void __cxa_pure_virtual(void); #ifdef __cplusplus } diff --git a/targets/f7/src/dfu.c b/targets/f7/src/dfu.c index 7e094b4c47e..2d5bddb17b2 100644 --- a/targets/f7/src/dfu.c +++ b/targets/f7/src/dfu.c @@ -7,7 +7,7 @@ #include #include -void flipper_boot_dfu_show_splash() { +void flipper_boot_dfu_show_splash(void) { // Initialize Canvas* canvas = canvas_init(); @@ -22,7 +22,7 @@ void flipper_boot_dfu_show_splash() { canvas_free(canvas); } -void flipper_boot_dfu_exec() { +void flipper_boot_dfu_exec(void) { // Show DFU splashscreen flipper_boot_dfu_show_splash(); diff --git a/targets/f7/src/main.c b/targets/f7/src/main.c index ca705fe5e42..77961f0eff8 100644 --- a/targets/f7/src/main.c +++ b/targets/f7/src/main.c @@ -18,7 +18,7 @@ int32_t init_task(void* context) { return 0; } -int main() { +int main(void) { // Initialize FURI layer furi_init(); @@ -71,6 +71,6 @@ void Error_Handler(void) { furi_crash("ErrorHandler"); } -void abort() { +void abort(void) { furi_crash("AbortHandler"); } diff --git a/targets/f7/src/recovery.c b/targets/f7/src/recovery.c index 848236815b5..0a2532bf7ee 100644 --- a/targets/f7/src/recovery.c +++ b/targets/f7/src/recovery.c @@ -34,7 +34,7 @@ void flipper_boot_recovery_draw_splash(Canvas* canvas) { canvas_commit(canvas); } -void flipper_boot_recovery_exec() { +void flipper_boot_recovery_exec(void) { Canvas* canvas = canvas_init(); // Show recovery splashscreen diff --git a/targets/f7/src/update.c b/targets/f7/src/update.c index 42ac90e7b91..e6cb4aabee1 100644 --- a/targets/f7/src/update.c +++ b/targets/f7/src/update.c @@ -22,7 +22,7 @@ static FATFS* pfs = NULL; } \ } -static bool flipper_update_mount_sd() { +static bool flipper_update_mount_sd(void) { for(int i = 0; i < furi_hal_sd_max_mount_retry_count(); ++i) { if(furi_hal_sd_init((i % 2) == 0) != FuriStatusOk) { /* Next attempt will be without card reset, let it settle */ @@ -37,7 +37,7 @@ static bool flipper_update_mount_sd() { return false; } -static bool flipper_update_init() { +static bool flipper_update_init(void) { // TODO FL-3504: Configure missing peripherals properly furi_hal_bus_enable(FuriHalBusHSEM); furi_hal_bus_enable(FuriHalBusIPCC); @@ -180,7 +180,7 @@ static UpdateManifest* flipper_update_process_manifest(const FuriString* manifes return manifest; } -void flipper_boot_update_exec() { +void flipper_boot_update_exec(void) { if(!flipper_update_init()) { return; } diff --git a/targets/furi_hal_include/furi_hal.h b/targets/furi_hal_include/furi_hal.h index 4f8aad6bd64..3eaf06da61c 100644 --- a/targets/furi_hal_include/furi_hal.h +++ b/targets/furi_hal_include/furi_hal.h @@ -46,13 +46,13 @@ extern "C" { #endif /** Early FuriHal init, only essential subsystems */ -void furi_hal_init_early(); +void furi_hal_init_early(void); /** Early FuriHal deinit */ -void furi_hal_deinit_early(); +void furi_hal_deinit_early(void); /** Init FuriHal */ -void furi_hal_init(); +void furi_hal_init(void); /** Transfer execution to address * diff --git a/targets/furi_hal_include/furi_hal_bt.h b/targets/furi_hal_include/furi_hal_bt.h index 266db858885..ef6b31bb43d 100644 --- a/targets/furi_hal_include/furi_hal_bt.h +++ b/targets/furi_hal_include/furi_hal_bt.h @@ -30,37 +30,37 @@ typedef enum { /** Initialize */ -void furi_hal_bt_init(); +void furi_hal_bt_init(void); /** Lock core2 state transition */ -void furi_hal_bt_lock_core2(); +void furi_hal_bt_lock_core2(void); /** Lock core2 state transition */ -void furi_hal_bt_unlock_core2(); +void furi_hal_bt_unlock_core2(void); /** Start radio stack * * @return true on successfull radio stack start */ -bool furi_hal_bt_start_radio_stack(); +bool furi_hal_bt_start_radio_stack(void); /** Get radio stack type * * @return FuriHalBtStack instance */ -FuriHalBtStack furi_hal_bt_get_radio_stack(); +FuriHalBtStack furi_hal_bt_get_radio_stack(void); /** Check if radio stack supports BLE GAT/GAP * * @return true if supported */ -bool furi_hal_bt_is_gatt_gap_supported(); +bool furi_hal_bt_is_gatt_gap_supported(void); /** Check if radio stack supports testing * * @return true if supported */ -bool furi_hal_bt_is_testing_supported(); +bool furi_hal_bt_is_testing_supported(void); /** Check if particular instance of profile belongs to given type * @@ -92,7 +92,7 @@ FURI_WARN_UNUSED FuriHalBleProfileBase* furi_hal_bt_start_app( * * Also can be used to prepare core2 for stop modes */ -void furi_hal_bt_reinit(); +void furi_hal_bt_reinit(void); /** Change BLE app * Restarts 2nd core @@ -123,15 +123,15 @@ void furi_hal_bt_update_power_state(bool charging); * * @return true if device is connected or advertising, false otherwise */ -bool furi_hal_bt_is_active(); +bool furi_hal_bt_is_active(void); /** Start advertising */ -void furi_hal_bt_start_advertising(); +void furi_hal_bt_start_advertising(void); /** Stop advertising */ -void furi_hal_bt_stop_advertising(); +void furi_hal_bt_stop_advertising(void); /** Get BT/BLE system component state * @@ -143,7 +143,7 @@ void furi_hal_bt_dump_state(FuriString* buffer); * * @return true if core2 is alive */ -bool furi_hal_bt_is_alive(); +bool furi_hal_bt_is_alive(void); /** Get key storage buffer address and size * @@ -155,18 +155,18 @@ void furi_hal_bt_get_key_storage_buff(uint8_t** key_buff_addr, uint16_t* key_buf /** Get SRAM2 hardware semaphore * @note Must be called before SRAM2 read/write operations */ -void furi_hal_bt_nvm_sram_sem_acquire(); +void furi_hal_bt_nvm_sram_sem_acquire(void); /** Release SRAM2 hardware semaphore * @note Must be called after SRAM2 read/write operations */ -void furi_hal_bt_nvm_sram_sem_release(); +void furi_hal_bt_nvm_sram_sem_release(void); /** Clear key storage * * @return true on success */ -bool furi_hal_bt_clear_white_list(); +bool furi_hal_bt_clear_white_list(void); /** Set key storage change callback * @@ -186,7 +186,7 @@ void furi_hal_bt_start_tone_tx(uint8_t channel, uint8_t power); /** Stop ble tone tx */ -void furi_hal_bt_stop_tone_tx(); +void furi_hal_bt_stop_tone_tx(void); /** Start sending ble packets at a given frequency and datarate * @@ -200,7 +200,7 @@ void furi_hal_bt_start_packet_tx(uint8_t channel, uint8_t pattern, uint8_t datar * * @return sent packet count */ -uint16_t furi_hal_bt_stop_packet_test(); +uint16_t furi_hal_bt_stop_packet_test(void); /** Start receiving packets * @@ -217,19 +217,19 @@ void furi_hal_bt_start_rx(uint8_t channel); /** Stop RF listenning */ -void furi_hal_bt_stop_rx(); +void furi_hal_bt_stop_rx(void); /** Get RSSI * * @return RSSI in dBm */ -float furi_hal_bt_get_rssi(); +float furi_hal_bt_get_rssi(void); /** Get number of transmitted packets * * @return packet count */ -uint32_t furi_hal_bt_get_transmitted_packets(); +uint32_t furi_hal_bt_get_transmitted_packets(void); /** Check & switch C2 to given mode * @@ -272,25 +272,25 @@ bool furi_hal_bt_extra_beacon_set_config(const GapExtraBeaconConfig* config); * * @return true on success */ -bool furi_hal_bt_extra_beacon_start(); +bool furi_hal_bt_extra_beacon_start(void); /** Stop extra beacon * * @return true on success */ -bool furi_hal_bt_extra_beacon_stop(); +bool furi_hal_bt_extra_beacon_stop(void); /** Check if extra beacon is active. * * @return extra beacon state */ -bool furi_hal_bt_extra_beacon_is_active(); +bool furi_hal_bt_extra_beacon_is_active(void); /** Get last configured extra beacon config * * @return extra beacon config. NULL if beacon had never been configured. */ -const GapExtraBeaconConfig* furi_hal_bt_extra_beacon_get_config(); +const GapExtraBeaconConfig* furi_hal_bt_extra_beacon_get_config(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_cortex.h b/targets/furi_hal_include/furi_hal_cortex.h index ebabbabfd8f..81271d31575 100644 --- a/targets/furi_hal_include/furi_hal_cortex.h +++ b/targets/furi_hal_include/furi_hal_cortex.h @@ -20,7 +20,7 @@ typedef struct { /** Early init stage for cortex */ -void furi_hal_cortex_init_early(); +void furi_hal_cortex_init_early(void); /** Microseconds delay * @@ -32,7 +32,7 @@ void furi_hal_cortex_delay_us(uint32_t microseconds); * * @return instructions per microsecond count */ -uint32_t furi_hal_cortex_instructions_per_microsecond(); +uint32_t furi_hal_cortex_instructions_per_microsecond(void); /** Get Timer * diff --git a/targets/furi_hal_include/furi_hal_crypto.h b/targets/furi_hal_include/furi_hal_crypto.h index 5e3b4104041..04a2c67cf18 100644 --- a/targets/furi_hal_include/furi_hal_crypto.h +++ b/targets/furi_hal_include/furi_hal_crypto.h @@ -91,7 +91,7 @@ typedef enum { } FuriHalCryptoGCMState; /** Initialize cryptography layer(includes AES engines, PKA and RNG) */ -void furi_hal_crypto_init(); +void furi_hal_crypto_init(void); /** Verify factory provisioned keys * diff --git a/targets/furi_hal_include/furi_hal_debug.h b/targets/furi_hal_include/furi_hal_debug.h index befbb4f40cb..1ea231bd070 100644 --- a/targets/furi_hal_include/furi_hal_debug.h +++ b/targets/furi_hal_include/furi_hal_debug.h @@ -13,13 +13,13 @@ extern "C" { #endif /** Enable MCU debug */ -void furi_hal_debug_enable(); +void furi_hal_debug_enable(void); /** Disable MCU debug */ -void furi_hal_debug_disable(); +void furi_hal_debug_disable(void); /** Check if GDB debug session is active */ -bool furi_hal_debug_is_gdb_session_active(); +bool furi_hal_debug_is_gdb_session_active(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_i2c.h b/targets/furi_hal_include/furi_hal_i2c.h index 44f647cefcc..7d69cd74d03 100644 --- a/targets/furi_hal_include/furi_hal_i2c.h +++ b/targets/furi_hal_include/furi_hal_i2c.h @@ -43,13 +43,13 @@ typedef enum { } FuriHalI2cEnd; /** Early Init I2C */ -void furi_hal_i2c_init_early(); +void furi_hal_i2c_init_early(void); /** Early DeInit I2C */ -void furi_hal_i2c_deinit_early(); +void furi_hal_i2c_deinit_early(void); /** Init I2C */ -void furi_hal_i2c_init(); +void furi_hal_i2c_init(void); /** Acquire I2C bus handle * diff --git a/targets/furi_hal_include/furi_hal_light.h b/targets/furi_hal_include/furi_hal_light.h index 0e06bd4239c..60f16afe8f6 100644 --- a/targets/furi_hal_include/furi_hal_light.h +++ b/targets/furi_hal_include/furi_hal_light.h @@ -15,7 +15,7 @@ extern "C" { /** Init light driver */ -void furi_hal_light_init(); +void furi_hal_light_init(void); /** Set light value * @@ -35,7 +35,7 @@ void furi_hal_light_blink_start(Light light, uint8_t brightness, uint16_t on_tim /** Stop hardware LED blinking mode */ -void furi_hal_light_blink_stop(); +void furi_hal_light_blink_stop(void); /** Set color in hardware LED blinking mode * diff --git a/targets/furi_hal_include/furi_hal_memory.h b/targets/furi_hal_include/furi_hal_memory.h index e9efa08c158..6451d93bca3 100644 --- a/targets/furi_hal_include/furi_hal_memory.h +++ b/targets/furi_hal_include/furi_hal_memory.h @@ -15,7 +15,7 @@ extern "C" { /** * @brief Init memory pool manager */ -void furi_hal_memory_init(); +void furi_hal_memory_init(void); /** * @brief Allocate memory from separate memory pool. That memory can't be freed. @@ -30,14 +30,14 @@ void* furi_hal_memory_alloc(size_t size); * * @return size_t */ -size_t furi_hal_memory_get_free(); +size_t furi_hal_memory_get_free(void); /** * @brief Get max free block size from memory pool * * @return size_t */ -size_t furi_hal_memory_max_pool_block(); +size_t furi_hal_memory_max_pool_block(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_mpu.h b/targets/furi_hal_include/furi_hal_mpu.h index 5dddadeb6b6..7a5759c1758 100644 --- a/targets/furi_hal_include/furi_hal_mpu.h +++ b/targets/furi_hal_include/furi_hal_mpu.h @@ -57,17 +57,17 @@ typedef enum { /** * @brief Initialize memory protection unit */ -void furi_hal_mpu_init(); +void furi_hal_mpu_init(void); /** * @brief Enable memory protection unit */ -void furi_hal_mpu_enable(); +void furi_hal_mpu_enable(void); /** * @brief Disable memory protection unit */ -void furi_hal_mpu_disable(); +void furi_hal_mpu_disable(void); void furi_hal_mpu_protect_no_access( FuriHalMpuRegion region, diff --git a/targets/furi_hal_include/furi_hal_nfc.h b/targets/furi_hal_include/furi_hal_nfc.h index 3d8ff394efb..1c9f54d359c 100644 --- a/targets/furi_hal_include/furi_hal_nfc.h +++ b/targets/furi_hal_include/furi_hal_nfc.h @@ -101,14 +101,14 @@ typedef enum { * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_init(); +FuriHalNfcError furi_hal_nfc_init(void); /** * @brief Check whether the NFC HAL was properly initialised and is ready. * * @returns FuriHalNfcErrorNone if ready, any other error code if not ready. */ -FuriHalNfcError furi_hal_nfc_is_hal_ready(); +FuriHalNfcError furi_hal_nfc_is_hal_ready(void); /** * @brief Exclusively take over the NFC HAL and associated hardware. @@ -118,7 +118,7 @@ FuriHalNfcError furi_hal_nfc_is_hal_ready(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_acquire(); +FuriHalNfcError furi_hal_nfc_acquire(void); /** * @brief Release the exclusive lock and make the NFC HAL available for others. @@ -129,7 +129,7 @@ FuriHalNfcError furi_hal_nfc_acquire(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_release(); +FuriHalNfcError furi_hal_nfc_release(void); /** * @brief Configure the NFC hardware to enter the low-power mode. @@ -139,7 +139,7 @@ FuriHalNfcError furi_hal_nfc_release(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_low_power_mode_start(); +FuriHalNfcError furi_hal_nfc_low_power_mode_start(void); /** * @brief Configure the NFC hardware to exit the low-power mode. @@ -149,7 +149,7 @@ FuriHalNfcError furi_hal_nfc_low_power_mode_start(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_low_power_mode_stop(); +FuriHalNfcError furi_hal_nfc_low_power_mode_stop(void); /** * @brief Configure the NFC HAL to work in a particular mode. @@ -167,28 +167,28 @@ FuriHalNfcError furi_hal_nfc_set_mode(FuriHalNfcMode mode, FuriHalNfcTech tech); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_reset_mode(); +FuriHalNfcError furi_hal_nfc_reset_mode(void); /** * @brief Enable field (carrier) detection by the NFC hardware. * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_field_detect_start(); +FuriHalNfcError furi_hal_nfc_field_detect_start(void); /** * @brief Disable field (carrier) detection by the NFC hardware. * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_field_detect_stop(); +FuriHalNfcError furi_hal_nfc_field_detect_stop(void); /** * @brief Check if the reader field (carrier) was detected by the NFC hardware. * * @returns true if the field was detected, false otherwise. */ -bool furi_hal_nfc_field_is_present(); +bool furi_hal_nfc_field_is_present(void); /** * @brief Enable field (carrier) generation by the NFC hardware. @@ -197,7 +197,7 @@ bool furi_hal_nfc_field_is_present(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_poller_field_on(); +FuriHalNfcError furi_hal_nfc_poller_field_on(void); /** * @brief Wait for an NFC HAL event in poller mode. @@ -263,7 +263,7 @@ FuriHalNfcError furi_hal_nfc_listener_rx(uint8_t* rx_data, size_t rx_data_size, * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_listener_sleep(); +FuriHalNfcError furi_hal_nfc_listener_sleep(void); /** * @brief Go to idle in listener mode. @@ -272,7 +272,7 @@ FuriHalNfcError furi_hal_nfc_listener_sleep(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_listener_idle(); +FuriHalNfcError furi_hal_nfc_listener_idle(void); /** * @brief Enable reception in listener mode. @@ -281,7 +281,7 @@ FuriHalNfcError furi_hal_nfc_listener_idle(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_listener_enable_rx(); +FuriHalNfcError furi_hal_nfc_listener_enable_rx(void); /** * @brief Reset communication. @@ -290,7 +290,7 @@ FuriHalNfcError furi_hal_nfc_listener_enable_rx(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_trx_reset(); +FuriHalNfcError furi_hal_nfc_trx_reset(void); /** * @brief Enable generation of NFC HAL events. @@ -300,7 +300,7 @@ FuriHalNfcError furi_hal_nfc_trx_reset(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_event_start(); +FuriHalNfcError furi_hal_nfc_event_start(void); /** * @brief Disable generation of NFC HAL events. @@ -309,14 +309,14 @@ FuriHalNfcError furi_hal_nfc_event_start(); * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_event_stop(); +FuriHalNfcError furi_hal_nfc_event_stop(void); /** * @brief Manually emit the FuriHalNfcEventAbortRequest event. * * @returns FuriHalNfcErrorNone on success, any other error code on failure. */ -FuriHalNfcError furi_hal_nfc_abort(); +FuriHalNfcError furi_hal_nfc_abort(void); /** * @brief Start frame wait timeout timer. @@ -328,7 +328,7 @@ void furi_hal_nfc_timer_fwt_start(uint32_t time_fc); /** * @brief Stop frame wait timeout timer. */ -void furi_hal_nfc_timer_fwt_stop(); +void furi_hal_nfc_timer_fwt_stop(void); /** * @brief Start block transmit (frame delay) timer. @@ -347,14 +347,14 @@ void furi_hal_nfc_timer_block_tx_start_us(uint32_t time_us); /** * @brief Stop block transmit (frame delay) timer. */ -void furi_hal_nfc_timer_block_tx_stop(); +void furi_hal_nfc_timer_block_tx_stop(void); /** * @brief Check whether block transmit (frame delay) timer is running. * * @returns true if timer is running, false otherwise. */ -bool furi_hal_nfc_timer_block_tx_is_running(); +bool furi_hal_nfc_timer_block_tx_is_running(void); /* * Technology-specific functions. @@ -450,7 +450,7 @@ FuriHalNfcError furi_hal_nfc_iso14443a_listener_tx_custom_parity( * * @return FuriHalNfcError */ -FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof(); +FuriHalNfcError furi_hal_nfc_iso15693_listener_tx_sof(void); /** * @brief Set FeliCa collision resolution parameters in listener mode. diff --git a/targets/furi_hal_include/furi_hal_power.h b/targets/furi_hal_include/furi_hal_power.h index fa5e179c003..06598df86a3 100644 --- a/targets/furi_hal_include/furi_hal_power.h +++ b/targets/furi_hal_include/furi_hal_power.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -21,7 +22,7 @@ typedef enum { } FuriHalPowerIC; /** Initialize drivers */ -void furi_hal_power_init(); +void furi_hal_power_init(void); /** Check if gauge is ok * @@ -32,104 +33,104 @@ void furi_hal_power_init(); * * @return true if gauge is ok */ -bool furi_hal_power_gauge_is_ok(); +bool furi_hal_power_gauge_is_ok(void); /** Check if gauge requests system shutdown * * @return true if system shutdown requested */ -bool furi_hal_power_is_shutdown_requested(); +bool furi_hal_power_is_shutdown_requested(void); /** Get current insomnia level * * @return insomnia level: 0 - no insomnia, >0 - insomnia, bearer count. */ -uint16_t furi_hal_power_insomnia_level(); +uint16_t furi_hal_power_insomnia_level(void); /** Enter insomnia mode Prevents device from going to sleep * @warning Internally increases insomnia level Must be paired with * furi_hal_power_insomnia_exit */ -void furi_hal_power_insomnia_enter(); +void furi_hal_power_insomnia_enter(void); /** Exit insomnia mode Allow device to go to sleep * @warning Internally decreases insomnia level. Must be paired with * furi_hal_power_insomnia_enter */ -void furi_hal_power_insomnia_exit(); +void furi_hal_power_insomnia_exit(void); /** Check if sleep available * * @return true if available */ -bool furi_hal_power_sleep_available(); +bool furi_hal_power_sleep_available(void); /** Go to sleep */ -void furi_hal_power_sleep(); +void furi_hal_power_sleep(void); /** Get predicted remaining battery capacity in percents * * @return remaining battery capacity in percents */ -uint8_t furi_hal_power_get_pct(); +uint8_t furi_hal_power_get_pct(void); /** Get battery health state in percents * * @return health in percents */ -uint8_t furi_hal_power_get_bat_health_pct(); +uint8_t furi_hal_power_get_bat_health_pct(void); /** Get charging status * * @return true if charging */ -bool furi_hal_power_is_charging(); +bool furi_hal_power_is_charging(void); /** Get charge complete status * * @return true if done charging and connected to charger */ -bool furi_hal_power_is_charging_done(); +bool furi_hal_power_is_charging_done(void); /** Switch MCU to SHUTDOWN */ -void furi_hal_power_shutdown(); +void furi_hal_power_shutdown(void); /** Poweroff device */ -void furi_hal_power_off(); +void furi_hal_power_off(void); /** Reset device */ -void furi_hal_power_reset(); +FURI_NORETURN void furi_hal_power_reset(void); /** OTG enable */ -bool furi_hal_power_enable_otg(); +bool furi_hal_power_enable_otg(void); /** OTG disable */ -void furi_hal_power_disable_otg(); +void furi_hal_power_disable_otg(void); /** Check OTG status fault */ -bool furi_hal_power_check_otg_fault(); +bool furi_hal_power_check_otg_fault(void); /** Check OTG status and disable it if falt happened */ -void furi_hal_power_check_otg_status(); +void furi_hal_power_check_otg_status(void); /** Get OTG status * * @return true if enabled */ -bool furi_hal_power_is_otg_enabled(); +bool furi_hal_power_is_otg_enabled(void); /** Get battery charge voltage limit in V * * @return voltage in V */ -float furi_hal_power_get_battery_charge_voltage_limit(); +float furi_hal_power_get_battery_charge_voltage_limit(void); /** Set battery charge voltage limit in V * @@ -143,19 +144,19 @@ void furi_hal_power_set_battery_charge_voltage_limit(float voltage); * * @return capacity in mAh */ -uint32_t furi_hal_power_get_battery_remaining_capacity(); +uint32_t furi_hal_power_get_battery_remaining_capacity(void); /** Get full charge battery capacity in mAh * * @return capacity in mAh */ -uint32_t furi_hal_power_get_battery_full_capacity(); +uint32_t furi_hal_power_get_battery_full_capacity(void); /** Get battery capacity in mAh from battery profile * * @return capacity in mAh */ -uint32_t furi_hal_power_get_battery_design_capacity(); +uint32_t furi_hal_power_get_battery_design_capacity(void); /** Get battery voltage in V * @@ -185,25 +186,25 @@ float furi_hal_power_get_battery_temperature(FuriHalPowerIC ic); * * @return voltage in V */ -float furi_hal_power_get_usb_voltage(); +float furi_hal_power_get_usb_voltage(void); /** Enable 3.3v on external gpio and sd card */ -void furi_hal_power_enable_external_3_3v(); +void furi_hal_power_enable_external_3_3v(void); /** Disable 3.3v on external gpio and sd card */ -void furi_hal_power_disable_external_3_3v(); +void furi_hal_power_disable_external_3_3v(void); /** Enter supress charge mode. * * Use this function when your application need clean power supply. */ -void furi_hal_power_suppress_charge_enter(); +void furi_hal_power_suppress_charge_enter(void); /** Exit supress charge mode */ -void furi_hal_power_suppress_charge_exit(); +void furi_hal_power_suppress_charge_exit(void); /** Get power information * diff --git a/targets/furi_hal_include/furi_hal_random.h b/targets/furi_hal_include/furi_hal_random.h index 5ca9cb723c3..051b6f928d6 100644 --- a/targets/furi_hal_include/furi_hal_random.h +++ b/targets/furi_hal_include/furi_hal_random.h @@ -7,13 +7,13 @@ extern "C" { #endif /** Initialize random subsystem */ -void furi_hal_random_init(); +void furi_hal_random_init(void); /** Get random value * * @return random value */ -uint32_t furi_hal_random_get(); +uint32_t furi_hal_random_get(void); /** Fill buffer with random data * diff --git a/targets/furi_hal_include/furi_hal_region.h b/targets/furi_hal_include/furi_hal_region.h index accd7e127cc..eed5bef92c9 100644 --- a/targets/furi_hal_include/furi_hal_region.h +++ b/targets/furi_hal_include/furi_hal_region.h @@ -22,7 +22,7 @@ typedef struct { } FuriHalRegion; /** Initialize region */ -void furi_hal_region_init(); +void furi_hal_region_init(void); /** Get Region Data. * @@ -31,7 +31,7 @@ void furi_hal_region_init(); * * @return pointer to FuriHalRegion instance (in RAM or Flash, check before freeing on region update) */ -const FuriHalRegion* furi_hal_region_get(); +const FuriHalRegion* furi_hal_region_get(void); /** Set device region data * @@ -43,7 +43,7 @@ void furi_hal_region_set(FuriHalRegion* region); * * @return true if provisioned, false otherwise */ -bool furi_hal_region_is_provisioned(); +bool furi_hal_region_is_provisioned(void); /** Get region name * @@ -55,7 +55,7 @@ bool furi_hal_region_is_provisioned(); * * @return Pointer to string */ -const char* furi_hal_region_get_name(); +const char* furi_hal_region_get_name(void); /** Сheck if transmission is allowed on this frequency for your flipper region * diff --git a/targets/furi_hal_include/furi_hal_sd.h b/targets/furi_hal_include/furi_hal_sd.h index 645403b7f54..28534846ca0 100644 --- a/targets/furi_hal_include/furi_hal_sd.h +++ b/targets/furi_hal_include/furi_hal_sd.h @@ -29,19 +29,19 @@ typedef struct { /** * @brief Init SD card presence detection */ -void furi_hal_sd_presence_init(); +void furi_hal_sd_presence_init(void); /** * @brief Get SD card status * @return true if SD card is present */ -bool furi_hal_sd_is_present(); +bool furi_hal_sd_is_present(void); /** * @brief SD card max mount retry count * @return uint8_t */ -uint8_t furi_hal_sd_max_mount_retry_count(); +uint8_t furi_hal_sd_max_mount_retry_count(void); /** * @brief Init SD card @@ -79,7 +79,7 @@ FuriStatus furi_hal_sd_info(FuriHalSdInfo* info); * @brief Get SD card state * @return FuriStatus */ -FuriStatus furi_hal_sd_get_card_state(); +FuriStatus furi_hal_sd_get_card_state(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_speaker.h b/targets/furi_hal_include/furi_hal_speaker.h index 0b33d923274..825a44e04ed 100644 --- a/targets/furi_hal_include/furi_hal_speaker.h +++ b/targets/furi_hal_include/furi_hal_speaker.h @@ -11,10 +11,10 @@ extern "C" { #endif /** Init speaker */ -void furi_hal_speaker_init(); +void furi_hal_speaker_init(void); /** Deinit speaker */ -void furi_hal_speaker_deinit(); +void furi_hal_speaker_deinit(void); /** Acquire speaker ownership * @@ -30,7 +30,7 @@ FURI_WARN_UNUSED bool furi_hal_speaker_acquire(uint32_t timeout); * * @warning You must release speaker ownership after use */ -void furi_hal_speaker_release(); +void furi_hal_speaker_release(void); /** Check current process speaker ownership * @@ -38,7 +38,7 @@ void furi_hal_speaker_release(); * * @return bool returns true if process owns speaker */ -bool furi_hal_speaker_is_mine(); +bool furi_hal_speaker_is_mine(void); /** Play a note * @@ -61,7 +61,7 @@ void furi_hal_speaker_set_volume(float volume); * * @warning no ownership check if called from ISR */ -void furi_hal_speaker_stop(); +void furi_hal_speaker_stop(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_spi.h b/targets/furi_hal_include/furi_hal_spi.h index af15a88381a..d497dff5c35 100644 --- a/targets/furi_hal_include/furi_hal_spi.h +++ b/targets/furi_hal_include/furi_hal_spi.h @@ -8,16 +8,16 @@ extern "C" { #endif /** Early initialize SPI HAL */ -void furi_hal_spi_config_init_early(); +void furi_hal_spi_config_init_early(void); /** Early deinitialize SPI HAL */ -void furi_hal_spi_config_deinit_early(); +void furi_hal_spi_config_deinit_early(void); /** Initialize SPI HAL */ -void furi_hal_spi_config_init(); +void furi_hal_spi_config_init(void); /** Initialize SPI DMA HAL */ -void furi_hal_spi_dma_init(); +void furi_hal_spi_dma_init(void); /** Initialize SPI Bus * diff --git a/targets/furi_hal_include/furi_hal_usb.h b/targets/furi_hal_include/furi_hal_usb.h index a98797955da..213e8d56f10 100644 --- a/targets/furi_hal_include/furi_hal_usb.h +++ b/targets/furi_hal_include/furi_hal_usb.h @@ -41,7 +41,7 @@ typedef void (*FuriHalUsbStateCallback)(FuriHalUsbStateEvent state, void* contex /** USB device low-level initialization */ -void furi_hal_usb_init(); +void furi_hal_usb_init(void); /** Set USB device configuration * @@ -55,29 +55,29 @@ bool furi_hal_usb_set_config(FuriHalUsbInterface* new_if, void* ctx); * * @return current USB device mode */ -FuriHalUsbInterface* furi_hal_usb_get_config(); +FuriHalUsbInterface* furi_hal_usb_get_config(void); /** Lock USB device mode switch */ -void furi_hal_usb_lock(); +void furi_hal_usb_lock(void); /** Unlock USB device mode switch */ -void furi_hal_usb_unlock(); +void furi_hal_usb_unlock(void); /** Check if USB device mode switch locked * * @return lock state */ -bool furi_hal_usb_is_locked(); +bool furi_hal_usb_is_locked(void); /** Disable USB device */ -void furi_hal_usb_disable(); +void furi_hal_usb_disable(void); /** Enable USB device */ -void furi_hal_usb_enable(); +void furi_hal_usb_enable(void); /** Set USB state callback */ @@ -85,7 +85,7 @@ void furi_hal_usb_set_state_callback(FuriHalUsbStateCallback cb, void* ctx); /** Restart USB device */ -void furi_hal_usb_reinit(); +void furi_hal_usb_reinit(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_usb_ccid.h b/targets/furi_hal_include/furi_hal_usb_ccid.h index a4880e4b6c4..500bafa3dfd 100644 --- a/targets/furi_hal_include/furi_hal_usb_ccid.h +++ b/targets/furi_hal_include/furi_hal_usb_ccid.h @@ -28,8 +28,8 @@ typedef struct { void furi_hal_ccid_set_callbacks(CcidCallbacks* cb); -void furi_hal_ccid_ccid_insert_smartcard(); -void furi_hal_ccid_ccid_remove_smartcard(); +void furi_hal_ccid_ccid_insert_smartcard(void); +void furi_hal_ccid_ccid_remove_smartcard(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_usb_hid.h b/targets/furi_hal_include/furi_hal_usb_hid.h index 13e83ef6752..da851cabb65 100644 --- a/targets/furi_hal_include/furi_hal_usb_hid.h +++ b/targets/furi_hal_include/furi_hal_usb_hid.h @@ -190,13 +190,13 @@ enum HidMouseButtons { * * @return true / false */ -bool furi_hal_hid_is_connected(); +bool furi_hal_hid_is_connected(void); /** Get USB HID keyboard leds state * * @return leds state */ -uint8_t furi_hal_hid_get_led_state(); +uint8_t furi_hal_hid_get_led_state(void); /** Set USB HID connect/disconnect callback * @@ -220,7 +220,7 @@ bool furi_hal_hid_kb_release(uint16_t button); /** Clear all pressed keys and send HID report * */ -bool furi_hal_hid_kb_release_all(); +bool furi_hal_hid_kb_release_all(void); /** Set mouse movement and send HID report * diff --git a/targets/furi_hal_include/furi_hal_usb_hid_u2f.h b/targets/furi_hal_include/furi_hal_usb_hid_u2f.h index 1b20a33c487..444ef552f22 100644 --- a/targets/furi_hal_include/furi_hal_usb_hid_u2f.h +++ b/targets/furi_hal_include/furi_hal_usb_hid_u2f.h @@ -18,7 +18,7 @@ typedef void (*HidU2fCallback)(HidU2fEvent ev, void* context); * * @return true / false */ -bool furi_hal_hid_u2f_is_connected(); +bool furi_hal_hid_u2f_is_connected(void); /** Set HID U2F event callback * diff --git a/targets/furi_hal_include/furi_hal_version.h b/targets/furi_hal_include/furi_hal_version.h index 8e7059fbc47..79ebf4275d8 100644 --- a/targets/furi_hal_include/furi_hal_version.h +++ b/targets/furi_hal_include/furi_hal_version.h @@ -54,157 +54,157 @@ typedef enum { /** Init flipper version */ -void furi_hal_version_init(); +void furi_hal_version_init(void); /** Check target firmware version * * @return true if target and real matches */ -bool furi_hal_version_do_i_belong_here(); +bool furi_hal_version_do_i_belong_here(void); /** Get model name * * @return model name C-string */ -const char* furi_hal_version_get_model_name(); +const char* furi_hal_version_get_model_name(void); /** Get model name * * @return model code C-string */ -const char* furi_hal_version_get_model_code(); +const char* furi_hal_version_get_model_code(void); /** Get FCC ID * * @return FCC id as C-string */ -const char* furi_hal_version_get_fcc_id(); +const char* furi_hal_version_get_fcc_id(void); /** Get IC id * * @return IC id as C-string */ -const char* furi_hal_version_get_ic_id(); +const char* furi_hal_version_get_ic_id(void); /** Get MIC id * * @return MIC id as C-string */ -const char* furi_hal_version_get_mic_id(); +const char* furi_hal_version_get_mic_id(void); /** Get SRRC id * * @return SRRC id as C-string */ -const char* furi_hal_version_get_srrc_id(); +const char* furi_hal_version_get_srrc_id(void); /** Get NCC id * * @return NCC id as C-string */ -const char* furi_hal_version_get_ncc_id(); +const char* furi_hal_version_get_ncc_id(void); /** Get OTP version * * @return OTP Version */ -FuriHalVersionOtpVersion furi_hal_version_get_otp_version(); +FuriHalVersionOtpVersion furi_hal_version_get_otp_version(void); /** Get hardware version * * @return Hardware Version */ -uint8_t furi_hal_version_get_hw_version(); +uint8_t furi_hal_version_get_hw_version(void); /** Get hardware target * * @return Hardware Target */ -uint8_t furi_hal_version_get_hw_target(); +uint8_t furi_hal_version_get_hw_target(void); /** Get hardware body * * @return Hardware Body */ -uint8_t furi_hal_version_get_hw_body(); +uint8_t furi_hal_version_get_hw_body(void); /** Get hardware body color * * @return Hardware Color */ -FuriHalVersionColor furi_hal_version_get_hw_color(); +FuriHalVersionColor furi_hal_version_get_hw_color(void); /** Get hardware connect * * @return Hardware Interconnect */ -uint8_t furi_hal_version_get_hw_connect(); +uint8_t furi_hal_version_get_hw_connect(void); /** Get hardware region * * @return Hardware Region */ -FuriHalVersionRegion furi_hal_version_get_hw_region(); +FuriHalVersionRegion furi_hal_version_get_hw_region(void); /** Get hardware region name * * @return Hardware Region name */ -const char* furi_hal_version_get_hw_region_name(); +const char* furi_hal_version_get_hw_region_name(void); /** Get hardware display id * * @return Display id */ -FuriHalVersionDisplay furi_hal_version_get_hw_display(); +FuriHalVersionDisplay furi_hal_version_get_hw_display(void); /** Get hardware timestamp * * @return Hardware Manufacture timestamp */ -uint32_t furi_hal_version_get_hw_timestamp(); +uint32_t furi_hal_version_get_hw_timestamp(void); /** Get pointer to target name * * @return Hardware Name C-string */ -const char* furi_hal_version_get_name_ptr(); +const char* furi_hal_version_get_name_ptr(void); /** Get pointer to target device name * * @return Hardware Device Name C-string */ -const char* furi_hal_version_get_device_name_ptr(); +const char* furi_hal_version_get_device_name_ptr(void); /** Get pointer to target ble local device name * * @return Ble Device Name C-string */ -const char* furi_hal_version_get_ble_local_device_name_ptr(); +const char* furi_hal_version_get_ble_local_device_name_ptr(void); /** Get BLE MAC address * * @return pointer to BLE MAC address */ -const uint8_t* furi_hal_version_get_ble_mac(); +const uint8_t* furi_hal_version_get_ble_mac(void); /** Get address of version structure of firmware. * * @return Address of firmware version structure. */ -const struct Version* furi_hal_version_get_firmware_version(); +const struct Version* furi_hal_version_get_firmware_version(void); /** Get platform UID size in bytes * * @return UID size in bytes */ -size_t furi_hal_version_uid_size(); +size_t furi_hal_version_uid_size(void); /** Get const pointer to UID * * @return pointer to UID */ -const uint8_t* furi_hal_version_uid(); +const uint8_t* furi_hal_version_uid(void); #ifdef __cplusplus } diff --git a/targets/furi_hal_include/furi_hal_vibro.h b/targets/furi_hal_include/furi_hal_vibro.h index fa5a54c681c..0254f42e0c4 100644 --- a/targets/furi_hal_include/furi_hal_vibro.h +++ b/targets/furi_hal_include/furi_hal_vibro.h @@ -15,7 +15,7 @@ extern "C" { /** Initialize vibro */ -void furi_hal_vibro_init(); +void furi_hal_vibro_init(void); /** Turn on/off vibro * From bcde0aefbdb3c3b17bbed56340587e5d85cb72ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Wed, 20 Mar 2024 00:23:06 +0900 Subject: [PATCH 03/28] [FL-3729] Gui: unicode support, new canvas API (#3322) * Revert "Rollback #3305 and #3297 fix various rendering issues (#3307)" This reverts commit 531ba24e9a1af8ff007e72dd976cb66259895bc7. * Gui: refactor canvas to use proper coordinate system types. Furi: new furi_break check macros. Desktop: proper types for negative offset. * Desktop: proper types in desktop_view_locked_doors_draw * Examples: update images example, off it goes --------- Co-authored-by: hedger --- .../example_custom_font/example_custom_font.c | 86 ++++++++---- .../examples/example_images/example_images.c | 4 +- .../desktop/views/desktop_view_locked.c | 20 +-- applications/services/gui/canvas.c | 124 ++++++++--------- applications/services/gui/canvas.h | 131 +++++++++--------- applications/services/gui/canvas_i.h | 24 ++-- furi/core/check.h | 7 + lib/u8g2/u8g2.h | 2 +- targets/f18/api_symbols.csv | 42 +++--- targets/f7/api_symbols.csv | 42 +++--- 10 files changed, 259 insertions(+), 223 deletions(-) diff --git a/applications/examples/example_custom_font/example_custom_font.c b/applications/examples/example_custom_font/example_custom_font.c index 2fec419041b..405db46e30a 100644 --- a/applications/examples/example_custom_font/example_custom_font.c +++ b/applications/examples/example_custom_font/example_custom_font.c @@ -11,35 +11,62 @@ //This arrays contains the font itself. You can use any u8g2 font you want /* -Fontname: -Raccoon-Fixed4x6-Medium-R-Normal--6-60-75-75-P-40-ISO10646-1 -Copyright: -Glyphs: 95/203 -BBX Build Mode: 0 + Fontname: -Misc-Fixed-Medium-R-Normal--6-60-75-75-C-40-ISO10646-1 + Copyright: Public domain font. Share and enjoy. + Glyphs: 191/919 + BBX Build Mode: 0 */ -const uint8_t u8g2_font_tom_thumb_4x6_tr[725] = - "_\0\2\2\2\3\3\4\4\3\6\0\377\5\377\5\0\0\352\1\330\2\270 \5\340\315\0!\6\265\310" - "\254\0\42\6\213\313$\25#\10\227\310\244\241\206\12$\10\227\310\215\70b\2%\10\227\310d\324F\1" - "&\10\227\310(\65R\22'\5\251\313\10(\6\266\310\251\62)\10\226\310\304\224\24\0*\6\217\312\244" - "\16+\7\217\311\245\225\0,\6\212\310)\0-\5\207\312\14.\5\245\310\4/\7\227\310Ve\4\60" - "\7\227\310-k\1\61\6\226\310\255\6\62\10\227\310h\220\312\1\63\11\227\310h\220\62X\0\64\10\227" - "\310$\65b\1\65\10\227\310\214\250\301\2\66\10\227\310\315\221F\0\67\10\227\310\314TF\0\70\10\227" - "\310\214\64\324\10\71\10\227\310\214\64\342\2:\6\255\311\244\0;\7\222\310e\240\0<\10\227\310\246\32" - "d\20=\6\217\311l\60>\11\227\310d\220A*\1\77\10\227\310\314\224a\2@\10\227\310UC\3" - "\1A\10\227\310UC\251\0B\10\227\310\250\264\322\2C\7\227\310\315\32\10D\10\227\310\250d-\0" - "E\10\227\310\214\70\342\0F\10\227\310\214\70b\4G\10\227\310\315\221\222\0H\10\227\310$\65\224\12" - "I\7\227\310\254X\15J\7\227\310\226\252\2K\10\227\310$\265\222\12L\7\227\310\304\346\0M\10\227" - "\310\244\61\224\12N\10\227\310\244q\250\0O\7\227\310UV\5P\10\227\310\250\264b\4Q\10\227\310" - "Uj$\1R\10\227\310\250\64V\1S\10\227\310m\220\301\2T\7\227\310\254\330\2U\7\227\310$" - "W\22V\10\227\310$\253L\0W\10\227\310$\65\206\12X\10\227\310$\325R\1Y\10\227\310$U" - "V\0Z\7\227\310\314T\16[\7\227\310\214X\16\134\10\217\311d\220A\0]\7\227\310\314r\4^" - "\5\213\313\65_\5\207\310\14`\6\212\313\304\0a\7\223\310\310\65\2b\10\227\310D\225\324\2c\7" - "\223\310\315\14\4d\10\227\310\246\245\222\0e\6\223\310\235\2f\10\227\310\246\264b\2g\10\227\307\35" - "\61%\0h\10\227\310D\225\254\0i\6\265\310\244\1j\10\233\307f\30U\5k\10\227\310\304\264T" - "\1l\7\227\310\310\326\0m\7\223\310\11\253\310d\220A*\1\77\11\253\310h\220\62L\0@\7" + "\253\310-\33\10A\10\253\310UC\251\0B\10\253\310\250\264\322\2C\10\253\310U\62U\0D\10\253" + "\310\250d-\0E\10\253\310\214\250\342\0F\10\253\310\214\250b\4G\10\253\310\315\244\222\0H\10\253" + "\310$\65\224\12I\7\253\310\254X\15J\7\253\310\226\252\2K\10\253\310$\265\222\12L\7\253\310\304" + "\346\0M\10\253\310\244\61\224\12N\10\253\310\252\241$\0O\7\253\310UV\5P\10\253\310\250\264b" + "\4Q\10\263\307UV\15\2R\10\253\310\250\264\222\12S\10\253\310m\220\301\2T\7\253\310\254\330\2" + "U\7\253\310$\327\10V\10\253\310$k\244\4W\10\253\310$\65\206\12X\10\253\310$\325R\1Y" + "\10\253\310$UV\0Z\7\253\310\314T\16[\6\352\310\254J\134\11\253\310\304\14\62\210\1]\6\252" + "\310\250j^\5\223\313\65_\5\213\307\14`\6\322\313\304\0a\7\243\310-\225\4b\10\253\310D\225" + "\324\2c\7\243\310\315\14\4d\10\253\310\246\245\222\0e\6\243\310USf\10\253\310\246\264b\2g" + "\10\253\307\255$\27\0h\10\253\310D\225\254\0i\10\253\310e$\323\0j\10\263\307fX.\0k" + "\10\253\310\304\264\222\12l\7\253\310\310\326\0m\10\243\310\244\241T\0n\7\243\310\250d\5o\7\243" + "\310U\252\2p\10\253\307\250\264b\4q\10\253\307-\225d\0r\10\243\310\244\25#\0s\10\243\310" + "\215\14\26\0t\10\253\310\245\25\63\10u\7\243\310$+\11v\7\243\310$\253\2w\10\243\310$\65" + "T\0x\7\243\310\244\62\25y\10\253\307$\225\344\2z\7\243\310\314\224\6{\10\263\307\246$k\20" + "|\6\351\310\14\1}\11\263\307d\20UL\21~\7\224\313%\225\0\0\0\0\4\377\377\4\1\11\253" + "\310\244\261\342\0\4\2\11\253\310\214\250\222\12\4\3\10\253\310\16Y\2\4\4\11\253\310M\225\201\0\4" + "\5\11\253\310m\220\301\2\4\6\10\253\310\254X\15\4\7\11\253\310\244\221b\32\4\10\10\253\310\226\252" + "\2\4\11\11\254\310L\325Z\2\4\12\11\254\310\244\326JK\4\13\11\253\310\250\250\222\12\4\14\10\253" + "\310\312\264\12\4\16\11\263\307\244\32u\2\4\17\11\263\307$\327H\11\4\20\11\253\310UC\251\0\4" + "\21\11\253\310\214\250\322\2\4\22\11\253\310\250\264\322\2\4\23\10\253\310\214\330\4\4\24\11\263\307\254\245" + "\206\12\4\25\11\253\310\214\250\342\0\4\26\12\253\310\244\221\322H\1\4\27\12\253\310h\220\62X\0\4" + "\30\11\253\310\304\64T\14\4\31\11\263\307\315\64T\14\4\32\11\253\310$\265\222\12\4\33\10\253\310-" + "W\0\4\34\11\253\310\244\241\254\0\4\35\11\253\310$\65\224\12\4\36\10\253\310UV\5\4\37\10\253" + "\310\214\344\12\4 \11\253\310\250\264b\4\4!\11\253\310U\62U\0\4\42\10\253\310\254\330\2\4#" + "\11\263\307$\253L\21\4$\12\253\310\245\221FJ\0\4%\11\253\310$\325R\1\4&\10\253\310$" + "\327\10\4'\11\253\310$\225d\1\4(\11\253\310$\65\216\0\4)\12\264\307\244\326#\203\0\4*" + "\13\254\310h\220\201LI\1\4+\12\254\310D\271\324H\1\4,\11\253\310\304\250\322\2\4-\11\253" + "\310h\220\344\2\4.\12\254\310\244\244.\225\0\4/\11\253\310\255\264T\0\4\60\10\243\310-\225\4" + "\4\61\11\253\310\315\221*\0\4\62\11\243\310\14\225\26\0\4\63\10\243\310\214X\2\4\64\11\253\307-" + "\65T\0\4\65\7\243\310US\4\66\11\244\310$S%\1\4\67\11\243\310\254\14\26\0\4\70\11\243" + "\310\244\61T\0\4\71\11\253\310\244\326P\1\4:\10\243\310$\265\12\4;\7\243\310-+\4<\11" + "\243\310\244\241T\0\4=\11\243\310\244\241T\0\4>\10\243\310U\252\2\4\77\10\243\310\214d\5\4" + "@\11\253\307\250\264b\4\4A\10\243\310\315\14\4\4B\10\243\310\254X\1\4C\11\253\307$\225\344" + "\2\4D\12\263\307\305\224T\231\0\4E\10\243\310\244\62\25\4F\11\253\307$k\304\0\4G\11\243" + "\310$\225d\0\4H\10\243\310\244q\4\4I\11\254\307\244\364\310 \4J\12\244\310h SR\0" + "\4K\11\244\310\304\245F\12\4L\11\243\310D\225\26\0\4M\10\243\310H\271\0\4N\12\244\310\244" + "\244\226J\0\4O\10\243\310\255\264\2\4Q\10\253\310\244\326\24\4R\11\263\307D\25U\31\4S\11" + "\253\310\246\64b\4\4T\11\243\310\215\224\201\0\4U\11\243\310\215\14\26\0\4V\11\253\310e$\323" + "\0\4W\11\253\310\244\14d\32\4X\11\263\307fX.\0\4Y\10\244\310\251\326\22\4Z\11\244\310" + "\244\264\322\22\4[\11\253\310D\25U\1\4\134\10\253\310\312\264\12\4^\11\263\307\244\32u\2\4_" + "\11\253\307$k\244\4\4\220\10\253\310\16Y\2\4\221\10\243\310\16\31\1\4\222\11\253\310\251\264b\2" + "\4\223\11\243\310\251\264\22\0\0"; // Screen is 128x64 px static void app_draw_callback(Canvas* canvas, void* ctx) { @@ -47,10 +74,11 @@ static void app_draw_callback(Canvas* canvas, void* ctx) { canvas_clear(canvas); - canvas_set_custom_u8g2_font(canvas, u8g2_font_tom_thumb_4x6_tr); + canvas_set_custom_u8g2_font(canvas, u8g2_font_4x6_t_cyrillic); canvas_draw_str(canvas, 0, 6, "This is a tiny custom font"); canvas_draw_str(canvas, 0, 12, "012345.?! ,:;\"\'@#$%"); + canvas_draw_str(canvas, 0, 18, "И немного юникода"); } static void app_input_callback(InputEvent* input_event, void* ctx) { diff --git a/applications/examples/example_images/example_images.c b/applications/examples/example_images/example_images.c index c43a30b698a..ba9a354f608 100644 --- a/applications/examples/example_images/example_images.c +++ b/applications/examples/example_images/example_images.c @@ -13,7 +13,7 @@ #include "example_images_icons.h" typedef struct { - uint8_t x, y; + int32_t x, y; } ImagePosition; static ImagePosition image_position = {.x = 0, .y = 0}; @@ -23,7 +23,7 @@ static void app_draw_callback(Canvas* canvas, void* ctx) { UNUSED(ctx); canvas_clear(canvas); - canvas_draw_icon(canvas, image_position.x % 128, image_position.y % 64, &I_dolphin_71x25); + canvas_draw_icon(canvas, image_position.x, image_position.y, &I_dolphin_71x25); } static void app_input_callback(InputEvent* input_event, void* ctx) { diff --git a/applications/services/desktop/views/desktop_view_locked.c b/applications/services/desktop/views/desktop_view_locked.c index 47e9802fdf9..34d92b0ddb2 100644 --- a/applications/services/desktop/views/desktop_view_locked.c +++ b/applications/services/desktop/views/desktop_view_locked.c @@ -14,14 +14,14 @@ #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_START (-55) +#define DOOR_OFFSET_END (0) -#define DOOR_L_FINAL_POS 0 -#define DOOR_R_FINAL_POS 60 +#define DOOR_L_FINAL_POS (0) +#define DOOR_R_FINAL_POS (60) -#define UNLOCK_CNT 3 -#define UNLOCK_RST_TIMEOUT 600 +#define UNLOCK_CNT (3) +#define UNLOCK_RST_TIMEOUT (600) struct DesktopViewLocked { View* view; @@ -63,10 +63,10 @@ static void locked_view_timer_callback(void* context) { } static void desktop_view_locked_doors_draw(Canvas* canvas, DesktopViewLockedModel* model) { - int8_t offset = model->door_offset; - uint8_t door_left_x = DOOR_L_FINAL_POS + offset; - uint8_t door_right_x = DOOR_R_FINAL_POS - offset; - uint8_t height = icon_get_height(&I_DoorLeft_70x55); + int32_t offset = model->door_offset; + int32_t door_left_x = DOOR_L_FINAL_POS + offset; + int32_t door_right_x = DOOR_R_FINAL_POS - offset; + size_t height = icon_get_height(&I_DoorLeft_70x55); canvas_draw_icon(canvas, door_left_x, canvas_height(canvas) - height, &I_DoorLeft_70x55); canvas_draw_icon(canvas, door_right_x, canvas_height(canvas) - height, &I_DoorRight_70x55); } diff --git a/applications/services/gui/canvas.c b/applications/services/gui/canvas.c index 2c0d1d5a8b7..c2931658790 100644 --- a/applications/services/gui/canvas.c +++ b/applications/services/gui/canvas.c @@ -95,10 +95,10 @@ size_t canvas_get_buffer_size(const Canvas* canvas) { void canvas_frame_set( Canvas* canvas, - uint8_t offset_x, - uint8_t offset_y, - uint8_t width, - uint8_t height) { + int32_t offset_x, + int32_t offset_y, + size_t width, + size_t height) { furi_check(canvas); canvas->offset_x = offset_x; canvas->offset_y = offset_y; @@ -106,19 +106,19 @@ void canvas_frame_set( canvas->height = height; } -uint8_t canvas_width(const Canvas* canvas) { +size_t canvas_width(const Canvas* canvas) { furi_check(canvas); return canvas->width; } -uint8_t canvas_height(const Canvas* canvas) { +size_t canvas_height(const Canvas* canvas) { furi_check(canvas); return canvas->height; } -uint8_t canvas_current_font_height(const Canvas* canvas) { +size_t canvas_current_font_height(const Canvas* canvas) { furi_check(canvas); - uint8_t font_height = u8g2_GetMaxCharHeight(&canvas->fb); + size_t font_height = u8g2_GetMaxCharHeight(&canvas->fb); if(canvas->fb.font == u8g2_font_haxrcorp4089_tr) { font_height += 1; @@ -174,18 +174,18 @@ void canvas_set_custom_u8g2_font(Canvas* canvas, const uint8_t* font) { u8g2_SetFont(&canvas->fb, font); } -void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str) { +void canvas_draw_str(Canvas* canvas, int32_t x, int32_t y, const char* str) { furi_check(canvas); if(!str) return; x += canvas->offset_x; y += canvas->offset_y; - u8g2_DrawStr(&canvas->fb, x, y, str); + u8g2_DrawUTF8(&canvas->fb, x, y, str); } void canvas_draw_str_aligned( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, Align horizontal, Align vertical, const char* str) { @@ -198,10 +198,10 @@ void canvas_draw_str_aligned( case AlignLeft: break; case AlignRight: - x -= u8g2_GetStrWidth(&canvas->fb, str); + x -= u8g2_GetUTF8Width(&canvas->fb, str); break; case AlignCenter: - x -= (u8g2_GetStrWidth(&canvas->fb, str) / 2); + x -= (u8g2_GetUTF8Width(&canvas->fb, str) / 2); break; default: furi_crash(); @@ -222,26 +222,26 @@ void canvas_draw_str_aligned( break; } - u8g2_DrawStr(&canvas->fb, x, y, str); + u8g2_DrawUTF8(&canvas->fb, x, y, str); } uint16_t canvas_string_width(Canvas* canvas, const char* str) { furi_check(canvas); if(!str) return 0; - return u8g2_GetStrWidth(&canvas->fb, str); + return u8g2_GetUTF8Width(&canvas->fb, str); } -uint8_t canvas_glyph_width(Canvas* canvas, uint16_t symbol) { +size_t canvas_glyph_width(Canvas* canvas, uint16_t symbol) { furi_check(canvas); return u8g2_GetGlyphWidth(&canvas->fb, symbol); } void canvas_draw_bitmap( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, + int32_t x, + int32_t y, + size_t width, + size_t height, const uint8_t* compressed_bitmap_data) { furi_check(canvas); @@ -254,8 +254,8 @@ void canvas_draw_bitmap( void canvas_draw_icon_animation( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, IconAnimation* icon_animation) { furi_check(canvas); furi_check(icon_animation); @@ -350,28 +350,28 @@ static void canvas_draw_u8g2_bitmap_int( void canvas_draw_u8g2_bitmap( u8g2_t* u8g2, - u8g2_uint_t x, - u8g2_uint_t y, - u8g2_uint_t w, - u8g2_uint_t h, + int32_t x, + int32_t y, + size_t width, + size_t height, const uint8_t* bitmap, IconRotation rotation) { #ifdef U8G2_WITH_INTERSECTION - if(u8g2_IsIntersection(u8g2, x, y, x + w, y + h) == 0) return; + if(u8g2_IsIntersection(u8g2, x, y, x + width, y + height) == 0) return; #endif /* U8G2_WITH_INTERSECTION */ switch(rotation) { case IconRotation0: - canvas_draw_u8g2_bitmap_int(u8g2, x, y, w, h, 0, 0, bitmap); + canvas_draw_u8g2_bitmap_int(u8g2, x, y, width, height, 0, 0, bitmap); break; case IconRotation90: - canvas_draw_u8g2_bitmap_int(u8g2, x, y, w, h, 0, 1, bitmap); + canvas_draw_u8g2_bitmap_int(u8g2, x, y, width, height, 0, 1, bitmap); break; case IconRotation180: - canvas_draw_u8g2_bitmap_int(u8g2, x, y, w, h, 1, 0, bitmap); + canvas_draw_u8g2_bitmap_int(u8g2, x, y, width, height, 1, 0, bitmap); break; case IconRotation270: - canvas_draw_u8g2_bitmap_int(u8g2, x, y, w, h, 1, 1, bitmap); + canvas_draw_u8g2_bitmap_int(u8g2, x, y, width, height, 1, 1, bitmap); break; default: break; @@ -380,8 +380,8 @@ void canvas_draw_u8g2_bitmap( void canvas_draw_icon_ex( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, const Icon* icon, IconRotation rotation) { furi_check(canvas); @@ -395,7 +395,7 @@ void canvas_draw_icon_ex( &canvas->fb, x, y, icon_get_width(icon), icon_get_height(icon), icon_data, rotation); } -void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon) { +void canvas_draw_icon(Canvas* canvas, int32_t x, int32_t y, const Icon* icon) { furi_check(canvas); furi_check(icon); @@ -407,14 +407,14 @@ void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon) { &canvas->fb, x, y, icon_get_width(icon), icon_get_height(icon), icon_data, IconRotation0); } -void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y) { +void canvas_draw_dot(Canvas* canvas, int32_t x, int32_t y) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawPixel(&canvas->fb, x, y); } -void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { +void canvas_draw_box(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; @@ -423,18 +423,18 @@ void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_ void canvas_draw_rbox( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, - uint8_t radius) { + int32_t x, + int32_t y, + size_t width, + size_t height, + size_t radius) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawRBox(&canvas->fb, x, y, width, height, radius); } -void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { +void canvas_draw_frame(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; @@ -443,18 +443,18 @@ void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint void canvas_draw_rframe( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, - uint8_t radius) { + int32_t x, + int32_t y, + size_t width, + size_t height, + size_t radius) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawRFrame(&canvas->fb, x, y, width, height, radius); } -void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) { +void canvas_draw_line(Canvas* canvas, int32_t x1, int32_t y1, int32_t x2, int32_t y2) { furi_check(canvas); x1 += canvas->offset_x; y1 += canvas->offset_y; @@ -463,14 +463,14 @@ void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_ u8g2_DrawLine(&canvas->fb, x1, y1, x2, y2); } -void canvas_draw_circle(Canvas* canvas, uint8_t x, uint8_t y, uint8_t radius) { +void canvas_draw_circle(Canvas* canvas, int32_t x, int32_t y, size_t radius) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; u8g2_DrawCircle(&canvas->fb, x, y, radius, U8G2_DRAW_ALL); } -void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t radius) { +void canvas_draw_disc(Canvas* canvas, int32_t x, int32_t y, size_t radius) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; @@ -479,10 +479,10 @@ void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t radius) { void canvas_draw_triangle( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t base, - uint8_t height, + int32_t x, + int32_t y, + size_t base, + size_t height, CanvasDirection dir) { furi_check(canvas); if(dir == CanvasDirectionBottomToTop) { @@ -506,18 +506,18 @@ void canvas_draw_triangle( void canvas_draw_xbm( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, + int32_t x, + int32_t y, + size_t width, + size_t height, const uint8_t* bitmap) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; - canvas_draw_u8g2_bitmap(&canvas->fb, x, y, w, h, bitmap, IconRotation0); + canvas_draw_u8g2_bitmap(&canvas->fb, x, y, width, height, bitmap, IconRotation0); } -void canvas_draw_glyph(Canvas* canvas, uint8_t x, uint8_t y, uint16_t ch) { +void canvas_draw_glyph(Canvas* canvas, int32_t x, int32_t y, uint16_t ch) { furi_check(canvas); x += canvas->offset_x; y += canvas->offset_y; @@ -591,4 +591,4 @@ void canvas_remove_framebuffer_callback( furi_check(CanvasCallbackPairArray_count(canvas->canvas_callback_pair, p) == 1); CanvasCallbackPairArray_remove_val(canvas->canvas_callback_pair, p); canvas_unlock(canvas); -} \ No newline at end of file +} diff --git a/applications/services/gui/canvas.h b/applications/services/gui/canvas.h index b1a1b04be25..9554a200e3e 100644 --- a/applications/services/gui/canvas.h +++ b/applications/services/gui/canvas.h @@ -6,6 +6,7 @@ #pragma once #include +#include #include #include @@ -101,7 +102,7 @@ void canvas_commit(Canvas* canvas); * * @return width in pixels. */ -uint8_t canvas_width(const Canvas* canvas); +size_t canvas_width(const Canvas* canvas); /** Get Canvas height * @@ -109,7 +110,7 @@ uint8_t canvas_width(const Canvas* canvas); * * @return height in pixels. */ -uint8_t canvas_height(const Canvas* canvas); +size_t canvas_height(const Canvas* canvas); /** Get current font height * @@ -117,7 +118,7 @@ uint8_t canvas_height(const Canvas* canvas); * * @return height in pixels. */ -uint8_t canvas_current_font_height(const Canvas* canvas); +size_t canvas_current_font_height(const Canvas* canvas); /** Get font parameters * @@ -141,8 +142,7 @@ void canvas_clear(Canvas* canvas); */ void canvas_set_color(Canvas* canvas, Color color); -/** Set font swap - * Argument String Rotation Description +/** Set font swap Argument String Rotation Description * * @param canvas Canvas instance * @param dir Direction font @@ -176,7 +176,7 @@ void canvas_set_custom_u8g2_font(Canvas* canvas, const uint8_t* font); * @param y anchor point y coordinate * @param str C-string */ -void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str); +void canvas_draw_str(Canvas* canvas, int32_t x, int32_t y, const char* str); /** Draw aligned string defined by x, y. * @@ -192,8 +192,8 @@ void canvas_draw_str(Canvas* canvas, uint8_t x, uint8_t y, const char* str); */ void canvas_draw_str_aligned( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, Align horizontal, Align vertical, const char* str); @@ -214,37 +214,37 @@ uint16_t canvas_string_width(Canvas* canvas, const char* str); * * @return width in pixels */ -uint8_t canvas_glyph_width(Canvas* canvas, uint16_t symbol); +size_t canvas_glyph_width(Canvas* canvas, uint16_t symbol); /** Draw bitmap picture at position defined by x,y. * - * @param canvas Canvas instance - * @param x x coordinate - * @param y y coordinate - * @param width width of bitmap - * @param height height of bitmap - * @param compressed_bitmap_data compressed bitmap data + * @param canvas Canvas instance + * @param x x coordinate + * @param y y coordinate + * @param width width of bitmap + * @param height height of bitmap + * @param compressed_bitmap_data compressed bitmap data */ void canvas_draw_bitmap( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, + int32_t x, + int32_t y, + size_t width, + size_t height, const uint8_t* compressed_bitmap_data); /** Draw icon at position defined by x,y with rotation and flip. * - * @param canvas Canvas instance - * @param x x coordinate - * @param y y coordinate - * @param icon Icon instance - * @param rotation IconRotation + * @param canvas Canvas instance + * @param x x coordinate + * @param y y coordinate + * @param icon Icon instance + * @param rotation IconRotation */ void canvas_draw_icon_ex( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, const Icon* icon, IconRotation rotation); @@ -257,8 +257,8 @@ void canvas_draw_icon_ex( */ void canvas_draw_icon_animation( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, IconAnimation* icon_animation); /** Draw icon at position defined by x,y. @@ -268,23 +268,23 @@ void canvas_draw_icon_animation( * @param y y coordinate * @param icon Icon instance */ -void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon); +void canvas_draw_icon(Canvas* canvas, int32_t x, int32_t y, const Icon* icon); /** Draw XBM bitmap * * @param canvas Canvas instance * @param x x coordinate * @param y y coordinate - * @param w bitmap width - * @param h bitmap height + * @param[in] width bitmap width + * @param[in] height bitmap height * @param bitmap pointer to XBM bitmap data */ void canvas_draw_xbm( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t w, - uint8_t h, + int32_t x, + int32_t y, + size_t width, + size_t height, const uint8_t* bitmap); /** Draw dot at x,y @@ -293,7 +293,7 @@ void canvas_draw_xbm( * @param x x coordinate * @param y y coordinate */ -void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y); +void canvas_draw_dot(Canvas* canvas, int32_t x, int32_t y); /** Draw box of width, height at x,y * @@ -303,7 +303,7 @@ void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y); * @param width box width * @param height box height */ -void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); +void canvas_draw_box(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height); /** Draw frame of width, height at x,y * @@ -313,7 +313,7 @@ void canvas_draw_box(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_ * @param width frame width * @param height frame height */ -void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); +void canvas_draw_frame(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height); /** Draw line from x1,y1 to x2,y2 * @@ -323,41 +323,42 @@ void canvas_draw_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint * @param x2 x2 coordinate * @param y2 y2 coordinate */ -void canvas_draw_line(Canvas* canvas, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2); +void canvas_draw_line(Canvas* canvas, int32_t x1, int32_t y1, int32_t x2, int32_t y2); /** Draw circle at x,y with radius r * * @param canvas Canvas instance * @param x x coordinate * @param y y coordinate - * @param r radius + * @param radius radius */ -void canvas_draw_circle(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r); +void canvas_draw_circle(Canvas* canvas, int32_t x, int32_t y, size_t radius); /** Draw disc at x,y with radius r * * @param canvas Canvas instance * @param x x coordinate * @param y y coordinate - * @param r radius + * @param radius radius */ -void canvas_draw_disc(Canvas* canvas, uint8_t x, uint8_t y, uint8_t r); +void canvas_draw_disc(Canvas* canvas, int32_t x, int32_t y, size_t radius); -/** Draw triangle with given base and height lengths and their intersection coordinate +/** Draw triangle with given base and height lengths and their intersection + * coordinate * - * @param canvas Canvas instance - * @param x x coordinate of base and height intersection - * @param y y coordinate of base and height intersection - * @param base length of triangle side - * @param height length of triangle height - * @param dir CanvasDirection triangle orientation + * @param canvas Canvas instance + * @param x x coordinate of base and height intersection + * @param y y coordinate of base and height intersection + * @param base length of triangle side + * @param height length of triangle height + * @param dir CanvasDirection triangle orientation */ void canvas_draw_triangle( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t base, - uint8_t height, + int32_t x, + int32_t y, + size_t base, + size_t height, CanvasDirection dir); /** Draw glyph @@ -367,7 +368,7 @@ void canvas_draw_triangle( * @param y y coordinate * @param ch character */ -void canvas_draw_glyph(Canvas* canvas, uint8_t x, uint8_t y, uint16_t ch); +void canvas_draw_glyph(Canvas* canvas, int32_t x, int32_t y, uint16_t ch); /** Set transparency mode * @@ -387,11 +388,11 @@ void canvas_set_bitmap_mode(Canvas* canvas, bool alpha); */ void canvas_draw_rframe( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, - uint8_t radius); + int32_t x, + int32_t y, + size_t width, + size_t height, + size_t radius); /** Draw rounded-corner box of width, height at x,y, with round value raduis * @@ -404,11 +405,11 @@ void canvas_draw_rframe( */ void canvas_draw_rbox( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, - uint8_t radius); + int32_t x, + int32_t y, + size_t width, + size_t height, + size_t radius); #ifdef __cplusplus } diff --git a/applications/services/gui/canvas_i.h b/applications/services/gui/canvas_i.h index c31bdd3bb01..c204b970fbf 100644 --- a/applications/services/gui/canvas_i.h +++ b/applications/services/gui/canvas_i.h @@ -38,10 +38,10 @@ ALGO_DEF(CanvasCallbackPairArray, CanvasCallbackPairArray_t); struct Canvas { u8g2_t fb; CanvasOrientation orientation; - uint8_t offset_x; - uint8_t offset_y; - uint8_t width; - uint8_t height; + size_t offset_x; + size_t offset_y; + size_t width; + size_t height; CompressIcon* compress_icon; CanvasCallbackPairArray_t canvas_callback_pair; FuriMutex* mutex; @@ -85,10 +85,10 @@ size_t canvas_get_buffer_size(const Canvas* canvas); */ void canvas_frame_set( Canvas* canvas, - uint8_t offset_x, - uint8_t offset_y, - uint8_t width, - uint8_t height); + int32_t offset_x, + int32_t offset_y, + size_t width, + size_t height); /** Set canvas orientation * @@ -117,10 +117,10 @@ CanvasOrientation canvas_get_orientation(const Canvas* canvas); */ void canvas_draw_u8g2_bitmap( u8g2_t* u8g2, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, + int32_t x, + int32_t y, + size_t width, + size_t height, const uint8_t* bitmap, IconRotation rotation); diff --git a/furi/core/check.h b/furi/core/check.h index 13b3fd51bc6..a51d7b41eae 100644 --- a/furi/core/check.h +++ b/furi/core/check.h @@ -98,6 +98,13 @@ FURI_NORETURN void __furi_halt_implementation(void); #define furi_assert(...) \ M_APPLY(__furi_assert, M_DEFAULT_ARGS(2, (__FURI_ASSERT_MESSAGE_FLAG), __VA_ARGS__)) +#define furi_break(__e) \ + do { \ + if(!(__e)) { \ + asm volatile("bkpt 0"); \ + } \ + } while(0) + #ifdef __cplusplus } #endif diff --git a/lib/u8g2/u8g2.h b/lib/u8g2/u8g2.h index 68611d48277..540b7a87381 100644 --- a/lib/u8g2/u8g2.h +++ b/lib/u8g2/u8g2.h @@ -67,7 +67,7 @@ Use 16 Bit mode for any display with more than 240 pixel in one direction. */ -//#define U8G2_16BIT +#define U8G2_16BIT /* The following macro switches the library into dynamic display buffer allocation mode. diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index cc7d414a8f8..2a30a7690bd 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -712,27 +712,27 @@ Function,-,bzero,void,"void*, size_t" Function,+,calloc,void*,"size_t, size_t" Function,+,canvas_clear,void,Canvas* Function,+,canvas_commit,void,Canvas* -Function,+,canvas_current_font_height,uint8_t,const Canvas* -Function,+,canvas_draw_bitmap,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" -Function,+,canvas_draw_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_circle,void,"Canvas*, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_disc,void,"Canvas*, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_dot,void,"Canvas*, uint8_t, uint8_t" -Function,+,canvas_draw_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_glyph,void,"Canvas*, uint8_t, uint8_t, uint16_t" -Function,+,canvas_draw_icon,void,"Canvas*, uint8_t, uint8_t, const Icon*" -Function,+,canvas_draw_icon_animation,void,"Canvas*, uint8_t, uint8_t, IconAnimation*" -Function,+,canvas_draw_icon_ex,void,"Canvas*, uint8_t, uint8_t, const Icon*, IconRotation" -Function,+,canvas_draw_line,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_rbox,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_rframe,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_str,void,"Canvas*, uint8_t, uint8_t, const char*" -Function,+,canvas_draw_str_aligned,void,"Canvas*, uint8_t, uint8_t, Align, Align, const char*" -Function,+,canvas_draw_triangle,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, CanvasDirection" -Function,+,canvas_draw_xbm,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" +Function,+,canvas_current_font_height,size_t,const Canvas* +Function,+,canvas_draw_bitmap,void,"Canvas*, int32_t, int32_t, size_t, size_t, const uint8_t*" +Function,+,canvas_draw_box,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,canvas_draw_circle,void,"Canvas*, int32_t, int32_t, size_t" +Function,+,canvas_draw_disc,void,"Canvas*, int32_t, int32_t, size_t" +Function,+,canvas_draw_dot,void,"Canvas*, int32_t, int32_t" +Function,+,canvas_draw_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,canvas_draw_glyph,void,"Canvas*, int32_t, int32_t, uint16_t" +Function,+,canvas_draw_icon,void,"Canvas*, int32_t, int32_t, const Icon*" +Function,+,canvas_draw_icon_animation,void,"Canvas*, int32_t, int32_t, IconAnimation*" +Function,+,canvas_draw_icon_ex,void,"Canvas*, int32_t, int32_t, const Icon*, IconRotation" +Function,+,canvas_draw_line,void,"Canvas*, int32_t, int32_t, int32_t, int32_t" +Function,+,canvas_draw_rbox,void,"Canvas*, int32_t, int32_t, size_t, size_t, size_t" +Function,+,canvas_draw_rframe,void,"Canvas*, int32_t, int32_t, size_t, size_t, size_t" +Function,+,canvas_draw_str,void,"Canvas*, int32_t, int32_t, const char*" +Function,+,canvas_draw_str_aligned,void,"Canvas*, int32_t, int32_t, Align, Align, const char*" +Function,+,canvas_draw_triangle,void,"Canvas*, int32_t, int32_t, size_t, size_t, CanvasDirection" +Function,+,canvas_draw_xbm,void,"Canvas*, int32_t, int32_t, size_t, size_t, const uint8_t*" Function,+,canvas_get_font_params,const CanvasFontParameters*,"const Canvas*, Font" -Function,+,canvas_glyph_width,uint8_t,"Canvas*, uint16_t" -Function,+,canvas_height,uint8_t,const Canvas* +Function,+,canvas_glyph_width,size_t,"Canvas*, uint16_t" +Function,+,canvas_height,size_t,const Canvas* Function,+,canvas_invert_color,void,Canvas* Function,+,canvas_reset,void,Canvas* Function,+,canvas_set_bitmap_mode,void,"Canvas*, _Bool" @@ -741,7 +741,7 @@ Function,+,canvas_set_custom_u8g2_font,void,"Canvas*, const uint8_t*" Function,+,canvas_set_font,void,"Canvas*, Font" Function,+,canvas_set_font_direction,void,"Canvas*, CanvasDirection" Function,+,canvas_string_width,uint16_t,"Canvas*, const char*" -Function,+,canvas_width,uint8_t,const Canvas* +Function,+,canvas_width,size_t,const Canvas* Function,-,cbrt,double,double Function,-,cbrtf,float,float Function,-,cbrtl,long double,long double diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 878d22e2671..8c03a6676c5 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -780,27 +780,27 @@ Function,-,bzero,void,"void*, size_t" Function,+,calloc,void*,"size_t, size_t" Function,+,canvas_clear,void,Canvas* Function,+,canvas_commit,void,Canvas* -Function,+,canvas_current_font_height,uint8_t,const Canvas* -Function,+,canvas_draw_bitmap,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" -Function,+,canvas_draw_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_circle,void,"Canvas*, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_disc,void,"Canvas*, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_dot,void,"Canvas*, uint8_t, uint8_t" -Function,+,canvas_draw_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_glyph,void,"Canvas*, uint8_t, uint8_t, uint16_t" -Function,+,canvas_draw_icon,void,"Canvas*, uint8_t, uint8_t, const Icon*" -Function,+,canvas_draw_icon_animation,void,"Canvas*, uint8_t, uint8_t, IconAnimation*" -Function,+,canvas_draw_icon_ex,void,"Canvas*, uint8_t, uint8_t, const Icon*, IconRotation" -Function,+,canvas_draw_line,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_rbox,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_rframe,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,canvas_draw_str,void,"Canvas*, uint8_t, uint8_t, const char*" -Function,+,canvas_draw_str_aligned,void,"Canvas*, uint8_t, uint8_t, Align, Align, const char*" -Function,+,canvas_draw_triangle,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, CanvasDirection" -Function,+,canvas_draw_xbm,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" +Function,+,canvas_current_font_height,size_t,const Canvas* +Function,+,canvas_draw_bitmap,void,"Canvas*, int32_t, int32_t, size_t, size_t, const uint8_t*" +Function,+,canvas_draw_box,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,canvas_draw_circle,void,"Canvas*, int32_t, int32_t, size_t" +Function,+,canvas_draw_disc,void,"Canvas*, int32_t, int32_t, size_t" +Function,+,canvas_draw_dot,void,"Canvas*, int32_t, int32_t" +Function,+,canvas_draw_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,canvas_draw_glyph,void,"Canvas*, int32_t, int32_t, uint16_t" +Function,+,canvas_draw_icon,void,"Canvas*, int32_t, int32_t, const Icon*" +Function,+,canvas_draw_icon_animation,void,"Canvas*, int32_t, int32_t, IconAnimation*" +Function,+,canvas_draw_icon_ex,void,"Canvas*, int32_t, int32_t, const Icon*, IconRotation" +Function,+,canvas_draw_line,void,"Canvas*, int32_t, int32_t, int32_t, int32_t" +Function,+,canvas_draw_rbox,void,"Canvas*, int32_t, int32_t, size_t, size_t, size_t" +Function,+,canvas_draw_rframe,void,"Canvas*, int32_t, int32_t, size_t, size_t, size_t" +Function,+,canvas_draw_str,void,"Canvas*, int32_t, int32_t, const char*" +Function,+,canvas_draw_str_aligned,void,"Canvas*, int32_t, int32_t, Align, Align, const char*" +Function,+,canvas_draw_triangle,void,"Canvas*, int32_t, int32_t, size_t, size_t, CanvasDirection" +Function,+,canvas_draw_xbm,void,"Canvas*, int32_t, int32_t, size_t, size_t, const uint8_t*" Function,+,canvas_get_font_params,const CanvasFontParameters*,"const Canvas*, Font" -Function,+,canvas_glyph_width,uint8_t,"Canvas*, uint16_t" -Function,+,canvas_height,uint8_t,const Canvas* +Function,+,canvas_glyph_width,size_t,"Canvas*, uint16_t" +Function,+,canvas_height,size_t,const Canvas* Function,+,canvas_invert_color,void,Canvas* Function,+,canvas_reset,void,Canvas* Function,+,canvas_set_bitmap_mode,void,"Canvas*, _Bool" @@ -809,7 +809,7 @@ Function,+,canvas_set_custom_u8g2_font,void,"Canvas*, const uint8_t*" Function,+,canvas_set_font,void,"Canvas*, Font" Function,+,canvas_set_font_direction,void,"Canvas*, CanvasDirection" Function,+,canvas_string_width,uint16_t,"Canvas*, const char*" -Function,+,canvas_width,uint8_t,const Canvas* +Function,+,canvas_width,size_t,const Canvas* Function,-,cbrt,double,double Function,-,cbrtf,float,float Function,-,cbrtl,long double,long double From ff0952d66acc0ba7533698ce66e0dacefa887de3 Mon Sep 17 00:00:00 2001 From: Astra <93453568+Astrrra@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:37:07 +0200 Subject: [PATCH 04/28] [FL-3776] Add the Freedom_2_dolphins animation (#3521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add the Freedom_2_dolphins animation * Dolphin: rebalance animation weights Co-authored-by: あく --- .../L3_Freedom_2_dolphins_128x64/frame_0.png | Bin 0 -> 1059 bytes .../L3_Freedom_2_dolphins_128x64/frame_1.png | Bin 0 -> 1114 bytes .../L3_Freedom_2_dolphins_128x64/frame_10.png | Bin 0 -> 1451 bytes .../L3_Freedom_2_dolphins_128x64/frame_11.png | Bin 0 -> 1300 bytes .../L3_Freedom_2_dolphins_128x64/frame_12.png | Bin 0 -> 1666 bytes .../L3_Freedom_2_dolphins_128x64/frame_13.png | Bin 0 -> 1946 bytes .../L3_Freedom_2_dolphins_128x64/frame_14.png | Bin 0 -> 1929 bytes .../L3_Freedom_2_dolphins_128x64/frame_15.png | Bin 0 -> 1929 bytes .../L3_Freedom_2_dolphins_128x64/frame_16.png | Bin 0 -> 1850 bytes .../L3_Freedom_2_dolphins_128x64/frame_17.png | Bin 0 -> 1872 bytes .../L3_Freedom_2_dolphins_128x64/frame_18.png | Bin 0 -> 1715 bytes .../L3_Freedom_2_dolphins_128x64/frame_19.png | Bin 0 -> 2446 bytes .../L3_Freedom_2_dolphins_128x64/frame_2.png | Bin 0 -> 1592 bytes .../L3_Freedom_2_dolphins_128x64/frame_20.png | Bin 0 -> 2383 bytes .../L3_Freedom_2_dolphins_128x64/frame_21.png | Bin 0 -> 2399 bytes .../L3_Freedom_2_dolphins_128x64/frame_22.png | Bin 0 -> 2396 bytes .../L3_Freedom_2_dolphins_128x64/frame_23.png | Bin 0 -> 2398 bytes .../L3_Freedom_2_dolphins_128x64/frame_24.png | Bin 0 -> 2394 bytes .../L3_Freedom_2_dolphins_128x64/frame_25.png | Bin 0 -> 2418 bytes .../L3_Freedom_2_dolphins_128x64/frame_26.png | Bin 0 -> 2434 bytes .../L3_Freedom_2_dolphins_128x64/frame_27.png | Bin 0 -> 2434 bytes .../L3_Freedom_2_dolphins_128x64/frame_28.png | Bin 0 -> 1835 bytes .../L3_Freedom_2_dolphins_128x64/frame_29.png | Bin 0 -> 1852 bytes .../L3_Freedom_2_dolphins_128x64/frame_3.png | Bin 0 -> 1553 bytes .../L3_Freedom_2_dolphins_128x64/frame_30.png | Bin 0 -> 1829 bytes .../L3_Freedom_2_dolphins_128x64/frame_31.png | Bin 0 -> 1882 bytes .../L3_Freedom_2_dolphins_128x64/frame_32.png | Bin 0 -> 1888 bytes .../L3_Freedom_2_dolphins_128x64/frame_33.png | Bin 0 -> 1878 bytes .../L3_Freedom_2_dolphins_128x64/frame_34.png | Bin 0 -> 2056 bytes .../L3_Freedom_2_dolphins_128x64/frame_35.png | Bin 0 -> 2048 bytes .../L3_Freedom_2_dolphins_128x64/frame_36.png | Bin 0 -> 2042 bytes .../L3_Freedom_2_dolphins_128x64/frame_37.png | Bin 0 -> 2062 bytes .../L3_Freedom_2_dolphins_128x64/frame_38.png | Bin 0 -> 2073 bytes .../L3_Freedom_2_dolphins_128x64/frame_39.png | Bin 0 -> 2000 bytes .../L3_Freedom_2_dolphins_128x64/frame_4.png | Bin 0 -> 1551 bytes .../L3_Freedom_2_dolphins_128x64/frame_40.png | Bin 0 -> 2127 bytes .../L3_Freedom_2_dolphins_128x64/frame_41.png | Bin 0 -> 1602 bytes .../L3_Freedom_2_dolphins_128x64/frame_42.png | Bin 0 -> 1463 bytes .../L3_Freedom_2_dolphins_128x64/frame_43.png | Bin 0 -> 1556 bytes .../L3_Freedom_2_dolphins_128x64/frame_44.png | Bin 0 -> 1850 bytes .../L3_Freedom_2_dolphins_128x64/frame_45.png | Bin 0 -> 2130 bytes .../L3_Freedom_2_dolphins_128x64/frame_46.png | Bin 0 -> 2139 bytes .../L3_Freedom_2_dolphins_128x64/frame_47.png | Bin 0 -> 2155 bytes .../L3_Freedom_2_dolphins_128x64/frame_48.png | Bin 0 -> 2179 bytes .../L3_Freedom_2_dolphins_128x64/frame_49.png | Bin 0 -> 2132 bytes .../L3_Freedom_2_dolphins_128x64/frame_5.png | Bin 0 -> 1490 bytes .../L3_Freedom_2_dolphins_128x64/frame_50.png | Bin 0 -> 2191 bytes .../L3_Freedom_2_dolphins_128x64/frame_51.png | Bin 0 -> 2165 bytes .../L3_Freedom_2_dolphins_128x64/frame_52.png | Bin 0 -> 2205 bytes .../L3_Freedom_2_dolphins_128x64/frame_53.png | Bin 0 -> 2151 bytes .../L3_Freedom_2_dolphins_128x64/frame_54.png | Bin 0 -> 2146 bytes .../L3_Freedom_2_dolphins_128x64/frame_55.png | Bin 0 -> 1952 bytes .../L3_Freedom_2_dolphins_128x64/frame_56.png | Bin 0 -> 1878 bytes .../L3_Freedom_2_dolphins_128x64/frame_6.png | Bin 0 -> 1592 bytes .../L3_Freedom_2_dolphins_128x64/frame_7.png | Bin 0 -> 1537 bytes .../L3_Freedom_2_dolphins_128x64/frame_8.png | Bin 0 -> 1460 bytes .../L3_Freedom_2_dolphins_128x64/frame_9.png | Bin 0 -> 1490 bytes .../L3_Freedom_2_dolphins_128x64/meta.txt | 23 ++++++++++++++++++ assets/dolphin/external/manifest.txt | 17 +++++++++---- 59 files changed, 35 insertions(+), 5 deletions(-) create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_0.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_1.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_10.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_11.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_12.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_13.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_14.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_15.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_16.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_17.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_18.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_19.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_2.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_20.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_21.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_22.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_23.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_24.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_25.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_26.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_27.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_28.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_29.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_3.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_30.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_31.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_32.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_33.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_34.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_35.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_36.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_37.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_38.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_39.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_4.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_40.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_41.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_42.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_43.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_44.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_45.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_46.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_47.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_48.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_49.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_5.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_50.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_51.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_52.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_53.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_54.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_55.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_56.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_6.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_7.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_8.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_9.png create mode 100755 assets/dolphin/external/L3_Freedom_2_dolphins_128x64/meta.txt diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_0.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_0.png new file mode 100755 index 0000000000000000000000000000000000000000..7d42cb57db999d20125d8ff2d5061a40c975d5a9 GIT binary patch literal 1059 zcmV+;1l;?HP)i+PaAH2SL*d z0B!()`@W%YT^HcbR#V$V+2?6Y0i{FEzzEbfQFq&Hn{oK(oFhd7ZXBLtc~R?FZFDr}1JH>VfUnKP zF_aKmw$)JM@E*%`GxCj)q4wfoGv#bhr4TWn@A#P3c$+< zYrI8J;GzPyC6WkUQiGjJnu3ST*ddhjsWrW{)!H_DETRBBjIczyV=Tvj9bDhpn&dEo z2t)yRPUursm9(uhftCoU_fj9$wl@W^+a5uL^04&L$`PJi8^Bfs-ASPIJ|Z)1gllBHMNS@c(GB74S&Cz*2)Imr_e zLavYQeB$SSo=xg%=l0m!+qRxuOpn8(VjclbKqCTeREUmw5@;RTywR+sqmjXjp5tVD+G%W*91DA1J8(a$3 zPT+E;8Me0a6r2PXG6E2^oF?7fb(>aY;R$CiKnj3`a_mU^C?crs`mhyJ0KZs-XH7() z+IoRSkU2m_Z(_z}*i;pP6SP(PCOARN2*B`XtzgdTl_E$1EI`T)aGRN=02abk37#U@N&vl^Gdr+a1X~H0 zH-ZAtIzy4CkGO1EJz|~$*c7W=AWs7~<>ME=50-(9027&A6}66twNc<}xc7y$LSCfxdbTap zZw-4RK}LYh;SP#i&H|Dc;DoUJtsw=lIouCUwWI(JVk8Gh0USg|fPW0PGgw1Kh7`bI dw46_U{tZ$_s-d*!*B1Z)002ovPDHLkV1ibi;B^21 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_1.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_1.png new file mode 100755 index 0000000000000000000000000000000000000000..25b4609c37949e1dac85ed4d8246a39d4329b66c GIT binary patch literal 1114 zcmV-g1f~0lP)f6h5tB;dvoIhGf-kM%}pb3Oo_cmc%P z+#Ev*L9(rf8b|b4j+2pZh75I-2%9Nqb6dfcj6Z7rSph^Ev64s;;C{GOi`!%pfhd3| zBUTeFf(92Auq~NH@X{LGsibK{*o+-QIiK3oTU)Db-eXY(5Mjhhv=y^*4A{Z_%C;nj z8APB8AaX*lva6((&IBY8P~WvaR@*KL;BM~-GL(m{4=G2u@@#;$A{b5rweK16w2@2n zsD5$sH*43*@u&i@8jvLltU!Bp%eB`cA~#6r+)jNS)M3ytT*hxb3s~WNDFRdN zI80T5l|BQ`_&M5^8XuPvaghN#X4d(wJ?`gfh4KGF2v)N8i95^wNloO)81W=?4k9Pn zAtB`Y7|tht|If8a-R;~Fdq>;$lZzQ~cvhB2fG1!Pfi)^*XL%C1IHMx}t6z!;T$I3AOSDn6>VRwqRR+GHZD}J(W&e9)q(mEGwnSW720jg3#&K;)(RyumrjvSPXRSwzs=^=2!S0N#*7 zv?ZKdA_CPmijM>rN&p{xgh?gjOV6;pfQshLCMW^8A!XlLL{I_nO#~%?4QROmZsSRM0dViKpFkfCc8MUp0G`fn5!6}0W~BE7{qJ6s z01~iM1SNnZ%!puxFiHT47!kp$Yj~~#=+DIa&%4s@2lW3|V->-wdj(YmBqgdkC;=o! z6Tu2f02i^W#48T-7C{N%23W78&G424dM7wqQs~|Poso`|F(c8TBEU_M-UmpBOBzcA zFtb{pa-b85c3ZhIQYpAc0IN7OWn0=`wI{nMwQXQ(A;O>l!p^CaJ7X78Rp26k%*oid ziiD~PW<~HLb+Q|e7avcd&CAs}x|9QC5DCC{MuJsW%r7T_SwztD4T4ye3$R;&)afq1 z!Le5G3E}KEuYg=FtO0q7%QbNLO9?*U2}{#?xkhPHrF%3*QLMxA9hf}V2g z$BT$Vwwa5hbr`e(EP|_%^2#>gx&@5jeX$}FUgMbA2GR)NDbC%=Oa)Tc!XJXA45dU- g0(cmb^Qpi811bdjh~;$8#{d8T07*qoM6N<$g5bIA4FCWD literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_10.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_10.png new file mode 100755 index 0000000000000000000000000000000000000000..575df3b9f5bd672203836637106fa68fba69af7a GIT binary patch literal 1451 zcmV;c1yuTpP)=Kp_r`fzHNq1;8(v^7MM}uovr872WPssi|XZ+O$ z$9Q37n^L=fHmuMY;6I~9jNkXQ#k|AcE#QCHp}BU8>)!=8#air=sNYtj>BPCw89L+D zgXL?4;QExt(YKj_7gnGNo2@f;|D16&Pr!|%ax5=uAM2Ig&G-Ox-~~{t zb2AJ@1WC6Z)Htfgay<-vcZg8EsL+`*Hn$awMEq6r&k~?giA+?I0L$T4EpD?D2}A-^ zDUmI=ngk7;SHQaLM1q&rASae*Es7mqorSLS$B0$3E#7|9V}S7@bMuD#|F zxvgS!n;ThRX@@~t#p@rz8xueS7x7yR-`?Y%Nsvn5RGMiafhh~{00(@Lc6}tB`RQ#- z>CDAM9PzPXqQ-CSv7FHi<9#6nGgp#+EI#ow(WJK#wU%*GVW}6`(5q!XIG-n2Ia99b;_FVm7)R6+{K-30IsW`?WN^vVEb*hu?bNYLx`p({8D5K+8>09h$n z28k>lfofX?OafO75RIx&fkamPyA0QX19^~jQ< z?^)S^6>kDSAP8K&hxIt2BFEJeR>ua{b=e7k-PsCQ%dw;S%}Ud7|67m%7y?vRv8>=+ zan_z{EisSwzY7VD+5#{vCE6@_(?U;QD@kydNcjR-4t}h}=#4Cukt;}$ej}&~y99mB zSP^}s%3=R}CXOY*F5A#3R+Hf97=Xeqo`Hg7RIX?=J0=L71?&n>I=CZIyd=no6Q-X9 zRARJ}xdSPzB*>~Hk~e~+iP)J0qesA5eT~9Hg8q91Zvvcf4xnMiS->hHRK)~8xdm9U z`kX-{K?cnKKEUqA2goPr>X<-F5mRIU;Q>xCHiy+ln*r?lGcT3AJwRLKtKHrxPA0De z=|~yFV>|Ui$cYnrDtRSXib(CbXRCO%m%hdL0BiJ~Ez^1##v3HM?*p8U*~i5*y^m(_ zh|S0>;Ma{G8GpqQE;e*VR`5Z9Q_{T%s^Wqw67;f0>H`-5P}ShCLUiSimX@own~`nc z_3g&DV#Yj7JHlmd7e{dHg^(!vdIwIQGH(}GY&qO@G7o-Y3&7AODeEw3c4oj;2tD@v zDGy-1yLVC{2_G1>KU;BoUy=f)T|LPPgI3f9dZS0Tfp;a)BQ)}C1){fg`}a>lGzNH$ zTxT9Vh?t4Y+dzypz{h_b>j77njv}f9WvG$y zNd0)*RFP#Q8@T(1S+#O+J{_H?Y~yS1Qsd$#d{yA-_5c9<{~oRhiYQ1bF=@Y+`pqi) z&KOfv2dXGU-4*C@_YYfVvrCveoY!X=h??Y;;5-0Fia%qM`ukB)rhfnc002ovPDHLk FV1k?psWt!r literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_11.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_11.png new file mode 100755 index 0000000000000000000000000000000000000000..2cfc582ef9f3c1dba187a96c4941ba73195647ec GIT binary patch literal 1300 zcmV+v1?&2WP)bKpfHgREeh0XZ% z;PoX!aC7$d(T-Vx7dD_S$QhUctxeQvTWvEA|D1EANWkqQaxX6`kF`c;b3OnqyZ~Zt zu8yII(6g-twU6k%T!o=;28C)xgw2$*xl}Nt_@nMWOMpltJP}C(ybgD2@t8~`=n^2x z2yaA_pn{7E*p^Hrcu503sidihuo*jqaz2&Q>sYOAtM?)jAi@YwNGHZ~57@!&$<~O& z3?vW<5P3sqv8$x*Jrn4Wfch@2;ca`D0H4+)$WR{EHF_FhW^Mpq5|~Ax^gSb1+QDe2c*_5H(rW}-2Jk+K&mkCIB`BW4};9$6uzGX6~l$cCN)<>)7_@VptrW748w>8=xV9HY#L?y9o3SZPC!=($UBe1xq>@ zDg!l(e=4NY--`%bl)%uIXjVwo0XYs%8F+(~(k!B~y11cIfo8S;&8G7nF3kePZ0>JeXc58#{x()%N zpw$N9B!EMJP)ORK9TR~=fDMqe0UomwhX5PVMuS}>NYe_|v|Yaqy%Mp#z7lB&Q2W(w z5B)D-Hwl)cfJeW1(<9NJ_D`_Jz z5kTYY*#?GoL)w#&fe^E$XYW8z_rVe++zGG(7M4?|BLfL4M#<3IOYh;5gk>UdCNyPo z*h*Lho%FVHg{4wh(h2m$>QpkbMl^bF7PZ$ca3O$4F6QQtLY`*s-uxW0lA>1{4iTV~ z`+peG+jzvO+MPN+p&>?91*0Um-gC&p#BxFQsG;eJR=CB!gpkv;5vlv z1ZWq0Ot7&`o2>>uod_OU;Px+s%(N+QlMZyav~!G#z};QUl_Z!+1CJ^IfX}h*_fhO9 z4?XP|!OCbbn+DhyLde0R%?9FiCJC!ZwyTs|weD;hcxV8xleXH)BkNIX?;yddC@_)+ ze((K#OvURkv_|V0Mw)ab0Vr`BWIvA*G%7_MTQixat$j9hRZ;Y zieYAs=)WCBM3YF{6rv81`DvinhNKfQ^N6!IUlby{gBl^ok>VeWO87` literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_12.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_12.png new file mode 100755 index 0000000000000000000000000000000000000000..4aa135cd6ba8c0d708869660226ed8983c6d2dc0 GIT binary patch literal 1666 zcmV-|27UR7P)qEWFLL%2t%G zt~s)8(eGuii?jjQNtJt9) z;onhpcf02GW?Jes${9TdeKo#)7!8D3_uhf)B`L-wj-5B>IMq>Py{mC$=s z&TM#B!hdTGD!;@5tT!P+EkUvmh_0W2YE0QsYp+$=GGV?oKW$hH-qW0Oa}1(<5v3+M}>-+w-TAN)+$gF){+!wNbm5k@ZKq7vFhBRlVma39GqGW=&afSdxdVZEa4Q4zq-U71%6`$tgSJGH;}JSh$^Qpp}> z7{ClpF#|J|?~ZB32;d1+!3aem8Lngi3e-LB`*{)fu@j|T2u2_jLNqIfD?nuOEXrr( z&Hm1K2I5tjer*2M{wINUfK@0OI8x~&a;a@s=VV5my;@lid5av$n=`tqsri`#m?Ba5 zV5BIEQ6#EL`cN7hfmtV-k@N0ztrc&X$>6i=TO)|%@I3O&m?h&&9iZPlwvjBav=)b~ zqhK6`$;RZed3WT-Ucs1pJXmgEo}uJ8)UOIv>FC^xVj&ozq+jh^@E^sTiGv0+5482Mu? z933q^uTPuV6~gK1Mvao@e$OG%QAX2X2fyyj*4b@MgaIB@m}lU$cQ{| z%qrPp#QD8C{w&qSQCPNZ+dM@vut;!({3$r9d@r4$erSE$ubR@%@Y(7O@*dWDJmL^D z;ME}%s8z#^qOXiqA!in>k~T9uR#`sscrWMQRnZI&rTT}^dp^qjBT+fp^`x~oa%&L3 zq-=!MdNKp56e{D60-X$$${_RjUst%rOCd<{G{*Y-@uN@)_iCuG0zF^kIA{J0RszvL zr1Y7&pOtI+O+s@%V>Y=pHnuD~Onu7>Tt&Bn3(j^;sQRhfPf zZzM45*(~=)+`$7gJeHfId7^$9-0c*wY~7Al!up5^ksTlL16B)Ah+P!*Zg~o*qRPCF zZ0@rBtL9Y{sK}F@_Y9s~{p^w1s0g-3z^=?&5%II_y|in+e>V&zy&xm%=j`XReeZ_1 z?*pi5UV!^JZ;orcU6=U`gSXp~^oz0(=Wc z*>*OS{lWQ8AR>S>Ln?Zq6M@wruI~At1SEmqI38t{AI-%ODR` zGFS=C)d+A!?>hsY5kU3+s9M*W|0N8CXH+7J8AD_s z{n#oem{Bykf-!g}gG!VO|HFv=wQ8h%D+D8gs$j@C`s<8};kLbgH}Gt*`_H0p#*p74 zfLisdyg@{#iYN+v6K5lsjA-{VWF7A9&%@E89=Yom%50e0m#sh3OS2KCB8#%8XbfAg z>OiXvD`?XGy8n(mS$UYOpht+}RWLKsM0@n;b37a95iv#iSxZOjcyb|*aAs7E7VV?e zUw>8jzzYf77w|T@@5hAdFR~wQ0ANK730p=#^Cco~G1^@s6 M07*qoM6N<$g45PMl>h($ literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_13.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_13.png new file mode 100755 index 0000000000000000000000000000000000000000..aae2827e8596d168ae734a93f96135397a266c5d GIT binary patch literal 1946 zcmV;L2W9w)P)Y zdW-`S~);eccSa;c^Bq}RMUS{ zUo-VrkExzV^4PiQ3}8h*iuA}^z4I*X=D#O9AF2h z*nyqKcgKuk2JjTBpu

4&USe4A?!E&v_a5HHp$x0ucy?5bdhr3@kGF6yqcEroSVe zVezWWb4dOee@UPopbcsb>@<2uE!F2$naHWLN3DxR-l9PAWJX7}G`~v#GNhG05Gl%{ zi$qmPpH;>>u&bl#lsjdem1xo21h5f(D(*puxs-7YZe+Qo&s<-UV{jB#0P*dkVl{2>-@wU(Z7 zqI(Dx<5%YTw&-SX>dl+5_yCId2<*mX8ND^8qaFPp4UO>50Om~)y*k1zC-R~(Yh;a% z{=GVWce`83fGaqz>$*HcA)rjKLjD-68s95t)^pbU`nhUJ%j|ha3AOH>-XL$WI^r!3 zu>;R$mZ44VNR>Ws@M260i zLnc77Yqe0#CZ~5(-t&&$;;P6HKIDj5qNwFX*BH50Mq(W%l09Xul!A8#U^iMm`-IwW zIil3ndfpn3&a1HGcxypxKy7PV7hnlz&{g{J}J+ejLtU2}4Tma*oLOjBZlS{JtAjR$++f z%6v?#h`JR`Y?s==ZdBN|9^a7`SK;Z;z87HUV1ote1piGSYGZaqRn#Y2K#_NM`O-Qt zEPU1Y%y?!$OcHoUd!*6X7JU*s=hvi`c|LNMmwdo$kM3}Y>>QQOpaWS0bRb(Y*mo^I zelsYGh>T@rJ*9>tME&(Ax+eryNB8#v&>(b8-pg)ArVC*8$jH#TWaqK?5|Xuw6#}Ts z`};S8B0&{0SbfPYslO4#q&c1bGo_%Ba&amPL z`o6Uv4Cl&5I?Ub!IDn@_l*;CJEl)nvkqN4$qQe+D9nmPlJ$7oz z@D>v}LDl${oE2mv@zcQ`E;;d0K1m(Ka4nze?LC-jIWhI zL@?WNSRKU<%Zu#AOHXW07*qoM6N<$f;-N=*Z=?k literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_14.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_14.png new file mode 100755 index 0000000000000000000000000000000000000000..a66867a32660267596ccc34eb548c63b12d9079d GIT binary patch literal 1929 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 P00000NkvXXu0mjfPmjjh literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_16.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_16.png new file mode 100755 index 0000000000000000000000000000000000000000..2632103d6cb7b296f9858f9084fb7f1ea1991e59 GIT binary patch literal 1850 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 KMNUMnLSTY037nV! literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_18.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_18.png new file mode 100755 index 0000000000000000000000000000000000000000..b5a85de1df6730ba2978509bd7b4f7445632de5d GIT binary patch literal 1715 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 M07*qoM6N<$f`h@c00000 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_2.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_2.png new file mode 100755 index 0000000000000000000000000000000000000000..ca4bf322ba1a693b44b6ddf283a5576467b04d05 GIT binary patch literal 1592 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 Bx1#_6 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_21.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_21.png new file mode 100755 index 0000000000000000000000000000000000000000..6a40d4148f0134314776a5f1ced7826695ac5bf3 GIT binary patch literal 2399 zcmV-l3840gP)U8KeNH?a zTbK>XuRAKt0*Ap?#ya|{dGkJV1OuaNz%^=4<`3?vd_vvMa|LMSb2g5#a`Jhj;vK={ zp<`9R7<#i4r2@w6V)x7@21W(S6YE)wGS*T6b`Ago!5aWv7N}5{QIJ~iUNI0XU@QPC zfKKw%HSW(C$yvv!UV$Ks1L~Ncvz$@}sA?z^Mr#!avf8PF#%x79)f~Lfd|m+~VskQ28!hvfA1`G0*czJ6SLk^}2RsV2nPa{|+-U{mdr?24@|{ zN&+CGN~NrWcsEGZiBYz&y|VF68AAKJdNWb;=5t2z>_EnK+5DSLj+-fmnZn)Ly>nu+ z;ARZaEkhZ=9Di6WD<);JQ+{L&%;fDg5S5^zD?w8MW3rQcXFpZW9K9KsS+aJMuhwN? zVRo{7&HFnVqmY9}tDq^PIss$*D>=acN>2w|%3suto~sOhw*C|YuzekW7#Nv< zl|L(GCwrzoGy8u7V71nD);r^9V6}di0dSuR+!zmLSGKRqWKNtMdn@~IwU`AdtDjM^ zLL9D9Nn_7DG|BX_`}o-jD$aN9$l}rUN3k%ow>lKh^Ze-n+*(%!4Grxeo~>iSJk0=V ztU3&tAIu*Xi%L(H2ltRqnLU+WwB0=ns}c{LTeB;BJ9@?tJwTj{&(UaR1T(gC z#r@SatCdk422kM3l7Mqj*jlG%cgha#)6p}=7 z6Y9i2(-UL)!UrsQ9jDc4+D*1YXPG_)O64EZKlfNkepe6kCj*NDfr`ruasw^@+>UkEU&OQnRDqk<8x{i|-{i=F|0dRyRCO*$}tulb} zr8_jB}(DJhn#$G?xJ~U!0_`fLk3z^lhaat8#Rs z5#3FhGg(Pt^YLp%vUPFHu^AH@pR*GhgNS=kIX{j_9M%;qQtP~w996Ve3%6UNl>p8iIVq6???H^e!;owBrAW6`FQ{zrW)c4f`r&AL|y1UP>+Si7Q5 zG_snSUp29;?0xI>GjYqY(*IThG6jyo-I{b-R1bilX7lkGOY}~{BM|X$1Vu6^-3p#Au6k$lF{mk9su`u?5|FBXWz`8tSmWn&scDd-wG+{oC@xoo1Jvk z7ci=v5>d^ZagrbXP@mC`suVDB!O~^JE@+%y1n0f|bucr)0YSWHwUyP!Ifg-Z8!e~S zWj#RD&HOnnon)>sMs*nCym|fcOQDMX9HsHJGQniK0cWh_UYT$6J_CXp|CX$lsp_z@ z`1~jVagf!~tW2O{#uAFgGab>ft~kkLx)BJSy?24L)1x@O0D|JKf?Fw7Ck#)aL)XmF z6ClWZtJXSTz_Ru!$&w%EsQ5B4(0?d$rPfx4XLOzQ4$<*dsgmOOqQHQ?%&sU~oaD#3 ztXyLruItMGfrt(W*olvyPsl0@WHunfIQm&Hb5hV2H~E-c#Q^d8RsyQppEZKaiAu8G z1E24TN?5evUuXiSEn|4!rJPdHKf9*?XHb>=tZ_Rjs+ru?7bPbBZvz2Ki!0qjI>s2+ z|LgMaSaljf1`>yU<7ad#TeBn8+rcOHbnNNw(~0rh_y7P@3YFrl;aGXKQD7(?GHajP z$SQE22E*1UkalcMN@qqHoq8hvH^9-z^s%hvxNUBj%iZhw^9A|AoX? zrM6r`|5mqMo&0P~_V)7)$v|0wT8+Q`LI}QsWP$3ua#UUFH$_pVyGFet zexfmS^sBcrHjdZp?G<3WmjU%EhLX`uX4K!3su$?^na$s^Pl;<=_Et2;$N{iwOhuL5 zSFukD3r-Z*wr_opptHXdX9@t^aHU7cPSwi$_$Q?T!5E+Yfz+z*iiw=K{s-Xk#uehx RG8_N^002ovPDHLkV1ghXm$m=^ literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_22.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_22.png new file mode 100755 index 0000000000000000000000000000000000000000..67189811d89055dff6660f1f2c4286d65e890f68 GIT binary patch literal 2396 zcmV-i38VIjP)Us8+6VEd=o;ySl946lj`PSz3bj}QI|YD};3ENC6sWRJK@dCder87?ham?r z2RgxHpHV(SB6pn4~B8qziE$@b)HW%EojB1CeK z4EZtJUmoR?Kx>R8Qm#2EDExDjB2A*?tEZ5r1S8O9tm$ z_7zP41(l3hC*xfwRTaZ@L9*2IP8-Vlcljz}`|foF@u(opo1-vhFk-mcyH_ek zIaeV-w+*QTbL>IBtdJD>j@h9Q7}3XTU}lmPopBm-7^0QnJMvgNbNH%cM!{MQK0Bw9 z1?h?6bzh%R8J0O&Y34MhRL5aRKBFB7!1#2Mi`kp`E9$fzXMau#X8Rc#BLrZ*P6=}} zzDk1XyaUh3aqJnh%V~v3K1yn2ODC90hAPHv@6Aun0L+n2uX8d!J44Av=ba4C>uOJB zm(n34M8}?)wxibAJ<|U-0cLw$=e+YgE9jg@y$3_1r z$VsYyW0b-Z_+n)kbUD1UVAVJM9Bt=i&sU4Lf)x7RsNL+720N9T|; zyKSdJ0QRgZ24x4br&IAx9NZ#N==FvG%t1;ar`L7hj>+i4Wh8|FXw3~m4t9ku*_QZ; z)-%O`GJPF?#AhcGu6kWIh$+g>cQe0xUg=Zu&AL~6cao}b=EuCJ)BA6NGeF$T;LUZK z8+0X~eX3r`oXZe^C7*I$Md++btcsU|n3Z3$pUmt}hQ9bS(<>`v z$vVf+)#_)3g5;~V<0gUPbJL3{SP4a+xkqJ(A%|vC{g18hM1YJiv%yzL7Wt^6LN>bo zSA3!`UwHu;+<|XaO{>9n;7svTfn;r{nk^WqHX7~e_UvvED!<&%U-3pcuiLwkBblR+ za1Youx9!`>E zKWDzmo|Pm}d|u2cu27_O)yFF8LT;9!63s;bWJ~_+w6(n7K}4qwBfU^NX6@*eh0XMS zq_i9G*1&mcyLlA^@Up zi&2S|bx=_4RD6e661@FFNZ#00qDqP<$U&MIToh`BPSxoZvM+;C490MyjdYae_z=l$?8_X<#P_*dR3%{8gkt{VnRND!vNTjE)E`BcIAY zGp!TJLo*PPd9vUm#<905$2wDK%~qL?g)M)Hwm7YpK|fuKWBCxQ-(S8rtH{m60jg6SVKCZB#57J zuS2szKrJ96(rkgOoQ*tUGQb%i5^^YeMVuV~bC73;9j5<`E{>z!`JqCvcy4#~D_LU< z{uZF98XQ;O0+6ixn(blF(VA;xb;dzWr2A?W?@W|a1uZL&6t9xNp(v9DQ5meNcK1Aj z^qNV`Oe?7A?nQorZvk-=>t|@7nF;<)D{lo#Zk1fSsj_{gdKsETq;cAF)Kww?GA=8E zlHl8k%G?1gFpH-SnClz}^gUkz4BAC&~(Mx`jfJAkS;nfp1SY6eqn0lo!9 zVTyS)w1QSOWHM(|@>$SV5MU-*RCRXw&lFU55Py4qUDw3~I!;Fhqv~UdL}EkEuAynB z|1&+1y}O7Nqob3X1UJ3?QYaJXv)a`r`k)W^6&jFGDe zY!b{6Lab`m*-0}p)GUOak1_B+6xkWP6m|Jz`EHwV9P{LUMIGH8*w2(J+}R&V{sR#+ z!Rwrx3CwCTAaY^1qjQ`UIy$T-pPIoCeY5}vz8yu~;8&CSE)@6{rW*?hunb_otx3MI}5m|7WG2+&a87kf91v4)0|3i6rbt0Pf+z%(ixr@|C?4Sy5f%# zwtDMgdcHaacLURb=%<2?5+d(xG zWS%QjCDTmBSNo0&XdR7LZ9plDcy$c_231MW)om8`)%oe^-n>7?`18MqS4MXNSoJ7} z$G6CFW<@KyyUA8nvWoy8x{se0P#Lk}h~1U8o1DR^IzLNF-fEB?JN^TP4Vbp$QX}mE O00003aGA literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_23.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_23.png new file mode 100755 index 0000000000000000000000000000000000000000..b770f32088c543b70ba617ffa71b3a1bb7a7fb2b GIT binary patch literal 2398 zcmV-k38D6hP)lAW5=Djln9iw!>J!*}!2W2Xokay*|N@!)Xdyl@V#PflScL;-r zhGh<8+3PAwIgIJW?wL+38C6oA*w1|AP)j9nr2tqGyd*#s1+uJj5Ty23ujmNoFy;W| zz)JAcHOgm*RN2R%UL}F^1M--kT}&wgWIdD-gS9LPT<=s)W4fZAY7O2yo0WVQ1cpcz zB#V?KwrioPoiO|68rcHa24ubqm#nvTE9Sm$sV8%Wf?lOZWe>hn6`LU=OLk_HN`}fl z^p#8i2bGFhC*!M5$|^?b!eqJkSzTtOs_2&-Occs-1Pn1;ix* z+gqJI;=XFzb@7__kEqOU?^a569H!*#kgFV&9qnRQBxkSVpYh4~RuHp-kPl_7%h+g? z%Rsds6=F#c4ORQArTN`b3*Q_NfeKS8Y zeVt#J9#6J8F0MG8K@BR~xuSe^b-glD1p$~nE(p=SDpitUrR|{qonO$;PX#NP(25dh zyy|)J8fD{t=PXybtc5tIFrA}}u5M^khKz1)*Z)}pKPw8ZBmr{*20QE5OgHxYBmzvH z4%I3;utHEl$tss6@JbP~M1SG~7Q7WCU{%N*uN+!gTj_Di7R4vNQ-Nm*oax~9Gx%n_ zR@<>k`Y~VzV3Y~P{p^|RN6tYjlqFAw0Iu3um7`4N7iEt^PPC_5d@c!8yyy&&1zR~% z8K@w?6KIA~@wwyGMS!lX3JNL0pfR~|-D*2l_CA$UP^cp`KI>x{Wj)vJV^zG009nOn ze5<6AV6_dicFg#U5q=n?;JRyA1xj%}eyxz($9grs&w?Kb;q?SLpRWWz^1){@#t$Vl zqnI#ke>PX_1RLeB`_39w=@r>0lVA+}eU9q2qHA3L*Dr+N!fY^9&sY253Uyi(-m5ho zI++A4QL`Bgugv!t_;~+N0~&5%En=nmPZJu-5+Xx@D)c*w{y~K6`U26hQk0Gt3;evN zzY(P1!u9uT(ta1Aqp|?MBQeo#_EnY3`nH03R-8;9mjo{}KsO28!14)li53IG)^`TK zjxG!Zc6`G8UhVyA|8EOm{iTuwxV|%xoFs)t3Nlp?rrs+9szN`k{z?+y{;UX9JH{9& zo-Z?inh7d{U)CnxL23rTq*m+aGX~$4gs8N>ZW1_KPx$$z1vq9|ra9$KQVdKaHUqex z-*FhqbP18!+^v4K4-?xVa%S6gU4On6%&xI2s)OH&BZzYGOrxCy2EcH+xk5$z*hG?!+fO z1uz4Z@~drt$-?*O6s3=oQPDvK0q>Qb%I0q3RfCW6I>EoLYh3^Dsm}oTtTJhzM1(4& zs$i?6ltNl0&j6qHT zaUpX+Rxxb<2~wwoI3wWD#dOF};hVIIlx{G`_i^1A1OXhm0N|Qcr(!T;P~8y4DxiW6 zl^*-AB#0t6I%d^Ypc0G)dQv5rEA%f1b0yijQ$PCni9zi$ueOeurBMNt z$DYS$y8~r)-a-8Q2cO%1#TbJa_i5 zBET3wEnq4U4Z-SlRml>^RX>|X6_04(4y{1zys}w@%^fSWo7|B{wf9G#zx;7%S3%VZ zvKb_;OY!FoIRuidPg;mEX{W2I` zJ$-a&Hv!^(XAr#apYH@ZC02spB^)55jEt)56znT!ofr_Sw3}orNHF)Me;m3>*rPiE zeTU-}-%9X5kqliKYL;=qXQzYGABUn~Twk5^T_(OO@Jg3S)$02sB4ku)smw0+{8=$R zGU!mnY2R=vCNZm+c=Et?kxtGADjA*33KHP+xR0I!q7ZlNV@_kFrgvuCr%45WQpdJ; z>ZoM9Qxg09ate4k0*u!-&)XjJdNMOhMz;j8eIR5=QFW}0h^|Nr;!>|EUq9-HRX zar4^=FouWCNT-J5ovYKQd#d?u0hwWyj91Dq9-Z^*r|47qRD)gBYe(<@04_JN`SGUv Q9{>OV07*qoM6N<$f)^Krl>h($ literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_24.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_24.png new file mode 100755 index 0000000000000000000000000000000000000000..4a899faf2fa41977236c1259548e27ee6723c612 GIT binary patch literal 2394 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 Z`~w)ArNa<0?~MQe002ovPDHLkV1jFZk7fV> literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_29.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_29.png new file mode 100755 index 0000000000000000000000000000000000000000..f18f8798de868ac7f9153c99fb3d0fbe5b05b157 GIT binary patch literal 1852 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 D0)@Uc literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_30.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_30.png new file mode 100755 index 0000000000000000000000000000000000000000..64cf5858030b039b43e24eb3ed49a26394581828 GIT binary patch literal 1829 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 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_32.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_32.png new file mode 100755 index 0000000000000000000000000000000000000000..417419f8582eb96a70806fa7b111f5709d768291 GIT binary patch literal 1888 zcmV-m2cP(fP)Toynv@vH%Gd zly-WIF|P3sC0y6vEj*6nEjy0mJ!btZk&#cCr4Q#=^4F@QM1tPS!MuR?CdPTZ-dnu%FC>P1^ z7nZWs!>|tC3kW&qQ@x5;i?v%or5vz&t?{>fG%`SU*R4gpH74iW9RyG40niqfdCCkR z(Xr_n+JD-u#M*qO7H8#{46Dr38UQQEWVsjZpU8Z~ZrZne%v=dk{*eHvWVyB>PeG{` zFUT#uWB9#;l;08n*;>vteoS+8H@wa7E(fTWWdNMNEdV;R9N}fdCsC=zkGTazo9{U< z(UIkv@!on~FJNt6SL6BPMH$H)Zz;5TZb6YzX$Wz!PDrusC-#t^ErIi0wycR4MAHyVD`yp zIv51?SZq@9ALXdm(l340pxy#d2}UH7F%q4$$Ff8Oi&>_Q6?li^id$$t4{x+3Y-xiP2%7E_jnxc}7$EcfiX6ePgcg(@Iu6I$ z7qqD>2)uQyF_fRUkxUKq=IxMcn<(K0!5oj!aVT0@d^*lC_%Cnpv)0{q(Y{rFSeB5e zG-28Gys=E*a!2r7*VkVKGqjDy?WTP;2)b#N2`r73GV4ajmM<1szwoUGm=nDX_Idzo zydt-pVY4Z-LFlK3m7qhG^wzg*o9nDVv-i5LKRrN(&ZQAvx7%F~G#fgDK=Xr{yBY+M z4h#}4Xjt9W8IAFaZvhpo1{HHS@*r6qR=HVW1@x`u7O=Y<;08o2aaRL{_GJ&kTbo(0 z!_VWouFIkaRF>%taII)vPab7tv=J;zWJ^j%1L__23f+5pG~Zfo0lUjVv`NwU9gMIF zueMtasn-}sa}e#ffbMc&ZIb4wv~#6C?grYQDO;U~F41}mu;gfPM$S;O#xzejc+2ii z+p255@bI+FL}W7>4bI3T+)eSB;F@#snVDdjn?MC#GXIEMz)ocJAya0-J`tGKE}ya23ZZVs?FMZvh?C>l`W$EDE~!}NBhjWjJ^(dl#79ScNxM%#}XmO zy&&*{#PaRVK621%80DA;t7LS7$+l>Y=TkNSDhz;V`CWiE zX96=`Gu(0}n-ROHmsvNO(_z~V|H{7$n1*=_fX_v9q$~;oFQa}Fx|&T)?9wd&4U3dU z)MfP>?A$w=FsTP|SI|`&LA(u=ZUI?inR%HtY8)dr@Y>crG_Vl-Lh03Yt| zTvrbt$E%mZ`>$dn+Q%sUROc$;l>(_-doG%TIvAf<{j3~l zWlvA3IJyNqt+BEW1T!VmTX@KnvTP7!vb)mz;M(ec2>A(Jw3m&UjAgKky*zzm@aMpM z|6t8E8DKXo!&v%`4wm_Dp}UdQ=2!Nzdi7(<nnz^47EFSayZ~D>(Y54YMq|Bmac{V&%(~)g<`z aUi=56Ve-FkX=G0T0000eEh_RM^Yq~yPyU+S^cR1z@B908p65SKw*eY+ zt=z6rky|i*Ht3Q3n*a^)PUje_21SvhK0BW=hA00fKqDCKGr2c^MULYtlYA4P5m(c` zBCj&ZHvt;4Qj4o{Pw$w^*F0@r}BFXxB#QW9>%kmml${1H{O5C zE#RXWfMvZmX6IxM>qf^(tjbX@+M+Vg(cyqj;D)_1HvTj`=U;IPz{7w^V|80waNWlf zpmNHiY=7e9BdX3{WdLu!_r7gEefCHKtekS@kWWF?`KxkI@3!f`6q-taD1g~~e8%f~ zGhNXJpF-sP?s9;7RR+NMQwdNF`syiX`n}WeBvxv1Rj%sw#^3U-=@xLsDQCt<>pj&A zu+F@z)<-=6+o#7o9+rB5D^7W4xaXLPt&v?TP-(xT9L(GTn7z{pz>Gjdr(9|7lq672 zd^Fz47Aoy`l!Hib)&tn*ju{7di&jp#vS}r7Sp(=fVy0wdtg}>$C*+=9lt=qHX6V!+ zVu6SOs1F!Z9uSAJF)y%L^32j(=5&=MR76QoSzE2e z9e(lj+GiB|-5wwdY&6zQdsc_a65feWgFM5Em0G+iXZCx(iSSN<3VlcQyo27Nj8|C# z_u?gjQadX>0RtQL8-u2XLHcbo>rG2?RuO7LfsNqKgre7)?#(TVqr zQ=jjU+cAq(DrD==teMq%WXaiHBLc=E+sDfq;?YdR0P6D{@&V7mPeWx;6_p+b?HJG7 zM6jQyEJrjTdtYgBrYyIj>HF$ZzP6@$-R>RA~4P z+RvPb8~2g`9TPdlgJ+Ako@IhNk?CXpcz+wH&^G>jHSI^#p0NaGyEks_?|_;}E9+Dd z^)&z6TY#mxj^HXiQTDuwE9|zfvG#eMf4&Q_O6@}^$3?w)SIE7MWlr)KAZsGKfz4R; zgwG@d>&str>vmw%~MyQs7JCdp+uy(Czf6LzmWaS`RcUB$+EGuE31hyB} ztX+lWTR=p)%DNS~f~!vFOygErmj&DF+&j^73y5gC^A_;biT3)NZXHpQ*|E+zTsJx|uw4RA#G!YJw?= zVAoZB73r&%0IQd+f8fN30hlq-yRvR1NBvbcs5-3bWM)@1FVou%76-&f-vUslvf)){ zR_d;GY_(ojq0l*l?QLuy^zJ*N62LxV7Tr+}##jb?cD1Qf*ubNAMSnG@GiAWjIne%H zz-l=dpRF$Yu3|O#XlteiS?p7Re!k=upeRRu3`!G&>*KtRV5p~Vrb$y6fH7+a(h`71 zM72IMu1f8djdnUk(Y0;&d{Hy>WMy~-m)rupjSOU)U`(UTjnEM|vo!>aYJEBM_|%47vu&{$I(*@p8X zdzNnjcJ7_PO|4LJRj;?#Dn;X36(6d%lMDwM?Ue&&cs1}>)G*IRo6N&zWu0ukQs$~j zpswvDeRXeky@LhYJMob*Prdp4*ikA?$LvYF zDo_fYcG=PKJA$s~#F7H?0W(aKjaPj1AGc2N*h!s} QIRF3v07*qoM6N<$f;&2|82|tP literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_34.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_34.png new file mode 100755 index 0000000000000000000000000000000000000000..26dfe53911400e4daf2cd14640154546bac8b442 GIT binary patch literal 2056 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 eNea(j7? literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_36.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_36.png new file mode 100755 index 0000000000000000000000000000000000000000..7bd425e1d105c77f4efcca2ed6d34050bc3305db GIT binary patch literal 2042 zcmV;`Tt+`KFlh`=|e+$;BfJn8*!xLUFIhTrx(?#CE$FUE>`qBZteWS`-!`0e@g;_3Y95Q2yI zF(~i;(@FP0wD%(rtsYi1tiTYLEcpyK4_D^5{f@rc`)L70K}1Hs>FNP&<6|I3`YOzk z`GxzvWJOHo;@q z2Jqrl`DJ}qi_6+(oz9q<$qP4UU}ni#-QnJqf!|>O1hqro_Ont1xW2+L*LD5c z8|gv(Q1=T#L}itv&J>SVu^C-raLoP?rcdcu#y}p>jHa_VD#wghkWt=P{NW6+Dych) zBDz)>zyl?V+tbDLM9iUda8v}SBg&ioZuNZ%;OQjqyhcgF_&so02S@ghQ6f?N$HdLx zVC}xT%KoOSO)^UWCQC_z)$4(5ZL{w0Bp>}%lDKkzHKNB+?!E!;15B|GKWL z1D+?9z&w3BlkO#>(&6lxf=Lu_ghypi;AbT+1)nOrWXBpizQ(=RDsXM} zRmD~QTUo0As|@Wd^9oIMXYEu%OhlKC-1SfZ~hN95Zou#lrz(LcB^0 zfJ!2>f_i4DghwU|U~1GXUCTbQ!TpMQ_DE%1mB7 zoTmRZPzeZ~Q1?^^tgHw;eau#NjCkv-K1Z@^_ClPtF#w|{b(ouxDg&^NuQ15UBf`UO zHOjKaF-&^O+FiiidLRk7Yfu5tQq%y&K zetX4Ji8CsQm5rhtpOrTX>mS-Wjw5G)j;u_++V$A!mA8Oy{9T$yUsTqdoh#1s_g`G4 zzXU!hmJ&Pr*ejeTS^NKN{e&?uzzRn_#vOR2#Em zndBA*Q1#fvSCVf(M@7v1P@15E$sL6dNhR+0am>B^jFqbu<>Su z-NQ5+d>JFY?U&s}V4cGIRq0IiQ9Rk8h-)j@R0qE9uvhiz!vJ`5=M1p=472yT4A7A- zMhZ30G9kNX^$*{F6u>tPf=s%}x9eu?+3&L$&0?z@tDa4Z&)aVL7n48B0PN_p!)lkZ zXN2V^J7N%*w|CPUB%YGUekJ*KeMcfNapHffag_N2@u7bcI21m?23gT5N%wqSb>^zR z@5YQZYS#I7o%?SA-ljVWKxG>&(3Lh;#kuNjXO$gREbcFXxZy4tbQ(RwGuQg7+K8lk zPN+Q&-M(HRrVso|6+jg;2R1dlWYda z_GY4VE52n^J3L~&9eYCt$TsX0R?%6dcNn1Kmr`tKH+qwLs= z>hKx8p>&g8De#PG?mAAp!>_mJg+bt^-BJn0^R+_zOlNoI82j=0-y|=utL~EMyplgLb;znBQ0Z1JfR&w(daI(?**#}f;|>37;a2RleAk?y2%foF(lhX9Un#R0q%)gT zuHKBqd_B*T&j6L6tAc~4r?c8c)ymIou4aPDv9prVFh;BYID#SYF3HX*=^Sf^KjroWkrdSoy!tfWG1m?U1>Sn z_B@Vb9Gfu4IL`B=_up`}u=l3k_B+l;8*wh$igKbc_F1$(^S7e6r_YCn^S46iJiL!a zdH0_Vy5~fDKXRg#!;*$282Tj(KJ%OBSEjf9j=I|WX#zw>M2o)Z>N(ij$DA0+t1w5V z7tZ&B6)~9?2fUBE&igb0lnTb@QF6SQ0lL9M$1<9)%3;A`!HjIOc6oAX0<2bc#R*R` zfM>629|pm5x>~_3aGoET?s$)lv2sHOs06d)#5XViI<7M>7y&$sh zo+GVtm85!-0kUARWU?~RRz}kiDoKDcSK=1-09jByc*%syTpettXGGuVShX^l9Q30d zQ>ox62~dXT2k*O;_mcpf%JJ}2g=ZC(*->EwY3(sGL>g=}K4i z!XUE%WKQ*hVC8yFM#{ExD?wu{Q1K7b|5H(BCoSKZ99}?d@G_@H0Yv|?1YxM?Z}q4o zfrpFbjT$4Ez^~#>BjN#2!f&NtWp$s&}7`vT|$&?v#bu!rX zP*1hOUFQkGi{vtYc<_7_=^NQ^pZ{Wj9Tnv%n;{C$T?`O8l~sS&HhjjOD`Od(s0qBp z0E&?nWR-Rm14NaAPOl_Dv;}y&cw;MmVxL*{AIEWgb_9QnAv-0)l*1J6Uafq#u1CRh zd?ol1m7nKH{e`wiV1CLzd-&`K{%-6}0;{hFg)vlHv-z0}H3_WlIFHHj>})ZB6?PSN zCV`b1t;Ld{5)eDSvu&X5m9c8||JnjpDk{UIys85uR`>s7`_)sKGpC>7KVJ}TG&ZabJ*m|!am zV8`HhZ+x`Q3iEXlB`J;PNFw7IcjeyCbT|&}tc-~oZC@-wyx^;H**c2;kv+S zP=fzP+Gov~{j4%T6in6^bP5A~i4CmR!+7H=Yh#mdKaVlA_W+*q6{9PASU30+)?k#Q zuJ1K`o=&?8L-lnf2{5tPe2D=%U;$V6zG#fPK8|PIvG{NB+6sC#b&HTd(hr@v}P zXB*5Cq=G7Qb}((*&Hzf&r9Ss$MshO!J$qQ=*X@CJB!bE|ikvKI(;i?hSg9UQ=`Jdj zZ|_x30l3~u4`h3SIlm$!YC5fcyWlbaTU^Cc!SD6}Dg&ZEtZ`&xqGYt|vC3WP3n-fm zLCWr|Q;<2ILER3lOl8|s=U41Qo$-EVo4N*WDOTRMBJeI`do{wVa*xTf{jlnXNGEkJ z&X3k#Z7{tx=_z0*x*3c2EmoQhs0O}e$aGq!W9$*&~y6gnq&dug1^uHrX?ns0PQS*yFzJ&oSu5bo3xO)olo=;T# z!kn(6<9{#Mp3d{$Z47V)yb6o#h!`Mx?v3xf8?ib^>vfrgt=EA_~>w5}g)UogL4oeZ8W**d7xpPvbwgWi%1 z5s=1J`c<6dZ4)c>jxu+k8vHrNCThw6ckOAcTB0giIl`*Vtdto8gsh$e16a5RrQRH$lmwp`1pox_M27M zm593iDwS7`gm(SPdyXyx?Dpx-IHkWFdKJ1aPcUGN5tM6Zn_$7875(IU00r2L{`za- z(}1U6XjI@afZDjNCc#|K&V2)|BRqzjcK`ZY!SnOgr-5$uGg%%DE5Y`Xrn0VAC|)r= z0jposV9P%gIM%uiKsiF*kpz)n zvS4+fCRKEFK8_=1fKH}mP!piS0Lq$oGC{YuSOq(phI5oHAX~JG%sH6@J^H`$x?*2v zon3k=+tP9ZtbjQeDV;sf669Y>g6_Nu(|C5A|F2o6+PmpZ#haL5;%a@e`w>2Nkaz9S s%LK~18dq-zSL)T#|2XpC+i~9YKRPRP)vcRH5BdBTMhp9F>1}_;{b(cZMO#shx5mzS=PQ3_^k(`zbvQp2Lg(Rg zG>Sd%1Zy(r%!&57=R_+RrMqNLi9|;Cf&c*p?Jvyj^X$G)5 zSLECMm}FJG@cfKExVFm_k^wR|5a;nQWvsf17#Oy`!we`_*}5CF>?Mfg*w2;ZV>Vg4 zm|U3vicTi!n>nwtzT#xhSrvIKV5$Ukn2;rGbi*Td!!=f}%K)8V?$GmDqjCy5T-nLi zMSes1(G6B-q0Wps>{@0In_n`XY;h;3Xyh-A%o)mY*_-Oow?Za~RB)G0>SklS>>e)( zo+!){@++ftP#AD^lo}rRfu?5pl#Y@?}@WjnbNadzo5$rD5e$S~2 zUO-q9M8Wm^$>g%Kk@X+Sep=xyh>?;LWdN0|1fv3V6Y$33dhaGN8x&1@s3ZZ(%*0LU z@Ad#!l>w#PG*}Q=uy8&4fyrX}qaW4nx1TFXfHJ(eDgECGaCVS8$*`LgUT_f|Jv>HZ zrNGlOVn_^Jmud0bXII$WNs$@R`HF@ySlJ+0xy;E(*>-OwXo>|Y{!{utE6V(q>$Cbu z270|-ud|(;F(^`gS05IP$_=N^Yo5z|<6V}_S}zGu4?F)i>0~_2GmNb{`{qYf{CGUx z>m%0aG9L!RdxrXXYwg*kB%EM?tPvH5tmjuSfOk`@gYBML>6i%y?N0xM6Q&q@_zwyJ%&H`=dsQNXn<;8qXBvr3=JDV@M0Y$BjRlMIE(Fb13R z0%hl_iBm}ewpQ(Dc1i|Vf;@C?L*^la~z!U`}>5fk9t8lUQBR}?q{ zlSyE8_H1D_(~e9JE7$JZDI3iG&U&<+^$X!Ih3;V0^ok)C=;SLHAfrpRC+gbW1xrd6 zbUU^ZAd}U$H>hSa!xao**Wk}=y$Zgyd(BTKL&pE?^4RBZeGl_ZV1}wH!Jh(i@NP0N zJ-y&Z=V$D$^ad(nGO_Y(#qlretO~B^4Y~}#bgMF2*H4OND*Ej96gaxy16XBu4&Q~U z<&4&LdH}n|27G}vS&U{qU?QPR)k|Ri;Q`lpy-VtQfUBDs59pL^W488ofPrNRlhxg> z$Nor_6I@q~3EP`ufQfQ20dx>+vW`P1!GcGtc0SV-PWmL@a|5f7H)- z35NUGI@ZG|`BQNz{YFsbu&FGq$jk(fF+#>}6_6!!EFg*US$U&~{OqmA zn_hVf=rTr^=23Q*H76QOJooEw1JN0G!ct;qpL&I3V0L3*yry%_catGw=M)QD9iRAc zx&iE9IWl`bu2o5_x?wAWjalp_LiUUupnc)L4V*w$jtzVz_zV>WsPq6CTdqh151!p< z-=Ez$)dL``<5VNX<|0HjF(Mb(_76PG1agMetF9T~r)Y>FO)!`Y2P9CYUf{+%=x^8$oBn3w~rrms0I{ z>UFb&iH45Jsq`K0zYF*^c$uE*;&<$_4W0dbSF@*@<*L2%H-ebJJFuL~^oYur_g;_k z6_%5|-oUcMo&L%M|0`kse-^*`T*(TN6B(^%U*)oLCv-pCXUevyJlb`%2e=E>+fxaC z_59tsj%;vNL*0F=TI;@gfQ37fK~b%pvqo3wf343VOXpZ#)E=*tb+HqC_buRVWOe8; z0J}BO8FnAa?Yt4N^Sf^+)xD@UWq@Bvgb3XR&|?|}<#6^EQng{H-0awK9Pk#9*>DyV zMMl(_O@f_z$@E#DJ;uqDw7c*w0l!fDl@6Y6m7qsKTJkzNXUoncc4G8Z0zBHf;`UdJ zQ331*A8+!64gW&vw01w)t-4wfM75#nl!4t>Mk^y@)1AN=+h-qd0i7mhN2%ke-x&64 zSGoDDYma(`$PQLUteiVofi^4jp8P%J+qtA2_ zSg4zL7OD*R^}mEIu%GRXTYv6GhI&!Ys1clK5bas)JfTSmG^1Ar|EeUYuFuLrynBFMoJpgT=ieE8#BLI( z`3gS12~=a&n2J#r*&65VyOIH>u*(2yem%Fq=WF~Ap}zXe+6bt&00000NkvXXu0mjf DQ>_I$ literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_39.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_39.png new file mode 100755 index 0000000000000000000000000000000000000000..30b6bd67e1c2e55059beddacd20e0c5d07176733 GIT binary patch literal 2000 zcmV;>2QT=EP);MVi|D$p<2+CK{0^ff`)ufKzvF(i5%;34$j4h_=REn!-x7bL7k@IIAn1jmr5Q1VE>D;M;!ABmu6kAk1}LAA3DM z=s)EBKqn%zN>FE#hh=O8muQ@lKS=S*RIEZE=4b`eksXy|h9#sIH)X%u1FQ<_j->F$ z3IZ^vM0PV?ijRjJnF{uj0C{+Ev)?VhR|5Px$U8?bNN7KEuBu>99wJIa49V=s)^+`0 z^?!Dm{k4%f69XCTSJkha9PP~}=UD5>jSxiXa30719|oA=A5!Dj+Oa%&E$G z8N!N-D!js5=^GtKmL45v{)M1d5P-p>nyUl~{gkC@f_X{6bh2|L1o*3?bymgU2=7=` zswg6PE6D1SNdl!y83DQ#$i_P%Km?mA_?|r6SE1@rP_6!<({p#QJtKA|h2@L#l=E<8 zD3Xy|3EWDudU(}u=bpPO&C7naZgtR69-CLkh6k};@EHn3x>YEPDtJUO1bcfAFcb7y zL)G3DdMT%=z(u++y_AfMjow-$&qk&vKEouRLV%88ij?zLBU6+d-r295IcuY*Pi0P# z=bttL%qUb*I%C8PVtI+oj;Jc~cy_Tw@Op_X(kR=QzO7q;60(vkOxf=%kP1mXXKOk^ zw><3n>w0h2)Nz9A&^H-U{%O4jV8-mARY_p?M{+O#9zv|LACpP>wvq%GE0nVY0kU+S z=j%_ESkkRVfQ$}yM4LL0oLR^8ovD8Nd5q=v02O1{+8N}SJqDCqRsHs}cW!&nyVUi! zBI^tLxpWJtD#O-x3{lGO=vh2lz5P*wRESl07riVoKc*3&D{u#`L;$a%JAPP^2wAkr z@Ik#X3DP~l5WFj>S!1jot9k&e_?hIlJ;C5nsa`y<8UIzs!EqFR7H}uRine2?2Vnfw z@yGNS6dieXKU>F+ImLfAF0bUguIpNPhVCXrB}=N3$1}Ueu2Y{QhqKPQVh8Gt&m;S? zGQ72|TR@e(%%2$j%}__dI0OeD`;0uQNuHU{ z>e;1A^=JB^)SJMrqMbRr1{jl}9Y2*9!Chrpb4kT79x=VQL_!fD`nbl3r zkMZMo1kE;pD`}=NWJx^R(2nn_vHexoKPb~*AiWS^C;WGsljE3cf>tAdbuI?kCa6t< zors{C)T-Rno4^&x5H)U=W*ft(i)V5(GNbDD&}LUMWaX%23IA3wZeFdhr*xHP)bLdT zI7?9@wnK);mmTX@^d5i-nWfd0ppaz-MY{Vta=P+nbsce*ZvuyqyW9kj@T|=wYPAok zBtLf7S?V;nEB21qKGaK-yAlQ-^&e{#bt)|is_K=z0L=t%1%12+xa&)x=xtf2aqS#$ z**9z6HE|Wq#>VRTvP-p%ggcLn2T z%jAw!2|nHu*sWpqYK40J%5Ot9JI?KRUI}Zz^@1cr801Rut4OixNU6NB%TNZbz1zy$ zbCv+n8^LcUfs#EN{K{A*Pp=)QpyZ(b_+27^a_;JERC9 zkWu29sVi~z=ME<+v>^}Cg i2#4!c#e4je-~ItpPfMZMU%Yz&0000^uAq0YCU*xpt51KLt;YwbUhX_jY6GB)QQQI@8lb zrCChWE{&ANbBfa%Y%z!Sn1P@55Om00KGa7 z!*E2@51%t<6r3DBiP zHM&VKAbAC<%Sj}7SOdPPq#5YYnHq#MJ{Qx+Sg&rY*J2W&Ly1aQC#G@@)WG;;dy>Nw zNMI76b38Q_Ctd6wx3&4LWrsMJ0tntTqDrdIBc>O{MWwP~?3X6<4l}gO-l|Q4i zwW*OxsX8A?=M#VL%x!9g(dlAn9bH9&=vchD6cK};igFJ?ku^TO*9i{^yk6mSEJ*@s zk`z)%c_%Yp6rNa`^$cBzgo9KWs0rq>(d_%un3b?jzvdAnFF~=2$X0d0jeAyZXb1Bn z8SW}M-lTH2M2mpVi*?ZCmzIGu=y2~*&@xUMLrX!t7Aa?1p{tgs&?I=EEC-l%cbRap z3YyWh3dgE6==d&Z6Z^3)O($p|z!2(bs#qsTn!6HODeLiO+B~O` zV2S`)vazBw28$4qxvgK{^D? zDo9(Fr-Gi?3UHmdUE!e30|4lYnptp#cd_PQ0eT2_c!E{}NJh%CUdx^}xUsvEQ>{ACo@dcU005s+vt6;OlG5vyRw6u!D2K15d)0`__}0^pLA`DyLAEgcHIOQ^DuIgB{+w<@KWW@) zr=LQqj%Lfll5YXlDa(SZ|0C~O_bWrlN=RN$GJa(Lr&_^S&~!a2Wa^c3X&dI9XBRj< zxpr~%@TGGAsvK2nmrJ#pK3vBwGS|*B(Fy~ZJ$DlzvSFthpBw)TryoNr4Kw@x$^oi+ z{X@A9%zi(tQ*c^|gewCN zFd;o_qR&oR`#@#R6)FR}KayZ$M~sf&AMkjClfDIbP|+cL0<2kNMK!Q8r&yV=cJvo$ zh?~j*Ji>M&+60QsNt;a-@OZ1LHF2%%h`rp6pxq<@u)B}keQTbTmB8vf;~GFwPw=V& zqJlFqxdK=&C4^QA&ggn#B1kcn0|3|wp7+B;^=4_`87zGx_a&Ly_*41_v?Uw~X&-+i z%Dbs2gaip(Chu*TO2$8Zz1hy-s}&qAe>%%0k1WqO3hjMuzLSj)ApgEVhydE8ov;j9 zIrnKFd$K6;06%;$ydQ`-QXKPV;(n-sR1HY?{{dU)`dDu$%3}Zk002ovPDHLkV1iMw B)AIlT literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_40.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_40.png new file mode 100755 index 0000000000000000000000000000000000000000..d413cf0ede7649a87df21726f796cabe144cc090 GIT binary patch literal 2127 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 AoB#j- literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_42.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_42.png new file mode 100755 index 0000000000000000000000000000000000000000..baf3c7c79d561f7be0ce0f6ea3c06befebe5d16e GIT binary patch literal 1463 zcmV;o1xWgdP)S}W^h z>HZG52|zLZvn9^Yrgl#Rbkjgv8 zN?1tX-9a?u__}8yfM$XnvmCNJez3sfbgT2Zu{FVV8Ubd*8#|mp7)l4PbG7}sm4C^& z0|6`%GrQd#kbQW^ofUN7f&it+&Vv)x1XY~8S;)wOyvGMB>n;Qsfkph9^N#C}$(f1F zv^tV`sR>{`pH@N}@KAj*tV$iZ%% z|0Vx_`Z9*((ZjepXGQ+XmAo z%lYFtR#_=K9k%?rGl?6VjW!h%v>H`=en*`Jx7S&5(2n@(Is!7%ql`RvCZcom_O*<$ zoB*x0=7}D^1UZ!7S(vfvyUID4<7g_3Kivua=IT6{8*|icy!OA3f2@#>II6vOylham zf&Qd2w(C0X01;)pt0`LWfCkaX?Z}7;DD1GO)n=t6q=6oVd!G?jXOj~WoU<}bjL2OP z54G0frQqzs3kGlTiIP7<-)v&dB*19HWBzfdrr?9c0v`F9Y2o;tcNbh40Dmo{$PTb2 zZAmm*G;O62O`ju`L9RZ7UEKs&?fjF^TZ{}VgFuh$esvuIE1kb%o3w&jb<{l$vu)dD z_p6xzD+?l}*n&JwTPQbL0HZLbquH`EVSX$4#A;Y(CNgvDEkzD?R})3G14znerdU~L z@@Xp$7N|~v>h}RGtc^z2ku%e>-DU@F7I5=iO_0>z2bke}ZMtRczjGB*Rm>eo`F((l z!U|TXkz~%U$<|C%_3sod}U;mS$%o>j9OguPF`8uKUkm{+%4(krnj1VyM=1 zkAtm)P)>&5jj~_(F?|QHIv=Jzuao28j!3U-_5okS2zK8qBjbN$seDk#>wx&+Hv$Rv=3`kXz+k znvKb>wSJd^xvHF&S=3}^ZtIyr+lu3dI`+7f*;228-;p|C1i*;UJ4k{l0$IzQr^Wy) zgTD+?L%T!0eqd@wu}n%)xIQBpx)RbKEvWQOO7ARJD630`&SFL=mT}Q-j{{U^2Df)DV Rzp?-T002ovPDHLkV1jg@$Aka? literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_43.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_43.png new file mode 100755 index 0000000000000000000000000000000000000000..b4cb1179f388fbf1cad5040e10a9dc10728725d4 GIT binary patch literal 1556 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 FV1hu@Gr|A> literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_49.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_49.png new file mode 100755 index 0000000000000000000000000000000000000000..ef68cf86614c97098e4bc877527deead0c8b577a GIT binary patch literal 2132 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 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_50.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_50.png new file mode 100755 index 0000000000000000000000000000000000000000..a44a566c7b93d66ffd54487a3c8cca7d48ccf05c GIT binary patch literal 2191 zcmV;A2ypj_P)eK@OGHX0y7O6ks7R;8TS5=9aq zq`u7beO=dc9kSKi+<9T6*%UnikSK9 zC`T0+&Szj{O2%-&`xxuGFA3muFh0-7@yQA>1rH0WWWMW1fu+FAa*BB|zmfpEo!u$I zZz=%G*Ub+>U`2O3SOLfCsA9)^YE1N-DnJL!NfAFm0kCir`R>j~5D=g&W~Ll*EX#*I zUp`)J@C4LO@pi%NuE&a@3fEN@Cf^8_OP=UQ5mR+G;)Uz0TwmxcbMgsSR^%#9%#Y=a z#q7v;tXqsFiz~+Nk}IyQI$bHVvKLOSidlhky2II36@Q`tSk#Gp$M+5iaC}E$p6B^C zH}iw_L*FkfB0B4UxUNev|e^y-8!P$DKD499&BXB!) zi0i(l&i+l;2(khI!E!)|ep!*@+N%2};A6aQ{w)4iCm1JKcKvMOur|QLgK2PuTUXdz`x8vuhU^RDk%50k4X;V@};1 z;whrKeqNJex}6@A?Yv^JKcN7)CUz_3Xep1w*pkMsla#TTM;CS zSH;&ML7C@2Iw;751b#B&cFhX)n~*hA04K(5-D++JtT-o| z--$zwAD;oTWKp)Wz`Bak*^8^rQa)o`8G+b3UC^Rm7T>fvS=`4IpaO`!7zs`&$O#2- z)?jP0_bjg}PK@njQ!-*~D*z^mpP33Ez$|E&1T2mn1;_wo&pNSUz7=Q~?~anF20N|* zY`@ADK53^FfaRh{5Z|++qfZAk)>IvmJGF}M+X~ynHhr@B9GE6o2y0aPxX&h5-sprPLrO{wx->l{@8v?<_> zEDQLxy{uOx#6$tI^<5II_q%n>)UrcH2dlqZz=W~NSV49>AAx6yR7GR)#rZMb_s!wkvTMx8p0Dm&t#ev$KAdOT33;Vq7s7HD}qMUGSZb zQvoWg_F6X%77z3D4zRMiIg;)A!Z~U!Rmbt~1UjA0ieJeWW4l^EzOWGP89?P(7IgKTCD9$P&Lq|N z4*2n2$D%Z2Zn&*=ntxs515#%# zcke%akYaHxJGEBylaZ6jeg*y)1*j&YEXDENgfbTI7z5i?fXrv~g9TSguw%{vG6Pwi z0ak4B{{8%SCAah6!SWqb#d2i3Lx|3PzEc+mw65H<_|`c4{|AWUVz9qyYW;W^-8qy+ ziwCsopc@Zuoi$H_?;d#V?*qgD*Zb)7CylM0C9mQ}A1C6<8l-cknu6X{0{i;_Y_dx9 zoi;f?RE3yyYi6oBvb|XuJJU>*K%I%~p9QGkVrRXR2$g?#?W)_SIWTY)2splL69rJ) z%UA(0piE+S%q3O@ES?8WtQp7SI&MeC`4uTDl4ZED^|uuO4G&%?EIV)^!@GVfb9}O* zP7Z1g_`Cku^CJrI6SjyDU-;bd(aj~Q0lO-ho$k?W?H&J^JH{&&04IIA#bi&N2he}F z$U7Zd<+&^W>qQlSCH?6Z<6bed7n|o2VJfrJj%8OT9!4gWQ>34=ZhYCe zj&i(90XqIzTr3}k>#}eEPhcGMZ&HAX;hsKGf@RJ&dJ=q;^A#5=U8d;weSiIX0d6w? zFUI7xLjuR&^gy_?ZN&JpGsATye>SdSrrJ|K*;dT4W8!sca(^Al|L!)z;$VKS>-zrF zz$yvl+$qROQ?i|b*@`VTilL5{~K R10MhY002ovPDHLkV1j_4D?$JO literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_51.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_51.png new file mode 100755 index 0000000000000000000000000000000000000000..ba00473ddd16115e1bfbace6df50d3da336372f8 GIT binary patch literal 2165 zcmV-*2#WWKP)RCt`-T>b9a^fv#GTzu01rj8v zz25b89LIHRvg^8z*Xw2PKjDgo_XckK&g(fwUdyqvpXeQY7VYoyUBRvJoSx2iK%6|j z&q1mC-zHrp5${JyL_e-*T!C?3GV)#CR9+o!{LWbMep&!g5YeVjx~c?Yd@hNRzm9Tb zxOlxHD^fDW1K($?zM>5D8j6i1K(BgsOQ7S zsa~ETwUfN3DF7#CRlb?5YVn{SSD3D|nJ?bo#d@-{$jNWLa(pUgPG(2GF>jc&D1S(D zwYYF^*Xd4~ot?ZmBRzV*lfAVu!d%z&pS6)6=81iu=v& zOR6FP{i-ChWaHWnX-)+?`EmHq4w&C~b%bzHL`jVZESDX>P@yrn# z6@l|Jp53MZ46yTY$+}AcT(VRgSs`R3a$Js>Z0vN4z~R0{0TArCho515e|)eIb|^wd zj(T4uxS|4Cmu6k5_Q;C6JHFoH{QLes(pB);eP`giM1GEA!x?}#h$L**R*L}FMgAj< z?29Em>+*_RM`}}zGb#dw=fo=C-B~*gLEohS_zr(p??>Y$!tacqcjCkS8GAT3t_1nY zjK%dGixO3l!zw;kAd38KU$;J5SKUjkujEfDG+#^qE?}nOXYBRTzct{8<#Lw-RIo++ zW^1cO(;>g3ybkwI0jQZ)0na03#+dlkpk~hi_>RKE@ns!dElxMDogci<*j)F!e6{{- zASX-NAai_F;#7cDQ%P7=fXbc@!wUJT2)gU>ePyaZ-xOfyW@Cd$x)nH1WYu;lfFsa7 ztK#hxCu8Zv7hzTTeN%wWCQklU(pUvJVJZRDB2ZnIT{*eVRE(|&@Ml*%UD8xeJ4Nnd zQh94DK&6w%&r#)l!qoVQI*y-J;#Q#L;AG-YKBq3`kYv;rvO=Mezsr&Ax zQf^PRuG6`l^^P?58|@zzpNdWKavT$X5{Q9D$yPvibU%(26=c+DS+W>wwFt(~t4)+O zOSBH3XI!A~wgPl)mT@+)+q(ZHphTg zJD-VHLEs*%3NS1Gu5&9L%=>eES^iv}NA9BaQUMTb2fXS?7g)t2;xi1LGr%qdRC8Tn z&$?gvs&+Jga8KpqPX@NKX_jy`Gb78oEyL02z|KKS5zKgZn%l4IW0)G3Z~r#1V^KG` z%`1l>eqNC`^-Pf-#aSJ53Nv1_ZsjrAnc1r*mErIGxmoWB9?!Cbqc8Rs?W^9+Iz`3R zCEQ83!j<{1ImU=>MY`Z8<@eX)WyZJgZwC-EWS$T|BUOy{1%XnftAA8oj8{N>VdR_ zzcX`J3ZO#T%(!NJKkr@Fb#)YAr_AlJj6_u&)wPwqE7n!A9pt+rm{x!Y;J3_mHa>S< ze@6_ez|bm%ddJmS>kQxm=}6-)!};4GKl8UcmT`{328zZX=X+NX4F7l?{>#4wD8T6G zQ+D@Wv;MPnst{abbq;{l=5@+9r2tV-cUj~ggB;h@*^c}1)mfxQj4R69ssbo1_#Ang zRseRc4v9OgQdm`-yr#Op>nOZ-)+0%gDy))TiFru@)CQgRJ3ierJ`1dNzp{?Z^0hin z)%{t2%D=NM3h)U-=~4;9qU#iF)hf-g+DsKZZlId)JzZ1xdtM-(U zQL))E$L}lkxtn~Y3_Kp3AG|Nm04~_yG7hSyl2kPuDSZA|DFVjRU57X_JjY@F4u6C;3UZ-i%7ADn?U;*Gs!00000NkvXXu0mjf1RFsb literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_52.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_52.png new file mode 100755 index 0000000000000000000000000000000000000000..8045749acb6d220582409da302be490c77596535 GIT binary patch literal 2205 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 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_53.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_53.png new file mode 100755 index 0000000000000000000000000000000000000000..18337cd63c7b7021f0f14c0c2f4b510736127926 GIT binary patch literal 2151 zcmV-t2$=VYP)?5CLUs+GI2iGF|F5VT~3eV-!`5h1kkKeOX z>iwsau7Zf~qadOlS2V7`I4)W8UEEY$9d7)dvEuu*03s(Mqi=eu0Hc2{h>^Yyb7Z*q zyh>KYWGWB*p0SSiwg4&}%nKTLA9 zxX`xibjQq2E2z>Z z1gt~FL4A+Z^>2EPgX%XN3vT?iDFxa0uknonFPoNp=ay zf~t~$dR35_vhi#uX^sUt@p1UC4w&EgbP3_2h=Lj=kmKhH#7PG~;^-8ClCk!U0iGxZ z3_$1kL=m`PaFRJWE_g0pO6Ps|Ztq!9MR+@U&ilUar#jF9%|ub@Dh?HZPKT?tsKeNI zrMDug(<^wR{kVQT+41Lje!a)f5Pm;C;~egLk^vYq+EfW)KWC)U6jAp_cq_#}Z~iy2;W$Xx*v7(*GkV=+r|Jxxl3>*@hn&fDtNmXzy(V& zT9xvnHCLR7!xbLys}_O7y@de~m@?Fzdn~I(fH;(7GqdAE)}>ijM)7mS-5p^$0$)B?8+w?zzOSOc8HR(V`f+V%vgl?Us&bcpkmNm1y_U|%gSn5NyBac8SV(@B0OUJmzH0jQbgz%xJv7(WO=?PrixXB@uS zI{@xcBZ;wP9bGL>H?N%@6+h0KV>ZbEv$KXls=#q@X1Y9*9Sl&hp=_$Jhn?f&zYwJH;+^J=WFHm75&HUmTnjtqB2IW-bL#>@D)g5a4r^tye# zRta)tEY2jY+mzKYgu2JqQw-ol&9T+a=ftaEu?<(W4o9_Pqt5M|cS&Qtk^QLnlyA5X zZEt0ON=J4iN_+(e7e-Z2w+ImHN*rCcX337mQ0C(@1E_sW&)p<4dsK=C@pTwL1#L$Y zbQy#by~3JRx$k?P0USWran%msbvH)FUR59~3@}Uou5&9L%=VQp6~S0k8s|Ju{bvHJ zAYFnhz!i;VwxhjS@ORB@H@jJ9#gB}#6)RQrDsl1pgNq%SR@I#aTmh)s%=XWAVASdA z85PoQ>5c;DA3k~CpRu^Zfvh_+uui)8T+$;w9R_4usJk-e5Z6=1GemVh7Q?qY00OKk z$Ne)GzDzn}DPuDAp67UG1NXUmQPjEWa@)O6tqA*Te+r0zRg|xax)AQr8NHAE&2H^o z;YRt1TR++vc`p4FuoGYwWK4YLexNRuEEW2n^;6w_D!R~5#|kPBU7V;J{cZgofDO-d zDAFH)Mlfc(J}cUY0ixMmo!csrRf*W3+MLc`RZQdgr;~gIYDS*ABV_oqyTPuD@W8d} zY^O(WDzJ^isrN6S1~(1e1B1TXD(`rwj&%)58HQnJ^x>;UjU;^QWt1P zTrg(>^Q4|x{neS>Y0?PGG6S%}mCH{gGt@h4rz-feshMwq&zHVax zmg>HaxG~hVRVn6KiLi8767M%N7r%^2@ckAB_zB^z%SO?xV5hpLI~T2W?@TMnXFaSB z<2UtFz#FAAuDbeEGkl{_=-5mTzONL`4E=X}|1}Jdi3_sZTaj*asNzuj`OcJ$x7p^b z_?a>Qf_byJ8RukY5uncQelCQpcq)w4k&pp62yd0A$JNf{yJk|ed-VcXDGJK~?0h#^ zKPgdgqYK@PU)hCgCP^#fq{7^651B?XfO7inGMki+xUq;fcXTf6MEm^g6qmyP4+BI& zeRDBH3=jpO%T}5HyOPg1Gdwe6={Ur{5W?b=B8|L3x(sj}^S?J>-)CvMo3ycxPsZi+ zD166p{QVa~A|}A~$S4|rT9|&bnchi4S5|4i+qqTzB|CQ`TUn9dJ_Tk*Tw*%N z^@-$Xez^Uu0zipq%I%+#nHjx1cr%#alzfNpI12xD>~YN9KJht>&U~ExF0RURm(1AR zF-A~OFFrXhS5`SYoIs;9&s{V2twk{FC!cfnF`g_}mL!#A^&GOZqBHxyp$JqQchNtd di{c;U?LQ598PTka3!DG|002ovPDHLkV1m)|6oLQ% literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_54.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_54.png new file mode 100755 index 0000000000000000000000000000000000000000..10be0ad16a87bae7c178b3715a76c1e5c210e267 GIT binary patch literal 2146 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 Y1HPr&iQ>d1uK)l507*qoM6N<$g2Z$WjQ{`u literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_55.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_55.png new file mode 100755 index 0000000000000000000000000000000000000000..fd8269bb4d5af2a4b30bbbc4213b4cbe43fc41e4 GIT binary patch literal 1952 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 Qp8x;=07*qoM6N<$f_H(Or~m)} literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_6.png b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/frame_6.png new file mode 100755 index 0000000000000000000000000000000000000000..56f37fbd8943ee285f8451c64269c2045acf4cb7 GIT binary patch literal 1592 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 literal 0 HcmV?d00001 diff --git a/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/meta.txt b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/meta.txt new file mode 100755 index 00000000000..4eeb913065b --- /dev/null +++ b/assets/dolphin/external/L3_Freedom_2_dolphins_128x64/meta.txt @@ -0,0 +1,23 @@ +Filetype: Flipper Animation +Version: 1 + +Width: 128 +Height: 64 +Passive frames: 20 +Active frames: 38 +Frames order: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 12 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 +Active cycles: 1 +Frame rate: 2 +Duration: 3600 +Active cooldown: 7 + +Bubble slots: 1 + +Slot: 0 +X: 52 +Y: 46 +Text: Thanks, man! +AlignH: Left +AlignV: Top +StartFrame: 37 +EndFrame: 40 \ No newline at end of file diff --git a/assets/dolphin/external/manifest.txt b/assets/dolphin/external/manifest.txt index d7348b25cdd..c0e1741a0c6 100644 --- a/assets/dolphin/external/manifest.txt +++ b/assets/dolphin/external/manifest.txt @@ -104,7 +104,7 @@ Min butthurt: 0 Max butthurt: 8 Min level: 1 Max level: 3 -Weight: 4 +Weight: 3 Name: L2_Wake_up_128x64 Min butthurt: 0 @@ -139,7 +139,7 @@ Min butthurt: 0 Max butthurt: 8 Min level: 2 Max level: 3 -Weight: 4 +Weight: 3 Name: L3_Furippa3_128x64 Min butthurt: 0 @@ -167,18 +167,25 @@ Min butthurt: 8 Max butthurt: 13 Min level: 1 Max level: 3 -Weight: 4 +Weight: 3 Name: L2_Coding_in_the_shell_128x64 Min butthurt: 0 Max butthurt: 12 Min level: 2 Max level: 3 -Weight: 4 +Weight: 3 Name: L2_Secret_door_128x64 Min butthurt: 0 Max butthurt: 12 Min level: 2 Max level: 3 -Weight: 4 +Weight: 3 + +Name: L3_Freedom_2_dolphins_128x64 +Min butthurt: 0 +Max butthurt: 12 +Min level: 3 +Max level: 3 +Weight: 5 From 8bd984ff81d2c229cf6dd55afd2c2462e1ec8a02 Mon Sep 17 00:00:00 2001 From: Astra <93453568+Astrrra@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:44:31 +0200 Subject: [PATCH 05/28] [FL-3151] Update the WiFi devboard developer documentation (#3520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- .../Firmware update on Developer Board.md | 204 ++++-------------- .../Get started with the Dev Board.md | 47 ++-- .../Reading logs via the Dev Board.md | 88 ++++---- 3 files changed, 113 insertions(+), 226 deletions(-) diff --git a/documentation/devboard/Firmware update on Developer Board.md b/documentation/devboard/Firmware update on Developer Board.md index c62c653444a..f6a81d97b6f 100644 --- a/documentation/devboard/Firmware update on Developer Board.md +++ b/documentation/devboard/Firmware update on Developer Board.md @@ -1,77 +1,30 @@ # Firmware update on Developer Board {#dev_board_fw_update} -It's important to regularly update your Developer Board to keep it up to date. This tutorial will guide you through the necessary steps to successfully update the firmware of your Developer Board. +It's important to regularly update your Developer Board to ensure that you have access to the latest features and bug fixes. This tutorial will guide you through the necessary steps to update the firmware of your Developer Board. -This tutorial assumes that you're familiar with the basics of the command line. If you’re unfamiliar with the command line, please refer to the [Windows](https://www.digitalcitizen.life/command-prompt-how-use-basic-commands/) or [MacOS/Linux](https://ubuntu.com/tutorials/command-line-for-beginners#1-overview) command line tutorials. +This tutorial assumes that you're familiar with the basics of the command line. If you’re not, please refer to the [Windows](https://www.digitalcitizen.life/command-prompt-how-use-basic-commands/) or [MacOS/Linux](https://ubuntu.com/tutorials/command-line-for-beginners#1-overview) command line tutorials. *** -## Downloading the latest firmware +## Installing the micro Flipper Build Tool -The first thing you need to do is to download the latest Developer Board firmware. +Micro Flipper Build Tool (uFBT) is a cross-platform tool that enables basic development tasks for Flipper Zero, such as building and debugging applications, flashing firmware, and creating VS Code development configurations. -To get the latest pre-built firmware, do the following: +Install uFBT on your computer by running the following command in the Terminal: -1. Go to the [Update Server page](https://update.flipperzero.one/builds/blackmagic-firmware). -![The Update Server page hosts different versions of the Developer Board firmware](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/gIXVO9VrE4LK05CmcMSSD_monosnap-miro-2023-07-19-17-36-23.jpg) - - There, you can find the following version of the Developer Board firmware: - - * **Release:** The most stable version of the firmware, which went through rigorous testing. The Release firmware version has the following format: **X.Y.Z/**, where X, Y, and Z are the build numbers. We recommend installing this version of the firmware. - - * **Release-candidate:** The firmware version that hasn't been tested yet and may contain bugs. The Release-candidate firmware version has the following format: **X.Y.Z-rc/**, where X, Y, and Z are the build numbers. - - * **Development:** The firmware version which builds every day and contains the latest features but might be unstable. - -2. Open the folder with the latest Release firmware and download the `blackmagic-firmware-s2-full-X.Y.Z.tgz` file. - -*** - -## Extracting the firmware - -After downloading the firmware archive, extract it into a folder: - -* On Windows, you can use any archive manager for this, for example, [7-Zip](https://www.7-zip.org/). - -* On MacOS and Linux, you can use the `tar` command: - - ```text - tar -xzf blackmagic-firmware-s2-full-X.Y.Z.tgz -C - ``` - -Don't forget to replace `X.Y.Z` with the actual version number and set the destination directory! - -*** - -## Installing the prerequisites for flashing - -Install the tools below if you haven't already. - -### Python - -Download and install [Python3](https://www.python.org/downloads/). Make sure to check the “Add Python to PATH” option during installation. - -### pip - -To install the pip package manager, run the following command in the Terminal: +**For Linux & macOS:** ```text -python3 -m ensurepip --upgrade +python3 -m pip install --upgrade ufbt ``` -If this command fails, please refer to the [official pip documentation](https://pip.pypa.io/en/stable/installation/) for alternative installation methods. - -### esptool - -esptool is a command-line utility for flashing ESP8266 and ESP32 microcontrollers, including the ESP32-S2 in your Developer Board. - -To install esptool, run the following command in the Terminal: +**For Windows:** ```text -pip3 install esptool +py -m pip install --upgrade ufbt ``` -If this command fails, try using **pip** instead of **pip3**. If this didn’t help, please refer to the [official esptool installation manual](https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html). +If you want to learn more about uFBT, visit [the project's page](https://pypi.org/project/ufbt/). *** @@ -79,38 +32,38 @@ If this command fails, try using **pip** instead of **pip3**. If this didn’t h 1. List all of the serial devices on your computer. - * ***Windows*** + **Windows** - On Windows, go to Device Manager and expand the Ports (COM & LPT) section. + On Windows, go to Device Manager and expand the Ports (COM & LPT) section. - * ***macOS*** + **macOS** - On macOS, you can run the following command in the Terminal: + On macOS, you can run the following command in the Terminal: - ```text - ls /dev/cu.* - ``` + ```text + ls /dev/cu.* + ``` - * ***Linux*** + **Linux** - On Linux, you can run the following command in the Terminal: + On Linux, you can run the following command in the Terminal: - ```text - ls /dev/tty* - ``` + ```text + ls /dev/tty* + ``` View the devices in the list. -2. Connect the Developer Board to your computer using a USB-C cable.\ +2. Connect the Developer Board to your computer using a USB-C cable. ![The Developer Board in Wired mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/Aq7gfMI-m_5H6sGGjwb4I_monosnap-miro-2023-07-19-19-47-39.jpg) 3. Switch your Developer Board to Bootloader mode: - 3.1. Press and hold the **BOOT** button. - - 3.2. Press the **RESET** button while holding the **BOOT** button. - - 3.3. Release the **BOOT** button. + 3.1. Press and hold the **BOOT** button. + + 3.2. Press the **RESET** button while holding the **BOOT** button. + + 3.3. Release the **BOOT** button.\ ![You can easily switch the Dev Board to Bootloader mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/KynP9iT6sJ3mXLaLyI82__image.png) 4. Repeat Step 1 and view the name of your Developer Board that appeared in the list. @@ -125,103 +78,23 @@ If this command fails, try using **pip** instead of **pip3**. If this didn’t h ## Flashing the firmware -### Getting the flash command - -1. Run the Terminal and navigate to the folder with the extracted firmware. - -2. Run the following command to read the file with the flash command: +To flash the firmware onto your Developer Board, run the following command in the terminal: - ```text - cat flash.command - ``` - - If you see a similar output, you can proceed to the Flashing step: - - ```text - esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32s2 write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 bootloader.bin 0x10000 blackmagic.bin 0x8000 partition-table.bin - ``` - - Don't use the exact command above for your Developer Board in the next step since it's just an example and may not match your firmware version! - - If you get an error, ensure you’re in the correct directory and extracted the firmware archive correctly. - -*** - -### Flashing - -1. Copy the command you got from the previous step and replace the `(PORT)` part with the name of the serial device you learned earlier. - - For Windows, replace `(PORT)` with the COM port number—for example, `COM3`. - -2. Run the command in the Terminal. - - Your command should look similar to this: - - ```text - esptool.py -p /dev/cu.usbmodem01 -b 460800 --before default_reset --after hard_reset --chip esp32s2 write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 bootloader.bin 0x10000 blackmagic.bin 0x8000 partition-table.bin - ``` - - If you get an error, ensure that you’ve entered the correct serial device name and that the Developer Board is in Bootloader mode. - -3. Wait till the firmware flashing is over. The flashing process takes about 30 seconds. - - The Terminal output should look similar to this: - - ```text - esptool.py v4.6.1 - Serial port /dev/cu.usbmodem01 - Connecting... - Chip is ESP32-S2 (revision v0.0) - Features: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor - calibration in BLK2 of efuse V2 - Crystal is 40MHz - MAC: 00:11:22:33:44:55 - Uploading stub... - Running stub... - Stub running... - Changing baud rate to 460800 - Changed. - Configuring flash size... - Flash will be erased from 0x00001000 to 0x00004fff... - Flash will be erased from 0x00010000 to 0x000ecfff... - Flash will be erased from 0x00008000 to 0x00008fff... - Compressed 13248 bytes to 9298... - Wrote 13248 bytes (9298 compressed) at 0x00001000 in 0.3 seconds (effective 402.7 kbit/s)... - Hash of data verified. - Compressed 904288 bytes to 562550... - Wrote 904288 bytes (562550 compressed) at 0x00010000 in 6.7 seconds (effective 1076.5 kbit/s)... - Hash of data verified. - Compressed 3072 bytes to 124... - Wrote 3072 bytes (124 compressed) at 0x00008000 in 0.1 seconds (effective 360.8 kbit/s)... - Hash of data verified. - Leaving... - Hard resetting via RTS pin... - ``` - - If the Terminal output has these two lines at the end, your Developer Board has been successfully updated: - - ```text - Leaving... - Hard resetting via RTS pin... - ``` - - If you get this warning, you can safely ignore it: +```text +python3 -m ufbt devboard_flash +``` - ```text - WARNING: ESP32-S2 (revision v0.0) chip was placed into download mode using GPIO0. - esptool.py can not exit the download mode over USB. To run the app, reset the chip manually. - To suppress this note, set --after option to 'no_reset - ``` +You should see the following message: `WiFi board flashed successfully`. -#### If flashing failed +## If flashing failed -If you get an error message during the flashing process, such as: +If you get an error message during the flashing process, such as this: ```text A fatal error occurred: Serial data stream stopped: Possible serial noise or corruption. ``` -or +Or this: ```text FileNotFoundError: [Errno 2] No such file or directory: '/dev/cu.usbmodem01' @@ -239,8 +112,11 @@ Try doing the following: ## Finishing the installation -After flashing the firmware, you can reboot the Developer Board by pressing the **RESET** button. +After flashing the firmware: +1. Reboot the Developer Board by pressing the **RESET** button. ![Reset the Developer Board](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/rcQeKARgrVwa51tLoo-qY_monosnap-miro-2023-07-20-18-29-33.jpg) +2. Disconnect and reconnect the USB-C cable. + The Developer Board should appear as a serial device on your computer. Now, you can use it with the Black Magic Debug client of your choice. diff --git a/documentation/devboard/Get started with the Dev Board.md b/documentation/devboard/Get started with the Dev Board.md index eb230663e52..04fa9d3589e 100644 --- a/documentation/devboard/Get started with the Dev Board.md +++ b/documentation/devboard/Get started with the Dev Board.md @@ -2,7 +2,7 @@ The Wi-Fi Developer Board serves as a tool to debug the Flipper Zero firmware. To debug the firmware, the initial step involves compiling the firmware from its source code. This process enables the debugging functionality within the firmware and generates all the necessary files required for debugging purposes. -> **NOTE:** Building and debugging the Flipper Zero firmware is fully supported on MacOS and Linux. Support for Windows is in beta test. +> **NOTE:** Building and debugging the Flipper Zero firmware is fully supported on MacOS and Linux. Support for Windows is in beta test. *** @@ -14,11 +14,11 @@ Update the firmware of your Developer Board before using it. For more informatio ## Installing Git -You’ll need Git installed on your computer to clone the firmware repository. If you don’t have Git, install it by doing the following: +You'll need Git installed on your computer to clone the firmware repository. If you don't have Git, install it by doing the following: * **MacOS** - On MacOS, install the **Xcode Command Line Tools** package, which includes Git as one of the pre-installed command-line utilities, by running in the Terminal the following command: + On MacOS, install the **Xcode Command Line Tools** package, which includes Git as one of the pre-installed command-line utilities, by running in the Terminal the following command: ```text xcode-select --install @@ -26,11 +26,11 @@ You’ll need Git installed on your computer to clone the firmware repository. I * **Linux** - On Linux, you can install Git using your package manager. For example, on Ubuntu, run in the Terminal the following command: + On Linux, you can install Git using your package manager. For example, on Ubuntu, run in the Terminal the following command: - ```text - sudo apt install git - ``` + ```text + sudo apt install git + ``` For other distributions, refer to your package manager documentation. @@ -57,7 +57,9 @@ Then, run the **Flipper Build Tool** (FBT) to build the firmware: The Developer Board can work in the **Wired** mode and two **Wireless** modes: **Wi-Fi access point (AP)** mode and **Wi-Fi client (STA)** mode. The Wired mode is the simplest to set up, but requires a USB Type-C cable. The Wireless modes are more complex to set up, but they allow you to debug your Flipper Zero wirelessly. -> **NOTE:** Use the following credentials when connecting to the Developer Board in **Wi-Fi access point** mode: Name: **blackmagic**, Password: **iamwitcher** + > **NOTE:** Use the following credentials when connecting to the Developer Board in **Wi-Fi access point** mode:\n + Name: **blackmagic**\n + Password: **iamwitcher** ## Wired @@ -69,13 +71,13 @@ To connect the Developer Board in **Wired** mode, do the following: 2. On your computer, open the **Terminal** and run the following: - * **MacOS** + * **MacOS** ```text ls /dev/cu.* ``` - * **Linux** + * **Linux** ```text ls /dev/tty* @@ -87,9 +89,9 @@ To connect the Developer Board in **Wired** mode, do the following: 4. Rerun the command. Two new devices have to appear: this is the Developer Board. -> **NOTE:** If the Developer Board doesn’t appear in the list of devices, try using a different cable, USB port, or computer. -> -> **NOTE:** Flipper Zero logs can only be viewed when the Developer Board is connected via USB. The option to view logs over Wi-Fi will be added in future updates. For more information, visit [Reading logs via the Dev Board](https://docs.flipperzero.one/development/hardware/wifi-debugger-module/reading-logs). + > **NOTE:** If the Developer Board doesn't appear in the list of devices, try using a different cable, USB port, or computer. + > + > **NOTE:** Flipper Zero logs can only be viewed when the Developer Board is connected via USB. The option to view logs over Wi-Fi will be added in future updates. For more information, visit [Reading logs via the Dev Board](https://docs.flipperzero.one/development/hardware/wifi-debugger-module/reading-logs). ## Wireless @@ -97,7 +99,7 @@ To connect the Developer Board in **Wired** mode, do the following: ![The Developer Board in Wi-Fi access point mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/tKRTMHAuruiLSEce2a8Ve_monosnap-miro-2023-06-22-16-39-17.jpg) -Out of the box, the Developer Board is configured to work as a **Wi-Fi access point**. This means it will create its own Wi-Fi network to which you can connect. If your Developer Board doesn’t create a Wi-Fi network, it is probably configured to work in **Wi-Fi client** mode. To reset your Developer Board back to **Wi-Fi access point** mode, press and hold the **BOOT** button for 10 seconds, then wait for the module to reboot. +Out of the box, the Developer Board is configured to work as a **Wi-Fi access point**. This means it'll create its own Wi-Fi network to which you can connect. If your Developer Board doesn't create a Wi-Fi network, it is probably configured to work in **Wi-Fi client** mode. To reset your Developer Board back to **Wi-Fi access point** mode, press and hold the **BOOT** button for 10 seconds, then wait for the module to reboot. ![You can reconfigure the Developer Board mode by pressing and holding the BOOT button](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/57eELJsAwMxeZCEA1NMJw_monosnap-miro-2023-06-22-20-33-27.jpg) @@ -110,11 +112,12 @@ To connect the Developer Board in **Wi-Fi access point** mode, do the following: 3. Connect to the network: * Name: **blackmagic** + * Password: **iamwitcher** 4. To configure the Developer Board, open a browser and go to `http://192.168.4.1`. -#### Wi-Fi client (STA) mode +### Wi-Fi client (STA) mode ![The Developer Board in Wi-Fi client mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/xLQpFyYPfUS5Cx0uQhrNd_monosnap-miro-2023-06-23-12-34-36.jpg) @@ -126,15 +129,15 @@ To connect the Developer Board in **Wi-Fi client** mode, you need to configure i 3. In a browser, go to the configuration page on `http://192.168.4.1`. -4. Select the **STA** mode and enter your network’s **SSID** (name) and **password**. For convenience, you can click the **+** button to see the list of nearby networks. +4. Select the **STA** mode and enter your network's **SSID** (name) and **password**. For convenience, you can click the **+** button to see the list of nearby networks. 5. Save the configuration and reboot the Developer Board. ![In the Wi-Fi tab, you can set the Developer Board mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/klbLVj8lz2bEvm7j4wRaj_monosnap-miro-2023-06-23-13-06-32.jpg) -After rebooting, the Developer Board connects to your Wi-Fi network. You can connect to the device using the mDNS name [blackmagic.local](http://blackmagic.local) or the IP address it got from your router (you’ll have to figure this out yourself, every router is different). +After rebooting, the Developer Board connects to your Wi-Fi network. You can connect to the device using the mDNS name **blackmagic.local** or the IP address it got from your router (you'll have to figure this out yourself, every router is different). -After connecting to your debugger via [blackmagic.local](http://blackmagic.local), you can find its IP address in the **SYS** tab. You can also change the debugger’s mode to **AP** or **STA** there. +After connecting to your debugger via , you can find its IP address in the **SYS** tab. You can also change the debugger's mode to **AP** or **STA** there. ![In the SYS tab, you can view the IP address of your Developer Board](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/5XbUptlfqzlV0p6hRUqiG_monosnap-miro-2023-06-22-18-11-30.jpg) @@ -145,10 +148,10 @@ After connecting to your debugger via [blackmagic.local](http://blackmagic.local Open the **Terminal** in the **flipperzero-firmware** directory that you cloned earlier and run the following command: ```text -./fbt flash_blackmagic +./fbt flash ``` -This will upload the firmware you’ve just built to your Flipper Zero via the Developer Board. After that, you can start debugging the firmware using the [GDB](https://www.gnu.org/software/gdb/) debugger. We recommend using **VSCode** with the recommended extensions, and we have pre-made configurations for it. +This will upload the firmware you've just built to your Flipper Zero via the Developer Board. After that, you can start debugging the firmware using the [GDB](https://www.gnu.org/software/gdb/) debugger. We recommend using **VSCode** with the recommended extensions, and we have pre-made configurations for it. To debug in **VSCode**, do the following: @@ -162,9 +165,9 @@ To debug in **VSCode**, do the following: 4. In VSCode, open the **Run and Debug** tab and select **Attach FW (blackmagic)** from the dropdown menu. -5. If needed, flash your Flipper Zero with the `./fbt flash_blackmagic` command, then click the **Play** button in the debug sidebar to start the debugging session. +5. If needed, flash your Flipper Zero with the `./fbt flash` command, then click the **Play** button in the debug sidebar to start the debugging session. -6. Note that starting a debug session halts the execution of the firmware, so you’ll need to click the **Continue** button on the toolbar at the top of your VSCode window to continue execution. +6. Note that starting a debug session halts the execution of the firmware, so you'll need to click the **Continue** button on the toolbar at the top of your VSCode window to continue execution. ![Click Continue in the toolbar to continue execution of the firmware](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/lp8ygGaZ3DvWD3OSI9yGO_monosnap-miro-2023-06-23-17-58-09.jpg) diff --git a/documentation/devboard/Reading logs via the Dev Board.md b/documentation/devboard/Reading logs via the Dev Board.md index 112e59a19bf..e9fc0e2ca8f 100644 --- a/documentation/devboard/Reading logs via the Dev Board.md +++ b/documentation/devboard/Reading logs via the Dev Board.md @@ -4,9 +4,11 @@ The Developer Board allows you to read Flipper Zero logs via UART. Unlike readin > **NOTE:** Flipper Zero logs can only be viewed when the developer board is connected via USB. The option to view logs over Wi-Fi will be added in future updates. +*** + ## Setting the log level -Depending on your needs, you can set the log level by going to Main Menu -> Settings -> Log Level. To learn more about logging levels, visit [Settings](https://docs.flipperzero.one/basics/settings#d5TAt). +Depending on your needs, you can set the log level by going to **Main Menu -> Settings -> Log Level**. To learn more about logging levels, visit [Settings](https://docs.flipperzero.one/basics/settings#d5TAt). ![You can manually set the preferred log level](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/INzQMw8QUsG9PXi30WFS0_monosnap-miro-2023-07-11-13-29-47.jpg) @@ -20,17 +22,17 @@ Depending on your operating system, you need to install an additional applicatio On MacOS, you need to install the **minicom** communication program by doing the following: -1. [Install Homebrew](https://brew.sh/) by running in the Terminal the following command: +1. [Install Homebrew](https://brew.sh/) by running the following command in the Terminal: - ```text - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - ``` + ```text + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + ``` 2. After installation of Homebrew, run the following command to install minicom: - ```text - brew install minicom - ``` + ```text + brew install minicom + ``` After installation of minicom on your macOS computer, you can connect to the Developer Board to read Flipper Zero logs by doing the following: @@ -38,37 +40,40 @@ After installation of minicom on your macOS computer, you can connect to the Dev 2. On your computer, open the Terminal and run the following command: - ```text - ls /dev/cu.* - ``` + ```text + ls /dev/cu.* + ``` - Note the list of devices. + Note the list of devices. -3. Connect the developer board to your computer using a USB Type-C cable.\ -![The Developer Board in Wired mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/iPpsMt2-is4aIjiVeFu5t_hjxs2i1oovrnps74v5jgsimage.png) +3. Connect the developer board to your computer using a USB Type-C cable. +![Connect the developer board with a USB-C cable](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/iPpsMt2-is4aIjiVeFu5t_hjxs2i1oovrnps74v5jgsimage.png) 4. Rerun the command. Two new devices have to appear: this is the Developer Board. - ```text - /dev/cu.usbmodemblackmagic1 - /dev/cu.usbmodemblackmagic3 - ``` + ```text + /dev/cu.usbmodemblackmagic1 + ``` + + ```text + /dev/cu.usbmodemblackmagic3 + ``` Your Developer Board might have different names. 5. Run the following command: - ```text - minicom -D /dev/ -b 230400 - ``` + ```text + minicom -D /dev/ -b 230400 + ``` Where `` is the name of your device with a bigger number. Example: - ```text - minicom -D /dev/cu.usbmodemblackmagic3 -b 230400 - ``` + ```text + minicom -D /dev/cu.usbmodemblackmagic3 -b 230400 + ``` 6. View logs of your Flipper Zero in the Terminal. @@ -79,8 +84,8 @@ After installation of minicom on your macOS computer, you can connect to the Dev On Linux, you need to install the **minicom** communication program. For example, on Ubuntu, run in the Terminal the following command: ```text -sudo apt install minicom -``` + sudo apt install minicom + ``` After installation of minicom on your Linux computer, you can connect to the Developer Board to read Flipper Zero logs by doing the following: @@ -88,28 +93,31 @@ After installation of minicom on your Linux computer, you can connect to the Dev 2. On your computer, open the Terminal and run the following command: - ```text - ls /dev/tty* - ``` + ```text + ls /dev/tty* + ``` Note the list of devices. 3. Connect the developer board to your computer using a USB Type-C cable. -![The Developer Board in Wired mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/iPpsMt2-is4aIjiVeFu5t_hjxs2i1oovrnps74v5jgsimage.png) +![Connect the developer board with a USB-C cable](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/iPpsMt2-is4aIjiVeFu5t_hjxs2i1oovrnps74v5jgsimage.png) 4. Rerun the command. Two new devices have to appear: this is the Developer Board. - ```text - /dev/ttyACM0 - /dev/ttyACM1 - ``` + ```text + /dev/ttyACM0 + ``` + + ```text + /dev/ttyACM1 + ``` Your Developer Board might have different names. 5. Run the following command: ```text - minicom -D /dev/ \-b 230400 + minicom -D /dev/ -b 230400 ``` Where `` is the name of your device with a bigger number. @@ -117,12 +125,12 @@ After installation of minicom on your Linux computer, you can connect to the Dev Example: ```text - minicom -D /dev/ttyACM1 \-b 230400 + minicom -D /dev/cu.usbmodemblackmagic3 -b 230400 ``` 6. View logs of your Flipper Zero in the Terminal. - > **NOTE:** If no logs are shown in the Terminal, try running the command from Step 5 with another device name. + **NOTE:** If no logs are shown in the Terminal, try running the command from Step 5 with another device name. 7. To quit, close the minicom window or quit via the minicom menu. @@ -135,17 +143,17 @@ On Windows, do the following: 2. Cold-plug the Developer Board into your Flipper Zero by turning off the Flipper Zero, connecting the developer board, and then turning it back on. 3. Connect the developer board to your computer using a USB Type-C cable. -![The Developer Board in Wired mode](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/iPpsMt2-is4aIjiVeFu5t_hjxs2i1oovrnps74v5jgsimage.png) +![Connect the developer board with a USB-C cable](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/iPpsMt2-is4aIjiVeFu5t_hjxs2i1oovrnps74v5jgsimage.png) 4. Find the serial port that the developer board is connected to by going to **Device Manager -> Ports (COM & LPT)** and looking for a new port that appears when you connect the Wi-Fi developer board. -![Go to Device Manager -> Ports (COM & LPT)](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/KKLQJK1lvqmI5iab3d__C_image.png) +![Find the serial port in your Device Manager](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/KKLQJK1lvqmI5iab3d__C_image.png) 5. Run the PuTTY application and select **Serial** as the connection type. 6. Enter the port number you found in the previous step into the **Serial line** field. 7. Set the **Speed** parameter to **230400** and click **Open**. -![Set the required parameters](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/ROBSJyfQ_CXiy4GUZcPbs_monosnap-miro-2023-07-12-13-56-47.jpg) +![Set speed to 230400](https://archbee-image-uploads.s3.amazonaws.com/3StCFqarJkJQZV-7N79yY/ROBSJyfQ_CXiy4GUZcPbs_monosnap-miro-2023-07-12-13-56-47.jpg) 8. View logs of your Flipper Zero in the PuTTY terminal window. From 169522cbe873fdcb4159d96ff31d828b44bf8e55 Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:37:16 +0300 Subject: [PATCH 06/28] [FL-3792] Fix iButton emulation regression (#3519) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- lib/one_wire/one_wire_slave.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/one_wire/one_wire_slave.c b/lib/one_wire/one_wire_slave.c index f426582cfb7..8dfbe4aa582 100644 --- a/lib/one_wire/one_wire_slave.c +++ b/lib/one_wire/one_wire_slave.c @@ -158,6 +158,8 @@ static inline bool onewire_slave_receive_and_process_command(OneWireSlave* bus) static inline bool onewire_slave_bus_start(OneWireSlave* bus) { FURI_CRITICAL_ENTER(); + + furi_hal_gpio_disable_int_callback(bus->gpio_pin); furi_hal_gpio_init(bus->gpio_pin, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow); while(onewire_slave_receive_and_process_command(bus)) @@ -166,6 +168,8 @@ static inline bool onewire_slave_bus_start(OneWireSlave* bus) { const bool result = (bus->error == OneWireSlaveErrorNone); furi_hal_gpio_init(bus->gpio_pin, GpioModeInterruptRiseFall, GpioPullNo, GpioSpeedLow); + furi_hal_gpio_enable_int_callback(bus->gpio_pin); + FURI_CRITICAL_EXIT(); return result; From 1c033e2afea4d69ad4492d460a2e1ad532d1ca2f Mon Sep 17 00:00:00 2001 From: Astra <93453568+Astrrra@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:44:48 +0200 Subject: [PATCH 07/28] NFC wording fixes (#3512) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * NFC wording fixes * Fix filename Co-authored-by: hedger Co-authored-by: あく --- .../mf_ultralight/mf_ultralight.c | 2 +- .../mf_ultralight/mf_ultralight_render.c | 6 +- .../main/nfc/scenes/nfc_scene_config.h | 3 +- .../main/nfc/scenes/nfc_scene_detect.c | 2 +- ...nfc_scene_mf_classic_keys_warn_duplicate.c | 2 +- .../nfc_scene_mf_classic_mfkey_complete.c | 2 +- .../nfc_scene_mf_classic_update_initial.c | 8 ++- ...ene_mf_classic_update_initial_wrong_card.c | 58 +++++++++++++++++++ .../nfc_scene_mf_classic_write_initial.c | 5 +- ...ene_mf_classic_write_initial_wrong_card.c} | 14 ++--- .../nfc_scene_mf_ultralight_unlock_warn.c | 10 ++-- .../main/nfc/scenes/nfc_scene_slix_unlock.c | 2 +- 12 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial_wrong_card.c rename applications/main/nfc/scenes/{nfc_scene_mf_classic_wrong_card.c => nfc_scene_mf_classic_write_initial_wrong_card.c} (69%) diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c index eb6911df742..c2aaac5bee5 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c @@ -169,7 +169,7 @@ static void nfc_scene_read_setup_view(NfcApp* instance) { popup_set_icon(instance->popup, 0, 8, &I_NFC_manual_60x50); popup_set_header(instance->popup, "Unlocking", 97, 15, AlignCenter, AlignTop); popup_set_text( - instance->popup, "Apply card to\nFlipper's back", 97, 27, AlignCenter, AlignTop); + instance->popup, "Hold card next\nto Flipper's back", 94, 27, AlignCenter, AlignTop); } else { popup_set_header(instance->popup, "Don't move", 85, 27, AlignCenter, AlignTop); popup_set_icon(instance->popup, 12, 20, &A_Loading_24); diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c index 1bc508adce1..c4ad67ff8bc 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight_render.c @@ -11,7 +11,11 @@ static void nfc_render_mf_ultralight_pages_count(const MfUltralightData* data, F void nfc_render_mf_ultralight_pwd_pack(const MfUltralightData* data, FuriString* str) { bool all_pages = mf_ultralight_is_all_data_read(data); - furi_string_cat_printf(str, "\e#%s pages unlocked!", all_pages ? "All" : "Not all"); + if(all_pages) { + furi_string_cat_printf(str, "\e#All Pages Are Unlocked!"); + } else { + furi_string_cat_printf(str, "\e#Some Pages Are Locked!"); + } MfUltralightConfigPages* config; mf_ultralight_get_config_page(data, &config); diff --git a/applications/main/nfc/scenes/nfc_scene_config.h b/applications/main/nfc/scenes/nfc_scene_config.h index 035c4949cf2..8a5e29ff394 100644 --- a/applications/main/nfc/scenes/nfc_scene_config.h +++ b/applications/main/nfc/scenes/nfc_scene_config.h @@ -43,10 +43,11 @@ ADD_SCENE(nfc, mf_classic_mfkey_nonces_info, MfClassicMfkeyNoncesInfo) ADD_SCENE(nfc, mf_classic_mfkey_complete, MfClassicMfkeyComplete) ADD_SCENE(nfc, mf_classic_update_initial, MfClassicUpdateInitial) ADD_SCENE(nfc, mf_classic_update_initial_success, MfClassicUpdateInitialSuccess) +ADD_SCENE(nfc, mf_classic_update_initial_wrong_card, MfClassicUpdateInitialWrongCard) ADD_SCENE(nfc, mf_classic_write_initial, MfClassicWriteInitial) ADD_SCENE(nfc, mf_classic_write_initial_success, MfClassicWriteInitialSuccess) ADD_SCENE(nfc, mf_classic_write_initial_fail, MfClassicWriteInitialFail) -ADD_SCENE(nfc, mf_classic_wrong_card, MfClassicWrongCard) +ADD_SCENE(nfc, mf_classic_write_initial_wrong_card, MfClassicWriteInitialWrongCard) ADD_SCENE(nfc, mf_classic_keys, MfClassicKeys) ADD_SCENE(nfc, mf_classic_keys_list, MfClassicKeysList) diff --git a/applications/main/nfc/scenes/nfc_scene_detect.c b/applications/main/nfc/scenes/nfc_scene_detect.c index 34c552aba50..3ef153657d3 100644 --- a/applications/main/nfc/scenes/nfc_scene_detect.c +++ b/applications/main/nfc/scenes/nfc_scene_detect.c @@ -19,7 +19,7 @@ void nfc_scene_detect_on_enter(void* context) { popup_reset(instance->popup); popup_set_header(instance->popup, "Reading", 97, 15, AlignCenter, AlignTop); popup_set_text( - instance->popup, "Apply card to\nFlipper's back", 97, 27, AlignCenter, AlignTop); + instance->popup, "Hold card next\nto Flipper's back", 94, 27, AlignCenter, AlignTop); popup_set_icon(instance->popup, 0, 8, &I_NFC_manual_60x50); view_dispatcher_switch_to_view(instance->view_dispatcher, NfcViewPopup); diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_keys_warn_duplicate.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_keys_warn_duplicate.c index c3fb92bee06..675463ec963 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_keys_warn_duplicate.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_keys_warn_duplicate.c @@ -12,7 +12,7 @@ void nfc_scene_mf_classic_keys_warn_duplicate_on_enter(void* context) { // Setup view Popup* popup = instance->popup; popup_set_icon(popup, 83, 22, &I_WarningDolphinFlip_45x42); - popup_set_header(popup, "Key already exists!", 64, 3, AlignCenter, AlignTop); + popup_set_header(popup, "Key Already Exists!", 64, 3, AlignCenter, AlignTop); popup_set_text( popup, "Please enter a\n" diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_mfkey_complete.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_mfkey_complete.c index eb0aa7c3aea..d5033789a12 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_mfkey_complete.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_mfkey_complete.c @@ -14,7 +14,7 @@ void nfc_scene_mf_classic_mfkey_complete_on_enter(void* context) { NfcApp* instance = context; widget_add_string_element( - instance->widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "Complete!"); + instance->widget, 64, 0, AlignCenter, AlignTop, FontPrimary, "Completed!"); widget_add_string_multiline_element( instance->widget, 64, diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial.c index 961afdf5311..7c76260b4fa 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial.c @@ -61,7 +61,7 @@ static void nfc_scene_mf_classic_update_initial_setup_view(NfcApp* instance) { if(state == NfcSceneMfClassicUpdateInitialStateCardSearch) { popup_set_text( - instance->popup, "Apply the initial\ncard only", 128, 32, AlignRight, AlignCenter); + instance->popup, "Use the source\ncard only", 128, 32, AlignRight, AlignCenter); popup_set_icon(instance->popup, 0, 8, &I_NFC_manual_60x50); } else { popup_set_header(popup, "Updating\nDon't move...", 52, 32, AlignLeft, AlignCenter); @@ -111,14 +111,16 @@ bool nfc_scene_mf_classic_update_initial_on_event(void* context, SceneManagerEve nfc_scene_mf_classic_update_initial_setup_view(instance); consumed = true; } else if(event.event == NfcCustomEventWrongCard) { - scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicWrongCard); + scene_manager_next_scene( + instance->scene_manager, NfcSceneMfClassicUpdateInitialWrongCard); consumed = true; } else if(event.event == NfcCustomEventWorkerExit) { if(nfc_save_shadow_file(instance)) { scene_manager_next_scene( instance->scene_manager, NfcSceneMfClassicUpdateInitialSuccess); } else { - scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicWrongCard); + scene_manager_next_scene( + instance->scene_manager, NfcSceneMfClassicUpdateInitialWrongCard); consumed = true; } } 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 new file mode 100644 index 00000000000..c2c36c74fa1 --- /dev/null +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_update_initial_wrong_card.c @@ -0,0 +1,58 @@ +#include "../nfc_app_i.h" + +void nfc_scene_mf_classic_update_initial_wrong_card_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + NfcApp* instance = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(instance->view_dispatcher, result); + } +} + +void nfc_scene_mf_classic_update_initial_wrong_card_on_enter(void* context) { + NfcApp* instance = context; + Widget* widget = instance->widget; + + notification_message(instance->notifications, &sequence_error); + + widget_add_icon_element(widget, 83, 22, &I_WarningDolphinFlip_45x42); + widget_add_string_element(widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "Wrong Card!"); + widget_add_string_multiline_element( + widget, + 4, + 17, + AlignLeft, + AlignTop, + FontSecondary, + "Data management\nis only possible\nwith source card"); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Retry", + nfc_scene_mf_classic_update_initial_wrong_card_widget_callback, + instance); + + // Setup and start worker + view_dispatcher_switch_to_view(instance->view_dispatcher, NfcViewWidget); +} + +bool nfc_scene_mf_classic_update_initial_wrong_card_on_event( + void* context, + SceneManagerEvent event) { + NfcApp* instance = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeLeft) { + consumed = scene_manager_previous_scene(instance->scene_manager); + } + } + return consumed; +} + +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.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial.c index da576a276c2..12e7ba1ecdf 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial.c @@ -67,7 +67,7 @@ static void nfc_scene_mf_classic_write_initial_setup_view(NfcApp* instance) { if(state == NfcSceneMfClassicWriteInitialStateCardSearch) { popup_set_header(instance->popup, "Writing", 95, 20, AlignCenter, AlignCenter); popup_set_text( - instance->popup, "Apply the initial\ncard only", 95, 38, AlignCenter, AlignCenter); + instance->popup, "Use the source\ncard only", 95, 38, AlignCenter, AlignCenter); popup_set_icon(instance->popup, 0, 8, &I_NFC_manual_60x50); } else { popup_set_header(popup, "Writing\nDon't move...", 52, 32, AlignLeft, AlignCenter); @@ -115,7 +115,8 @@ bool nfc_scene_mf_classic_write_initial_on_event(void* context, SceneManagerEven nfc_scene_mf_classic_write_initial_setup_view(instance); consumed = true; } else if(event.event == NfcCustomEventWrongCard) { - scene_manager_next_scene(instance->scene_manager, NfcSceneMfClassicWrongCard); + scene_manager_next_scene( + instance->scene_manager, NfcSceneMfClassicWriteInitialWrongCard); consumed = true; } else if(event.event == NfcCustomEventPollerSuccess) { scene_manager_next_scene( diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_wrong_card.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c similarity index 69% rename from applications/main/nfc/scenes/nfc_scene_mf_classic_wrong_card.c rename to applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c index a879985bc8d..3f92ebfd3b2 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_wrong_card.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_write_initial_wrong_card.c @@ -1,6 +1,6 @@ #include "../nfc_app_i.h" -void nfc_scene_mf_classic_wrong_card_widget_callback( +void nfc_scene_mf_classic_write_initial_wrong_card_widget_callback( GuiButtonType result, InputType type, void* context) { @@ -10,7 +10,7 @@ void nfc_scene_mf_classic_wrong_card_widget_callback( } } -void nfc_scene_mf_classic_wrong_card_on_enter(void* context) { +void nfc_scene_mf_classic_write_initial_wrong_card_on_enter(void* context) { NfcApp* instance = context; Widget* widget = instance->widget; @@ -18,7 +18,7 @@ void nfc_scene_mf_classic_wrong_card_on_enter(void* context) { widget_add_icon_element(widget, 83, 22, &I_WarningDolphinFlip_45x42); widget_add_string_element( - widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "This is wrong card"); + widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "Use The Source Card!"); widget_add_string_multiline_element( widget, 4, @@ -26,19 +26,19 @@ void nfc_scene_mf_classic_wrong_card_on_enter(void* context) { AlignLeft, AlignTop, FontSecondary, - "Data management\nis only possible\nwith initial card"); + "Go to NFC Magic\napp if you want to\nwrite blanks"); widget_add_button_element( widget, GuiButtonTypeLeft, "Retry", - nfc_scene_mf_classic_wrong_card_widget_callback, + nfc_scene_mf_classic_write_initial_wrong_card_widget_callback, instance); // Setup and start worker view_dispatcher_switch_to_view(instance->view_dispatcher, NfcViewWidget); } -bool nfc_scene_mf_classic_wrong_card_on_event(void* context, SceneManagerEvent event) { +bool nfc_scene_mf_classic_write_initial_wrong_card_on_event(void* context, SceneManagerEvent event) { NfcApp* instance = context; bool consumed = false; @@ -50,7 +50,7 @@ bool nfc_scene_mf_classic_wrong_card_on_event(void* context, SceneManagerEvent e return consumed; } -void nfc_scene_mf_classic_wrong_card_on_exit(void* context) { +void nfc_scene_mf_classic_write_initial_wrong_card_on_exit(void* context) { NfcApp* instance = context; widget_reset(instance->widget); diff --git a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_warn.c b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_warn.c index db5fd945fa0..4df8a62899e 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_warn.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_unlock_warn.c @@ -22,14 +22,14 @@ void nfc_scene_mf_ultralight_unlock_warn_on_enter(void* context) { for(size_t i = 0; i < sizeof(nfc->mf_ul_auth->password.data); i++) { furi_string_cat_printf(password_str, "%02X ", nfc->mf_ul_auth->password.data[i]); } - furi_string_cat_str(password_str, "?\nCaution, a wrong password\ncan block the card!"); + furi_string_cat_str(password_str, "\nWarning: incorrect password\nwill block the card!"); nfc_text_store_set(nfc, furi_string_get_cstr(password_str)); furi_string_free(password_str); - const char* message = (type == MfUltralightAuthTypeReader) ? "Password captured!" : - "Risky function!"; + const char* message = (type == MfUltralightAuthTypeReader) ? "Password Captured!" : + "Risky Action!"; dialog_ex_set_header(dialog_ex, message, 64, 0, AlignCenter, AlignTop); - dialog_ex_set_text(dialog_ex, nfc->text_store, 64, 12, AlignCenter, AlignTop); + dialog_ex_set_text(dialog_ex, nfc->text_store, 64, 10, AlignCenter, AlignTop); dialog_ex_set_left_button_text(dialog_ex, "Cancel"); dialog_ex_set_right_button_text(dialog_ex, "Continue"); @@ -37,7 +37,7 @@ void nfc_scene_mf_ultralight_unlock_warn_on_enter(void* context) { notification_message(nfc->notifications, &sequence_set_green_255); } } else { - dialog_ex_set_header(dialog_ex, "Risky function!", 64, 4, AlignCenter, AlignTop); + dialog_ex_set_header(dialog_ex, "Risky action!", 64, 4, AlignCenter, AlignTop); dialog_ex_set_text( dialog_ex, "Wrong password\ncan block your\ncard.", 4, 18, AlignLeft, AlignTop); dialog_ex_set_icon(dialog_ex, 83, 22, &I_WarningDolphinFlip_45x42); diff --git a/applications/main/nfc/scenes/nfc_scene_slix_unlock.c b/applications/main/nfc/scenes/nfc_scene_slix_unlock.c index b01876e068a..ae725ce6794 100644 --- a/applications/main/nfc/scenes/nfc_scene_slix_unlock.c +++ b/applications/main/nfc/scenes/nfc_scene_slix_unlock.c @@ -32,7 +32,7 @@ void nfc_scene_slix_unlock_on_enter(void* context) { popup_set_icon(instance->popup, 0, 8, &I_NFC_manual_60x50); popup_set_header(instance->popup, "Unlocking", 97, 15, AlignCenter, AlignTop); popup_set_text( - instance->popup, "Apply card to\nFlipper's back", 97, 27, AlignCenter, AlignTop); + instance->popup, "Hold card next\nto Flipper's back", 94, 27, AlignCenter, AlignTop); view_dispatcher_switch_to_view(instance->view_dispatcher, NfcViewPopup); instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolSlix); From 7987917d85281066136d22d65baafc6f8041eb8a Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:54:07 +0300 Subject: [PATCH 08/28] [FL-3496, FL-3523, FL-3767, FL-3790] Infrared fixes and more (#3515) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FL-3496: do not hardcode universal library names in CLI * FL-3523: remove TODO, no changes necessary * FL-3767: remove TODO, no changes necessary * FL-3790: fix laggy TextInput by not adding it into a ViewStack * Improve documentation * Fix logical error in documentation Co-authored-by: あく --- applications/main/infrared/infrared_app.c | 12 +++-- applications/main/infrared/infrared_app_i.h | 12 +++-- applications/main/infrared/infrared_cli.c | 50 ++++++++++++++++--- .../common/infrared_scene_universal_common.c | 3 +- .../scenes/infrared_scene_edit_delete.c | 7 +-- .../scenes/infrared_scene_edit_move.c | 8 ++- .../scenes/infrared_scene_edit_rename.c | 15 ++---- .../scenes/infrared_scene_remote_list.c | 3 -- .../main/infrared/scenes/infrared_scene_rpc.c | 7 +-- applications/services/gui/view_dispatcher.h | 4 +- applications/services/gui/view_holder.h | 6 +++ applications/services/gui/view_stack.h | 4 +- applications/services/rpc/rpc.c | 2 - 13 files changed, 84 insertions(+), 49 deletions(-) diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 7ccbb6ceafa..82b05447865 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -189,6 +189,10 @@ static InfraredApp* infrared_alloc(void) { view_dispatcher_add_view( view_dispatcher, InfraredViewMove, infrared_move_view_get_view(infrared->move_view)); + infrared->loading = loading_alloc(); + view_dispatcher_add_view( + view_dispatcher, InfraredViewLoading, loading_get_view(infrared->loading)); + if(app_state->is_debug_enabled) { infrared->debug_view = infrared_debug_view_alloc(); view_dispatcher_add_view( @@ -198,7 +202,6 @@ static InfraredApp* infrared_alloc(void) { } infrared->button_panel = button_panel_alloc(); - infrared->loading = loading_alloc(); infrared->progress = infrared_progress_view_alloc(); return infrared; @@ -240,13 +243,15 @@ static void infrared_free(InfraredApp* infrared) { view_dispatcher_remove_view(view_dispatcher, InfraredViewMove); infrared_move_view_free(infrared->move_view); + view_dispatcher_remove_view(view_dispatcher, InfraredViewLoading); + loading_free(infrared->loading); + if(app_state->is_debug_enabled) { view_dispatcher_remove_view(view_dispatcher, InfraredViewDebugView); infrared_debug_view_free(infrared->debug_view); } button_panel_free(infrared->button_panel); - loading_free(infrared->loading); infrared_progress_view_free(infrared->progress); view_dispatcher_free(view_dispatcher); @@ -385,14 +390,13 @@ void infrared_tx_stop(InfraredApp* infrared) { } void infrared_blocking_task_start(InfraredApp* infrared, FuriThreadCallback callback) { - view_stack_add_view(infrared->view_stack, loading_get_view(infrared->loading)); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewLoading); furi_thread_set_callback(infrared->task_thread, callback); furi_thread_start(infrared->task_thread); } bool infrared_blocking_task_finalize(InfraredApp* infrared) { furi_thread_join(infrared->task_thread); - view_stack_remove_view(infrared->view_stack, loading_get_view(infrared->loading)); return furi_thread_get_return_code(infrared->task_thread); } diff --git a/applications/main/infrared/infrared_app_i.h b/applications/main/infrared/infrared_app_i.h index bccd58608a5..1c074323a2e 100644 --- a/applications/main/infrared/infrared_app_i.h +++ b/applications/main/infrared/infrared_app_i.h @@ -141,6 +141,7 @@ typedef enum { InfraredViewStack, InfraredViewDebugView, InfraredViewMove, + InfraredViewLoading, } InfraredView; /** @@ -213,8 +214,8 @@ void infrared_tx_stop(InfraredApp* infrared); /** * @brief Start a blocking task in a separate thread. * - * If a ViewStack is currently on screen, a busy "Hourglass" animation - * will be shown and no input will be accepted until completion. + * Before starting a blocking task, the current view will be replaced + * with a busy animation. All subsequent user input will be ignored. * * @param[in,out] infrared pointer to the application instance. * @param[in] callback pointer to the function to be run in the thread. @@ -222,10 +223,11 @@ void infrared_tx_stop(InfraredApp* infrared); void infrared_blocking_task_start(InfraredApp* infrared, FuriThreadCallback callback); /** - * @brief Wait for a blocking task to finish and receive the result. + * @brief Wait for a blocking task to finish and get the result. * - * Upon the completion of a blocking task, the busy animation will be hidden - * and input will be accepted again. + * The busy animation shown during the infrared_blocking_task_start() call + * will NOT be hidden and WILL remain on screen. If another view is needed + * (e.g. to display the results), the caller code MUST set it explicitly. * * @param[in,out] infrared pointer to the application instance. * @return true if the blocking task finished successfully, false otherwise. diff --git a/applications/main/infrared/infrared_cli.c b/applications/main/infrared/infrared_cli.c index b498fc6006b..123fe78d54c 100644 --- a/applications/main/infrared/infrared_cli.c +++ b/applications/main/infrared/infrared_cli.c @@ -10,8 +10,10 @@ #include "infrared_signal.h" #include "infrared_brute_force.h" -#define INFRARED_CLI_BUF_SIZE 10 -#define INFRARED_ASSETS_FOLDER "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) @@ -66,6 +68,37 @@ static void signal_received_callback(void* context, InfraredWorkerSignal* receiv } } +static void infrared_cli_print_universal_remotes(void) { + Storage* storage = furi_record_open(RECORD_STORAGE); + File* dir = storage_file_alloc(storage); + + do { + if(!storage_dir_open(dir, INFRARED_ASSETS_FOLDER)) break; + + FileInfo file_info; + char file_name[INFRARED_CLI_FILE_NAME_SIZE]; + + while(storage_dir_read(dir, &file_info, file_name, sizeof(file_name))) { + if(file_info.flags & FSF_DIRECTORY) { + continue; + } + + char* file_ext = strstr(file_name, INFRARED_FILE_EXTENSION); + if((file_ext == NULL) || (strcmp(file_ext, INFRARED_FILE_EXTENSION) != 0)) { + continue; + } + + *file_ext = '\0'; + printf("%s ", file_name); + } + + printf("\r\n"); + } while(false); + + storage_file_free(dir); + furi_record_close(RECORD_STORAGE); +} + static void infrared_cli_print_usage(void) { printf("Usage:\r\n"); printf("\tir rx [raw]\r\n"); @@ -85,8 +118,9 @@ static void infrared_cli_print_usage(void) { printf("\tir decode []\r\n"); printf("\tir universal \r\n"); printf("\tir universal list \r\n"); - // TODO FL-3496: Do not hardcode universal remote names - printf("\tAvailable universal remotes: tv audio ac projector\r\n"); + printf("\tAvailable universal remotes: "); + + infrared_cli_print_universal_remotes(); } static void infrared_cli_start_ir_rx(Cli* cli, FuriString* args) { @@ -211,7 +245,6 @@ static bool infrared_cli_decode_raw_signal( size_t i; for(i = 0; i < raw_signal->timings_size; ++i) { - // TODO FL-3523: Any infrared_check_decoder_ready() magic? const InfraredMessage* message = infrared_decode(decoder, level, raw_signal->timings[i]); if(message) { @@ -365,7 +398,10 @@ static void infrared_cli_list_remote_signals(FuriString* remote_name) { Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* ff = flipper_format_buffered_file_alloc(storage); FuriString* remote_path = furi_string_alloc_printf( - "%s/%s.ir", EXT_PATH(INFRARED_ASSETS_FOLDER), furi_string_get_cstr(remote_name)); + "%s/%s%s", + INFRARED_ASSETS_FOLDER, + furi_string_get_cstr(remote_name), + INFRARED_FILE_EXTENSION); do { if(!flipper_format_buffered_file_open_existing(ff, furi_string_get_cstr(remote_path))) { @@ -413,7 +449,7 @@ static void infrared_cli_brute_force_signals(Cli* cli, FuriString* remote_name, FuriString* signal_name) { InfraredBruteForce* brute_force = infrared_brute_force_alloc(); FuriString* remote_path = furi_string_alloc_printf( - "%s/%s.ir", EXT_PATH(INFRARED_ASSETS_FOLDER), furi_string_get_cstr(remote_name)); + "%s/%s.ir", INFRARED_ASSETS_FOLDER, furi_string_get_cstr(remote_name)); infrared_brute_force_set_db_filename(brute_force, furi_string_get_cstr(remote_path)); infrared_brute_force_add_record( diff --git a/applications/main/infrared/scenes/common/infrared_scene_universal_common.c b/applications/main/infrared/scenes/common/infrared_scene_universal_common.c index 9fc48bd46bd..9bdcdc4a823 100644 --- a/applications/main/infrared/scenes/common/infrared_scene_universal_common.c +++ b/applications/main/infrared/scenes/common/infrared_scene_universal_common.c @@ -46,7 +46,6 @@ void infrared_scene_universal_common_on_enter(void* context) { InfraredApp* infrared = context; view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical); view_stack_add_view(infrared->view_stack, button_panel_get_view(infrared->button_panel)); - view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); // Load universal remote data in background infrared_blocking_task_start(infrared, infrared_scene_universal_common_task_callback); @@ -98,6 +97,8 @@ bool infrared_scene_universal_common_on_event(void* context, SceneManagerEvent e if(!task_success) { scene_manager_next_scene(infrared->scene_manager, InfraredSceneErrorDatabases); + } else { + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); } } consumed = true; diff --git a/applications/main/infrared/scenes/infrared_scene_edit_delete.c b/applications/main/infrared/scenes/infrared_scene_edit_delete.c index 8dc4ab6f9f8..90a2633d338 100644 --- a/applications/main/infrared/scenes/infrared_scene_edit_delete.c +++ b/applications/main/infrared/scenes/infrared_scene_edit_delete.c @@ -91,10 +91,7 @@ void infrared_scene_edit_delete_on_enter(void* context) { dialog_ex_set_result_callback(dialog_ex, infrared_scene_edit_delete_dialog_result_callback); dialog_ex_set_context(dialog_ex, context); - view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationHorizontal); - view_stack_add_view(infrared->view_stack, dialog_ex_get_view(infrared->dialog_ex)); - - view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx); } bool infrared_scene_edit_delete_on_event(void* context, SceneManagerEvent event) { @@ -136,5 +133,5 @@ bool infrared_scene_edit_delete_on_event(void* context, SceneManagerEvent event) void infrared_scene_edit_delete_on_exit(void* context) { InfraredApp* infrared = context; - view_stack_remove_view(infrared->view_stack, dialog_ex_get_view(infrared->dialog_ex)); + dialog_ex_reset(infrared->dialog_ex); } diff --git a/applications/main/infrared/scenes/infrared_scene_edit_move.c b/applications/main/infrared/scenes/infrared_scene_edit_move.c index 500f3d791ed..fcac1fc15e0 100644 --- a/applications/main/infrared/scenes/infrared_scene_edit_move.c +++ b/applications/main/infrared/scenes/infrared_scene_edit_move.c @@ -38,10 +38,7 @@ void infrared_scene_edit_move_on_enter(void* context) { infrared_move_view_set_callback( infrared->move_view, infrared_scene_edit_move_button_callback, infrared); - view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationHorizontal); - view_stack_add_view(infrared->view_stack, infrared_move_view_get_view(infrared->move_view)); - - view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewMove); } bool infrared_scene_edit_move_on_event(void* context, SceneManagerEvent event) { @@ -62,6 +59,8 @@ bool infrared_scene_edit_move_on_event(void* context, SceneManagerEvent event) { infrared_show_error_message(infrared, "Failed to move\n\"%s\"", signal_name); scene_manager_search_and_switch_to_previous_scene( infrared->scene_manager, InfraredSceneRemoteList); + } else { + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewMove); } } consumed = true; @@ -72,6 +71,5 @@ bool infrared_scene_edit_move_on_event(void* context, SceneManagerEvent event) { void infrared_scene_edit_move_on_exit(void* context) { InfraredApp* infrared = context; - view_stack_remove_view(infrared->view_stack, infrared_move_view_get_view(infrared->move_view)); infrared_move_view_reset(infrared->move_view); } diff --git a/applications/main/infrared/scenes/infrared_scene_edit_rename.c b/applications/main/infrared/scenes/infrared_scene_edit_rename.c index 2763c277738..a546ad6e50d 100644 --- a/applications/main/infrared/scenes/infrared_scene_edit_rename.c +++ b/applications/main/infrared/scenes/infrared_scene_edit_rename.c @@ -75,10 +75,7 @@ void infrared_scene_edit_rename_on_enter(void* context) { enter_name_length, false); - view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationHorizontal); - view_stack_add_view(infrared->view_stack, text_input_get_view(infrared->text_input)); - - view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewTextInput); } bool infrared_scene_edit_rename_on_event(void* context, SceneManagerEvent event) { @@ -117,12 +114,10 @@ void infrared_scene_edit_rename_on_exit(void* context) { InfraredApp* infrared = context; TextInput* text_input = infrared->text_input; - view_stack_remove_view(infrared->view_stack, text_input_get_view(text_input)); - - void* validator_context = text_input_get_validator_callback_context(text_input); - text_input_set_validator(text_input, NULL, NULL); - + ValidatorIsFile* validator_context = text_input_get_validator_callback_context(text_input); if(validator_context) { - validator_is_file_free((ValidatorIsFile*)validator_context); + validator_is_file_free(validator_context); } + + text_input_reset(text_input); } diff --git a/applications/main/infrared/scenes/infrared_scene_remote_list.c b/applications/main/infrared/scenes/infrared_scene_remote_list.c index 744409a7ab2..9c880ac2fb9 100644 --- a/applications/main/infrared/scenes/infrared_scene_remote_list.c +++ b/applications/main/infrared/scenes/infrared_scene_remote_list.c @@ -18,9 +18,6 @@ static void infrared_scene_remote_list_select_and_load(InfraredApp* infrared) { infrared->dialogs, infrared->file_path, infrared->file_path, &browser_options); if(file_selected) { - view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical); - view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); - // Load the remote in a separate thread infrared_blocking_task_start(infrared, infrared_scene_remote_list_task_callback); diff --git a/applications/main/infrared/scenes/infrared_scene_rpc.c b/applications/main/infrared/scenes/infrared_scene_rpc.c index 03a2bff0107..4c263a11752 100644 --- a/applications/main/infrared/scenes/infrared_scene_rpc.c +++ b/applications/main/infrared/scenes/infrared_scene_rpc.c @@ -30,11 +30,8 @@ void infrared_scene_rpc_on_enter(void* context) { popup_set_context(popup, context); popup_set_callback(popup, infrared_popup_closed_callback); - view_stack_add_view(infrared->view_stack, popup_get_view(infrared->popup)); - view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewStack); - + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup); scene_manager_set_scene_state(infrared->scene_manager, InfraredSceneRpc, InfraredRpcStateIdle); - notification_message(infrared->notifications, &sequence_display_backlight_on); } @@ -69,6 +66,7 @@ bool infrared_scene_rpc_on_event(void* context, SceneManagerEvent event) { popup_set_text( infrared->popup, infrared->text_store[0], 89, 44, AlignCenter, AlignTop); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup); rpc_system_app_confirm(infrared->rpc_ctx, task_success); @@ -135,6 +133,5 @@ void infrared_scene_rpc_on_exit(void* context) { infrared_tx_stop(infrared); } - view_stack_remove_view(infrared->view_stack, popup_get_view(infrared->popup)); popup_reset(infrared->popup); } diff --git a/applications/services/gui/view_dispatcher.h b/applications/services/gui/view_dispatcher.h index 80cd9cbb0f8..f8567ea1ac9 100644 --- a/applications/services/gui/view_dispatcher.h +++ b/applications/services/gui/view_dispatcher.h @@ -1,6 +1,8 @@ /** * @file view_dispatcher.h - * GUI: ViewDispatcher API + * @brief GUI: ViewDispatcher API + * + * @warning Views added to a ViewDispatcher MUST NOT be in a ViewStack at the same time. */ #pragma once diff --git a/applications/services/gui/view_holder.h b/applications/services/gui/view_holder.h index e4646af9ca7..bc313a92638 100644 --- a/applications/services/gui/view_holder.h +++ b/applications/services/gui/view_holder.h @@ -1,3 +1,9 @@ +/** + * @file view_holder.h + * @brief GUI: ViewHolder API + * + * @warning View added to a ViewHolder MUST NOT be in a ViewStack at the same time. + */ #pragma once #include diff --git a/applications/services/gui/view_stack.h b/applications/services/gui/view_stack.h index ed17f682f15..7387038b0a3 100644 --- a/applications/services/gui/view_stack.h +++ b/applications/services/gui/view_stack.h @@ -1,11 +1,13 @@ /** * @file view_stack.h - * GUI: ViewStack API + * @brief GUI: ViewStack API * * ViewStack accumulates several Views in one stack. * Draw callbacks are called sequenctially starting from * first added. Input callbacks are called in reverse order. * Consumed input is not passed on underlying layers. + * + * @warning Views added to a ViewStack MUST NOT be in a ViewDispatcher or a ViewHolder at the same time. */ #pragma once diff --git a/applications/services/rpc/rpc.c b/applications/services/rpc/rpc.c index b2700c713e4..054a0286f8f 100644 --- a/applications/services/rpc/rpc.c +++ b/applications/services/rpc/rpc.c @@ -190,8 +190,6 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) { furi_assert(session); furi_assert(istream->bytes_left); - /* TODO FL-3768 this function may be called after - marking the worker for termination */ if(session->terminate) { return false; } From 558f75672f4fe38a4ee1db0c70daa7b8ed9f05c9 Mon Sep 17 00:00:00 2001 From: Astra <93453568+Astrrra@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:08:35 +0200 Subject: [PATCH 09/28] [FL-3760] NFC Parsers cosmetic fixes (#3511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * NFC Parsers cosmetic fixes * Clarify the unknown digit indication Co-authored-by: あく --- applications/main/nfc/plugins/supported_cards/myki.c | 2 +- applications/main/nfc/plugins/supported_cards/opal.c | 2 +- applications/main/nfc/plugins/supported_cards/plantain.c | 2 +- applications/main/nfc/plugins/supported_cards/two_cities.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/main/nfc/plugins/supported_cards/myki.c b/applications/main/nfc/plugins/supported_cards/myki.c index c4f1625f51e..7b541024e75 100644 --- a/applications/main/nfc/plugins/supported_cards/myki.c +++ b/applications/main/nfc/plugins/supported_cards/myki.c @@ -73,7 +73,7 @@ static bool myki_parse(const NfcDevice* device, FuriString* parsed_data) { // Stored card number doesn't include check digit card_number += myki_calculate_luhn(card_number); - furi_string_set(parsed_data, "\e#myki\n"); + furi_string_set(parsed_data, "\e#myki\nNo.: "); // Stylise card number according to the physical card char card_string[20]; diff --git a/applications/main/nfc/plugins/supported_cards/opal.c b/applications/main/nfc/plugins/supported_cards/opal.c index 15bec852b36..db9a1784ca6 100644 --- a/applications/main/nfc/plugins/supported_cards/opal.c +++ b/applications/main/nfc/plugins/supported_cards/opal.c @@ -170,7 +170,7 @@ static bool opal_parse(const NfcDevice* device, FuriString* parsed_data) { furi_string_printf( parsed_data, - "\e#Opal: $%s%ld.%02hu\n3085 22%02hhu %04hu %03hu%01hhu\n%s, %s\n", + "\e#Opal: $%s%ld.%02hu\nNo.: 3085 22%02hhu %04hu %03hu%01hhu\n%s, %s\n", sign, balance_dollars, balance_cents, diff --git a/applications/main/nfc/plugins/supported_cards/plantain.c b/applications/main/nfc/plugins/supported_cards/plantain.c index 51222840542..03fa6495a5c 100644 --- a/applications/main/nfc/plugins/supported_cards/plantain.c +++ b/applications/main/nfc/plugins/supported_cards/plantain.c @@ -192,7 +192,7 @@ static bool plantain_parse(const NfcDevice* device, FuriString* parsed_data) { } furi_string_printf( - parsed_data, "\e#Plantain\nN:%llu-\nBalance:%lu\n", card_number, balance); + parsed_data, "\e#Plantain\nNo.: %llu?\nBalance:%lu\n", card_number, balance); parsed = true; } while(false); diff --git a/applications/main/nfc/plugins/supported_cards/two_cities.c b/applications/main/nfc/plugins/supported_cards/two_cities.c index 26f42ba89a5..402e9d90a22 100644 --- a/applications/main/nfc/plugins/supported_cards/two_cities.c +++ b/applications/main/nfc/plugins/supported_cards/two_cities.c @@ -158,7 +158,7 @@ static bool two_cities_parse(const NfcDevice* device, FuriString* parsed_data) { furi_string_printf( parsed_data, - "\e#Troika+Plantain\nPN: %llu-\nPB: %lu rur.\nTN: %lu\nTB: %u rur.\n", + "\e#Troika+Plantain\nPN: %llu?\nPB: %lu rur.\nTN: %lu\nTB: %u rur.\n", card_number, balance, troika_number, From ee36c66572d07c32f96efb5074f8a066e6f12ffa Mon Sep 17 00:00:00 2001 From: hedger Date: Wed, 20 Mar 2024 20:32:53 +0400 Subject: [PATCH 10/28] fbt: `doxygen` target (#3510) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fbt: doxygen target * github: adjustments for doxygen * github: always generate docs, only upload for dev * doxygen: fixed exclusion path for awesome-css * github: stricter check for push ref * github: bumped action version to fix node.js deprecation * github: added PVS report url to workflow summary * github: pvs: reworked report URL handling * github: added size report to summary * docs: added `doxygen` target * fbt: common naming scheme for COMSTR * Documentation: fix warnings and errors * Doxygen: stricter warning checks * fbt: "doxy" target, opens generated doxygen documentation in browser * github: doxygen: now using edge (1.10) version Co-authored-by: あく --- .github/workflows/build.yml | 5 +- .github/workflows/docs.yml | 8 +- .github/workflows/pvs_studio.yml | 12 +- SConstruct | 18 +- applications/services/gui/view_holder.h | 5 +- documentation/doxygen/Doxyfile-awesome.cfg | 13 +- documentation/doxygen/Doxyfile.cfg | 600 ++++++++----- documentation/fbt.md | 1 + lib/flipper_application/flipper_application.h | 59 +- lib/flipper_format/flipper_format.h | 803 ++++++++++-------- lib/lfrfid/lfrfid_worker.h | 90 +- lib/toolbox/compress.h | 33 +- scripts/fbt/util.py | 10 + scripts/fbt_tools/doxygen.py | 40 + scripts/fbt_tools/pvsstudio.py | 2 +- site_scons/fbt_extra/util.py | 2 +- 16 files changed, 1021 insertions(+), 680 deletions(-) create mode 100644 scripts/fbt_tools/doxygen.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38b1d7b6886..252310af6dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,7 +129,7 @@ jobs: - name: 'Find previous comment' if: ${{ !github.event.pull_request.head.repo.fork && matrix.target == env.DEFAULT_TARGET && github.event.pull_request }} - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@v3 id: find-comment with: issue-number: ${{ github.event.pull_request.number }} @@ -138,7 +138,7 @@ jobs: - name: 'Create or update comment' if: ${{ !github.event.pull_request.head.repo.fork && matrix.target == env.DEFAULT_TARGET && github.event.pull_request }} - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v4 with: comment-id: ${{ steps.find-comment.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} @@ -147,6 +147,7 @@ jobs: - [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz) - [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-full-${{steps.names.outputs.suffix}}.dfu) - [☁️ Web/App updater](https://lab.flipper.net/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.branch_name}}&version=${{steps.names.outputs.commit_sha}}) + - [📊 Size report](https://fw-reports.flipp.dev/?branch=${{steps.names.outputs.branch_name}}) edit-mode: replace - name: 'SDK submission to staging catalog' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e6e53ee0160..690bcbe1972 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,6 +4,7 @@ on: push: branches: - dev + pull_request: env: TARGETS: f7 @@ -37,12 +38,17 @@ jobs: python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" - name: 'Generate documentation' - uses: mattnotmitt/doxygen-action@v1.9.8 + uses: mattnotmitt/doxygen-action@edge + env: + DOXY_SRC_ROOT: "${{ github.workspace }}" + DOXY_CONFIG_DIR: "${{ github.workspace }}/documentation/doxygen" + DOXY_OUTPUT_DIR: "${{ github.workspace }}/documentation/doxygen/build" with: working-directory: 'documentation/' doxyfile-path: './doxygen/Doxyfile-awesome.cfg' - name: 'Upload documentation' + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }} uses: jakejarvis/s3-sync-action@v0.5.1 env: AWS_S3_BUCKET: "${{ secrets.FW_DOCS_AWS_BUCKET }}" diff --git a/.github/workflows/pvs_studio.yml b/.github/workflows/pvs_studio.yml index 4527e292078..8eb6fea482b 100644 --- a/.github/workflows/pvs_studio.yml +++ b/.github/workflows/pvs_studio.yml @@ -48,6 +48,9 @@ jobs: WARNINGS=0 ./fbt COMPACT=1 PVSNOBROWSER=1 firmware_pvs || WARNINGS=1 echo "warnings=${WARNINGS}" >> $GITHUB_OUTPUT + if [[ $WARNINGS -ne 0 ]]; then + echo "report-url=https://pvs.flipp.dev/${{steps.names.outputs.branch_name}}/${{steps.names.outputs.default_target}}-${{steps.names.outputs.suffix}}/index.html" >> $GITHUB_OUTPUT + fi - name: 'Upload report' if: ${{ !github.event.pull_request.head.repo.fork && (steps.pvs-warn.outputs.warnings != 0) }} @@ -62,7 +65,7 @@ jobs: - name: 'Find Previous Comment' if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request && (steps.pvs-warn.outputs.warnings != 0) }} - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@v3 id: fc with: issue-number: ${{ github.event.pull_request.number }} @@ -71,18 +74,19 @@ jobs: - name: 'Create or update comment' if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request && (steps.pvs-warn.outputs.warnings != 0) }} - uses: peter-evans/create-or-update-comment@v1 + uses: peter-evans/create-or-update-comment@v4 with: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | **PVS-Studio report for commit `${{steps.names.outputs.commit_sha}}`:** - - [Report](https://pvs.flipp.dev/${{steps.names.outputs.branch_name}}/${{steps.names.outputs.default_target}}-${{steps.names.outputs.suffix}}/index.html) + - [Report](${{ steps.pvs-warn.outputs.report-url }}) edit-mode: replace - name: 'Raise exception' if: ${{ steps.pvs-warn.outputs.warnings != 0 }} run: | echo "Please fix all PVS warnings before merge" + echo "Report: ${{ steps.pvs-warn.outputs.report-url }}" + echo "[PVS report](${{ steps.pvs-warn.outputs.report-url }})" >> $GITHUB_STEP_SUMMARY exit 1 - diff --git a/SConstruct b/SConstruct index 2bc0128ccc5..26505fe8cae 100644 --- a/SConstruct +++ b/SConstruct @@ -7,7 +7,7 @@ # construction of certain targets behind command-line options. import os -from fbt.util import path_as_posix +from fbt.util import path_as_posix, open_browser_action DefaultEnvironment(tools=[]) @@ -42,6 +42,7 @@ distenv = coreenv.Clone( "openocd", "blackmagic", "jflash", + "doxygen", ], ENV=os.environ, UPDATE_BUNDLE_DIR="dist/${DIST_DIR}/f${TARGET_HW}-update-${DIST_SUFFIX}", @@ -419,3 +420,18 @@ distenv.PhonyTarget( "env", "@echo $( ${FBT_SCRIPT_DIR.abspath}/toolchain/fbtenv.sh $)", ) + +doxy_build = distenv.DoxyBuild( + "documentation/doxygen/build/html/index.html", + "documentation/doxygen/Doxyfile-awesome.cfg", + doxy_env_variables={ + "DOXY_SRC_ROOT": Dir(".").abspath, + "DOXY_BUILD_DIR": Dir("documentation/doxygen/build").abspath, + "DOXY_CONFIG_DIR": "documentation/doxygen", + }, +) +distenv.Alias("doxygen", doxy_build) +distenv.AlwaysBuild(doxy_build) + +# Open generated documentation in browser +distenv.PhonyTarget("doxy", open_browser_action, source=doxy_build) diff --git a/applications/services/gui/view_holder.h b/applications/services/gui/view_holder.h index bc313a92638..90ce82b3778 100644 --- a/applications/services/gui/view_holder.h +++ b/applications/services/gui/view_holder.h @@ -94,8 +94,9 @@ void view_holder_start(ViewHolder* view_holder); void view_holder_stop(ViewHolder* view_holder); /** View Update Handler - * @param view, View Instance - * @param context, ViewHolder instance + * + * @param view View Instance + * @param context ViewHolder instance */ void view_holder_update(View* view, void* context); diff --git a/documentation/doxygen/Doxyfile-awesome.cfg b/documentation/doxygen/Doxyfile-awesome.cfg index e4c4c95cd70..b289055dd56 100644 --- a/documentation/doxygen/Doxyfile-awesome.cfg +++ b/documentation/doxygen/Doxyfile-awesome.cfg @@ -1,11 +1,10 @@ -@INCLUDE = doxygen/Doxyfile.cfg +@INCLUDE = $(DOXY_CONFIG_DIR)/Doxyfile.cfg GENERATE_TREEVIEW = YES # required! DISABLE_INDEX = NO FULL_SIDEBAR = NO -HTML_EXTRA_STYLESHEET = doxygen/doxygen-awesome-css/doxygen-awesome.css \ - doxygen/doxygen-awesome-css/doxygen-awesome-sidebar-only.css \ - doxygen/doxygen-awesome-css/doxygen-awesome-sidebar-only-darkmode-toggle.css +HTML_EXTRA_STYLESHEET = $(DOXY_CONFIG_DIR)/doxygen-awesome-css/doxygen-awesome.css \ + $(DOXY_CONFIG_DIR)/doxygen-awesome-css/doxygen-awesome-sidebar-only.css \ + $(DOXY_CONFIG_DIR)/doxygen-awesome-css/doxygen-awesome-sidebar-only-darkmode-toggle.css HTML_COLORSTYLE = LIGHT # required with Doxygen >= 1.9.5 -HTML_HEADER = doxygen/header.html -HTML_EXTRA_FILES = doxygen/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js - +HTML_HEADER = $(DOXY_CONFIG_DIR)/header.html +HTML_EXTRA_FILES = $(DOXY_CONFIG_DIR)/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js diff --git a/documentation/doxygen/Doxyfile.cfg b/documentation/doxygen/Doxyfile.cfg index 28ac19e0294..2596d161f48 100644 --- a/documentation/doxygen/Doxyfile.cfg +++ b/documentation/doxygen/Doxyfile.cfg @@ -1,4 +1,4 @@ -# Doxyfile 1.9.2 +# Doxyfile 1.10.0 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,6 +12,16 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options @@ -51,30 +61,43 @@ PROJECT_BRIEF = # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = doxygen/logo.png +PROJECT_LOGO = $(DOXY_CONFIG_DIR)/logo.png # With the PROJECT_ICON tag one can specify an icon that is included in the tabs -# when the HTML document is shown. Doxygen will copy the logo to the output directory. +# when the HTML document is shown. Doxygen will copy the logo to the output +# directory. -PROJECT_ICON = doxygen/favicon.ico +PROJECT_ICON = $(DOXY_CONFIG_DIR)/favicon.ico # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = doxygen/build +OUTPUT_DIRECTORY = $(DOXY_CONFIG_DIR)/build -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -86,14 +109,14 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English @@ -167,7 +190,7 @@ FULL_PATH_NAMES = NO # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = +STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -176,7 +199,7 @@ STRIP_FROM_PATH = # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't @@ -346,13 +369,24 @@ MARKDOWN_SUPPORT = YES TOC_INCLUDE_HEADINGS = 5 +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0 and GITHUB use the lower case version of title +# with any whitespace replaced by '-' and punctuation characters removed. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. -AUTOLINK_SUPPORT = NO +AUTOLINK_SUPPORT = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this @@ -457,7 +491,7 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 -# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use # during processing. When set to 0 doxygen will based this on the number of # cores available in the system. You can set it explicitly to a value larger # than 0 to get more control over the balance between CPU load and processing @@ -470,6 +504,14 @@ LOOKUP_CACHE_SIZE = 0 NUM_PROC_THREADS = 4 +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -551,7 +593,8 @@ HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO @@ -582,14 +625,15 @@ INTERNAL_DOCS = NO # filesystem is case sensitive (i.e. it supports files in the same directory # whose names only differ in casing), the option must be set to YES to properly # deal with such files in case they appear in the input. For filesystems that -# are not case sensitive the option should be be set to NO to properly deal with +# are not case sensitive the option should be set to NO to properly deal with # output files written for symbols that only differ in casing, such as for two # classes, one named CLASS and the other named Class, and to also support # references to files without having to specify the exact matching casing. On # Windows (including Cygwin) and MacOS, users should typically set this option # to NO, whereas on Linux or other Unix flavors it should typically be set to # YES. -# The default value is: system dependent. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. CASE_SENSE_NAMES = NO @@ -798,7 +842,7 @@ CITE_BIB_FILES = # messages are off. # The default value is: NO. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES @@ -814,7 +858,7 @@ WARNINGS = YES # will automatically be disabled. # The default value is: YES. -WARN_IF_UNDOCUMENTED = YES +WARN_IF_UNDOCUMENTED = NO # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as documenting some parameters in @@ -839,16 +883,31 @@ WARN_IF_INCOMPLETE_DOC = YES # WARN_IF_INCOMPLETE_DOC # The default value is: NO. -WARN_NO_PARAMDOC = NO +WARN_NO_PARAMDOC = YES + +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS # then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but # at the end of the doxygen process doxygen will return with a non-zero status. -# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. # The default value is: NO. -WARN_AS_ERROR = NO +WARN_AS_ERROR = FAIL_ON_WARNINGS # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which @@ -856,13 +915,27 @@ WARN_AS_ERROR = NO # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = @@ -876,23 +949,34 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../applications \ - ../documentation \ - ../targets \ - ../assets \ - ../lib \ - ../furi \ - ../.vscode \ +INPUT = $(DOXY_SRC_ROOT)/applications \ + $(DOXY_SRC_ROOT)/documentation \ + $(DOXY_SRC_ROOT)/targets \ + $(DOXY_SRC_ROOT)/assets \ + $(DOXY_SRC_ROOT)/lib \ + $(DOXY_SRC_ROOT)/furi \ + $(DOXY_SRC_ROOT)/.vscode # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: # https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -904,12 +988,12 @@ INPUT_ENCODING = UTF-8 # Note the list of default checked file patterns might differ from the list of # default file extension mappings. # -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, -# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C -# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, -# *.vhdl, *.ucf, *.qsf and *.ice. +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm, +# *.cpp, *.cppm, *.ccm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, +# *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d, +# *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to +# be provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.c \ *.cc \ @@ -937,47 +1021,45 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = \ - ../lib/mlib \ - ../lib/STM32CubeWB \ - ../lib/littlefs \ - ../lib/nanopb \ - ../assets/protobuf \ - ../lib/libusb_stm32 \ - ../lib/FreeRTOS-Kernel \ - ../lib/microtar \ - ../lib/mbedtls \ - ../lib/cxxheaderparser \ - ../lib/ST25RFAL002 \ - ../lib/fatfs \ - ../lib/mlib \ - ../lib/stm32wb_cmsis \ - ../lib/stm32wb_copro \ - ../lib/stm32wb_hal_driver \ - ../lib/stm32wb_hal \ - ../lib/cmsis_core \ - ../targets/f7/fatfs/ \ - ../applications/plugins/dap_link/lib/free-dap \ - ../applications/debug \ - ../applications/main \ - ../applications/settings \ - ../lib/micro-ecc \ - ../lib/ReadMe.md \ - ../lib/callback-connector \ - ../lib/app-scened-template \ - ../applications/ReadMe.md \ - ../targets/ReadMe.md \ - ../web \ - ../assets/protobuf \ - ../lib/libusb_stm32 \ - ../lib/FreeRTOS-Kernel \ - ../lib/microtar \ - ../lib/mbedtls \ - ../lib/cxxheaderparser \ - ../applications/external/dap_link/lib/free-dap \ - ../lib/heatshrink \ - ./doxygen/doxygen-awesome-css - +EXCLUDE = $(DOXY_SRC_ROOT)/lib/mlib \ + $(DOXY_SRC_ROOT)/lib/STM32CubeWB \ + $(DOXY_SRC_ROOT)/lib/littlefs \ + $(DOXY_SRC_ROOT)/lib/nanopb \ + $(DOXY_SRC_ROOT)/assets/protobuf \ + $(DOXY_SRC_ROOT)/lib/libusb_stm32 \ + $(DOXY_SRC_ROOT)/lib/FreeRTOS-Kernel \ + $(DOXY_SRC_ROOT)/lib/microtar \ + $(DOXY_SRC_ROOT)/lib/mbedtls \ + $(DOXY_SRC_ROOT)/lib/cxxheaderparser \ + $(DOXY_SRC_ROOT)/lib/ST25RFAL002 \ + $(DOXY_SRC_ROOT)/lib/fatfs \ + $(DOXY_SRC_ROOT)/lib/mlib \ + $(DOXY_SRC_ROOT)/lib/stm32wb_cmsis \ + $(DOXY_SRC_ROOT)/lib/stm32wb_copro \ + $(DOXY_SRC_ROOT)/lib/stm32wb_hal_driver \ + $(DOXY_SRC_ROOT)/lib/stm32wb_hal \ + $(DOXY_SRC_ROOT)/lib/cmsis_core \ + $(DOXY_SRC_ROOT)/targets/f7/fatfs/ \ + $(DOXY_SRC_ROOT)/applications/plugins/dap_link/lib/free-dap \ + $(DOXY_SRC_ROOT)/applications/debug \ + $(DOXY_SRC_ROOT)/applications/main \ + $(DOXY_SRC_ROOT)/applications/settings \ + $(DOXY_SRC_ROOT)/lib/micro-ecc \ + $(DOXY_SRC_ROOT)/lib/ReadMe.md \ + $(DOXY_SRC_ROOT)/lib/callback-connector \ + $(DOXY_SRC_ROOT)/lib/app-scened-template \ + $(DOXY_SRC_ROOT)/applications/ReadMe.md \ + $(DOXY_SRC_ROOT)/targets/ReadMe.md \ + $(DOXY_SRC_ROOT)/web \ + $(DOXY_SRC_ROOT)/assets/protobuf \ + $(DOXY_SRC_ROOT)/lib/libusb_stm32 \ + $(DOXY_SRC_ROOT)/lib/FreeRTOS-Kernel \ + $(DOXY_SRC_ROOT)/lib/microtar \ + $(DOXY_SRC_ROOT)/lib/mbedtls \ + $(DOXY_SRC_ROOT)/lib/cxxheaderparser \ + $(DOXY_SRC_ROOT)/applications/external/dap_link/lib/free-dap \ + $(DOXY_SRC_ROOT)/lib/heatshrink \ + $(DOXY_CONFIG_DIR)/doxygen-awesome-css # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -999,10 +1081,7 @@ EXCLUDE_PATTERNS = # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* +# ANamespace::AClass, ANamespace::*Test EXCLUDE_SYMBOLS = @@ -1047,6 +1126,11 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -1088,6 +1172,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -1102,7 +1195,8 @@ USE_MDFILE_AS_MAINPAGE = SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. +# multi-line macros, enums or list initialized variables directly into the +# documentation. # The default value is: NO. INLINE_SOURCES = NO @@ -1185,10 +1279,11 @@ VERBATIM_HEADERS = YES ALPHABETICAL_INDEX = YES -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = @@ -1267,7 +1362,12 @@ HTML_STYLESHEET = # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = @@ -1282,6 +1382,19 @@ HTML_EXTRA_STYLESHEET = HTML_EXTRA_FILES = +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a color-wheel, see @@ -1312,15 +1425,6 @@ HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that # are dynamically created via JavaScript. If disabled, the navigation index will @@ -1340,6 +1444,33 @@ HTML_DYNAMIC_MENUS = YES HTML_DYNAMIC_SECTIONS = NO +# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be +# dynamically folded and expanded in the generated HTML source code. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_CODE_FOLDING = YES + +# If the HTML_COPY_CLIPBOARD tag is set to YES then doxygen will show an icon in +# the top right corner of code and text fragments that allows the user to copy +# its content to the clipboard. Note this only works if supported by the browser +# and the web page is served via a secure context (see: +# https://www.w3.org/TR/secure-contexts/), i.e. using the https: or file: +# protocol. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COPY_CLIPBOARD = YES + +# Doxygen stores a couple of settings persistently in the browser (via e.g. +# cookies). By default these settings apply to all HTML pages generated by +# doxygen across all projects. The HTML_PROJECT_COOKIE tag can be used to store +# the settings under a project specific key, such that the user preferences will +# be stored separately. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_PROJECT_COOKIE = + # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to @@ -1376,6 +1507,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1463,6 +1601,16 @@ BINARY_TOC = NO TOC_EXPAND = NO +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help @@ -1580,7 +1728,7 @@ GENERATE_TREEVIEW = NO # area (value NO) or if it should extend to the full height of the window (value # YES). Setting this to YES gives a layout similar to # https://docs.readthedocs.io with more room for contents, but less room for the -# project logo, title, and description. If either GENERATOR_TREEVIEW or +# project logo, title, and description. If either GENERATE_TREEVIEW or # DISABLE_INDEX is set to NO, this option has no effect. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1611,6 +1759,13 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for @@ -1631,17 +1786,6 @@ HTML_FORMULA_FORMAT = png FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See # the section "Including formulas" for details. @@ -1703,8 +1847,8 @@ MATHJAX_RELPATH = # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example -# for MathJax version 2 (see https://docs.mathjax.org/en/v2.7-latest/tex.html -# #tex-and-latex-extensions): +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # For example for MathJax version 3 (see # http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): @@ -1955,9 +2099,16 @@ PDF_HYPERLINKS = YES USE_PDFLATEX = YES -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode -# command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. +# The LATEX_BATCHMODE tag signals the behavior of LaTeX in case of an error. +# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch +# mode nothing is printed on the terminal, errors are scrolled as if is +# hit at every error; missing files that TeX tries to input or request from +# keyboard input (\read on a not open input stream) cause the job to abort, +# NON_STOP In nonstop mode the diagnostic message will appear on the terminal, +# but there is no possibility of user interaction just like in batch mode, +# SCROLL In scroll mode, TeX will stop only for missing files to input or if +# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at +# each error, asking for user intervention. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1978,14 +2129,6 @@ LATEX_HIDE_INDICES = NO LATEX_BIB_STYLE = plain -# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_TIMESTAMP = NO - # The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) # path from which the emoji images will be read. If a relative path is entered, # it will be relative to the LATEX_OUTPUT directory. If left blank the @@ -2151,13 +2294,39 @@ DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to Sqlite3 output +#--------------------------------------------------------------------------- + +# If the GENERATE_SQLITE3 tag is set to YES doxygen will generate a Sqlite3 +# database with symbols found by doxygen stored in tables. +# The default value is: NO. + +GENERATE_SQLITE3 = NO + +# The SQLITE3_OUTPUT tag is used to specify where the Sqlite3 database will be +# put. If a relative path is entered the value of OUTPUT_DIRECTORY will be put +# in front of it. +# The default directory is: sqlite3. +# This tag requires that the tag GENERATE_SQLITE3 is set to YES. + +SQLITE3_OUTPUT = sqlite3 + +# The SQLITE3_RECREATE_DB tag is set to YES, the existing doxygen_sqlite3.db +# database file will be recreated with each doxygen run. If set to NO, doxygen +# will warn if a database file is already found and not modify it. +# The default value is: YES. +# This tag requires that the tag GENERATE_SQLITE3 is set to YES. + +SQLITE3_RECREATE_DB = YES + #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- @@ -2232,7 +2401,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2299,15 +2469,15 @@ TAGFILES = GENERATE_TAGFILE = -# If the ALLEXTERNALS tag is set to YES, all external class will be listed in -# the class index. If set to NO, only the inherited external classes will be -# listed. +# If the ALLEXTERNALS tag is set to YES, all external classes and namespaces +# will be listed in the class and namespace index. If set to NO, only the +# inherited external classes will be listed. # The default value is: NO. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will be +# in the topic index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. @@ -2321,25 +2491,9 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to diagram generator tools #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - -# You can include diagrams made with dia in doxygen documentation. Doxygen will -# then run dia to produce the diagram and insert it in the documentation. The -# DIA_PATH tag allows you to specify the directory where the dia binary resides. -# If left empty dia is assumed to be found in the default search path. - -DIA_PATH = - # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. @@ -2348,7 +2502,7 @@ HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. @@ -2365,49 +2519,77 @@ HAVE_DOT = NO DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTNAME = Helvetica +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_FONTSIZE = 10 +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" + +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will +# generate a graph for each documented class showing the direct and indirect +# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and +# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case +# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the +# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used. +# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance +# relations will be shown as texts / links. Explicit enabling an inheritance +# graph or choosing a different representation for an inheritance graph of a +# specific class, can be accomplished by means of the command \inheritancegraph. +# Disabling an inheritance graph can be accomplished by means of the command +# \hideinheritancegraph. +# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation # dependencies (inheritance, containment, and class references variables) of the -# class with other documented classes. +# class with other documented classes. Explicit enabling a collaboration graph, +# when COLLABORATION_GRAPH is set to NO, can be accomplished by means of the +# command \collaborationgraph. Disabling a collaboration graph can be +# accomplished by means of the command \hidecollaborationgraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. Explicit enabling a group +# dependency graph, when GROUP_GRAPHS is set to NO, can be accomplished by means +# of the command \groupgraph. Disabling a directory graph can be accomplished by +# means of the command \hidegroupgraph. See also the chapter Grouping in the +# manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2449,8 +2631,8 @@ DOT_UML_DETAILS = NO # The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters # to display on a single line. If the actual line length exceeds this threshold -# significantly it will wrapped across multiple lines. Some heuristics are apply -# to avoid ugly line breaks. +# significantly it will be wrapped across multiple lines. Some heuristics are +# applied to avoid ugly line breaks. # Minimum value: 0, maximum value: 1000, default value: 17. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2467,7 +2649,9 @@ TEMPLATE_RELATIONS = NO # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the # direct and indirect include dependencies of the file with other documented -# files. +# files. Explicit enabling an include graph, when INCLUDE_GRAPH is is set to NO, +# can be accomplished by means of the command \includegraph. Disabling an +# include graph can be accomplished by means of the command \hideincludegraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2476,7 +2660,10 @@ INCLUDE_GRAPH = YES # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other documented -# files. +# files. Explicit enabling an included by graph, when INCLUDED_BY_GRAPH is set +# to NO, can be accomplished by means of the command \includedbygraph. Disabling +# an included by graph can be accomplished by means of the command +# \hideincludedbygraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2516,16 +2703,26 @@ GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The # dependency relations are determined by the #include relations between the -# files in the directories. +# files in the directories. Explicit enabling a directory graph, when +# DIRECTORY_GRAPH is set to NO, can be accomplished by means of the command +# \directorygraph. Disabling a directory graph can be accomplished by means of +# the command \hidedirectorygraph. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). +# https://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). @@ -2562,11 +2759,12 @@ DOT_PATH = DOTFILE_DIRS = -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the \mscfile -# command). +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. -MSCFILE_DIRS = +DIA_PATH = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile @@ -2575,10 +2773,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2616,18 +2814,6 @@ DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support @@ -2640,6 +2826,8 @@ DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2653,3 +2841,19 @@ GENERATE_LEGEND = YES # The default value is: YES. DOT_CLEANUP = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will +# use a built-in version of mscgen tool to produce the charts. Alternatively, +# the MSCGEN_TOOL tag can also specify the name an external tool. For instance, +# specifying prog as the value, doxygen will call the tool as prog -T +# -o . The external tool should support +# output file formats "png", "eps", "svg", and "ismap". + +MSCGEN_TOOL = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = diff --git a/documentation/fbt.md b/documentation/fbt.md index a7df5615b91..8e083349f7d 100644 --- a/documentation/fbt.md +++ b/documentation/fbt.md @@ -79,6 +79,7 @@ To use language servers other than the default VS Code C/C++ language server, us - `lint`, `format` - run clang-format on the C source code to check and reformat it according to the `.clang-format` specs. Supports `ARGS="..."` to pass extra arguments to clang-format. - `lint_py`, `format_py` - run [black](https://black.readthedocs.io/en/stable/index.html) on the Python source code, build system files & application manifests. Supports `ARGS="..."` to pass extra arguments to black. - `firmware_pvs` - generate a PVS Studio report for the firmware. Requires PVS Studio to be available on your system's `PATH`. +- `doxygen` - generate Doxygen documentation for the firmware. `doxy` target also opens web browser to view the generated documentation. - `cli` - start a Flipper CLI session over USB. ### Firmware targets diff --git a/lib/flipper_application/flipper_application.h b/lib/flipper_application/flipper_application.h index a119cf530de..3daca5bc0b4 100644 --- a/lib/flipper_application/flipper_application.h +++ b/lib/flipper_application/flipper_application.h @@ -33,15 +33,13 @@ typedef enum { FlipperApplicationLoadStatusMissingImports, } FlipperApplicationLoadStatus; -/** - * @brief Get text description of preload status +/** Get text description of preload status * @param status Status code * @return String pointer to description */ const char* flipper_application_preload_status_to_string(FlipperApplicationPreloadStatus status); -/** - * @brief Get text description of load status +/** Get text description of load status * @param status Status code * @return String pointer to description */ @@ -61,8 +59,7 @@ typedef struct { uint8_t* debug_link; } FlipperApplicationState; -/** - * @brief Initialize FlipperApplication object +/** Initialize FlipperApplication object * @param storage Storage instance * @param api_interface ELF API interface to use for pre-loading and symbol resolving * @return Application instance @@ -70,44 +67,44 @@ typedef struct { FlipperApplication* flipper_application_alloc(Storage* storage, const ElfApiInterface* api_interface); -/** - * @brief Destroy FlipperApplication object +/** Destroy FlipperApplication object * @param app Application pointer */ void flipper_application_free(FlipperApplication* app); -/** - * @brief Validate elf file and load application metadata - * @param app Application pointer - * @return Preload result code +/** Validate elf file and load application metadata + * + * @param app Application pointer + * @param[in] path The path to fap file + * + * @return Preload result code */ FlipperApplicationPreloadStatus flipper_application_preload(FlipperApplication* app, const char* path); -/** - * @brief Validate elf file and load application manifest - * @param app Application pointer - * @return Preload result code +/** Validate elf file and load application manifest + * + * @param app Application pointer + * @param[in] path The path to fap file + * + * @return Preload result code */ FlipperApplicationPreloadStatus flipper_application_preload_manifest(FlipperApplication* app, const char* path); -/** - * @brief Get pointer to application manifest for preloaded application +/** Get pointer to application manifest for preloaded application * @param app Application pointer * @return Pointer to application manifest */ const FlipperApplicationManifest* flipper_application_get_manifest(FlipperApplication* app); -/** - * @brief Load sections and process relocations for already pre-loaded application +/** Load sections and process relocations for already pre-loaded application * @param app Application pointer * @return Load result code */ FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplication* app); -/** - * @brief Allocate application thread at entry point address, using app name and +/** Allocate application thread at entry point address, using app name and * stack size from metadata. Returned thread isn't started yet. * Can be only called once for application instance. * @param app Applicaiton pointer @@ -116,20 +113,17 @@ FlipperApplicationLoadStatus flipper_application_map_to_memory(FlipperApplicatio */ FuriThread* flipper_application_alloc_thread(FlipperApplication* app, const char* args); -/** - * @brief Check if application is a plugin (not a runnable standalone app) +/** Check if application is a plugin (not a runnable standalone app) * @param app Application pointer * @return true if application is a plugin, false otherwise */ bool flipper_application_is_plugin(FlipperApplication* app); -/** - * @brief Entry point prototype for standalone applications +/** Entry point prototype for standalone applications */ typedef int32_t (*FlipperApplicationEntryPoint)(void*); -/** - * @brief An object that describes a plugin - must be returned by plugin's entry point +/** An object that describes a plugin - must be returned by plugin's entry point */ typedef struct { const char* appid; @@ -137,21 +131,18 @@ typedef struct { const void* entry_point; } FlipperAppPluginDescriptor; -/** - * @brief Entry point prototype for plugins +/** Entry point prototype for plugins */ typedef const FlipperAppPluginDescriptor* (*FlipperApplicationPluginEntryPoint)(void); -/** - * @brief Get plugin descriptor for preloaded plugin +/** Get plugin descriptor for preloaded plugin * @param app Application pointer * @return Pointer to plugin descriptor */ const FlipperAppPluginDescriptor* flipper_application_plugin_get_descriptor(FlipperApplication* app); -/** - * @brief Load name and icon from FAP file. +/** Load name and icon from FAP file. * * @param path Path to FAP file. * @param storage Storage instance. diff --git a/lib/flipper_format/flipper_format.h b/lib/flipper_format/flipper_format.h index c8f5278ed78..46f78e25549 100644 --- a/lib/flipper_format/flipper_format.h +++ b/lib/flipper_format/flipper_format.h @@ -1,20 +1,20 @@ -/** - * @file flipper_format.h - * Flipper File Format helper library. - * +/** @file flipper_format.h Flipper File Format helper library. + * * Flipper File Format is a fairly simple format for storing data in a file. - * + * * Flipper file structure: - * + * * ~~~~~~~~~~~~~~~~~~~~~ * # Commentary * Field name: field value * ~~~~~~~~~~~~~~~~~~~~~ - * - * Lines starting with the # character are ignored (considered as comments). The separator between the name of the value and the value itself is the string ": ". + * + * Lines starting with the # character are ignored (considered as comments). The + * separator between the name of the value and the value itself is the string + * ": ". * * Currently supported types: - * + * * ~~~~~~~~~~~~~~~~~~~~~ * String: text * Int32: 1 2 -3 4 @@ -22,13 +22,15 @@ * Float: 1.0 1234.654 * Hex: A4 B3 C2 D1 12 FF * ~~~~~~~~~~~~~~~~~~~~~ - * + * * End of line is LF when writing, but CR is supported when reading. - * - * The library is designed in such a way that comments and field values are completely ignored when searching for keys, that is, they do not consume memory. - * - * File example: - * + * + * The library is designed in such a way that comments and field values are + * completely ignored when searching for keys, that is, they do not consume + * memory. + * + * File example: + * * ~~~~~~~~~~~~~~~~~~~~~ * Filetype: Flipper Test File * Version: 1 @@ -37,59 +39,49 @@ * UINT: 1234 * Hex: 00 01 FF A3 * ~~~~~~~~~~~~~~~~~~~~~ - * + * * Writing: - * + * * ~~~~~~~~~~~~~~~~~~~~~ * FlipperFormat* format = flipper_format_file_alloc(storage); - * - * do { - * const uint32_t version = 1; - * const char* string_value = "String value"; - * const uint32_t uint32_value = 1234; - * const uint16_t array_size = 4; - * const uint8_t* array[array_size] = {0x00, 0x01, 0xFF, 0xA3}; - * - * if(!flipper_format_file_open_new(format, EXT_PATH("flipper_format_test"))) break; - * if(!flipper_format_write_header_cstr(format, "Flipper Test File", version)) break; - * if(!flipper_format_write_comment_cstr(format, "Just test file")) break; - * if(!flipper_format_write_string_cstr(format, "String", string_value)) break; - * if(!flipper_format_write_uint32(format, "UINT", &uint32_value, 1)) break; - * if(!flipper_format_write_hex(format, "Hex Array", array, array_size)) break; - * - * // signal that the file was written successfully - * } while(0); - * + * + * do { const uint32_t version = 1; const char* string_value = "String value"; + * const uint32_t uint32_value = 1234; const uint16_t array_size = 4; const + * uint8_t* array[array_size] = {0x00, 0x01, 0xFF, 0xA3}; + * + * if(!flipper_format_file_open_new(format, EXT_PATH("flipper_format_test"))) + * break; if(!flipper_format_write_header_cstr(format, "Flipper Test File", + * version)) break; if(!flipper_format_write_comment_cstr(format, + * "Just test file")) break; if(!flipper_format_write_string_cstr(format, + * "String", string_value)) break; if(!flipper_format_write_uint32(format, + * "UINT", &uint32_value, 1)) break; if(!flipper_format_write_hex(format, + * "Hex Array", array, array_size)) break; + * + * // signal that the file was written successfully } while(0); + * * flipper_format_free(file); * ~~~~~~~~~~~~~~~~~~~~~ - * + * * Reading: - * + * * ~~~~~~~~~~~~~~~~~~~~~ * FlipperFormat* file = flipper_format_file_alloc(storage); - * - * do { - * uint32_t version = 1; - * FuriString* file_type; - * FuriString* string_value; - * uint32_t uint32_value = 1; - * uint16_t array_size = 4; - * uint8_t* array[array_size] = {0}; - * file_type = furi_string_alloc(); - * string_value = furi_string_alloc(); - * - * if(!flipper_format_file_open_existing(file, EXT_PATH("flipper_format_test"))) break; - * if(!flipper_format_read_header(file, file_type, &version)) break; - * if(!flipper_format_read_string(file, "String", string_value)) break; - * if(!flipper_format_read_uint32(file, "UINT", &uint32_value, 1)) break; - * if(!flipper_format_read_hex(file, "Hex Array", array, array_size)) break; - * - * // signal that the file was read successfully - * } while(0); - * + * + * do { uint32_t version = 1; FuriString* file_type; FuriString* string_value; + * uint32_t uint32_value = 1; uint16_t array_size = 4; uint8_t* + * array[array_size] = {0}; file_type = furi_string_alloc(); string_value = + * furi_string_alloc(); + * + * if(!flipper_format_file_open_existing(file, EXT_PATH("flipper_format_test"))) + * break; if(!flipper_format_read_header(file, file_type, &version)) break; + * if(!flipper_format_read_string(file, "String", string_value)) break; + * if(!flipper_format_read_uint32(file, "UINT", &uint32_value, 1)) break; + * if(!flipper_format_read_hex(file, "Hex Array", array, array_size)) break; + * + * // signal that the file was read successfully } while(0); + * * flipper_format_free(file); * ~~~~~~~~~~~~~~~~~~~~~ - * */ #pragma once @@ -102,215 +94,240 @@ extern "C" { typedef struct FlipperFormat FlipperFormat; -/** - * Allocate FlipperFormat as string. - * @return FlipperFormat* pointer to a FlipperFormat instance +/** Allocate FlipperFormat as string. + * + * @return FlipperFormat* pointer to a FlipperFormat instance */ FlipperFormat* flipper_format_string_alloc(void); -/** - * Allocate FlipperFormat as file. - * @return FlipperFormat* pointer to a FlipperFormat instance +/** Allocate FlipperFormat as file. + * + * @param storage The storage + * + * @return FlipperFormat* pointer to a FlipperFormat instance */ FlipperFormat* flipper_format_file_alloc(Storage* storage); -/** - * Allocate FlipperFormat as file, buffered mode. - * @return FlipperFormat* pointer to a FlipperFormat instance +/** Allocate FlipperFormat as file, buffered mode. + * + * @param storage The storage + * + * @return FlipperFormat* pointer to a FlipperFormat instance */ FlipperFormat* flipper_format_buffered_file_alloc(Storage* storage); -/** - * Open existing file. - * Use only if FlipperFormat allocated as a file. - * @param flipper_format Pointer to a FlipperFormat instance - * @param path File path - * @return True on success +/** Open existing file. Use only if FlipperFormat allocated as a file. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param path File path + * + * @return True on success */ bool flipper_format_file_open_existing(FlipperFormat* flipper_format, const char* path); -/** - * Open existing file, buffered mode. - * Use only if FlipperFormat allocated as a buffered file. - * @param flipper_format Pointer to a FlipperFormat instance - * @param path File path - * @return True on success +/** Open existing file, buffered mode. Use only if FlipperFormat allocated as a + * buffered file. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param path File path + * + * @return True on success */ bool flipper_format_buffered_file_open_existing(FlipperFormat* flipper_format, const char* path); -/** - * Open existing file for writing and add values to the end of file. - * Use only if FlipperFormat allocated as a file. - * @param flipper_format Pointer to a FlipperFormat instance - * @param path File path - * @return True on success +/** Open existing file for writing and add values to the end of file. Use only if + * FlipperFormat allocated as a file. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param path File path + * + * @return True on success */ bool flipper_format_file_open_append(FlipperFormat* flipper_format, const char* path); -/** - * Open file. Creates a new file, or deletes the contents of the file if it already exists. - * Use only if FlipperFormat allocated as a file. - * @param flipper_format Pointer to a FlipperFormat instance - * @param path File path - * @return True on success +/** Open file. Creates a new file, or deletes the contents of the file if it + * already exists. Use only if FlipperFormat allocated as a file. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param path File path + * + * @return True on success */ bool flipper_format_file_open_always(FlipperFormat* flipper_format, const char* path); -/** - * Open file. Creates a new file, or deletes the contents of the file if it already exists, buffered mode. - * Use only if FlipperFormat allocated as a buffered file. - * @param flipper_format Pointer to a FlipperFormat instance - * @param path File path - * @return True on success +/** Open file. Creates a new file, or deletes the contents of the file if it + * already exists, buffered mode. Use only if FlipperFormat allocated as a + * buffered file. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param path File path + * + * @return True on success */ bool flipper_format_buffered_file_open_always(FlipperFormat* flipper_format, const char* path); -/** - * Open file. Creates a new file, fails if file already exists. - * Use only if FlipperFormat allocated as a file. - * @param flipper_format Pointer to a FlipperFormat instance - * @param path File path - * @return True on success +/** Open file. Creates a new file, fails if file already exists. Use only if + * FlipperFormat allocated as a file. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param path File path + * + * @return True on success */ bool flipper_format_file_open_new(FlipperFormat* flipper_format, const char* path); -/** - * Closes the file, use only if FlipperFormat allocated as a file. - * @param flipper_format - * @return true - * @return false +/** Closes the file, use only if FlipperFormat allocated as a file. + * + * @param flipper_format The flipper format + * + * @return true + * @return false */ bool flipper_format_file_close(FlipperFormat* flipper_format); -/** - * Closes the file, use only if FlipperFormat allocated as a buffered file. - * @param flipper_format - * @return true - * @return false +/** Closes the file, use only if FlipperFormat allocated as a buffered file. + * + * @param flipper_format The flipper format + * + * @return true + * @return false */ bool flipper_format_buffered_file_close(FlipperFormat* flipper_format); -/** - * Free FlipperFormat. - * @param flipper_format Pointer to a FlipperFormat instance +/** Free FlipperFormat. + * + * @param flipper_format Pointer to a FlipperFormat instance */ void flipper_format_free(FlipperFormat* flipper_format); -/** - * Set FlipperFormat mode. - * @param flipper_format Pointer to a FlipperFormat instance - * @param strict_mode True obligates not to skip valid fields. False by default. +/** Set FlipperFormat mode. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param strict_mode True obligates not to skip valid fields. False by + * default. */ void flipper_format_set_strict_mode(FlipperFormat* flipper_format, bool strict_mode); -/** - * Rewind the RW pointer. - * @param flipper_format Pointer to a FlipperFormat instance - * @return True on success +/** Rewind the RW pointer. + * + * @param flipper_format Pointer to a FlipperFormat instance + * + * @return True on success */ bool flipper_format_rewind(FlipperFormat* flipper_format); -/** - * Move the RW pointer at the end. Can be useful if you want to add some data after reading. - * @param flipper_format Pointer to a FlipperFormat instance - * @return True on success +/** Move the RW pointer at the end. Can be useful if you want to add some data + * after reading. + * + * @param flipper_format Pointer to a FlipperFormat instance + * + * @return True on success */ bool flipper_format_seek_to_end(FlipperFormat* flipper_format); -/** - * Check if the key exists. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @return true key exists - * @return false key is not exists +/** Check if the key exists. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * + * @return true key exists + * @return false key is not exists */ bool flipper_format_key_exist(FlipperFormat* flipper_format, const char* key); -/** - * Read the header (file type and version). - * @param flipper_format Pointer to a FlipperFormat instance - * @param filetype File type string - * @param version Version Value - * @return True on success +/** Read the header (file type and version). + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param filetype File type string + * @param version Version Value + * + * @return True on success */ bool flipper_format_read_header( FlipperFormat* flipper_format, FuriString* filetype, uint32_t* version); -/** - * Write the header (file type and version). - * @param flipper_format Pointer to a FlipperFormat instance - * @param filetype File type string - * @param version Version Value - * @return True on success +/** Write the header (file type and version). + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param filetype File type string + * @param version Version Value + * + * @return True on success */ bool flipper_format_write_header( FlipperFormat* flipper_format, FuriString* filetype, const uint32_t version); -/** - * Write the header (file type and version). Plain C string version. - * @param flipper_format Pointer to a FlipperFormat instance - * @param filetype File type string - * @param version Version Value - * @return True on success +/** Write the header (file type and version). Plain C string version. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param filetype File type string + * @param version Version Value + * + * @return True on success */ bool flipper_format_write_header_cstr( FlipperFormat* flipper_format, const char* filetype, const uint32_t version); -/** - * Get the count of values by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key - * @param count - * @return bool +/** Get the count of values by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key The key + * @param count The count + * + * @return bool */ bool flipper_format_get_value_count( FlipperFormat* flipper_format, const char* key, uint32_t* count); -/** - * Read a string by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Read a string by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_read_string(FlipperFormat* flipper_format, const char* key, FuriString* data); -/** - * Write key and string - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Write key and string + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_write_string(FlipperFormat* flipper_format, const char* key, FuriString* data); -/** - * Write key and string. Plain C string version. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Write key and string. Plain C string version. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_write_string_cstr( FlipperFormat* flipper_format, const char* key, const char* data); -/** - * Read array of uint64 in hex format by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Read array of uint64 in hex format by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_read_hex_uint64( FlipperFormat* flipper_format, @@ -318,13 +335,14 @@ bool flipper_format_read_hex_uint64( uint64_t* data, const uint16_t data_size); -/** - * Write key and array of uint64 in hex format - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Write key and array of uint64 in hex format + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_write_hex_uint64( FlipperFormat* flipper_format, @@ -332,13 +350,14 @@ bool flipper_format_write_hex_uint64( const uint64_t* data, const uint16_t data_size); -/** - * Read array of uint32 by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Read array of uint32 by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_read_uint32( FlipperFormat* flipper_format, @@ -346,13 +365,14 @@ bool flipper_format_read_uint32( uint32_t* data, const uint16_t data_size); -/** - * Write key and array of uint32 - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Write key and array of uint32 + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_write_uint32( FlipperFormat* flipper_format, @@ -360,13 +380,14 @@ bool flipper_format_write_uint32( const uint32_t* data, const uint16_t data_size); -/** - * Read array of int32 by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Read array of int32 by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_read_int32( FlipperFormat* flipper_format, @@ -374,13 +395,14 @@ bool flipper_format_read_int32( int32_t* data, const uint16_t data_size); -/** - * Write key and array of int32 - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Write key and array of int32 + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_write_int32( FlipperFormat* flipper_format, @@ -388,13 +410,14 @@ bool flipper_format_write_int32( const int32_t* data, const uint16_t data_size); -/** - * Read array of bool by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Read array of bool by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_read_bool( FlipperFormat* flipper_format, @@ -402,13 +425,14 @@ bool flipper_format_read_bool( bool* data, const uint16_t data_size); -/** - * Write key and array of bool - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Write key and array of bool + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_write_bool( FlipperFormat* flipper_format, @@ -416,13 +440,14 @@ bool flipper_format_write_bool( const bool* data, const uint16_t data_size); -/** - * Read array of float by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Read array of float by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_read_float( FlipperFormat* flipper_format, @@ -430,13 +455,14 @@ bool flipper_format_read_float( float* data, const uint16_t data_size); -/** - * Write key and array of float - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Write key and array of float + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_write_float( FlipperFormat* flipper_format, @@ -444,13 +470,14 @@ bool flipper_format_write_float( const float* data, const uint16_t data_size); -/** - * Read array of hex-formatted bytes by key - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Read array of hex-formatted bytes by key + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_read_hex( FlipperFormat* flipper_format, @@ -458,13 +485,14 @@ bool flipper_format_read_hex( uint8_t* data, const uint16_t data_size); -/** - * Write key and array of hex-formatted bytes - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @param data_size Values count - * @return True on success +/** Write key and array of hex-formatted bytes + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param data_size Values count + * + * @return True on success */ bool flipper_format_write_hex( FlipperFormat* flipper_format, @@ -472,57 +500,68 @@ bool flipper_format_write_hex( const uint8_t* data, const uint16_t data_size); -/** - * Write comment - * @param flipper_format Pointer to a FlipperFormat instance - * @param data Comment text - * @return True on success +/** Write comment + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param data Comment text + * + * @return True on success */ bool flipper_format_write_comment(FlipperFormat* flipper_format, FuriString* data); -/** - * Write comment. Plain C string version. - * @param flipper_format Pointer to a FlipperFormat instance - * @param data Comment text - * @return True on success +/** Write comment. Plain C string version. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param data Comment text + * + * @return True on success */ bool flipper_format_write_comment_cstr(FlipperFormat* flipper_format, const char* data); -/** - * Removes the first matching key and its value. Sets the RW pointer to a position of deleted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @return True on success +/** Removes the first matching key and its value. Sets the RW pointer to a + * position of deleted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * + * @return True on success */ bool flipper_format_delete_key(FlipperFormat* flipper_format, const char* key); -/** - * Updates the value of the first matching key to a string value. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a string value. Sets the RW + * pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_update_string(FlipperFormat* flipper_format, const char* key, FuriString* data); -/** - * Updates the value of the first matching key to a string value. Plain C version. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a string value. Plain C + * version. Sets the RW pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_update_string_cstr( FlipperFormat* flipper_format, const char* key, const char* data); -/** - * Updates the value of the first matching key to a uint32 array value. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a uint32 array value. Sets the + * RW pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_update_uint32( FlipperFormat* flipper_format, @@ -530,12 +569,15 @@ bool flipper_format_update_uint32( const uint32_t* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a int32 array value. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a int32 array value. Sets the + * RW pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_update_int32( FlipperFormat* flipper_format, @@ -543,12 +585,15 @@ bool flipper_format_update_int32( const int32_t* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a bool array value. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a bool array value. Sets the + * RW pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_update_bool( FlipperFormat* flipper_format, @@ -556,12 +601,15 @@ bool flipper_format_update_bool( const bool* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a float array value. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a float array value. Sets the + * RW pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_update_float( FlipperFormat* flipper_format, @@ -569,12 +617,15 @@ bool flipper_format_update_float( const float* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to an array of hex-formatted bytes. Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to an array of hex-formatted + * bytes. Sets the RW pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_update_hex( FlipperFormat* flipper_format, @@ -582,40 +633,46 @@ bool flipper_format_update_hex( const uint8_t* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a string value, or adds the key and value if the key did not exist. - * Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a string value, or adds the + * key and value if the key did not exist. Sets the RW pointer to a position at + * the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_insert_or_update_string( FlipperFormat* flipper_format, const char* key, FuriString* data); -/** - * Updates the value of the first matching key to a string value, or adds the key and value if the key did not exist. - * Plain C version. - * Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a string value, or adds the + * key and value if the key did not exist. Plain C version. Sets the RW pointer + * to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * + * @return True on success */ bool flipper_format_insert_or_update_string_cstr( FlipperFormat* flipper_format, const char* key, const char* data); -/** - * Updates the value of the first matching key to a uint32 array value, or adds the key and value if the key did not exist. - * Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a uint32 array value, or adds + * the key and value if the key did not exist. Sets the RW pointer to a position + * at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_insert_or_update_uint32( FlipperFormat* flipper_format, @@ -623,13 +680,16 @@ bool flipper_format_insert_or_update_uint32( const uint32_t* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a int32 array value, or adds the key and value if the key did not exist. - * Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a int32 array value, or adds + * the key and value if the key did not exist. Sets the RW pointer to a position + * at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_insert_or_update_int32( FlipperFormat* flipper_format, @@ -637,13 +697,16 @@ bool flipper_format_insert_or_update_int32( const int32_t* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a bool array value, or adds the key and value if the key did not exist. - * Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a bool array value, or adds + * the key and value if the key did not exist. Sets the RW pointer to a position + * at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_insert_or_update_bool( FlipperFormat* flipper_format, @@ -651,13 +714,16 @@ bool flipper_format_insert_or_update_bool( const bool* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to a float array value, or adds the key and value if the key did not exist. - * Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to a float array value, or adds + * the key and value if the key did not exist. Sets the RW pointer to a position + * at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_insert_or_update_float( FlipperFormat* flipper_format, @@ -665,13 +731,16 @@ bool flipper_format_insert_or_update_float( const float* data, const uint16_t data_size); -/** - * Updates the value of the first matching key to an array of hex-formatted bytes, or adds the key and value if the key did not exist. - *Sets the RW pointer to a position at the end of inserted data. - * @param flipper_format Pointer to a FlipperFormat instance - * @param key Key - * @param data Value - * @return True on success +/** Updates the value of the first matching key to an array of hex-formatted + * bytes, or adds the key and value if the key did not exist. Sets the RW + * pointer to a position at the end of inserted data. + * + * @param flipper_format Pointer to a FlipperFormat instance + * @param key Key + * @param data Value + * @param[in] data_size The data size + * + * @return True on success */ bool flipper_format_insert_or_update_hex( FlipperFormat* flipper_format, diff --git a/lib/lfrfid/lfrfid_worker.h b/lib/lfrfid/lfrfid_worker.h index 22135097e26..3bee1d146e0 100644 --- a/lib/lfrfid/lfrfid_worker.h +++ b/lib/lfrfid/lfrfid_worker.h @@ -1,5 +1,4 @@ -/** - * @file lfrfid_worker.h +/** @file lfrfid_worker.h * * LFRFID worker */ @@ -54,37 +53,35 @@ typedef void (*LFRFIDWorkerEmulateRawCallback)(LFRFIDWorkerEmulateRawResult resu typedef struct LFRFIDWorker LFRFIDWorker; -/** - * Allocate LF-RFID worker +/** Allocate LF-RFID worker * @return LFRFIDWorker* */ LFRFIDWorker* lfrfid_worker_alloc(ProtocolDict* dict); -/** - * Free LF-RFID worker - * @param worker +/** Free LF-RFID worker + * + * @param worker The worker */ void lfrfid_worker_free(LFRFIDWorker* worker); -/** - * Start LF-RFID worker thread - * @param worker +/** Start LF-RFID worker thread + * + * @param worker The worker */ void lfrfid_worker_start_thread(LFRFIDWorker* worker); -/** - * Stop LF-RFID worker thread - * @param worker +/** Stop LF-RFID worker thread + * + * @param worker The worker */ void lfrfid_worker_stop_thread(LFRFIDWorker* worker); -/** - * @brief Start read mode - * - * @param worker - * @param type - * @param callback - * @param context +/** Start read mode + * + * @param worker The worker + * @param type The type + * @param callback The callback + * @param context The context */ void lfrfid_worker_read_start( LFRFIDWorker* worker, @@ -92,13 +89,12 @@ void lfrfid_worker_read_start( LFRFIDWorkerReadCallback callback, void* context); -/** - * @brief Start write mode - * - * @param worker - * @param protocol - * @param callback - * @param context +/** Start write mode + * + * @param worker The worker + * @param protocol The protocol + * @param callback The callback + * @param context The context */ void lfrfid_worker_write_start( LFRFIDWorker* worker, @@ -106,20 +102,20 @@ void lfrfid_worker_write_start( LFRFIDWorkerWriteCallback callback, void* context); -/** - * Start emulate mode - * @param worker +/** Start emulate mode + * + * @param worker The worker + * @param[in] protocol The protocol */ void lfrfid_worker_emulate_start(LFRFIDWorker* worker, LFRFIDProtocol protocol); -/** - * @brief Start raw read mode - * - * @param worker - * @param filename - * @param type - * @param callback - * @param context +/** Start raw read mode + * + * @param worker The worker + * @param filename The filename + * @param type The type + * @param callback The callback + * @param context The context */ void lfrfid_worker_read_raw_start( LFRFIDWorker* worker, @@ -128,12 +124,12 @@ void lfrfid_worker_read_raw_start( LFRFIDWorkerReadRawCallback callback, void* context); -/** - * Emulate raw read mode - * @param worker - * @param filename - * @param callback - * @param context +/** Emulate raw read mode + * + * @param worker The worker + * @param filename The filename + * @param callback The callback + * @param context The context */ void lfrfid_worker_emulate_raw_start( LFRFIDWorker* worker, @@ -141,9 +137,9 @@ void lfrfid_worker_emulate_raw_start( LFRFIDWorkerEmulateRawCallback callback, void* context); -/** - * Stop all modes - * @param worker +/** Stop all modes + * + * @param worker The worker */ void lfrfid_worker_stop(LFRFIDWorker* worker); diff --git a/lib/toolbox/compress.h b/lib/toolbox/compress.h index b61bdb0227d..f844802ec59 100644 --- a/lib/toolbox/compress.h +++ b/lib/toolbox/compress.h @@ -43,27 +43,29 @@ typedef struct Compress Compress; /** Allocate encoder and decoder * - * @param compress_buff_size size of decoder and encoder buffer to allocate + * @param compress_buff_size size of decoder and encoder buffer to + * allocate * - * @return Compress instance + * @return Compress instance */ Compress* compress_alloc(uint16_t compress_buff_size); /** Free encoder and decoder * - * @param compress Compress instance + * @param compress Compress instance */ void compress_free(Compress* compress); /** Encode data * - * @param compress Compress instance - * @param data_in pointer to input data - * @param data_in_size size of input data - * @param data_out maximum size of output data - * @param data_res_size pointer to result output data size + * @param compress Compress instance + * @param data_in pointer to input data + * @param data_in_size size of input data + * @param data_out maximum size of output data + * @param[in] data_out_size The data out size + * @param data_res_size pointer to result output data size * - * @return true on success + * @return true on success */ bool compress_encode( Compress* compress, @@ -75,13 +77,14 @@ bool compress_encode( /** Decode data * - * @param compress Compress instance - * @param data_in pointer to input data - * @param data_in_size size of input data - * @param data_out maximum size of output data - * @param data_res_size pointer to result output data size + * @param compress Compress instance + * @param data_in pointer to input data + * @param data_in_size size of input data + * @param data_out maximum size of output data + * @param[in] data_out_size The data out size + * @param data_res_size pointer to result output data size * - * @return true on success + * @return true on success */ bool compress_decode( Compress* compress, diff --git a/scripts/fbt/util.py b/scripts/fbt/util.py index a6a6313030c..42fc296f383 100644 --- a/scripts/fbt/util.py +++ b/scripts/fbt/util.py @@ -1,5 +1,8 @@ import os import re +import subprocess +import sys +import webbrowser import SCons from SCons.Errors import StopError @@ -83,3 +86,10 @@ def path_as_posix(path): if SCons.Platform.platform_default() == "win32": return path.replace(os.path.sep, os.path.altsep) return path + + +def open_browser_action(target, source, env): + if sys.platform == "darwin": + subprocess.run(["open", source[0].abspath]) + else: + webbrowser.open(source[0].abspath) diff --git a/scripts/fbt_tools/doxygen.py b/scripts/fbt_tools/doxygen.py new file mode 100644 index 00000000000..319cb9e5d4a --- /dev/null +++ b/scripts/fbt_tools/doxygen.py @@ -0,0 +1,40 @@ +from SCons.Script import Action, Builder + + +def exists(env): + return True + + +def DoxyBuild(env, target, source, doxy_env_variables=None): + if doxy_env_variables: + doxy_env = env.Clone() + doxy_env.Append(ENV=doxy_env_variables) + else: + doxy_env = env + + return doxy_env._DoxyBuilder(target, source) + + +def generate(env): + if not env["VERBOSE"]: + env.SetDefault( + DOXYGENCOMSTR="\tDOXY\t${TARGET}", + ) + + env.SetDefault( + DOXYGEN="doxygen", + ) + + env.AddMethod(DoxyBuild) + env.Append( + BUILDERS={ + "_DoxyBuilder": Builder( + action=[ + Action( + [["$DOXYGEN", "$SOURCE"]], + "$DOXYGENCOMSTR", + ), + ], + ) + } + ) diff --git a/scripts/fbt_tools/pvsstudio.py b/scripts/fbt_tools/pvsstudio.py index ecf9d4b0681..d74aae7686b 100644 --- a/scripts/fbt_tools/pvsstudio.py +++ b/scripts/fbt_tools/pvsstudio.py @@ -32,7 +32,7 @@ def atexist_handler(): for bf in GetBuildFailures(): for node in Flatten(bf.node): - if node.exists and node.name.endswith(".html"): + if node.exists and "pvs" in node.name and node.name.endswith(".html"): # macOS if sys.platform == "darwin": subprocess.run(["open", node.abspath]) diff --git a/site_scons/fbt_extra/util.py b/site_scons/fbt_extra/util.py index c670c01d4d0..e99d62c915f 100644 --- a/site_scons/fbt_extra/util.py +++ b/site_scons/fbt_extra/util.py @@ -1,5 +1,5 @@ -from fbt.util import link_dir from ansi.color import fg +from fbt.util import link_dir def link_elf_dir_as_latest(env, elf_node): From 7d50c4a742b97cb1af351c23a703786f9e018d3b Mon Sep 17 00:00:00 2001 From: Nikolay Minaylov Date: Thu, 21 Mar 2024 00:35:48 +0300 Subject: [PATCH 11/28] it-IT-mac layout (#3401) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- .../resources/badusb/assets/layouts/it-IT-mac.kl | Bin 0 -> 256 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 applications/main/bad_usb/resources/badusb/assets/layouts/it-IT-mac.kl diff --git a/applications/main/bad_usb/resources/badusb/assets/layouts/it-IT-mac.kl b/applications/main/bad_usb/resources/badusb/assets/layouts/it-IT-mac.kl new file mode 100644 index 0000000000000000000000000000000000000000..6c10e4266bf294e3a419582ec091473d59eded9b GIT binary patch literal 256 zcmaKnw++Go0KhCO)P&wbCv;IGQOAf|`2PmP$bvU}GyJk+&-OR{wF48UUbDox3y-W^ zo0@Xx$%CaECQO-;FlWJ%6>A>ey|MA;(MuMXGjGA7CCi3JR;*gHZo{T6+ji{QGq&%* yp(Dqhvo~pW@+k!5$Wx$5i83J(6{^&z)1XO Date: Wed, 20 Mar 2024 17:45:16 -0400 Subject: [PATCH 12/28] Adding F13-F24 function key support to BadUSB (#3468) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adding F13-F24 function key support to BadUSB * Adding F13-F24 function key support to JS version of BadUSB Co-authored-by: hedger Co-authored-by: あく --- .../main/bad_usb/helpers/ducky_script_keycodes.c | 12 ++++++++++++ applications/system/js_app/modules/js_badusb.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/applications/main/bad_usb/helpers/ducky_script_keycodes.c b/applications/main/bad_usb/helpers/ducky_script_keycodes.c index da2fc22f79f..56b5144d48d 100644 --- a/applications/main/bad_usb/helpers/ducky_script_keycodes.c +++ b/applications/main/bad_usb/helpers/ducky_script_keycodes.c @@ -64,6 +64,18 @@ static const DuckyKey ducky_keys[] = { {"F10", HID_KEYBOARD_F10}, {"F11", HID_KEYBOARD_F11}, {"F12", HID_KEYBOARD_F12}, + {"F13", HID_KEYBOARD_F13}, + {"F14", HID_KEYBOARD_F14}, + {"F15", HID_KEYBOARD_F15}, + {"F16", HID_KEYBOARD_F16}, + {"F17", HID_KEYBOARD_F17}, + {"F18", HID_KEYBOARD_F18}, + {"F19", HID_KEYBOARD_F19}, + {"F20", HID_KEYBOARD_F20}, + {"F21", HID_KEYBOARD_F21}, + {"F22", HID_KEYBOARD_F22}, + {"F23", HID_KEYBOARD_F23}, + {"F24", HID_KEYBOARD_F24}, }; uint16_t ducky_get_keycode_by_name(const char* param) { diff --git a/applications/system/js_app/modules/js_badusb.c b/applications/system/js_app/modules/js_badusb.c index 6b19faea21f..199773c3991 100644 --- a/applications/system/js_app/modules/js_badusb.c +++ b/applications/system/js_app/modules/js_badusb.c @@ -52,6 +52,18 @@ static const struct { {"F10", HID_KEYBOARD_F10}, {"F11", HID_KEYBOARD_F11}, {"F12", HID_KEYBOARD_F12}, + {"F13", HID_KEYBOARD_F13}, + {"F14", HID_KEYBOARD_F14}, + {"F15", HID_KEYBOARD_F15}, + {"F16", HID_KEYBOARD_F16}, + {"F17", HID_KEYBOARD_F17}, + {"F18", HID_KEYBOARD_F18}, + {"F19", HID_KEYBOARD_F19}, + {"F20", HID_KEYBOARD_F20}, + {"F21", HID_KEYBOARD_F21}, + {"F22", HID_KEYBOARD_F22}, + {"F23", HID_KEYBOARD_F23}, + {"F24", HID_KEYBOARD_F24}, }; static bool setup_parse_params(struct mjs* mjs, mjs_val_t arg, FuriHalUsbHidConfig* hid_cfg) { From 1bef579b821059c33e75e014bc33717041d3ee62 Mon Sep 17 00:00:00 2001 From: Jaroslav Nesterov Date: Thu, 21 Mar 2024 02:18:02 +0400 Subject: [PATCH 13/28] Add support for DEFAULT_STRING_DELAY in Bad USB App (#3476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for `DEFAULT_STRING_DELAY` in bad_usb * Format Sources Co-authored-by: あく --- applications/main/bad_usb/helpers/ducky_script.c | 6 +++++- .../main/bad_usb/helpers/ducky_script_commands.c | 16 +++++++++++++++- .../main/bad_usb/helpers/ducky_script_i.h | 1 + documentation/file_formats/BadUsbScriptFormat.md | 10 ++++++---- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index 1b0ea71d544..5a32ae433ee 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -432,6 +432,7 @@ static int32_t bad_usb_worker(void* context) { bad_usb->st.line_cur = 0; bad_usb->defdelay = 0; bad_usb->stringdelay = 0; + bad_usb->defstringdelay = 0; bad_usb->repeat_cnt = 0; bad_usb->key_hold_nb = 0; bad_usb->file_end = false; @@ -455,6 +456,7 @@ static int32_t bad_usb_worker(void* context) { bad_usb->st.line_cur = 0; bad_usb->defdelay = 0; bad_usb->stringdelay = 0; + bad_usb->defstringdelay = 0; bad_usb->repeat_cnt = 0; bad_usb->file_end = false; storage_file_seek(script_file, 0, true); @@ -582,9 +584,11 @@ static int32_t bad_usb_worker(void* context) { continue; } } else if(worker_state == BadUsbStateStringDelay) { // State: print string with delays + uint32_t delay = (bad_usb->stringdelay == 0) ? bad_usb->defstringdelay : + bad_usb->stringdelay; uint32_t flags = bad_usb_flags_get( WorkerEvtEnd | WorkerEvtStartStop | WorkerEvtPauseResume | WorkerEvtDisconnect, - bad_usb->stringdelay); + delay); if(!(flags & FuriFlagError)) { if(flags & WorkerEvtEnd) { diff --git a/applications/main/bad_usb/helpers/ducky_script_commands.c b/applications/main/bad_usb/helpers/ducky_script_commands.c index a5bc7c8cf95..fdf963b4040 100644 --- a/applications/main/bad_usb/helpers/ducky_script_commands.c +++ b/applications/main/bad_usb/helpers/ducky_script_commands.c @@ -46,6 +46,17 @@ static int32_t ducky_fnc_strdelay(BadUsbScript* bad_usb, const char* line, int32 return 0; } +static int32_t ducky_fnc_defstrdelay(BadUsbScript* bad_usb, const char* line, int32_t param) { + UNUSED(param); + + line = &line[ducky_get_command_len(line) + 1]; + bool state = ducky_get_number(line, &bad_usb->defstringdelay); + if(!state) { + return ducky_error(bad_usb, "Invalid number %s", line); + } + return 0; +} + static int32_t ducky_fnc_string(BadUsbScript* bad_usb, const char* line, int32_t param) { line = &line[ducky_get_command_len(line) + 1]; furi_string_set_str(bad_usb->string_print, line); @@ -53,7 +64,8 @@ static int32_t ducky_fnc_string(BadUsbScript* bad_usb, const char* line, int32_t furi_string_cat(bad_usb->string_print, "\n"); } - if(bad_usb->stringdelay == 0) { // stringdelay not set - run command immediately + if(bad_usb->stringdelay == 0 && + bad_usb->defstringdelay == 0) { // stringdelay not set - run command immediately bool state = ducky_string(bad_usb, furi_string_get_cstr(bad_usb->string_print)); if(!state) { return ducky_error(bad_usb, "Invalid string %s", line); @@ -161,6 +173,8 @@ static const DuckyCmd ducky_commands[] = { {"DEFAULTDELAY", ducky_fnc_defdelay, -1}, {"STRINGDELAY", ducky_fnc_strdelay, -1}, {"STRING_DELAY", ducky_fnc_strdelay, -1}, + {"DEFAULT_STRING_DELAY", ducky_fnc_defstrdelay, -1}, + {"DEFAULTSTRINGDELAY", ducky_fnc_defstrdelay, -1}, {"REPEAT", ducky_fnc_repeat, -1}, {"SYSRQ", ducky_fnc_sysrq, -1}, {"ALTCHAR", ducky_fnc_altchar, -1}, diff --git a/applications/main/bad_usb/helpers/ducky_script_i.h b/applications/main/bad_usb/helpers/ducky_script_i.h index 84c7ef9de6c..9c1025b00b5 100644 --- a/applications/main/bad_usb/helpers/ducky_script_i.h +++ b/applications/main/bad_usb/helpers/ducky_script_i.h @@ -30,6 +30,7 @@ struct BadUsbScript { uint32_t defdelay; uint32_t stringdelay; + uint32_t defstringdelay; uint16_t layout[128]; FuriString* line; diff --git a/documentation/file_formats/BadUsbScriptFormat.md b/documentation/file_formats/BadUsbScriptFormat.md index 3bda3061723..cc919da0944 100644 --- a/documentation/file_formats/BadUsbScriptFormat.md +++ b/documentation/file_formats/BadUsbScriptFormat.md @@ -97,10 +97,12 @@ Will wait indefinitely for a button to be pressed ## String delay Delay between keypresses. -| Command | Parameters | Notes | -| ------------ | ----------------- | --------------------------------------------- | -| STRING_DELAY | Delay value in ms | Applied once to next appearing STRING command | -| STRINGDELAY | Delay value in ms | Same as STRING_DELAY | +| Command | Parameters | Notes | +| -------------------- | ----------------- | --------------------------------------------- | +| STRING_DELAY | Delay value in ms | Applied once to next appearing STRING command | +| STRINGDELAY | Delay value in ms | Same as STRING_DELAY | +| DEFAULT_STRING_DELAY | Delay value in ms | Apply to every appearing STRING command | +| DEFAULTSTRINGDELAY | Delay value in ms | Same as DEFAULT_STRING_DELAY | ### Repeat From 0c465f7eb32ec34fea5b04bd4ecc4e2b60a8ec95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=85=BD=E5=85=BD?= Date: Wed, 20 Mar 2024 18:24:33 -0400 Subject: [PATCH 14/28] Added new IR commands (#3480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: hedger Co-authored-by: あく --- .../infrared/resources/infrared/assets/tv.ir | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/applications/main/infrared/resources/infrared/assets/tv.ir b/applications/main/infrared/resources/infrared/assets/tv.ir index fcbbf28dcc4..1159f2f04d3 100644 --- a/applications/main/infrared/resources/infrared/assets/tv.ir +++ b/applications/main/infrared/resources/infrared/assets/tv.ir @@ -1800,3 +1800,31 @@ type: parsed protocol: NECext address: 01 72 00 00 command: 44 BB 00 00 +# +# Koro Box +# +name: Power +type: parsed +protocol: NEC +address: 01 00 00 00 +command: 18 00 00 00 +# +# Toshiba Amazon TV +# +name: Vol_up +type: parsed +protocol: NEC +address: 01 00 00 00 +command: 0E 00 00 00 +# +name: Vol_dn +type: parsed +protocol: NEC +address: 01 00 00 00 +command: 0F 00 00 00 +# +name: Mute +type: parsed +protocol: NEC +address: 01 00 00 00 +command: 17 00 00 00 \ No newline at end of file From 4039ccbcca715a7d0339d882312dcbaccda15d6b Mon Sep 17 00:00:00 2001 From: Silent Date: Wed, 20 Mar 2024 23:36:38 +0100 Subject: [PATCH 15/28] fbt/ufbt: Ensure POSIX paths are passed to GDB on all platforms (#3360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fbt/ufbt: Ensure POSIX paths are passed to GDB on all platforms GDB heavily dislikes forward slashes from Windows paths and strips them internally instead of normalizing them. Account for this by passing POSIX paths explicitly. * fbt: different approach for posix path handling * fbt, ufbt: further fixes for path handling * fbt: explicit path stringification * linter fixes Co-authored-by: hedger Co-authored-by: hedger Co-authored-by: あく --- SConstruct | 2 -- scripts/fbt/util.py | 22 +++++++++++++++++++ scripts/fbt_tools/fbt_debugopts.py | 18 +++++++-------- scripts/fbt_tools/fbt_sdk.py | 6 ++--- scripts/ufbt/SConstruct | 35 +++++++++++++++--------------- site_scons/environ.scons | 3 ++- 6 files changed, 53 insertions(+), 33 deletions(-) diff --git a/SConstruct b/SConstruct index 26505fe8cae..b48b1c6847e 100644 --- a/SConstruct +++ b/SConstruct @@ -230,7 +230,6 @@ firmware_debug = distenv.PhonyTarget( source=firmware_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE}", GDBREMOTE="${OPENOCD_GDB_PIPE}", - FBT_FAP_DEBUG_ELF_ROOT=path_as_posix(firmware_env.subst("$FBT_FAP_DEBUG_ELF_ROOT")), ) distenv.Depends(firmware_debug, firmware_flash) @@ -240,7 +239,6 @@ distenv.PhonyTarget( source=firmware_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}", GDBREMOTE="${BLACKMAGIC_ADDR}", - FBT_FAP_DEBUG_ELF_ROOT=path_as_posix(firmware_env.subst("$FBT_FAP_DEBUG_ELF_ROOT")), ) # Debug alien elf diff --git a/scripts/fbt/util.py b/scripts/fbt/util.py index 42fc296f383..19fdb3ae658 100644 --- a/scripts/fbt/util.py +++ b/scripts/fbt/util.py @@ -3,6 +3,7 @@ import subprocess import sys import webbrowser +from pathlib import Path, PurePosixPath import SCons from SCons.Errors import StopError @@ -82,6 +83,27 @@ def resolve_real_dir_node(node): raise StopError(f"Can't find absolute path for {node.name} ({node})") +class PosixPathWrapper: + def __init__(self, pathobj): + self.pathobj = pathobj + + @staticmethod + def fixup_separators(path): + if SCons.Platform.platform_default() == "win32": + return path.replace(os.path.sep, os.path.altsep) + return path + + @staticmethod + def fix_path(path): + return str(PurePosixPath(Path(path).as_posix())) + + def __call__(self, target, source, env, for_signature): + if for_signature: + return self.pathobj + + return self.fix_path(env.subst(self.pathobj)) + + def path_as_posix(path): if SCons.Platform.platform_default() == "win32": return path.replace(os.path.sep, os.path.altsep) diff --git a/scripts/fbt_tools/fbt_debugopts.py b/scripts/fbt_tools/fbt_debugopts.py index 392465a518f..77b63e2034f 100644 --- a/scripts/fbt_tools/fbt_debugopts.py +++ b/scripts/fbt_tools/fbt_debugopts.py @@ -18,7 +18,7 @@ def GetDevices(env): def generate(env, **kw): env.AddMethod(GetDevices) env.SetDefault( - FBT_DEBUG_DIR="${FBT_SCRIPT_DIR}/debug", + FBT_DEBUG_DIR="${POSIXPATH('$FBT_SCRIPT_DIR')}/debug", ) if (adapter_serial := env.subst("$SWD_TRANSPORT_SERIAL")) != "auto": @@ -36,11 +36,11 @@ def generate(env, **kw): env.SetDefault( OPENOCD_GDB_PIPE=[ - "|openocd -c 'gdb_port pipe; log_output ${FBT_DEBUG_DIR}/openocd.log' ${[SINGLEQUOTEFUNC(OPENOCD_OPTS)]}" + "|openocd -c 'gdb_port pipe; log_output ${POSIXPATH('$FBT_DEBUG_DIR')}/openocd.log' ${[SINGLEQUOTEFUNC(OPENOCD_OPTS)]}" ], GDBOPTS_BASE=[ "-ex", - "source ${FBT_DEBUG_DIR}/gdbinit", + "source ${POSIXPATH('$FBT_DEBUG_DIR')}/gdbinit", "-ex", "target extended-remote ${GDBREMOTE}", ], @@ -57,17 +57,17 @@ def generate(env, **kw): ], GDBPYOPTS=[ "-ex", - "source ${FBT_DEBUG_DIR}/FreeRTOS/FreeRTOS.py", + "source ${POSIXPATH('$FBT_DEBUG_DIR')}/FreeRTOS/FreeRTOS.py", "-ex", - "source ${FBT_DEBUG_DIR}/flipperapps.py", + "source ${POSIXPATH('$FBT_DEBUG_DIR')}/flipperapps.py", "-ex", - "source ${FBT_DEBUG_DIR}/flipperversion.py", + "source ${POSIXPATH('$FBT_DEBUG_DIR')}/flipperversion.py", "-ex", - "fap-set-debug-elf-root ${FBT_FAP_DEBUG_ELF_ROOT}", + "fap-set-debug-elf-root ${POSIXPATH('$FBT_FAP_DEBUG_ELF_ROOT')}", "-ex", - "source ${FBT_DEBUG_DIR}/PyCortexMDebug/PyCortexMDebug.py", + "source ${POSIXPATH('$FBT_DEBUG_DIR')}/PyCortexMDebug/PyCortexMDebug.py", "-ex", - "svd_load ${SVD_FILE}", + "svd_load ${POSIXPATH('$SVD_FILE')}", "-ex", "compare-sections", "-ex", diff --git a/scripts/fbt_tools/fbt_sdk.py b/scripts/fbt_tools/fbt_sdk.py index 17acc8cf1ae..a3f7faa577b 100644 --- a/scripts/fbt_tools/fbt_sdk.py +++ b/scripts/fbt_tools/fbt_sdk.py @@ -6,7 +6,7 @@ from fbt.sdk.cache import SdkCache from fbt.sdk.collector import SdkCollector -from fbt.util import path_as_posix +from fbt.util import PosixPathWrapper from SCons.Action import Action from SCons.Builder import Builder from SCons.Errors import UserError @@ -80,7 +80,7 @@ def _wrap_scons_vars(self, vars: str): vars, target=Entry(self.MAP_FILE_SUBST), ) - return path_as_posix(expanded_vars) + return PosixPathWrapper.fixup_separators(expanded_vars) class SdkTreeBuilder: @@ -149,7 +149,7 @@ def _generate_sdk_meta(self): meta.save_to(self.target[0].path) def build_sdk_file_path(self, orig_path: str) -> str: - return path_as_posix( + return PosixPathWrapper.fix_path( posixpath.normpath( posixpath.join( self.SDK_DIR_SUBST, diff --git a/scripts/ufbt/SConstruct b/scripts/ufbt/SConstruct index 8178a83da4e..11fefd22b59 100644 --- a/scripts/ufbt/SConstruct +++ b/scripts/ufbt/SConstruct @@ -47,7 +47,7 @@ from fbt.appmanifest import FlipperApplication, FlipperAppType from fbt.sdk.cache import SdkCache from fbt.util import ( FORWARDED_ENV_VARIABLES, - path_as_posix, + PosixPathWrapper, resolve_real_dir_node, single_quote, tempfile_arg_esc_func, @@ -89,6 +89,7 @@ env = core_env.Clone( ("compilation_db", {"COMPILATIONDB_COMSTR": "\tCDB\t${TARGET}"}), ], FBT_FAP_DEBUG_ELF_ROOT=ufbt_build_dir, + POSIXPATH=PosixPathWrapper, TEMPFILE=TempFileMunge, MAXLINELENGTH=2048, PROGSUFFIX=".elf", @@ -128,7 +129,7 @@ dist_env = env.Clone( "-c", "transport select hla_swd", "-f", - "${FBT_DEBUG_DIR}/stm32wbx.cfg", + "${POSIXPATH('$FBT_DEBUG_DIR')}/stm32wbx.cfg", "-c", "stm32wbx.cpu configure -rtos auto", ], @@ -161,7 +162,6 @@ firmware_debug = dist_env.PhonyTarget( source=dist_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE}", GDBREMOTE="${OPENOCD_GDB_PIPE}", - FBT_FAP_DEBUG_ELF_ROOT=path_as_posix(dist_env.subst("$FBT_FAP_DEBUG_ELF_ROOT")), ) dist_env.PhonyTarget( @@ -170,15 +170,14 @@ dist_env.PhonyTarget( source=dist_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}", GDBREMOTE="${BLACKMAGIC_ADDR}", - FBT_FAP_DEBUG_ELF_ROOT=path_as_posix(dist_env.subst("$FBT_FAP_DEBUG_ELF_ROOT")), ) # Debug alien elf debug_other_opts = [ "-ex", - "source ${FBT_DEBUG_DIR}/PyCortexMDebug/PyCortexMDebug.py", + "source ${POSIXPATH('FBT_DEBUG_DIR')}/PyCortexMDebug/PyCortexMDebug.py", "-ex", - "source ${FBT_DEBUG_DIR}/flipperversion.py", + "source ${POSIXPATH('FBT_DEBUG_DIR')}/flipperversion.py", "-ex", "fw-version", ] @@ -371,10 +370,6 @@ dist_env.PhonyTarget( # Prepare vscode environment -def _path_as_posix(path): - return pathlib.Path(path).as_posix() - - vscode_dist = [] project_template_dir = dist_env["UFBT_SCRIPT_ROOT"].Dir("project_template") for template_file in project_template_dir.Dir(".vscode").glob("*"): @@ -387,20 +382,24 @@ for template_file in project_template_dir.Dir(".vscode").glob("*"): "@UFBT_TOOLCHAIN_ARM_TOOLCHAIN_DIR@": pathlib.Path( dist_env.WhereIs("arm-none-eabi-gcc") ).parent.as_posix(), - "@UFBT_TOOLCHAIN_GCC@": _path_as_posix( + "@UFBT_TOOLCHAIN_GCC@": PosixPathWrapper.fix_path( dist_env.WhereIs("arm-none-eabi-gcc") ), - "@UFBT_TOOLCHAIN_GDB_PY@": _path_as_posix( + "@UFBT_TOOLCHAIN_GDB_PY@": PosixPathWrapper.fix_path( dist_env.WhereIs("arm-none-eabi-gdb-py3") ), - "@UFBT_TOOLCHAIN_OPENOCD@": _path_as_posix(dist_env.WhereIs("openocd")), - "@UFBT_APP_DIR@": _path_as_posix(original_app_dir.abspath), - "@UFBT_ROOT_DIR@": _path_as_posix(Dir("#").abspath), - "@UFBT_DEBUG_DIR@": _path_as_posix(dist_env["FBT_DEBUG_DIR"].abspath), - "@UFBT_DEBUG_ELF_DIR@": _path_as_posix( + "@UFBT_TOOLCHAIN_OPENOCD@": PosixPathWrapper.fix_path( + dist_env.WhereIs("openocd") + ), + "@UFBT_APP_DIR@": PosixPathWrapper.fix_path(original_app_dir.abspath), + "@UFBT_ROOT_DIR@": PosixPathWrapper.fix_path(Dir("#").abspath), + "@UFBT_DEBUG_DIR@": dist_env.subst("FBT_DEBUG_DIR"), + "@UFBT_DEBUG_ELF_DIR@": PosixPathWrapper.fix_path( dist_env["FBT_FAP_DEBUG_ELF_ROOT"].abspath ), - "@UFBT_FIRMWARE_ELF@": _path_as_posix(dist_env["FW_ELF"].abspath), + "@UFBT_FIRMWARE_ELF@": PosixPathWrapper.fix_path( + dist_env["FW_ELF"].abspath + ), }, ) ) diff --git a/site_scons/environ.scons b/site_scons/environ.scons index ece8de2122b..3f2d3450e1d 100644 --- a/site_scons/environ.scons +++ b/site_scons/environ.scons @@ -3,6 +3,7 @@ import os from fbt.util import ( FORWARDED_ENV_VARIABLES, + PosixPathWrapper, resolve_real_dir_node, single_quote, tempfile_arg_esc_func, @@ -26,7 +27,6 @@ for env_value_name in variables_to_forward: if environ_value := os.environ.get(env_value_name, None): forward_os_env[env_value_name] = environ_value - coreenv = VAR_ENV.Clone( tools=[ "fbt_tweaks", @@ -43,6 +43,7 @@ coreenv = VAR_ENV.Clone( "ccache", ], TEMPFILE=TempFileMunge, + POSIXPATH=PosixPathWrapper, MAXLINELENGTH=2048, PROGSUFFIX=".elf", ENV=forward_os_env, From 2aa2dcc71b54c08f0220c9672d50819c409c8d1c Mon Sep 17 00:00:00 2001 From: Egor Koleda Date: Fri, 22 Mar 2024 15:25:52 +0300 Subject: [PATCH 16/28] Add support for Pioneer SR IR remotes (#3308) * add support for Pioneer SR IR remotes * fix minor issues * fix repeat * Fix protocol enumeration order * Add unit tests for Pioneer IR protocol * Clean up raw test data * Add encoder/decoder tests, modify parser * Remove dead code * Use loops where appropriate Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Co-authored-by: Georgii Surkov --- .../debug/unit_tests/infrared/infrared_test.c | 76 +++---- .../unit_tests/infrared/test_pioneer.irtest | 205 ++++++++++++++++++ .../common/infrared_common_i.h | 1 - lib/infrared/encoder_decoder/infrared.c | 15 ++ lib/infrared/encoder_decoder/infrared.h | 2 + .../kaseikyo/infrared_protocol_kaseikyo.c | 1 - .../nec/infrared_protocol_nec.c | 1 - .../pioneer/infrared_decoder_pioneer.c | 57 +++++ .../pioneer/infrared_encoder_pioneer.c | 61 ++++++ .../pioneer/infrared_protocol_pioneer.c | 40 ++++ .../pioneer/infrared_protocol_pioneer.h | 36 +++ .../pioneer/infrared_protocol_pioneer_i.h | 25 +++ .../rca/infrared_protocol_rca.c | 1 - .../samsung/infrared_protocol_samsung.c | 1 - .../sirc/infrared_protocol_sirc.c | 1 - 15 files changed, 480 insertions(+), 43 deletions(-) create mode 100644 applications/debug/unit_tests/resources/unit_tests/infrared/test_pioneer.irtest create mode 100644 lib/infrared/encoder_decoder/pioneer/infrared_decoder_pioneer.c create mode 100644 lib/infrared/encoder_decoder/pioneer/infrared_encoder_pioneer.c create mode 100644 lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.c create mode 100644 lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.h create mode 100644 lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h diff --git a/applications/debug/unit_tests/infrared/infrared_test.c b/applications/debug/unit_tests/infrared/infrared_test.c index 13c5559d1de..4442fedb30f 100644 --- a/applications/debug/unit_tests/infrared/infrared_test.c +++ b/applications/debug/unit_tests/infrared/infrared_test.c @@ -426,53 +426,53 @@ MU_TEST(infrared_test_decoder_mixed) { infrared_test_run_decoder(InfraredProtocolSIRC, 3); infrared_test_run_decoder(InfraredProtocolKaseikyo, 1); infrared_test_run_decoder(InfraredProtocolRCA, 1); + infrared_test_run_decoder(InfraredProtocolPioneer, 6); } MU_TEST(infrared_test_decoder_nec) { - infrared_test_run_decoder(InfraredProtocolNEC, 1); - infrared_test_run_decoder(InfraredProtocolNEC, 2); - infrared_test_run_decoder(InfraredProtocolNEC, 3); + for(uint32_t i = 1; i <= 3; ++i) { + infrared_test_run_decoder(InfraredProtocolNEC, i); + } } MU_TEST(infrared_test_decoder_unexpected_end_in_sequence) { - infrared_test_run_decoder(InfraredProtocolNEC, 1); - infrared_test_run_decoder(InfraredProtocolNEC, 1); - infrared_test_run_decoder(InfraredProtocolNEC, 2); - infrared_test_run_decoder(InfraredProtocolNEC, 2); + for(uint32_t i = 1; i <= 2; ++i) { + infrared_test_run_decoder(InfraredProtocolNEC, i); + infrared_test_run_decoder(InfraredProtocolNEC, i); + } } MU_TEST(infrared_test_decoder_necext1) { - infrared_test_run_decoder(InfraredProtocolNECext, 1); - infrared_test_run_decoder(InfraredProtocolNECext, 1); + for(uint32_t i = 0; i < 2; ++i) { + UNUSED(i); + infrared_test_run_decoder(InfraredProtocolNECext, 1); + } } MU_TEST(infrared_test_decoder_long_packets_with_nec_start) { - infrared_test_run_decoder(InfraredProtocolNEC42ext, 1); - infrared_test_run_decoder(InfraredProtocolNEC42ext, 2); + for(uint32_t i = 1; i <= 2; ++i) { + infrared_test_run_decoder(InfraredProtocolNEC42ext, i); + } } MU_TEST(infrared_test_encoder_sirc) { - infrared_test_run_encoder(InfraredProtocolSIRC, 1); - infrared_test_run_encoder(InfraredProtocolSIRC, 2); + for(uint32_t i = 1; i <= 2; ++i) { + infrared_test_run_encoder(InfraredProtocolSIRC, i); + } } MU_TEST(infrared_test_decoder_sirc) { - infrared_test_run_decoder(InfraredProtocolSIRC, 3); - infrared_test_run_decoder(InfraredProtocolSIRC, 1); - infrared_test_run_decoder(InfraredProtocolSIRC, 2); - infrared_test_run_decoder(InfraredProtocolSIRC, 4); - infrared_test_run_decoder(InfraredProtocolSIRC, 5); + for(uint32_t i = 1; i <= 5; ++i) { + infrared_test_run_decoder(InfraredProtocolSIRC, 5); + } } MU_TEST(infrared_test_decoder_rc5) { infrared_test_run_decoder(InfraredProtocolRC5X, 1); - infrared_test_run_decoder(InfraredProtocolRC5, 1); - infrared_test_run_decoder(InfraredProtocolRC5, 2); - infrared_test_run_decoder(InfraredProtocolRC5, 3); - infrared_test_run_decoder(InfraredProtocolRC5, 4); - infrared_test_run_decoder(InfraredProtocolRC5, 5); - infrared_test_run_decoder(InfraredProtocolRC5, 6); - infrared_test_run_decoder(InfraredProtocolRC5, 7); + + for(uint32_t i = 1; i <= 7; ++i) { + infrared_test_run_decoder(InfraredProtocolRC5, i); + } } MU_TEST(infrared_test_encoder_rc5x) { @@ -492,21 +492,21 @@ MU_TEST(infrared_test_encoder_rc6) { } MU_TEST(infrared_test_decoder_kaseikyo) { - infrared_test_run_decoder(InfraredProtocolKaseikyo, 1); - infrared_test_run_decoder(InfraredProtocolKaseikyo, 2); - infrared_test_run_decoder(InfraredProtocolKaseikyo, 3); - infrared_test_run_decoder(InfraredProtocolKaseikyo, 4); - infrared_test_run_decoder(InfraredProtocolKaseikyo, 5); - infrared_test_run_decoder(InfraredProtocolKaseikyo, 6); + for(uint32_t i = 1; i <= 6; ++i) { + infrared_test_run_decoder(InfraredProtocolKaseikyo, i); + } } MU_TEST(infrared_test_decoder_rca) { - infrared_test_run_decoder(InfraredProtocolRCA, 1); - infrared_test_run_decoder(InfraredProtocolRCA, 2); - infrared_test_run_decoder(InfraredProtocolRCA, 3); - infrared_test_run_decoder(InfraredProtocolRCA, 4); - infrared_test_run_decoder(InfraredProtocolRCA, 5); - infrared_test_run_decoder(InfraredProtocolRCA, 6); + for(uint32_t i = 1; i <= 6; ++i) { + infrared_test_run_decoder(InfraredProtocolRCA, i); + } +} + +MU_TEST(infrared_test_decoder_pioneer) { + for(uint32_t i = 1; i <= 11; ++i) { + infrared_test_run_decoder(InfraredProtocolPioneer, i); + } } MU_TEST(infrared_test_encoder_decoder_all) { @@ -520,6 +520,7 @@ MU_TEST(infrared_test_encoder_decoder_all) { infrared_test_run_encoder_decoder(InfraredProtocolSIRC, 1); infrared_test_run_encoder_decoder(InfraredProtocolKaseikyo, 1); infrared_test_run_encoder_decoder(InfraredProtocolRCA, 1); + infrared_test_run_encoder_decoder(InfraredProtocolPioneer, 1); } MU_TEST_SUITE(infrared_test) { @@ -539,6 +540,7 @@ MU_TEST_SUITE(infrared_test) { MU_RUN_TEST(infrared_test_decoder_necext1); MU_RUN_TEST(infrared_test_decoder_kaseikyo); MU_RUN_TEST(infrared_test_decoder_rca); + MU_RUN_TEST(infrared_test_decoder_pioneer); MU_RUN_TEST(infrared_test_decoder_mixed); MU_RUN_TEST(infrared_test_encoder_decoder_all); } diff --git a/applications/debug/unit_tests/resources/unit_tests/infrared/test_pioneer.irtest b/applications/debug/unit_tests/resources/unit_tests/infrared/test_pioneer.irtest new file mode 100644 index 00000000000..f05b33eec77 --- /dev/null +++ b/applications/debug/unit_tests/resources/unit_tests/infrared/test_pioneer.irtest @@ -0,0 +1,205 @@ +Filetype: IR tests file +Version: 1 +# +name: decoder_input1 +type: raw +data: 25557 8437 4188 571 1538 595 1514 567 1542 570 1539 573 501 565 1544 568 506 571 1539 573 501 565 509 568 508 569 506 571 1538 574 501 565 1543 569 506 571 504 573 1536 566 1544 568 506 592 1517 574 1535 567 507 570 505 572 1537 575 500 566 508 600 1509 572 503 574 501 565 1544 568 1540 593 +# +name: decoder_expected1 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AF 00 00 00 +command: 36 00 00 00 +repeat: false +# +name: decoder_input2 +type: raw +data: 25609 8444 4152 564 1568 544 1565 547 1561 541 1568 544 530 547 1536 566 510 567 1567 545 529 548 526 540 535 542 508 569 1539 573 527 539 1543 569 506 571 504 573 1561 541 508 569 507 570 1538 564 1545 567 507 570 505 572 1537 565 509 568 1541 571 1538 564 511 566 509 568 1539 573 1537 596 +# +name: decoder_expected2 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AF 00 00 00 +command: 32 00 00 00 +repeat: false +# +name: decoder_input3 +type: raw +data: 25582 8448 4176 571 1537 565 1544 568 1540 572 1537 575 500 566 1542 570 505 572 1537 575 500 566 508 569 506 571 504 573 1536 565 510 567 1542 570 504 573 1536 566 1543 569 506 571 504 573 1536 566 1543 569 506 571 504 573 502 575 500 566 1542 570 1539 573 502 575 500 566 1542 570 1540 572 +# +name: decoder_expected3 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AF 00 00 00 +command: 33 00 00 00 +repeat: false +# +name: decoder_input4 +type: raw +data: 25594 8443 4181 568 1542 570 505 572 1538 564 1545 567 508 569 1540 572 504 573 1536 566 510 567 1542 571 505 572 504 573 1562 540 510 567 1543 570 506 571 504 573 503 574 501 565 510 567 509 568 507 570 1539 573 502 565 1545 568 1542 571 1539 573 1536 566 1544 569 1541 572 503 574 1537 565 +# +name: decoder_expected4 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 40 00 00 00 +repeat: false +# +name: decoder_input5 +type: raw +data: 25556 8475 4150 597 1512 600 476 601 1509 603 1506 595 480 597 1512 600 476 601 1508 594 482 595 1515 597 478 599 477 600 1510 602 473 604 1506 595 480 597 1513 599 476 601 475 602 474 603 472 594 482 595 1514 598 477 600 476 601 1508 594 1516 596 1513 599 1510 602 1507 595 480 597 1513 599 +# +name: decoder_expected5 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 41 00 00 00 +repeat: false +# +name: decoder_input6 +type: raw +data: 25567 8471 4155 604 1506 596 480 597 1513 599 1510 603 473 594 1515 597 478 599 1511 602 474 603 1507 595 480 597 479 598 1511 602 474 603 1506 596 480 597 478 599 1511 602 474 603 472 594 481 596 479 598 1512 601 474 603 1506 596 479 598 1511 602 1508 594 1515 598 1512 600 475 602 1507 595 +# +name: decoder_expected6 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 42 00 00 00 +repeat: false +# +name: decoder_input7 +type: raw +data: 25584 8444 4180 569 1541 572 504 573 1536 566 1544 569 507 570 1539 574 501 566 1569 596 455 570 1540 573 502 575 501 565 1544 569 507 570 1565 548 503 574 1535 567 1543 570 506 571 529 548 502 565 511 566 1543 601 475 571 504 573 503 574 1536 566 1543 570 1539 574 1536 566 509 568 1541 572 +# +name: decoder_expected7 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 43 00 00 00 +repeat: false +# +name: decoder_input8 +type: raw +data: 25562 8445 4181 568 1543 570 505 572 1538 575 1535 567 508 569 1539 573 503 595 1514 567 508 600 1509 572 503 595 481 596 1513 568 507 601 1508 573 502 575 501 566 1543 570 506 571 504 573 1536 566 510 567 508 600 475 571 1539 573 502 575 1534 568 1542 571 505 572 1537 575 1534 568 1542 571 +# +name: decoder_expected8 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 12 00 00 00 +repeat: false +# +name: decoder_input9 +type: raw +data: 25558 8470 4152 597 1513 600 476 601 1508 594 1515 598 478 599 1509 593 483 594 1515 598 478 599 1510 603 474 592 482 595 1514 599 477 600 1509 593 483 594 481 596 1513 600 476 601 1508 594 1515 598 478 599 476 601 474 593 1517 596 479 598 1512 601 474 603 472 594 1515 598 1511 602 1508 594 +# +name: decoder_expected9 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 1A 00 00 00 +repeat: false +# +name: decoder_input10 +type: raw +data: 25587 8442 4179 601 1507 595 481 565 1544 600 1509 593 482 595 1513 568 507 570 1539 594 481 565 1544 600 476 570 505 593 1516 597 479 598 1511 591 484 593 481 575 1534 600 476 570 1539 595 480 597 478 599 476 570 505 593 1517 564 511 597 1511 602 474 572 1537 597 1513 600 1509 572 1537 565 +# +name: decoder_expected10 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 0A 00 00 00 +repeat: false +# +name: decoder_input11 +type: raw +data: 25554 8474 4149 600 1510 603 472 594 1515 597 1512 601 475 602 1507 595 480 597 1513 599 475 602 1508 594 481 596 479 598 1512 601 474 603 1506 596 479 598 1512 601 1508 594 481 596 1513 599 476 601 474 603 472 594 481 596 480 597 478 599 1510 603 473 593 1515 597 1512 601 1509 603 1506 596 +# +name: decoder_expected11 +type: parsed_array +count: 1 +# +protocol: Pioneer +address: AD 00 00 00 +command: 0B 00 00 00 +repeat: false +# +name: encoder_decoder_input1 +type: parsed_array +count: 11 +# +protocol: Pioneer +address: AF 00 00 00 +command: 36 00 00 00 +repeat: false +# +protocol: Pioneer +address: AF 00 00 00 +command: 32 00 00 00 +repeat: false +# +protocol: Pioneer +address: AF 00 00 00 +command: 33 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 40 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 41 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 42 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 43 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 12 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 1A 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 0A 00 00 00 +repeat: false +# +protocol: Pioneer +address: AD 00 00 00 +command: 0B 00 00 00 +repeat: false +# diff --git a/lib/infrared/encoder_decoder/common/infrared_common_i.h b/lib/infrared/encoder_decoder/common/infrared_common_i.h index f34e81edaef..05c5faf8d25 100644 --- a/lib/infrared/encoder_decoder/common/infrared_common_i.h +++ b/lib/infrared/encoder_decoder/common/infrared_common_i.h @@ -18,7 +18,6 @@ typedef InfraredStatus ( typedef struct { InfraredTimings timings; bool manchester_start_from_space; - bool no_stop_bit; uint8_t databit_len[4]; InfraredCommonDecode decode; InfraredCommonDecodeRepeat decode_repeat; diff --git a/lib/infrared/encoder_decoder/infrared.c b/lib/infrared/encoder_decoder/infrared.c index d0bdaaef6cc..8f4c0c87245 100644 --- a/lib/infrared/encoder_decoder/infrared.c +++ b/lib/infrared/encoder_decoder/infrared.c @@ -12,6 +12,7 @@ #include "sirc/infrared_protocol_sirc.h" #include "kaseikyo/infrared_protocol_kaseikyo.h" #include "rca/infrared_protocol_rca.h" +#include "pioneer/infrared_protocol_pioneer.h" typedef struct { InfraredAlloc alloc; @@ -114,6 +115,20 @@ static const InfraredEncoderDecoder infrared_encoder_decoder[] = { .free = infrared_encoder_sirc_free}, .get_protocol_variant = infrared_protocol_sirc_get_variant, }, + { + .decoder = + {.alloc = infrared_decoder_pioneer_alloc, + .decode = infrared_decoder_pioneer_decode, + .reset = infrared_decoder_pioneer_reset, + .check_ready = infrared_decoder_pioneer_check_ready, + .free = infrared_decoder_pioneer_free}, + .encoder = + {.alloc = infrared_encoder_pioneer_alloc, + .encode = infrared_encoder_pioneer_encode, + .reset = infrared_encoder_pioneer_reset, + .free = infrared_encoder_pioneer_free}, + .get_protocol_variant = infrared_protocol_pioneer_get_variant, + }, { .decoder = {.alloc = infrared_decoder_kaseikyo_alloc, diff --git a/lib/infrared/encoder_decoder/infrared.h b/lib/infrared/encoder_decoder/infrared.h index ada449b9831..377ce0ef27a 100644 --- a/lib/infrared/encoder_decoder/infrared.h +++ b/lib/infrared/encoder_decoder/infrared.h @@ -34,6 +34,8 @@ typedef enum { InfraredProtocolSIRC20, InfraredProtocolKaseikyo, InfraredProtocolRCA, + InfraredProtocolPioneer, + /* Add new protocols here */ InfraredProtocolMAX, } InfraredProtocol; diff --git a/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo.c b/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo.c index 0c61be3bf8c..63179cff39b 100644 --- a/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo.c +++ b/lib/infrared/encoder_decoder/kaseikyo/infrared_protocol_kaseikyo.c @@ -15,7 +15,6 @@ const InfraredCommonProtocolSpec infrared_protocol_kaseikyo = { .min_split_time = INFRARED_KASEIKYO_MIN_SPLIT_TIME, }, .databit_len[0] = 48, - .no_stop_bit = false, .decode = infrared_common_decode_pdwm, .encode = infrared_common_encode_pdwm, .interpret = infrared_decoder_kaseikyo_interpret, diff --git a/lib/infrared/encoder_decoder/nec/infrared_protocol_nec.c b/lib/infrared/encoder_decoder/nec/infrared_protocol_nec.c index 3444f78b612..bfd6d55fbab 100644 --- a/lib/infrared/encoder_decoder/nec/infrared_protocol_nec.c +++ b/lib/infrared/encoder_decoder/nec/infrared_protocol_nec.c @@ -16,7 +16,6 @@ const InfraredCommonProtocolSpec infrared_protocol_nec = { }, .databit_len[0] = 42, .databit_len[1] = 32, - .no_stop_bit = false, .decode = infrared_common_decode_pdwm, .encode = infrared_common_encode_pdwm, .interpret = infrared_decoder_nec_interpret, diff --git a/lib/infrared/encoder_decoder/pioneer/infrared_decoder_pioneer.c b/lib/infrared/encoder_decoder/pioneer/infrared_decoder_pioneer.c new file mode 100644 index 00000000000..43c843bab3b --- /dev/null +++ b/lib/infrared/encoder_decoder/pioneer/infrared_decoder_pioneer.c @@ -0,0 +1,57 @@ +#include "infrared_protocol_pioneer_i.h" +#include + +InfraredMessage* infrared_decoder_pioneer_check_ready(void* ctx) { + return infrared_common_decoder_check_ready(ctx); +} + +bool infrared_decoder_pioneer_interpret(InfraredCommonDecoder* decoder) { + furi_assert(decoder); + + uint32_t* data = (void*)&decoder->data[0]; + uint8_t address = 0; + uint8_t command = 0; + InfraredProtocol protocol = InfraredProtocolUnknown; + + if(decoder->databit_cnt == decoder->protocol->databit_len[0] || + decoder->databit_cnt == decoder->protocol->databit_len[1]) { + address = *data & 0xFF; + uint8_t real_address_checksum = ~address; + uint8_t address_checksum = (*data >> 8) & 0xFF; + command = (*data >> 16) & 0xFF; + uint8_t real_command_checksum = ~command; + uint8_t command_checksum = (*data >> 24) & 0xFF; + if(address_checksum != real_address_checksum) { + return false; + } + if(command_checksum != real_command_checksum) { + return false; + } + protocol = InfraredProtocolPioneer; + } else { + return false; + } + + decoder->message.protocol = protocol; + decoder->message.address = address; + decoder->message.command = command; + decoder->message.repeat = false; + + return true; +} + +void* infrared_decoder_pioneer_alloc(void) { + return infrared_common_decoder_alloc(&infrared_protocol_pioneer); +} + +InfraredMessage* infrared_decoder_pioneer_decode(void* decoder, bool level, uint32_t duration) { + return infrared_common_decode(decoder, level, duration); +} + +void infrared_decoder_pioneer_free(void* decoder) { + infrared_common_decoder_free(decoder); +} + +void infrared_decoder_pioneer_reset(void* decoder) { + infrared_common_decoder_reset(decoder); +} diff --git a/lib/infrared/encoder_decoder/pioneer/infrared_encoder_pioneer.c b/lib/infrared/encoder_decoder/pioneer/infrared_encoder_pioneer.c new file mode 100644 index 00000000000..b72643d7539 --- /dev/null +++ b/lib/infrared/encoder_decoder/pioneer/infrared_encoder_pioneer.c @@ -0,0 +1,61 @@ +#include "infrared_protocol_pioneer_i.h" +#include + +void infrared_encoder_pioneer_reset(void* encoder_ptr, const InfraredMessage* message) { + furi_assert(encoder_ptr); + furi_assert(message); + + InfraredCommonEncoder* encoder = encoder_ptr; + infrared_common_encoder_reset(encoder); + + uint8_t* data = encoder->data; + + if(message->protocol == InfraredProtocolPioneer) { + data[0] = message->address & 0xFF; + data[1] = ~(message->address & 0xFF); + data[2] = message->command & 0xFF; + data[3] = ~(message->command & 0xFF); + data[4] = 0; + encoder->bits_to_encode = encoder->protocol->databit_len[0]; + } else { + furi_crash(); + } +} + +void* infrared_encoder_pioneer_alloc(void) { + return infrared_common_encoder_alloc(&infrared_protocol_pioneer); +} + +void infrared_encoder_pioneer_free(void* encoder_ptr) { + infrared_common_encoder_free(encoder_ptr); +} + +InfraredStatus infrared_encoder_pioneer_encode_repeat( + InfraredCommonEncoder* encoder, + uint32_t* duration, + bool* level) { + furi_assert(encoder); + + *duration = INFRARED_PIONEER_SILENCE; + *level = false; + + encoder->timings_sum = 0; + encoder->timings_encoded = 1; + encoder->bits_encoded = 0; + encoder->state = InfraredCommonEncoderStatePreamble; + + return InfraredStatusOk; +} + +InfraredStatus + infrared_encoder_pioneer_encode(void* encoder_ptr, uint32_t* duration, bool* level) { + InfraredCommonEncoder* encoder = encoder_ptr; + + InfraredStatus status = infrared_common_encode(encoder, duration, level); + if((status == InfraredStatusOk) && (encoder->bits_encoded == encoder->bits_to_encode)) { + furi_assert(!*level); + status = InfraredStatusDone; + encoder->state = InfraredCommonEncoderStateEncodeRepeat; + } + return status; +} diff --git a/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.c b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.c new file mode 100644 index 00000000000..dec60f17f14 --- /dev/null +++ b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.c @@ -0,0 +1,40 @@ +#include "infrared_protocol_pioneer_i.h" + +const InfraredCommonProtocolSpec infrared_protocol_pioneer = { + .timings = + { + .preamble_mark = INFRARED_PIONEER_PREAMBLE_MARK, + .preamble_space = INFRARED_PIONEER_PREAMBLE_SPACE, + .bit1_mark = INFRARED_PIONEER_BIT1_MARK, + .bit1_space = INFRARED_PIONEER_BIT1_SPACE, + .bit0_mark = INFRARED_PIONEER_BIT0_MARK, + .bit0_space = INFRARED_PIONEER_BIT0_SPACE, + .preamble_tolerance = INFRARED_PIONEER_PREAMBLE_TOLERANCE, + .bit_tolerance = INFRARED_PIONEER_BIT_TOLERANCE, + .silence_time = INFRARED_PIONEER_SILENCE, + .min_split_time = INFRARED_PIONEER_MIN_SPLIT_TIME, + }, + .databit_len[0] = 33, + .databit_len[1] = 32, + .decode = infrared_common_decode_pdwm, + .encode = infrared_common_encode_pdwm, + .interpret = infrared_decoder_pioneer_interpret, + .decode_repeat = NULL, + .encode_repeat = infrared_encoder_pioneer_encode_repeat, +}; + +static const InfraredProtocolVariant infrared_protocol_variant_pioneer = { + .name = "Pioneer", + .address_length = 8, + .command_length = 8, + .frequency = INFRARED_PIONEER_CARRIER_FREQUENCY, + .duty_cycle = INFRARED_PIONEER_DUTY_CYCLE, + .repeat_count = INFRARED_PIONEER_REPEAT_COUNT_MIN, +}; + +const InfraredProtocolVariant* infrared_protocol_pioneer_get_variant(InfraredProtocol protocol) { + if(protocol == InfraredProtocolPioneer) + return &infrared_protocol_variant_pioneer; + else + return NULL; +} diff --git a/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.h b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.h new file mode 100644 index 00000000000..d350cdaee28 --- /dev/null +++ b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer.h @@ -0,0 +1,36 @@ +#pragma once + +#include "../infrared_i.h" + +/*************************************************************************************************** +* Pioneer SR protocol description +* http://www.adrian-kingston.com/IRFormatPioneer.htm +**************************************************************************************************** +* Preamble Preamble Pulse Width Modulation Pause Entirely repeat +* mark space up to period message.. +* +* 8500 4250 33 bits (500, 1500) ...26000 8500 4250 +* __________ _ _ _ _ _ _ _ _ _ _ _ _ _ __________ _ _ +* ____ __________ _ _ _ __ __ __ _ _ __ __ _ _ ____________________ __________ _ +* +* In 33 bits of data there is: +* - 8 bits address +* - 8 bits address inverse +* - 8 bits command +* - 8 bits command inverse +* - 1 stop bit +***************************************************************************************************/ + +void* infrared_decoder_pioneer_alloc(void); +void infrared_decoder_pioneer_reset(void* decoder); +InfraredMessage* infrared_decoder_pioneer_check_ready(void* decoder); +void infrared_decoder_pioneer_free(void* decoder); +InfraredMessage* infrared_decoder_pioneer_decode(void* decoder, bool level, uint32_t duration); + +void* infrared_encoder_pioneer_alloc(void); +void infrared_encoder_pioneer_reset(void* encoder_ptr, const InfraredMessage* message); +void infrared_encoder_pioneer_free(void* decoder); +InfraredStatus + infrared_encoder_pioneer_encode(void* encoder_ptr, uint32_t* duration, bool* polarity); + +const InfraredProtocolVariant* infrared_protocol_pioneer_get_variant(InfraredProtocol protocol); diff --git a/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h new file mode 100644 index 00000000000..2ff7f7e3a05 --- /dev/null +++ b/lib/infrared/encoder_decoder/pioneer/infrared_protocol_pioneer_i.h @@ -0,0 +1,25 @@ +#pragma once + +#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_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 + +extern const InfraredCommonProtocolSpec infrared_protocol_pioneer; + +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 diff --git a/lib/infrared/encoder_decoder/rca/infrared_protocol_rca.c b/lib/infrared/encoder_decoder/rca/infrared_protocol_rca.c index 8e1e76dbd37..f4a34ae2e0e 100644 --- a/lib/infrared/encoder_decoder/rca/infrared_protocol_rca.c +++ b/lib/infrared/encoder_decoder/rca/infrared_protocol_rca.c @@ -15,7 +15,6 @@ const InfraredCommonProtocolSpec infrared_protocol_rca = { .min_split_time = INFRARED_RCA_MIN_SPLIT_TIME, }, .databit_len[0] = 24, - .no_stop_bit = false, .decode = infrared_common_decode_pdwm, .encode = infrared_common_encode_pdwm, .interpret = infrared_decoder_rca_interpret, diff --git a/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung.c b/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung.c index ca78726acf9..5877911cdba 100644 --- a/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung.c +++ b/lib/infrared/encoder_decoder/samsung/infrared_protocol_samsung.c @@ -15,7 +15,6 @@ const InfraredCommonProtocolSpec infrared_protocol_samsung32 = { .min_split_time = INFRARED_SAMSUNG_MIN_SPLIT_TIME, }, .databit_len[0] = 32, - .no_stop_bit = false, .decode = infrared_common_decode_pdwm, .encode = infrared_common_encode_pdwm, .interpret = infrared_decoder_samsung32_interpret, diff --git a/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc.c b/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc.c index b527fba980c..f5950b88d78 100644 --- a/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc.c +++ b/lib/infrared/encoder_decoder/sirc/infrared_protocol_sirc.c @@ -17,7 +17,6 @@ const InfraredCommonProtocolSpec infrared_protocol_sirc = { .databit_len[0] = 20, .databit_len[1] = 15, .databit_len[2] = 12, - .no_stop_bit = true, .decode = infrared_common_decode_pdwm, .encode = infrared_common_encode_pdwm, .interpret = infrared_decoder_sirc_interpret, From 6947d3dea296a71f4118ae321c9da816f7f31b10 Mon Sep 17 00:00:00 2001 From: hedger Date: Fri, 22 Mar 2024 16:36:05 +0400 Subject: [PATCH 17/28] BLE/GAP fixes (#3533) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * hal: fixed ble_gap race on queue init * fbt: removed deprecated path_as_posix * hal: fixed inconsistencies between f7/f18 APIs * hal: fixed excessively strict event handler re-init checks Co-authored-by: あく --- SConstruct | 2 +- scripts/fbt/util.py | 6 ------ targets/f18/api_symbols.csv | 4 ++-- targets/f7/api_symbols.csv | 2 +- targets/f7/ble_glue/ble_event_thread.c | 2 +- targets/f7/ble_glue/ble_glue.c | 4 ++-- targets/f7/ble_glue/furi_ble/event_dispatcher.c | 10 +++++----- targets/f7/ble_glue/furi_ble/gatt.c | 2 +- targets/f7/ble_glue/gap.c | 10 ++++++---- 9 files changed, 19 insertions(+), 23 deletions(-) diff --git a/SConstruct b/SConstruct index b48b1c6847e..a57714a3ce2 100644 --- a/SConstruct +++ b/SConstruct @@ -7,7 +7,7 @@ # construction of certain targets behind command-line options. import os -from fbt.util import path_as_posix, open_browser_action +from fbt.util import open_browser_action DefaultEnvironment(tools=[]) diff --git a/scripts/fbt/util.py b/scripts/fbt/util.py index 19fdb3ae658..1becd51bb20 100644 --- a/scripts/fbt/util.py +++ b/scripts/fbt/util.py @@ -104,12 +104,6 @@ def __call__(self, target, source, env, for_signature): return self.fix_path(env.subst(self.pathobj)) -def path_as_posix(path): - if SCons.Platform.platform_default() == "win32": - return path.replace(os.path.sep, os.path.altsep) - return path - - def open_browser_action(target, source, env): if sys.platform == "darwin": subprocess.run(["open", source[0].abspath]) diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 2a30a7690bd..83d2c03f7f1 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -639,8 +639,8 @@ Function,+,ble_glue_is_alive,_Bool, Function,+,ble_glue_is_radio_stack_ready,_Bool, Function,+,ble_glue_reinit_c2,_Bool, Function,+,ble_glue_set_key_storage_changed_callback,void,"BleGlueKeyStorageChangedCallback, void*" -Function,+,ble_glue_start,_Bool, -Function,+,ble_glue_stop,void, +Function,-,ble_glue_start,_Bool, +Function,-,ble_glue_stop,void, Function,+,ble_glue_wait_for_c2_start,_Bool,int32_t Function,-,ble_profile_hid_consumer_key_press,_Bool,"FuriHalBleProfileBase*, uint16_t" Function,-,ble_profile_hid_consumer_key_release,_Bool,"FuriHalBleProfileBase*, uint16_t" diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 8c03a6676c5..a843fcf7261 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -685,7 +685,7 @@ Function,-,ble_app_get_key_storage_buff,void,"uint8_t**, uint16_t*" Function,-,ble_app_init,_Bool, Function,-,ble_event_app_notification,BleEventFlowStatus,void* Function,-,ble_event_dispatcher_init,void, -Function,+,ble_event_dispatcher_process_event,BleEventFlowStatus,void* +Function,-,ble_event_dispatcher_process_event,BleEventFlowStatus,void* Function,+,ble_event_dispatcher_register_svc_handler,GapSvcEventHandler*,"BleSvcEventHandlerCb, void*" Function,-,ble_event_dispatcher_reset,void, Function,+,ble_event_dispatcher_unregister_svc_handler,void,GapSvcEventHandler* diff --git a/targets/f7/ble_glue/ble_event_thread.c b/targets/f7/ble_glue/ble_event_thread.c index 6f9a1cdcd33..deafbb9a484 100644 --- a/targets/f7/ble_glue/ble_event_thread.c +++ b/targets/f7/ble_glue/ble_event_thread.c @@ -80,7 +80,7 @@ void ble_event_thread_stop(void) { } FuriThreadId thread_id = furi_thread_get_id(event_thread); - furi_assert(thread_id); + furi_check(thread_id); furi_thread_flags_set(thread_id, BLE_EVENT_THREAD_FLAG_KILL_THREAD); furi_thread_join(event_thread); furi_thread_free(event_thread); diff --git a/targets/f7/ble_glue/ble_glue.c b/targets/f7/ble_glue/ble_glue.c index b2e42b8daa0..ecc2f83c510 100644 --- a/targets/f7/ble_glue/ble_glue.c +++ b/targets/f7/ble_glue/ble_glue.c @@ -224,7 +224,7 @@ bool ble_glue_wait_for_c2_start(int32_t timeout_ms) { } bool ble_glue_start(void) { - furi_assert(ble_glue); + furi_check(ble_glue); if(ble_glue->status != BleGlueStatusC2Started) { return false; @@ -243,7 +243,7 @@ bool ble_glue_start(void) { } void ble_glue_stop(void) { - furi_assert(ble_glue); + furi_check(ble_glue); ble_event_thread_stop(); // Free resources diff --git a/targets/f7/ble_glue/furi_ble/event_dispatcher.c b/targets/f7/ble_glue/furi_ble/event_dispatcher.c index ce3661d6d9a..19f60afb540 100644 --- a/targets/f7/ble_glue/furi_ble/event_dispatcher.c +++ b/targets/f7/ble_glue/furi_ble/event_dispatcher.c @@ -50,14 +50,14 @@ BleEventFlowStatus ble_event_dispatcher_process_event(void* payload) { } void ble_event_dispatcher_init(void) { - furi_assert(!initialized); - - GapSvcEventHandlerList_init(handlers); - initialized = true; + if(!initialized) { + GapSvcEventHandlerList_init(handlers); + initialized = true; + } } void ble_event_dispatcher_reset(void) { - furi_assert(initialized); + furi_check(initialized); furi_check(GapSvcEventHandlerList_size(handlers) == 0); GapSvcEventHandlerList_clear(handlers); diff --git a/targets/f7/ble_glue/furi_ble/gatt.c b/targets/f7/ble_glue/furi_ble/gatt.c index 4603f4be090..e407865833c 100644 --- a/targets/f7/ble_glue/furi_ble/gatt.c +++ b/targets/f7/ble_glue/furi_ble/gatt.c @@ -90,7 +90,7 @@ bool ble_gatt_characteristic_update( uint16_t svc_handle, BleGattCharacteristicInstance* char_instance, const void* source) { - furi_assert(char_instance); + furi_check(char_instance); const BleGattCharacteristicParams* char_descriptor = char_instance->characteristic; FURI_LOG_D(TAG, "Updating %s char", char_descriptor->name); diff --git a/targets/f7/ble_glue/gap.c b/targets/f7/ble_glue/gap.c index 86623b02fb2..fded66a9b4a 100644 --- a/targets/f7/ble_glue/gap.c +++ b/targets/f7/ble_glue/gap.c @@ -60,7 +60,7 @@ static void gap_advertise_start(GapState new_state); static int32_t gap_app(void* context); static void gap_verify_connection_parameters(Gap* gap) { - furi_assert(gap); + furi_check(gap); FURI_LOG_I( TAG, @@ -480,6 +480,8 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) { return false; } + furi_check(gap == NULL); + gap = malloc(sizeof(Gap)); gap->config = config; // Create advertising timer @@ -494,13 +496,13 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) { gap->service.connection_handle = 0xFFFF; gap->enable_adv = true; + // Command queue allocation + gap->command_queue = furi_message_queue_alloc(8, sizeof(GapCommand)); + // Thread configuration gap->thread = furi_thread_alloc_ex("BleGapDriver", 1024, gap_app, gap); furi_thread_start(gap->thread); - // Command queue allocation - gap->command_queue = furi_message_queue_alloc(8, sizeof(GapCommand)); - uint8_t adv_service_uid[2]; gap->service.adv_svc_uuid_len = 1; adv_service_uid[0] = gap->config->adv_service_uuid & 0xff; From 0a48658a9acbd1cf756376d6d80e8fe681d4ad11 Mon Sep 17 00:00:00 2001 From: WillyJL <49810075+Willy-JL@users.noreply.github.com> Date: Sat, 23 Mar 2024 05:54:01 +0000 Subject: [PATCH 18/28] GUI: Fix elements module for new canvas API (#3527) * GUI: Fix elements module for new canvas API * Update symbols * Update f18 symbols * Gui: update elements for new canvas Co-authored-by: hedger Co-authored-by: Aleksandr Kutuzov --- applications/services/gui/elements.c | 300 ++++++++++++++------------- applications/services/gui/elements.h | 79 ++++--- targets/f18/api_symbols.csv | 34 +-- targets/f7/api_symbols.csv | 34 +-- 4 files changed, 223 insertions(+), 224 deletions(-) diff --git a/applications/services/gui/elements.c b/applications/services/gui/elements.c index dfdd6c03465..d488cbfc6ec 100644 --- a/applications/services/gui/elements.c +++ b/applications/services/gui/elements.c @@ -17,50 +17,50 @@ #include typedef struct { - uint8_t x; - uint8_t y; - uint8_t leading_min; - uint8_t leading_default; - uint8_t height; - uint8_t descender; - uint8_t len; + int32_t x; + int32_t y; + int32_t leading_min; + int32_t leading_default; + size_t height; + size_t descender; + size_t len; const char* text; } ElementTextBoxLine; -void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress) { +void elements_progress_bar(Canvas* canvas, int32_t x, int32_t y, size_t width, float progress) { furi_check(canvas); furi_check((progress >= 0.0f) && (progress <= 1.0f)); - uint8_t height = 9; + size_t height = 9; - uint8_t progress_length = roundf(progress * (width - 2)); + float progress_width = roundf(progress * (width - 2)); canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, x + 1, y + 1, width - 2, height - 2); canvas_set_color(canvas, ColorBlack); canvas_draw_rframe(canvas, x, y, width, height, 3); - canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2); + canvas_draw_box(canvas, x + 1, y + 1, progress_width, height - 2); } void elements_progress_bar_with_text( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, + int32_t x, + int32_t y, + size_t width, float progress, const char* text) { furi_check(canvas); furi_check((progress >= 0.0f) && (progress <= 1.0f)); - uint8_t height = 11; + size_t height = 11; - uint8_t progress_length = roundf(progress * (width - 2)); + float progress_width = roundf(progress * (width - 2)); canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, x + 1, y + 1, width - 2, height - 2); canvas_set_color(canvas, ColorBlack); canvas_draw_rframe(canvas, x, y, width, height, 3); - canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2); + canvas_draw_box(canvas, x + 1, y + 1, progress_width, height - 2); canvas_set_color(canvas, ColorXOR); canvas_set_font(canvas, FontSecondary); @@ -69,20 +69,23 @@ void elements_progress_bar_with_text( void elements_scrollbar_pos( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t height, - uint16_t pos, - uint16_t total) { + int32_t x, + int32_t y, + size_t height, + size_t pos, + size_t total) { furi_check(canvas); + // prevent overflows canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, x - 3, y, 3, height); + // dot line canvas_set_color(canvas, ColorBlack); - for(uint8_t i = y; i < height + y; i += 2) { + for(int32_t i = y; i < (int32_t)height + y; i += 2) { canvas_draw_dot(canvas, x - 2, i); } + // Position block if(total) { float block_h = ((float)height) / total; @@ -90,19 +93,22 @@ void elements_scrollbar_pos( } } -void elements_scrollbar(Canvas* canvas, uint16_t pos, uint16_t total) { +void elements_scrollbar(Canvas* canvas, size_t pos, size_t total) { furi_check(canvas); - uint8_t width = canvas_width(canvas); - uint8_t height = canvas_height(canvas); + size_t width = canvas_width(canvas); + size_t height = canvas_height(canvas); + // prevent overflows canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, width - 3, 0, 3, height); + // dot line canvas_set_color(canvas, ColorBlack); - for(uint8_t i = 0; i < height; i += 2) { + for(size_t i = 0; i < height; i += 2) { canvas_draw_dot(canvas, width - 2, i); } + // Position block if(total) { float block_h = ((float)height) / total; @@ -110,7 +116,7 @@ void elements_scrollbar(Canvas* canvas, uint16_t pos, uint16_t total) { } } -void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { +void elements_frame(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height) { furi_check(canvas); canvas_draw_line(canvas, x + 2, y, x + width - 2, y); @@ -127,18 +133,18 @@ void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t void elements_button_left(Canvas* canvas, const char* str) { furi_check(canvas); - const uint8_t button_height = 12; - const uint8_t vertical_offset = 3; - const uint8_t horizontal_offset = 3; - const uint8_t string_width = canvas_string_width(canvas, str); + const size_t button_height = 12; + const size_t vertical_offset = 3; + const size_t horizontal_offset = 3; + const size_t string_width = canvas_string_width(canvas, str); const Icon* icon = &I_ButtonLeft_4x7; - const uint8_t icon_h_offset = 3; - const uint8_t icon_width_with_offset = icon->width + icon_h_offset; - const uint8_t icon_v_offset = icon->height + vertical_offset; - const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; + const int32_t icon_h_offset = 3; + const int32_t icon_width_with_offset = icon->width + icon_h_offset; + const int32_t icon_v_offset = icon->height + vertical_offset; + const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; - const uint8_t x = 0; - const uint8_t y = canvas_height(canvas); + const int32_t x = 0; + const int32_t y = canvas_height(canvas); canvas_draw_box(canvas, x, y - button_height, button_width, button_height); canvas_draw_line(canvas, x + button_width + 0, y, x + button_width + 0, y - button_height + 0); @@ -155,18 +161,18 @@ void elements_button_left(Canvas* canvas, const char* str) { void elements_button_right(Canvas* canvas, const char* str) { furi_check(canvas); - const uint8_t button_height = 12; - const uint8_t vertical_offset = 3; - const uint8_t horizontal_offset = 3; - const uint8_t string_width = canvas_string_width(canvas, str); + const size_t button_height = 12; + const size_t vertical_offset = 3; + const size_t horizontal_offset = 3; + const size_t string_width = canvas_string_width(canvas, str); const Icon* icon = &I_ButtonRight_4x7; - const uint8_t icon_h_offset = 3; - const uint8_t icon_width_with_offset = icon->width + icon_h_offset; - const uint8_t icon_v_offset = icon->height + vertical_offset; - const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; + const int32_t icon_h_offset = 3; + const int32_t icon_width_with_offset = icon->width + icon_h_offset; + const int32_t icon_v_offset = icon->height + vertical_offset; + const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; - const uint8_t x = canvas_width(canvas); - const uint8_t y = canvas_height(canvas); + const int32_t x = canvas_width(canvas); + const int32_t y = canvas_height(canvas); canvas_draw_box(canvas, x - button_width, y - button_height, button_width, button_height); canvas_draw_line(canvas, x - button_width - 1, y, x - button_width - 1, y - button_height + 0); @@ -183,18 +189,18 @@ void elements_button_right(Canvas* canvas, const char* str) { void elements_button_center(Canvas* canvas, const char* str) { furi_check(canvas); - const uint8_t button_height = 12; - const uint8_t vertical_offset = 3; - const uint8_t horizontal_offset = 1; - const uint8_t string_width = canvas_string_width(canvas, str); + const size_t button_height = 12; + const size_t vertical_offset = 3; + const size_t horizontal_offset = 1; + const size_t string_width = canvas_string_width(canvas, str); const Icon* icon = &I_ButtonCenter_7x7; - const uint8_t icon_h_offset = 3; - const uint8_t icon_width_with_offset = icon->width + icon_h_offset; - const uint8_t icon_v_offset = icon->height + vertical_offset; - const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; + const int32_t icon_h_offset = 3; + const int32_t icon_width_with_offset = icon->width + icon_h_offset; + const int32_t icon_v_offset = icon->height + vertical_offset; + const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; - const uint8_t x = (canvas_width(canvas) - button_width) / 2; - const uint8_t y = canvas_height(canvas); + const int32_t x = (canvas_width(canvas) - button_width) / 2; + const int32_t y = canvas_height(canvas); canvas_draw_box(canvas, x, y - button_height, button_width, button_height); @@ -214,7 +220,7 @@ void elements_button_center(Canvas* canvas, const char* str) { } static size_t - elements_get_max_chars_to_fit(Canvas* canvas, Align horizontal, const char* text, uint8_t x) { + elements_get_max_chars_to_fit(Canvas* canvas, Align horizontal, const char* text, int32_t x) { const char* end = strchr(text, '\n'); if(end == NULL) { end = text + strlen(text); @@ -225,10 +231,10 @@ static size_t furi_string_left(str, text_size); size_t result = 0; - uint16_t len_px = canvas_string_width(canvas, furi_string_get_cstr(str)); - uint8_t px_left = 0; + size_t len_px = canvas_string_width(canvas, furi_string_get_cstr(str)); + size_t px_left = 0; if(horizontal == AlignCenter) { - if(x > (canvas_width(canvas) / 2)) { + if(x > (int32_t)(canvas_width(canvas) / 2)) { px_left = (canvas_width(canvas) - x) * 2; } else { px_left = x * 2; @@ -261,16 +267,16 @@ static size_t void elements_multiline_text_aligned( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, Align horizontal, Align vertical, const char* text) { furi_check(canvas); furi_check(text); - uint8_t lines_count = 0; - uint8_t font_height = canvas_current_font_height(canvas); + size_t lines_count = 0; + size_t font_height = canvas_current_font_height(canvas); FuriString* line; /* go through text line by line and count lines */ @@ -302,7 +308,7 @@ void elements_multiline_text_aligned( canvas_draw_str_aligned(canvas, x, y, horizontal, vertical, furi_string_get_cstr(line)); furi_string_free(line); y += font_height; - if(y > canvas_height(canvas)) { + if(y > (int32_t)canvas_height(canvas)) { break; } @@ -311,11 +317,11 @@ void elements_multiline_text_aligned( } } -void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* text) { +void elements_multiline_text(Canvas* canvas, int32_t x, int32_t y, const char* text) { furi_check(canvas); furi_check(text); - uint8_t font_height = canvas_current_font_height(canvas); + size_t font_height = canvas_current_font_height(canvas); FuriString* str; str = furi_string_alloc(); const char* start = text; @@ -334,57 +340,53 @@ void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* t furi_string_free(str); } -void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text) { +void elements_multiline_text_framed(Canvas* canvas, int32_t x, int32_t y, const char* text) { furi_check(canvas); furi_check(text); - uint8_t font_y = canvas_current_font_height(canvas); - uint16_t str_width = canvas_string_width(canvas, text); + size_t font_height = canvas_current_font_height(canvas); + size_t str_width = canvas_string_width(canvas, text); + // count \n's - uint8_t lines = 1; + size_t lines = 1; const char* t = text; while(*t != '\0') { if(*t == '\n') { lines++; - uint16_t temp_width = canvas_string_width(canvas, t + 1); + size_t temp_width = canvas_string_width(canvas, t + 1); str_width = temp_width > str_width ? temp_width : str_width; } t++; } canvas_set_color(canvas, ColorWhite); - canvas_draw_box(canvas, x, y - font_y, str_width + 8, font_y * lines + 4); + canvas_draw_box(canvas, x, y - font_height, str_width + 8, font_height * lines + 4); canvas_set_color(canvas, ColorBlack); elements_multiline_text(canvas, x + 4, y - 1, text); - elements_frame(canvas, x, y - font_y, str_width + 8, font_y * lines + 4); + elements_frame(canvas, x, y - font_height, str_width + 8, font_height * lines + 4); } void elements_slightly_rounded_frame( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height) { + int32_t x, + int32_t y, + size_t width, + size_t height) { furi_check(canvas); canvas_draw_rframe(canvas, x, y, width, height, 1); } void elements_slightly_rounded_box( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height) { + int32_t x, + int32_t y, + size_t width, + size_t height) { furi_check(canvas); canvas_draw_rbox(canvas, x, y, width, height, 1); } -void elements_bold_rounded_frame( - Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height) { +void elements_bold_rounded_frame(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height) { furi_check(canvas); canvas_set_color(canvas, ColorWhite); @@ -420,10 +422,10 @@ void elements_bold_rounded_frame( canvas_draw_dot(canvas, x + width - 2, y + height - 3); } -void elements_bubble(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height) { +void elements_bubble(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height) { furi_check(canvas); canvas_draw_rframe(canvas, x + 4, y, width, height, 3); - uint8_t y_corner = y + height * 2 / 3; + int32_t y_corner = y + height * 2 / 3; canvas_draw_line(canvas, x, y_corner, x + 4, y_corner - 4); canvas_draw_line(canvas, x, y_corner, x + 4, y_corner + 4); canvas_set_color(canvas, ColorWhite); @@ -433,45 +435,46 @@ void elements_bubble(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_ void elements_bubble_str( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, const char* text, Align horizontal, Align vertical) { furi_check(canvas); furi_check(text); - uint8_t font_y = canvas_current_font_height(canvas); - uint16_t str_width = canvas_string_width(canvas, text); + size_t font_height = canvas_current_font_height(canvas); + size_t str_width = canvas_string_width(canvas, text); + // count \n's - uint8_t lines = 1; + size_t lines = 1; const char* t = text; while(*t != '\0') { if(*t == '\n') { lines++; - uint16_t temp_width = canvas_string_width(canvas, t + 1); + size_t temp_width = canvas_string_width(canvas, t + 1); str_width = temp_width > str_width ? temp_width : str_width; } t++; } - uint8_t frame_x = x; - uint8_t frame_y = y; - uint8_t frame_width = str_width + 8; - uint8_t frame_height = font_y * lines + 4; + int32_t frame_x = x; + int32_t frame_y = y; + size_t frame_width = str_width + 8; + size_t frame_height = font_height * lines + 4; canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, frame_x + 1, frame_y + 1, frame_width - 2, frame_height - 2); canvas_set_color(canvas, ColorBlack); canvas_draw_rframe(canvas, frame_x, frame_y, frame_width, frame_height, 1); - elements_multiline_text(canvas, x + 4, y - 1 + font_y, text); - - uint8_t x1 = 0; - uint8_t x2 = 0; - uint8_t x3 = 0; - uint8_t y1 = 0; - uint8_t y2 = 0; - uint8_t y3 = 0; + elements_multiline_text(canvas, x + 4, y - 1 + font_height, text); + + int32_t x1 = 0; + int32_t x2 = 0; + int32_t x3 = 0; + int32_t y1 = 0; + int32_t y2 = 0; + int32_t y3 = 0; if((horizontal == AlignLeft) && (vertical == AlignTop)) { x1 = frame_x; y1 = frame_y; @@ -565,11 +568,11 @@ void elements_bubble_str( canvas_draw_line(canvas, x2, y2, x3, y3); } -void elements_string_fit_width(Canvas* canvas, FuriString* string, uint8_t width) { +void elements_string_fit_width(Canvas* canvas, FuriString* string, size_t width) { furi_check(canvas); furi_check(string); - uint16_t len_px = canvas_string_width(canvas, furi_string_get_cstr(string)); + size_t len_px = canvas_string_width(canvas, furi_string_get_cstr(string)); if(len_px > width) { width -= canvas_string_width(canvas, "..."); do { @@ -582,9 +585,9 @@ void elements_string_fit_width(Canvas* canvas, FuriString* string, uint8_t width void elements_scrollable_text_line( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, + int32_t x, + int32_t y, + size_t width, FuriString* string, size_t scroll, bool ellipsis) { @@ -632,10 +635,10 @@ void elements_scrollable_text_line( void elements_text_box( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, + int32_t x, + int32_t y, + size_t width, + size_t height, Align horizontal, Align vertical, const char* text, @@ -645,25 +648,25 @@ void elements_text_box( ElementTextBoxLine line[ELEMENTS_MAX_LINES_NUM]; bool bold = false; bool mono = false; - bool inversed = false; - bool inversed_present = false; + bool inverse = false; + bool inverse_present = false; Font current_font = FontSecondary; Font prev_font = FontSecondary; const CanvasFontParameters* font_params = canvas_get_font_params(canvas, current_font); // Fill line parameters - uint8_t line_leading_min = font_params->leading_min; - uint8_t line_leading_default = font_params->leading_default; - uint8_t line_height = font_params->height; - uint8_t line_descender = font_params->descender; - uint8_t line_num = 0; - uint8_t line_width = 0; - uint8_t line_len = 0; - uint8_t total_height_min = 0; - uint8_t total_height_default = 0; - uint16_t i = 0; + size_t line_leading_min = font_params->leading_min; + size_t line_leading_default = font_params->leading_default; + size_t line_height = font_params->height; + size_t line_descender = font_params->descender; + size_t line_num = 0; + size_t line_width = 0; + size_t line_len = 0; + size_t total_height_min = 0; + size_t total_height_default = 0; + size_t i = 0; bool full_text_processed = false; - uint16_t dots_width = canvas_string_width(canvas, "..."); + size_t dots_width = canvas_string_width(canvas, "..."); canvas_set_font(canvas, FontSecondary); @@ -702,8 +705,8 @@ void elements_text_box( canvas_set_font(canvas, FontKeyboard); mono = !mono; } - if(text[i] == ELEMENTS_INVERSED_MARKER) { - inversed_present = true; + if(text[i] == ELEMENTS_INVERSE_MARKER) { + inverse_present = true; } continue; } @@ -719,10 +722,10 @@ void elements_text_box( if(text[i] == '\0') { full_text_processed = true; } - if(inversed_present) { + if(inverse_present) { line_leading_min += 1; line_leading_default += 1; - inversed_present = false; + inverse_present = false; } line[line_num].leading_min = line_leading_min; line[line_num].leading_default = line_leading_default; @@ -765,14 +768,14 @@ void elements_text_box( line[0].y = y + line[0].height + (height - total_height_default); } if(line_num > 1) { - for(uint8_t i = 1; i < line_num; i++) { + for(size_t i = 1; i < line_num; i++) { line[i].y = line[i - 1].y + line[i - 1].leading_default; } } } else if(line_num > 1) { - uint8_t free_pixel_num = height - total_height_min; - uint8_t fill_pixel = 0; - uint8_t j = 1; + size_t free_pixel_num = height - total_height_min; + size_t fill_pixel = 0; + size_t j = 1; line[0].y = y + line[0].height; while(fill_pixel < free_pixel_num) { line[j].y = line[j - 1].y + line[j - 1].leading_min + 1; @@ -785,9 +788,9 @@ void elements_text_box( canvas_set_font(canvas, FontSecondary); bold = false; mono = false; - inversed = false; - for(uint8_t i = 0; i < line_num; i++) { - for(uint8_t j = 0; j < line[i].len; j++) { + inverse = false; + for(size_t i = 0; i < line_num; i++) { + for(size_t j = 0; j < line[i].len; j++) { // Process format symbols if(line[i].text[j] == ELEMENTS_BOLD_MARKER) { if(bold) { @@ -809,11 +812,11 @@ void elements_text_box( mono = !mono; continue; } - if(line[i].text[j] == ELEMENTS_INVERSED_MARKER) { - inversed = !inversed; + if(line[i].text[j] == ELEMENTS_INVERSE_MARKER) { + inverse = !inverse; continue; } - if(inversed) { + if(inverse) { canvas_draw_box( canvas, line[i].x - 1, @@ -825,8 +828,9 @@ void elements_text_box( canvas_invert_color(canvas); } else { if((i == line_num - 1) && strip_to_dots) { - uint8_t next_symbol_width = canvas_glyph_width(canvas, line[i].text[j]); - if(line[i].x + next_symbol_width + dots_width > x + width) { + size_t next_symbol_width = canvas_glyph_width(canvas, line[i].text[j]); + if((line[i].x + (int32_t)next_symbol_width + (int32_t)dots_width) > + (x + (int32_t)width)) { canvas_draw_str(canvas, line[i].x, line[i].y, "..."); break; } diff --git a/applications/services/gui/elements.h b/applications/services/gui/elements.h index dbaf6d68108..833d5d6eec4 100644 --- a/applications/services/gui/elements.h +++ b/applications/services/gui/elements.h @@ -19,7 +19,7 @@ extern "C" { #define ELEMENTS_MAX_LINES_NUM (7) #define ELEMENTS_BOLD_MARKER '#' #define ELEMENTS_MONO_MARKER '*' -#define ELEMENTS_INVERSED_MARKER '!' +#define ELEMENTS_INVERSE_MARKER '!' /** Draw progress bar. * @@ -29,7 +29,7 @@ extern "C" { * @param width progress bar width * @param progress progress (0.0 - 1.0) */ -void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress); +void elements_progress_bar(Canvas* canvas, int32_t x, int32_t y, size_t width, float progress); /** Draw progress bar with text. * @@ -42,9 +42,9 @@ void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, */ void elements_progress_bar_with_text( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, + int32_t x, + int32_t y, + size_t width, float progress, const char* text); @@ -59,11 +59,11 @@ void elements_progress_bar_with_text( */ void elements_scrollbar_pos( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t height, - uint16_t pos, - uint16_t total); + int32_t x, + int32_t y, + size_t height, + size_t pos, + size_t total); /** Draw scrollbar on canvas. * @note width 3px, height equal to canvas height @@ -72,7 +72,7 @@ void elements_scrollbar_pos( * @param pos current element of total elements * @param total total elements */ -void elements_scrollbar(Canvas* canvas, uint16_t pos, uint16_t total); +void elements_scrollbar(Canvas* canvas, size_t pos, size_t total); /** Draw rounded frame * @@ -80,7 +80,7 @@ void elements_scrollbar(Canvas* canvas, uint16_t pos, uint16_t total); * @param x, y top left corner coordinates * @param width, height frame width and height */ -void elements_frame(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); +void elements_frame(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height); /** Draw button in left corner * @@ -112,8 +112,8 @@ void elements_button_center(Canvas* canvas, const char* str); */ void elements_multiline_text_aligned( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, Align horizontal, Align vertical, const char* text); @@ -124,7 +124,7 @@ void elements_multiline_text_aligned( * @param x, y top left corner coordinates * @param text string (possible multiline) */ -void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* text); +void elements_multiline_text(Canvas* canvas, int32_t x, int32_t y, const char* text); /** Draw framed multiline text * @@ -132,7 +132,7 @@ void elements_multiline_text(Canvas* canvas, uint8_t x, uint8_t y, const char* t * @param x, y top left corner coordinates * @param text string (possible multiline) */ -void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const char* text); +void elements_multiline_text_framed(Canvas* canvas, int32_t x, int32_t y, const char* text); /** Draw slightly rounded frame * @@ -142,10 +142,10 @@ void elements_multiline_text_framed(Canvas* canvas, uint8_t x, uint8_t y, const */ void elements_slightly_rounded_frame( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height); + int32_t x, + int32_t y, + size_t width, + size_t height); /** Draw slightly rounded box * @@ -155,10 +155,10 @@ void elements_slightly_rounded_frame( */ void elements_slightly_rounded_box( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height); + int32_t x, + int32_t y, + size_t width, + size_t height); /** Draw bold rounded frame * @@ -166,12 +166,7 @@ void elements_slightly_rounded_box( * @param x, y top left corner coordinates * @param width, height size of frame */ -void elements_bold_rounded_frame( - Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height); +void elements_bold_rounded_frame(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height); /** Draw bubble frame for text * @@ -181,7 +176,7 @@ void elements_bold_rounded_frame( * @param width bubble width * @param height bubble height */ -void elements_bubble(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_t height); +void elements_bubble(Canvas* canvas, int32_t x, int32_t y, size_t width, size_t height); /** Draw bubble frame for text with corner * @@ -194,8 +189,8 @@ void elements_bubble(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, uint8_ */ void elements_bubble_str( Canvas* canvas, - uint8_t x, - uint8_t y, + int32_t x, + int32_t y, const char* text, Align horizontal, Align vertical); @@ -206,7 +201,7 @@ void elements_bubble_str( * @param string string to trim * @param width max width */ -void elements_string_fit_width(Canvas* canvas, FuriString* string, uint8_t width); +void elements_string_fit_width(Canvas* canvas, FuriString* string, size_t width); /** Draw scrollable text line * @@ -220,9 +215,9 @@ void elements_string_fit_width(Canvas* canvas, FuriString* string, uint8_t width */ void elements_scrollable_text_line( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, + int32_t x, + int32_t y, + size_t width, FuriString* string, size_t scroll, bool ellipsis); @@ -239,15 +234,15 @@ void elements_scrollable_text_line( * @param[in] text Formatted text. The following formats are available: * "\e#Bold text\e#" - bold font is used * "\e*Monospaced text\e*" - monospaced font is used - * "\e!Inversed text\e!" - white text on black background + * "\e!Inverted text\e!" - white text on black background * @param strip_to_dots Strip text to ... if does not fit to width */ void elements_text_box( Canvas* canvas, - uint8_t x, - uint8_t y, - uint8_t width, - uint8_t height, + int32_t x, + int32_t y, + size_t width, + size_t height, Align horizontal, Align vertical, const char* text, diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 83d2c03f7f1..f19a5428c56 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,59.0,, +Version,+,60.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -852,25 +852,25 @@ Function,-,dprintf,int,"int, const char*, ..." Function,-,drand48,double, Function,-,drem,double,"double, double" Function,-,dremf,float,"float, float" -Function,+,elements_bold_rounded_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_bubble,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_bubble_str,void,"Canvas*, uint8_t, uint8_t, const char*, Align, Align" +Function,+,elements_bold_rounded_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_bubble,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_bubble_str,void,"Canvas*, int32_t, int32_t, const char*, Align, Align" Function,+,elements_button_center,void,"Canvas*, const char*" Function,+,elements_button_left,void,"Canvas*, const char*" Function,+,elements_button_right,void,"Canvas*, const char*" -Function,+,elements_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_multiline_text,void,"Canvas*, uint8_t, uint8_t, const char*" -Function,+,elements_multiline_text_aligned,void,"Canvas*, uint8_t, uint8_t, Align, Align, const char*" -Function,+,elements_multiline_text_framed,void,"Canvas*, uint8_t, uint8_t, const char*" -Function,+,elements_progress_bar,void,"Canvas*, uint8_t, uint8_t, uint8_t, float" -Function,+,elements_progress_bar_with_text,void,"Canvas*, uint8_t, uint8_t, uint8_t, float, const char*" -Function,+,elements_scrollable_text_line,void,"Canvas*, uint8_t, uint8_t, uint8_t, FuriString*, size_t, _Bool" -Function,+,elements_scrollbar,void,"Canvas*, uint16_t, uint16_t" -Function,+,elements_scrollbar_pos,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t" -Function,+,elements_slightly_rounded_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_slightly_rounded_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_string_fit_width,void,"Canvas*, FuriString*, uint8_t" -Function,+,elements_text_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, Align, Align, const char*, _Bool" +Function,+,elements_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_multiline_text,void,"Canvas*, int32_t, int32_t, const char*" +Function,+,elements_multiline_text_aligned,void,"Canvas*, int32_t, int32_t, Align, Align, const char*" +Function,+,elements_multiline_text_framed,void,"Canvas*, int32_t, int32_t, const char*" +Function,+,elements_progress_bar,void,"Canvas*, int32_t, int32_t, size_t, float" +Function,+,elements_progress_bar_with_text,void,"Canvas*, int32_t, int32_t, size_t, float, const char*" +Function,+,elements_scrollable_text_line,void,"Canvas*, int32_t, int32_t, size_t, FuriString*, size_t, _Bool" +Function,+,elements_scrollbar,void,"Canvas*, size_t, size_t" +Function,+,elements_scrollbar_pos,void,"Canvas*, int32_t, int32_t, size_t, size_t, size_t" +Function,+,elements_slightly_rounded_box,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_slightly_rounded_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_string_fit_width,void,"Canvas*, FuriString*, size_t" +Function,+,elements_text_box,void,"Canvas*, int32_t, int32_t, size_t, size_t, Align, Align, const char*, _Bool" Function,+,elf_resolve_from_hashtable,_Bool,"const ElfApiInterface*, uint32_t, Elf32_Addr*" Function,+,elf_symbolname_hash,uint32_t,const char* Function,+,empty_screen_alloc,EmptyScreen*, diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index a843fcf7261..d1e91ddbedb 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,59.0,, +Version,+,60.0,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, @@ -920,25 +920,25 @@ Function,-,dprintf,int,"int, const char*, ..." Function,-,drand48,double, Function,-,drem,double,"double, double" Function,-,dremf,float,"float, float" -Function,+,elements_bold_rounded_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_bubble,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_bubble_str,void,"Canvas*, uint8_t, uint8_t, const char*, Align, Align" +Function,+,elements_bold_rounded_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_bubble,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_bubble_str,void,"Canvas*, int32_t, int32_t, const char*, Align, Align" Function,+,elements_button_center,void,"Canvas*, const char*" Function,+,elements_button_left,void,"Canvas*, const char*" Function,+,elements_button_right,void,"Canvas*, const char*" -Function,+,elements_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_multiline_text,void,"Canvas*, uint8_t, uint8_t, const char*" -Function,+,elements_multiline_text_aligned,void,"Canvas*, uint8_t, uint8_t, Align, Align, const char*" -Function,+,elements_multiline_text_framed,void,"Canvas*, uint8_t, uint8_t, const char*" -Function,+,elements_progress_bar,void,"Canvas*, uint8_t, uint8_t, uint8_t, float" -Function,+,elements_progress_bar_with_text,void,"Canvas*, uint8_t, uint8_t, uint8_t, float, const char*" -Function,+,elements_scrollable_text_line,void,"Canvas*, uint8_t, uint8_t, uint8_t, FuriString*, size_t, _Bool" -Function,+,elements_scrollbar,void,"Canvas*, uint16_t, uint16_t" -Function,+,elements_scrollbar_pos,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t" -Function,+,elements_slightly_rounded_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_slightly_rounded_frame,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,+,elements_string_fit_width,void,"Canvas*, FuriString*, uint8_t" -Function,+,elements_text_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, Align, Align, const char*, _Bool" +Function,+,elements_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_multiline_text,void,"Canvas*, int32_t, int32_t, const char*" +Function,+,elements_multiline_text_aligned,void,"Canvas*, int32_t, int32_t, Align, Align, const char*" +Function,+,elements_multiline_text_framed,void,"Canvas*, int32_t, int32_t, const char*" +Function,+,elements_progress_bar,void,"Canvas*, int32_t, int32_t, size_t, float" +Function,+,elements_progress_bar_with_text,void,"Canvas*, int32_t, int32_t, size_t, float, const char*" +Function,+,elements_scrollable_text_line,void,"Canvas*, int32_t, int32_t, size_t, FuriString*, size_t, _Bool" +Function,+,elements_scrollbar,void,"Canvas*, size_t, size_t" +Function,+,elements_scrollbar_pos,void,"Canvas*, int32_t, int32_t, size_t, size_t, size_t" +Function,+,elements_slightly_rounded_box,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_slightly_rounded_frame,void,"Canvas*, int32_t, int32_t, size_t, size_t" +Function,+,elements_string_fit_width,void,"Canvas*, FuriString*, size_t" +Function,+,elements_text_box,void,"Canvas*, int32_t, int32_t, size_t, size_t, Align, Align, const char*, _Bool" Function,+,elf_resolve_from_hashtable,_Bool,"const ElfApiInterface*, uint32_t, Elf32_Addr*" Function,+,elf_symbolname_hash,uint32_t,const char* Function,+,empty_screen_alloc,EmptyScreen*, From c52f28efa40773d926816ca7cdba8c8fea9cb825 Mon Sep 17 00:00:00 2001 From: WillyJL <49810075+Willy-JL@users.noreply.github.com> Date: Mon, 25 Mar 2024 06:28:20 +0000 Subject: [PATCH 19/28] GUI: Fix textbox overflow/crash/hang with 256+ lines (#3536) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * GUI: Fix textbox overflow/crash/hang with 256+ lines * GUI: Textbox calculate lines based on font height * Gui: proper types in text_box Co-authored-by: あく --- applications/services/gui/modules/text_box.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/applications/services/gui/modules/text_box.c b/applications/services/gui/modules/text_box.c index f80129eb93b..9c2959b301a 100644 --- a/applications/services/gui/modules/text_box.c +++ b/applications/services/gui/modules/text_box.c @@ -100,16 +100,19 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) { line_num++; model->text = furi_string_get_cstr(model->text_formatted); model->text_pos = (char*)model->text; - if(model->focus == TextBoxFocusEnd && line_num > 5) { + size_t lines_on_screen = 56 / canvas_current_font_height(canvas); + if(model->focus == TextBoxFocusEnd && line_num > lines_on_screen) { // Set text position to 5th line from the end - for(uint8_t i = 0; i < line_num - 5; i++) { - while(*model->text_pos++ != '\n') { - }; + const char* end = model->text + furi_string_size(model->text_formatted); + for(size_t i = 0; i < line_num - lines_on_screen; i++) { + while(model->text_pos < end) { + if(*model->text_pos++ == '\n') break; + } } - model->scroll_num = line_num - 4; - model->scroll_pos = line_num - 5; + model->scroll_num = line_num - (lines_on_screen - 1); + model->scroll_pos = line_num - lines_on_screen; } else { - model->scroll_num = MAX(line_num - 4, 0u); + model->scroll_num = MAX(line_num - (lines_on_screen - 1), 0u); model->scroll_pos = 0; } } From 23940bff8117c1ed4ac1446d34b390abe997a22a Mon Sep 17 00:00:00 2001 From: gornekich Date: Mon, 25 Mar 2024 06:36:17 +0000 Subject: [PATCH 20/28] [FL-3796], [FL-3795] NFC UI fixes (#3532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nfc app: fix navigation in select protocol scene * nfc app: fix text box position and size on emulation screen Co-authored-by: あく --- .../main/nfc/helpers/protocol_support/nfc_protocol_support.c | 2 +- applications/main/nfc/scenes/nfc_scene_select_protocol.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c index 80fbb63de07..2ba5c65ba14 100644 --- a/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c +++ b/applications/main/nfc/helpers/protocol_support/nfc_protocol_support.c @@ -600,7 +600,7 @@ static void nfc_protocol_support_scene_emulate_on_enter(NfcApp* instance) { } widget_add_text_box_element( - widget, 56, 33, 71, 25, AlignCenter, AlignTop, furi_string_get_cstr(temp_str), false); + widget, 50, 33, 78, 31, AlignCenter, AlignTop, furi_string_get_cstr(temp_str), false); furi_string_free(temp_str); diff --git a/applications/main/nfc/scenes/nfc_scene_select_protocol.c b/applications/main/nfc/scenes/nfc_scene_select_protocol.c index 52b2664ec61..af644035e80 100644 --- a/applications/main/nfc/scenes/nfc_scene_select_protocol.c +++ b/applications/main/nfc/scenes/nfc_scene_select_protocol.c @@ -57,6 +57,11 @@ bool nfc_scene_select_protocol_on_event(void* context, SceneManagerEvent event) scene_manager_set_scene_state( instance->scene_manager, NfcSceneSelectProtocol, event.event); consumed = true; + } else if(event.type == SceneManagerEventTypeBack) { + if(scene_manager_has_previous_scene(instance->scene_manager, NfcSceneDetect)) { + consumed = scene_manager_search_and_switch_to_previous_scene( + instance->scene_manager, NfcSceneStart); + } } return consumed; } From bf769ee3987223d4850c9547b90a73ed7ba63d8d Mon Sep 17 00:00:00 2001 From: Protik Banerji Date: Mon, 25 Mar 2024 07:42:42 +0100 Subject: [PATCH 21/28] Add Dutch Originals Sound Bar IR codes to infrared app (#3529) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Dutch Originals Soundbar IR codes * Switch change_input button to next and prev Co-authored-by: あく --- .../resources/infrared/assets/audio.ir | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/applications/main/infrared/resources/infrared/assets/audio.ir b/applications/main/infrared/resources/infrared/assets/audio.ir index d5a0f86dc36..2d3d2198598 100644 --- a/applications/main/infrared/resources/infrared/assets/audio.ir +++ b/applications/main/infrared/resources/infrared/assets/audio.ir @@ -426,3 +426,52 @@ type: parsed protocol: NECext address: 87 7C 00 00 command: 06 F9 00 00 +# +# Model: Dutch Originals Sound Bar +name: Power +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 07 00 00 00 +# +name: Next +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 15 00 00 00 +# +name: Prev +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 15 00 00 00 +# +name: Play +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 6A 00 00 00 +# +name: Pause +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 6A 00 00 00 +# +name: Mute +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 09 00 00 00 +# +name: Vol_up +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 5E 00 00 00 +# +name: Vol_dn +type: parsed +protocol: NEC +address: 00 00 00 00 +command: 85 00 00 00 From 763e2f5babb2898c7468509ad56bd10aeabd7069 Mon Sep 17 00:00:00 2001 From: hedger Date: Mon, 25 Mar 2024 10:51:09 +0400 Subject: [PATCH 22/28] github: additional pre-upload checks for doxygen workflow (#3526) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- .github/workflows/docs.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 690bcbe1972..1fa02508567 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,9 +11,26 @@ env: DEFAULT_TARGET: f7 jobs: + check-secret: + if: ${{ github.event.pull_request.head.repo.fork == false }} + runs-on: ubuntu-latest + outputs: + s3-valid-config: ${{ steps.check.outputs.s3-valid-config }} + + steps: + - name: 'Check if S3 key exists' + id: check + run: | + if [[ -z "${{ secrets.FW_DOCS_AWS_ACCESS_KEY }}" || -z "${{ secrets.FW_DOCS_AWS_SECRET_KEY }}" || -z "${{ secrets.FW_DOCS_AWS_BUCKET }}" ]]; then + echo "s3-valid-config=false" >> $GITHUB_OUTPUT; + else + echo "s3-valid-config=true" >> $GITHUB_OUTPUT; + fi + doxygen: - if: ${{ !github.event.pull_request.head.repo.fork }} + if: ${{ github.event.pull_request.head.repo.fork == false }} runs-on: ubuntu-latest + needs: check-secret steps: - name: 'Wipe workspace' run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; @@ -48,7 +65,7 @@ jobs: doxyfile-path: './doxygen/Doxyfile-awesome.cfg' - name: 'Upload documentation' - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' && needs.check-secret.outputs.s3-valid-config == 'true' }} uses: jakejarvis/s3-sync-action@v0.5.1 env: AWS_S3_BUCKET: "${{ secrets.FW_DOCS_AWS_BUCKET }}" @@ -59,4 +76,3 @@ jobs: DEST_DIR: "${{steps.names.outputs.branch_name}}" with: args: "--delete" - From 11d7f5385432912bac77c485c7a028761ff1353c Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Mon, 25 Mar 2024 10:00:35 +0300 Subject: [PATCH 23/28] [FL-3770, FL-3680] HID App improvements and little extra (#3518) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FL-3680: change capitalisation * Replace D-Pad graphic * Fix the bluetooth indicator not showing * Remove exit confirm scene * Fix wrong back button durations * Improve application structure * Improve mouse clicker view * Improve mouse jiggler view * Improve media view * Improve mouse and media views * Improve tiktok view * Reset mouse jiggler state on view exit * Use alpha in mouse and tiktok views * Reset mouse left button state on view exit * Improve button graphics * Improve mouse graphics Co-authored-by: あく --- .../scenes/subghz_test_scene_show_only_rx.c | 2 +- .../main/bad_usb/scenes/bad_usb_scene_error.c | 2 +- .../scenes/gpio_scene_usb_uart_close_rpc.c | 2 +- .../scenes/infrared_scene_learn_done.c | 2 +- .../main/infrared/views/infrared_move_view.c | 2 +- .../scenes/subghz_scene_receiver_config.c | 2 +- .../main/u2f/scenes/u2f_scene_error.c | 2 +- .../scenes/desktop_settings_scene_favorite.c | 2 +- .../desktop_settings_scene_pin_disable.c | 2 +- .../scenes/desktop_settings_scene_pin_menu.c | 6 +- .../desktop_settings_scene_pin_setup_done.c | 2 +- .../desktop_settings_view_pin_setup_howto.c | 2 +- .../scenes/power_settings_scene_power_off.c | 2 +- .../scenes/power_settings_scene_reboot.c | 4 +- .../system/hid_app/assets/Circles_47x47.png | Bin 3712 -> 0 bytes .../hid_app/assets/DolphinDone_80x58.png | Bin 0 -> 1664 bytes .../hid_app/assets/DolphinNice_96x59.png | Bin 2459 -> 0 bytes .../system/hid_app/assets/Dpad_49x46.png | Bin 0 -> 1078 bytes .../hid_app/assets/Left_mouse_icon_9x10.png | Bin 0 -> 129 bytes .../hid_app/assets/Left_mouse_icon_9x9.png | Bin 3622 -> 0 bytes .../system/hid_app/assets/Like_def_11x9.png | Bin 3616 -> 0 bytes .../system/hid_app/assets/Like_def_13x11.png | Bin 0 -> 600 bytes .../hid_app/assets/Like_pressed_17x16.png | Bin 0 -> 189 bytes .../hid_app/assets/Like_pressed_17x17.png | Bin 3643 -> 0 bytes .../hid_app/assets/Ok_btn_pressed_13x12.png | Bin 0 -> 146 bytes .../hid_app/assets/Ok_btn_pressed_13x13.png | Bin 3625 -> 0 bytes .../hid_app/assets/Right_mouse_icon_9x10.png | Bin 0 -> 126 bytes .../hid_app/assets/Right_mouse_icon_9x9.png | Bin 3622 -> 0 bytes applications/system/hid_app/hid.c | 139 ++---------------- applications/system/hid_app/hid.h | 13 +- .../system/hid_app/scenes/hid_scene_config.h | 2 +- .../hid_app/scenes/hid_scene_exit_confirm.c | 45 ------ .../system/hid_app/scenes/hid_scene_main.c | 4 +- .../system/hid_app/scenes/hid_scene_start.c | 127 ++++++++++++++++ .../system/hid_app/scenes/hid_scene_unpair.c | 6 +- .../system/hid_app/views/hid_keyboard.c | 13 +- .../system/hid_app/views/hid_keynote.c | 43 +++--- applications/system/hid_app/views/hid_media.c | 43 +++--- applications/system/hid_app/views/hid_media.h | 1 - applications/system/hid_app/views/hid_mouse.c | 56 +++---- .../system/hid_app/views/hid_mouse_clicker.c | 59 ++++---- .../system/hid_app/views/hid_mouse_jiggler.c | 57 +++---- .../system/hid_app/views/hid_tiktok.c | 50 +++---- 43 files changed, 323 insertions(+), 369 deletions(-) delete mode 100644 applications/system/hid_app/assets/Circles_47x47.png create mode 100644 applications/system/hid_app/assets/DolphinDone_80x58.png delete mode 100644 applications/system/hid_app/assets/DolphinNice_96x59.png create mode 100644 applications/system/hid_app/assets/Dpad_49x46.png create mode 100644 applications/system/hid_app/assets/Left_mouse_icon_9x10.png delete mode 100644 applications/system/hid_app/assets/Left_mouse_icon_9x9.png delete mode 100644 applications/system/hid_app/assets/Like_def_11x9.png create mode 100644 applications/system/hid_app/assets/Like_def_13x11.png create mode 100644 applications/system/hid_app/assets/Like_pressed_17x16.png delete mode 100644 applications/system/hid_app/assets/Like_pressed_17x17.png create mode 100644 applications/system/hid_app/assets/Ok_btn_pressed_13x12.png delete mode 100644 applications/system/hid_app/assets/Ok_btn_pressed_13x13.png create mode 100644 applications/system/hid_app/assets/Right_mouse_icon_9x10.png delete mode 100644 applications/system/hid_app/assets/Right_mouse_icon_9x9.png delete mode 100644 applications/system/hid_app/scenes/hid_scene_exit_confirm.c create mode 100644 applications/system/hid_app/scenes/hid_scene_start.c diff --git a/applications/debug/subghz_test/scenes/subghz_test_scene_show_only_rx.c b/applications/debug/subghz_test/scenes/subghz_test_scene_show_only_rx.c index 3d5a54355c3..d8eade41d62 100644 --- a/applications/debug/subghz_test/scenes/subghz_test_scene_show_only_rx.c +++ b/applications/debug/subghz_test/scenes/subghz_test_scene_show_only_rx.c @@ -12,7 +12,7 @@ void subghz_test_scene_show_only_rx_on_enter(void* context) { // Setup view Popup* popup = app->popup; - const char* header_text = "Transmission is blocked"; + const char* header_text = "Transmission is Blocked"; const char* message_text = "Transmission on\nthis frequency is\nrestricted in\nyour region"; if(!furi_hal_region_is_provisioned()) { header_text = "Firmware update needed"; diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_error.c b/applications/main/bad_usb/scenes/bad_usb_scene_error.c index abd7b38b95e..9d3a44f12f9 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_error.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_error.c @@ -32,7 +32,7 @@ void bad_usb_scene_error_on_enter(void* context) { } else if(app->error == BadUsbAppErrorCloseRpc) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); + app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nIs Active!"); widget_add_string_multiline_element( app->widget, 3, diff --git a/applications/main/gpio/scenes/gpio_scene_usb_uart_close_rpc.c b/applications/main/gpio/scenes/gpio_scene_usb_uart_close_rpc.c index 2cb53cab248..59ba101f676 100644 --- a/applications/main/gpio/scenes/gpio_scene_usb_uart_close_rpc.c +++ b/applications/main/gpio/scenes/gpio_scene_usb_uart_close_rpc.c @@ -6,7 +6,7 @@ void gpio_scene_usb_uart_close_rpc_on_enter(void* context) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); + app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nIs Active!"); widget_add_string_multiline_element( app->widget, 3, diff --git a/applications/main/infrared/scenes/infrared_scene_learn_done.c b/applications/main/infrared/scenes/infrared_scene_learn_done.c index a0c605b0b5a..6fcb4411085 100644 --- a/applications/main/infrared/scenes/infrared_scene_learn_done.c +++ b/applications/main/infrared/scenes/infrared_scene_learn_done.c @@ -6,7 +6,7 @@ void infrared_scene_learn_done_on_enter(void* context) { if(infrared->app_state.is_learning_new_remote) { popup_set_icon(popup, 48, 6, &I_DolphinDone_80x58); - popup_set_header(popup, "New remote\ncreated!", 0, 0, AlignLeft, AlignTop); + popup_set_header(popup, "Success!", 10, 12, AlignLeft, AlignTop); } else { popup_set_icon(popup, 36, 5, &I_DolphinSaved_92x58); popup_set_header(popup, "Saved", 15, 19, AlignLeft, AlignBottom); diff --git a/applications/main/infrared/views/infrared_move_view.c b/applications/main/infrared/views/infrared_move_view.c index 374a65a44e8..5635d8a74dc 100644 --- a/applications/main/infrared/views/infrared_move_view.c +++ b/applications/main/infrared/views/infrared_move_view.c @@ -34,7 +34,7 @@ static void infrared_move_view_draw_callback(Canvas* canvas, void* _model) { canvas_set_color(canvas, ColorBlack); canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned( - canvas, canvas_width(canvas) / 2, 0, AlignCenter, AlignTop, "Select a button to move"); + canvas, canvas_width(canvas) / 2, 0, AlignCenter, AlignTop, "Select a Button to Move"); const size_t btn_number = InfraredMoveViewItemArray_size(model->labels); const bool show_scrollbar = btn_number > LIST_ITEMS; diff --git a/applications/main/subghz/scenes/subghz_scene_receiver_config.c b/applications/main/subghz/scenes/subghz_scene_receiver_config.c index 55a8f6b44a5..2e2344d5675 100644 --- a/applications/main/subghz/scenes/subghz_scene_receiver_config.c +++ b/applications/main/subghz/scenes/subghz_scene_receiver_config.c @@ -297,7 +297,7 @@ void subghz_scene_receiver_config_on_enter(void* context) { SubGhzCustomEventManagerSet) { item = variable_item_list_add( subghz->variable_item_list, - "Bin_RAW:", + "Bin_Raw:", BIN_RAW_COUNT, subghz_scene_receiver_config_set_bin_raw, subghz); diff --git a/applications/main/u2f/scenes/u2f_scene_error.c b/applications/main/u2f/scenes/u2f_scene_error.c index e10e9c0981f..98ce38d76fd 100644 --- a/applications/main/u2f/scenes/u2f_scene_error.c +++ b/applications/main/u2f/scenes/u2f_scene_error.c @@ -27,7 +27,7 @@ void u2f_scene_error_on_enter(void* context) { } else if(app->error == U2fAppErrorCloseRpc) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); + app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nIs Active!"); widget_add_string_multiline_element( app->widget, 3, 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 31826cae074..db5d231ffa6 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c @@ -116,7 +116,7 @@ void desktop_settings_scene_favorite_on_enter(void* context) { } } - submenu_set_header(submenu, is_dummy_app ? ("Dummy Mode app:") : ("Favorite app:")); + submenu_set_header(submenu, is_dummy_app ? ("Dummy Mode App") : ("Favorite App")); submenu_set_selected_item(submenu, pre_select_item); // If set during loop, visual glitch. view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewMenu); diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c index 43f05ec9bdb..c3e22805d61 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_disable.c @@ -25,7 +25,7 @@ void desktop_settings_scene_pin_disable_on_enter(void* context) { popup_set_context(app->popup, app); popup_set_callback(app->popup, pin_disable_back_callback); popup_set_icon(app->popup, 0, 2, &I_DolphinMafia_119x62); - popup_set_header(app->popup, "Deleted", 80, 19, AlignLeft, AlignBottom); + popup_set_header(app->popup, "PIN\nDeleted!", 100, 0, AlignCenter, AlignTop); popup_set_timeout(app->popup, 1500); popup_enable_timeout(app->popup); view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewIdPopup); 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 d226181d7be..86e756ede8b 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 @@ -22,7 +22,7 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) { if(!app->settings.pin_code.length) { submenu_add_item( submenu, - "Set Pin", + "Set PIN", SCENE_EVENT_SET_PIN, desktop_settings_scene_pin_menu_submenu_callback, app); @@ -30,7 +30,7 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) { } else { submenu_add_item( submenu, - "Change Pin", + "Change PIN", SCENE_EVENT_CHANGE_PIN, desktop_settings_scene_pin_menu_submenu_callback, app); @@ -43,7 +43,7 @@ void desktop_settings_scene_pin_menu_on_enter(void* context) { app); } - submenu_set_header(app->submenu, "Pin code settings:"); + submenu_set_header(app->submenu, "PIN Code Settings"); submenu_set_selected_item(app->submenu, app->menu_idx); view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewMenu); } diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c index f6ceb96de99..b829f995bc2 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c @@ -34,7 +34,7 @@ void desktop_settings_scene_pin_setup_done_on_enter(void* context) { desktop_view_pin_input_set_done_callback(app->pin_input_view, pin_setup_done_callback); desktop_view_pin_input_set_pin(app->pin_input_view, &app->settings.pin_code); desktop_view_pin_input_set_label_button(app->pin_input_view, "Done"); - desktop_view_pin_input_set_label_primary(app->pin_input_view, 29, 8, "PIN activated!"); + desktop_view_pin_input_set_label_primary(app->pin_input_view, 29, 8, "PIN Activated!"); desktop_view_pin_input_set_label_secondary( app->pin_input_view, 7, 45, "Remember or write it down"); desktop_view_pin_input_lock_input(app->pin_input_view); diff --git a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c index 537acb8d59f..b86d6c04523 100644 --- a/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c +++ b/applications/settings/desktop_settings/views/desktop_settings_view_pin_setup_howto.c @@ -23,7 +23,7 @@ static void desktop_settings_view_pin_setup_howto_draw(Canvas* canvas, void* mod elements_button_right(canvas, "Next"); canvas_set_font(canvas, FontPrimary); - elements_multiline_text_aligned(canvas, 64, 0, AlignCenter, AlignTop, "Setting up PIN"); + elements_multiline_text_aligned(canvas, 64, 0, AlignCenter, AlignTop, "Setting Up PIN"); canvas_set_font(canvas, FontSecondary); elements_multiline_text(canvas, 58, 24, "Prepare to use\narrows as\nPIN symbols"); diff --git a/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c b/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c index 923ec250e24..c3f5d5ad805 100644 --- a/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c +++ b/applications/settings/power_settings_app/scenes/power_settings_scene_power_off.c @@ -10,7 +10,7 @@ void power_settings_scene_power_off_on_enter(void* context) { PowerSettingsApp* app = context; DialogEx* dialog = app->dialog; - dialog_ex_set_header(dialog, "Turn Off Device?", 64, 2, AlignCenter, AlignTop); + dialog_ex_set_header(dialog, "Turn OFF Device?", 64, 2, AlignCenter, AlignTop); dialog_ex_set_text( dialog, " I will be\nwaiting for\n you here...", 78, 16, AlignLeft, AlignTop); dialog_ex_set_icon(dialog, 21, 13, &I_Cry_dolph_55x52); diff --git a/applications/settings/power_settings_app/scenes/power_settings_scene_reboot.c b/applications/settings/power_settings_app/scenes/power_settings_scene_reboot.c index 2d879612e77..2d5dedfd42f 100644 --- a/applications/settings/power_settings_app/scenes/power_settings_scene_reboot.c +++ b/applications/settings/power_settings_app/scenes/power_settings_scene_reboot.c @@ -15,10 +15,10 @@ void power_settings_scene_reboot_on_enter(void* context) { PowerSettingsApp* app = context; Submenu* submenu = app->submenu; - submenu_set_header(submenu, "Reboot type"); + submenu_set_header(submenu, "Reboot Type"); submenu_add_item( submenu, - "Firmware upgrade", + "Firmware Upgrade", PowerSettingsRebootSubmenuIndexDfu, power_settings_scene_reboot_submenu_callback, app); diff --git a/applications/system/hid_app/assets/Circles_47x47.png b/applications/system/hid_app/assets/Circles_47x47.png deleted file mode 100644 index 6a16ebf7bbe999fa143c683bef713a6e2f466cbb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3712 zcmaJ^c|26@-#)fNS+a&?jCd-`%-Bu#v5X=b+o)7y3;Soh36 zP7A&OfYn&SO_E-Dk~aX%Wl1T^hNu`(4;k4VSxEQ#i(R6~?3m%)z2*K^*J6&wx*s>5 zQRy#yb}pPVJ-zyIwQ@Xbe65YqE)lsyN+WSBFAy+6MVZ2TR1%z#_03h0{IbYFL6GDa zyUt&z0RUzN81x9*Ba1b@ha`X>Ab08Pk!l>;yj0<$;R%2efkCj;_%=Q!3TV=CYmxz) zb^?!FpZbad$p8?{IBN|C?u!9a3l8Q&Ku=LpzdX>Bx2s4Ph~op&_uB8_w|ohla=(Dm z;;*d(a#@yO9l_cXzDTdU+DkufA$`U++&Ha;kI{K6zz ze#@zyIdwZLqeTR*nuMh>s_>W{KJh)^HevbnctJ1*sedD~05lOJa|GPbL@D4evJOo2 zMymbLrpTDY9k*Oz_BDZYudQ9Hw1*{McydJG1AmC+i+d`H*WTn(J81e6-jS(!K^=;v zyUik>=M{Dw`W8Y1&RvVgMs~o&{jPt)9KU|W_S99hqDG?}b`)*kkzjyTMjM67D%Iv- zIKq4QV`K)N6KX24Kc%xB6)jI1<6te4R98tf_HA|TBqmUKhj#1^FjE2 z4E)wn2SRSB3&izGk+gnDhI(tJ9D-e-o!|8?1MiRL20$ig6(XN6?Y2#Om)05dZR^DN z#HEF>?PAelml}~idliBd&L|Y_EK`7_JKhy~pO)U_2K}h3lRCkLm#{F$>58NdlobWhz*UtT^%hw{24{{H>ij>`778#bbp~6rJ zF6~E7=2xFwzqo=GdlDUGmm7`Dcf*#wQHWEOd!vh+LtA%KJOn1Sf^Itb9DA}neX0@@bZkGlhl{fZ-sje5g- zt9yN>DbsS(lf9e}a<*l*R`w#C0Oy8?R2WtqsfeoR3u*su{vJEYm=IZfyC^>Kxx;>u zu#mqf|DDs#=}<9(>I)k(6@p>L*x42)_FK?Re0j(0<)M2!*Z~!Z^#S=E4*7qTYs_5n z|7t*&H}_+acKNXMzu@|VOff!q-M)hQf`*ameXYqs8GaQVrSEAiElpbetR7bLRJ=)7 zR!|P6`cq}!T3pl}+pLCzv4*jYslBOZ*+QvKsa)1g4|5NO$D+qamP7aPNv%mjw`Z`6 zl4s`jOn4^y`Mu)I;`-1`!hp=MOv1j-eT%NdUf9&yl;~8()Rt+JCCrlg5@D%bxn-A> za`yq+fwL4^NK0rixpJ~#NdI+FebMU)Pk$x<+tloN1Npm$m~5%E&@_2hLgBSS;;nFY z%BbQ@Md!2ki}{%^Gy97_5k7owF>5&YVAV+{Q>oeewHe21VU~*?KHc&)yD+n`Zk{;~ zIT3oo>%?l+Zs(_28adriLQ`M;vB4_#nNx6cGu%qsgn;=QbN*Z5x2{y*tp*R6RjWmG zN2Et=UCUWLu)_stbx2o(cpBs0gMD-q~s(6esj@3uL>w zto3#gF)tNL5~)`Hhte`uuisxQqeJ$saJKAGr4?w4hU4z;9r4la!UK{Kq`S+G6D`k$ zV+QSmW6D+V3hDC8=VbQn*S)Xv{Ya@R?KF+6)y*35TJ^7rpGzpZ{^CGi;B!i-KPxa8 z6^xzAERQU|Uw(mp<)`gjniNfXkI3}Zk@}u`v#VdJ{NuqHdRZeGZmBeE$!LGx3;D5$ zHg-;!sh5El^Q>{yO{uge7NeIy)-I5p&ZC7yCuQj$mouZBZL9O*@{T+%D?ey@V=UVv zWy$#SfpdtJfM{pCkT-fF&L~YrqQZ?AYV%GWHr-!X?VnD6(l$xXO3unhiQ!XAH9tbj z_Le#OX=)~kjWEUtZs9mcU{#=1*SqLhv0|mUxKX8(go9sb zx5EP$<6BEx-?j=EU<{^@wLE9_{kUzIzZ9N*-ka^QUi_e}`jbX)cg^RpGxOq?lw}Wm z;UrI0KGURo236UfTO@YQT>PA%=%Z9oGZyi=+&;{?At&L?oikgPY&nyGG*WQ?!dlC^;licR{FXIW`vz6opFxRI~z3fo2S&5l_1bKZ3 z`S2KN631mvdzzNe7Mvyzba39EUkR-3qJI4OQOElhql)upN~w&f@p)Iddd1?;(4}el zFwq&ue(&%E`op#A-u3TWS0uilFWq>It0fHnJXL$D{k4|_M_lAe&PMX)`zu48_AT~Z zYIbUI3E3(tN@9vtKYZJgh6ox=o`Wr$EG6Vm|6xzuJgdkCH zAOjskZ7fV*7i46j12cr0=;~{MbfGXK2-FAy)6<5+;7~)jo(brm1I(*N@%4kFZ0!E2 z#T%J{186id90Cao3)2bH(;-p(AutmY69`lnqN}UTLugYOL>h*!O{A**R+HbD!f4PQ#alUpG5&`u0jN$k{d(r!& z-alO5KYP*tBNxIm1NpVD|7)Lr-{OVmSNGr4@&^Cr9!KPbox)4C?9}%J-W##S#nH`n zb90l|b+3CL!E2HoY^>bqy;G?sQngTFfsRd!?EP0Hv_eg1tl7i-zBctc!@fr=HS*x6(|+l1S)TBgWjCP}EhD_i3C!C# zW_0QGnT2_!N{&S~=WfI!^Wu$(&ALtQg88e}>7UgNt17G8mLO9J{pTOoNN^F;BQaeJ biU<_Yn+9Io=xs3K`2!qm58ISjpSt)z2v?8| diff --git a/applications/system/hid_app/assets/DolphinDone_80x58.png b/applications/system/hid_app/assets/DolphinDone_80x58.png new file mode 100644 index 0000000000000000000000000000000000000000..594d62d5294997399bc3b256fbe7685ce10b146d GIT binary patch literal 1664 zcmbVNc~BE)6wheY2!uKFLY*phgJAoI;~(9b-S2(h_kQpF-Zi@^ zF+PgtHqDL0;qcVaN)5Xvvag&wj{R2ntG{IzUnWw^ETRmI4WkK8n4Z!RfZBv*5gG#1 zJ63#0gm5_H9b}T0(Z(&5iMAyfDpT!HDDqb46vJwW~kNcFY38LI^aOT(OO4TNw@UFO4^9 zTaz3X0@M&zDwoFDnivAcz-<2B?#QLcvXLjyBwHBFsHE^*6Jci5N(G<25$Z|3oFF79 zt{0&K1d|yAVyOrc=nxShkm0BVg>_OwC(@1Cc@tix3X)1BkVqB;1;KD+Br265;Soxe zN-Rdg!lmdKR&BO2m>DO=e3Pv2Q7rOStUQ7yFovR&D9Sk235nShLs_#a3xG(35HLFq z!%4I2WR9y!uYy(*G?_=}RWxM+M$#-N-#`HpAu80Tmd;G97`! zdI?Mr{87CA|E3RQNrA3j`A_eR9kC7R5?@aPyLmlNgqa;8nw^%VblFu7XWV|ZGAzm7 z-ns8C-3V|CWLx`RUVV5?e=~JLXGNd*gA2VSy}M^liFW=t^rC%5`mI^MKJ^z*yC+9$ zK8y8opgw0i#OZbK-@bIOr+sL3X*0ny?F_5$?^u;L5LsJ%K{s=fe|&Jv>M52PH5+{E zciwC+?Q1wXec-Dn?aE=B+ip?UBV`Bm*T(s!wWZ~plEuod;*9$(j?$d6^(EcKbW!X< z&nIP6%$5Z)#Sc{zYqC;eHfJr#r`xJt{34$f<9D)}sVN9J6SzfMQhTpr?kB2_2ge#4 zPMiznH%5_{H{8XZyCE8Z^qt3(nNamZCKd_dTt1 zybD4vFW|RcM-rOAUY>VP`H4R@hUX>mS_}#FURP5QO}9;kzD&7Mf0X!18#*Cy#s=lb zoGCF8teZgFA$ z+RoI3!Q}^!2oJhss<8vOJLqi_j*V;@D?$qOzS!qAdI~fh>f!$Rlk&;`Vf`4<% z;twaDuf~1bzjhOXb@_XjZ49oi7zcZBs XY(V!OcIS4x{t4>Hc;)f%%(edjvT}hx literal 0 HcmV?d00001 diff --git a/applications/system/hid_app/assets/DolphinNice_96x59.png b/applications/system/hid_app/assets/DolphinNice_96x59.png deleted file mode 100644 index a299d3630239b4486e249cc501872bed5996df3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2459 zcmbVO3s4i+8V(M(gEFORwSrA`4O0uPn|M|5y* zB*aMDxC&7(gP9JN;POOi-9khrC>Z9YJs2U!LnVcQEEC0fDtKo&ILlzb30%M}3J^;~ zv7RzcsilOs4Mq@tD*&R;!LMSk2A~{(`HK9|hQBqEX)3sQr9Je6SZU*F-^fD-p+~Hs; zHLkO%v?>ZoxEv+F#whudr%615FkA0DYR0tMEo}3OOY#xecLWe>xV?u5KtSmC^ z7)Fmj6gjfKstiEV-*Cxbbb+&rRWuI_rBJ)ybs_f1Rn&f2>q3pYwI^|J(hdn{j{0EZIm_F zpIyIWLsRUgOItR-dUbVd|6Zo=_BU_Tj4|{{jxO#=JH4o8er(5{!nZD_j4}MH&zh~9 zVLC~y(0-D6GO0ghZD8BYzP?o{>22~lT6^d@X{SwQ8vrNY-PPIMajIwC)`s14Ep72@ zeq7YOzM`?U{+W)ocXBr`eSOcpk?Rxc=ou5&)fWW|pD};-Z0mvk9}=&`Rb&y<77W~a z(>6YM;6Y5aIU~JKZ}mQZynKHiSTQ#Bczn@&jTiN^?vPJ(jhm7cXLx0oum5P$`TceG zU+wR;OO^)8CVlnM)5p$CO&e94KJt>HccCaHGusmW_b`T6m| z-R6V6Db1pErTot?^d22ojm+2>_)FbD`_+WbDGMx9f@hO27maS2`csiV(D&Fs`PS2& zvrq18du_&zXID(!KIxsU$)iuTYuZ?zmYiP&n&i@Be{IdbS-jA2c0QAlu5NXQv_0K< z3Hvs4eeu6B7yD&CNT~gIkMV&UkRU=V!iQ(+_(O&u^ah$+s{_yn(yBYeD40HeU{xGsIT6W Zfq!wOp!QGD6rWrYT{V(AWE2e}k%~M2*4f>e+(dVF+l3w3){Ue~JI;KrgU+93KHF93 z4_=}oDniMF*Psp^BlVDY2qNo{haiih!XzSz4nYLlH>;~1+6HFc`yTK2d%yR+H&;@< z#~Zx+y%>fyB;sNkSq8mijR$=nF7C)8(*&dau+JQXdD#Y7w`vXmJfX`ukOs0kcJ?Xg z#4t~*mg$H6Qc_S%os``ivY=ZCjbWW#1xr?j0mKJDPBX&9`ut-8*VHg^ij!!`ihv<4 zK5m1)@!pIwKCJL6(RB>(EC`4|2T;Zf`iS8Og)mX#6_D?SDFQF0z~L~lA*x?W;StjY zI8QP@g{B!ih`f#f8{+w3FxZZ>H0!760L5}X)-P~Df$6|E9|Bdh)j=UG#y0DrQh z(S~kq(HhR?RiR6x3bI8pB<;3UPL!nor|SAvwgb~(Tkk)Koy?d8s5EfQQCmU78*Fw< zSwh4HGBoXsX^xa{GBspE(-|@?oaIOcZ;@n0Gu%jP2_i{C!f>E$C?Fw*2}D9_nkx7? zk&kepV1x~IFibSs!v{JdfmoZTA`B-aGVX zRHu@eXt7vC?#adF3&`9`h~1gO>#tLZT?=@<=X#IgwziYnS#- zKB{%D))Mi%8Dj3xOkGBx>gE-;p;)HpTMSo8c+ zefBe`n$2DO@a*T>{HL8qR*m&y%g0yW)(*!mue{7(*Rsh2%KfI>%hNBORKFi-nv_;| YXR*jEHmfYXNg{DrBHAlH=*dp}0hQ-mxBvhE literal 0 HcmV?d00001 diff --git a/applications/system/hid_app/assets/Left_mouse_icon_9x10.png b/applications/system/hid_app/assets/Left_mouse_icon_9x10.png new file mode 100644 index 0000000000000000000000000000000000000000..e8ff5a308c4320dbe3ae8f13445cab6dcf950a45 GIT binary patch literal 129 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 diff --git a/applications/system/hid_app/assets/Like_def_11x9.png b/applications/system/hid_app/assets/Like_def_11x9.png deleted file mode 100644 index 555bea3d4b0239ae1be630d0306316d3e9494c4c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3616 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 literal 0 HcmV?d00001 diff --git a/applications/system/hid_app/assets/Like_pressed_17x17.png b/applications/system/hid_app/assets/Like_pressed_17x17.png deleted file mode 100644 index f5bf276f31a716a4b419995bd0631b2778f99ee9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3643 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 diff --git a/applications/system/hid_app/assets/Right_mouse_icon_9x10.png b/applications/system/hid_app/assets/Right_mouse_icon_9x10.png new file mode 100644 index 0000000000000000000000000000000000000000..014d9840e8fe8e88b2effa20820be8a31107b82f GIT binary patch literal 126 zcmeAS@N?(olHy`uVBq!ia0vp^oIuRQ!3HGLSWET+DOXPy$B+ufwf%uy3<@01b4&hf z&vs+(}R+k1F9+3x|HZ(so6H=Bupj;vWfZuSsJsEF5FNt0sU&UBN1>d!x z*-7w%>@YFG;_-^Aa(trZQF2*B61H^*jEuNsS~8h(_@J1++G=89I*%er`Kc?A@fiXvLda|NDkjVwOw7a=Z1E?2)w_-?q4eu^{Msu0-SlI;aInz>dIRK=%l z#e8CMskc_(+2Cl*9hJAodUoBXCe$`L^(M4|rx*1&0^`;5&be`ZvrrNxFl(pQ0bsd` zR`)@fmowNiY_f~ByQIHul6edW_AtBS0|4i73J`o-nSL`b0N^r1RG%8ktkxY;tK~jY zw|}%wV9Q1421cQ=9wUn3cMm?oa8W4=#VAK~Je5^-fqpQM)vC4ij7XphL+Tw~3Zv;F z--)~#b;{Ktd|ZYtya$PL!%-ZrHwp5wyizIQ8*+7~Tw*Z_pw=jHTd+mEwkgc+CLZKq zD!Ytk>_bGJHGUO;vIT&LZbej^!0v{W+M+)QzQ9)I=^nme{7~S%I}?@~Cz+Y{p7H!J z`j$@C-1|aLk>NN!Y_mq~=R-W2jh8eaO%0f5C)D^7+}fXkiv$as4nI9z#90-+=GOI$ z#U&PERLiHs#lnDyM-5F0mIUiT(>%}-1+4?ae7by`H*D*bzzKO4&lO)C_@nWVD;yR{ zFjbT97mGUx6%CBSHtH&fMPuPgmAChqJ$sDr5$iGT@wStnSIbY+GCeGx&^qkyRmy|7 zs|GsW5kExGmGrvhxd99drEn(Q=WWgzB({=@2GXsd&i#kd6Umc zpE*}qf*$*4l54r__+M@_SZ^`9W?Ey^Z7m`7CIE9pZaPqV^7XMnHO0= z&ZFV=9|t*YM{_$hST@*TAKPX=yD(kd1QKwQF7s29^AakIxE!M0sQ9d7=;{^Ks^o3i zsu*-Zeij0&X|Cy5X18+JL!W0l*=OTE)0%HiIX7t~=;pZilFF2dOpcaiC5&{|s~|Bc zkx*z_Xj^FVwMM68AvZmz#;D3^Gep?1*<9(Yk_kDkbAS4r{gC}wE`P416&kr#0x9sy zmdUEZvEF#+E+%KZJ|CQ6Ny{DgubKOPnL~VMc$gL=+XkqomYBAN$ zsxn6<=cMIH%jS-E9S=MDQ?%32umSj7+FaT|+C+uR8NV}X<$2{VNoJ)pXL6ht%d5S^ z&mf$#2@Yq@l^GYO7a!}dDz3^skXvb;U|pEePi}bndwFYleuebY*+K4+l5%SKH6qzn zid^xwq+v0kCgIwvYrk%zd4wW|gbQWQ$Oid7XNV(DBga!a?=R|Kd%K!A4{Xam}ra8c1V&QBu%DitfgkgoVn(6ZZe=}Ej_I)t$rbI zeF%B|k zbckVy^S;fEfU9zEV)cBcD-9(K<3fu=XX}dPJX?OdT`adgm)sfONf8b| z74*6PJrD5{F{U9%P$@hz+%ZBwmL5eo+zm_8W_6EZeJ60=af!I`G&0Nv@kHHRTUD0KWoonUs!;s^qwTB759>Gj0c!b;>+`jo(Qpj0xn#=Ry;wpD(O^Ga7*= zbtsQig_UC~AH6}ntS05Qc6OZ9$3Moe;=ki{7JJ5C5C=BAyBB2wtG{Xe);Ho@y}qs2 z`g+8H!@;W0qmQ&{wpq5WUlLs~zmd2}Jy&c^^;u}sQl0;+k?j2#q}Tm zY9ieH%j=!=C6>C7j*!Ez_nW5V={WzH`E|aD^`k<_;VZWSizaz`f4L${mW5u#q%Nl# zr`e}&I=ec*vU#W1-T!4gV9R9W7m@o~C?|jO6?`jYcs{f@fxO&xEB#*jwIIkJqb?&4 z%LC`!IwvlQ(3W0_GADbCc4OvFR-f!VyZn;5Tsks)(D9{X>J#Jz>KEo0)J{ULO>@=# zs??IovtE^p0W~iIJ=W)CGITq~R%`r!m)z~|%Rr#VYE}Yh>u=ZBCM3s#7)sln?Nvi8 zrN!cEo9YXz1`CEm*s;hyednFg!KKmb7i(FWE8U|e>)hdCT|4n>aU$6LaVc@_5ke7P zGfwCs5L5b$?fI=-Y?phNVusYt!=3gLDM@J1M&H+g&hF&ytfb|ngg4Zy+1p=gze+zD zX{v8J`nuIm6Lx;}^yWexYm_Cs^k_oFX67pBy7I2)AJ5k8-{)>7NGBxha&acFY%OWu z4Q2mVN;8cJOnaIKlSO2Z07G}0D+y#qC6Y;YB%-^&Pb&!p0G!GcJb_8DvP8Pks1V|w z55$j3XQKfCrSC^4x_Ob9AXgHZ;*AC`RlNa&DDG&mqqdcX6&*|Rq?iUUNcI8Nc((vA zH-tM_Uk`-xL$V2|BqkB$N4@0ji}XW-|Kvro_j_h281$zL(+ds$OBBKC6bMUWkU+W+ zn7W&Wh6YF%0U@~);jWqn zx>3CMEGmCOtgMh`-o8wtw;Ra}hX%7rAQXx_5{rOoVRcUE!ZeJvU@#+`Ar5;2gM(wR zx^PVx0 #include -#include "hid_icons.h" #define TAG "HidApp" -enum HidDebugSubmenuIndex { - HidSubmenuIndexKeynote, - HidSubmenuIndexKeynoteVertical, - HidSubmenuIndexKeyboard, - HidSubmenuIndexMedia, - HidSubmenuIndexTikTok, - HidSubmenuIndexMouse, - HidSubmenuIndexMouseClicker, - HidSubmenuIndexMouseJiggler, - HidSubmenuIndexRemovePairing, -}; - bool hid_custom_event_callback(void* context, uint32_t event) { furi_assert(context); Hid* app = context; @@ -29,9 +16,7 @@ bool hid_custom_event_callback(void* context, uint32_t event) { bool hid_back_event_callback(void* context) { furi_assert(context); Hid* app = context; - FURI_LOG_D("HID", "Back event"); - scene_manager_next_scene(app->scene_manager, HidSceneExitConfirm); - return true; + return scene_manager_handle_back_event(app->scene_manager); } void bt_hid_remove_pairing(Hid* app) { @@ -48,51 +33,12 @@ void bt_hid_remove_pairing(Hid* app) { furi_hal_bt_start_advertising(); } -static void hid_submenu_callback(void* context, uint32_t index) { - furi_assert(context); - Hid* app = context; - if(index == HidSubmenuIndexKeynote) { - app->view_id = HidViewKeynote; - hid_keynote_set_orientation(app->hid_keynote, false); - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewKeynote); - } else if(index == HidSubmenuIndexKeynoteVertical) { - app->view_id = HidViewKeynote; - hid_keynote_set_orientation(app->hid_keynote, true); - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewKeynote); - } else if(index == HidSubmenuIndexKeyboard) { - app->view_id = HidViewKeyboard; - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewKeyboard); - } else if(index == HidSubmenuIndexMedia) { - app->view_id = HidViewMedia; - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMedia); - } else if(index == HidSubmenuIndexMouse) { - app->view_id = HidViewMouse; - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouse); - } else if(index == HidSubmenuIndexTikTok) { - app->view_id = BtHidViewTikTok; - view_dispatcher_switch_to_view(app->view_dispatcher, BtHidViewTikTok); - } else if(index == HidSubmenuIndexMouseClicker) { - app->view_id = HidViewMouseClicker; - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseClicker); - } else if(index == HidSubmenuIndexMouseJiggler) { - app->view_id = HidViewMouseJiggler; - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseJiggler); - } else if(index == HidSubmenuIndexRemovePairing) { - scene_manager_next_scene(app->scene_manager, HidSceneUnpair); - } -} - static void bt_hid_connection_status_changed_callback(BtStatus status, void* context) { furi_assert(context); Hid* hid = context; - bool connected = (status == BtStatusConnected); -#ifdef HID_TRANSPORT_BLE - if(connected) { - notification_internal_message(hid->notifications, &sequence_set_blue_255); - } else { - notification_internal_message(hid->notifications, &sequence_reset_blue); - } -#endif + const bool connected = (status == BtStatusConnected); + notification_internal_message( + hid->notifications, connected ? &sequence_set_blue_255 : &sequence_reset_blue); hid_keynote_set_connected_status(hid->hid_keynote, connected); hid_keyboard_set_connected_status(hid->hid_keyboard, connected); hid_media_set_connected_status(hid->hid_media, connected); @@ -102,12 +48,7 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con hid_tiktok_set_connected_status(hid->hid_tiktok, connected); } -static uint32_t hid_exit(void* context) { - UNUSED(context); - return VIEW_NONE; -} - -Hid* hid_alloc(void) { +Hid* hid_alloc() { Hid* app = malloc(sizeof(Hid)); // Gui @@ -122,67 +63,18 @@ Hid* hid_alloc(void) { // View dispatcher app->view_dispatcher = view_dispatcher_alloc(); view_dispatcher_enable_queue(app->view_dispatcher); - view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); - view_dispatcher_set_navigation_event_callback(app->view_dispatcher, hid_back_event_callback); view_dispatcher_set_event_callback_context(app->view_dispatcher, app); + view_dispatcher_set_custom_event_callback(app->view_dispatcher, hid_custom_event_callback); + view_dispatcher_set_navigation_event_callback(app->view_dispatcher, hid_back_event_callback); + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); // Scene Manager app->scene_manager = scene_manager_alloc(&hid_scene_handlers, app); // Device Type Submenu view - app->device_type_submenu = submenu_alloc(); - submenu_add_item( - app->device_type_submenu, "Keynote", HidSubmenuIndexKeynote, hid_submenu_callback, app); - submenu_add_item( - app->device_type_submenu, - "Keynote Vertical", - HidSubmenuIndexKeynoteVertical, - hid_submenu_callback, - app); - submenu_add_item( - app->device_type_submenu, "Keyboard", HidSubmenuIndexKeyboard, hid_submenu_callback, app); - submenu_add_item( - app->device_type_submenu, "Media", HidSubmenuIndexMedia, hid_submenu_callback, app); - submenu_add_item( - app->device_type_submenu, "Mouse", HidSubmenuIndexMouse, hid_submenu_callback, app); -#ifdef HID_TRANSPORT_BLE - submenu_add_item( - app->device_type_submenu, - "TikTok Controller", - HidSubmenuIndexTikTok, - hid_submenu_callback, - app); -#endif - submenu_add_item( - app->device_type_submenu, - "Mouse Clicker", - HidSubmenuIndexMouseClicker, - hid_submenu_callback, - app); - submenu_add_item( - app->device_type_submenu, - "Mouse Jiggler", - HidSubmenuIndexMouseJiggler, - hid_submenu_callback, - app); -#ifdef HID_TRANSPORT_BLE - submenu_add_item( - app->device_type_submenu, - "Remove Pairing", - HidSubmenuIndexRemovePairing, - hid_submenu_callback, - app); -#endif - view_set_previous_callback(submenu_get_view(app->device_type_submenu), hid_exit); - view_dispatcher_add_view( - app->view_dispatcher, HidViewSubmenu, submenu_get_view(app->device_type_submenu)); - app->view_id = HidViewSubmenu; - return app; -} + app->submenu = submenu_alloc(); -Hid* hid_app_alloc_view(void* context) { - furi_assert(context); - Hid* app = context; + view_dispatcher_add_view(app->view_dispatcher, HidViewSubmenu, submenu_get_view(app->submenu)); // Dialog view app->dialog = dialog_ex_alloc(); @@ -243,7 +135,7 @@ void hid_free(Hid* app) { #endif // Free views view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu); - submenu_free(app->device_type_submenu); + submenu_free(app->submenu); view_dispatcher_remove_view(app->view_dispatcher, HidViewDialog); dialog_ex_free(app->dialog); view_dispatcher_remove_view(app->view_dispatcher, HidViewPopup); @@ -280,18 +172,16 @@ void hid_free(Hid* app) { int32_t hid_usb_app(void* p) { UNUSED(p); Hid* app = hid_alloc(); - app = hid_app_alloc_view(app); + FURI_LOG_D("HID", "Starting as USB app"); FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config(); furi_hal_usb_unlock(); furi_check(furi_hal_usb_set_config(&usb_hid, NULL) == true); - bt_hid_connection_status_changed_callback(BtStatusConnected, app); - dolphin_deed(DolphinDeedPluginStart); - scene_manager_next_scene(app->scene_manager, HidSceneMain); + scene_manager_next_scene(app->scene_manager, HidSceneStart); view_dispatcher_run(app->view_dispatcher); @@ -305,7 +195,6 @@ int32_t hid_usb_app(void* p) { int32_t hid_ble_app(void* p) { UNUSED(p); Hid* app = hid_alloc(); - app = hid_app_alloc_view(app); FURI_LOG_D("HID", "Starting as BLE app"); @@ -335,7 +224,7 @@ int32_t hid_ble_app(void* p) { dolphin_deed(DolphinDeedPluginStart); - scene_manager_next_scene(app->scene_manager, HidSceneMain); + scene_manager_next_scene(app->scene_manager, HidSceneStart); view_dispatcher_run(app->view_dispatcher); diff --git a/applications/system/hid_app/hid.h b/applications/system/hid_app/hid.h index a79b2bcd3e9..f83e4c6e231 100644 --- a/applications/system/hid_app/hid.h +++ b/applications/system/hid_app/hid.h @@ -30,11 +30,6 @@ #define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys" -typedef enum { - HidTransportUsb, - HidTransportBle, -} HidTransport; - typedef struct Hid Hid; struct Hid { @@ -44,7 +39,7 @@ struct Hid { NotificationApp* notifications; ViewDispatcher* view_dispatcher; SceneManager* scene_manager; - Submenu* device_type_submenu; + Submenu* submenu; DialogEx* dialog; Popup* popup; HidKeynote* hid_keynote; @@ -54,10 +49,8 @@ struct Hid { HidMouseClicker* hid_mouse_clicker; HidMouseJiggler* hid_mouse_jiggler; HidTikTok* hid_tiktok; - - HidTransport transport; - uint32_t view_id; }; + void bt_hid_remove_pairing(Hid* app); void hid_hal_keyboard_press(Hid* instance, uint16_t event); @@ -72,4 +65,4 @@ void hid_hal_mouse_move(Hid* instance, int8_t dx, int8_t dy); void hid_hal_mouse_scroll(Hid* instance, int8_t delta); void hid_hal_mouse_press(Hid* instance, uint16_t event); void hid_hal_mouse_release(Hid* instance, uint16_t event); -void hid_hal_mouse_release_all(Hid* instance); \ No newline at end of file +void hid_hal_mouse_release_all(Hid* instance); diff --git a/applications/system/hid_app/scenes/hid_scene_config.h b/applications/system/hid_app/scenes/hid_scene_config.h index 8f3a788d1fa..d18b1555821 100644 --- a/applications/system/hid_app/scenes/hid_scene_config.h +++ b/applications/system/hid_app/scenes/hid_scene_config.h @@ -1,3 +1,3 @@ +ADD_SCENE(hid, start, Start) ADD_SCENE(hid, main, Main) ADD_SCENE(hid, unpair, Unpair) -ADD_SCENE(hid, exit_confirm, ExitConfirm) \ No newline at end of file diff --git a/applications/system/hid_app/scenes/hid_scene_exit_confirm.c b/applications/system/hid_app/scenes/hid_scene_exit_confirm.c deleted file mode 100644 index 94e783e939c..00000000000 --- a/applications/system/hid_app/scenes/hid_scene_exit_confirm.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "../hid.h" -#include "../views.h" - -static void hid_scene_exit_confirm_dialog_callback(DialogExResult result, void* context) { - furi_assert(context); - Hid* app = context; - if(result == DialogExResultLeft) { - view_dispatcher_stop(app->view_dispatcher); - } else if(result == DialogExResultRight) { - scene_manager_previous_scene(app->scene_manager); - } else if(result == DialogExResultCenter) { - scene_manager_search_and_switch_to_previous_scene(app->scene_manager, HidSceneMain); - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu); - } -} - -void hid_scene_exit_confirm_on_enter(void* context) { - Hid* app = context; - - // Exit dialog view - dialog_ex_reset(app->dialog); - dialog_ex_set_result_callback(app->dialog, hid_scene_exit_confirm_dialog_callback); - dialog_ex_set_context(app->dialog, app); - dialog_ex_set_left_button_text(app->dialog, "Exit"); - dialog_ex_set_right_button_text(app->dialog, "Stay"); - dialog_ex_set_center_button_text(app->dialog, "Menu"); - dialog_ex_set_header(app->dialog, "Close Current App?", 16, 12, AlignLeft, AlignTop); - - view_dispatcher_switch_to_view(app->view_dispatcher, HidViewDialog); -} - -bool hid_scene_exit_confirm_on_event(void* context, SceneManagerEvent event) { - Hid* app = context; - bool consumed = false; - UNUSED(app); - UNUSED(event); - - return consumed; -} - -void hid_scene_exit_confirm_on_exit(void* context) { - Hid* app = context; - - dialog_ex_reset(app->dialog); -} diff --git a/applications/system/hid_app/scenes/hid_scene_main.c b/applications/system/hid_app/scenes/hid_scene_main.c index 6c4a1168208..1d0ca5ef4b2 100644 --- a/applications/system/hid_app/scenes/hid_scene_main.c +++ b/applications/system/hid_app/scenes/hid_scene_main.c @@ -3,8 +3,8 @@ void hid_scene_main_on_enter(void* context) { Hid* app = context; - - view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id); + view_dispatcher_switch_to_view( + app->view_dispatcher, scene_manager_get_scene_state(app->scene_manager, HidSceneMain)); } bool hid_scene_main_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/system/hid_app/scenes/hid_scene_start.c b/applications/system/hid_app/scenes/hid_scene_start.c new file mode 100644 index 00000000000..78461fe351c --- /dev/null +++ b/applications/system/hid_app/scenes/hid_scene_start.c @@ -0,0 +1,127 @@ +#include "../hid.h" +#include "../views.h" + +enum HidSubmenuIndex { + HidSubmenuIndexKeynote, + HidSubmenuIndexKeynoteVertical, + HidSubmenuIndexKeyboard, + HidSubmenuIndexMedia, + HidSubmenuIndexTikTok, + HidSubmenuIndexMouse, + HidSubmenuIndexMouseClicker, + HidSubmenuIndexMouseJiggler, + HidSubmenuIndexRemovePairing, +}; + +static void hid_scene_start_submenu_callback(void* context, uint32_t index) { + furi_assert(context); + Hid* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, index); +} + +void hid_scene_start_on_enter(void* context) { + Hid* app = context; + submenu_add_item( + app->submenu, "Keynote", HidSubmenuIndexKeynote, hid_scene_start_submenu_callback, app); + submenu_add_item( + app->submenu, + "Keynote Vertical", + HidSubmenuIndexKeynoteVertical, + hid_scene_start_submenu_callback, + app); + submenu_add_item( + app->submenu, "Keyboard", HidSubmenuIndexKeyboard, hid_scene_start_submenu_callback, app); + submenu_add_item( + app->submenu, "Media", HidSubmenuIndexMedia, hid_scene_start_submenu_callback, app); + submenu_add_item( + app->submenu, "Mouse", HidSubmenuIndexMouse, hid_scene_start_submenu_callback, app); +#ifdef HID_TRANSPORT_BLE + submenu_add_item( + app->submenu, + "TikTok Controller", + HidSubmenuIndexTikTok, + hid_scene_start_submenu_callback, + app); +#endif + submenu_add_item( + app->submenu, + "Mouse Clicker", + HidSubmenuIndexMouseClicker, + hid_scene_start_submenu_callback, + app); + submenu_add_item( + app->submenu, + "Mouse Jiggler", + HidSubmenuIndexMouseJiggler, + hid_scene_start_submenu_callback, + app); +#ifdef HID_TRANSPORT_BLE + submenu_add_item( + app->submenu, + "Bluetooth Unpairing", + HidSubmenuIndexRemovePairing, + hid_scene_start_submenu_callback, + app); +#endif + + submenu_set_selected_item( + app->submenu, scene_manager_get_scene_state(app->scene_manager, HidSceneStart)); + view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu); +} + +bool hid_scene_start_on_event(void* context, SceneManagerEvent event) { + Hid* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == HidSubmenuIndexRemovePairing) { + scene_manager_next_scene(app->scene_manager, HidSceneUnpair); + } else { + HidView view_id; + + switch(event.event) { + case HidSubmenuIndexKeynote: + view_id = HidViewKeynote; + hid_keynote_set_orientation(app->hid_keynote, false); + break; + case HidSubmenuIndexKeynoteVertical: + view_id = HidViewKeynote; + hid_keynote_set_orientation(app->hid_keynote, true); + break; + case HidSubmenuIndexKeyboard: + view_id = HidViewKeyboard; + break; + case HidSubmenuIndexMedia: + view_id = HidViewMedia; + break; + case HidSubmenuIndexTikTok: + view_id = BtHidViewTikTok; + break; + case HidSubmenuIndexMouse: + view_id = HidViewMouse; + break; + case HidSubmenuIndexMouseClicker: + view_id = HidViewMouseClicker; + break; + case HidSubmenuIndexMouseJiggler: + view_id = HidViewMouseJiggler; + break; + default: + furi_crash(); + } + + scene_manager_set_scene_state(app->scene_manager, HidSceneMain, view_id); + scene_manager_next_scene(app->scene_manager, HidSceneMain); + } + + scene_manager_set_scene_state(app->scene_manager, HidSceneStart, event.event); + consumed = true; + } + + return consumed; +} + +void hid_scene_start_on_exit(void* context) { + Hid* app = context; + submenu_reset(app->submenu); +} diff --git a/applications/system/hid_app/scenes/hid_scene_unpair.c b/applications/system/hid_app/scenes/hid_scene_unpair.c index 7b0bbd9e62e..3aa4ed96b11 100644 --- a/applications/system/hid_app/scenes/hid_scene_unpair.c +++ b/applications/system/hid_app/scenes/hid_scene_unpair.c @@ -29,14 +29,12 @@ void hid_scene_unpair_on_enter(void* context) { dialog_ex_reset(app->dialog); dialog_ex_set_result_callback(app->dialog, hid_scene_unpair_dialog_callback); dialog_ex_set_context(app->dialog, app); - dialog_ex_set_header(app->dialog, "Unpair All Devices?", 64, 3, AlignCenter, AlignTop); - dialog_ex_set_text( - app->dialog, "All previous pairings\nwill be lost!", 64, 22, AlignCenter, AlignTop); + dialog_ex_set_header(app->dialog, "Unpair the Device?", 64, 3, AlignCenter, AlignTop); dialog_ex_set_left_button_text(app->dialog, "Back"); dialog_ex_set_right_button_text(app->dialog, "Unpair"); // Un-pair success popup view - popup_set_icon(app->popup, 32, 5, &I_DolphinNice_96x59); + popup_set_icon(app->popup, 48, 6, &I_DolphinDone_80x58); popup_set_header(app->popup, "Done", 14, 15, AlignLeft, AlignTop); popup_set_timeout(app->popup, 1500); popup_set_context(app->popup, app); diff --git a/applications/system/hid_app/views/hid_keyboard.c b/applications/system/hid_app/views/hid_keyboard.c index 1ee2c01c9c1..9dd2ad65525 100644 --- a/applications/system/hid_app/views/hid_keyboard.c +++ b/applications/system/hid_app/views/hid_keyboard.c @@ -23,7 +23,6 @@ typedef struct { bool ok_pressed; bool back_pressed; bool connected; - HidTransport transport; } HidKeyboardModel; typedef struct { @@ -230,7 +229,8 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) { HidKeyboardModel* model = context; // Header - if((!model->connected) && (model->transport == HidTransportBle)) { +#ifdef HID_TRANSPORT_BLE + if(!model->connected) { canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keyboard"); @@ -243,6 +243,7 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) { canvas, 4, 60, AlignLeft, AlignBottom, "Waiting for Connection..."); return; // Dont render the keyboard if we are not yet connected } +#endif canvas_set_font(canvas, FontKeyboard); // Start shifting the all keys up if on the next row (Scrolling) @@ -400,13 +401,7 @@ HidKeyboard* hid_keyboard_alloc(Hid* bt_hid) { view_set_input_callback(hid_keyboard->view, hid_keyboard_input_callback); with_view_model( - hid_keyboard->view, - HidKeyboardModel * model, - { - model->transport = bt_hid->transport; - model->y = 1; - }, - true); + hid_keyboard->view, HidKeyboardModel * model, { model->y = 1; }, true); return hid_keyboard; } diff --git a/applications/system/hid_app/views/hid_keynote.c b/applications/system/hid_app/views/hid_keynote.c index 543363bf67b..793f6e5d355 100644 --- a/applications/system/hid_app/views/hid_keynote.c +++ b/applications/system/hid_app/views/hid_keynote.c @@ -19,7 +19,6 @@ typedef struct { bool ok_pressed; bool back_pressed; bool connected; - HidTransport transport; } HidKeynoteModel; static void hid_keynote_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) { @@ -40,13 +39,13 @@ static void hid_keynote_draw_callback(Canvas* canvas, void* context) { HidKeynoteModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); + } else { + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } +#endif canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keynote"); @@ -92,12 +91,12 @@ static void hid_keynote_draw_callback(Canvas* canvas, void* context) { canvas_set_color(canvas, ColorBlack); // Ok - canvas_draw_icon(canvas, 63, 25, &I_Space_65x18); + canvas_draw_icon(canvas, 63, 24, &I_Space_65x18); if(model->ok_pressed) { - elements_slightly_rounded_box(canvas, 66, 27, 60, 13); + elements_slightly_rounded_box(canvas, 66, 26, 60, 13); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9); + canvas_draw_icon(canvas, 74, 28, &I_Ok_btn_9x9); elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Space"); canvas_set_color(canvas, ColorBlack); @@ -116,18 +115,18 @@ static void hid_keynote_draw_vertical_callback(Canvas* canvas, void* context) { HidKeynoteModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } - canvas_set_font(canvas, FontPrimary); - elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Keynote"); +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); } else { - canvas_set_font(canvas, FontPrimary); - elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Keynote"); + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } + canvas_set_font(canvas, FontPrimary); + elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Keynote"); +#else + canvas_set_font(canvas, FontPrimary); + elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Keynote"); +#endif canvas_draw_icon(canvas, 2, 18, &I_Pin_back_arrow_10x8); canvas_set_font(canvas, FontSecondary); @@ -274,10 +273,6 @@ HidKeynote* hid_keynote_alloc(Hid* hid) { view_allocate_model(hid_keynote->view, ViewModelTypeLocking, sizeof(HidKeynoteModel)); view_set_draw_callback(hid_keynote->view, hid_keynote_draw_callback); view_set_input_callback(hid_keynote->view, hid_keynote_input_callback); - - with_view_model( - hid_keynote->view, HidKeynoteModel * model, { model->transport = hid->transport; }, true); - return hid_keynote; } diff --git a/applications/system/hid_app/views/hid_media.c b/applications/system/hid_app/views/hid_media.c index 6ef11729e95..ff4cdeb898e 100644 --- a/applications/system/hid_app/views/hid_media.c +++ b/applications/system/hid_app/views/hid_media.c @@ -21,7 +21,6 @@ typedef struct { bool down_pressed; bool ok_pressed; bool connected; - HidTransport transport; } HidMediaModel; static void hid_media_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) { @@ -42,46 +41,46 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) { HidMediaModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); + } else { + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } +#endif canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Media"); canvas_set_font(canvas, FontSecondary); // Keypad circles - canvas_draw_icon(canvas, 76, 8, &I_Circles_47x47); + canvas_draw_icon(canvas, 75, 9, &I_Dpad_49x46); // Up if(model->up_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 93, 9, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, true); + canvas_draw_icon(canvas, 93, 10, &I_Pressed_Button_13x13); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 96, 12, &I_Volup_8x6); + canvas_draw_icon(canvas, 96, 13, &I_Volup_8x6); canvas_set_color(canvas, ColorBlack); // Down if(model->down_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 93, 41, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 96, 45, &I_Voldwn_6x6); + canvas_draw_icon(canvas, 96, 44, &I_Voldwn_6x6); canvas_set_color(canvas, ColorBlack); // Left if(model->left_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 77, 25, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } hid_media_draw_arrow(canvas, 82, 31, CanvasDirectionRightToLeft); @@ -90,9 +89,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) { // Right if(model->right_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 109, 25, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } hid_media_draw_arrow(canvas, 112, 31, CanvasDirectionLeftToRight); @@ -177,6 +176,8 @@ static bool hid_media_input_callback(InputEvent* event, void* context) { hid_media_process_release(hid_media, event); consumed = true; } else if(event->type == InputTypeShort) { + consumed = true; + } else if(event->type == InputTypeLong) { if(event->key == InputKeyBack) { hid_hal_consumer_key_release_all(hid_media->hid); } @@ -193,10 +194,6 @@ HidMedia* hid_media_alloc(Hid* hid) { view_allocate_model(hid_media->view, ViewModelTypeLocking, sizeof(HidMediaModel)); view_set_draw_callback(hid_media->view, hid_media_draw_callback); view_set_input_callback(hid_media->view, hid_media_input_callback); - - with_view_model( - hid_media->view, HidMediaModel * model, { model->transport = hid->transport; }, true); - return hid_media; } diff --git a/applications/system/hid_app/views/hid_media.h b/applications/system/hid_app/views/hid_media.h index 2356734b3e5..faf88301f4d 100644 --- a/applications/system/hid_app/views/hid_media.h +++ b/applications/system/hid_app/views/hid_media.h @@ -3,7 +3,6 @@ #include typedef struct Hid Hid; - typedef struct HidMedia HidMedia; HidMedia* hid_media_alloc(Hid* hid); diff --git a/applications/system/hid_app/views/hid_mouse.c b/applications/system/hid_app/views/hid_mouse.c index 30a9d9d0635..9b64b62d7ca 100644 --- a/applications/system/hid_app/views/hid_mouse.c +++ b/applications/system/hid_app/views/hid_mouse.c @@ -20,7 +20,6 @@ typedef struct { bool left_mouse_held; bool right_mouse_pressed; bool connected; - HidTransport transport; } HidMouseModel; static void hid_mouse_draw_callback(Canvas* canvas, void* context) { @@ -28,13 +27,13 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) { HidMouseModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); + } else { + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } +#endif canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse"); @@ -49,23 +48,23 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) { } // Keypad circles - canvas_draw_icon(canvas, 64, 8, &I_Circles_47x47); + canvas_draw_icon(canvas, 63, 9, &I_Dpad_49x46); // Up if(model->up_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 81, 9, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, true); + canvas_draw_icon(canvas, 81, 10, &I_Pressed_Button_13x13); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 84, 10, &I_Pin_arrow_up_7x9); + canvas_draw_icon(canvas, 84, 12, &I_Pin_arrow_up_7x9); canvas_set_color(canvas, ColorBlack); // Down if(model->down_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 81, 41, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } canvas_draw_icon(canvas, 84, 43, &I_Pin_arrow_down_7x9); @@ -73,9 +72,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) { // Left if(model->left_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 65, 25, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } canvas_draw_icon(canvas, 67, 28, &I_Pin_arrow_left_9x7); @@ -83,9 +82,9 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) { // Right if(model->right_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 97, 25, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } canvas_draw_icon(canvas, 99, 28, &I_Pin_arrow_right_9x7); @@ -93,16 +92,16 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) { // Ok if(model->left_mouse_pressed) { - canvas_draw_icon(canvas, 81, 25, &I_Ok_btn_pressed_13x13); + canvas_draw_icon(canvas, 81, 26, &I_Ok_btn_pressed_13x12); } else { - canvas_draw_icon(canvas, 83, 27, &I_Left_mouse_icon_9x9); + canvas_draw_icon(canvas, 83, 27, &I_Left_mouse_icon_9x10); } // Back if(model->right_mouse_pressed) { - canvas_draw_icon(canvas, 108, 48, &I_Ok_btn_pressed_13x13); + canvas_draw_icon(canvas, 108, 49, &I_Ok_btn_pressed_13x12); } else { - canvas_draw_icon(canvas, 110, 50, &I_Right_mouse_icon_9x9); + canvas_draw_icon(canvas, 110, 50, &I_Right_mouse_icon_9x10); } } @@ -185,6 +184,15 @@ static bool hid_mouse_input_callback(InputEvent* event, void* context) { if(event->type == InputTypeLong && event->key == InputKeyBack) { hid_hal_mouse_release_all(hid_mouse->hid); + + with_view_model( + hid_mouse->view, + HidMouseModel * model, + { + model->left_mouse_held = false; + model->left_mouse_pressed = false; + }, + false); } else { hid_mouse_process(hid_mouse, event); consumed = true; @@ -201,10 +209,6 @@ HidMouse* hid_mouse_alloc(Hid* hid) { view_allocate_model(hid_mouse->view, ViewModelTypeLocking, sizeof(HidMouseModel)); view_set_draw_callback(hid_mouse->view, hid_mouse_draw_callback); view_set_input_callback(hid_mouse->view, hid_mouse_input_callback); - - with_view_model( - hid_mouse->view, HidMouseModel * model, { model->transport = hid->transport; }, true); - return hid_mouse; } diff --git a/applications/system/hid_app/views/hid_mouse_clicker.c b/applications/system/hid_app/views/hid_mouse_clicker.c index d85affc4338..3a2a064cbb1 100644 --- a/applications/system/hid_app/views/hid_mouse_clicker.c +++ b/applications/system/hid_app/views/hid_mouse_clicker.c @@ -18,7 +18,6 @@ typedef struct { bool connected; bool running; int rate; - HidTransport transport; } HidMouseClickerModel; static void hid_mouse_clicker_start_or_restart_timer(void* context) { @@ -44,46 +43,46 @@ static void hid_mouse_clicker_draw_callback(Canvas* canvas, void* context) { HidMouseClickerModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); + } else { + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } +#endif canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse Clicker"); + canvas_set_font(canvas, FontSecondary); // Ok - canvas_draw_icon(canvas, 63, 25, &I_Space_65x18); - if(model->running) { - canvas_set_font(canvas, FontPrimary); - - FuriString* rate_label = furi_string_alloc(); - furi_string_printf(rate_label, "%d clicks/s\n\nUp / Down", model->rate); - elements_multiline_text(canvas, AlignLeft, 35, furi_string_get_cstr(rate_label)); - canvas_set_font(canvas, FontSecondary); - furi_string_free(rate_label); + canvas_draw_icon(canvas, 58, 25, &I_Space_65x18); - elements_slightly_rounded_box(canvas, 66, 27, 60, 13); + if(model->running) { + elements_slightly_rounded_box(canvas, 61, 27, 60, 13); canvas_set_color(canvas, ColorWhite); - } else { - canvas_set_font(canvas, FontPrimary); - elements_multiline_text(canvas, AlignLeft, 35, "Press Start\nto start\nclicking"); - canvas_set_font(canvas, FontSecondary); } - canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9); + + canvas_draw_icon(canvas, 69, 29, &I_Ok_btn_9x9); + if(model->running) { - elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Stop"); + elements_multiline_text_aligned(canvas, 86, 37, AlignLeft, AlignBottom, "Stop"); } else { - elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Start"); + elements_multiline_text_aligned(canvas, 86, 37, AlignLeft, AlignBottom, "Start"); } canvas_set_color(canvas, ColorBlack); + // Clicks/s + char label[20]; + snprintf(label, sizeof(label), "%d clicks/s", model->rate); + elements_multiline_text_aligned(canvas, 28, 37, AlignCenter, AlignBottom, label); + + canvas_draw_icon(canvas, 25, 20, &I_ButtonUp_7x4); + canvas_draw_icon(canvas, 25, 44, &I_ButtonDown_7x4); + // Back - canvas_draw_icon(canvas, 74, 49, &I_Pin_back_arrow_10x8); - elements_multiline_text_aligned(canvas, 91, 57, AlignLeft, AlignBottom, "Quit"); + canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8); + elements_multiline_text_aligned(canvas, 13, 62, AlignLeft, AlignBottom, "Exit"); } static void hid_mouse_clicker_timer_callback(void* context) { @@ -145,6 +144,9 @@ static bool hid_mouse_clicker_input_callback(InputEvent* event, void* context) { rate_changed = true; consumed = true; break; + case InputKeyBack: + model->running = false; + break; default: consumed = true; break; @@ -179,10 +181,7 @@ HidMouseClicker* hid_mouse_clicker_alloc(Hid* hid) { with_view_model( hid_mouse_clicker->view, HidMouseClickerModel * model, - { - model->transport = hid->transport; - model->rate = DEFAULT_CLICK_RATE; - }, + { model->rate = DEFAULT_CLICK_RATE; }, true); return hid_mouse_clicker; diff --git a/applications/system/hid_app/views/hid_mouse_jiggler.c b/applications/system/hid_app/views/hid_mouse_jiggler.c index 15547eb26b5..b3dbc02b642 100644 --- a/applications/system/hid_app/views/hid_mouse_jiggler.c +++ b/applications/system/hid_app/views/hid_mouse_jiggler.c @@ -16,7 +16,6 @@ typedef struct { bool connected; bool running; uint8_t counter; - HidTransport transport; } HidMouseJigglerModel; static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) { @@ -24,38 +23,38 @@ static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) { HidMouseJigglerModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); + } else { + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } +#endif canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse Jiggler"); - - canvas_set_font(canvas, FontPrimary); - elements_multiline_text(canvas, AlignLeft, 35, "Press Start\nto jiggle"); canvas_set_font(canvas, FontSecondary); // Ok - canvas_draw_icon(canvas, 63, 25, &I_Space_65x18); + canvas_draw_icon(canvas, 32, 25, &I_Space_65x18); + if(model->running) { - elements_slightly_rounded_box(canvas, 66, 27, 60, 13); + elements_slightly_rounded_box(canvas, 35, 27, 60, 13); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9); + + canvas_draw_icon(canvas, 43, 29, &I_Ok_btn_9x9); + if(model->running) { - elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Stop"); + elements_multiline_text_aligned(canvas, 60, 37, AlignLeft, AlignBottom, "Stop"); } else { - elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Start"); + elements_multiline_text_aligned(canvas, 60, 37, AlignLeft, AlignBottom, "Start"); } canvas_set_color(canvas, ColorBlack); // Back - canvas_draw_icon(canvas, 74, 49, &I_Pin_back_arrow_10x8); - elements_multiline_text_aligned(canvas, 91, 57, AlignLeft, AlignBottom, "Quit"); + canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8); + elements_multiline_text_aligned(canvas, 13, 62, AlignLeft, AlignBottom, "Exit"); } static void hid_mouse_jiggler_timer_callback(void* context) { @@ -95,13 +94,25 @@ static bool hid_mouse_jiggler_input_callback(InputEvent* event, void* context) { bool consumed = false; - if(event->type == InputTypeShort && event->key == InputKeyOk) { + if(event->type == InputTypeShort) { with_view_model( hid_mouse_jiggler->view, HidMouseJigglerModel * model, - { model->running = !model->running; }, + { + switch(event->key) { + case InputKeyOk: + model->running = !model->running; + consumed = true; + break; + case InputKeyBack: + model->running = false; + break; + default: + consumed = true; + break; + } + }, true); - consumed = true; } return consumed; @@ -124,12 +135,6 @@ HidMouseJiggler* hid_mouse_jiggler_alloc(Hid* hid) { hid_mouse_jiggler->timer = furi_timer_alloc( hid_mouse_jiggler_timer_callback, FuriTimerTypePeriodic, hid_mouse_jiggler); - with_view_model( - hid_mouse_jiggler->view, - HidMouseJigglerModel * model, - { model->transport = hid->transport; }, - true); - return hid_mouse_jiggler; } diff --git a/applications/system/hid_app/views/hid_tiktok.c b/applications/system/hid_app/views/hid_tiktok.c index e1f9f4bed4c..f1501027ce2 100644 --- a/applications/system/hid_app/views/hid_tiktok.c +++ b/applications/system/hid_app/views/hid_tiktok.c @@ -19,7 +19,6 @@ typedef struct { bool ok_pressed; bool connected; bool is_cursor_set; - HidTransport transport; } HidTikTokModel; static void hid_tiktok_draw_callback(Canvas* canvas, void* context) { @@ -27,46 +26,46 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) { HidTikTokModel* model = context; // Header - if(model->transport == HidTransportBle) { - if(model->connected) { - canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); - } else { - canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); - } +#ifdef HID_TRANSPORT_BLE + if(model->connected) { + canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15); + } else { + canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); } +#endif canvas_set_font(canvas, FontPrimary); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "TikTok"); canvas_set_font(canvas, FontSecondary); // Keypad circles - canvas_draw_icon(canvas, 76, 8, &I_Circles_47x47); + canvas_draw_icon(canvas, 75, 9, &I_Dpad_49x46); // Up if(model->up_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 93, 9, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, true); + canvas_draw_icon(canvas, 93, 10, &I_Pressed_Button_13x13); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 96, 11, &I_Arr_up_7x9); + canvas_draw_icon(canvas, 96, 12, &I_Arr_up_7x9); canvas_set_color(canvas, ColorBlack); // Down if(model->down_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 93, 41, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 96, 44, &I_Arr_dwn_7x9); + canvas_draw_icon(canvas, 96, 43, &I_Arr_dwn_7x9); canvas_set_color(canvas, ColorBlack); // Left if(model->left_pressed) { - canvas_set_bitmap_mode(canvas, 1); + canvas_set_bitmap_mode(canvas, true); canvas_draw_icon(canvas, 77, 25, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } canvas_draw_icon(canvas, 81, 29, &I_Voldwn_6x6); @@ -74,19 +73,21 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) { // Right if(model->right_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 109, 25, &I_Pressed_Button_13x13); - canvas_set_bitmap_mode(canvas, 0); + canvas_set_bitmap_mode(canvas, true); + canvas_draw_icon(canvas, 110, 25, &I_Pressed_Button_13x13); + canvas_set_bitmap_mode(canvas, false); canvas_set_color(canvas, ColorWhite); } - canvas_draw_icon(canvas, 111, 29, &I_Volup_8x6); + canvas_draw_icon(canvas, 112, 29, &I_Volup_8x6); canvas_set_color(canvas, ColorBlack); // Ok if(model->ok_pressed) { - canvas_draw_icon(canvas, 91, 23, &I_Like_pressed_17x17); + canvas_set_bitmap_mode(canvas, true); + canvas_draw_icon(canvas, 91, 24, &I_Like_pressed_17x16); + canvas_set_bitmap_mode(canvas, false); } else { - canvas_draw_icon(canvas, 94, 27, &I_Like_def_11x9); + canvas_draw_icon(canvas, 93, 27, &I_Like_def_13x11); } // Exit canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8); @@ -211,9 +212,6 @@ HidTikTok* hid_tiktok_alloc(Hid* bt_hid) { view_set_draw_callback(hid_tiktok->view, hid_tiktok_draw_callback); view_set_input_callback(hid_tiktok->view, hid_tiktok_input_callback); - with_view_model( - hid_tiktok->view, HidTikTokModel * model, { model->transport = bt_hid->transport; }, true); - return hid_tiktok; } From f633f476c8d41f9b80df1ad0a1d54934482fa894 Mon Sep 17 00:00:00 2001 From: gornekich Date: Mon, 25 Mar 2024 07:18:28 +0000 Subject: [PATCH 24/28] [FL-3787] NFC: Slix privacy password reveal and Desfire detect fix (#3504) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * slix: fix incorrect default privacy passwords * slix poller: add check privacy password state * mf desfire: change detect algorithm * mf desfire: change detection algorithm to check master key version * mf desfire: change assert to check * Update api symbols and cleanup code Co-authored-by: あく --- .../protocols/mf_desfire/mf_desfire_poller.c | 4 +- .../protocols/mf_desfire/mf_desfire_poller.h | 15 ++++++ .../mf_desfire/mf_desfire_poller_i.c | 35 ++++++++----- lib/nfc/protocols/slix/slix.c | 4 +- lib/nfc/protocols/slix/slix_poller.c | 51 ++++++++++++++++++- lib/nfc/protocols/slix/slix_poller_i.h | 2 + targets/f18/api_symbols.csv | 2 +- targets/f7/api_symbols.csv | 3 +- 8 files changed, 96 insertions(+), 20 deletions(-) diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c index 5af033d4ca6..246107616d1 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.c @@ -225,8 +225,8 @@ static bool mf_desfire_poller_detect(NfcGenericEvent event, void* context) { bool protocol_detected = false; if(iso14443_4a_event->type == Iso14443_4aPollerEventTypeReady) { - MfDesfireVersion version = {}; - const MfDesfireError error = mf_desfire_poller_read_version(instance, &version); + MfDesfireKeyVersion key_version = {0}; + MfDesfireError error = mf_desfire_poller_read_key_version(instance, 0, &key_version); protocol_detected = (error == MfDesfireErrorNone); } diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.h b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.h index 6ef2f3f68d4..707df42cd62 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller.h +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller.h @@ -91,6 +91,21 @@ MfDesfireError MfDesfireError mf_desfire_poller_read_key_settings(MfDesfirePoller* instance, MfDesfireKeySettings* data); +/** + * @brief Read key version on MfDesfire card. + * + * Must ONLY be used inside the callback function. + * + * @param[in, out] instance pointer to the instance to be used in the transaction. + * @param[out] key_num key number. + * @param[in] data pointer to the MfDesfireKeyVersion structure to be filled with key version data. + * @return MfDesfireErrorNone on success, an error code on failure. + */ +MfDesfireError mf_desfire_poller_read_key_version( + MfDesfirePoller* instance, + uint8_t key_num, + MfDesfireKeyVersion* data); + /** * @brief Read key versions on MfDesfire card. * diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c index 4990e0c0686..790f1171573 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c @@ -139,6 +139,28 @@ MfDesfireError return error; } +MfDesfireError mf_desfire_poller_read_key_version( + MfDesfirePoller* instance, + uint8_t key_num, + MfDesfireKeyVersion* data) { + furi_check(instance); + furi_check(data); + + bit_buffer_set_size_bytes(instance->input_buffer, sizeof(uint8_t) * 2); + bit_buffer_set_byte(instance->input_buffer, 0, MF_DESFIRE_CMD_GET_KEY_VERSION); + bit_buffer_set_byte(instance->input_buffer, 1, key_num); + + MfDesfireError error = + mf_desfire_send_chunks(instance, instance->input_buffer, instance->result_buffer); + if(error == MfDesfireErrorNone) { + if(!mf_desfire_key_version_parse(data, instance->result_buffer)) { + error = MfDesfireErrorProtocol; + } + } + + return error; +} + MfDesfireError mf_desfire_poller_read_key_versions( MfDesfirePoller* instance, SimpleArray* data, @@ -148,22 +170,11 @@ MfDesfireError mf_desfire_poller_read_key_versions( simple_array_init(data, count); - bit_buffer_set_size_bytes(instance->input_buffer, sizeof(uint8_t) * 2); - bit_buffer_set_byte(instance->input_buffer, 0, MF_DESFIRE_CMD_GET_KEY_VERSION); - MfDesfireError error = MfDesfireErrorNone; for(uint32_t i = 0; i < count; ++i) { - bit_buffer_set_byte(instance->input_buffer, 1, i); - - error = mf_desfire_send_chunks(instance, instance->input_buffer, instance->result_buffer); - + error = mf_desfire_poller_read_key_version(instance, i, simple_array_get(data, i)); if(error != MfDesfireErrorNone) break; - - if(!mf_desfire_key_version_parse(simple_array_get(data, i), instance->result_buffer)) { - error = MfDesfireErrorProtocol; - break; - } } return error; diff --git a/lib/nfc/protocols/slix/slix.c b/lib/nfc/protocols/slix/slix.c index 41d19beb7e1..533ecff7413 100644 --- a/lib/nfc/protocols/slix/slix.c +++ b/lib/nfc/protocols/slix/slix.c @@ -78,8 +78,8 @@ typedef struct { static const SlixPasswordConfig slix_password_configs[] = { [SlixPasswordTypeRead] = {SLIX_PASSWORD_READ_KEY, SLIX_TYPE_FEATURE_READ, 0x00000000U}, [SlixPasswordTypeWrite] = {SLIX_PASSWORD_WRITE_KEY, SLIX_TYPE_FEATURE_WRITE, 0x00000000U}, - [SlixPasswordTypePrivacy] = {SLIX_PASSWORD_PRIVACY_KEY, SLIX_TYPE_FEATURE_PRIVACY, 0xFFFFFFFFU}, - [SlixPasswordTypeDestroy] = {SLIX_PASSWORD_DESTROY_KEY, SLIX_TYPE_FEATURE_DESTROY, 0xFFFFFFFFU}, + [SlixPasswordTypePrivacy] = {SLIX_PASSWORD_PRIVACY_KEY, SLIX_TYPE_FEATURE_PRIVACY, 0x0F0F0F0FU}, + [SlixPasswordTypeDestroy] = {SLIX_PASSWORD_DESTROY_KEY, SLIX_TYPE_FEATURE_DESTROY, 0x0F0F0F0FU}, [SlixPasswordTypeEasAfi] = {SLIX_PASSWORD_EAS_KEY, SLIX_TYPE_FEATURE_EAS, 0x00000000U}, }; diff --git a/lib/nfc/protocols/slix/slix_poller.c b/lib/nfc/protocols/slix/slix_poller.c index d9d38d10207..3c9a7cce4b9 100644 --- a/lib/nfc/protocols/slix/slix_poller.c +++ b/lib/nfc/protocols/slix/slix_poller.c @@ -73,17 +73,62 @@ static NfcCommand slix_poller_handler_read_signature(SlixPoller* instance) { if(slix_type_has_features(instance->type, SLIX_TYPE_FEATURE_SIGNATURE)) { instance->error = slix_poller_read_signature(instance, &instance->data->signature); if(instance->error == SlixErrorNone) { - instance->poller_state = SlixPollerStateReady; + instance->poller_state = SlixPollerStateCheckPrivacyPassword; } else { instance->poller_state = SlixPollerStateError; } } else { - instance->poller_state = SlixPollerStateReady; + instance->poller_state = SlixPollerStateCheckPrivacyPassword; } return NfcCommandContinue; } +static NfcCommand slix_poller_handler_check_privacy_password(SlixPoller* instance) { + NfcCommand command = NfcCommandContinue; + + do { + if(!slix_type_has_features(instance->type, SLIX_TYPE_FEATURE_PRIVACY)) { + instance->poller_state = SlixPollerStateReady; + break; + } + if(instance->privacy_password_checked) { + instance->poller_state = SlixPollerStateReady; + break; + } + + instance->slix_event.type = SlixPollerEventTypePrivacyUnlockRequest; + command = instance->callback(instance->general_event, instance->context); + + if(!instance->slix_event_data.privacy_password.password_set) { + instance->poller_state = SlixPollerStateReady; + break; + } + + SlixPassword pwd = instance->slix_event_data.privacy_password.password; + FURI_LOG_I(TAG, "Trying to check privacy password: %08lX", pwd); + + instance->error = slix_poller_get_random_number(instance, &instance->random_number); + if(instance->error != SlixErrorNone) { + instance->poller_state = SlixPollerStateReady; + break; + } + + instance->error = slix_poller_set_password(instance, SlixPasswordTypePrivacy, pwd); + if(instance->error != SlixErrorNone) { + command = NfcCommandReset; + break; + } + + FURI_LOG_I(TAG, "Found privacy password"); + instance->data->passwords[SlixPasswordTypePrivacy] = pwd; + instance->privacy_password_checked = true; + instance->poller_state = SlixPollerStateReady; + } while(false); + + return command; +} + static NfcCommand slix_poller_handler_privacy_unlock(SlixPoller* instance) { NfcCommand command = NfcCommandContinue; instance->poller_state = SlixPollerStateError; @@ -108,6 +153,7 @@ static NfcCommand slix_poller_handler_privacy_unlock(SlixPoller* instance) { FURI_LOG_I(TAG, "Privacy mode disabled"); instance->data->passwords[SlixPasswordTypePrivacy] = pwd; + instance->privacy_password_checked = true; instance->poller_state = SlixPollerStateIdle; slix_unlocked = true; } while(false); @@ -140,6 +186,7 @@ static const SlixPollerStateHandler slix_poller_state_handler[SlixPollerStateNum [SlixPollerStateError] = slix_poller_handler_error, [SlixPollerStateGetNxpSysInfo] = slix_poller_handler_get_nfc_system_info, [SlixPollerStateReadSignature] = slix_poller_handler_read_signature, + [SlixPollerStateCheckPrivacyPassword] = slix_poller_handler_check_privacy_password, [SlixPollerStatePrivacyUnlock] = slix_poller_handler_privacy_unlock, [SlixPollerStateReady] = slix_poller_handler_ready, }; diff --git a/lib/nfc/protocols/slix/slix_poller_i.h b/lib/nfc/protocols/slix/slix_poller_i.h index 7a3b543b7b4..38c23c297b6 100644 --- a/lib/nfc/protocols/slix/slix_poller_i.h +++ b/lib/nfc/protocols/slix/slix_poller_i.h @@ -14,6 +14,7 @@ typedef enum { SlixPollerStateIdle, SlixPollerStateGetNxpSysInfo, SlixPollerStateReadSignature, + SlixPollerStateCheckPrivacyPassword, SlixPollerStatePrivacyUnlock, SlixPollerStateReady, SlixPollerStateError, @@ -27,6 +28,7 @@ struct SlixPoller { SlixPollerState poller_state; SlixError error; SlixRandomNumber random_number; + bool privacy_password_checked; BitBuffer* tx_buffer; BitBuffer* rx_buffer; diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index f19a5428c56..880bfe754ac 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.0,, +Version,+,60.1,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index d1e91ddbedb..1f30a115048 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.0,, +Version,+,60.1,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, @@ -2444,6 +2444,7 @@ Function,+,mf_desfire_poller_read_file_settings_multi,MfDesfireError,"MfDesfireP Function,+,mf_desfire_poller_read_file_value,MfDesfireError,"MfDesfirePoller*, MfDesfireFileId, MfDesfireFileData*" Function,+,mf_desfire_poller_read_free_memory,MfDesfireError,"MfDesfirePoller*, MfDesfireFreeMemory*" Function,+,mf_desfire_poller_read_key_settings,MfDesfireError,"MfDesfirePoller*, MfDesfireKeySettings*" +Function,+,mf_desfire_poller_read_key_version,MfDesfireError,"MfDesfirePoller*, uint8_t, MfDesfireKeyVersion*" Function,+,mf_desfire_poller_read_key_versions,MfDesfireError,"MfDesfirePoller*, SimpleArray*, uint32_t" Function,+,mf_desfire_poller_read_version,MfDesfireError,"MfDesfirePoller*, MfDesfireVersion*" Function,+,mf_desfire_poller_select_application,MfDesfireError,"MfDesfirePoller*, const MfDesfireApplicationId*" From 6de2934394cd67f24d7dca52cb49303bfc06ddb2 Mon Sep 17 00:00:00 2001 From: Nikolay Minaylov Date: Mon, 25 Mar 2024 11:39:33 +0300 Subject: [PATCH 25/28] BadUSB: BLE, media keys, Fn/Globe key commands (#3403) * BadUSB: media keys, GLOBE command * f18 api table fix * BadUSB over BLE * Made PVS happy Co-authored-by: Aleksandr Kutuzov --- applications/main/bad_usb/application.fam | 2 +- applications/main/bad_usb/bad_usb_app.c | 102 +++++--- applications/main/bad_usb/bad_usb_app_i.h | 5 +- .../main/bad_usb/bad_usb_settings_filename.h | 3 - .../main/bad_usb/helpers/bad_usb_hid.c | 226 ++++++++++++++++++ .../main/bad_usb/helpers/bad_usb_hid.h | 35 +++ .../main/bad_usb/helpers/ducky_script.c | 106 ++++---- .../main/bad_usb/helpers/ducky_script.h | 3 +- .../bad_usb/helpers/ducky_script_commands.c | 50 +++- .../main/bad_usb/helpers/ducky_script_i.h | 13 +- .../bad_usb/helpers/ducky_script_keycodes.c | 44 +++- .../bad_usb/scenes/bad_usb_scene_config.c | 72 ++++-- .../scenes/bad_usb_scene_config_layout.c | 1 - .../scenes/bad_usb_scene_file_select.c | 4 - .../main/bad_usb/scenes/bad_usb_scene_work.c | 18 +- .../main/bad_usb/views/bad_usb_view.c | 21 +- .../main/bad_usb/views/bad_usb_view.h | 19 +- .../file_formats/BadUsbScriptFormat.md | 59 ++++- targets/f18/api_symbols.csv | 3 +- targets/f7/api_symbols.csv | 3 +- targets/f7/furi_hal/furi_hal_usb_hid.c | 7 + targets/furi_hal_include/furi_hal_usb_hid.h | 10 + 22 files changed, 636 insertions(+), 170 deletions(-) delete mode 100644 applications/main/bad_usb/bad_usb_settings_filename.h create mode 100644 applications/main/bad_usb/helpers/bad_usb_hid.c create mode 100644 applications/main/bad_usb/helpers/bad_usb_hid.h diff --git a/applications/main/bad_usb/application.fam b/applications/main/bad_usb/application.fam index 9844e248df9..8d3909fccc6 100644 --- a/applications/main/bad_usb/application.fam +++ b/applications/main/bad_usb/application.fam @@ -7,7 +7,7 @@ App( icon="A_BadUsb_14", order=70, resources="resources", - fap_libs=["assets"], + fap_libs=["assets", "ble_profile"], fap_icon="icon.png", fap_category="USB", ) diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_usb/bad_usb_app.c index ea97c448782..0cf7f192488 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_usb/bad_usb_app.c @@ -1,11 +1,14 @@ #include "bad_usb_app_i.h" -#include "bad_usb_settings_filename.h" #include #include #include #include +#include -#define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/" BAD_USB_SETTINGS_FILE_NAME +#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) { furi_assert(context); @@ -26,46 +29,69 @@ static void bad_usb_app_tick_event_callback(void* context) { } static void bad_usb_load_settings(BadUsbApp* app) { - File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(storage_file_open(settings_file, BAD_USB_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { - char chr; - while((storage_file_read(settings_file, &chr, 1) == 1) && - !storage_file_eof(settings_file) && !isspace(chr)) { - furi_string_push_back(app->keyboard_layout, chr); - } - } else { - furi_string_reset(app->keyboard_layout); + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* fff = flipper_format_file_alloc(storage); + bool state = false; + + FuriString* temp_str = furi_string_alloc(); + uint32_t version = 0; + uint32_t interface = 0; + + if(flipper_format_file_open_existing(fff, BAD_USB_SETTINGS_PATH)) { + do { + if(!flipper_format_read_header(fff, temp_str, &version)) break; + if((strcmp(furi_string_get_cstr(temp_str), BAD_USB_SETTINGS_FILE_TYPE) != 0) || + (version != BAD_USB_SETTINGS_VERSION)) + break; + + if(!flipper_format_read_string(fff, "layout", temp_str)) break; + if(!flipper_format_read_uint32(fff, "interface", &interface, 1)) break; + if(interface > BadUsbHidInterfaceBle) break; + + state = true; + } while(0); } - storage_file_close(settings_file); - storage_file_free(settings_file); + flipper_format_free(fff); + furi_record_close(RECORD_STORAGE); + + if(state) { + furi_string_set(app->keyboard_layout, temp_str); + app->interface = interface; - if(!furi_string_empty(app->keyboard_layout)) { Storage* fs_api = furi_record_open(RECORD_STORAGE); FileInfo layout_file_info; FS_Error file_check_err = storage_common_stat( fs_api, furi_string_get_cstr(app->keyboard_layout), &layout_file_info); furi_record_close(RECORD_STORAGE); - if(file_check_err != FSE_OK) { - furi_string_reset(app->keyboard_layout); - return; - } - if(layout_file_info.size != 256) { - furi_string_reset(app->keyboard_layout); + if((file_check_err != FSE_OK) || (layout_file_info.size != 256)) { + furi_string_set(app->keyboard_layout, BAD_USB_SETTINGS_DEFAULT_LAYOUT); } + } else { + furi_string_set(app->keyboard_layout, BAD_USB_SETTINGS_DEFAULT_LAYOUT); + app->interface = BadUsbHidInterfaceUsb; } + + furi_string_free(temp_str); } static void bad_usb_save_settings(BadUsbApp* app) { - File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(storage_file_open(settings_file, BAD_USB_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) { - storage_file_write( - settings_file, - furi_string_get_cstr(app->keyboard_layout), - furi_string_size(app->keyboard_layout)); - storage_file_write(settings_file, "\n", 1); + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* fff = flipper_format_file_alloc(storage); + + if(flipper_format_file_open_always(fff, BAD_USB_SETTINGS_PATH)) { + do { + if(!flipper_format_write_header_cstr( + fff, BAD_USB_SETTINGS_FILE_TYPE, BAD_USB_SETTINGS_VERSION)) + break; + if(!flipper_format_write_string(fff, "layout", app->keyboard_layout)) break; + uint32_t interface_id = app->interface; + if(!flipper_format_write_uint32(fff, "interface", (const uint32_t*)&interface_id, 1)) + break; + } while(0); } - storage_file_close(settings_file); - storage_file_free(settings_file); + + flipper_format_free(fff); + furi_record_close(RECORD_STORAGE); } BadUsbApp* bad_usb_app_alloc(char* arg) { @@ -103,13 +129,15 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { view_dispatcher_add_view( app->view_dispatcher, BadUsbAppViewError, widget_get_view(app->widget)); - app->submenu = submenu_alloc(); + app->var_item_list = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfig, submenu_get_view(app->submenu)); + app->view_dispatcher, + BadUsbAppViewConfig, + variable_item_list_get_view(app->var_item_list)); - app->bad_usb_view = bad_usb_alloc(); + app->bad_usb_view = bad_usb_view_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewWork, bad_usb_get_view(app->bad_usb_view)); + app->view_dispatcher, BadUsbAppViewWork, bad_usb_view_get_view(app->bad_usb_view)); view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); @@ -122,8 +150,6 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { furi_check(furi_hal_usb_set_config(NULL, NULL)); if(!furi_string_empty(app->file_path)) { - app->bad_usb_script = bad_usb_script_open(app->file_path); - bad_usb_script_set_keyboard_layout(app->bad_usb_script, app->keyboard_layout); scene_manager_next_scene(app->scene_manager, BadUsbSceneWork); } else { furi_string_set(app->file_path, BAD_USB_APP_BASE_FOLDER); @@ -144,15 +170,15 @@ void bad_usb_app_free(BadUsbApp* app) { // Views view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewWork); - bad_usb_free(app->bad_usb_view); + bad_usb_view_free(app->bad_usb_view); // Custom Widget view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewError); widget_free(app->widget); - // Submenu + // Config menu view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfig); - submenu_free(app->submenu); + variable_item_list_free(app->var_item_list); // View dispatcher view_dispatcher_free(app->view_dispatcher); diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h index cf1c02ebc7f..c12f9ac751c 100644 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ b/applications/main/bad_usb/bad_usb_app_i.h @@ -3,12 +3,12 @@ #include "bad_usb_app.h" #include "scenes/bad_usb_scene.h" #include "helpers/ducky_script.h" +#include "helpers/bad_usb_hid.h" #include #include #include #include -#include #include #include #include @@ -33,7 +33,7 @@ struct BadUsbApp { NotificationApp* notifications; DialogsApp* dialogs; Widget* widget; - Submenu* submenu; + VariableItemList* var_item_list; BadUsbAppError error; FuriString* file_path; @@ -41,6 +41,7 @@ struct BadUsbApp { BadUsb* bad_usb_view; BadUsbScript* bad_usb_script; + BadUsbHidInterface interface; FuriHalUsbInterface* usb_if_prev; }; diff --git a/applications/main/bad_usb/bad_usb_settings_filename.h b/applications/main/bad_usb/bad_usb_settings_filename.h deleted file mode 100644 index 12ba8f31c4c..00000000000 --- a/applications/main/bad_usb/bad_usb_settings_filename.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define BAD_USB_SETTINGS_FILE_NAME ".badusb.settings" diff --git a/applications/main/bad_usb/helpers/bad_usb_hid.c b/applications/main/bad_usb/helpers/bad_usb_hid.c new file mode 100644 index 00000000000..289e3ae8c1a --- /dev/null +++ b/applications/main/bad_usb/helpers/bad_usb_hid.c @@ -0,0 +1,226 @@ +#include "bad_usb_hid.h" +#include +#include +#include + +#define TAG "BadUSB HID" + +#define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys" + +void* hid_usb_init(FuriHalUsbHidConfig* hid_cfg) { + furi_check(furi_hal_usb_set_config(&usb_hid, hid_cfg)); + return NULL; +} + +void hid_usb_deinit(void* inst) { + UNUSED(inst); + furi_check(furi_hal_usb_set_config(NULL, NULL)); +} + +void hid_usb_set_state_callback(void* inst, HidStateCallback cb, void* context) { + UNUSED(inst); + furi_hal_hid_set_state_callback(cb, context); +} + +bool hid_usb_is_connected(void* inst) { + UNUSED(inst); + return furi_hal_hid_is_connected(); +} + +bool hid_usb_kb_press(void* inst, uint16_t button) { + UNUSED(inst); + return furi_hal_hid_kb_press(button); +} + +bool hid_usb_kb_release(void* inst, uint16_t button) { + UNUSED(inst); + return furi_hal_hid_kb_release(button); +} + +bool hid_usb_consumer_press(void* inst, uint16_t button) { + UNUSED(inst); + return furi_hal_hid_consumer_key_press(button); +} + +bool hid_usb_consumer_release(void* inst, uint16_t button) { + UNUSED(inst); + return furi_hal_hid_consumer_key_release(button); +} + +bool hid_usb_release_all(void* inst) { + UNUSED(inst); + bool state = furi_hal_hid_kb_release_all(); + state &= furi_hal_hid_consumer_key_release_all(); + return state; +} + +uint8_t hid_usb_get_led_state(void* inst) { + UNUSED(inst); + return furi_hal_hid_get_led_state(); +} + +static const BadUsbHidApi hid_api_usb = { + .init = hid_usb_init, + .deinit = hid_usb_deinit, + .set_state_callback = hid_usb_set_state_callback, + .is_connected = hid_usb_is_connected, + + .kb_press = hid_usb_kb_press, + .kb_release = hid_usb_kb_release, + .consumer_press = hid_usb_consumer_press, + .consumer_release = hid_usb_consumer_release, + .release_all = hid_usb_release_all, + .get_led_state = hid_usb_get_led_state, +}; + +typedef struct { + Bt* bt; + FuriHalBleProfileBase* profile; + HidStateCallback state_callback; + void* callback_context; + bool is_connected; +} BleHidInstance; + +static const BleProfileHidParams ble_hid_params = { + .device_name_prefix = "BadUSB", + .mac_xor = 0x0002, +}; + +static void hid_ble_connection_status_callback(BtStatus status, void* context) { + furi_assert(context); + BleHidInstance* ble_hid = context; + ble_hid->is_connected = (status == BtStatusConnected); + if(ble_hid->state_callback) { + ble_hid->state_callback(ble_hid->is_connected, ble_hid->callback_context); + } +} + +void* hid_ble_init(FuriHalUsbHidConfig* hid_cfg) { + UNUSED(hid_cfg); + BleHidInstance* ble_hid = malloc(sizeof(BleHidInstance)); + ble_hid->bt = furi_record_open(RECORD_BT); + bt_disconnect(ble_hid->bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + bt_keys_storage_set_storage_path(ble_hid->bt, APP_DATA_PATH(HID_BT_KEYS_STORAGE_NAME)); + + ble_hid->profile = bt_profile_start(ble_hid->bt, ble_profile_hid, (void*)&ble_hid_params); + furi_check(ble_hid->profile); + + furi_hal_bt_start_advertising(); + + bt_set_status_changed_callback(ble_hid->bt, hid_ble_connection_status_callback, ble_hid); + + return ble_hid; +} + +void hid_ble_deinit(void* inst) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + + bt_set_status_changed_callback(ble_hid->bt, NULL, NULL); + bt_disconnect(ble_hid->bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + bt_keys_storage_set_default_path(ble_hid->bt); + + furi_check(bt_profile_restore_default(ble_hid->bt)); + furi_record_close(RECORD_BT); + free(ble_hid); +} + +void hid_ble_set_state_callback(void* inst, HidStateCallback cb, void* context) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + ble_hid->state_callback = cb; + ble_hid->callback_context = context; +} + +bool hid_ble_is_connected(void* inst) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + return ble_hid->is_connected; +} + +bool hid_ble_kb_press(void* inst, uint16_t button) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + return ble_profile_hid_kb_press(ble_hid->profile, button); +} + +bool hid_ble_kb_release(void* inst, uint16_t button) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + return ble_profile_hid_kb_release(ble_hid->profile, button); +} + +bool hid_ble_consumer_press(void* inst, uint16_t button) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + return ble_profile_hid_consumer_key_press(ble_hid->profile, button); +} + +bool hid_ble_consumer_release(void* inst, uint16_t button) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + return ble_profile_hid_consumer_key_release(ble_hid->profile, button); +} + +bool hid_ble_release_all(void* inst) { + BleHidInstance* ble_hid = inst; + furi_assert(ble_hid); + bool state = ble_profile_hid_kb_release_all(ble_hid->profile); + state &= ble_profile_hid_consumer_key_release_all(ble_hid->profile); + return state; +} + +uint8_t hid_ble_get_led_state(void* inst) { + UNUSED(inst); + FURI_LOG_W(TAG, "hid_ble_get_led_state not implemented"); + return 0; +} + +static const BadUsbHidApi hid_api_ble = { + .init = hid_ble_init, + .deinit = hid_ble_deinit, + .set_state_callback = hid_ble_set_state_callback, + .is_connected = hid_ble_is_connected, + + .kb_press = hid_ble_kb_press, + .kb_release = hid_ble_kb_release, + .consumer_press = hid_ble_consumer_press, + .consumer_release = hid_ble_consumer_release, + .release_all = hid_ble_release_all, + .get_led_state = hid_ble_get_led_state, +}; + +const BadUsbHidApi* bad_usb_hid_get_interface(BadUsbHidInterface interface) { + if(interface == BadUsbHidInterfaceUsb) { + return &hid_api_usb; + } else { + return &hid_api_ble; + } +} + +void bad_usb_hid_ble_remove_pairing(void) { + Bt* bt = furi_record_open(RECORD_BT); + bt_disconnect(bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + furi_hal_bt_stop_advertising(); + + bt_keys_storage_set_storage_path(bt, APP_DATA_PATH(HID_BT_KEYS_STORAGE_NAME)); + bt_forget_bonded_devices(bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + bt_keys_storage_set_default_path(bt); + + 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/bad_usb_hid.h b/applications/main/bad_usb/helpers/bad_usb_hid.h new file mode 100644 index 00000000000..71d3a58e793 --- /dev/null +++ b/applications/main/bad_usb/helpers/bad_usb_hid.h @@ -0,0 +1,35 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef enum { + BadUsbHidInterfaceUsb, + BadUsbHidInterfaceBle, +} BadUsbHidInterface; + +typedef struct { + void* (*init)(FuriHalUsbHidConfig* hid_cfg); + void (*deinit)(void* inst); + void (*set_state_callback)(void* inst, HidStateCallback cb, void* context); + bool (*is_connected)(void* inst); + + bool (*kb_press)(void* inst, uint16_t button); + bool (*kb_release)(void* inst, uint16_t button); + bool (*consumer_press)(void* inst, uint16_t button); + bool (*consumer_release)(void* inst, uint16_t button); + bool (*release_all)(void* inst); + uint8_t (*get_led_state)(void* inst); +} BadUsbHidApi; + +const BadUsbHidApi* bad_usb_hid_get_interface(BadUsbHidInterface interface); + +void bad_usb_hid_ble_remove_pairing(void); + +#ifdef __cplusplus +} +#endif diff --git a/applications/main/bad_usb/helpers/ducky_script.c b/applications/main/bad_usb/helpers/ducky_script.c index 5a32ae433ee..077b1c37b8e 100644 --- a/applications/main/bad_usb/helpers/ducky_script.c +++ b/applications/main/bad_usb/helpers/ducky_script.c @@ -3,7 +3,6 @@ #include #include #include -#include #include #include "ducky_script.h" #include "ducky_script_i.h" @@ -71,39 +70,40 @@ bool ducky_get_number(const char* param, uint32_t* val) { return false; } -void ducky_numlock_on(void) { - if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { - furi_hal_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); - furi_hal_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); +void ducky_numlock_on(BadUsbScript* bad_usb) { + if((bad_usb->hid->get_led_state(bad_usb->hid_inst) & HID_KB_LED_NUM) == 0) { + bad_usb->hid->kb_press(bad_usb->hid_inst, HID_KEYBOARD_LOCK_NUM_LOCK); + bad_usb->hid->kb_release(bad_usb->hid_inst, HID_KEYBOARD_LOCK_NUM_LOCK); } } -bool ducky_numpad_press(const char num) { + +bool ducky_numpad_press(BadUsbScript* bad_usb, const char num) { if((num < '0') || (num > '9')) return false; uint16_t key = numpad_keys[num - '0']; - furi_hal_hid_kb_press(key); - furi_hal_hid_kb_release(key); + bad_usb->hid->kb_press(bad_usb->hid_inst, key); + bad_usb->hid->kb_release(bad_usb->hid_inst, key); return true; } -bool ducky_altchar(const char* charcode) { +bool ducky_altchar(BadUsbScript* bad_usb, const char* charcode) { uint8_t i = 0; bool state = false; - furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT); + bad_usb->hid->kb_press(bad_usb->hid_inst, KEY_MOD_LEFT_ALT); while(!ducky_is_line_end(charcode[i])) { - state = ducky_numpad_press(charcode[i]); + state = ducky_numpad_press(bad_usb, charcode[i]); if(state == false) break; i++; } - furi_hal_hid_kb_release(KEY_MOD_LEFT_ALT); + bad_usb->hid->kb_release(bad_usb->hid_inst, KEY_MOD_LEFT_ALT); return state; } -bool ducky_altstring(const char* param) { +bool ducky_altstring(BadUsbScript* bad_usb, const char* param) { uint32_t i = 0; bool state = false; @@ -116,7 +116,7 @@ bool ducky_altstring(const char* param) { char temp_str[4]; snprintf(temp_str, 4, "%u", param[i]); - state = ducky_altchar(temp_str); + state = ducky_altchar(bad_usb, temp_str); if(state == false) break; i++; } @@ -140,12 +140,12 @@ bool ducky_string(BadUsbScript* bad_usb, const char* param) { if(param[i] != '\n') { uint16_t keycode = BADUSB_ASCII_TO_KEY(bad_usb, param[i]); if(keycode != HID_KEYBOARD_NONE) { - furi_hal_hid_kb_press(keycode); - furi_hal_hid_kb_release(keycode); + bad_usb->hid->kb_press(bad_usb->hid_inst, keycode); + bad_usb->hid->kb_release(bad_usb->hid_inst, keycode); } } else { - furi_hal_hid_kb_press(HID_KEYBOARD_RETURN); - furi_hal_hid_kb_release(HID_KEYBOARD_RETURN); + bad_usb->hid->kb_press(bad_usb->hid_inst, HID_KEYBOARD_RETURN); + bad_usb->hid->kb_release(bad_usb->hid_inst, HID_KEYBOARD_RETURN); } i++; } @@ -163,12 +163,12 @@ static bool ducky_string_next(BadUsbScript* bad_usb) { if(print_char != '\n') { uint16_t keycode = BADUSB_ASCII_TO_KEY(bad_usb, print_char); if(keycode != HID_KEYBOARD_NONE) { - furi_hal_hid_kb_press(keycode); - furi_hal_hid_kb_release(keycode); + bad_usb->hid->kb_press(bad_usb->hid_inst, keycode); + bad_usb->hid->kb_release(bad_usb->hid_inst, keycode); } } else { - furi_hal_hid_kb_press(HID_KEYBOARD_RETURN); - furi_hal_hid_kb_release(HID_KEYBOARD_RETURN); + bad_usb->hid->kb_press(bad_usb->hid_inst, HID_KEYBOARD_RETURN); + bad_usb->hid->kb_release(bad_usb->hid_inst, HID_KEYBOARD_RETURN); } bad_usb->string_print_pos++; @@ -201,8 +201,8 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, FuriString* line) { line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; key |= ducky_get_keycode(bad_usb, line_tmp, true); } - furi_hal_hid_kb_press(key); - furi_hal_hid_kb_release(key); + bad_usb->hid->kb_press(bad_usb->hid_inst, key); + bad_usb->hid->kb_release(bad_usb->hid_inst, key); return 0; } @@ -231,6 +231,17 @@ static bool ducky_set_usb_id(BadUsbScript* bad_usb, const char* line) { return false; } +static void bad_usb_hid_state_callback(bool state, void* context) { + furi_assert(context); + BadUsbScript* bad_usb = context; + + if(state == true) { + furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtConnect); + } else { + furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtDisconnect); + } +} + static bool ducky_script_preload(BadUsbScript* bad_usb, File* script_file) { uint8_t ret = 0; uint32_t line_len = 0; @@ -265,10 +276,11 @@ static bool ducky_script_preload(BadUsbScript* bad_usb, File* script_file) { } if(id_set) { - furi_check(furi_hal_usb_set_config(&usb_hid, &bad_usb->hid_cfg)); + bad_usb->hid_inst = bad_usb->hid->init(&bad_usb->hid_cfg); } else { - furi_check(furi_hal_usb_set_config(&usb_hid, NULL)); + bad_usb->hid_inst = bad_usb->hid->init(NULL); } + bad_usb->hid->set_state_callback(bad_usb->hid_inst, bad_usb_hid_state_callback, bad_usb); storage_file_seek(script_file, 0, true); furi_string_reset(bad_usb->line); @@ -345,17 +357,6 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil return 0; } -static void bad_usb_hid_state_callback(bool state, void* context) { - furi_assert(context); - BadUsbScript* bad_usb = context; - - if(state == true) { - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtConnect); - } else { - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtDisconnect); - } -} - static uint32_t bad_usb_flags_get(uint32_t flags_mask, uint32_t timeout) { uint32_t flags = furi_thread_flags_get(); furi_check((flags & FuriFlagError) == 0); @@ -382,8 +383,6 @@ static int32_t bad_usb_worker(void* context) { bad_usb->line_prev = furi_string_alloc(); bad_usb->string_print = furi_string_alloc(); - furi_hal_hid_set_state_callback(bad_usb_hid_state_callback, bad_usb); - while(1) { if(worker_state == BadUsbStateInit) { // State: initialization if(storage_file_open( @@ -392,7 +391,7 @@ static int32_t bad_usb_worker(void* context) { FSAM_READ, FSOM_OPEN_EXISTING)) { if((ducky_script_preload(bad_usb, script_file)) && (bad_usb->st.line_nb > 0)) { - if(furi_hal_hid_is_connected()) { + if(bad_usb->hid->is_connected(bad_usb->hid_inst)) { worker_state = BadUsbStateIdle; // Ready to run } else { worker_state = BadUsbStateNotConnected; // USB not connected @@ -408,7 +407,8 @@ static int32_t bad_usb_worker(void* context) { } else if(worker_state == BadUsbStateNotConnected) { // State: USB not connected uint32_t flags = bad_usb_flags_get( - WorkerEvtEnd | WorkerEvtConnect | WorkerEvtStartStop, FuriWaitForever); + WorkerEvtEnd | WorkerEvtConnect | WorkerEvtDisconnect | WorkerEvtStartStop, + FuriWaitForever); if(flags & WorkerEvtEnd) { break; @@ -490,10 +490,10 @@ static int32_t bad_usb_worker(void* context) { break; } else if(flags & WorkerEvtStartStop) { worker_state = BadUsbStateIdle; // Stop executing script - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(flags & WorkerEvtDisconnect) { worker_state = BadUsbStateNotConnected; // USB disconnected - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(flags & WorkerEvtPauseResume) { pause_state = BadUsbStateRunning; worker_state = BadUsbStatePaused; // Pause @@ -513,12 +513,12 @@ static int32_t bad_usb_worker(void* context) { delay_val = 0; worker_state = BadUsbStateScriptError; bad_usb->st.state = worker_state; - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(delay_val == SCRIPT_STATE_END) { // End of script delay_val = 0; worker_state = BadUsbStateIdle; bad_usb->st.state = BadUsbStateDone; - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); continue; } else if(delay_val == SCRIPT_STATE_STRING_START) { // Start printing string with delays delay_val = bad_usb->defdelay; @@ -546,7 +546,7 @@ static int32_t bad_usb_worker(void* context) { worker_state = BadUsbStateRunning; } else if(flags & WorkerEvtDisconnect) { worker_state = BadUsbStateNotConnected; // USB disconnected - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } bad_usb->st.state = worker_state; continue; @@ -561,11 +561,11 @@ static int32_t bad_usb_worker(void* context) { } else if(flags & WorkerEvtStartStop) { worker_state = BadUsbStateIdle; // Stop executing script bad_usb->st.state = worker_state; - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(flags & WorkerEvtDisconnect) { worker_state = BadUsbStateNotConnected; // USB disconnected bad_usb->st.state = worker_state; - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(flags & WorkerEvtPauseResume) { if(pause_state == BadUsbStateRunning) { if(delay_val > 0) { @@ -595,10 +595,10 @@ static int32_t bad_usb_worker(void* context) { break; } else if(flags & WorkerEvtStartStop) { worker_state = BadUsbStateIdle; // Stop executing script - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(flags & WorkerEvtDisconnect) { worker_state = BadUsbStateNotConnected; // USB disconnected - furi_hal_hid_kb_release_all(); + bad_usb->hid->release_all(bad_usb->hid_inst); } else if(flags & WorkerEvtPauseResume) { pause_state = BadUsbStateStringDelay; worker_state = BadUsbStatePaused; // Pause @@ -628,7 +628,8 @@ static int32_t bad_usb_worker(void* context) { } } - furi_hal_hid_set_state_callback(NULL, NULL); + bad_usb->hid->set_state_callback(bad_usb->hid_inst, NULL, NULL); + bad_usb->hid->deinit(bad_usb->hid_inst); storage_file_close(script_file); storage_file_free(script_file); @@ -647,7 +648,7 @@ static void bad_usb_script_set_default_keyboard_layout(BadUsbScript* bad_usb) { memcpy(bad_usb->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_usb->layout))); } -BadUsbScript* bad_usb_script_open(FuriString* file_path) { +BadUsbScript* bad_usb_script_open(FuriString* file_path, BadUsbHidInterface interface) { furi_assert(file_path); BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript)); @@ -657,6 +658,7 @@ BadUsbScript* bad_usb_script_open(FuriString* file_path) { bad_usb->st.state = BadUsbStateInit; bad_usb->st.error[0] = '\0'; + bad_usb->hid = bad_usb_hid_get_interface(interface); bad_usb->thread = furi_thread_alloc_ex("BadUsbWorker", 2048, bad_usb_worker, bad_usb); furi_thread_start(bad_usb->thread); diff --git a/applications/main/bad_usb/helpers/ducky_script.h b/applications/main/bad_usb/helpers/ducky_script.h index dca61ed4e43..9519623f604 100644 --- a/applications/main/bad_usb/helpers/ducky_script.h +++ b/applications/main/bad_usb/helpers/ducky_script.h @@ -6,6 +6,7 @@ extern "C" { #include #include +#include "bad_usb_hid.h" typedef enum { BadUsbStateInit, @@ -33,7 +34,7 @@ typedef struct { typedef struct BadUsbScript BadUsbScript; -BadUsbScript* bad_usb_script_open(FuriString* file_path); +BadUsbScript* bad_usb_script_open(FuriString* file_path, BadUsbHidInterface interface); void bad_usb_script_close(BadUsbScript* bad_usb); diff --git a/applications/main/bad_usb/helpers/ducky_script_commands.c b/applications/main/bad_usb/helpers/ducky_script_commands.c index fdf963b4040..7f9a48fb20b 100644 --- a/applications/main/bad_usb/helpers/ducky_script_commands.c +++ b/applications/main/bad_usb/helpers/ducky_script_commands.c @@ -1,5 +1,4 @@ #include -#include #include "ducky_script.h" #include "ducky_script_i.h" @@ -93,9 +92,9 @@ static int32_t ducky_fnc_sysrq(BadUsbScript* bad_usb, const char* line, int32_t line = &line[ducky_get_command_len(line) + 1]; uint16_t key = ducky_get_keycode(bad_usb, line, true); - furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); - furi_hal_hid_kb_press(key); - furi_hal_hid_kb_release_all(); + bad_usb->hid->kb_press(bad_usb->hid_inst, KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); + bad_usb->hid->kb_press(bad_usb->hid_inst, key); + bad_usb->hid->release_all(bad_usb->hid_inst); return 0; } @@ -103,8 +102,8 @@ static int32_t ducky_fnc_altchar(BadUsbScript* bad_usb, const char* line, int32_ UNUSED(param); line = &line[ducky_get_command_len(line) + 1]; - ducky_numlock_on(); - bool state = ducky_altchar(line); + ducky_numlock_on(bad_usb); + bool state = ducky_altchar(bad_usb, line); if(!state) { return ducky_error(bad_usb, "Invalid altchar %s", line); } @@ -115,8 +114,8 @@ static int32_t ducky_fnc_altstring(BadUsbScript* bad_usb, const char* line, int3 UNUSED(param); line = &line[ducky_get_command_len(line) + 1]; - ducky_numlock_on(); - bool state = ducky_altstring(line); + ducky_numlock_on(bad_usb); + bool state = ducky_altstring(bad_usb, line); if(!state) { return ducky_error(bad_usb, "Invalid altstring %s", line); } @@ -135,7 +134,7 @@ static int32_t ducky_fnc_hold(BadUsbScript* bad_usb, const char* line, int32_t p if(bad_usb->key_hold_nb > (HID_KB_MAX_KEYS - 1)) { return ducky_error(bad_usb, "Too many keys are hold"); } - furi_hal_hid_kb_press(key); + bad_usb->hid->kb_press(bad_usb->hid_inst, key); return 0; } @@ -151,7 +150,36 @@ static int32_t ducky_fnc_release(BadUsbScript* bad_usb, const char* line, int32_ return ducky_error(bad_usb, "No keys are hold"); } bad_usb->key_hold_nb--; - furi_hal_hid_kb_release(key); + bad_usb->hid->kb_release(bad_usb->hid_inst, key); + return 0; +} + +static int32_t ducky_fnc_media(BadUsbScript* bad_usb, const char* line, int32_t param) { + UNUSED(param); + + line = &line[ducky_get_command_len(line) + 1]; + uint16_t key = ducky_get_media_keycode_by_name(line); + if(key == HID_CONSUMER_UNASSIGNED) { + return ducky_error(bad_usb, "No keycode defined for %s", line); + } + bad_usb->hid->consumer_press(bad_usb->hid_inst, key); + bad_usb->hid->consumer_release(bad_usb->hid_inst, key); + return 0; +} + +static int32_t ducky_fnc_globe(BadUsbScript* bad_usb, const char* line, int32_t param) { + UNUSED(param); + + line = &line[ducky_get_command_len(line) + 1]; + uint16_t key = ducky_get_keycode(bad_usb, line, true); + if(key == HID_KEYBOARD_NONE) { + return ducky_error(bad_usb, "No keycode defined for %s", line); + } + + bad_usb->hid->consumer_press(bad_usb->hid_inst, HID_CONSUMER_FN_GLOBE); + bad_usb->hid->kb_press(bad_usb->hid_inst, key); + bad_usb->hid->kb_release(bad_usb->hid_inst, key); + bad_usb->hid->consumer_release(bad_usb->hid_inst, HID_CONSUMER_FN_GLOBE); return 0; } @@ -183,6 +211,8 @@ static const DuckyCmd ducky_commands[] = { {"HOLD", ducky_fnc_hold, -1}, {"RELEASE", ducky_fnc_release, -1}, {"WAIT_FOR_BUTTON_PRESS", ducky_fnc_waitforbutton, -1}, + {"MEDIA", ducky_fnc_media, -1}, + {"GLOBE", ducky_fnc_globe, -1}, }; #define TAG "BadUsb" diff --git a/applications/main/bad_usb/helpers/ducky_script_i.h b/applications/main/bad_usb/helpers/ducky_script_i.h index 9c1025b00b5..bbafdccb6a0 100644 --- a/applications/main/bad_usb/helpers/ducky_script_i.h +++ b/applications/main/bad_usb/helpers/ducky_script_i.h @@ -7,6 +7,7 @@ extern "C" { #include #include #include "ducky_script.h" +#include "bad_usb_hid.h" #define SCRIPT_STATE_ERROR (-1) #define SCRIPT_STATE_END (-2) @@ -19,6 +20,8 @@ extern "C" { struct BadUsbScript { FuriHalUsbHidConfig hid_cfg; + const BadUsbHidApi* hid; + void* hid_inst; FuriThread* thread; BadUsbState st; @@ -50,15 +53,17 @@ bool ducky_is_line_end(const char chr); uint16_t ducky_get_keycode_by_name(const char* param); +uint16_t ducky_get_media_keycode_by_name(const char* param); + bool ducky_get_number(const char* param, uint32_t* val); -void ducky_numlock_on(void); +void ducky_numlock_on(BadUsbScript* bad_usb); -bool ducky_numpad_press(const char num); +bool ducky_numpad_press(BadUsbScript* bad_usb, const char num); -bool ducky_altchar(const char* charcode); +bool ducky_altchar(BadUsbScript* bad_usb, const char* charcode); -bool ducky_altstring(const char* param); +bool ducky_altstring(BadUsbScript* bad_usb, const char* param); bool ducky_string(BadUsbScript* bad_usb, const char* param); diff --git a/applications/main/bad_usb/helpers/ducky_script_keycodes.c b/applications/main/bad_usb/helpers/ducky_script_keycodes.c index 56b5144d48d..290618c131b 100644 --- a/applications/main/bad_usb/helpers/ducky_script_keycodes.c +++ b/applications/main/bad_usb/helpers/ducky_script_keycodes.c @@ -1,5 +1,4 @@ #include -#include #include "ducky_script_i.h" typedef struct { @@ -78,6 +77,37 @@ static const DuckyKey ducky_keys[] = { {"F24", HID_KEYBOARD_F24}, }; +static const DuckyKey ducky_media_keys[] = { + {"POWER", HID_CONSUMER_POWER}, + {"REBOOT", HID_CONSUMER_RESET}, + {"SLEEP", HID_CONSUMER_SLEEP}, + {"LOGOFF", HID_CONSUMER_AL_LOGOFF}, + + {"EXIT", HID_CONSUMER_AC_EXIT}, + {"HOME", HID_CONSUMER_AC_HOME}, + {"BACK", HID_CONSUMER_AC_BACK}, + {"FORWARD", HID_CONSUMER_AC_FORWARD}, + {"REFRESH", HID_CONSUMER_AC_REFRESH}, + + {"SNAPSHOT", HID_CONSUMER_SNAPSHOT}, + + {"PLAY", HID_CONSUMER_PLAY}, + {"PAUSE", HID_CONSUMER_PAUSE}, + {"PLAY_PAUSE", HID_CONSUMER_PLAY_PAUSE}, + {"NEXT_TRACK", HID_CONSUMER_SCAN_NEXT_TRACK}, + {"PREV_TRACK", HID_CONSUMER_SCAN_PREVIOUS_TRACK}, + {"STOP", HID_CONSUMER_STOP}, + {"EJECT", HID_CONSUMER_EJECT}, + + {"MUTE", HID_CONSUMER_MUTE}, + {"VOLUME_UP", HID_CONSUMER_VOLUME_INCREMENT}, + {"VOLUME_DOWN", HID_CONSUMER_VOLUME_DECREMENT}, + + {"FN", HID_CONSUMER_FN_GLOBE}, + {"BRIGHT_UP", HID_CONSUMER_BRIGHTNESS_INCREMENT}, + {"BRIGHT_DOWN", HID_CONSUMER_BRIGHTNESS_DECREMENT}, +}; + uint16_t ducky_get_keycode_by_name(const char* param) { for(size_t i = 0; i < COUNT_OF(ducky_keys); i++) { size_t key_cmd_len = strlen(ducky_keys[i].name); @@ -89,3 +119,15 @@ uint16_t ducky_get_keycode_by_name(const char* param) { return HID_KEYBOARD_NONE; } + +uint16_t ducky_get_media_keycode_by_name(const char* param) { + for(size_t i = 0; i < COUNT_OF(ducky_media_keys); i++) { + size_t key_cmd_len = strlen(ducky_media_keys[i].name); + if((strncmp(param, ducky_media_keys[i].name, key_cmd_len) == 0) && + (ducky_is_line_end(param[key_cmd_len]))) { + return ducky_media_keys[i].keycode; + } + } + + return HID_CONSUMER_UNASSIGNED; +} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config.c b/applications/main/bad_usb/scenes/bad_usb_scene_config.c index 5477c5e8072..d5f6fce2360 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config.c @@ -1,29 +1,62 @@ #include "../bad_usb_app_i.h" #include "furi_hal_power.h" -#include "furi_hal_usb.h" enum SubmenuIndex { - SubmenuIndexKeyboardLayout, + ConfigIndexKeyboardLayout, + ConfigIndexInterface, + ConfigIndexBleUnpair, }; -void bad_usb_scene_config_submenu_callback(void* context, uint32_t index) { +const char* const interface_mode_text[2] = { + "USB", + "BLE", +}; + +void bad_usb_scene_config_select_callback(void* context, uint32_t index) { BadUsbApp* bad_usb = context; - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); + if(index != ConfigIndexInterface) { + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); + } +} + +void bad_usb_scene_config_interface_callback(VariableItem* item) { + BadUsbApp* bad_usb = variable_item_get_context(item); + furi_assert(bad_usb); + uint8_t index = variable_item_get_current_value_index(item); + + variable_item_set_current_value_text(item, interface_mode_text[index]); + bad_usb->interface = index; + + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, ConfigIndexInterface); +} + +static void draw_menu(BadUsbApp* bad_usb) { + VariableItemList* var_item_list = bad_usb->var_item_list; + + variable_item_list_reset(var_item_list); + + variable_item_list_add(var_item_list, "Keyboard Layout (global)", 0, NULL, NULL); + + VariableItem* item = variable_item_list_add( + var_item_list, "Interface", 2, bad_usb_scene_config_interface_callback, bad_usb); + if(bad_usb->interface == BadUsbHidInterfaceUsb) { + variable_item_set_current_value_index(item, 0); + variable_item_set_current_value_text(item, interface_mode_text[0]); + } else { + variable_item_set_current_value_index(item, 1); + variable_item_set_current_value_text(item, interface_mode_text[1]); + variable_item_list_add(var_item_list, "Remove Pairing", 0, NULL, NULL); + } } void bad_usb_scene_config_on_enter(void* context) { BadUsbApp* bad_usb = context; - Submenu* submenu = bad_usb->submenu; - - submenu_add_item( - submenu, - "Keyboard Layout (global)", - SubmenuIndexKeyboardLayout, - bad_usb_scene_config_submenu_callback, - bad_usb); + VariableItemList* var_item_list = bad_usb->var_item_list; - submenu_set_selected_item( - submenu, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig)); + variable_item_list_set_enter_callback( + var_item_list, bad_usb_scene_config_select_callback, bad_usb); + draw_menu(bad_usb); + variable_item_list_set_selected_item(var_item_list, 0); view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfig); } @@ -33,10 +66,13 @@ bool bad_usb_scene_config_on_event(void* context, SceneManagerEvent event) { bool consumed = false; if(event.type == SceneManagerEventTypeCustom) { - scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, event.event); consumed = true; - if(event.event == SubmenuIndexKeyboardLayout) { + if(event.event == ConfigIndexKeyboardLayout) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); + } else if(event.event == ConfigIndexInterface) { + draw_menu(bad_usb); + } else if(event.event == ConfigIndexBleUnpair) { + bad_usb_hid_ble_remove_pairing(); } else { furi_crash("Unknown key type"); } @@ -47,7 +83,7 @@ bool bad_usb_scene_config_on_event(void* context, SceneManagerEvent event) { void bad_usb_scene_config_on_exit(void* context) { BadUsbApp* bad_usb = context; - Submenu* submenu = bad_usb->submenu; + VariableItemList* var_item_list = bad_usb->var_item_list; - submenu_reset(submenu); + variable_item_list_reset(var_item_list); } diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c index 5d70b801b25..2dbacbe12fb 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c @@ -1,6 +1,5 @@ #include "../bad_usb_app_i.h" #include "furi_hal_power.h" -#include "furi_hal_usb.h" #include static bool bad_usb_layout_select(BadUsbApp* bad_usb) { diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c index d6f05a1edec..5e2c3f14b4f 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c @@ -1,6 +1,5 @@ #include "../bad_usb_app_i.h" #include -#include #include static bool bad_usb_file_select(BadUsbApp* bad_usb) { @@ -28,9 +27,6 @@ void bad_usb_scene_file_select_on_enter(void* context) { } if(bad_usb_file_select(bad_usb)) { - bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path); - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork); } else { view_dispatcher_stop(bad_usb->view_dispatcher); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_work.c b/applications/main/bad_usb/scenes/bad_usb_scene_work.c index ad33a124d2a..0a383f02958 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_work.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_work.c @@ -16,7 +16,10 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == InputKeyLeft) { - if(bad_usb_is_idle_state(app->bad_usb_view)) { + if(bad_usb_view_is_idle_state(app->bad_usb_view)) { + bad_usb_script_close(app->bad_usb_script); + app->bad_usb_script = NULL; + scene_manager_next_scene(app->scene_manager, BadUsbSceneConfig); } consumed = true; @@ -28,7 +31,7 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { consumed = true; } } else if(event.type == SceneManagerEventTypeTick) { - bad_usb_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script)); + bad_usb_view_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script)); } return consumed; } @@ -36,21 +39,24 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { void bad_usb_scene_work_on_enter(void* context) { BadUsbApp* app = context; + app->bad_usb_script = bad_usb_script_open(app->file_path, app->interface); + bad_usb_script_set_keyboard_layout(app->bad_usb_script, app->keyboard_layout); + FuriString* file_name; file_name = furi_string_alloc(); path_extract_filename(app->file_path, file_name, true); - bad_usb_set_file_name(app->bad_usb_view, furi_string_get_cstr(file_name)); + bad_usb_view_set_file_name(app->bad_usb_view, furi_string_get_cstr(file_name)); furi_string_free(file_name); FuriString* layout; layout = furi_string_alloc(); path_extract_filename(app->keyboard_layout, layout, true); - bad_usb_set_layout(app->bad_usb_view, furi_string_get_cstr(layout)); + bad_usb_view_set_layout(app->bad_usb_view, furi_string_get_cstr(layout)); furi_string_free(layout); - bad_usb_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script)); + bad_usb_view_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script)); - bad_usb_set_button_callback(app->bad_usb_view, bad_usb_scene_work_button_callback, app); + bad_usb_view_set_button_callback(app->bad_usb_view, bad_usb_scene_work_button_callback, app); view_dispatcher_switch_to_view(app->view_dispatcher, BadUsbAppViewWork); } diff --git a/applications/main/bad_usb/views/bad_usb_view.c b/applications/main/bad_usb/views/bad_usb_view.c index 6ffa0f3c65d..728f843487f 100644 --- a/applications/main/bad_usb/views/bad_usb_view.c +++ b/applications/main/bad_usb/views/bad_usb_view.c @@ -66,7 +66,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect"); - canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "to USB"); + canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "to device"); } else if(state == BadUsbStateWillRun) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); @@ -193,7 +193,7 @@ static bool bad_usb_input_callback(InputEvent* event, void* context) { return consumed; } -BadUsb* bad_usb_alloc(void) { +BadUsb* bad_usb_view_alloc(void) { BadUsb* bad_usb = malloc(sizeof(BadUsb)); bad_usb->view = view_alloc(); @@ -205,18 +205,21 @@ BadUsb* bad_usb_alloc(void) { return bad_usb; } -void bad_usb_free(BadUsb* bad_usb) { +void bad_usb_view_free(BadUsb* bad_usb) { furi_assert(bad_usb); view_free(bad_usb->view); free(bad_usb); } -View* bad_usb_get_view(BadUsb* bad_usb) { +View* bad_usb_view_get_view(BadUsb* bad_usb) { furi_assert(bad_usb); return bad_usb->view; } -void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, void* context) { +void bad_usb_view_set_button_callback( + BadUsb* bad_usb, + BadUsbButtonCallback callback, + void* context) { furi_assert(bad_usb); furi_assert(callback); with_view_model( @@ -230,7 +233,7 @@ void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, true); } -void bad_usb_set_file_name(BadUsb* bad_usb, const char* name) { +void bad_usb_view_set_file_name(BadUsb* bad_usb, const char* name) { furi_assert(name); with_view_model( bad_usb->view, @@ -239,7 +242,7 @@ void bad_usb_set_file_name(BadUsb* bad_usb, const char* name) { true); } -void bad_usb_set_layout(BadUsb* bad_usb, const char* layout) { +void bad_usb_view_set_layout(BadUsb* bad_usb, const char* layout) { furi_assert(layout); with_view_model( bad_usb->view, @@ -248,7 +251,7 @@ void bad_usb_set_layout(BadUsb* bad_usb, const char* layout) { true); } -void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) { +void bad_usb_view_set_state(BadUsb* bad_usb, BadUsbState* st) { furi_assert(st); with_view_model( bad_usb->view, @@ -263,7 +266,7 @@ void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) { true); } -bool bad_usb_is_idle_state(BadUsb* bad_usb) { +bool bad_usb_view_is_idle_state(BadUsb* bad_usb) { bool is_idle = false; with_view_model( bad_usb->view, diff --git a/applications/main/bad_usb/views/bad_usb_view.h b/applications/main/bad_usb/views/bad_usb_view.h index ee58e7bd04c..45f13d650b7 100644 --- a/applications/main/bad_usb/views/bad_usb_view.h +++ b/applications/main/bad_usb/views/bad_usb_view.h @@ -6,18 +6,21 @@ typedef struct BadUsb BadUsb; typedef void (*BadUsbButtonCallback)(InputKey key, void* context); -BadUsb* bad_usb_alloc(void); +BadUsb* bad_usb_view_alloc(void); -void bad_usb_free(BadUsb* bad_usb); +void bad_usb_view_free(BadUsb* bad_usb); -View* bad_usb_get_view(BadUsb* bad_usb); +View* bad_usb_view_get_view(BadUsb* bad_usb); -void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, void* context); +void bad_usb_view_set_button_callback( + BadUsb* bad_usb, + BadUsbButtonCallback callback, + void* context); -void bad_usb_set_file_name(BadUsb* bad_usb, const char* name); +void bad_usb_view_set_file_name(BadUsb* bad_usb, const char* name); -void bad_usb_set_layout(BadUsb* bad_usb, const char* layout); +void bad_usb_view_set_layout(BadUsb* bad_usb, const char* layout); -void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st); +void bad_usb_view_set_state(BadUsb* bad_usb, BadUsbState* st); -bool bad_usb_is_idle_state(BadUsb* bad_usb); +bool bad_usb_view_is_idle_state(BadUsb* bad_usb); diff --git a/documentation/file_formats/BadUsbScriptFormat.md b/documentation/file_formats/BadUsbScriptFormat.md index cc919da0944..1bac3c4aa43 100644 --- a/documentation/file_formats/BadUsbScriptFormat.md +++ b/documentation/file_formats/BadUsbScriptFormat.md @@ -79,15 +79,7 @@ Up to 5 keys can be hold simultaneously. | HOLD | Special key or single character | Press and hold key until RELEASE command | | RELEASE | Special key or single character | Release key | -## Wait for button press - -Will wait indefinitely for a button to be pressed -| Command | Parameters | Notes | -| --------------------- | ------------ | --------------------------------------------------------------------- | -| WAIT_FOR_BUTTON_PRESS | None | Will wait for the user to press a button to continue script execution | - - -### String +## String | Command | Parameters | Notes | | ------- | ----------- | ----------------- | @@ -126,7 +118,54 @@ Send [SysRq command](https://en.wikipedia.org/wiki/Magic_SysRq_key) | ------- | ---------------- | ----- | | SYSRQ | Single character | | -### USB device ID +## Media keys + +Some Media/Consumer Control keys can be pressed with "MEDIA" command + +| Command | Parameters | Notes | +| ------- | ------------------------- | ----- | +| MEDIA | Media key, see list below | | + +| Key name | Notes | +| ----------------- | ----------------------------- | +| POWER | | +| REBOOT | | +| SLEEP | | +| LOGOFF | | +| EXIT | | +| HOME | | +| BACK | | +| FORWARD | | +| REFRESH | | +| SNAPSHOT | Take photo in a camera app | +| PLAY | | +| PAUSE | | +| PLAY_PAUSE | | +| NEXT_TRACK | | +| PREV_TRACK | | +| STOP | | +| EJECT | | +| MUTE | | +| VOLUME_UP | | +| VOLUME_DOWN | | +| FN | Fn/Globe key on Mac keyboard | +| BRIGHT_UP | Increase display brightness | +| BRIGHT_DOWN | Decrease display brightness | + +## Fn/Globe key commands (Mac/iPad) + +| Command | Parameters | Notes | +| ------- | ------------------------------- | ----- | +| GLOBE | Special key or single character | | + +## Wait for button press + +Will wait indefinitely for a button to be pressed +| Command | Parameters | Notes | +| --------------------- | ------------ | --------------------------------------------------------------------- | +| WAIT_FOR_BUTTON_PRESS | None | Will wait for the user to press a button to continue script execution | + +## USB device ID You can set the custom ID of the Flipper USB HID device. ID command should be in the **first line** of script, it is executed before script run. diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index 880bfe754ac..e80417b8eac 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.1,, +Version,+,60.2,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1205,6 +1205,7 @@ Function,+,furi_hal_gpio_init_simple,void,"const GpioPin*, const GpioMode" Function,+,furi_hal_gpio_remove_int_callback,void,const GpioPin* Function,+,furi_hal_hid_consumer_key_press,_Bool,uint16_t Function,+,furi_hal_hid_consumer_key_release,_Bool,uint16_t +Function,+,furi_hal_hid_consumer_key_release_all,_Bool, Function,+,furi_hal_hid_get_led_state,uint8_t, Function,+,furi_hal_hid_is_connected,_Bool, Function,+,furi_hal_hid_kb_press,_Bool,uint16_t diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 1f30a115048..a4a6cb250db 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.1,, +Version,+,60.2,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, @@ -1273,6 +1273,7 @@ Function,+,furi_hal_gpio_init_simple,void,"const GpioPin*, const GpioMode" Function,+,furi_hal_gpio_remove_int_callback,void,const GpioPin* Function,+,furi_hal_hid_consumer_key_press,_Bool,uint16_t Function,+,furi_hal_hid_consumer_key_release,_Bool,uint16_t +Function,+,furi_hal_hid_consumer_key_release_all,_Bool, Function,+,furi_hal_hid_get_led_state,uint8_t, Function,+,furi_hal_hid_is_connected,_Bool, Function,+,furi_hal_hid_kb_press,_Bool,uint16_t diff --git a/targets/f7/furi_hal/furi_hal_usb_hid.c b/targets/f7/furi_hal/furi_hal_usb_hid.c index f48c4a7813f..5d1a9c46e4f 100644 --- a/targets/f7/furi_hal/furi_hal_usb_hid.c +++ b/targets/f7/furi_hal/furi_hal_usb_hid.c @@ -354,6 +354,13 @@ bool furi_hal_hid_consumer_key_release(uint16_t button) { return hid_send_report(ReportIdConsumer); } +bool furi_hal_hid_consumer_key_release_all(void) { + for(uint8_t key_nb = 0; key_nb < HID_CONSUMER_MAX_KEYS; key_nb++) { + hid_report.consumer.btn[key_nb] = 0; + } + return hid_send_report(ReportIdConsumer); +} + static void* hid_set_string_descr(char* str) { furi_assert(str); diff --git a/targets/furi_hal_include/furi_hal_usb_hid.h b/targets/furi_hal_include/furi_hal_usb_hid.h index da851cabb65..29994196fcd 100644 --- a/targets/furi_hal_include/furi_hal_usb_hid.h +++ b/targets/furi_hal_include/furi_hal_usb_hid.h @@ -14,6 +14,11 @@ extern "C" { /** 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_KEYBOARD_NONE 0x00 /** HID keyboard modifier keys */ @@ -259,6 +264,11 @@ bool furi_hal_hid_consumer_key_press(uint16_t button); */ bool furi_hal_hid_consumer_key_release(uint16_t button); +/** Clear all pressed consumer keys and send HID report + * + */ +bool furi_hal_hid_consumer_key_release_all(void); + #ifdef __cplusplus } #endif From adafe96924bebc895cb48bdaf22fc11a541fa129 Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:56:56 +0300 Subject: [PATCH 26/28] [FL-3762] Configurable Infrared TX output (#3484) * Implement Gui for the feature * Implement furi_hal side * Implement IR module detection * Fix PVS warnings * Add comments Co-authored-by: Aleksandr Kutuzov --- applications/main/infrared/infrared_app.c | 78 ++++++++++++++ applications/main/infrared/infrared_app_i.h | 34 +++++- .../main/infrared/infrared_custom_event.h | 3 + .../infrared/scenes/infrared_scene_config.h | 1 + .../scenes/infrared_scene_gpio_settings.c | 102 ++++++++++++++++++ .../infrared/scenes/infrared_scene_start.c | 15 ++- targets/f18/api_symbols.csv | 2 +- targets/f7/api_symbols.csv | 4 +- targets/f7/furi_hal/furi_hal_infrared.c | 101 ++++++++++------- targets/furi_hal_include/furi_hal_infrared.h | 29 +++++ 10 files changed, 326 insertions(+), 43 deletions(-) create mode 100644 applications/main/infrared/scenes/infrared_scene_gpio_settings.c diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 82b05447865..5a83dfbd756 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -1,7 +1,10 @@ #include "infrared_app_i.h" +#include + #include #include +#include #include #define TAG "InfraredApp" @@ -9,6 +12,14 @@ #define INFRARED_TX_MIN_INTERVAL_MS (50U) #define INFRARED_TASK_STACK_SIZE (2048UL) +#define INFRARED_SETTINGS_PATH INT_PATH(".infrared.settings") +#define INFRARED_SETTINGS_VERSION (0) +#define INFRARED_SETTINGS_MAGIC (0x1F) + +typedef struct { + uint8_t tx_pin; +} InfraredSettings; + static const NotificationSequence* infrared_notification_sequences[InfraredNotificationMessageCount] = { &sequence_success, @@ -181,6 +192,12 @@ static InfraredApp* infrared_alloc(void) { infrared->popup = popup_alloc(); view_dispatcher_add_view(view_dispatcher, InfraredViewPopup, popup_get_view(infrared->popup)); + infrared->var_item_list = variable_item_list_alloc(); + view_dispatcher_add_view( + view_dispatcher, + InfraredViewVariableList, + variable_item_list_get_view(infrared->var_item_list)); + infrared->view_stack = view_stack_alloc(); view_dispatcher_add_view( view_dispatcher, InfraredViewStack, view_stack_get_view(infrared->view_stack)); @@ -237,6 +254,9 @@ static void infrared_free(InfraredApp* infrared) { view_dispatcher_remove_view(view_dispatcher, InfraredViewPopup); popup_free(infrared->popup); + view_dispatcher_remove_view(view_dispatcher, InfraredViewVariableList); + variable_item_list_free(infrared->var_item_list); + view_dispatcher_remove_view(view_dispatcher, InfraredViewStack); view_stack_free(infrared->view_stack); @@ -431,6 +451,60 @@ void infrared_show_error_message(const InfraredApp* infrared, const char* fmt, . va_end(args); } +void infrared_set_tx_pin(InfraredApp* infrared, FuriHalInfraredTxPin tx_pin) { + if(tx_pin < FuriHalInfraredTxPinMax) { + furi_hal_infrared_set_tx_output(tx_pin); + } else { + FuriHalInfraredTxPin tx_pin_detected = furi_hal_infrared_detect_tx_output(); + furi_hal_infrared_set_tx_output(tx_pin_detected); + if(tx_pin_detected != FuriHalInfraredTxPinInternal) { + infrared_enable_otg(infrared, true); + } + } + + infrared->app_state.tx_pin = tx_pin; +} + +void infrared_enable_otg(InfraredApp* infrared, bool enable) { + if(enable) { + furi_hal_power_enable_otg(); + } else { + furi_hal_power_disable_otg(); + } + infrared->app_state.is_otg_enabled = enable; +} + +static void infrared_load_settings(InfraredApp* infrared) { + InfraredSettings settings = {0}; + + if(!saved_struct_load( + INFRARED_SETTINGS_PATH, + &settings, + sizeof(InfraredSettings), + INFRARED_SETTINGS_MAGIC, + INFRARED_SETTINGS_VERSION)) { + FURI_LOG_D(TAG, "Failed to load settings, using defaults"); + infrared_save_settings(infrared); + } + + infrared_set_tx_pin(infrared, settings.tx_pin); +} + +void infrared_save_settings(InfraredApp* infrared) { + InfraredSettings settings = { + .tx_pin = infrared->app_state.tx_pin, + }; + + if(!saved_struct_save( + INFRARED_SETTINGS_PATH, + &settings, + sizeof(InfraredSettings), + INFRARED_SETTINGS_MAGIC, + INFRARED_SETTINGS_VERSION)) { + FURI_LOG_E(TAG, "Failed to save settings"); + } +} + void infrared_signal_received_callback(void* context, InfraredWorkerSignal* received_signal) { furi_assert(context); InfraredApp* infrared = context; @@ -471,6 +545,7 @@ void infrared_popup_closed_callback(void* context) { int32_t infrared_app(void* p) { InfraredApp* infrared = infrared_alloc(); + infrared_load_settings(infrared); infrared_make_app_folder(infrared); bool is_remote_loaded = false; @@ -513,6 +588,9 @@ int32_t infrared_app(void* p) { view_dispatcher_run(infrared->view_dispatcher); + infrared_set_tx_pin(infrared, FuriHalInfraredTxPinInternal); + infrared_enable_otg(infrared, false); infrared_free(infrared); + return 0; } diff --git a/applications/main/infrared/infrared_app_i.h b/applications/main/infrared/infrared_app_i.h index 1c074323a2e..1635fa0dc42 100644 --- a/applications/main/infrared/infrared_app_i.h +++ b/applications/main/infrared/infrared_app_i.h @@ -4,6 +4,8 @@ */ #pragma once +#include + #include #include #include @@ -18,13 +20,13 @@ #include #include #include +#include #include #include #include #include - #include #include "infrared_app.h" @@ -82,11 +84,13 @@ typedef struct { bool is_learning_new_remote; /**< Learning new remote or adding to an existing one. */ bool is_debug_enabled; /**< Whether to enable or disable debugging features. */ 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). */ 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. */ + FuriHalInfraredTxPin tx_pin; } InfraredAppState; /** @@ -110,6 +114,7 @@ struct InfraredApp { DialogEx* dialog_ex; /**< Standard view for displaying dialogs. */ ButtonMenu* button_menu; /**< Custom view for interacting with IR remotes. */ Popup* popup; /**< Standard view for displaying messages. */ + VariableItemList* var_item_list; /**< Standard view for displaying menus of choice items. */ ViewStack* view_stack; /**< Standard view for displaying stacked interfaces. */ InfraredDebugView* debug_view; /**< Custom view for displaying debug information. */ @@ -138,6 +143,7 @@ typedef enum { InfraredViewDialogEx, InfraredViewButtonMenu, InfraredViewPopup, + InfraredViewVariableList, InfraredViewStack, InfraredViewDebugView, InfraredViewMove, @@ -273,6 +279,32 @@ void infrared_play_notification_message( void infrared_show_error_message(const InfraredApp* infrared, const char* fmt, ...) _ATTRIBUTE((__format__(__printf__, 2, 3))); +/** + * @brief Set which pin will be used to transmit infrared signals. + * + * Setting tx_pin to InfraredTxPinInternal will enable transmission via + * the built-in infrared LEDs. + * + * @param[in] infrared pointer to the application instance. + * @param[in] tx_pin pin to be used for signal transmission. + */ +void infrared_set_tx_pin(InfraredApp* infrared, FuriHalInfraredTxPin tx_pin); + +/** + * @brief Enable or disable 5V at the GPIO pin 1. + * + * @param[in] infrared pointer to the application instance. + * @param[in] enable boolean value corresponding to OTG state (true = enable, false = disable) + */ +void infrared_enable_otg(InfraredApp* infrared, bool enable); + +/** + * @brief Save current settings to a file. + * + * @param[in] infrared pointer to the application instance. + */ +void infrared_save_settings(InfraredApp* infrared); + /** * @brief Common received signal callback. * diff --git a/applications/main/infrared/infrared_custom_event.h b/applications/main/infrared/infrared_custom_event.h index b53e52a2f3e..02d9a276f17 100644 --- a/applications/main/infrared/infrared_custom_event.h +++ b/applications/main/infrared/infrared_custom_event.h @@ -22,6 +22,9 @@ enum InfraredCustomEventType { InfraredCustomEventTypeRpcButtonPressIndex, InfraredCustomEventTypeRpcButtonRelease, InfraredCustomEventTypeRpcSessionClose, + + InfraredCustomEventTypeGpioTxPinChanged, + InfraredCustomEventTypeGpioOtgChanged, }; #pragma pack(push, 1) diff --git a/applications/main/infrared/scenes/infrared_scene_config.h b/applications/main/infrared/scenes/infrared_scene_config.h index 27ef2f3b179..976bb424c10 100644 --- a/applications/main/infrared/scenes/infrared_scene_config.h +++ b/applications/main/infrared/scenes/infrared_scene_config.h @@ -19,6 +19,7 @@ ADD_SCENE(infrared, universal_tv, UniversalTV) ADD_SCENE(infrared, universal_ac, UniversalAC) ADD_SCENE(infrared, universal_audio, UniversalAudio) ADD_SCENE(infrared, universal_projector, UniversalProjector) +ADD_SCENE(infrared, gpio_settings, GpioSettings) ADD_SCENE(infrared, debug, Debug) ADD_SCENE(infrared, error_databases, ErrorDatabases) ADD_SCENE(infrared, rpc, Rpc) diff --git a/applications/main/infrared/scenes/infrared_scene_gpio_settings.c b/applications/main/infrared/scenes/infrared_scene_gpio_settings.c new file mode 100644 index 00000000000..07782c08b38 --- /dev/null +++ b/applications/main/infrared/scenes/infrared_scene_gpio_settings.c @@ -0,0 +1,102 @@ +#include "../infrared_app_i.h" + +static const char* infrared_scene_gpio_settings_pin_text[] = { + "Flipper", + "2 (A7)", + "Detect", +}; + +static const char* infrared_scene_gpio_settings_otg_text[] = { + "OFF", + "ON", +}; + +static void infrared_scene_gpio_settings_pin_change_callback(VariableItem* item) { + InfraredApp* infrared = variable_item_get_context(item); + const uint8_t index = variable_item_get_current_value_index(item); + + variable_item_set_current_value_text(item, infrared_scene_gpio_settings_pin_text[index]); + view_dispatcher_send_custom_event( + infrared->view_dispatcher, + infrared_custom_event_pack(InfraredCustomEventTypeGpioTxPinChanged, index)); +} + +static void infrared_scene_gpio_settings_otg_change_callback(VariableItem* item) { + InfraredApp* infrared = variable_item_get_context(item); + const uint8_t index = variable_item_get_current_value_index(item); + + variable_item_set_current_value_text(item, infrared_scene_gpio_settings_otg_text[index]); + view_dispatcher_send_custom_event( + infrared->view_dispatcher, + infrared_custom_event_pack(InfraredCustomEventTypeGpioOtgChanged, index)); +} + +static void infrared_scene_gpio_settings_init(InfraredApp* infrared) { + VariableItemList* var_item_list = infrared->var_item_list; + VariableItem* item; + uint8_t value_index; + + item = variable_item_list_add( + var_item_list, + "Signal Output", + COUNT_OF(infrared_scene_gpio_settings_pin_text), + infrared_scene_gpio_settings_pin_change_callback, + infrared); + + value_index = infrared->app_state.tx_pin; + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, infrared_scene_gpio_settings_pin_text[value_index]); + + item = variable_item_list_add( + var_item_list, + "5V on GPIO", + COUNT_OF(infrared_scene_gpio_settings_otg_text), + infrared_scene_gpio_settings_otg_change_callback, + infrared); + + if(infrared->app_state.tx_pin < FuriHalInfraredTxPinMax) { + value_index = infrared->app_state.is_otg_enabled; + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text( + item, infrared_scene_gpio_settings_otg_text[value_index]); + } else { + variable_item_set_values_count(item, 1); + variable_item_set_current_value_index(item, 0); + variable_item_set_current_value_text(item, "Auto"); + } +} + +void infrared_scene_gpio_settings_on_enter(void* context) { + InfraredApp* infrared = context; + infrared_scene_gpio_settings_init(infrared); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewVariableList); +} + +bool infrared_scene_gpio_settings_on_event(void* context, SceneManagerEvent event) { + bool consumed = false; + + InfraredApp* infrared = context; + + if(event.type == SceneManagerEventTypeCustom) { + const uint16_t custom_event_type = infrared_custom_event_get_type(event.event); + const uint16_t custom_event_value = infrared_custom_event_get_value(event.event); + + if(custom_event_type == InfraredCustomEventTypeGpioTxPinChanged) { + infrared_set_tx_pin(infrared, custom_event_value); + variable_item_list_reset(infrared->var_item_list); + infrared_scene_gpio_settings_init(infrared); + } else if(custom_event_type == InfraredCustomEventTypeGpioOtgChanged) { + infrared_enable_otg(infrared, custom_event_value); + } + + consumed = true; + } + + return consumed; +} + +void infrared_scene_gpio_settings_on_exit(void* context) { + InfraredApp* infrared = context; + variable_item_list_reset(infrared->var_item_list); + infrared_save_settings(infrared); +} diff --git a/applications/main/infrared/scenes/infrared_scene_start.c b/applications/main/infrared/scenes/infrared_scene_start.c index 0e23bb7b8c9..3d57389a307 100644 --- a/applications/main/infrared/scenes/infrared_scene_start.c +++ b/applications/main/infrared/scenes/infrared_scene_start.c @@ -4,6 +4,7 @@ enum SubmenuIndex { SubmenuIndexUniversalRemotes, SubmenuIndexLearnNewRemote, SubmenuIndexSavedRemotes, + SubmenuIndexGpioSettings, SubmenuIndexDebug }; @@ -35,6 +36,12 @@ void infrared_scene_start_on_enter(void* context) { SubmenuIndexSavedRemotes, infrared_scene_start_submenu_callback, infrared); + submenu_add_item( + submenu, + "GPIO Settings", + SubmenuIndexGpioSettings, + infrared_scene_start_submenu_callback, + infrared); if(infrared->app_state.is_debug_enabled) { submenu_add_item( @@ -60,19 +67,19 @@ bool infrared_scene_start_on_event(void* context, SceneManagerEvent event) { scene_manager_set_scene_state(scene_manager, InfraredSceneStart, submenu_index); if(submenu_index == SubmenuIndexUniversalRemotes) { scene_manager_next_scene(scene_manager, InfraredSceneUniversal); - consumed = true; } else if(submenu_index == SubmenuIndexLearnNewRemote) { infrared->app_state.is_learning_new_remote = true; scene_manager_next_scene(scene_manager, InfraredSceneLearn); - consumed = true; } else if(submenu_index == SubmenuIndexSavedRemotes) { furi_string_set(infrared->file_path, INFRARED_APP_FOLDER); scene_manager_next_scene(scene_manager, InfraredSceneRemoteList); - consumed = true; + } else if(submenu_index == SubmenuIndexGpioSettings) { + scene_manager_next_scene(scene_manager, InfraredSceneGpioSettings); } else if(submenu_index == SubmenuIndexDebug) { scene_manager_next_scene(scene_manager, InfraredSceneDebug); - consumed = true; } + + consumed = true; } return consumed; diff --git a/targets/f18/api_symbols.csv b/targets/f18/api_symbols.csv index e80417b8eac..95879cde6ff 100644 --- a/targets/f18/api_symbols.csv +++ b/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.2,, +Version,+,60.3,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index a4a6cb250db..e0b7f681831 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,60.2,, +Version,+,60.3,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, @@ -1324,7 +1324,9 @@ Function,+,furi_hal_infrared_async_tx_set_signal_sent_isr_callback,void,"FuriHal Function,+,furi_hal_infrared_async_tx_start,void,"uint32_t, float" Function,+,furi_hal_infrared_async_tx_stop,void, Function,+,furi_hal_infrared_async_tx_wait_termination,void, +Function,+,furi_hal_infrared_detect_tx_output,FuriHalInfraredTxPin, Function,+,furi_hal_infrared_is_busy,_Bool, +Function,+,furi_hal_infrared_set_tx_output,void,FuriHalInfraredTxPin Function,-,furi_hal_init,void, Function,-,furi_hal_init_early,void, Function,-,furi_hal_interrupt_init,void, diff --git a/targets/f7/furi_hal/furi_hal_infrared.c b/targets/f7/furi_hal/furi_hal_infrared.c index 6ace2ed7f21..bbb00198e36 100644 --- a/targets/f7/furi_hal/furi_hal_infrared.c +++ b/targets/f7/furi_hal/furi_hal_infrared.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -9,12 +10,6 @@ #include #include -// #define INFRARED_TX_DEBUG - -#if defined INFRARED_TX_DEBUG -#define gpio_infrared_tx gpio_ext_pa7 -#endif - #define INFRARED_TIM_TX_DMA_BUFFER_SIZE 200 #define INFRARED_POLARITY_SHIFT 1 @@ -81,10 +76,16 @@ typedef enum { InfraredStateMAX, } InfraredState; +static FuriHalInfraredTxPin infrared_tx_output = FuriHalInfraredTxPinInternal; static volatile InfraredState furi_hal_infrared_state = InfraredStateIdle; static InfraredTimTx infrared_tim_tx; static InfraredTimRx infrared_tim_rx; +static const GpioPin* infrared_tx_pins[FuriHalInfraredTxPinMax] = { + [FuriHalInfraredTxPinInternal] = &gpio_infrared_tx, + [FuriHalInfraredTxPinExtPA7] = &gpio_ext_pa7, +}; + static void furi_hal_infrared_tx_fill_buffer(uint8_t buf_num, uint8_t polarity_shift); static void furi_hal_infrared_async_tx_free_resources(void); static void furi_hal_infrared_tx_dma_set_polarity(uint8_t buf_num, uint8_t polarity_shift); @@ -352,27 +353,31 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc LL_TIM_SetAutoReload( INFRARED_DMA_TIMER, __LL_TIM_CALC_ARR(SystemCoreClock, LL_TIM_GetPrescaler(INFRARED_DMA_TIMER), freq)); -#if defined INFRARED_TX_DEBUG - LL_TIM_OC_SetCompareCH1( - INFRARED_DMA_TIMER, ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1 - duty_cycle))); - LL_TIM_OC_EnablePreload(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1); - /* LL_TIM_OCMODE_PWM2 set by DMA */ - LL_TIM_OC_SetMode(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1, LL_TIM_OCMODE_FORCED_INACTIVE); - LL_TIM_OC_SetPolarity(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1N, LL_TIM_OCPOLARITY_HIGH); - LL_TIM_OC_DisableFast(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1); - LL_TIM_CC_EnableChannel(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1N); - LL_TIM_DisableIT_CC1(INFRARED_DMA_TIMER); -#else - LL_TIM_OC_SetCompareCH3( - INFRARED_DMA_TIMER, ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1 - duty_cycle))); - LL_TIM_OC_EnablePreload(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3); - /* LL_TIM_OCMODE_PWM2 set by DMA */ - LL_TIM_OC_SetMode(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3, LL_TIM_OCMODE_FORCED_INACTIVE); - LL_TIM_OC_SetPolarity(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3N, LL_TIM_OCPOLARITY_HIGH); - LL_TIM_OC_DisableFast(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3); - LL_TIM_CC_EnableChannel(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3N); - LL_TIM_DisableIT_CC3(INFRARED_DMA_TIMER); -#endif + + if(infrared_tx_output == FuriHalInfraredTxPinInternal) { + LL_TIM_OC_SetCompareCH3( + INFRARED_DMA_TIMER, + ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1 - duty_cycle))); + LL_TIM_OC_EnablePreload(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3); + /* LL_TIM_OCMODE_PWM2 set by DMA */ + LL_TIM_OC_SetMode(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3, LL_TIM_OCMODE_FORCED_INACTIVE); + LL_TIM_OC_SetPolarity(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3N, LL_TIM_OCPOLARITY_HIGH); + LL_TIM_OC_DisableFast(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3); + LL_TIM_CC_EnableChannel(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH3N); + LL_TIM_DisableIT_CC3(INFRARED_DMA_TIMER); + } else if(infrared_tx_output == FuriHalInfraredTxPinExtPA7) { + LL_TIM_OC_SetCompareCH1( + INFRARED_DMA_TIMER, + ((LL_TIM_GetAutoReload(INFRARED_DMA_TIMER) + 1) * (1 - duty_cycle))); + LL_TIM_OC_EnablePreload(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1); + /* LL_TIM_OCMODE_PWM2 set by DMA */ + LL_TIM_OC_SetMode(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1, LL_TIM_OCMODE_FORCED_INACTIVE); + LL_TIM_OC_SetPolarity(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1N, LL_TIM_OCPOLARITY_HIGH); + LL_TIM_OC_DisableFast(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1); + LL_TIM_CC_EnableChannel(INFRARED_DMA_TIMER, LL_TIM_CHANNEL_CH1N); + LL_TIM_DisableIT_CC1(INFRARED_DMA_TIMER); + } + LL_TIM_DisableMasterSlaveMode(INFRARED_DMA_TIMER); LL_TIM_EnableAllOutputs(INFRARED_DMA_TIMER); LL_TIM_DisableIT_UPDATE(INFRARED_DMA_TIMER); @@ -381,11 +386,13 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc static void furi_hal_infrared_configure_tim_cmgr2_dma_tx(void) { LL_DMA_InitTypeDef dma_config = {0}; -#if defined INFRARED_TX_DEBUG - dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (INFRARED_DMA_TIMER->CCMR1); -#else - dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (INFRARED_DMA_TIMER->CCMR2); -#endif + + if(infrared_tx_output == FuriHalInfraredTxPinInternal) { + dma_config.PeriphOrM2MSrcAddress = (uint32_t)(&(INFRARED_DMA_TIMER->CCMR2)); + } else if(infrared_tx_output == FuriHalInfraredTxPinExtPA7) { + dma_config.PeriphOrM2MSrcAddress = (uint32_t)(&(INFRARED_DMA_TIMER->CCMR1)); + } + dma_config.MemoryOrM2MDstAddress = (uint32_t)NULL; dma_config.Direction = LL_DMA_DIRECTION_MEMORY_TO_PERIPH; dma_config.Mode = LL_DMA_MODE_NORMAL; @@ -582,7 +589,8 @@ static void furi_hal_infrared_async_tx_free_resources(void) { (furi_hal_infrared_state == InfraredStateIdle) || (furi_hal_infrared_state == InfraredStateAsyncTxStopped)); - furi_hal_gpio_init(&gpio_infrared_tx, GpioModeAnalog, GpioPullDown, GpioSpeedLow); + furi_hal_gpio_init( + infrared_tx_pins[infrared_tx_output], GpioModeAnalog, GpioPullDown, GpioSpeedLow); furi_hal_interrupt_set_isr(INFRARED_DMA_CH1_IRQ, NULL, NULL); furi_hal_interrupt_set_isr(INFRARED_DMA_CH2_IRQ, NULL, NULL); @@ -643,10 +651,11 @@ void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle) { furi_delay_us(5); LL_TIM_GenerateEvent_UPDATE(INFRARED_DMA_TIMER); /* DMA -> TIMx_RCR */ furi_delay_us(5); - LL_GPIO_ResetOutputPin( - gpio_infrared_tx.port, gpio_infrared_tx.pin); /* when disable it prevents false pulse */ + + const GpioPin* tx_gpio = infrared_tx_pins[infrared_tx_output]; + LL_GPIO_ResetOutputPin(tx_gpio->port, tx_gpio->pin); /* when disable it prevents false pulse */ furi_hal_gpio_init_ex( - &gpio_infrared_tx, GpioModeAltFunctionPushPull, GpioPullUp, GpioSpeedHigh, GpioAltFn1TIM1); + tx_gpio, GpioModeAltFunctionPushPull, GpioPullUp, GpioSpeedHigh, GpioAltFn1TIM1); FURI_CRITICAL_ENTER(); LL_TIM_GenerateEvent_UPDATE(INFRARED_DMA_TIMER); /* TIMx_RCR -> Repetition counter */ @@ -691,3 +700,23 @@ void furi_hal_infrared_async_tx_set_signal_sent_isr_callback( infrared_tim_tx.signal_sent_callback = callback; infrared_tim_tx.signal_sent_context = context; } + +FuriHalInfraredTxPin furi_hal_infrared_detect_tx_output(void) { + for(FuriHalInfraredTxPin pin = FuriHalInfraredTxPinInternal + 1; //-V1008 + pin < FuriHalInfraredTxPinMax; + ++pin) { + const GpioPin* gpio = infrared_tx_pins[pin]; + furi_hal_gpio_init(gpio, GpioModeInput, GpioPullUp, GpioSpeedLow); + furi_hal_cortex_delay_us(1000U); + const bool level = furi_hal_gpio_read(gpio); + furi_hal_gpio_init(gpio, GpioModeAnalog, GpioPullNo, GpioSpeedLow); + if(!level) return pin; + } + + return FuriHalInfraredTxPinInternal; +} + +void furi_hal_infrared_set_tx_output(FuriHalInfraredTxPin tx_pin) { + furi_check(tx_pin < FuriHalInfraredTxPinMax); + infrared_tx_output = tx_pin; +} diff --git a/targets/furi_hal_include/furi_hal_infrared.h b/targets/furi_hal_include/furi_hal_infrared.h index ce2e4328e6a..29f7101c19e 100644 --- a/targets/furi_hal_include/furi_hal_infrared.h +++ b/targets/furi_hal_include/furi_hal_infrared.h @@ -16,6 +16,12 @@ extern "C" { #define INFRARED_MAX_FREQUENCY 56000 #define INFRARED_MIN_FREQUENCY 10000 +typedef enum { + FuriHalInfraredTxPinInternal, + FuriHalInfraredTxPinExtPA7, + FuriHalInfraredTxPinMax, +} FuriHalInfraredTxPin; + typedef enum { FuriHalInfraredTxGetDataStateOk, /**< New data obtained */ FuriHalInfraredTxGetDataStateDone, /**< New data obtained, and this is end of package */ @@ -143,6 +149,29 @@ void furi_hal_infrared_async_tx_set_signal_sent_isr_callback( FuriHalInfraredTxSignalSentISRCallback callback, void* context); +/** Detect which pin has an external IR module connected. + * + * External IR modules are detected by enabling a weak pull-up + * on supported pins and testing whether the input is still low. + * + * This method works best on modules that employ a FET with a + * strong pull-down or a BJT for driving IR LEDs. + * + * The module MUST pull the input voltage down to at least 0.9V + * or lower in order for it to be detected. + * + * If no module has been detected, FuriHalInfraredTxPinInternal is returned. + * + * @return numeric identifier of the first pin with a module detected. + */ +FuriHalInfraredTxPin furi_hal_infrared_detect_tx_output(void); + +/** Set which pin will be used to transmit infrared signals. + * + * @param[in] tx_pin pin to be used for signal transmission. + */ +void furi_hal_infrared_set_tx_output(FuriHalInfraredTxPin tx_pin); + #ifdef __cplusplus } #endif From 8762629276a1a82d7464d11edc15b68623cebc3b Mon Sep 17 00:00:00 2001 From: Kowalski Dragon Date: Mon, 25 Mar 2024 10:03:20 +0100 Subject: [PATCH 27/28] Add ChromeOS Bad USB demo (#3486) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kowalski Dragon (kowalski7cc) Co-authored-by: あく --- .../resources/badusb/demo_chromeos.txt | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 applications/main/bad_usb/resources/badusb/demo_chromeos.txt diff --git a/applications/main/bad_usb/resources/badusb/demo_chromeos.txt b/applications/main/bad_usb/resources/badusb/demo_chromeos.txt new file mode 100644 index 00000000000..c5f675fb338 --- /dev/null +++ b/applications/main/bad_usb/resources/badusb/demo_chromeos.txt @@ -0,0 +1,80 @@ +REM This is BadUSB demo script for ChromeOS by kowalski7cc + +REM Open a new tab +CTRL t +REM wait for some slower chromebooks +DELAY 1000 +REM Open an empty editable page +DEFAULT_DELAY 50 +STRING data:text/html,