diff --git a/CHANGELOG.md b/CHANGELOG.md index a16fc8256..425ba6300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,42 +1,40 @@ ### New changes -* **Warning! After installing, Desktop settings (Favoutite apps, PIN Code, AutoLock time..) will be resetted to default due to OFW changes, Please set your PIN code, Favourite apps again in Settings->Desktop** -* New way of changing device name -> **Now can be changed in Settings->Desktop** (by @xMasterX and @Willy-JL) -* Plugins: BadBT plugin (BT version of BadKB) [(by Willy-JL, ClaraCrazy, XFW contributors)](https://github.com/ClaraCrazy/Flipper-Xtreme/tree/dev/applications/main/bad_kb) -* Plugins: WiFi Marauder -> Added sniff pmkid on selected aps from 0.10.4 update (by @clipboard1) -* Plugins: SubGHz Bruteforcer -> Increase delay just a little bit to fix some cases when receiver will not get codes and decrease manual transmit delay -* Plugins: UART Terminal -> Fix crashes on plugin load with RX connected -* NFC: Mifare mini with SAK 0x89 support -* SubGHz: **CAME Atomo - Add manually support and custom buttons support** -* SubGHz: Fix crashes when deleting signals using right arrow button in `Read` mode -* SubGHz: Restore Rx indication after deletion after Memory is FULL (by @wosk | PR #464) -* SubGHz: **App refactoring** (OFW code ported + our code was refactored/cleaned up too) (by @gid9798 and @xMasterX | PR #461) -* SubGHz: Using scene manager functions in DecodeRAW (by @gid9798 | PR #462) -* SubGHz: Protocols and custom buttons refactoring (by @gid9798 | PR #465) -* SubGHz: Move `counter increase` setting out of debug, change max value -* GUI: Submenu locked elements (by @Willy-JL and @giacomoferretti) -* GUI: Text Input improvements, added cursor and ability to set minimal length (by @Willy-JL) -* BT API: Functions that allow to change bt mac address and device broadcasted name (by @Willy-JL and XFW contributors) -* Infrared: `External output` move out of debug and add power option for external modules -* Infrared: Updated universal remote assets (by @amec0e | PR #474) -* Extra pack: Some app fixes -* FBT: Fix vscode example config for debug builds - please run `./fbt vscode_dist` again if you had issues with debug builds size -* OFW PR 2316: NFC V support (by @g3gg0 & @nvx) -* OFW PR 2669: nfc: Fix MFUL tearing flags read (by @GMMan) -* OFW PR 2666: BadUSB: Add fr-FR-mac key layout (by @FelixLgr) -* OFW: api: added lib/nfc/protocols/nfc_util.h -* OFW: fix PIN retry count reset on reboot -* OFW: fbt: allow strings for fap_version field in app manifests -* OFW: Rpc: add desktop service. Desktop: refactor locking routine. **Now PIN lock is actually cannot be bypassed by reboot!** / **Desktop settings will be reset, please set your PIN and favourite apps again!** -* OFW: Part 2 of hooking C2 IPC -* OFW: ble: attempt to handle hardfaulted c2 -* OFW: Add Mfkey32 application -* OFW: Added DigitalSequence and PulseReader -* OFW: Debug: revert cortex debug to lxml and drop DWT **(reapply your VSCode launch.json from example folder)** -* OFW: furi_crash: added C2 status; added fw-version gdb command -* OFW: Removed STM32CubeWB module -* OFW: API version in UI -* OFW: ufbt: deploying sample ufbt automation for new apps; added `source "ufbt -s env"` for toolchain access -* OFW: Fix storage.py exist_dir logic +* !!! **Warning! After installing, Desktop settings (Favoutite apps, PIN Code, AutoLock time..) will be resetted to default due to settings changes, Please set your PIN code, Favourite apps again in Settings->Desktop** !!! +* If you have copied any apps manually into `apps` folder - remove `apps` folder or that specific apps you copied on your microSD before installing this release to avoid issues due to OFW API version update! If you using regular builds or extra pack builds (e) without your manually added apps, all included apps will be installed automatically, no extra actions needed! +----- +* Desktop: **Show clock on main screen** (Enable in Settings->Desktop->Show Clock) (by @gid9798 | PR #484) +* SubGHz Remote: New plugin - Configurator (Remote Maker) - Now you can create and edit map files on flipper! (by @gid9798 | PR #487) +* SubGHz Remote: Full refactoring, app was re-made from scratch (by @gid9798) +* Archive: Fix rename, show error message to user +* API: Cleanup, mini refactoring of some apps (+6k of free flash space) +* LFRFID: Debug: Allow PSK RAW emulation in gui +* SubGHz: Security+ 2.0 -> add extra custom button `0x78` - Fixes issue #469 +* SubGHz: Various fixes (by @gid9798) +* SubGHz: Fix counter settings in debug +* SubGHz: Move dangerous_settings check (by @gid9798 | PR #475) +* Misc: Move NFC plugins into NFC folder +* Misc: Name changer code moved to proper place, load after system startup + extra checks +* Plugins: Merge tiktok and ytshorts remote into one (by @Willy-JL) +* Plugins: NMEA GPS UART - stability fix +* Plugins: Port XFW keyboard with extra symbols to WiFi Marauder instead of using UART Term keyboard (thanks to @Willy-JL) +* Plugins: Moved from extra pack to main FW: Mifare Nested [(by AloneLiberty)](https://github.com/AloneLiberty/FlipperNested) - Works with PC and python app `FlipperNested` +* Plugins: Update TOTP (Authenticator) [(by akopachov)](https://github.com/akopachov/flipper-zero_authenticator) (+ Add option to set custom fonts) +* Plugins: Update NMEA GPS UART [(by ezod)](https://github.com/ezod/flipperzero-gps) (GLL support) +* Plugins: Update WiFi Marauder [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion) +* OFW PR 2680: RFID - Add support for Nexkey/Nexwatch (by @mauimauer) +* OFW: nfc: Mifare Ultralight C detection +* OFW: api: added toolbox/api_lock.h +* OFW: NFC: Add support for Gen4 "ultimate card" in Magic app +* OFW: desktop: Refactor favorites settings and allow app browser in selection +* OFW: Infrared: respect carrier frequency and duty cycle settings -> **Breaking API change, API version was changed from 26.x to 27.x** +* OFW: Desktop,Rpc: desktop status subscription +* OFW: Storage, common_rename: check that old path is exists +* OFW: Services: remove deallocator for persistent services +* OFW: Storage: common_rename is now POSIX compliant +* OFW: Removed user-specific data from tar artifacts +* OFW: fbt: Fix tar uid overflow when packaging +* OFW: fbt: Use union for old py (Fix builds if using older python versions) +* OFW: USB HID report timeout #### [🎲 Download latest extra apps pack](https://github.com/xMasterX/all-the-plugins/archive/refs/heads/main.zip) diff --git a/ReadMe.md b/ReadMe.md index 596891d6e..9b6947e90 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -45,6 +45,7 @@ Our Discord Community: * Universal remote for Projectors, Fans, A/Cs and Audio(soundbars, etc.) * Customizable Flipper name **Update! Now can be changed in Settings->Desktop** (by @xMasterX and @Willy-JL) * Text Input UI element -> Cursor feature (by @Willy-JL) +- **BadBT** plugin (BT version of BadKB) [(by Willy-JL, ClaraCrazy, XFW contributors)](https://github.com/ClaraCrazy/Flipper-Xtreme/tree/dev/applications/main/bad_kb) - (See in Applications->Tools) - (aka BadUSB via Bluetooth) - BadUSB -> Keyboard layouts [(by rien > dummy-decoy)](https://github.com/dummy-decoy/flipperzero-firmware/tree/dummy_decoy/bad_usb_keyboard_layout) - Sub-GHz -> External CC1101 module support - [(by quen0n)](https://github.com/DarkFlippers/unleashed-firmware/pull/307) - Sub-GHz -> `Add manually` menu extended with new protocols @@ -145,7 +146,7 @@ You can support us by using links or addresses below: - ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion) - Saving .pcap on flipper microSD [by tcpassos](https://github.com/tcpassos/flipperzero-firmware-with-wifi-marauder-companion) -> Only with custom marauder build (It is necessary to uncomment "#define WRITE_PACKETS_SERIAL" in configs.h (in marauder fw) and compile the firmware for the wifi board.) Or download precompiled build -> [Download esp32_marauder_ver_flipper_sd_serial.bin](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) - NRF24: Sniffer & MouseJacker (with changes) [(by mothball187)](https://github.com/mothball187/flipperzero-nrf24/tree/main/mousejacker) - Simple Clock (timer by GMMan) [(original by CompaqDisc)](https://gist.github.com/CompaqDisc/4e329c501bd03c1e801849b81f48ea61) -- **Sub-GHz Remote** (UniversalRF Remix) [(by @darmiel & @xMasterX)](https://github.com/darmiel/flipper-playlist/tree/feat/unirf-protocols) (original by @ESurge) +- **Sub-GHz Remote** [(by @gid9798)](https://github.com/gid9798) - Spectrum Analyzer (with changes) [(by jolcese)](https://github.com/jolcese/flipperzero-firmware/tree/spectrum/applications/spectrum_analyzer) - [Ultra Narrow mode & scan channels non-consecutively](https://github.com/theY4Kman/flipperzero-firmware/commits?author=theY4Kman) - Metronome [(by panki27)](https://github.com/panki27/Metronome) - DTMF Dolphin [(by litui)](https://github.com/litui/dtmf_dolphin) @@ -164,7 +165,8 @@ You can support us by using links or addresses below: - **ProtoView** [(by antirez)](https://github.com/antirez/protoview) - **SWD Probe** [(by g3gg0)](https://github.com/g3gg0/flipper-swd_probe) - IR Scope [(by kallanreed)](https://github.com/DarkFlippers/unleashed-firmware/pull/407) -- BadBT plugin (BT version of BadKB) [(by Willy-JL, ClaraCrazy, XFW contributors)](https://github.com/ClaraCrazy/Flipper-Xtreme/tree/dev/applications/main/bad_kb) +- **BadBT** plugin (BT version of BadKB) [(by Willy-JL, ClaraCrazy, XFW contributors)](https://github.com/ClaraCrazy/Flipper-Xtreme/tree/dev/applications/main/bad_kb) (See in Applications->Tools) - (aka BadUSB via Bluetooth) +- **Mifare Nested** [(by AloneLiberty)](https://github.com/AloneLiberty/FlipperNested) - Works with PC and python app `FlipperNested` Games: - DOOM (fixed) [(by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/) @@ -193,6 +195,8 @@ Games: ## [- How to change Flipper name](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/CustomFlipperName.md) +## [- How to use Mifare Nested plugin to recover keys](https://github.com/AloneLiberty/FlipperNested#how-to-use-it) + ### **Sub-GHz** ## [- Transmission is blocked? - How to extend Sub-GHz frequency range](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/DangerousSettings.md) diff --git a/applications/external/doom/display.h b/applications/external/doom/display.h index cc9052acc..9695b5adf 100644 --- a/applications/external/doom/display.h +++ b/applications/external/doom/display.h @@ -90,7 +90,7 @@ void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canva void setupDisplay(Canvas* canvas) { memset(zbuffer, 0xff, 128); - display_buf = (uint8_t*)canvas_get_buffer(canvas); + display_buf = (uint8_t*)canvas->fb.tile_buf_ptr; //display_buf = u8g2_GetBufferPtr(&canvas->fb); } diff --git a/applications/external/esp8266_deauth/esp8266_deauth.c b/applications/external/esp8266_deauth/esp8266_deauth.c index fc165b932..e0a966975 100644 --- a/applications/external/esp8266_deauth/esp8266_deauth.c +++ b/applications/external/esp8266_deauth/esp8266_deauth.c @@ -11,8 +11,6 @@ //#include //#include -#include - #include "FlipperZeroWiFiDeauthModuleDefines.h" #define DEAUTH_APP_DEBUG 0 @@ -154,10 +152,8 @@ static void esp8266_deauth_module_render_callback(Canvas* const canvas, void* ct const char* strInitializing = "Something wrong"; canvas_draw_str( canvas, - (u8g2_GetDisplayWidth(&canvas->fb) / 2) - - (canvas_string_width(canvas, strInitializing) / 2), - (u8g2_GetDisplayHeight(&canvas->fb) / - 2) /* - (u8g2_GetMaxCharHeight(&canvas->fb) / 2)*/, + (128 / 2) - (canvas_string_width(canvas, strInitializing) / 2), + (64 / 2) /* - (canvas_current_font_height(canvas) / 2)*/, strInitializing); } break; case WaitingForModule: @@ -170,10 +166,8 @@ static void esp8266_deauth_module_render_callback(Canvas* const canvas, void* ct const char* strInitializing = "Attach WiFi Deauther module"; canvas_draw_str( canvas, - (u8g2_GetDisplayWidth(&canvas->fb) / 2) - - (canvas_string_width(canvas, strInitializing) / 2), - (u8g2_GetDisplayHeight(&canvas->fb) / - 2) /* - (u8g2_GetMaxCharHeight(&canvas->fb) / 2)*/, + (128 / 2) - (canvas_string_width(canvas, strInitializing) / 2), + (64 / 2) /* - (canvas_current_font_height(canvas) / 2)*/, strInitializing); } #endif @@ -188,18 +182,16 @@ static void esp8266_deauth_module_render_callback(Canvas* const canvas, void* ct const char* strInitializing = "Initializing..."; canvas_draw_str( canvas, - (u8g2_GetDisplayWidth(&canvas->fb) / 2) - - (canvas_string_width(canvas, strInitializing) / 2), - (u8g2_GetDisplayHeight(&canvas->fb) / 2) - - (u8g2_GetMaxCharHeight(&canvas->fb) / 2), + (128 / 2) - (canvas_string_width(canvas, strInitializing) / 2), + (64 / 2) - (canvas_current_font_height(canvas) / 2), strInitializing); } } #endif // ENABLE_MODULE_POWER break; case ModuleActive: { - uint8_t* buffer = canvas_get_buffer(canvas); - app->m_canvasSize = canvas_get_buffer_size(canvas); + uint8_t* buffer = canvas->fb.tile_buf_ptr; + app->m_canvasSize = gui_get_framebuffer_size(app->m_gui); memcpy(buffer, app->m_backBuffer, app->m_canvasSize); } break; default: diff --git a/applications/external/gps_nmea_uart/gps_uart.c b/applications/external/gps_nmea_uart/gps_uart.c index 4e66aa284..d44cf22ef 100644 --- a/applications/external/gps_nmea_uart/gps_uart.c +++ b/applications/external/gps_nmea_uart/gps_uart.c @@ -66,6 +66,19 @@ static void gps_uart_parse_nmea(GpsUart* gps_uart, char* line) { } } break; + case MINMEA_SENTENCE_GLL: { + struct minmea_sentence_gll frame; + if(minmea_parse_gll(&frame, line)) { + gps_uart->status.latitude = minmea_tocoord(&frame.latitude); + gps_uart->status.longitude = minmea_tocoord(&frame.longitude); + gps_uart->status.time_hours = frame.time.hours; + gps_uart->status.time_minutes = frame.time.minutes; + gps_uart->status.time_seconds = frame.time.seconds; + + notification_message_block(gps_uart->notifications, &sequence_blink_red_10); + } + } break; + default: break; } @@ -74,11 +87,8 @@ static void gps_uart_parse_nmea(GpsUart* gps_uart, char* line) { static int32_t gps_uart_worker(void* context) { GpsUart* gps_uart = (GpsUart*)context; - gps_uart->rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE * 5, 1); size_t rx_offset = 0; - gps_uart_serial_init(gps_uart); - while(1) { uint32_t events = furi_thread_flags_wait(WORKER_ALL_RX_EVENTS, FuriFlagWaitAny, FuriWaitForever); @@ -91,35 +101,53 @@ static int32_t gps_uart_worker(void* context) { if(events & WorkerEvtRxDone) { size_t len = 0; do { + // receive serial bytes into rx_buf, starting at rx_offset from the start of the buffer + // the maximum we can receive is RX_BUF_SIZE - 1 - rx_offset len = furi_stream_buffer_receive( gps_uart->rx_stream, gps_uart->rx_buf + rx_offset, RX_BUF_SIZE - 1 - rx_offset, 0); if(len > 0) { + // increase rx_offset by the number of bytes received, and null-terminate rx_buf rx_offset += len; gps_uart->rx_buf[rx_offset] = '\0'; + // look for strings ending in newlines, starting at the start of rx_buf char* line_current = (char*)gps_uart->rx_buf; while(1) { + // skip null characters while(*line_current == '\0' && line_current < (char*)gps_uart->rx_buf + rx_offset - 1) { line_current++; } + // find the next newline char* newline = strchr(line_current, '\n'); - if(newline) { + if(newline) // newline found + { + // put a null terminator in place of the newline, to delimit the line string *newline = '\0'; + + // attempt to parse the line as a NMEA sentence gps_uart_parse_nmea(gps_uart, line_current); + + // move the cursor to the character after the newline line_current = newline + 1; - } else { - if(line_current > (char*)gps_uart->rx_buf) { + } else // no more newlines found + { + if(line_current > + (char*)gps_uart->rx_buf) // at least one line was found + { + // clear parsed lines, and move any leftover bytes to the start of rx_buf rx_offset = 0; - while(*line_current) { + while( + *line_current) // stop when the original rx_offset terminator is reached + { gps_uart->rx_buf[rx_offset++] = *(line_current++); } } - break; + break; // go back to receiving bytes from the serial stream } } } @@ -148,6 +176,8 @@ void gps_uart_init_thread(GpsUart* gps_uart) { gps_uart->status.time_minutes = 0; gps_uart->status.time_seconds = 0; + gps_uart->rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE * 5, 1); + gps_uart->thread = furi_thread_alloc(); furi_thread_set_name(gps_uart->thread, "GpsUartWorker"); furi_thread_set_stack_size(gps_uart->thread, 1024); @@ -155,6 +185,8 @@ void gps_uart_init_thread(GpsUart* gps_uart) { furi_thread_set_callback(gps_uart->thread, gps_uart_worker); furi_thread_start(gps_uart->thread); + + gps_uart_serial_init(gps_uart); } void gps_uart_deinit_thread(GpsUart* gps_uart) { diff --git a/applications/external/hid_app/hid.c b/applications/external/hid_app/hid.c index f4f59b435..28c9ff167 100644 --- a/applications/external/hid_app/hid.c +++ b/applications/external/hid_app/hid.c @@ -11,8 +11,7 @@ enum HidDebugSubmenuIndex { HidSubmenuIndexKeyboard, HidSubmenuIndexNumpad, HidSubmenuIndexMedia, - HidSubmenuIndexTikTok, - HidSubmenuIndexYTShorts, + HidSubmenuIndexTikShorts, HidSubmenuIndexMouse, HidSubmenuIndexMouseClicker, HidSubmenuIndexMouseJiggler, @@ -39,12 +38,9 @@ static void hid_submenu_callback(void* context, uint32_t index) { } 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 == HidSubmenuIndexYTShorts) { - app->view_id = BtHidViewYTShorts; - view_dispatcher_switch_to_view(app->view_dispatcher, BtHidViewYTShorts); + } else if(index == HidSubmenuIndexTikShorts) { + app->view_id = BtHidViewTikShorts; + view_dispatcher_switch_to_view(app->view_dispatcher, BtHidViewTikShorts); } else if(index == HidSubmenuIndexMouseClicker) { app->view_id = HidViewMouseClicker; view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseClicker); @@ -73,8 +69,7 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con hid_mouse_set_connected_status(hid->hid_mouse, connected); hid_mouse_clicker_set_connected_status(hid->hid_mouse_clicker, connected); hid_mouse_jiggler_set_connected_status(hid->hid_mouse_jiggler, connected); - hid_tiktok_set_connected_status(hid->hid_tiktok, connected); - hid_ytshorts_set_connected_status(hid->hid_ytshorts, connected); + hid_tikshorts_set_connected_status(hid->hid_tikshorts, connected); } static void hid_dialog_callback(DialogExResult result, void* context) { @@ -137,14 +132,8 @@ Hid* hid_alloc(HidTransport transport) { if(app->transport == HidTransportBle) { submenu_add_item( app->device_type_submenu, - "TikTok Controller", - HidSubmenuIndexTikTok, - hid_submenu_callback, - app); - submenu_add_item( - app->device_type_submenu, - "YT Shorts Controller", - HidSubmenuIndexYTShorts, + "TikTok / YT Shorts", + HidSubmenuIndexTikShorts, hid_submenu_callback, app); } @@ -215,17 +204,11 @@ Hid* hid_app_alloc_view(void* context) { view_dispatcher_add_view( app->view_dispatcher, HidViewMedia, hid_media_get_view(app->hid_media)); - // TikTok view - app->hid_tiktok = hid_tiktok_alloc(app); - view_set_previous_callback(hid_tiktok_get_view(app->hid_tiktok), hid_exit_confirm_view); + // TikTok / YT Shorts view + app->hid_tikshorts = hid_tikshorts_alloc(app); + view_set_previous_callback(hid_tikshorts_get_view(app->hid_tikshorts), hid_exit_confirm_view); view_dispatcher_add_view( - app->view_dispatcher, BtHidViewTikTok, hid_tiktok_get_view(app->hid_tiktok)); - - // YTShorts view - app->hid_ytshorts = hid_ytshorts_alloc(app); - view_set_previous_callback(hid_ytshorts_get_view(app->hid_ytshorts), hid_exit_confirm_view); - view_dispatcher_add_view( - app->view_dispatcher, BtHidViewYTShorts, hid_ytshorts_get_view(app->hid_ytshorts)); + app->view_dispatcher, BtHidViewTikShorts, hid_tikshorts_get_view(app->hid_tikshorts)); // Mouse view app->hid_mouse = hid_mouse_alloc(app); @@ -241,6 +224,7 @@ Hid* hid_app_alloc_view(void* context) { app->view_dispatcher, HidViewMouseClicker, hid_mouse_clicker_get_view(app->hid_mouse_clicker)); + // Mouse jiggler view app->hid_mouse_jiggler = hid_mouse_jiggler_alloc(app); view_set_previous_callback( @@ -282,10 +266,8 @@ void hid_free(Hid* app) { hid_mouse_clicker_free(app->hid_mouse_clicker); view_dispatcher_remove_view(app->view_dispatcher, HidViewMouseJiggler); hid_mouse_jiggler_free(app->hid_mouse_jiggler); - view_dispatcher_remove_view(app->view_dispatcher, BtHidViewTikTok); - hid_tiktok_free(app->hid_tiktok); - view_dispatcher_remove_view(app->view_dispatcher, BtHidViewYTShorts); - hid_ytshorts_free(app->hid_ytshorts); + view_dispatcher_remove_view(app->view_dispatcher, BtHidViewTikShorts); + hid_tikshorts_free(app->hid_tikshorts); view_dispatcher_free(app->view_dispatcher); // Close records diff --git a/applications/external/hid_app/hid.h b/applications/external/hid_app/hid.h index 1a533de99..4a8cd2a98 100644 --- a/applications/external/hid_app/hid.h +++ b/applications/external/hid_app/hid.h @@ -23,8 +23,7 @@ #include "views/hid_media.h" #include "views/hid_mouse.h" #include "views/hid_mouse_jiggler.h" -#include "views/hid_tiktok.h" -#include "views/hid_ytshorts.h" +#include "views/hid_tikshorts.h" #include "views/hid_mouse_clicker.h" #define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys" @@ -51,8 +50,7 @@ struct Hid { HidMouse* hid_mouse; HidMouseClicker* hid_mouse_clicker; HidMouseJiggler* hid_mouse_jiggler; - HidTikTok* hid_tiktok; - HidYTShorts* hid_ytshorts; + HidTikShorts* hid_tikshorts; HidTransport transport; uint32_t view_id; diff --git a/applications/external/hid_app/views.h b/applications/external/hid_app/views.h index 2ec17bb33..5d02220cd 100644 --- a/applications/external/hid_app/views.h +++ b/applications/external/hid_app/views.h @@ -8,7 +8,6 @@ typedef enum { HidViewMouse, HidViewMouseClicker, HidViewMouseJiggler, - BtHidViewTikTok, - BtHidViewYTShorts, + BtHidViewTikShorts, HidViewExitConfirm, } HidView; diff --git a/applications/external/hid_app/views/hid_ytshorts.c b/applications/external/hid_app/views/hid_tikshorts.c similarity index 59% rename from applications/external/hid_app/views/hid_ytshorts.c rename to applications/external/hid_app/views/hid_tikshorts.c index 359091640..0e156fdf0 100644 --- a/applications/external/hid_app/views/hid_ytshorts.c +++ b/applications/external/hid_app/views/hid_tikshorts.c @@ -1,12 +1,12 @@ -#include "hid_ytshorts.h" +#include "hid_tikshorts.h" #include "../hid.h" #include #include "hid_icons.h" -#define TAG "HidYTShorts" +#define TAG "HidTikShorts" -struct HidYTShorts { +struct HidTikShorts { View* view; Hid* hid; }; @@ -21,11 +21,11 @@ typedef struct { bool is_cursor_set; bool back_mouse_pressed; HidTransport transport; -} HidYTShortsModel; +} HidTikShortsModel; -static void hid_ytshorts_draw_callback(Canvas* canvas, void* context) { +static void hid_tikshorts_draw_callback(Canvas* canvas, void* context) { furi_assert(context); - HidYTShortsModel* model = context; + HidTikShortsModel* model = context; // Header if(model->transport == HidTransportBle) { @@ -37,7 +37,8 @@ static void hid_ytshorts_draw_callback(Canvas* canvas, void* context) { } canvas_set_font(canvas, FontPrimary); - elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Shorts"); + elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "TikTok /"); + elements_multiline_text_aligned(canvas, 3, 18, AlignLeft, AlignTop, "YT Shorts"); canvas_set_font(canvas, FontSecondary); // Keypad circles @@ -109,22 +110,21 @@ static void hid_ytshorts_draw_callback(Canvas* canvas, void* context) { elements_multiline_text_aligned(canvas, 13, 62, AlignLeft, AlignBottom, "Hold to exit"); } -static void hid_ytshorts_reset_cursor(HidYTShorts* hid_ytshorts) { +static void hid_tikshorts_reset_cursor(HidTikShorts* hid_tikshorts) { // Set cursor to the phone's left up corner // Delays to guarantee one packet per connection interval for(size_t i = 0; i < 8; i++) { - hid_hal_mouse_move(hid_ytshorts->hid, -127, -127); + hid_hal_mouse_move(hid_tikshorts->hid, -127, -127); furi_delay_ms(50); } // Move cursor from the corner - hid_hal_mouse_move(hid_ytshorts->hid, 40, 120); - hid_hal_mouse_move(hid_ytshorts->hid, 0, 120); + hid_hal_mouse_move(hid_tikshorts->hid, 20, 120); furi_delay_ms(50); } -static void hid_ytshorts_process_press( - HidYTShorts* hid_ytshorts, - HidYTShortsModel* model, +static void hid_tikshorts_process_press( + HidTikShorts* hid_tikshorts, + HidTikShortsModel* model, InputEvent* event) { if(event->key == InputKeyUp) { model->up_pressed = true; @@ -132,10 +132,10 @@ static void hid_ytshorts_process_press( model->down_pressed = true; } else if(event->key == InputKeyLeft) { model->left_pressed = true; - hid_hal_consumer_key_press(hid_ytshorts->hid, HID_CONSUMER_VOLUME_DECREMENT); + hid_hal_consumer_key_press(hid_tikshorts->hid, HID_CONSUMER_VOLUME_DECREMENT); } else if(event->key == InputKeyRight) { model->right_pressed = true; - hid_hal_consumer_key_press(hid_ytshorts->hid, HID_CONSUMER_VOLUME_INCREMENT); + hid_hal_consumer_key_press(hid_tikshorts->hid, HID_CONSUMER_VOLUME_INCREMENT); } else if(event->key == InputKeyOk) { model->ok_pressed = true; } else if(event->key == InputKeyBack) { @@ -143,9 +143,9 @@ static void hid_ytshorts_process_press( } } -static void hid_ytshorts_process_release( - HidYTShorts* hid_ytshorts, - HidYTShortsModel* model, +static void hid_tikshorts_process_release( + HidTikShorts* hid_tikshorts, + HidTikShortsModel* model, InputEvent* event) { if(event->key == InputKeyUp) { model->up_pressed = false; @@ -153,10 +153,10 @@ static void hid_ytshorts_process_release( model->down_pressed = false; } else if(event->key == InputKeyLeft) { model->left_pressed = false; - hid_hal_consumer_key_release(hid_ytshorts->hid, HID_CONSUMER_VOLUME_DECREMENT); + hid_hal_consumer_key_release(hid_tikshorts->hid, HID_CONSUMER_VOLUME_DECREMENT); } else if(event->key == InputKeyRight) { model->right_pressed = false; - hid_hal_consumer_key_release(hid_ytshorts->hid, HID_CONSUMER_VOLUME_INCREMENT); + hid_hal_consumer_key_release(hid_tikshorts->hid, HID_CONSUMER_VOLUME_INCREMENT); } else if(event->key == InputKeyOk) { model->ok_pressed = false; } else if(event->key == InputKeyBack) { @@ -164,62 +164,61 @@ static void hid_ytshorts_process_release( } } -static bool hid_ytshorts_input_callback(InputEvent* event, void* context) { +static bool hid_tikshorts_input_callback(InputEvent* event, void* context) { furi_assert(context); - HidYTShorts* hid_ytshorts = context; + HidTikShorts* hid_tikshorts = context; bool consumed = false; with_view_model( - hid_ytshorts->view, - HidYTShortsModel * model, + hid_tikshorts->view, + HidTikShortsModel * model, { if(event->type == InputTypePress) { - hid_ytshorts_process_press(hid_ytshorts, model, event); + hid_tikshorts_process_press(hid_tikshorts, model, event); if(model->connected && !model->is_cursor_set) { - hid_ytshorts_reset_cursor(hid_ytshorts); + hid_tikshorts_reset_cursor(hid_tikshorts); model->is_cursor_set = true; } consumed = true; } else if(event->type == InputTypeRelease) { - hid_ytshorts_process_release(hid_ytshorts, model, event); + hid_tikshorts_process_release(hid_tikshorts, model, event); consumed = true; } else if(event->type == InputTypeShort) { if(event->key == InputKeyOk) { - hid_hal_mouse_press(hid_ytshorts->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(50); - hid_hal_mouse_release(hid_ytshorts->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(50); - hid_hal_mouse_press(hid_ytshorts->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(50); - hid_hal_mouse_release(hid_ytshorts->hid, HID_MOUSE_BTN_LEFT); + hid_hal_mouse_press(hid_tikshorts->hid, HID_MOUSE_BTN_LEFT); + furi_delay_ms(25); + hid_hal_mouse_release(hid_tikshorts->hid, HID_MOUSE_BTN_LEFT); + furi_delay_ms(100); + hid_hal_mouse_press(hid_tikshorts->hid, HID_MOUSE_BTN_LEFT); + furi_delay_ms(25); + hid_hal_mouse_release(hid_tikshorts->hid, HID_MOUSE_BTN_LEFT); consumed = true; } else if(event->key == InputKeyDown) { - // Swipe to new video - hid_hal_mouse_scroll(hid_ytshorts->hid, 6); - hid_hal_mouse_scroll(hid_ytshorts->hid, 8); - hid_hal_mouse_scroll(hid_ytshorts->hid, 10); - hid_hal_mouse_scroll(hid_ytshorts->hid, 8); - hid_hal_mouse_scroll(hid_ytshorts->hid, 6); + // Swipe to next video + hid_hal_mouse_scroll(hid_tikshorts->hid, 6); + hid_hal_mouse_scroll(hid_tikshorts->hid, 8); + hid_hal_mouse_scroll(hid_tikshorts->hid, 10); + hid_hal_mouse_scroll(hid_tikshorts->hid, 8); + hid_hal_mouse_scroll(hid_tikshorts->hid, 6); consumed = true; } else if(event->key == InputKeyUp) { // Swipe to previous video - hid_hal_mouse_scroll(hid_ytshorts->hid, -6); - hid_hal_mouse_scroll(hid_ytshorts->hid, -8); - hid_hal_mouse_scroll(hid_ytshorts->hid, -10); - hid_hal_mouse_scroll(hid_ytshorts->hid, -8); - hid_hal_mouse_scroll(hid_ytshorts->hid, -6); + hid_hal_mouse_scroll(hid_tikshorts->hid, -6); + hid_hal_mouse_scroll(hid_tikshorts->hid, -8); + hid_hal_mouse_scroll(hid_tikshorts->hid, -10); + hid_hal_mouse_scroll(hid_tikshorts->hid, -8); + hid_hal_mouse_scroll(hid_tikshorts->hid, -6); consumed = true; } else if(event->key == InputKeyBack) { // Pause - hid_hal_mouse_press(hid_ytshorts->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(50); - hid_hal_mouse_release(hid_ytshorts->hid, HID_MOUSE_BTN_LEFT); + hid_hal_mouse_press(hid_tikshorts->hid, HID_MOUSE_BTN_LEFT); furi_delay_ms(50); + hid_hal_mouse_release(hid_tikshorts->hid, HID_MOUSE_BTN_LEFT); consumed = true; } } else if(event->type == InputTypeLong) { if(event->key == InputKeyBack) { - hid_hal_consumer_key_release_all(hid_ytshorts->hid); + hid_hal_consumer_key_release_all(hid_tikshorts->hid); model->is_cursor_set = false; consumed = false; } @@ -230,40 +229,40 @@ static bool hid_ytshorts_input_callback(InputEvent* event, void* context) { return consumed; } -HidYTShorts* hid_ytshorts_alloc(Hid* bt_hid) { - HidYTShorts* hid_ytshorts = malloc(sizeof(HidYTShorts)); - hid_ytshorts->hid = bt_hid; - hid_ytshorts->view = view_alloc(); - view_set_context(hid_ytshorts->view, hid_ytshorts); - view_allocate_model(hid_ytshorts->view, ViewModelTypeLocking, sizeof(HidYTShortsModel)); - view_set_draw_callback(hid_ytshorts->view, hid_ytshorts_draw_callback); - view_set_input_callback(hid_ytshorts->view, hid_ytshorts_input_callback); +HidTikShorts* hid_tikshorts_alloc(Hid* bt_hid) { + HidTikShorts* hid_tikshorts = malloc(sizeof(HidTikShorts)); + hid_tikshorts->hid = bt_hid; + hid_tikshorts->view = view_alloc(); + view_set_context(hid_tikshorts->view, hid_tikshorts); + view_allocate_model(hid_tikshorts->view, ViewModelTypeLocking, sizeof(HidTikShortsModel)); + view_set_draw_callback(hid_tikshorts->view, hid_tikshorts_draw_callback); + view_set_input_callback(hid_tikshorts->view, hid_tikshorts_input_callback); with_view_model( - hid_ytshorts->view, - HidYTShortsModel * model, + hid_tikshorts->view, + HidTikShortsModel * model, { model->transport = bt_hid->transport; }, true); - return hid_ytshorts; + return hid_tikshorts; } -void hid_ytshorts_free(HidYTShorts* hid_ytshorts) { - furi_assert(hid_ytshorts); - view_free(hid_ytshorts->view); - free(hid_ytshorts); +void hid_tikshorts_free(HidTikShorts* hid_tikshorts) { + furi_assert(hid_tikshorts); + view_free(hid_tikshorts->view); + free(hid_tikshorts); } -View* hid_ytshorts_get_view(HidYTShorts* hid_ytshorts) { - furi_assert(hid_ytshorts); - return hid_ytshorts->view; +View* hid_tikshorts_get_view(HidTikShorts* hid_tikshorts) { + furi_assert(hid_tikshorts); + return hid_tikshorts->view; } -void hid_ytshorts_set_connected_status(HidYTShorts* hid_ytshorts, bool connected) { - furi_assert(hid_ytshorts); +void hid_tikshorts_set_connected_status(HidTikShorts* hid_tikshorts, bool connected) { + furi_assert(hid_tikshorts); with_view_model( - hid_ytshorts->view, - HidYTShortsModel * model, + hid_tikshorts->view, + HidTikShortsModel * model, { model->connected = connected; model->is_cursor_set = false; diff --git a/applications/external/hid_app/views/hid_tikshorts.h b/applications/external/hid_app/views/hid_tikshorts.h new file mode 100644 index 000000000..5604962ee --- /dev/null +++ b/applications/external/hid_app/views/hid_tikshorts.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +typedef struct Hid Hid; +typedef struct HidTikShorts HidTikShorts; + +HidTikShorts* hid_tikshorts_alloc(Hid* bt_hid); + +void hid_tikshorts_free(HidTikShorts* hid_tikshorts); + +View* hid_tikshorts_get_view(HidTikShorts* hid_tikshorts); + +void hid_tikshorts_set_connected_status(HidTikShorts* hid_tikshorts, bool connected); diff --git a/applications/external/hid_app/views/hid_tiktok.c b/applications/external/hid_app/views/hid_tiktok.c deleted file mode 100644 index 4dfbde4eb..000000000 --- a/applications/external/hid_app/views/hid_tiktok.c +++ /dev/null @@ -1,256 +0,0 @@ -#include "hid_tiktok.h" -#include "../hid.h" -#include - -#include "hid_icons.h" - -#define TAG "HidTikTok" - -struct HidTikTok { - View* view; - Hid* hid; -}; - -typedef struct { - bool left_pressed; - bool up_pressed; - bool right_pressed; - bool down_pressed; - bool ok_pressed; - bool connected; - bool is_cursor_set; - bool back_mouse_pressed; - HidTransport transport; -} HidTikTokModel; - -static void hid_tiktok_draw_callback(Canvas* canvas, void* context) { - furi_assert(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); - } - } - - 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, 58, 3, &I_OutCircles); - - // Pause - if(model->back_mouse_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19); - canvas_set_bitmap_mode(canvas, 0); - canvas_set_color(canvas, ColorWhite); - } - canvas_draw_icon(canvas, 113, 37, &I_Pause_icon_9x9); - canvas_set_color(canvas, ColorBlack); - - // Up - if(model->up_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 68, 6, &I_S_UP); - canvas_set_bitmap_mode(canvas, 0); - canvas_set_color(canvas, ColorWhite); - } - canvas_draw_icon(canvas, 80, 8, &I_Arr_up_7x9); - canvas_set_color(canvas, ColorBlack); - - // Down - if(model->down_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 68, 36, &I_S_DOWN); - canvas_set_bitmap_mode(canvas, 0); - canvas_set_color(canvas, ColorWhite); - } - canvas_draw_icon(canvas, 80, 40, &I_Arr_dwn_7x9); - canvas_set_color(canvas, ColorBlack); - - // Left - if(model->left_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 61, 13, &I_S_LEFT); - canvas_set_bitmap_mode(canvas, 0); - canvas_set_color(canvas, ColorWhite); - } - canvas_draw_icon(canvas, 64, 25, &I_Voldwn_6x6); - canvas_set_color(canvas, ColorBlack); - - // Right - if(model->right_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT); - canvas_set_bitmap_mode(canvas, 0); - canvas_set_color(canvas, ColorWhite); - } - canvas_draw_icon(canvas, 95, 25, &I_Volup_8x6); - canvas_set_color(canvas, ColorBlack); - - // Ok - if(model->ok_pressed) { - canvas_set_bitmap_mode(canvas, 1); - canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19); - canvas_set_bitmap_mode(canvas, 0); - canvas_set_color(canvas, ColorWhite); - } - canvas_draw_icon(canvas, 78, 25, &I_Like_def_11x9); - canvas_set_color(canvas, ColorBlack); - - // Exit - canvas_draw_icon(canvas, 0, 54, &I_Pin_back_arrow_10x8); - canvas_set_font(canvas, FontSecondary); - elements_multiline_text_aligned(canvas, 13, 62, AlignLeft, AlignBottom, "Hold to exit"); -} - -static void hid_tiktok_reset_cursor(HidTikTok* hid_tiktok) { - // Set cursor to the phone's left up corner - // Delays to guarantee one packet per connection interval - for(size_t i = 0; i < 8; i++) { - hid_hal_mouse_move(hid_tiktok->hid, -127, -127); - furi_delay_ms(50); - } - // Move cursor from the corner - hid_hal_mouse_move(hid_tiktok->hid, 40, 120); - hid_hal_mouse_move(hid_tiktok->hid, 0, 120); - furi_delay_ms(50); -} - -static void - hid_tiktok_process_press(HidTikTok* hid_tiktok, HidTikTokModel* model, InputEvent* event) { - if(event->key == InputKeyUp) { - model->up_pressed = true; - } else if(event->key == InputKeyDown) { - model->down_pressed = true; - } else if(event->key == InputKeyLeft) { - model->left_pressed = true; - hid_hal_consumer_key_press(hid_tiktok->hid, HID_CONSUMER_VOLUME_DECREMENT); - } else if(event->key == InputKeyRight) { - model->right_pressed = true; - hid_hal_consumer_key_press(hid_tiktok->hid, HID_CONSUMER_VOLUME_INCREMENT); - } else if(event->key == InputKeyOk) { - model->ok_pressed = true; - } else if(event->key == InputKeyBack) { - model->back_mouse_pressed = true; - } -} - -static void - hid_tiktok_process_release(HidTikTok* hid_tiktok, HidTikTokModel* model, InputEvent* event) { - if(event->key == InputKeyUp) { - model->up_pressed = false; - } else if(event->key == InputKeyDown) { - model->down_pressed = false; - } else if(event->key == InputKeyLeft) { - model->left_pressed = false; - hid_hal_consumer_key_release(hid_tiktok->hid, HID_CONSUMER_VOLUME_DECREMENT); - } else if(event->key == InputKeyRight) { - model->right_pressed = false; - hid_hal_consumer_key_release(hid_tiktok->hid, HID_CONSUMER_VOLUME_INCREMENT); - } else if(event->key == InputKeyOk) { - model->ok_pressed = false; - } else if(event->key == InputKeyBack) { - model->back_mouse_pressed = false; - } -} - -static bool hid_tiktok_input_callback(InputEvent* event, void* context) { - furi_assert(context); - HidTikTok* hid_tiktok = context; - bool consumed = false; - - with_view_model( - hid_tiktok->view, - HidTikTokModel * model, - { - if(event->type == InputTypePress) { - hid_tiktok_process_press(hid_tiktok, model, event); - if(model->connected && !model->is_cursor_set) { - hid_tiktok_reset_cursor(hid_tiktok); - model->is_cursor_set = true; - } - consumed = true; - } else if(event->type == InputTypeRelease) { - hid_tiktok_process_release(hid_tiktok, model, event); - consumed = true; - } else if(event->type == InputTypeShort) { - if(event->key == InputKeyOk) { - hid_hal_mouse_press(hid_tiktok->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(25); - hid_hal_mouse_release(hid_tiktok->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(100); - hid_hal_mouse_press(hid_tiktok->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(25); - hid_hal_mouse_release(hid_tiktok->hid, HID_MOUSE_BTN_LEFT); - consumed = true; - } else if(event->key == InputKeyDown) { - // Swipe to previous video - hid_hal_mouse_scroll(hid_tiktok->hid, 19); - consumed = true; - } else if(event->key == InputKeyUp) { - // Swipe to new video - hid_hal_mouse_scroll(hid_tiktok->hid, -19); - consumed = true; - } else if(event->key == InputKeyBack) { - // Pause - hid_hal_mouse_press(hid_tiktok->hid, HID_MOUSE_BTN_LEFT); - furi_delay_ms(50); - hid_hal_mouse_release(hid_tiktok->hid, HID_MOUSE_BTN_LEFT); - consumed = true; - } - } else if(event->type == InputTypeLong) { - if(event->key == InputKeyBack) { - hid_hal_consumer_key_release_all(hid_tiktok->hid); - model->is_cursor_set = false; - consumed = false; - } - } - }, - true); - - return consumed; -} - -HidTikTok* hid_tiktok_alloc(Hid* bt_hid) { - HidTikTok* hid_tiktok = malloc(sizeof(HidTikTok)); - hid_tiktok->hid = bt_hid; - hid_tiktok->view = view_alloc(); - view_set_context(hid_tiktok->view, hid_tiktok); - view_allocate_model(hid_tiktok->view, ViewModelTypeLocking, sizeof(HidTikTokModel)); - 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; -} - -void hid_tiktok_free(HidTikTok* hid_tiktok) { - furi_assert(hid_tiktok); - view_free(hid_tiktok->view); - free(hid_tiktok); -} - -View* hid_tiktok_get_view(HidTikTok* hid_tiktok) { - furi_assert(hid_tiktok); - return hid_tiktok->view; -} - -void hid_tiktok_set_connected_status(HidTikTok* hid_tiktok, bool connected) { - furi_assert(hid_tiktok); - with_view_model( - hid_tiktok->view, - HidTikTokModel * model, - { - model->connected = connected; - model->is_cursor_set = false; - }, - true); -} diff --git a/applications/external/hid_app/views/hid_tiktok.h b/applications/external/hid_app/views/hid_tiktok.h deleted file mode 100644 index b2efc3692..000000000 --- a/applications/external/hid_app/views/hid_tiktok.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -typedef struct Hid Hid; -typedef struct HidTikTok HidTikTok; - -HidTikTok* hid_tiktok_alloc(Hid* bt_hid); - -void hid_tiktok_free(HidTikTok* hid_tiktok); - -View* hid_tiktok_get_view(HidTikTok* hid_tiktok); - -void hid_tiktok_set_connected_status(HidTikTok* hid_tiktok, bool connected); diff --git a/applications/external/hid_app/views/hid_ytshorts.h b/applications/external/hid_app/views/hid_ytshorts.h deleted file mode 100644 index 03264dd36..000000000 --- a/applications/external/hid_app/views/hid_ytshorts.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -typedef struct Hid Hid; -typedef struct HidYTShorts HidYTShorts; - -HidYTShorts* hid_ytshorts_alloc(Hid* bt_hid); - -void hid_ytshorts_free(HidYTShorts* hid_ytshorts); - -View* hid_ytshorts_get_view(HidYTShorts* hid_ytshorts); - -void hid_ytshorts_set_connected_status(HidYTShorts* hid_ytshorts, bool connected); diff --git a/applications/external/mfkey32/application.fam b/applications/external/mfkey32/application.fam index eb11aec2c..75fa40bf6 100644 --- a/applications/external/mfkey32/application.fam +++ b/applications/external/mfkey32/application.fam @@ -10,7 +10,7 @@ App( ], stack_size=1 * 1024, fap_icon="mfkey.png", - fap_category="Tools", + fap_category="NFC", fap_author="noproto", fap_icon_assets="images", fap_weburl="https://github.com/noproto/FlipperMfkey", diff --git a/applications/external/mifare_nested/LICENSE.md b/applications/external/mifare_nested/LICENSE.md new file mode 100644 index 000000000..f288702d2 --- /dev/null +++ b/applications/external/mifare_nested/LICENSE.md @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/applications/external/mifare_nested/README.md b/applications/external/mifare_nested/README.md new file mode 100644 index 000000000..9d5031725 --- /dev/null +++ b/applications/external/mifare_nested/README.md @@ -0,0 +1,38 @@ +# Mifare Nested Attacks for Flipper Zero + +Ported Nested attacks from Proxmark3 (Iceman fork) + +This is not original Repo of this app! Please follow this link to find latest original source and support the author! +[Flipper (Mifare) Nested (by AloneLiberty)](https://github.com/AloneLiberty/FlipperNested) + +## Currently supported attacks + + - nested attack + - static nested attack + - hard nested attack + +## Warning + +App is still in early development, so there may be bugs. Your Flipper Zero may randomly crash/froze. Please create issue if you find any bugs (one bug = one issue). In original repo! - https://github.com/AloneLiberty/FlipperNested + +## Disclaimer + +The app provided for personal use only. Developer does not take responsibility for any loss or damage caused by the misuse of this app. In addition, the app developer does not guarantee the performance or compatibility of the app with all tags, and cannot be held liable for any damage caused to your tags/Flipper Zero as a result of using the app. By using this app you confirm that the tag belongs to you, you have permission to preform the attack and you agree to hold the app developer harmless from any and all claims, damages, or losses that may arise from its use. + +## I need **your** help! + +To successfuly recover keys from nested attack we need to correctly predict PRNG value. But we have a problem with that. Due to lack of my knowlege of Flipper Zero NFC HAL, PRNG can jump by quite large values (not like Proxmark3). So app is trying to find a delay where PRNG can be predicted accurately enough. This is not the best option, because we have to try to recover a bunch of unnecessary keys, which takes a lot of time and RAM and also spend a lot of time on timings. I don't know how to fix it. + +UPD: Chameleon Ultra devs [faced same issue](https://youtu.be/_wfikmXNQzE?t=202). They seems to use same method: [nested.c](https://github.com/RfidResearchGroup/ChameleonUltra/blob/main/software/src/nested.c) (better know from the beginning of development...) + +## How to use it? + +Detailed guide: [EN](https://github.com/AloneLiberty/FlipperNested/wiki/Usage-guide), [RU](https://github.com/AloneLiberty/FlipperNested/wiki/%D0%93%D0%B0%D0%B9%D0%B4-%D0%BF%D0%BE-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8E). + +## FAQ + +For frequently asked questions, please refer to the FAQ: [EN](https://github.com/AloneLiberty/FlipperNested/wiki/FAQ), [RU](https://github.com/AloneLiberty/FlipperNested/wiki/%D0%A7%D0%90%D0%92%D0%9E). + +## Contacts + +Find here: https://github.com/AloneLiberty/FlipperNested diff --git a/applications/external/mifare_nested/TODO.md b/applications/external/mifare_nested/TODO.md new file mode 100644 index 000000000..4610e5c7b --- /dev/null +++ b/applications/external/mifare_nested/TODO.md @@ -0,0 +1,3 @@ +# TODO: + +1. Better (faster) detection of delay in a nested attack diff --git a/applications/external/mifare_nested/application.fam b/applications/external/mifare_nested/application.fam new file mode 100644 index 000000000..236abf6d1 --- /dev/null +++ b/applications/external/mifare_nested/application.fam @@ -0,0 +1,25 @@ +App( + appid="mifare_nested", + name="Mifare Nested", + apptype=FlipperAppType.EXTERNAL, + entry_point="mifare_nested_app", + requires=[ + "storage", + "gui", + "nfc" + ], + stack_size=4 * 1024, + order=30, + fap_icon="assets/icon.png", + fap_category="NFC", + fap_private_libs=[ + Lib(name="nested"), + Lib(name="parity"), + Lib(name="crypto1") + ], + fap_icon_assets="assets", + fap_author="AloneLiberty", + fap_description="Recover Mifare Classic keys", + fap_weburl="https://github.com/AloneLiberty/FlipperNested", + fap_version=(1, 4) +) diff --git a/applications/external/mifare_nested/assets/ApplyTag.png b/applications/external/mifare_nested/assets/ApplyTag.png new file mode 100644 index 000000000..787c0bcfe Binary files /dev/null and b/applications/external/mifare_nested/assets/ApplyTag.png differ diff --git a/applications/external/mifare_nested/assets/DolphinCry.png b/applications/external/mifare_nested/assets/DolphinCry.png new file mode 100644 index 000000000..86d9db1b4 Binary files /dev/null and b/applications/external/mifare_nested/assets/DolphinCry.png differ diff --git a/applications/external/mifare_nested/assets/DolphinSuccess.png b/applications/external/mifare_nested/assets/DolphinSuccess.png new file mode 100644 index 000000000..341999109 Binary files /dev/null and b/applications/external/mifare_nested/assets/DolphinSuccess.png differ diff --git a/applications/external/mifare_nested/assets/Loading.png b/applications/external/mifare_nested/assets/Loading.png new file mode 100644 index 000000000..93a59fe68 Binary files /dev/null and b/applications/external/mifare_nested/assets/Loading.png differ diff --git a/applications/external/mifare_nested/assets/icon.png b/applications/external/mifare_nested/assets/icon.png new file mode 100644 index 000000000..ae72f2ff9 Binary files /dev/null and b/applications/external/mifare_nested/assets/icon.png differ diff --git a/applications/external/mifare_nested/lib/crypto1/crypto1.c b/applications/external/mifare_nested/lib/crypto1/crypto1.c new file mode 100644 index 000000000..0483f45e8 --- /dev/null +++ b/applications/external/mifare_nested/lib/crypto1/crypto1.c @@ -0,0 +1,118 @@ +#include "crypto1.h" +#include + +void crypto1_reset(Crypto1* crypto1) { + furi_assert(crypto1); + crypto1->even = 0; + crypto1->odd = 0; +} + +void crypto1_init(Crypto1* crypto1, uint64_t key) { + furi_assert(crypto1); + crypto1->even = 0; + crypto1->odd = 0; + for(int8_t i = 47; i > 0; i -= 2) { + crypto1->odd = crypto1->odd << 1 | FURI_BIT(key, (i - 1) ^ 7); + crypto1->even = crypto1->even << 1 | FURI_BIT(key, i ^ 7); + } +} + +uint32_t crypto1_filter(uint32_t in) { + uint32_t out = 0; + out = 0xf22c0 >> (in & 0xf) & 16; + out |= 0x6c9c0 >> (in >> 4 & 0xf) & 8; + out |= 0x3c8b0 >> (in >> 8 & 0xf) & 4; + out |= 0x1e458 >> (in >> 12 & 0xf) & 2; + out |= 0x0d938 >> (in >> 16 & 0xf) & 1; + return FURI_BIT(0xEC57E80A, out); +} + +uint8_t crypto1_bit(Crypto1* crypto1, uint8_t in, int is_encrypted) { + furi_assert(crypto1); + uint8_t out = crypto1_filter(crypto1->odd); + uint32_t feed = out & (!!is_encrypted); + feed ^= !!in; + feed ^= LF_POLY_ODD & crypto1->odd; + feed ^= LF_POLY_EVEN & crypto1->even; + crypto1->even = crypto1->even << 1 | (evenparity32(feed)); + + FURI_SWAP(crypto1->odd, crypto1->even); + return out; +} + +uint8_t crypto1_byte(Crypto1* crypto1, uint8_t in, int is_encrypted) { + furi_assert(crypto1); + uint8_t out = 0; + for(uint8_t i = 0; i < 8; i++) { + out |= crypto1_bit(crypto1, FURI_BIT(in, i), is_encrypted) << i; + } + return out; +} + +uint32_t crypto1_word(Crypto1* crypto1, uint32_t in, int is_encrypted) { + furi_assert(crypto1); + uint32_t out = 0; + for(uint8_t i = 0; i < 32; i++) { + out |= (uint32_t)crypto1_bit(crypto1, BEBIT(in, i), is_encrypted) << (24 ^ i); + } + return out; +} + +uint32_t prng_successor(uint32_t x, uint32_t n) { + SWAPENDIAN(x); + while(n--) x = x >> 1 | (x >> 16 ^ x >> 18 ^ x >> 19 ^ x >> 21) << 31; + + return SWAPENDIAN(x); +} + +void crypto1_decrypt( + Crypto1* crypto, + uint8_t* encrypted_data, + uint16_t encrypted_data_bits, + uint8_t* decrypted_data) { + furi_assert(crypto); + furi_assert(encrypted_data); + furi_assert(decrypted_data); + + if(encrypted_data_bits < 8) { + uint8_t decrypted_byte = 0; + decrypted_byte |= (crypto1_bit(crypto, 0, 0) ^ FURI_BIT(encrypted_data[0], 0)) << 0; + decrypted_byte |= (crypto1_bit(crypto, 0, 0) ^ FURI_BIT(encrypted_data[0], 1)) << 1; + decrypted_byte |= (crypto1_bit(crypto, 0, 0) ^ FURI_BIT(encrypted_data[0], 2)) << 2; + decrypted_byte |= (crypto1_bit(crypto, 0, 0) ^ FURI_BIT(encrypted_data[0], 3)) << 3; + decrypted_data[0] = decrypted_byte; + } else { + for(size_t i = 0; i < encrypted_data_bits / 8; i++) { + decrypted_data[i] = crypto1_byte(crypto, 0, 0) ^ encrypted_data[i]; + } + } +} + +void crypto1_encrypt( + Crypto1* crypto, + uint8_t* keystream, + uint8_t* plain_data, + uint16_t plain_data_bits, + uint8_t* encrypted_data, + uint8_t* encrypted_parity) { + furi_assert(crypto); + furi_assert(plain_data); + furi_assert(encrypted_data); + furi_assert(encrypted_parity); + + if(plain_data_bits < 8) { + encrypted_data[0] = 0; + for(size_t i = 0; i < plain_data_bits; i++) { + encrypted_data[0] |= (crypto1_bit(crypto, 0, 0) ^ FURI_BIT(plain_data[0], i)) << i; + } + } else { + memset(encrypted_parity, 0, plain_data_bits / 8 + 1); + for(uint8_t i = 0; i < plain_data_bits / 8; i++) { + encrypted_data[i] = crypto1_byte(crypto, keystream ? keystream[i] : 0, 0) ^ + plain_data[i]; + encrypted_parity[i / 8] |= + (((crypto1_filter(crypto->odd) ^ oddparity8(plain_data[i])) & 0x01) + << (7 - (i & 0x0007))); + } + } +} \ No newline at end of file diff --git a/applications/external/mifare_nested/lib/crypto1/crypto1.h b/applications/external/mifare_nested/lib/crypto1/crypto1.h new file mode 100644 index 000000000..bad6e631b --- /dev/null +++ b/applications/external/mifare_nested/lib/crypto1/crypto1.h @@ -0,0 +1,39 @@ +#include "../../lib/parity/parity.h" +#include +#include +#include "stddef.h" + +#define LF_POLY_ODD (0x29CE5C) +#define LF_POLY_EVEN (0x870804) + +#define SWAPENDIAN(x) \ + ((x) = ((x) >> 8 & 0xff00ff) | ((x)&0xff00ff) << 8, (x) = (x) >> 16 | (x) << 16) +#define BEBIT(x, n) FURI_BIT(x, (n) ^ 24) + +void crypto1_reset(Crypto1* crypto1); + +void crypto1_init(Crypto1* crypto1, uint64_t key); + +uint32_t crypto1_filter(uint32_t in); + +uint8_t crypto1_bit(Crypto1* crypto1, uint8_t in, int is_encrypted); + +uint8_t crypto1_byte(Crypto1* crypto1, uint8_t in, int is_encrypted); + +uint32_t crypto1_word(Crypto1* crypto1, uint32_t in, int is_encrypted); + +uint32_t prng_successor(uint32_t x, uint32_t n); + +void crypto1_decrypt( + Crypto1* crypto, + uint8_t* encrypted_data, + uint16_t encrypted_data_bits, + uint8_t* decrypted_data); + +void crypto1_encrypt( + Crypto1* crypto, + uint8_t* keystream, + uint8_t* plain_data, + uint16_t plain_data_bits, + uint8_t* encrypted_data, + uint8_t* encrypted_parity); \ No newline at end of file diff --git a/applications/external/mifare_nested/lib/nested/nested.c b/applications/external/mifare_nested/lib/nested/nested.c new file mode 100644 index 000000000..4d04b99d5 --- /dev/null +++ b/applications/external/mifare_nested/lib/nested/nested.c @@ -0,0 +1,740 @@ +#include "nested.h" + +#include +#include "../../lib/parity/parity.h" +#include "../../lib/crypto1/crypto1.h" +#define TAG "Nested" + +void nfc_util_num2bytes(uint64_t src, uint8_t len, uint8_t* dest) { + furi_assert(dest); + furi_assert(len <= 8); + + while(len--) { + dest[len] = (uint8_t)src; + src >>= 8; + } +} + +uint64_t nfc_util_bytes2num(const uint8_t* src, uint8_t len) { + furi_assert(src); + furi_assert(len <= 8); + + uint64_t res = 0; + while(len--) { + res = (res << 8) | (*src); + src++; + } + return res; +} + +uint16_t nfca_get_crc16(uint8_t* buff, uint16_t len) { + uint16_t crc = 0x6363; // NFCA_CRC_INIT + uint8_t byte = 0; + + for(uint8_t i = 0; i < len; i++) { + byte = buff[i]; + byte ^= (uint8_t)(crc & 0xff); + byte ^= byte << 4; + crc = (crc >> 8) ^ (((uint16_t)byte) << 8) ^ (((uint16_t)byte) << 3) ^ + (((uint16_t)byte) >> 4); + } + + return crc; +} + +void nfca_append_crc16(uint8_t* buff, uint16_t len) { + uint16_t crc = nfca_get_crc16(buff, len); + buff[len] = (uint8_t)crc; + buff[len + 1] = (uint8_t)(crc >> 8); +} + +bool mifare_sendcmd_short( + Crypto1* crypto, + FuriHalNfcTxRxContext* tx_rx, + bool crypted, + uint32_t cmd, + uint32_t data) { + uint16_t pos; + uint8_t dcmd[4] = {cmd, data, 0x00, 0x00}; + nfca_append_crc16(dcmd, 2); + + memset(tx_rx->tx_data, 0, sizeof(tx_rx->tx_data)); + memset(tx_rx->tx_parity, 0, sizeof(tx_rx->tx_parity)); + + if(crypted) { + for(pos = 0; pos < 4; pos++) { + uint8_t res = crypto1_byte(crypto, 0x00, 0) ^ dcmd[pos]; + tx_rx->tx_data[pos] = res; + tx_rx->tx_parity[0] |= + (((crypto1_filter(crypto->odd) ^ oddparity8(dcmd[pos])) & 0x01) << (7 - pos)); + } + + tx_rx->tx_rx_type = FuriHalNfcTxRxTypeRaw; + tx_rx->tx_bits = 4 * 8; + } else { + for(pos = 0; pos < 2; pos++) { + tx_rx->tx_data[pos] = dcmd[pos]; + } + + tx_rx->tx_rx_type = FuriHalNfcTxRxTypeRxNoCrc; + tx_rx->tx_bits = 2 * 8; + } + + if(!furi_hal_nfc_tx_rx(tx_rx, 6)) return false; + + return true; +} + +bool mifare_classic_authex( + Crypto1* crypto, + FuriHalNfcTxRxContext* tx_rx, + uint32_t uid, + uint32_t blockNo, + uint32_t keyType, + uint64_t ui64Key, + bool isNested, + uint32_t* ntptr) { + uint32_t nt, ntpp; // Supplied tag nonce + uint8_t nr[4]; + + // "random" reader nonce: + nfc_util_num2bytes(prng_successor(0, 32), 4, nr); // DWT->CYCCNT + + // Transmit MIFARE_CLASSIC_AUTH + if(!mifare_sendcmd_short(crypto, tx_rx, isNested, 0x60 + (keyType & 0x01), blockNo)) { + return false; + }; + + memset(tx_rx->tx_data, 0, sizeof(tx_rx->tx_data)); + memset(tx_rx->tx_parity, 0, sizeof(tx_rx->tx_parity)); + + nt = (uint32_t)nfc_util_bytes2num(tx_rx->rx_data, 4); + + if(isNested) crypto1_reset(crypto); // deinit + + crypto1_init(crypto, ui64Key); + + if(isNested) { + nt = crypto1_word(crypto, nt ^ uid, 1) ^ nt; + } else { + crypto1_word(crypto, nt ^ uid, 0); + } + + // save Nt + if(ntptr) *ntptr = nt; + + // Generate (encrypted) nr+parity by loading it into the cipher (Nr) + tx_rx->tx_parity[0] = 0; + for(uint8_t i = 0; i < 4; i++) { + tx_rx->tx_data[i] = crypto1_byte(crypto, nr[i], 0) ^ nr[i]; + tx_rx->tx_parity[0] |= + (((crypto1_filter(crypto->odd) ^ oddparity8(nr[i])) & 0x01) << (7 - i)); + } + + nt = prng_successor(nt, 32); + + for(uint8_t i = 4; i < 8; i++) { + nt = prng_successor(nt, 8); + tx_rx->tx_data[i] = crypto1_byte(crypto, 0x00, 0) ^ (nt & 0xff); + tx_rx->tx_parity[0] |= + (((crypto1_filter(crypto->odd) ^ oddparity8(nt & 0xff)) & 0x01) << (7 - i)); + } + + tx_rx->tx_rx_type = FuriHalNfcTxRxTypeRaw; + tx_rx->tx_bits = 8 * 8; + + if(!furi_hal_nfc_tx_rx(tx_rx, 25)) { + return false; + }; + + uint32_t answer = (uint32_t)nfc_util_bytes2num(tx_rx->rx_data, 4); + + ntpp = prng_successor(nt, 32) ^ crypto1_word(crypto, 0, 0); + + if(answer != ntpp) { + return false; + } + + return true; +} + +static int valid_nonce(uint32_t Nt, uint32_t NtEnc, uint32_t Ks1, const uint8_t* parity) { + return ((oddparity8((Nt >> 24) & 0xFF) == + ((parity[0]) ^ oddparity8((NtEnc >> 24) & 0xFF) ^ FURI_BIT(Ks1, 16))) && + (oddparity8((Nt >> 16) & 0xFF) == + ((parity[1]) ^ oddparity8((NtEnc >> 16) & 0xFF) ^ FURI_BIT(Ks1, 8))) && + (oddparity8((Nt >> 8) & 0xFF) == + ((parity[2]) ^ oddparity8((NtEnc >> 8) & 0xFF) ^ FURI_BIT(Ks1, 0)))) ? + 1 : + 0; +} + +void nonce_distance(uint32_t* msb, uint32_t* lsb) { + uint16_t x = 1, pos; + uint8_t calc_ok = 0; + + for(uint16_t i = 1; i; ++i) { + pos = (x & 0xff) << 8 | x >> 8; + + if((pos == *msb) & !(calc_ok >> 0 & 0x01)) { + *msb = i; + calc_ok |= 0x01; + } + + if((pos == *lsb) & !(calc_ok >> 1 & 0x01)) { + *lsb = i; + calc_ok |= 0x02; + } + + if(calc_ok == 0x03) { + return; + } + + x = x >> 1 | (x ^ x >> 2 ^ x >> 3 ^ x >> 5) << 15; + } +} + +bool validate_prng_nonce(uint32_t nonce) { + uint32_t msb = nonce >> 16; + uint32_t lsb = nonce & 0xffff; + nonce_distance(&msb, &lsb); + return ((65535 - msb + lsb) % 65535) == 16; +} + +MifareNestedNonceType nested_check_nonce_type(FuriHalNfcTxRxContext* tx_rx, uint8_t blockNo) { + uint32_t nonces[5] = {}; + uint8_t sameNonces = 0; + uint8_t hardNonces = 0; + Crypto1 crypt; + Crypto1* crypto = {&crypt}; + + for(int32_t i = 0; i < 5; i++) { + // Setup nfc poller + nfc_activate(); + furi_hal_nfc_activate_nfca(100, NULL); + + // Start communication + bool success = mifare_sendcmd_short(crypto, tx_rx, false, 0x60, blockNo); + if(!success) { + continue; + }; + + uint32_t nt = (uint32_t)nfc_util_bytes2num(tx_rx->rx_data, 4); + if(nt == 0) continue; + if(!validate_prng_nonce(nt)) hardNonces++; + nonces[i] = nt; + + nfc_deactivate(); + } + + for(int32_t i = 0; i < 5; i++) { + for(int32_t j = 0; j < 5; j++) { + if(i != j && nonces[j] && nonces[i] == nonces[j]) { + sameNonces++; + } + } + } + + if(!nonces[4]) { + return MifareNestedNonceNoTag; + } + + if(sameNonces > 3) { + return MifareNestedNonceStatic; + } + + if(hardNonces > 3) { + return MifareNestedNonceHard; + } + + return MifareNestedNonceWeak; +} + +struct nonce_info_static nested_static_nonce_attack( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint8_t targetBlockNo, + uint8_t targetKeyType, + uint64_t ui64Key) { + uint32_t cuid = 0; + Crypto1* crypto = malloc(sizeof(Crypto1)); + struct nonce_info_static r; + + r.full = false; + + // Setup nfc poller + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) { + free(crypto); + return r; + } + + r.cuid = cuid; + + uint32_t nt1; + uint32_t nt_unused; + + crypto1_reset(crypto); + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1); + + if(targetKeyType == 1 && nt1 == 0x009080A2) { + r.target_nt[0] = prng_successor(nt1, 161); + r.target_nt[1] = prng_successor(nt1, 321); + } else { + r.target_nt[0] = prng_successor(nt1, 160); + r.target_nt[1] = prng_successor(nt1, 320); + } + + bool success = + mifare_sendcmd_short(crypto, tx_rx, true, 0x60 + (targetKeyType & 0x01), targetBlockNo); + + if(!success) { + free(crypto); + return r; + }; + + uint32_t nt2 = nfc_util_bytes2num(tx_rx->rx_data, 4); + r.target_ks[0] = nt2 ^ r.target_nt[0]; + + nfc_activate(); + + if(!furi_hal_nfc_activate_nfca(200, &cuid)) { + free(crypto); + return r; + } + + crypto1_reset(crypto); + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1); + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, true, &nt_unused); + + success = + mifare_sendcmd_short(crypto, tx_rx, true, 0x60 + (targetKeyType & 0x01), targetBlockNo); + + free(crypto); + + if(!success) { + return r; + }; + + uint32_t nt3 = (uint32_t)nfc_util_bytes2num(tx_rx->rx_data, 4); + + r.target_ks[1] = nt3 ^ r.target_nt[1]; + r.full = true; + + nfc_deactivate(); + + return r; +} + +uint32_t nested_calibrate_distance( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key, + uint32_t delay, + bool full) { + uint32_t cuid = 0; + Crypto1* crypto = malloc(sizeof(Crypto1)); + uint32_t nt1, nt2, i = 0, davg = 0, dmin = 0, dmax = 0, rtr = 0, unsuccessful_tries = 0; + uint32_t max_prng_value = full ? 65565 : 1200; + uint32_t rounds = full ? 5 : 17; // full does not require precision + uint32_t collected = 0; + + for(rtr = 0; rtr < rounds; rtr++) { + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) break; + + if(!mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1)) { + continue; + } + + furi_delay_us(delay); + + if(!mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, true, &nt2)) { + continue; + } + + // NXP Mifare is typical around 840, but for some unlicensed/compatible mifare tag this can be 160 + uint32_t nttmp = prng_successor(nt1, 100); + + for(i = 101; i < max_prng_value; i++) { + nttmp = prng_successor(nttmp, 1); + if(nttmp == nt2) break; + } + + if(i != max_prng_value) { + if(rtr != 0) { + davg += i; + dmin = MIN(dmin, i); + dmax = MAX(dmax, i); + } else { + dmin = dmax = i; + } + + FURI_LOG_D(TAG, "Calibrating: ntdist=%lu", i); + collected++; + } else { + unsuccessful_tries++; + if(unsuccessful_tries > 12) { + free(crypto); + FURI_LOG_E( + TAG, + "Tag isn't vulnerable to nested attack (random numbers are not predictable)"); + return 0; + } + } + } + + if(collected > 1) davg = (davg + (collected - 1) / 2) / (collected - 1); + + davg = MIN(MAX(dmin, davg), dmax); + + FURI_LOG_I( + TAG, + "Calibration completed: rtr=%lu min=%lu max=%lu avg=%lu collected=%lu", + rtr, + dmin, + dmax, + davg, + collected); + + free(crypto); + + nfc_deactivate(); + + return davg; +} + +struct distance_info nested_calibrate_distance_info( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key) { + uint32_t cuid = 0; + Crypto1* crypto = malloc(sizeof(Crypto1)); + uint32_t nt1, nt2, i = 0, davg = 0, dmin = 0, dmax = 0, rtr = 0, unsuccessful_tries = 0; + struct distance_info r; + r.min_prng = 0; + r.max_prng = 0; + r.mid_prng = 0; + + for(rtr = 0; rtr < 10; rtr++) { + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) break; + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1); + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, true, &nt2); + + // NXP Mifare is typical around 840, but for some unlicensed/compatible mifare tag this can be 160 + uint32_t nttmp = prng_successor(nt1, 1); + + for(i = 2; i < 65565; i++) { + nttmp = prng_successor(nttmp, 1); + if(nttmp == nt2) break; + } + + if(i != 65565) { + if(rtr != 0) { + davg += i; + if(dmin == 0) { + dmin = i; + } else { + dmin = MIN(dmin, i); + } + dmax = MAX(dmax, i); + } + + FURI_LOG_D(TAG, "Calibrating: ntdist=%lu", i); + } else { + unsuccessful_tries++; + if(unsuccessful_tries > 12) { + free(crypto); + + FURI_LOG_E( + TAG, + "Tag isn't vulnerable to nested attack (random numbers are not predictable)"); + + return r; + } + } + } + + if(rtr > 1) davg = (davg + (rtr - 1) / 2) / (rtr - 1); + + FURI_LOG_I( + TAG, "Calibration completed: rtr=%lu min=%lu max=%lu avg=%lu", rtr, dmin, dmax, davg); + + r.min_prng = dmin; + r.max_prng = dmax; + r.mid_prng = davg; + + free(crypto); + + nfc_deactivate(); + + return r; +} + +struct nonce_info nested_attack( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint8_t targetBlockNo, + uint8_t targetKeyType, + uint64_t ui64Key, + uint32_t distance, + uint32_t delay) { + uint32_t cuid = 0; + Crypto1* crypto = malloc(sizeof(Crypto1)); + uint8_t par_array[4] = {0x00}; + uint32_t nt1, nt2, ks1, i = 0, j = 0; + struct nonce_info r; + uint32_t dmin = distance - 2; + uint32_t dmax = distance + 2; + + r.full = false; + + for(i = 0; i < 2; i++) { // look for exactly two different nonces + r.target_nt[i] = 0; + + while(r.target_nt[i] == 0) { // continue until we have an unambiguous nonce + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) { + free(crypto); + return r; + } + + r.cuid = cuid; + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1); + + furi_delay_us(delay); + + bool success = mifare_sendcmd_short( + crypto, tx_rx, true, 0x60 + (targetKeyType & 0x01), targetBlockNo); + + if(!success) continue; + + nt2 = nfc_util_bytes2num(tx_rx->rx_data, 4); + + // Parity validity check + for(j = 0; j < 4; j++) { + par_array[j] = + (oddparity8(tx_rx->rx_data[j]) != ((tx_rx->rx_parity[0] >> (7 - j)) & 0x01)); + } + + uint32_t ncount = 0; + uint32_t nttest = prng_successor(nt1, dmin - 1); + + for(j = dmin; j < dmax + 1; j++) { + nttest = prng_successor(nttest, 1); + ks1 = nt2 ^ nttest; + + if(valid_nonce(nttest, nt2, ks1, par_array)) { + if(ncount > 0) { // we are only interested in disambiguous nonces, try again + FURI_LOG_D(TAG, "Nonce#%lu: dismissed (ambiguous), ntdist=%lu", i + 1, j); + r.target_nt[i] = 0; + break; + } + + if(delay) { + // will predict later + r.target_nt[i] = nt1; + r.target_ks[i] = nt2; + } else { + r.target_nt[i] = nttest; + r.target_ks[i] = ks1; + } + + memcpy(&r.parity[i], par_array, 4); + ncount++; + + if(i == 1 && + (r.target_nt[0] == r.target_nt[1] || + r.target_ks[0] == r.target_ks[1])) { // we need two different nonces + r.target_nt[i] = 0; + FURI_LOG_D(TAG, "Nonce#2: dismissed (= nonce#1), ntdist=%lu", j); + break; + } + + FURI_LOG_D(TAG, "Nonce#%lu: valid, ntdist=%lu", i + 1, j); + } + } + + if(r.target_nt[i] == 0 && j == dmax + 1) { + FURI_LOG_D(TAG, "Nonce#%lu: dismissed (all invalid)", i + 1); + } + } + } + + if(r.target_nt[0] && r.target_nt[1]) { + r.full = true; + } + + free(crypto); + + nfc_deactivate(); + + return r; +} + +struct nonce_info_hard nested_hard_nonce_attack( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint8_t targetBlockNo, + uint8_t targetKeyType, + uint64_t ui64Key, + uint32_t* found, + uint32_t* first_byte_sum, + Stream* file_stream) { + uint32_t cuid = 0; + uint8_t same = 0; + uint64_t previous = 0; + Crypto1* crypto = malloc(sizeof(Crypto1)); + uint8_t par_array[4] = {0x00}; + struct nonce_info_hard r; + r.full = false; + r.static_encrypted = false; + + for(uint32_t i = 0; i < 8; i++) { + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) { + free(crypto); + return r; + } + + r.cuid = cuid; + + if(!mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, NULL)) + continue; + + if(!mifare_sendcmd_short(crypto, tx_rx, true, 0x60 + (targetKeyType & 0x01), targetBlockNo)) + continue; + + uint64_t nt = nfc_util_bytes2num(tx_rx->rx_data, 4); + + for(uint32_t j = 0; j < 4; j++) { + par_array[j] = + (oddparity8(tx_rx->rx_data[j]) != ((tx_rx->rx_parity[0] >> (7 - j)) & 0x01)); + } + + uint8_t pbits = 0; + for(uint8_t j = 0; j < 4; j++) { + uint8_t p = oddparity8(tx_rx->rx_data[j]); + if(par_array[j]) { + p ^= 1; + } + pbits <<= 1; + pbits |= p; + } + + // update unique nonces + if(!found[tx_rx->rx_data[0]]) { + *first_byte_sum += evenparity32(pbits & 0x08); + found[tx_rx->rx_data[0]]++; + } + + if(nt == previous) { + same++; + } + + previous = nt; + + FuriString* row = furi_string_alloc_printf("%llu|%u\n", nt, pbits); + stream_write_string(file_stream, row); + + FURI_LOG_D(TAG, "Accured %lu/8 nonces", i + 1); + furi_string_free(row); + } + + if(same > 4) { + r.static_encrypted = true; + } + + r.full = true; + + free(crypto); + + nfc_deactivate(); + + return r; +} + +NestedCheckKeyResult nested_check_key( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key) { + uint32_t cuid = 0; + uint32_t nt; + + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) return NestedCheckKeyNoTag; + + FURI_LOG_D( + TAG, "Checking %c key %012llX for block %u", !keyType ? 'A' : 'B', ui64Key, blockNo); + + Crypto1* crypto = malloc(sizeof(Crypto1)); + + bool success = + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt); + + free(crypto); + + nfc_deactivate(); + + return success ? NestedCheckKeyValid : NestedCheckKeyInvalid; +} + +bool nested_check_block(FuriHalNfcTxRxContext* tx_rx, uint8_t blockNo, uint8_t keyType) { + uint32_t cuid = 0; + + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) return false; + + Crypto1* crypto = malloc(sizeof(Crypto1)); + + bool success = mifare_sendcmd_short(crypto, tx_rx, false, 0x60 + (keyType & 0x01), blockNo); + + free(crypto); + + nfc_deactivate(); + + return success; +} + +void nested_get_data(FuriHalNfcDevData* dev_data) { + nfc_activate(); + furi_hal_nfc_detect(dev_data, 400); + nfc_deactivate(); +} + +void nfc_activate() { + nfc_deactivate(); + + // Setup nfc poller + furi_hal_nfc_exit_sleep(); + furi_hal_nfc_ll_txrx_on(); + furi_hal_nfc_ll_poll(); + if(furi_hal_nfc_ll_set_mode( + FuriHalNfcModePollNfca, FuriHalNfcBitrate106, FuriHalNfcBitrate106) != + FuriHalNfcReturnOk) + return; + + furi_hal_nfc_ll_set_fdt_listen(FURI_HAL_NFC_LL_FDT_LISTEN_NFCA_POLLER); + furi_hal_nfc_ll_set_fdt_poll(FURI_HAL_NFC_LL_FDT_POLL_NFCA_POLLER); + furi_hal_nfc_ll_set_error_handling(FuriHalNfcErrorHandlingNfc); + furi_hal_nfc_ll_set_guard_time(FURI_HAL_NFC_LL_GT_NFCA); +} + +void nfc_deactivate() { + furi_hal_nfc_ll_txrx_off(); + furi_hal_nfc_start_sleep(); + furi_hal_nfc_sleep(); +} diff --git a/applications/external/mifare_nested/lib/nested/nested.h b/applications/external/mifare_nested/lib/nested/nested.h new file mode 100644 index 000000000..a2b902446 --- /dev/null +++ b/applications/external/mifare_nested/lib/nested/nested.h @@ -0,0 +1,118 @@ +#pragma once + +#include +#include +#include + +#include +#include +#include + +typedef enum { + MifareNestedNonceNoTag, + MifareNestedNonceWeak, + MifareNestedNonceStatic, + MifareNestedNonceHard, +} MifareNestedNonceType; + +MifareNestedNonceType nested_check_nonce_type(FuriHalNfcTxRxContext* tx_rx, uint8_t blockNo); + +struct nonce_info_static { + uint32_t cuid; + uint32_t target_nt[2]; + uint32_t target_ks[2]; + bool full; +}; + +struct nonce_info_hard { + uint32_t cuid; + bool static_encrypted; + bool full; +}; + +struct nonce_info { + uint32_t cuid; + uint32_t target_nt[2]; + uint32_t target_ks[2]; + uint8_t parity[2][4]; + bool full; +}; + +struct distance_info { + uint32_t min_prng; + uint32_t max_prng; + uint32_t mid_prng; +}; + +struct nonce_info_static nested_static_nonce_attack( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint8_t targetBlockNo, + uint8_t targetKeyType, + uint64_t ui64Key); + +struct nonce_info nested_attack( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint8_t targetBlockNo, + uint8_t targetKeyType, + uint64_t ui64Key, + uint32_t distance, + uint32_t delay); + +struct nonce_info_hard nested_hard_nonce_attack( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint8_t targetBlockNo, + uint8_t targetKeyType, + uint64_t ui64Key, + uint32_t* found, + uint32_t* first_byte_sum, + Stream* file_stream); + +uint32_t nested_calibrate_distance( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key, + uint32_t delay, + bool full); + +struct distance_info nested_calibrate_distance_info( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key); + +typedef enum { + NestedCheckKeyNoTag, + NestedCheckKeyValid, + NestedCheckKeyInvalid, +} NestedCheckKeyResult; + +NestedCheckKeyResult nested_check_key( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key); + +bool nested_check_block(FuriHalNfcTxRxContext* tx_rx, uint8_t blockNo, uint8_t keyType); + +void nested_get_data(); + +bool mifare_classic_authex( + Crypto1* crypto, + FuriHalNfcTxRxContext* tx_rx, + uint32_t uid, + uint32_t blockNo, + uint32_t keyType, + uint64_t ui64Key, + bool isNested, + uint32_t* ntptr); + +void nfc_activate(); + +void nfc_deactivate(); diff --git a/applications/external/mifare_nested/lib/parity/parity.c b/applications/external/mifare_nested/lib/parity/parity.c new file mode 100644 index 000000000..c8e2f807e --- /dev/null +++ b/applications/external/mifare_nested/lib/parity/parity.c @@ -0,0 +1,71 @@ +#include "parity.h" + +uint32_t __paritysi2(uint32_t a) { + uint32_t x = (uint32_t)a; + x ^= x >> 16; + x ^= x >> 8; + x ^= x >> 4; + return (0x6996 >> (x & 0xF)) & 1; +} + +static const uint8_t g_odd_byte_parity[256] = { + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, + 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, + 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, + 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, + 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, + 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, + 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1}; + +#define ODD_PARITY8(x) \ + { g_odd_byte_parity[x] } +#define EVEN_PARITY8(x) \ + { !g_odd_byte_parity[x] } + +uint8_t oddparity8(const uint8_t x) { + return g_odd_byte_parity[x]; +} + +uint8_t evenparity8(const uint8_t x) { + return !g_odd_byte_parity[x]; +} + +uint8_t evenparity16(uint16_t x) { +#if !defined __GNUC__ + x ^= x >> 8; + return EVEN_PARITY8(x); +#else + return (__builtin_parity(x) & 0xFF); +#endif +} + +uint8_t oddparity16(uint16_t x) { +#if !defined __GNUC__ + x ^= x >> 8; + return ODD_PARITY8(x); +#else + return !__builtin_parity(x); +#endif +} + +uint8_t evenparity32(uint32_t x) { +#if !defined __GNUC__ + x ^= x >> 16; + x ^= x >> 8; + return EVEN_PARITY8(x); +#else + return (__builtin_parity(x) & 0xFF); +#endif +} + +uint8_t oddparity32(uint32_t x) { +#if !defined __GNUC__ + x ^= x >> 16; + x ^= x >> 8; + return ODD_PARITY8(x); +#else + return !__builtin_parity(x); +#endif +} \ No newline at end of file diff --git a/applications/external/mifare_nested/lib/parity/parity.h b/applications/external/mifare_nested/lib/parity/parity.h new file mode 100644 index 000000000..16648afa1 --- /dev/null +++ b/applications/external/mifare_nested/lib/parity/parity.h @@ -0,0 +1,10 @@ +#include "stdint.h" + +uint8_t oddparity8(const uint8_t x); +uint8_t evenparity8(const uint8_t x); + +uint8_t evenparity16(uint16_t x); +uint8_t oddparity16(uint16_t x); + +uint8_t evenparity32(uint32_t x); +uint8_t oddparity32(uint32_t x); \ No newline at end of file diff --git a/applications/external/mifare_nested/mifare_nested.c b/applications/external/mifare_nested/mifare_nested.c new file mode 100644 index 000000000..237eaef9a --- /dev/null +++ b/applications/external/mifare_nested/mifare_nested.c @@ -0,0 +1,408 @@ +#include "mifare_nested_i.h" +#include + +bool mifare_nested_custom_event_callback(void* context, uint32_t event) { + furi_assert(context); + MifareNested* mifare_nested = context; + return scene_manager_handle_custom_event(mifare_nested->scene_manager, event); +} + +bool mifare_nested_back_event_callback(void* context) { + furi_assert(context); + MifareNested* mifare_nested = context; + return scene_manager_handle_back_event(mifare_nested->scene_manager); +} + +void mifare_nested_tick_event_callback(void* context) { + furi_assert(context); + MifareNested* mifare_nested = context; + scene_manager_handle_tick_event(mifare_nested->scene_manager); +} + +void mifare_nested_show_loading_popup(void* context, bool show) { + MifareNested* mifare_nested = context; + TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME); + + if(show) { + // Raise timer priority so that animations can play + vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1); + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewLoading); + } else { + // Restore default timer priority + vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY); + } +} + +NestedState* collection_alloc() { + NestedState* nested = malloc(sizeof(NestedState)); + nested->view = view_alloc(); + view_allocate_model(nested->view, ViewModelTypeLocking, sizeof(NestedAttackViewModel)); + with_view_model( + nested->view, + NestedAttackViewModel * model, + { + model->header = furi_string_alloc(); + furi_string_set(model->header, "Collecting nonces"); + model->keys_count = 0; + model->hardnested_states = 0; + model->lost_tag = false; + model->calibrating = false; + model->need_prediction = false; + model->hardnested = false; + }, + false); + + return nested; +} + +CheckKeysState* check_keys_alloc() { + CheckKeysState* state = malloc(sizeof(CheckKeysState)); + state->view = view_alloc(); + view_allocate_model(state->view, ViewModelTypeLocking, sizeof(CheckKeysViewModel)); + with_view_model( + state->view, + CheckKeysViewModel * model, + { + model->header = furi_string_alloc(); + furi_string_set(model->header, "Checking keys"); + model->lost_tag = false; + }, + false); + + return state; +} + +static void nested_draw_callback(Canvas* canvas, void* model) { + NestedAttackViewModel* m = model; + + if(m->lost_tag) { + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 64, 4, AlignCenter, AlignTop, "Lost the tag!"); + canvas_set_font(canvas, FontSecondary); + elements_multiline_text_aligned( + canvas, 64, 23, AlignCenter, AlignTop, "Make sure the tag is\npositioned correctly."); + } else if(m->calibrating) { + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 64, 4, AlignCenter, AlignTop, "Calibrating..."); + canvas_set_font(canvas, FontSecondary); + if(!m->need_prediction) { + elements_multiline_text_aligned( + canvas, 64, 23, AlignCenter, AlignTop, "Don't touch or move\nFlipper/Tag!"); + } else { + elements_multiline_text_aligned( + canvas, 64, 18, AlignCenter, AlignTop, "Don't touch or move tag!"); + canvas_set_font(canvas, FontPrimary); + elements_multiline_text_aligned( + canvas, 64, 30, AlignCenter, AlignTop, "Calibration will take\nmore time"); + } + } else if(m->hardnested) { + char draw_str[32] = {}; + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned( + canvas, 64, 2, AlignCenter, AlignTop, furi_string_get_cstr(m->header)); + canvas_set_font(canvas, FontSecondary); + + float progress = + m->keys_count == 0 ? 0 : (float)(m->nonces_collected) / (float)(m->keys_count); + + if(progress > 1.0) { + progress = 1.0; + } + + elements_progress_bar(canvas, 5, 15, 120, progress); + canvas_set_font(canvas, FontSecondary); + snprintf( + draw_str, + sizeof(draw_str), + "Nonces collected: %lu/%lu", + m->nonces_collected, + m->keys_count); + canvas_draw_str_aligned(canvas, 1, 28, AlignLeft, AlignTop, draw_str); + snprintf(draw_str, sizeof(draw_str), "States found: %lu/256", m->hardnested_states); + canvas_draw_str_aligned(canvas, 1, 40, AlignLeft, AlignTop, draw_str); + } else { + char draw_str[32] = {}; + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned( + canvas, 64, 2, AlignCenter, AlignTop, furi_string_get_cstr(m->header)); + canvas_set_font(canvas, FontSecondary); + + float progress = + m->keys_count == 0 ? 0 : (float)(m->nonces_collected) / (float)(m->keys_count); + + if(progress > 1.0) { + progress = 1.0; + } + + elements_progress_bar(canvas, 5, 15, 120, progress); + canvas_set_font(canvas, FontSecondary); + snprintf( + draw_str, + sizeof(draw_str), + "Nonces collected: %lu/%lu", + m->nonces_collected, + m->keys_count); + canvas_draw_str_aligned(canvas, 1, 28, AlignLeft, AlignTop, draw_str); + } + + elements_button_center(canvas, "Stop"); +} + +static void check_keys_draw_callback(Canvas* canvas, void* model) { + CheckKeysViewModel* m = model; + + if(m->lost_tag) { + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 64, 4, AlignCenter, AlignTop, "Lost the tag!"); + canvas_set_font(canvas, FontSecondary); + elements_multiline_text_aligned( + canvas, 64, 23, AlignCenter, AlignTop, "Make sure the tag is\npositioned correctly."); + } else if(m->processing_keys) { + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 64, 4, AlignCenter, AlignTop, "Processing keys..."); + canvas_set_font(canvas, FontSecondary); + elements_multiline_text_aligned( + canvas, 64, 23, AlignCenter, AlignTop, "Checking which keys you\nalready have..."); + } else { + char draw_str[32] = {}; + char draw_sub_str[32] = {}; + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned( + canvas, 64, 2, AlignCenter, AlignTop, furi_string_get_cstr(m->header)); + canvas_set_font(canvas, FontSecondary); + + float progress = m->keys_count == 0 ? 0 : + (float)(m->keys_checked) / (float)(m->keys_count); + + if(progress > 1.0) { + progress = 1.0; + } + + elements_progress_bar(canvas, 5, 15, 120, progress); + canvas_set_font(canvas, FontSecondary); + snprintf( + draw_str, sizeof(draw_str), "Keys checked: %lu/%lu", m->keys_checked, m->keys_count); + canvas_draw_str_aligned(canvas, 1, 28, AlignLeft, AlignTop, draw_str); + snprintf( + draw_sub_str, + sizeof(draw_sub_str), + "Keys found: %lu/%lu", + m->keys_found, + m->keys_total); + canvas_draw_str_aligned(canvas, 1, 40, AlignLeft, AlignTop, draw_sub_str); + } + + elements_button_center(canvas, "Stop"); +} + +static bool nested_input_callback(InputEvent* event, void* context) { + MifareNested* mifare_nested = context; + + bool consumed = false; + + if(event->type == InputTypeShort && (event->key == InputKeyBack || event->key == InputKeyOk)) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +MifareNested* mifare_nested_alloc() { + MifareNested* mifare_nested = malloc(sizeof(MifareNested)); + + mifare_nested->worker = mifare_nested_worker_alloc(); + mifare_nested->view_dispatcher = view_dispatcher_alloc(); + mifare_nested->scene_manager = + scene_manager_alloc(&mifare_nested_scene_handlers, mifare_nested); + view_dispatcher_enable_queue(mifare_nested->view_dispatcher); + view_dispatcher_set_event_callback_context(mifare_nested->view_dispatcher, mifare_nested); + view_dispatcher_set_custom_event_callback( + mifare_nested->view_dispatcher, mifare_nested_custom_event_callback); + view_dispatcher_set_navigation_event_callback( + mifare_nested->view_dispatcher, mifare_nested_back_event_callback); + view_dispatcher_set_tick_event_callback( + mifare_nested->view_dispatcher, mifare_nested_tick_event_callback, 100); + + // Nfc device + mifare_nested->nfc_dev = nfc_device_alloc(); + + // Open GUI record + mifare_nested->gui = furi_record_open(RECORD_GUI); + view_dispatcher_attach_to_gui( + mifare_nested->view_dispatcher, mifare_nested->gui, ViewDispatcherTypeFullscreen); + + // Open Notification record + mifare_nested->notifications = furi_record_open(RECORD_NOTIFICATION); + + // Submenu + mifare_nested->submenu = submenu_alloc(); + view_dispatcher_add_view( + mifare_nested->view_dispatcher, + MifareNestedViewMenu, + submenu_get_view(mifare_nested->submenu)); + + // Popup + mifare_nested->popup = popup_alloc(); + view_dispatcher_add_view( + mifare_nested->view_dispatcher, + MifareNestedViewPopup, + popup_get_view(mifare_nested->popup)); + + // Loading + mifare_nested->loading = loading_alloc(); + view_dispatcher_add_view( + mifare_nested->view_dispatcher, + MifareNestedViewLoading, + loading_get_view(mifare_nested->loading)); + + // Text Input + mifare_nested->text_input = text_input_alloc(); + view_dispatcher_add_view( + mifare_nested->view_dispatcher, + MifareNestedViewTextInput, + text_input_get_view(mifare_nested->text_input)); + + // Custom Widget + mifare_nested->widget = widget_alloc(); + view_dispatcher_add_view( + mifare_nested->view_dispatcher, + MifareNestedViewWidget, + widget_get_view(mifare_nested->widget)); + + // Variable Item List + mifare_nested->variable_item_list = variable_item_list_alloc(); + view_dispatcher_add_view( + mifare_nested->view_dispatcher, + MifareNestedViewVariableList, + variable_item_list_get_view(mifare_nested->variable_item_list)); + + // Nested attack state + NestedState* plugin_state = collection_alloc(); + view_set_context(plugin_state->view, mifare_nested); + mifare_nested->nested_state = plugin_state; + view_dispatcher_add_view( + mifare_nested->view_dispatcher, MifareNestedViewCollecting, plugin_state->view); + + // Check keys attack state + CheckKeysState* keys_state = check_keys_alloc(); + view_set_context(keys_state->view, mifare_nested); + mifare_nested->keys_state = keys_state; + view_dispatcher_add_view( + mifare_nested->view_dispatcher, MifareNestedViewCheckKeys, keys_state->view); + + KeyInfo_t* key_info = malloc(sizeof(KeyInfo_t)); + mifare_nested->keys = key_info; + + MifareNestedSettings* settings = malloc(sizeof(MifareNestedSettings)); + settings->only_hardnested = false; + mifare_nested->settings = settings; + + view_set_draw_callback(plugin_state->view, nested_draw_callback); + view_set_input_callback(plugin_state->view, nested_input_callback); + + view_set_draw_callback(keys_state->view, check_keys_draw_callback); + view_set_input_callback(keys_state->view, nested_input_callback); + + mifare_nested->collecting_type = MifareNestedWorkerStateReady; + mifare_nested->run = NestedRunIdle; + + return mifare_nested; +} + +void mifare_nested_free(MifareNested* mifare_nested) { + furi_assert(mifare_nested); + + // Nfc device + nfc_device_free(mifare_nested->nfc_dev); + + // Submenu + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewMenu); + submenu_free(mifare_nested->submenu); + + // Popup + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewPopup); + popup_free(mifare_nested->popup); + + // Loading + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewLoading); + loading_free(mifare_nested->loading); + + // TextInput + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewTextInput); + text_input_free(mifare_nested->text_input); + + // Custom Widget + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); + widget_free(mifare_nested->widget); + + // Variable Item List + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewVariableList); + variable_item_list_free(mifare_nested->variable_item_list); + + // Nested + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewCollecting); + + // Check keys + view_dispatcher_remove_view(mifare_nested->view_dispatcher, MifareNestedViewCheckKeys); + + // Nonces states + free(mifare_nested->nonces); + free(mifare_nested->nested_state); + + // Keys + free(mifare_nested->keys); + + // Settings + free(mifare_nested->settings); + + // Worker + mifare_nested_worker_stop(mifare_nested->worker); + mifare_nested_worker_free(mifare_nested->worker); + + // View Dispatcher + view_dispatcher_free(mifare_nested->view_dispatcher); + + // Scene Manager + scene_manager_free(mifare_nested->scene_manager); + + // GUI + furi_record_close(RECORD_GUI); + mifare_nested->gui = NULL; + + // Notifications + furi_record_close(RECORD_NOTIFICATION); + mifare_nested->notifications = NULL; + + free(mifare_nested); +} + +void mifare_nested_blink_start(MifareNested* mifare_nested) { + notification_message(mifare_nested->notifications, &mifare_nested_sequence_blink_start_blue); +} + +void mifare_nested_blink_calibration_start(MifareNested* mifare_nested) { + notification_message( + mifare_nested->notifications, &mifare_nested_sequence_blink_start_magenta); +} + +void mifare_nested_blink_nonce_collection_start(MifareNested* mifare_nested) { + notification_message(mifare_nested->notifications, &mifare_nested_sequence_blink_start_yellow); +} + +void mifare_nested_blink_stop(MifareNested* mifare_nested) { + notification_message(mifare_nested->notifications, &mifare_nested_sequence_blink_stop); +} + +int32_t mifare_nested_app(void* p) { + UNUSED(p); + MifareNested* mifare_nested = mifare_nested_alloc(); + + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneStart); + + view_dispatcher_run(mifare_nested->view_dispatcher); + + mifare_nested_free(mifare_nested); + + return 0; +} diff --git a/applications/external/mifare_nested/mifare_nested.h b/applications/external/mifare_nested/mifare_nested.h new file mode 100644 index 000000000..a59a5b8ca --- /dev/null +++ b/applications/external/mifare_nested/mifare_nested.h @@ -0,0 +1,3 @@ +#pragma once + +typedef struct MifareNested MifareNested; diff --git a/applications/external/mifare_nested/mifare_nested_i.h b/applications/external/mifare_nested/mifare_nested_i.h new file mode 100644 index 000000000..59aab5825 --- /dev/null +++ b/applications/external/mifare_nested/mifare_nested_i.h @@ -0,0 +1,180 @@ +#pragma once +#include "mifare_nested.h" +#include "mifare_nested_worker.h" +#include "lib/nested/nested.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "scenes/mifare_nested_scene.h" +#include +#include +#include +#include +#include +#include "mifare_nested_icons.h" + +#define NESTED_VERSION_APP "1.4.6" +#define NESTED_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNested" +#define NESTED_RECOVER_KEYS_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNestedRecovery" +#define NESTED_NONCE_FORMAT_VERSION "3" +#define NESTED_AUTHOR "@AloneLiberty (t.me/libertydev)" + +enum MifareNestedCustomEvent { + // Reserve first 100 events for button types and indexes, starting from 0 + MifareNestedCustomEventReserved = 100, + + MifareNestedCustomEventViewExit, + MifareNestedCustomEventWorkerExit, + MifareNestedCustomEventByteInputDone, + MifareNestedCustomEventTextInputDone, + MifareNestedCustomEventSceneSettingLock +}; + +typedef void (*NestedCallback)(void* context); + +typedef struct { + FuriMutex* mutex; + FuriMessageQueue* event_queue; + ViewPort* view_port; + View* view; + NestedCallback callback; + void* context; +} NestedState; + +typedef void (*CheckKeysCallback)(void* context); + +typedef struct { + FuriMutex* mutex; + FuriMessageQueue* event_queue; + ViewPort* view_port; + View* view; + CheckKeysCallback callback; + void* context; +} CheckKeysState; + +typedef enum { + EventTypeTick, + EventTypeKey, +} EventType; + +typedef struct { + EventType type; + InputEvent input; +} PluginEvent; + +typedef struct { + bool only_hardnested; +} MifareNestedSettings; + +typedef enum { NestedRunIdle, NestedRunCheckKeys, NestedRunAttack } NestedRunNext; + +struct MifareNested { + MifareNestedWorker* worker; + ViewDispatcher* view_dispatcher; + Gui* gui; + NotificationApp* notifications; + SceneManager* scene_manager; + NfcDevice* nfc_dev; + VariableItemList* variable_item_list; + MifareNestedSettings* settings; + FuriString* text_box_store; + + // Common Views + Submenu* submenu; + Popup* popup; + Loading* loading; + TextInput* text_input; + Widget* widget; + + NonceList_t* nonces; + KeyInfo_t* keys; + + NestedState* nested_state; + CheckKeysState* keys_state; + + MifareNestedWorkerState collecting_type; + + NestedRunNext run; +}; + +typedef enum { + MifareNestedViewMenu, + MifareNestedViewPopup, + MifareNestedViewLoading, + MifareNestedViewTextInput, + MifareNestedViewWidget, + MifareNestedViewVariableList, + MifareNestedViewCollecting, + MifareNestedViewCheckKeys, +} MifareNestedView; + +typedef struct { + FuriString* header; + uint32_t keys_count; + uint32_t nonces_collected; + uint32_t hardnested_states; + bool lost_tag; + bool calibrating; + bool need_prediction; + bool hardnested; +} NestedAttackViewModel; + +typedef struct { + FuriString* header; + uint32_t keys_count; + uint32_t keys_checked; + uint32_t keys_found; + uint32_t keys_total; + bool lost_tag; + bool processing_keys; +} CheckKeysViewModel; + +static const NotificationSequence mifare_nested_sequence_blink_start_blue = { + &message_blink_start_10, + &message_blink_set_color_blue, + &message_do_not_reset, + NULL, +}; + +static const NotificationSequence mifare_nested_sequence_blink_start_magenta = { + &message_blink_start_10, + &message_blink_set_color_magenta, + &message_do_not_reset, + NULL, +}; + +static const NotificationSequence mifare_nested_sequence_blink_start_yellow = { + &message_blink_start_10, + &message_blink_set_color_yellow, + &message_do_not_reset, + NULL, +}; + +static const NotificationSequence mifare_nested_sequence_blink_stop = { + &message_blink_stop, + NULL, +}; + +MifareNested* mifare_nested_alloc(); + +void mifare_nested_text_store_set(MifareNested* mifare_nested, const char* text, ...); + +void mifare_nested_text_store_clear(MifareNested* mifare_nested); + +void mifare_nested_blink_start(MifareNested* mifare_nested); + +void mifare_nested_blink_calibration_start(MifareNested* mifare_nested); + +void mifare_nested_blink_nonce_collection_start(MifareNested* mifare_nested); + +void mifare_nested_blink_stop(MifareNested* mifare_nested); + +void mifare_nested_show_loading_popup(void* context, bool show); diff --git a/applications/external/mifare_nested/mifare_nested_worker.c b/applications/external/mifare_nested/mifare_nested_worker.c new file mode 100644 index 000000000..56d2f2427 --- /dev/null +++ b/applications/external/mifare_nested/mifare_nested_worker.c @@ -0,0 +1,1663 @@ +#include "mifare_nested_worker_i.h" + +#include "lib/nested/nested.h" +#include "lib/parity/parity.h" +#include + +#include +#include +#include +#include "string.h" +#include +#include + +#define TAG "MifareNestedWorker" + +// possible sum property values +static uint16_t sums[] = + {0, 32, 56, 64, 80, 96, 104, 112, 120, 128, 136, 144, 152, 160, 176, 192, 200, 224, 256}; + +void mifare_nested_worker_change_state( + MifareNestedWorker* mifare_nested_worker, + MifareNestedWorkerState state) { + furi_assert(mifare_nested_worker); + + mifare_nested_worker->state = state; +} + +MifareNestedWorker* mifare_nested_worker_alloc() { + MifareNestedWorker* mifare_nested_worker = malloc(sizeof(MifareNestedWorker)); + + // Worker thread attributes + mifare_nested_worker->thread = furi_thread_alloc_ex( + "MifareNestedWorker", 8192, mifare_nested_worker_task, mifare_nested_worker); + + mifare_nested_worker->callback = NULL; + mifare_nested_worker->context = NULL; + + mifare_nested_worker_change_state(mifare_nested_worker, MifareNestedWorkerStateReady); + + return mifare_nested_worker; +} + +void mifare_nested_worker_free(MifareNestedWorker* mifare_nested_worker) { + furi_assert(mifare_nested_worker); + + furi_thread_free(mifare_nested_worker->thread); + free(mifare_nested_worker); +} + +void mifare_nested_worker_stop(MifareNestedWorker* mifare_nested_worker) { + furi_assert(mifare_nested_worker); + + mifare_nested_worker_change_state(mifare_nested_worker, MifareNestedWorkerStateStop); + furi_thread_join(mifare_nested_worker->thread); +} + +void mifare_nested_worker_start( + MifareNestedWorker* mifare_nested_worker, + MifareNestedWorkerState state, + NfcDeviceData* dev_data, + MifareNestedWorkerCallback callback, + void* context) { + furi_assert(mifare_nested_worker); + furi_assert(dev_data); + + mifare_nested_worker->callback = callback; + mifare_nested_worker->context = context; + mifare_nested_worker->dev_data = dev_data; + mifare_nested_worker_change_state(mifare_nested_worker, state); + furi_thread_start(mifare_nested_worker->thread); +} + +int32_t mifare_nested_worker_task(void* context) { + MifareNestedWorker* mifare_nested_worker = context; + + if(mifare_nested_worker->state == MifareNestedWorkerStateCheck) { + mifare_nested_worker_check(mifare_nested_worker); + } else if(mifare_nested_worker->state == MifareNestedWorkerStateCollectingStatic) { + mifare_nested_worker_collect_nonces_static(mifare_nested_worker); + } else if(mifare_nested_worker->state == MifareNestedWorkerStateCollecting) { + mifare_nested_worker_collect_nonces(mifare_nested_worker); + } else if(mifare_nested_worker->state == MifareNestedWorkerStateCollectingHard) { + mifare_nested_worker_collect_nonces_hard(mifare_nested_worker); + } else if(mifare_nested_worker->state == MifareNestedWorkerStateValidating) { + mifare_nested_worker_check_keys(mifare_nested_worker); + } + + mifare_nested_worker_change_state(mifare_nested_worker, MifareNestedWorkerStateReady); + + return 0; +} + +void mifare_nested_worker_write_uid_string(FuriHalNfcDevData* data, FuriString* string) { + uint8_t* uid = data->uid; + uint8_t uid_len = data->uid_len; + + for(size_t i = 0; i < uid_len; i++) { + uint8_t uid_part = uid[i]; + furi_string_cat_printf(string, "%02X", uid_part); + } +} + +void mifare_nested_worker_get_key_cache_file_path(FuriHalNfcDevData* data, FuriString* file_path) { + furi_string_set(file_path, EXT_PATH("nfc/.cache") "/"); + + mifare_nested_worker_write_uid_string(data, file_path); + + furi_string_cat_printf(file_path, ".keys"); +} + +void mifare_nested_worker_get_nonces_file_path(FuriHalNfcDevData* data, FuriString* file_path) { + furi_string_set(file_path, NESTED_FOLDER "/"); + + mifare_nested_worker_write_uid_string(data, file_path); + + furi_string_cat_printf(file_path, ".nonces"); +} + +void mifare_nested_worker_get_found_keys_file_path(FuriHalNfcDevData* data, FuriString* file_path) { + furi_string_set(file_path, NESTED_FOLDER "/"); + + mifare_nested_worker_write_uid_string(data, file_path); + + furi_string_cat_printf(file_path, ".keys"); +} + +void mifare_nested_worker_get_hardnested_folder_path( + FuriHalNfcDevData* data, + FuriString* file_path) { + furi_string_set(file_path, NESTED_FOLDER "/"); + + mifare_nested_worker_write_uid_string(data, file_path); +} + +void mifare_nested_worker_get_hardnested_file_path( + FuriHalNfcDevData* data, + FuriString* file_path, + uint8_t sector, + uint8_t key_type) { + mifare_nested_worker_get_hardnested_folder_path(data, file_path); + + furi_string_cat_printf(file_path, "/%u_%u.nonces", sector, key_type); +} + +uint8_t mifare_nested_worker_get_block_by_sector(uint8_t sector) { + furi_assert(sector < 40); + if(sector < 32) { + return (sector * 4) + 3; + } else { + return 32 * 4 + (sector - 32) * 16 + 15; + } +} + +static MfClassicSectorTrailer* + mifare_nested_worker_get_sector_trailer_by_sector(MfClassicData* data, uint8_t sector) { + return (MfClassicSectorTrailer*)data->block[mifare_nested_worker_get_block_by_sector(sector)] + .value; +} + +bool mifare_nested_worker_read_key_cache(FuriHalNfcDevData* data, MfClassicData* mf_data) { + Storage* storage = furi_record_open(RECORD_STORAGE); + FuriString* temp_str = furi_string_alloc(); + mifare_nested_worker_get_key_cache_file_path(data, temp_str); + FlipperFormat* file = flipper_format_file_alloc(storage); + bool load_success = false; + uint32_t sector_count = 0; + + do { + if(storage_common_stat(storage, furi_string_get_cstr(temp_str), NULL) != FSE_OK) break; + + if(!flipper_format_file_open_existing(file, furi_string_get_cstr(temp_str))) break; + + uint32_t version = 0; + + if(!flipper_format_read_header(file, temp_str, &version)) break; + if(furi_string_cmp_str(temp_str, "Flipper NFC keys")) break; + + if(version != 1) break; + + if(!flipper_format_read_string(file, "Mifare Classic type", temp_str)) break; + + if(!furi_string_cmp(temp_str, "1K")) { + mf_data->type = MfClassicType1k; + sector_count = 16; + } else if(!furi_string_cmp(temp_str, "4K")) { + mf_data->type = MfClassicType4k; + sector_count = 40; + } else if(!furi_string_cmp(temp_str, "MINI")) { + mf_data->type = MfClassicTypeMini; + sector_count = 5; + } else { + break; + } + + if(!flipper_format_read_hex_uint64(file, "Key A map", &mf_data->key_a_mask, 1)) break; + if(!flipper_format_read_hex_uint64(file, "Key B map", &mf_data->key_b_mask, 1)) break; + + bool key_read_success = true; + + for(size_t i = 0; (i < sector_count) && (key_read_success); i++) { + MfClassicSectorTrailer* sec_tr = + mifare_nested_worker_get_sector_trailer_by_sector(mf_data, i); + + if(FURI_BIT(mf_data->key_a_mask, i)) { + furi_string_printf(temp_str, "Key A sector %d", i); + key_read_success = flipper_format_read_hex( + file, furi_string_get_cstr(temp_str), sec_tr->key_a, 6); + } + + if(!key_read_success) break; + + if(FURI_BIT(mf_data->key_b_mask, i)) { + furi_string_printf(temp_str, "Key B sector %d", i); + key_read_success = flipper_format_read_hex( + file, furi_string_get_cstr(temp_str), sec_tr->key_b, 6); + } + } + + load_success = key_read_success; + } while(false); + + furi_string_free(temp_str); + flipper_format_free(file); + + return load_success; +} + +bool hex_char_to_hex_nibble(char c, uint8_t* nibble) { + if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) { + if(c <= '9') { + *nibble = c - '0'; + } else if(c <= 'F') { + *nibble = c - 'A' + 10; + } else { + *nibble = c - 'a' + 10; + } + return true; + } else { + return false; + } +} + +bool hex_char_to_uint8(char hi, char low, uint8_t* value) { + uint8_t hi_nibble_value, low_nibble_value; + + if(hex_char_to_hex_nibble(hi, &hi_nibble_value) && + hex_char_to_hex_nibble(low, &low_nibble_value)) { + *value = (hi_nibble_value << 4) | low_nibble_value; + return true; + } else { + return false; + } +} + +void free_nonces(NonceList_t* nonces, uint8_t sector_count, uint8_t tries_count) { + for(uint8_t sector = 0; sector < sector_count; sector++) { + for(uint8_t key_type = 0; key_type < 2; key_type++) { + for(uint8_t tries = 0; tries < tries_count; tries++) { + free(nonces->nonces[sector][key_type][tries]); + } + } + } +} + +MfClassicType mifare_nested_worker_get_tag_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) { + UNUSED(ATQA1); + if((ATQA0 == 0x44 || ATQA0 == 0x04)) { + if((SAK == 0x08 || SAK == 0x88)) { + return MfClassicType1k; + } else if(SAK == 0x09) { + return MfClassicTypeMini; + } + } else if((ATQA0 == 0x01) && (ATQA1 == 0x0F) && (SAK == 0x01)) { + //skylanders support + return MfClassicType1k; + } else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) { + return MfClassicType4k; + } + return MfClassicType1k; +} + +uint32_t mifare_nested_worker_predict_delay( + FuriHalNfcTxRxContext* tx_rx, + uint8_t blockNo, + uint8_t keyType, + uint64_t ui64Key, + uint32_t tries, + MifareNestedWorker* mifare_nested_worker) { + uint32_t cuid = 0; + Crypto1* crypto = malloc(sizeof(Crypto1)); + uint32_t nt1, nt2, i = 0, previous = 0, prng_delay = 0, zero_prng_value = 65565, repeat = 0; + + if(tries > 25) { + free(crypto); + return 2; // Too many tries, fallback to hardnested + } + + // This part of attack is my attempt to implement it on Flipper. + // Proxmark can do this in 2 fucking steps, but idk how. + + // First, we find RPNG rounds per 1000 us + for(uint32_t rtr = 0; rtr < 25; rtr++) { + if(mifare_nested_worker->state != MifareNestedWorkerStateCollecting) { + free(crypto); + return 1; + } + + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) break; + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1); + + furi_delay_us(rtr * 1000); + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, true, &nt2); + + // Searching for delay, where PRNG will be near 800 + uint32_t nttmp = prng_successor(nt1, 100); + + for(i = 101; i < 65565; i++) { + nttmp = prng_successor(nttmp, 1); + if(nttmp == nt2) break; + } + + if(!rtr) { + zero_prng_value = i; + } + + if(previous && i > previous && i != 65565) { + if(!prng_delay) { + prng_delay = i - previous; + } else if(prng_delay - 100 > i - previous && prng_delay + 100 < i - previous) { + prng_delay += i - previous; + prng_delay /= 2; + } + } + + previous = i; + + FURI_LOG_D(TAG, "Calibrating: ntdist=%lu, delay=%lu", i, rtr * 1000); + + // Let's hope... + if(i > 810 && i < 840) { + free(crypto); + return rtr * 1000; + } + } + + FURI_LOG_D(TAG, "PRNG timing: growth ratio per 1000 us = %lu", prng_delay); + + // Next, we try to calculate time until PRNG near 800 with more perfect timing + // Mifare Classic (weak) RPNG repeats every 65565 PRNG cycles + + if(zero_prng_value == 65565) { + free(crypto); + // PRNG isn't pretictable + return 1; + } + + uint32_t cycles_to_reset = (65565 - zero_prng_value) / prng_delay; + + uint32_t limit = 7; + + for(uint32_t rtr = cycles_to_reset - 1; rtr < cycles_to_reset + limit; rtr++) { + for(uint32_t rtz = 0; rtz < 100; rtz++) { + if(mifare_nested_worker->state != MifareNestedWorkerStateCollecting) { + free(crypto); + return 1; + } + + nfc_activate(); + if(!furi_hal_nfc_activate_nfca(200, &cuid)) break; + + uint32_t delay = rtr * 1000 + rtz * 10; + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, false, &nt1); + + furi_delay_us(delay); + + mifare_classic_authex(crypto, tx_rx, cuid, blockNo, keyType, ui64Key, true, &nt2); + + // Searching for delay, where PRNG will be near 800 + uint32_t nttmp = prng_successor(nt1, 0); + + for(i = 1; i < 65565; i++) { + nttmp = prng_successor(nttmp, 1); + if(nttmp == nt2) break; + } + + if(!(i > previous - 50 && i < previous + 50) && rtz) { + repeat++; + + if(repeat < 5) { + FURI_LOG_D(TAG, "Invalid RPNG value: ntdist=%lu", i); + + continue; + } + } + + if(i > 2000 && i < 65500) { + uint32_t catch_cycles = (65565 - i) / prng_delay; + if(catch_cycles > 2) { + catch_cycles++; + + FURI_LOG_D( + TAG, + "Trying a more accurate value: skipping additional %lu us", + catch_cycles * 1000); + limit += catch_cycles + 2; + rtr += catch_cycles; + } + } + + FURI_LOG_D( + TAG, + "Calibrating: ntdist=%lu, delay=%lu, max=%lu", + i, + delay, + (cycles_to_reset + limit) * 1000); + + repeat = 0; + previous = i; + + if(i > 810 && i < 840) { + free(crypto); + FURI_LOG_I(TAG, "Found delay: %lu us", delay); + return delay; + } else if(i > 840 && i < 40000) { + FURI_LOG_D(TAG, "Trying again: timing lost"); + tries++; + free(crypto); + return mifare_nested_worker_predict_delay( + tx_rx, blockNo, keyType, ui64Key, tries, mifare_nested_worker); + } + } + } + + if(i > 1000 && i < 65000) { + FURI_LOG_D(TAG, "Trying again: wrong predicted timing"); + tries++; + free(crypto); + return mifare_nested_worker_predict_delay( + tx_rx, blockNo, keyType, ui64Key, tries, mifare_nested_worker); + } + + free(crypto); + + return 1; +} + +void mifare_nested_worker_write_nonces( + FuriHalNfcDevData* data, + Storage* storage, + NonceList_t* nonces, + uint8_t tries_count, + uint8_t free_tries_count, + uint8_t sector_count, + uint32_t delay, + uint32_t distance) { + FuriString* path = furi_string_alloc(); + Stream* file_stream = file_stream_alloc(storage); + mifare_nested_worker_get_nonces_file_path(data, path); + + file_stream_open(file_stream, furi_string_get_cstr(path), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS); + + FuriString* header = furi_string_alloc_printf( + "Filetype: Flipper Nested Nonce Manifest File\nVersion: %s\nNote: you will need desktop app to recover keys: %s\n", + NESTED_NONCE_FORMAT_VERSION, + NESTED_RECOVER_KEYS_GITHUB_LINK); + stream_write_string(file_stream, header); + + for(uint8_t tries = 0; tries < tries_count; tries++) { + for(uint8_t sector = 0; sector < sector_count; sector++) { + for(uint8_t key_type = 0; key_type < 2; key_type++) { + if(nonces->nonces[sector][key_type][tries]->collected && + !nonces->nonces[sector][key_type][tries]->skipped) { + if(nonces->nonces[sector][key_type][tries]->hardnested) { + FuriString* path = furi_string_alloc(); + mifare_nested_worker_get_hardnested_file_path( + data, path, sector, key_type); + + FuriString* str = furi_string_alloc_printf( + "HardNested: Key %c cuid 0x%08lx file %s sec %u\n", + !key_type ? 'A' : 'B', + nonces->cuid, + furi_string_get_cstr(path), + sector); + + stream_write_string(file_stream, str); + + furi_string_free(path); + furi_string_free(str); + } else { + FuriString* str = furi_string_alloc_printf( + "Nested: Key %c cuid 0x%08lx", !key_type ? 'A' : 'B', nonces->cuid); + + for(uint8_t type = 0; type < 2; type++) { + furi_string_cat_printf( + str, + " nt%u 0x%08lx ks%u 0x%08lx par%u ", + type, + nonces->nonces[sector][key_type][tries]->target_nt[type], + type, + nonces->nonces[sector][key_type][tries]->target_ks[type], + type); + + uint8_t* par = nonces->nonces[sector][key_type][tries]->parity[type]; + for(uint8_t i = 0; i < 4; i++) { + furi_string_cat_printf(str, "%u", par[i]); + } + } + + furi_string_cat_printf(str, " sec %u\n", sector); + + stream_write_string(file_stream, str); + furi_string_free(str); + } + } + } + } + } + + if(delay) { + FuriString* str = + furi_string_alloc_printf("Nested: Delay %lu, distance %lu", delay, distance); + + stream_write_string(file_stream, str); + furi_string_free(str); + } + + free_nonces(nonces, sector_count, free_tries_count); + furi_string_free(path); + file_stream_close(file_stream); + free(file_stream); + furi_record_close(RECORD_STORAGE); +} + +bool mifare_nested_worker_check_initial_keys( + NonceList_t* nonces, + MfClassicData* mf_data, + uint8_t tries_count, + uint8_t sector_count, + uint64_t* key, + uint32_t* key_block, + uint32_t* found_key_type) { + bool has_a_key, has_b_key; + FuriHalNfcTxRxContext tx_rx = {}; + + for(uint8_t sector = 0; sector < sector_count; sector++) { + for(uint8_t key_type = 0; key_type < 2; key_type++) { + for(uint8_t tries = 0; tries < tries_count; tries++) { + Nonces* info = malloc(sizeof(Nonces)); + info->key_type = key_type; + info->block = mifare_nested_worker_get_block_by_sector(sector); + info->collected = false; + info->skipped = true; + + nonces->nonces[sector][key_type][tries] = info; + } + } + } + + for(uint8_t sector = 0; sector < sector_count; sector++) { + MfClassicSectorTrailer* trailer = + mifare_nested_worker_get_sector_trailer_by_sector(mf_data, sector); + has_a_key = FURI_BIT(mf_data->key_a_mask, sector); + has_b_key = FURI_BIT(mf_data->key_b_mask, sector); + + if(has_a_key) { + for(uint8_t tries = 0; tries < tries_count; tries++) { + Nonces* info = nonces->nonces[sector][0][tries]; + info->collected = true; + info->skipped = true; + + nonces->nonces[sector][0][tries] = info; + } + + if(*key_block == 0) { + uint64_t key_check = nfc_util_bytes2num(trailer->key_a, 6); + if(nested_check_key( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector), 0, key_check) == + NestedCheckKeyValid) { + *key = key_check; + *key_block = mifare_nested_worker_get_block_by_sector(sector); + *found_key_type = 0; + } + } + } + + if(has_b_key) { + for(uint8_t tries = 0; tries < tries_count; tries++) { + Nonces* info = nonces->nonces[sector][1][tries]; + info->collected = true; + info->skipped = true; + + nonces->nonces[sector][1][tries] = info; + } + + if(*key_block == 0) { + uint64_t key_check = nfc_util_bytes2num(trailer->key_b, 6); + if(nested_check_key( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector), 1, key_check) == + NestedCheckKeyValid) { + *key = key_check; + *key_block = mifare_nested_worker_get_block_by_sector(sector); + *found_key_type = 1; + } + } + } + } + + nonces->cuid = 0; + nonces->hardnested_states = 0; + nonces->sector_count = sector_count; + nonces->tries = tries_count; + + return *key_block; +} + +void mifare_nested_worker_check(MifareNestedWorker* mifare_nested_worker) { + while(mifare_nested_worker->state == MifareNestedWorkerStateCheck) { + FuriHalNfcTxRxContext tx_rx = {}; + NfcDevice* dev = mifare_nested_worker->context->nfc_dev; + MfClassicData* mf_data = &dev->dev_data.mf_classic_data; + FuriHalNfcDevData data = {}; + MifareNestedNonceType type = MifareNestedNonceNoTag; + nested_get_data(&data); + + if(mifare_nested_worker_read_key_cache(&data, mf_data)) { + for(uint8_t sector = 0; sector < 40; sector++) { + if(FURI_BIT(mf_data->key_a_mask, sector) || + FURI_BIT(mf_data->key_b_mask, sector)) { + type = nested_check_nonce_type( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector)); + break; + } + } + + if(type == MifareNestedNonceNoTag) { + type = nested_check_nonce_type(&tx_rx, 0); + } + } else { + type = nested_check_nonce_type(&tx_rx, 0); + } + + if(type == MifareNestedNonceStatic) { + mifare_nested_worker->context->collecting_type = + MifareNestedWorkerStateCollectingStatic; + + mifare_nested_worker->callback( + MifareNestedWorkerEventCollecting, mifare_nested_worker->context); + + break; + } else if(type == MifareNestedNonceWeak) { + mifare_nested_worker->context->collecting_type = MifareNestedWorkerStateCollecting; + + mifare_nested_worker->callback( + MifareNestedWorkerEventCollecting, mifare_nested_worker->context); + + break; + } else if(type == MifareNestedNonceHard) { + mifare_nested_worker->context->collecting_type = MifareNestedWorkerStateCollectingHard; + + mifare_nested_worker->callback( + MifareNestedWorkerEventCollecting, mifare_nested_worker->context); + + break; + } + + furi_delay_ms(250); + } + + nfc_deactivate(); +} + +void mifare_nested_worker_collect_nonces_static(MifareNestedWorker* mifare_nested_worker) { + NonceList_t nonces; + Storage* storage = furi_record_open(RECORD_STORAGE); + NfcDevice* dev = mifare_nested_worker->context->nfc_dev; + MfClassicData* mf_data = &dev->dev_data.mf_classic_data; + FuriString* folder_path = furi_string_alloc(); + FuriHalNfcDevData data = {}; + nested_get_data(&data); + MfClassicType type = mifare_nested_worker_get_tag_type(data.atqa[0], data.atqa[1], data.sak); + uint64_t key = 0; // Found key for attack + uint32_t found_key_type = 0; + uint32_t key_block = 0; + uint32_t sector_count = 0; + + FURI_LOG_I(TAG, "Running Static Nested attack"); + FuriString* tag_info = furi_string_alloc_printf("Tag UID: "); + mifare_nested_worker_write_uid_string(&data, tag_info); + FURI_LOG_I(TAG, "%s", furi_string_get_cstr(tag_info)); + furi_string_free(tag_info); + + if(type == MfClassicType4k) { + sector_count = 40; + FURI_LOG_I(TAG, "Found Mifare Classic 4K tag"); + } else if(type == MfClassicType1k) { + sector_count = 16; + FURI_LOG_I(TAG, "Found Mifare Classic 1K tag"); + } else { // if(type == MfClassicTypeMini) + sector_count = 5; + FURI_LOG_I(TAG, "Found Mifare Classic Mini tag"); + } + + furi_string_set(folder_path, NESTED_FOLDER); + storage_common_mkdir(storage, furi_string_get_cstr(folder_path)); + furi_string_free(folder_path); + + if(!mifare_nested_worker_read_key_cache(&data, mf_data) || + !mifare_nested_worker_check_initial_keys( + &nonces, mf_data, 1, sector_count, &key, &key_block, &found_key_type)) { + mifare_nested_worker->callback( + MifareNestedWorkerEventNeedKey, mifare_nested_worker->context); + nfc_deactivate(); + + free(mf_data); + free_nonces(&nonces, sector_count, 1); + + return; + } + + FURI_LOG_I( + TAG, "Using %c key for block %lu: %012llX", !found_key_type ? 'A' : 'B', key_block, key); + + while(mifare_nested_worker->state == MifareNestedWorkerStateCollectingStatic) { + FuriHalNfcTxRxContext tx_rx = {}; + + for(uint8_t sector = 0; sector < sector_count; sector++) { + for(uint8_t key_type = 0; key_type < 2; key_type++) { + Nonces* info = nonces.nonces[sector][key_type][0]; + + if(info->collected) { + FURI_LOG_I( + TAG, + "Skipping sector %u, block %u, key_type: %u as we already have a key", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info->skipped = true; + + nonces.nonces[sector][key_type][0] = info; + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + continue; + } + + if(!nested_check_block( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector), key_type)) { + FURI_LOG_E( + TAG, + "Skipping sector %u, block %u, key_type: %u as we can't auth on it", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info->skipped = true; + + nonces.nonces[sector][key_type][0] = info; + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + continue; + } + + while(!info->collected) { + if(mifare_nested_worker->state != MifareNestedWorkerStateCollectingStatic) { + break; + } + + struct nonce_info_static result = nested_static_nonce_attack( + &tx_rx, + key_block, + found_key_type, + mifare_nested_worker_get_block_by_sector(sector), + key_type, + key); + if(result.full) { + FURI_LOG_I( + TAG, + "Accured nonces for sector %u, block %u, key_type: %u", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info = nonces.nonces[sector][key_type][0]; + info->collected = true; + info->skipped = false; + + memcpy(&info->target_nt, result.target_nt, sizeof(result.target_nt)); + memcpy(&info->target_ks, result.target_ks, sizeof(result.target_ks)); + + nonces.nonces[sector][key_type][0] = info; + nonces.cuid = result.cuid; + nonces.sector_count = sector_count; + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + break; + } else { + mifare_nested_worker->callback( + MifareNestedWorkerEventNoTagDetected, mifare_nested_worker->context); + } + } + } + } + + break; + } + + mifare_nested_worker_write_nonces(&data, storage, &nonces, 1, 1, sector_count, 0, 0); + + free(mf_data); + + mifare_nested_worker->callback( + MifareNestedWorkerEventNoncesCollected, mifare_nested_worker->context); + + nfc_deactivate(); +} + +void mifare_nested_worker_collect_nonces_hard(MifareNestedWorker* mifare_nested_worker) { + NonceList_t nonces; + Storage* storage = furi_record_open(RECORD_STORAGE); + NfcDevice* dev = mifare_nested_worker->context->nfc_dev; + MfClassicData* mf_data = &dev->dev_data.mf_classic_data; + FuriString* folder_path = furi_string_alloc(); + FuriHalNfcDevData data = {}; + nested_get_data(&data); + MfClassicType type = mifare_nested_worker_get_tag_type(data.atqa[0], data.atqa[1], data.sak); + uint64_t key = 0; // Found key for attack + uint32_t found_key_type = 0; + uint32_t key_block = 0; + uint32_t sector_count = 0; + uint32_t cuid = 0; + furi_hal_nfc_activate_nfca(200, &cuid); + + FURI_LOG_I(TAG, "Running Hard Nested attack"); + FuriString* tag_info = furi_string_alloc_printf("Tag UID: "); + mifare_nested_worker_write_uid_string(&data, tag_info); + FURI_LOG_I(TAG, "%s", furi_string_get_cstr(tag_info)); + furi_string_free(tag_info); + + if(type == MfClassicType4k) { + sector_count = 40; + FURI_LOG_I(TAG, "Found Mifare Classic 4K tag"); + } else if(type == MfClassicType1k) { + sector_count = 16; + FURI_LOG_I(TAG, "Found Mifare Classic 1K tag"); + } else { // if(type == MfClassicTypeMini) + sector_count = 5; + FURI_LOG_I(TAG, "Found Mifare Classic Mini tag"); + } + + furi_string_set(folder_path, NESTED_FOLDER); + storage_common_mkdir(storage, furi_string_get_cstr(folder_path)); + mifare_nested_worker_get_hardnested_folder_path(&data, folder_path); + storage_common_mkdir(storage, furi_string_get_cstr(folder_path)); + furi_string_free(folder_path); + + if(!mifare_nested_worker_read_key_cache(&data, mf_data) || + !mifare_nested_worker_check_initial_keys( + &nonces, mf_data, 1, sector_count, &key, &key_block, &found_key_type)) { + mifare_nested_worker->callback( + MifareNestedWorkerEventNeedKey, mifare_nested_worker->context); + nfc_deactivate(); + + free(mf_data); + free_nonces(&nonces, sector_count, 1); + + return; + } + + FURI_LOG_I( + TAG, "Using %c key for block %lu: %012llX", !found_key_type ? 'A' : 'B', key_block, key); + + FuriHalNfcTxRxContext tx_rx = {}; + nonces.tries = 1; + nonces.hardnested_states = 0; + nonces.sector_count = sector_count; + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback(MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + mifare_nested_worker->callback( + MifareNestedWorkerEventHardnestedStatesFound, mifare_nested_worker->context); + + for(uint8_t sector = 0; sector < sector_count && + mifare_nested_worker->state == MifareNestedWorkerStateCollectingHard; + sector++) { + for(uint8_t key_type = 0; + key_type < 2 && mifare_nested_worker->state == MifareNestedWorkerStateCollectingHard; + key_type++) { + Nonces* info = nonces.nonces[sector][key_type][0]; + if(info->collected) { + FURI_LOG_I( + TAG, + "Skipping sector %u, block %u, key_type: %u as we already have a key", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info->skipped = true; + + nonces.nonces[sector][key_type][0] = info; + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + continue; + } + + if(!nested_check_block( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector), key_type)) { + FURI_LOG_E( + TAG, + "Skipping sector %u, block %u, key_type: %u as we can't auth on it", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info->skipped = true; + + nonces.nonces[sector][key_type][0] = info; + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + continue; + } + + while(!info->collected && + mifare_nested_worker->state == MifareNestedWorkerStateCollectingHard) { + Stream* file_stream = file_stream_alloc(storage); + FuriString* hardnested_file = furi_string_alloc(); + mifare_nested_worker_get_hardnested_file_path( + &data, hardnested_file, sector, key_type); + + file_stream_open( + file_stream, + furi_string_get_cstr(hardnested_file), + FSAM_READ_WRITE, + FSOM_CREATE_ALWAYS); + + FuriString* header = furi_string_alloc_printf( + "Filetype: Flipper Nested Nonces File\nVersion: %s\nNote: you will need desktop app to recover keys: %s\nKey %c cuid 0x%08lx sec %u\n", + NESTED_NONCE_FORMAT_VERSION, + NESTED_RECOVER_KEYS_GITHUB_LINK, + !key_type ? 'A' : 'B', + cuid, + sector); + + stream_write_string(file_stream, header); + furi_string_free(header); + + uint32_t first_byte_sum = 0; + uint32_t* found = malloc(sizeof(uint32_t) * 256); + for(uint32_t i = 0; i < 256; i++) { + found[i] = 0; + } + + while(mifare_nested_worker->state == MifareNestedWorkerStateCollectingHard) { + struct nonce_info_hard result = nested_hard_nonce_attack( + &tx_rx, + key_block, + found_key_type, + mifare_nested_worker_get_block_by_sector(sector), + key_type, + key, + found, + &first_byte_sum, + file_stream); + + if(result.static_encrypted) { + file_stream_close(file_stream); + + storage_simply_remove(storage, furi_string_get_cstr(hardnested_file)); + + furi_string_free(hardnested_file); + free(found); + free(mf_data); + nfc_deactivate(); + + mifare_nested_worker->callback( + MifareNestedWorkerEventStaticEncryptedNonce, + mifare_nested_worker->context); + + return; + } + + if(result.full) { + uint32_t states = 0; + for(uint32_t i = 0; i < 256; i++) { + states += found[i]; + } + + nonces.hardnested_states = states; + + mifare_nested_worker->callback( + MifareNestedWorkerEventHardnestedStatesFound, + mifare_nested_worker->context); + + FURI_LOG_D(TAG, "Found states: %lu", states); + + if(states == 256) { + FURI_LOG_D( + TAG, "All states collected, first_byte_sum: %lu", first_byte_sum); + + bool valid = false; + for(uint8_t i = 0; i < sizeof(sums); i++) { + if(sums[i] == first_byte_sum) { + valid = true; + break; + } + } + + if(!valid) { + FURI_LOG_E(TAG, "Invalid first_byte_sum!"); + break; + } + + info->collected = true; + info->hardnested = true; + info->skipped = false; + + nonces.cuid = result.cuid; + + nonces.nonces[sector][key_type][0] = info; + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + break; + } + } else { + mifare_nested_worker->callback( + MifareNestedWorkerEventNoTagDetected, mifare_nested_worker->context); + } + } + + free(found); + furi_string_free(hardnested_file); + file_stream_close(file_stream); + } + } + } + + mifare_nested_worker_write_nonces(&data, storage, &nonces, 1, 1, sector_count, 0, 0); + + free(mf_data); + + mifare_nested_worker->callback( + MifareNestedWorkerEventNoncesCollected, mifare_nested_worker->context); + + nfc_deactivate(); +} + +void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worker) { + NonceList_t nonces; + Storage* storage = furi_record_open(RECORD_STORAGE); + NfcDevice* dev = mifare_nested_worker->context->nfc_dev; + MfClassicData* mf_data = &dev->dev_data.mf_classic_data; + FuriString* folder_path = furi_string_alloc(); + FuriHalNfcDevData data = {}; + nested_get_data(&data); + MfClassicType type = mifare_nested_worker_get_tag_type(data.atqa[0], data.atqa[1], data.sak); + uint64_t key = 0; // Found key for attack + uint32_t found_key_type = 0; + uint32_t key_block = 0; + uint32_t sector_count = 0; + uint32_t delay = 0; + uint32_t distance = 0; + uint32_t tries_count = 1; + + FURI_LOG_I(TAG, "Running Nested attack"); + FuriString* tag_info = furi_string_alloc_printf("Tag UID: "); + mifare_nested_worker_write_uid_string(&data, tag_info); + FURI_LOG_I(TAG, "%s", furi_string_get_cstr(tag_info)); + furi_string_free(tag_info); + + if(type == MfClassicType4k) { + sector_count = 40; + FURI_LOG_I(TAG, "Found Mifare Classic 4K tag"); + } else if(type == MfClassicType1k) { + sector_count = 16; + FURI_LOG_I(TAG, "Found Mifare Classic 1K tag"); + } else { // if(type == MfClassicTypeMini) + sector_count = 5; + FURI_LOG_I(TAG, "Found Mifare Classic Mini tag"); + } + + furi_string_set(folder_path, NESTED_FOLDER); + storage_common_mkdir(storage, furi_string_get_cstr(folder_path)); + furi_string_free(folder_path); + + if(!mifare_nested_worker_read_key_cache(&data, mf_data) || + !mifare_nested_worker_check_initial_keys( + &nonces, mf_data, 3, sector_count, &key, &key_block, &found_key_type)) { + mifare_nested_worker->callback( + MifareNestedWorkerEventNeedKey, mifare_nested_worker->context); + nfc_deactivate(); + + free(mf_data); + free_nonces(&nonces, sector_count, 3); + + return; + } + + FURI_LOG_I( + TAG, "Using %c key for block %lu: %012llX", !found_key_type ? 'A' : 'B', key_block, key); + + while(mifare_nested_worker->state == MifareNestedWorkerStateCollecting) { + FuriHalNfcTxRxContext tx_rx = {}; + uint32_t first_distance = 0; + uint32_t second_distance = 0; + + mifare_nested_worker->callback( + MifareNestedWorkerEventCalibrating, mifare_nested_worker->context); + + distance = nested_calibrate_distance(&tx_rx, key_block, found_key_type, key, delay, false); + + if(mifare_nested_worker->state == MifareNestedWorkerStateCollecting) { + first_distance = + nested_calibrate_distance(&tx_rx, key_block, found_key_type, key, delay, true); + } + + if(mifare_nested_worker->state == MifareNestedWorkerStateCollecting) { + second_distance = + nested_calibrate_distance(&tx_rx, key_block, found_key_type, key, 10000, true); + } + + if(first_distance == 0 && second_distance == 0) { + nfc_deactivate(); + + free(mf_data); + free_nonces(&nonces, sector_count, 3); + + mifare_nested_worker_change_state( + mifare_nested_worker, MifareNestedWorkerStateCollectingHard); + + mifare_nested_worker_collect_nonces_hard(mifare_nested_worker); + return; + } + + if(first_distance < second_distance - 100 && second_distance > 100) { + FURI_LOG_E( + TAG, + "Discovered tag with PRNG that depends on time. PRNG values: %lu, %lu", + first_distance, + second_distance); + + struct distance_info info = + nested_calibrate_distance_info(&tx_rx, key_block, found_key_type, key); + + if(info.max_prng - info.min_prng > 150) { + FURI_LOG_W( + TAG, + "PRNG is too unpredictable (min/max values more than 150: %lu - %lu = %lu), fallback to delay method", + info.max_prng, + info.min_prng, + info.max_prng - info.min_prng); + + delay = 1; + } else { + FURI_LOG_I( + TAG, + "PRNG is stable, using method without delay! (May be false positive, still will collect x3 times)"); + + distance = + nested_calibrate_distance(&tx_rx, key_block, found_key_type, key, delay, true); + + delay = 2; + tries_count = 3; + } + } + + if(distance == 0 || delay == 1) { + bool failed = false; + // Tag need delay or unpredictable PRNG + FURI_LOG_W(TAG, "Can't determine distance, trying to find timing..."); + + mifare_nested_worker->callback( + MifareNestedWorkerEventNeedPrediction, mifare_nested_worker->context); + + delay = mifare_nested_worker_predict_delay( + &tx_rx, key_block, found_key_type, key, 0, mifare_nested_worker); + + if(delay == 1) { + FURI_LOG_E(TAG, "Can't determine delay"); + + // Check that we didn't lost tag + FuriHalNfcDevData lost_tag_data = {}; + nested_get_data(&lost_tag_data); + if(lost_tag_data.uid_len == 0) { + // We lost it. + mifare_nested_worker->callback( + MifareNestedWorkerEventNoTagDetected, mifare_nested_worker->context); + + while(mifare_nested_worker->state == MifareNestedWorkerStateCollecting && + lost_tag_data.cuid != data.cuid) { + furi_delay_ms(250); + nested_get_data(&lost_tag_data); + } + + mifare_nested_worker->callback( + MifareNestedWorkerEventCalibrating, mifare_nested_worker->context); + + continue; + } + + failed = true; + } + + if(delay == 2) { + FURI_LOG_E(TAG, "Can't determine delay in 25 tries, fallback to hardnested"); + + nfc_deactivate(); + + free(mf_data); + free_nonces(&nonces, sector_count, 3); + + mifare_nested_worker_change_state( + mifare_nested_worker, MifareNestedWorkerStateCollectingHard); + + mifare_nested_worker_collect_nonces_hard(mifare_nested_worker); + return; + } + + if(mifare_nested_worker->state == MifareNestedWorkerStateCollecting && !failed) { + distance = nested_calibrate_distance( + &tx_rx, key_block, found_key_type, key, delay, false); + } + + if(distance == 0 && !failed) { + FURI_LOG_E(TAG, "Found delay, but can't find distance"); + + failed = true; + } + + if(failed) { + nfc_deactivate(); + + mifare_nested_worker->callback( + MifareNestedWorkerEventAttackFailed, mifare_nested_worker->context); + + free(mf_data); + free_nonces(&nonces, sector_count, 3); + + return; + } + + tries_count = 3; + } + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + for(uint8_t tries = 0; tries < tries_count; tries++) { + for(uint8_t sector = 0; sector < sector_count; sector++) { + for(uint8_t key_type = 0; key_type < 2; key_type++) { + Nonces* info = nonces.nonces[sector][key_type][tries]; + if(info->collected) { + FURI_LOG_I( + TAG, + "Skipping sector %u, block %u, key_type: %u as we already have a key", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info->skipped = true; + + nonces.nonces[sector][key_type][tries] = info; + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + continue; + } + + if(!nested_check_block( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector), key_type)) { + FURI_LOG_E( + TAG, + "Skipping sector %u, block %u, key_type: %u as we can't auth on it", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info->skipped = true; + + nonces.nonces[sector][key_type][0] = info; + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + + continue; + } + + while(!info->collected) { + if(mifare_nested_worker->state != MifareNestedWorkerStateCollecting) { + break; + } + + struct nonce_info result = nested_attack( + &tx_rx, + key_block, + found_key_type, + mifare_nested_worker_get_block_by_sector(sector), + key_type, + key, + distance, + delay); + + if(result.full) { + FURI_LOG_I( + TAG, + "Accured nonces for sector %u, block %u, key_type: %u", + sector, + mifare_nested_worker_get_block_by_sector(sector), + key_type); + + info = nonces.nonces[sector][key_type][tries]; + info->collected = true; + info->skipped = false; + + memcpy(&info->target_nt, result.target_nt, sizeof(result.target_nt)); + memcpy(&info->target_ks, result.target_ks, sizeof(result.target_ks)); + memcpy(&info->parity, result.parity, sizeof(result.parity)); + + nonces.nonces[sector][key_type][tries] = info; + nonces.cuid = result.cuid; + nonces.sector_count = sector_count; + nonces.tries = tries_count; + + mifare_nested_worker->context->nonces = &nonces; + + mifare_nested_worker->callback( + MifareNestedWorkerEventNewNonce, mifare_nested_worker->context); + break; + } else { + mifare_nested_worker->callback( + MifareNestedWorkerEventNoTagDetected, + mifare_nested_worker->context); + } + } + } + } + } + + break; + } + + mifare_nested_worker_write_nonces( + &data, storage, &nonces, tries_count, 3, sector_count, delay, distance); + + free(mf_data); + + mifare_nested_worker->callback( + MifareNestedWorkerEventNoncesCollected, mifare_nested_worker->context); + + nfc_deactivate(); +} + +bool* mifare_nested_worker_check_keys_exists( + Storage* storage, + char* path, + uint64_t* keys, + uint32_t key_count, + MifareNestedWorker* mifare_nested_worker) { + bool* old_keys = malloc(sizeof(bool) * key_count); + Stream* file_stream = file_stream_alloc(storage); + file_stream_open(file_stream, path, FSAM_READ, FSOM_OPEN_ALWAYS); + FuriString* key_strings[key_count]; + + for(uint32_t i = 0; i < key_count; i++) { + old_keys[i] = false; + key_strings[i] = furi_string_alloc_printf("%012llX\n", keys[i]); + } + + while(mifare_nested_worker->state == MifareNestedWorkerStateValidating) { + FuriString* next_line = furi_string_alloc(); + + if(!stream_read_line(file_stream, next_line)) { + break; + } + + for(uint32_t i = 0; i < key_count; i++) { + if(keys[i] == (uint64_t)-1) continue; + + if(furi_string_cmp(next_line, key_strings[i]) == 0) { + old_keys[i] = true; + } + } + + furi_string_free(next_line); + } + + for(uint32_t i = 0; i < key_count; i++) { + furi_string_free(key_strings[i]); + } + + file_stream_close(file_stream); + free(file_stream); + + return old_keys; +} + +void mifare_nested_worker_write_key(Storage* storage, FuriString* key) { + Stream* file_stream = file_stream_alloc(storage); + file_stream_open( + file_stream, + EXT_PATH("nfc/assets/mf_classic_dict_user.nfc"), + FSAM_READ_WRITE, + FSOM_OPEN_APPEND); + + stream_write_string(file_stream, key); + + file_stream_close(file_stream); +} + +void mifare_nested_worker_check_keys(MifareNestedWorker* mifare_nested_worker) { + KeyInfo_t* key_info = mifare_nested_worker->context->keys; + Storage* storage = furi_record_open(RECORD_STORAGE); + Stream* file_stream = file_stream_alloc(storage); + FuriString* next_line = furi_string_alloc(); + FuriString* path = furi_string_alloc(); + FuriHalNfcDevData data = {}; + nested_get_data(&data); + MfClassicType type = mifare_nested_worker_get_tag_type(data.atqa[0], data.atqa[1], data.sak); + NestedCheckKeyResult result = NestedCheckKeyNoTag; + FuriHalNfcTxRxContext tx_rx = {}; + uint32_t key_count = 0; + uint32_t sector_key_count = 0; + uint64_t keys[80]; + bool found_keys[2][40]; + bool unique_keys[2][40]; + uint32_t sector_count = 0; + + if(type == MfClassicType4k) { + sector_count = 40; + FURI_LOG_I(TAG, "Found Mifare Classic 4K tag"); + } else if(type == MfClassicType1k) { + sector_count = 16; + FURI_LOG_I(TAG, "Found Mifare Classic 1K tag"); + } else { // if(type == MfClassicTypeMini) + sector_count = 5; + FURI_LOG_I(TAG, "Found Mifare Classic Mini tag"); + } + + uint32_t keys_count = sector_count * 2; + + for(uint8_t key = 0; key < 2; key++) { + for(uint8_t i = 0; i < sector_count; i++) { + found_keys[key][i] = false; + unique_keys[key][i] = false; + } + } + + for(uint8_t i = 0; i < keys_count; i++) { + keys[i] = -1; + } + + mifare_nested_worker_get_found_keys_file_path(&data, path); + + if(!file_stream_open(file_stream, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { + FURI_LOG_E(TAG, "Can't open %s", furi_string_get_cstr(path)); + + file_stream_close(file_stream); + + mifare_nested_worker_get_nonces_file_path(&data, path); + + if(!file_stream_open( + file_stream, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { + mifare_nested_worker->callback( + MifareNestedWorkerEventNeedCollection, mifare_nested_worker->context); + } else { + mifare_nested_worker->callback( + MifareNestedWorkerEventNeedKeyRecovery, mifare_nested_worker->context); + } + + file_stream_close(file_stream); + + free(file_stream); + furi_string_free(path); + furi_string_free(next_line); + furi_record_close(RECORD_STORAGE); + + return; + }; + + while(true) { + if(!stream_read_line(file_stream, next_line)) { + break; + } + + if(furi_string_start_with_str(next_line, "Key")) { + uint8_t key_type = furi_string_get_char(next_line, 4) == 'B'; + uint8_t sector = atoi((char[]){furi_string_get_char(next_line, 13)}) * 10 + + atoi((char[]){furi_string_get_char(next_line, 14)}); + + if(!unique_keys[key_type][sector]) { + unique_keys[key_type][sector] = true; + sector_key_count++; + } + } + + key_count++; + } + + stream_rewind(file_stream); + + key_info->total_keys = key_count; + key_info->sector_keys = sector_key_count; + + while(mifare_nested_worker->state == MifareNestedWorkerStateValidating) { + if(!stream_read_line(file_stream, next_line)) { + break; + } + + if(furi_string_start_with_str(next_line, "Key")) { + // Key X sector XX: XX XX XX XX XX XX + // 0000000000111111111122222222223333 + // 0123456789012345678901234567890123 + uint8_t keyChar[6]; + uint8_t count = 0; + + uint8_t key_type = furi_string_get_char(next_line, 4) == 'B'; + uint8_t sector = atoi((char[]){furi_string_get_char(next_line, 13)}) * 10 + + atoi((char[]){furi_string_get_char(next_line, 14)}); + + for(uint8_t i = 17; i < 33; i += 3) { + hex_char_to_uint8( + furi_string_get_char(next_line, i), + furi_string_get_char(next_line, i + 1), + &keyChar[count]); + count++; + } + + uint64_t key = nfc_util_bytes2num(keyChar, 6); + + key_info->checked_keys++; + + if(found_keys[key_type][sector]) { + mifare_nested_worker->callback( + MifareNestedWorkerEventKeyChecked, mifare_nested_worker->context); + + continue; + } + + while(mifare_nested_worker->state == MifareNestedWorkerStateValidating) { + result = nested_check_key( + &tx_rx, mifare_nested_worker_get_block_by_sector(sector), key_type, key); + + if(result == NestedCheckKeyNoTag) { + mifare_nested_worker->callback( + MifareNestedWorkerEventNoTagDetected, mifare_nested_worker->context); + + furi_delay_ms(250); + } else { + break; + } + } + + if(result == NestedCheckKeyValid) { + FURI_LOG_I( + TAG, "Found valid %c key for sector %u: %012llX", key_type, sector, key); + bool exists = false; + + for(uint8_t i = 0; i < keys_count; i++) { + if(keys[i] == key) { + exists = true; + } + } + + if(!exists) { + keys[key_info->found_keys] = key; + } + + key_info->found_keys++; + found_keys[key_type][sector] = true; + } + + mifare_nested_worker->callback( + MifareNestedWorkerEventKeyChecked, mifare_nested_worker->context); + } + } + + furi_string_free(next_line); + file_stream_close(file_stream); + free(file_stream); + + mifare_nested_worker->callback( + MifareNestedWorkerEventProcessingKeys, mifare_nested_worker->context); + + bool* old_keys = mifare_nested_worker_check_keys_exists( + storage, + EXT_PATH("nfc/assets/mf_classic_dict_user.nfc"), + keys, + keys_count, + mifare_nested_worker); + + for(uint8_t i = 0; i < keys_count; i++) { + if(old_keys[i]) { + keys[i] = -1; + } + } + + old_keys = mifare_nested_worker_check_keys_exists( + storage, + EXT_PATH("nfc/assets/mf_classic_dict.nfc"), + keys, + keys_count, + mifare_nested_worker); + + for(uint8_t i = 0; i < keys_count; i++) { + if(old_keys[i]) { + keys[i] = -1; + } + } + + for(uint8_t i = 0; i < keys_count; i++) { + if(keys[i] == (uint64_t)-1) continue; + + FuriString* key_string = furi_string_alloc_printf("%012llX\n", keys[i]); + + mifare_nested_worker_write_key(storage, key_string); + FURI_LOG_I(TAG, "Added new key: %s", furi_string_get_cstr(key_string)); + + key_info->added_keys++; + + furi_string_free(key_string); + } + + if(!storage_simply_remove(storage, furi_string_get_cstr(path))) { + FURI_LOG_E(TAG, "Failed to remove .keys file"); + } + + furi_record_close(RECORD_STORAGE); + furi_string_free(path); + + mifare_nested_worker->callback( + MifareNestedWorkerEventKeysFound, mifare_nested_worker->context); + + return; +} \ No newline at end of file diff --git a/applications/external/mifare_nested/mifare_nested_worker.h b/applications/external/mifare_nested/mifare_nested_worker.h new file mode 100644 index 000000000..561620676 --- /dev/null +++ b/applications/external/mifare_nested/mifare_nested_worker.h @@ -0,0 +1,89 @@ +#pragma once + +#include + +#define NESTED_FOLDER EXT_PATH("nfc/.nested") + +typedef struct MifareNestedWorker MifareNestedWorker; + +typedef enum { + MifareNestedWorkerStateReady, + + MifareNestedWorkerStateCheck, + MifareNestedWorkerStateCollecting, + MifareNestedWorkerStateCollectingStatic, + MifareNestedWorkerStateCollectingHard, + MifareNestedWorkerStateValidating, + + MifareNestedWorkerStateStop, +} MifareNestedWorkerState; + +typedef enum { + MifareNestedWorkerEventReserved = 1000, + + MifareNestedWorkerEventNoTagDetected, + MifareNestedWorkerEventNoncesCollected, + MifareNestedWorkerEventCollecting, + + MifareNestedWorkerEventNewNonce, + MifareNestedWorkerEventKeyChecked, + MifareNestedWorkerEventKeysFound, + MifareNestedWorkerEventNeedKey, + MifareNestedWorkerEventAttackFailed, + MifareNestedWorkerEventCalibrating, + MifareNestedWorkerEventStaticEncryptedNonce, + MifareNestedWorkerEventNeedPrediction, + MifareNestedWorkerEventProcessingKeys, + MifareNestedWorkerEventNeedKeyRecovery, + MifareNestedWorkerEventNeedCollection, + MifareNestedWorkerEventHardnestedStatesFound +} MifareNestedWorkerEvent; + +typedef bool (*MifareNestedWorkerCallback)(MifareNestedWorkerEvent event, void* context); + +MifareNestedWorker* mifare_nested_worker_alloc(); + +void mifare_nested_worker_change_state( + MifareNestedWorker* mifare_nested_worker, + MifareNestedWorkerState state); + +void mifare_nested_worker_free(MifareNestedWorker* mifare_nested_worker); + +void mifare_nested_worker_stop(MifareNestedWorker* mifare_nested_worker); + +void mifare_nested_worker_start( + MifareNestedWorker* mifare_nested_worker, + MifareNestedWorkerState state, + NfcDeviceData* dev_data, + MifareNestedWorkerCallback callback, + void* context); + +typedef struct { + uint32_t key_type; + uint32_t block; + uint32_t target_nt[2]; + uint32_t target_ks[2]; + uint8_t parity[2][4]; + bool collected; + bool skipped; + bool hardnested; +} Nonces; + +typedef struct { + uint32_t cuid; + uint32_t sector_count; + // 40 (or 16/5) sectors, 2 keys (A/B), 3 tries + Nonces* nonces[40][2][3]; + uint32_t tries; + // unique first bytes + uint32_t hardnested_states; +} NonceList_t; + +typedef struct { + uint32_t total_keys; + uint32_t checked_keys; + uint32_t found_keys; + uint32_t added_keys; + uint32_t sector_keys; + bool tag_lost; +} KeyInfo_t; diff --git a/applications/external/mifare_nested/mifare_nested_worker_i.h b/applications/external/mifare_nested/mifare_nested_worker_i.h new file mode 100644 index 000000000..fd82535d0 --- /dev/null +++ b/applications/external/mifare_nested/mifare_nested_worker_i.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include "mifare_nested_i.h" +#include "mifare_nested_worker.h" + +struct MifareNestedWorker { + FuriThread* thread; + + NfcDeviceData* dev_data; + + MifareNestedWorkerCallback callback; + MifareNested* context; + + MifareNestedWorkerState state; +}; + +int32_t mifare_nested_worker_task(void* context); + +void mifare_nested_worker_check(MifareNestedWorker* mifare_nested_worker); + +void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worker); + +void mifare_nested_worker_collect_nonces_static(MifareNestedWorker* mifare_nested_worker); + +void mifare_nested_worker_collect_nonces_hard(MifareNestedWorker* mifare_nested_worker); + +void mifare_nested_worker_check_keys(MifareNestedWorker* mifare_nested_worker); diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene.c b/applications/external/mifare_nested/scenes/mifare_nested_scene.c new file mode 100644 index 000000000..3962ed908 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene.c @@ -0,0 +1,30 @@ +#include "mifare_nested_scene.h" + +// Generate scene on_enter handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, +void (*const mifare_nested_on_enter_handlers[])(void*) = { +#include "mifare_nested_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_event handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, +bool (*const mifare_nested_on_event_handlers[])(void* context, SceneManagerEvent event) = { +#include "mifare_nested_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_exit handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, +void (*const mifare_nested_on_exit_handlers[])(void* context) = { +#include "mifare_nested_scene_config.h" +}; +#undef ADD_SCENE + +// Initialize scene handlers configuration structure +const SceneManagerHandlers mifare_nested_scene_handlers = { + .on_enter_handlers = mifare_nested_on_enter_handlers, + .on_event_handlers = mifare_nested_on_event_handlers, + .on_exit_handlers = mifare_nested_on_exit_handlers, + .scene_num = MifareNestedSceneNum, +}; diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene.h b/applications/external/mifare_nested/scenes/mifare_nested_scene.h new file mode 100644 index 000000000..e9596f222 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +// Generate scene id and total number +#define ADD_SCENE(prefix, name, id) MifareNestedScene##id, +typedef enum { +#include "mifare_nested_scene_config.h" + MifareNestedSceneNum, +} MifareNestedScene; +#undef ADD_SCENE + +extern const SceneManagerHandlers mifare_nested_scene_handlers; + +// Generate scene on_enter handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); +#include "mifare_nested_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_event handlers declaration +#define ADD_SCENE(prefix, name, id) \ + bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); +#include "mifare_nested_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_exit handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); +#include "mifare_nested_scene_config.h" +#undef ADD_SCENE diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_about.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_about.c new file mode 100644 index 000000000..cb07f81a3 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_about.c @@ -0,0 +1,77 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_about_widget_callback(GuiButtonType result, InputType type, void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_about_on_enter(void* context) { + MifareNested* mifare_nested = context; + + FuriString* temp_str; + temp_str = furi_string_alloc(); + furi_string_printf(temp_str, "\e#%s\n", "Information"); + + furi_string_cat_printf(temp_str, "Version: %s\n", NESTED_VERSION_APP); + furi_string_cat_printf(temp_str, "Developed by:\n%s\n\n", NESTED_AUTHOR); + furi_string_cat_printf(temp_str, "Github: %s\n\n", NESTED_GITHUB_LINK); + + furi_string_cat_printf(temp_str, "\e#%s\n", "Description"); + furi_string_cat_printf( + temp_str, + "Ported Nested attacks\nfrom Proxmark3 (Iceman fork)\nCurrently supported attacks:\n - nested attack\n - static nested attack\n - hard nested attack\n\n"); + furi_string_cat_printf( + temp_str, + "You will need desktop app to recover keys from collected nonces: %s\n\n", + NESTED_RECOVER_KEYS_GITHUB_LINK); + furi_string_cat_printf(temp_str, "\e#%s\n", "Quick guide"); + furi_string_cat_printf(temp_str, "1. Install key recovery script on PC:\n"); + furi_string_cat_printf(temp_str, "pip install FlipperNested\n"); + furi_string_cat_printf(temp_str, "2. Connect Flipper Zero to PC\n"); + furi_string_cat_printf(temp_str, "3. Run key recovery:\n"); + furi_string_cat_printf(temp_str, "FlipperNested"); + + widget_add_text_box_element( + mifare_nested->widget, + 0, + 0, + 128, + 14, + AlignCenter, + AlignBottom, + "\e#\e! \e!\n", + false); + widget_add_text_box_element( + mifare_nested->widget, + 0, + 2, + 128, + 14, + AlignCenter, + AlignBottom, + "\e#\e! Flipper (Mifare) Nested \e!\n", + false); + widget_add_text_scroll_element( + mifare_nested->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str)); + furi_string_free(temp_str); + + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_about_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + UNUSED(mifare_nested); + UNUSED(event); + + return consumed; +} + +void mifare_nested_scene_about_on_exit(void* context) { + MifareNested* mifare_nested = context; + + // Clear views + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_added_keys.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_added_keys.c new file mode 100644 index 000000000..f5627a300 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_added_keys.c @@ -0,0 +1,76 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_added_keys_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_added_keys_on_enter(void* context) { + MifareNested* mifare_nested = context; + KeyInfo_t* key_info = mifare_nested->keys; + Widget* widget = mifare_nested->widget; + char draw_str[32] = {}; + char append[5] = {'k', 'e', 'y', ' ', '\0'}; + if(key_info->added_keys != 1) { + append[3] = 's'; + } + + widget_add_string_element( + widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Results of key recovery"); + + if(key_info->added_keys != 0) { + snprintf(draw_str, sizeof(draw_str), "Added: %lu %s", key_info->added_keys, append); + notification_message(mifare_nested->notifications, &sequence_success); + widget_add_icon_element(widget, 52, 17, &I_DolphinSuccess); + } else { + snprintf(draw_str, sizeof(draw_str), "No new keys were added"); + widget_add_string_element( + widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "Try running \"Nested attack\""); + widget_add_string_element(widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "again"); + notification_message(mifare_nested->notifications, &sequence_error); + } + + widget_add_string_element(widget, 0, 12, AlignLeft, AlignTop, FontSecondary, draw_str); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_added_keys_widget_callback, + mifare_nested); + + free(key_info); + + KeyInfo_t* new_key_info = malloc(sizeof(KeyInfo_t)); + mifare_nested->keys = new_key_info; + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_added_keys_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_added_keys_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_check.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_check.c new file mode 100644 index 000000000..4eb344703 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_check.c @@ -0,0 +1,102 @@ +#include "../mifare_nested_i.h" + +enum { + MifareNestedSceneCheckStateTagSearch, + MifareNestedSceneCheckStateTagFound, +}; + +bool mifare_nested_check_worker_callback(MifareNestedWorkerEvent event, void* context) { + furi_assert(context); + + MifareNested* mifare_nested = context; + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, event); + + return true; +} + +static void mifare_nested_scene_check_setup_view(MifareNested* mifare_nested) { + Popup* popup = mifare_nested->popup; + popup_reset(popup); + uint32_t state = + scene_manager_get_scene_state(mifare_nested->scene_manager, MifareNestedSceneCheck); + + if(state == MifareNestedSceneCheckStateTagSearch) { + popup_set_icon(mifare_nested->popup, 0, 8, &I_ApplyTag); + popup_set_text( + mifare_nested->popup, "Apply tag to\nthe back", 128, 32, AlignRight, AlignCenter); + } else { + popup_set_icon(popup, 12, 23, &I_Loading); + popup_set_header(popup, "Checking\nDon't move...", 52, 32, AlignLeft, AlignCenter); + } + + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewPopup); +} + +void mifare_nested_scene_check_on_enter(void* context) { + MifareNested* mifare_nested = context; + + scene_manager_set_scene_state( + mifare_nested->scene_manager, + MifareNestedSceneCheck, + MifareNestedSceneCheckStateTagSearch); + mifare_nested_scene_check_setup_view(mifare_nested); + + // Setup and start worker + mifare_nested_worker_start( + mifare_nested->worker, + MifareNestedWorkerStateCheck, + &mifare_nested->nfc_dev->dev_data, + mifare_nested_check_worker_callback, + mifare_nested); + mifare_nested_blink_start(mifare_nested); +} + +bool mifare_nested_scene_check_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == MifareNestedWorkerEventNoncesCollected) { + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneNoncesCollected); + consumed = true; + } else if(event.event == MifareNestedWorkerEventAttackFailed) { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneFailed); + consumed = true; + } else if(event.event == MifareNestedWorkerEventCollecting) { + if(mifare_nested->run == NestedRunAttack) { + if(mifare_nested->settings->only_hardnested) { + FURI_LOG_I("MifareNested", "Using Hard Nested because user settings"); + mifare_nested->collecting_type = MifareNestedWorkerStateCollectingHard; + } + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneCollecting); + } else { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneCheckKeys); + } + consumed = true; + } else if(event.event == MifareNestedWorkerEventNoTagDetected) { + scene_manager_set_scene_state( + mifare_nested->scene_manager, + MifareNestedSceneCheck, + MifareNestedSceneCheckStateTagSearch); + mifare_nested_scene_check_setup_view(mifare_nested); + consumed = true; + } + } + return consumed; +} + +void mifare_nested_scene_check_on_exit(void* context) { + MifareNested* mifare_nested = context; + + mifare_nested_worker_stop(mifare_nested->worker); + scene_manager_set_scene_state( + mifare_nested->scene_manager, + MifareNestedSceneCheck, + MifareNestedSceneCheckStateTagSearch); + // Clear view + popup_reset(mifare_nested->popup); + + mifare_nested_blink_stop(mifare_nested); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_check_keys.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_check_keys.c new file mode 100644 index 000000000..f0071b7aa --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_check_keys.c @@ -0,0 +1,124 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_check_keys_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +bool mifare_nested_check_keys_worker_callback(MifareNestedWorkerEvent event, void* context) { + MifareNested* mifare_nested = context; + CheckKeysState* plugin_state = mifare_nested->keys_state; + + if(event == MifareNestedWorkerEventKeyChecked) { + mifare_nested_blink_nonce_collection_start(mifare_nested); + + KeyInfo_t* key_info = mifare_nested->keys; + + with_view_model( + plugin_state->view, + CheckKeysViewModel * model, + { + model->lost_tag = false; + model->keys_checked = key_info->checked_keys; + model->keys_found = key_info->found_keys; + model->keys_total = key_info->sector_keys; + model->keys_count = key_info->total_keys; + }, + true); + } else if(event == MifareNestedWorkerEventNoTagDetected) { + mifare_nested_blink_start(mifare_nested); + + with_view_model( + plugin_state->view, CheckKeysViewModel * model, { model->lost_tag = true; }, true); + } else if(event == MifareNestedWorkerEventProcessingKeys) { + with_view_model( + plugin_state->view, + CheckKeysViewModel * model, + { model->processing_keys = true; }, + true); + } + + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, event); + + return true; +} + +void mifare_nested_scene_check_keys_on_enter(void* context) { + MifareNested* mifare_nested = context; + CheckKeysState* plugin_state = mifare_nested->keys_state; + + mifare_nested_worker_start( + mifare_nested->worker, + MifareNestedWorkerStateValidating, + &mifare_nested->nfc_dev->dev_data, + mifare_nested_check_keys_worker_callback, + mifare_nested); + + mifare_nested_blink_start(mifare_nested); + + with_view_model( + plugin_state->view, + CheckKeysViewModel * model, + { + model->lost_tag = false; + model->processing_keys = false; + model->keys_count = 0; + model->keys_checked = 0; + model->keys_found = 0; + }, + false); + + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewCheckKeys); +} + +bool mifare_nested_scene_check_keys_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + + bool consumed = false; + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } else if(event.event == MifareNestedWorkerEventNoncesCollected) { + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneNoncesCollected); + consumed = true; + } else if(event.event == MifareNestedWorkerEventNeedKey) { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneNoKeys); + consumed = true; + } else if(event.event == MifareNestedWorkerEventKeysFound) { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneAddedKeys); + consumed = true; + } else if(event.event == MifareNestedWorkerEventNeedKeyRecovery) { + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneNeedKeyRecovery); + consumed = true; + } else if(event.event == MifareNestedWorkerEventNeedCollection) { + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneNeedCollection); + consumed = true; + } else if( + event.event == MifareNestedWorkerEventKeyChecked || + event.event == MifareNestedWorkerEventNoTagDetected || + event.event == MifareNestedWorkerEventProcessingKeys) { + consumed = true; + } + } + + return consumed; +} + +void mifare_nested_scene_check_keys_on_exit(void* context) { + MifareNested* mifare_nested = context; + mifare_nested_worker_stop(mifare_nested->worker); + + // Clear view + mifare_nested_blink_stop(mifare_nested); + popup_reset(mifare_nested->popup); + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c new file mode 100644 index 000000000..05c96d97d --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c @@ -0,0 +1,154 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_collecting_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +bool mifare_nested_collecting_worker_callback(MifareNestedWorkerEvent event, void* context) { + MifareNested* mifare_nested = context; + NestedState* plugin_state = mifare_nested->nested_state; + + if(event == MifareNestedWorkerEventNewNonce) { + mifare_nested_blink_nonce_collection_start(mifare_nested); + + uint8_t collected = 0; + NonceList_t* nonces = mifare_nested->nonces; + for(uint8_t tries = 0; tries < nonces->tries; tries++) { + for(uint8_t sector = 0; sector < nonces->sector_count; sector++) { + for(uint8_t keyType = 0; keyType < 2; keyType++) { + Nonces* info = nonces->nonces[sector][keyType][tries]; + if(info->collected) { + collected++; + } + } + } + } + + with_view_model( + plugin_state->view, + NestedAttackViewModel * model, + { + model->calibrating = false; + model->lost_tag = false; + model->nonces_collected = collected; + model->keys_count = nonces->sector_count * nonces->tries * 2; + }, + true); + } else if(event == MifareNestedWorkerEventNoTagDetected) { + mifare_nested_blink_start(mifare_nested); + + with_view_model( + plugin_state->view, NestedAttackViewModel * model, { model->lost_tag = true; }, true); + } else if(event == MifareNestedWorkerEventCalibrating) { + mifare_nested_blink_calibration_start(mifare_nested); + + with_view_model( + plugin_state->view, + NestedAttackViewModel * model, + { + model->calibrating = true; + model->lost_tag = false; + model->need_prediction = false; + model->hardnested = false; + }, + true); + } else if(event == MifareNestedWorkerEventNeedPrediction) { + with_view_model( + plugin_state->view, + NestedAttackViewModel * model, + { model->need_prediction = true; }, + true); + } else if(event == MifareNestedWorkerEventHardnestedStatesFound) { + NonceList_t* nonces = mifare_nested->nonces; + with_view_model( + plugin_state->view, + NestedAttackViewModel * model, + { + model->calibrating = false; + model->lost_tag = false; + model->hardnested = true; + model->hardnested_states = nonces->hardnested_states; + }, + true); + } + + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, event); + + return true; +} + +void mifare_nested_scene_collecting_on_enter(void* context) { + MifareNested* mifare_nested = context; + NestedState* nested = mifare_nested->nested_state; + + mifare_nested_worker_start( + mifare_nested->worker, + mifare_nested->collecting_type, + &mifare_nested->nfc_dev->dev_data, + mifare_nested_collecting_worker_callback, + mifare_nested); + + mifare_nested_blink_start(mifare_nested); + + with_view_model( + nested->view, + NestedAttackViewModel * model, + { + model->lost_tag = false; + model->nonces_collected = 0; + }, + false); + + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewCollecting); +} + +bool mifare_nested_scene_collecting_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + + bool consumed = false; + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } else if(event.event == MifareNestedWorkerEventNoncesCollected) { + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneNoncesCollected); + consumed = true; + } else if(event.event == MifareNestedWorkerEventAttackFailed) { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneFailed); + consumed = true; + } else if(event.event == MifareNestedWorkerEventNeedKey) { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneNoKeys); + consumed = true; + } else if(event.event == MifareNestedWorkerEventStaticEncryptedNonce) { + scene_manager_next_scene( + mifare_nested->scene_manager, MifareNestedSceneStaticEncryptedNonce); + consumed = true; + } else if( + event.event == MifareNestedWorkerEventNewNonce || + event.event == MifareNestedWorkerEventNoTagDetected || + event.event == MifareNestedWorkerEventCalibrating || + event.event == MifareNestedWorkerEventNeedPrediction || + event.event == MifareNestedWorkerEventHardnestedStatesFound) { + consumed = true; + } + } + + return consumed; +} + +void mifare_nested_scene_collecting_on_exit(void* context) { + MifareNested* mifare_nested = context; + mifare_nested_worker_stop(mifare_nested->worker); + + // Clear view + mifare_nested_blink_stop(mifare_nested); + popup_reset(mifare_nested->popup); + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_config.h b/applications/external/mifare_nested/scenes/mifare_nested_scene_config.h new file mode 100644 index 000000000..14cf52c4e --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_config.h @@ -0,0 +1,13 @@ +ADD_SCENE(mifare_nested, start, Start) +ADD_SCENE(mifare_nested, check, Check) +ADD_SCENE(mifare_nested, nonces_collected, NoncesCollected) +ADD_SCENE(mifare_nested, collecting, Collecting) +ADD_SCENE(mifare_nested, no_keys, NoKeys) +ADD_SCENE(mifare_nested, check_keys, CheckKeys) +ADD_SCENE(mifare_nested, added_keys, AddedKeys) +ADD_SCENE(mifare_nested, failed, Failed) +ADD_SCENE(mifare_nested, about, About) +ADD_SCENE(mifare_nested, static_encrypted_nonce, StaticEncryptedNonce) +ADD_SCENE(mifare_nested, need_key_recovery, NeedKeyRecovery) +ADD_SCENE(mifare_nested, need_collection, NeedCollection) +ADD_SCENE(mifare_nested, settings, Settings) \ No newline at end of file diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_failed.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_failed.c new file mode 100644 index 000000000..e7d1ee80d --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_failed.c @@ -0,0 +1,59 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_failed_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_failed_on_enter(void* context) { + MifareNested* mifare_nested = context; + Widget* widget = mifare_nested->widget; + + notification_message(mifare_nested->notifications, &sequence_error); + + widget_add_icon_element(widget, 73, 13, &I_DolphinCry); + widget_add_string_element( + widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Failed to preform attack"); + widget_add_string_element(widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "Try running"); + widget_add_string_element( + widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "\"Nested attack\""); + widget_add_string_element(widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "again or check"); + widget_add_string_element(widget, 0, 42, AlignLeft, AlignTop, FontSecondary, "logs"); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_failed_widget_callback, + mifare_nested); + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_failed_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_failed_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_need_collection.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_need_collection.c new file mode 100644 index 000000000..ee6e76b40 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_need_collection.c @@ -0,0 +1,56 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_need_collection_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_need_collection_on_enter(void* context) { + MifareNested* mifare_nested = context; + Widget* widget = mifare_nested->widget; + + notification_message(mifare_nested->notifications, &sequence_error); + + widget_add_icon_element(widget, 73, 13, &I_DolphinCry); + widget_add_string_element( + widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Missing collected nonces"); + widget_add_string_element( + widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "Run \"Nested attack\""); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_need_collection_widget_callback, + mifare_nested); + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_need_collection_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_need_collection_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_need_key_recovery.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_need_key_recovery.c new file mode 100644 index 000000000..e34b68137 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_need_key_recovery.c @@ -0,0 +1,59 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_need_key_recovery_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_need_key_recovery_on_enter(void* context) { + MifareNested* mifare_nested = context; + Widget* widget = mifare_nested->widget; + + notification_message(mifare_nested->notifications, &sequence_error); + + widget_add_icon_element(widget, 74, 13, &I_DolphinCry); + widget_add_string_element( + widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Missing found keys"); + widget_add_string_element( + widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "First you need to"); + widget_add_string_element(widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "recover keys"); + widget_add_string_element(widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "Read \"About\""); + widget_add_string_element(widget, 0, 42, AlignLeft, AlignTop, FontSecondary, "for more info"); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_need_key_recovery_widget_callback, + mifare_nested); + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_need_key_recovery_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_need_key_recovery_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_no_keys.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_no_keys.c new file mode 100644 index 000000000..138cbdbc8 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_no_keys.c @@ -0,0 +1,61 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_no_keys_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_no_keys_on_enter(void* context) { + MifareNested* mifare_nested = context; + Widget* widget = mifare_nested->widget; + + notification_message(mifare_nested->notifications, &sequence_success); + + widget_add_icon_element(widget, 73, 13, &I_DolphinCry); + widget_add_string_element(widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "No keys found"); + widget_add_string_element( + widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "Scan tag and find at"); + widget_add_string_element( + widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "least one key to"); + widget_add_string_element( + widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "start (save dump"); + widget_add_string_element( + widget, 0, 42, AlignLeft, AlignTop, FontSecondary, "after scanning!)"); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_no_keys_widget_callback, + mifare_nested); + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_no_keys_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_no_keys_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_nonces_collected.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_nonces_collected.c new file mode 100644 index 000000000..cc543645f --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_nonces_collected.c @@ -0,0 +1,58 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_nonces_collected_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_nonces_collected_on_enter(void* context) { + MifareNested* mifare_nested = context; + Widget* widget = mifare_nested->widget; + + notification_message(mifare_nested->notifications, &sequence_success); + + widget_add_icon_element(widget, 52, 17, &I_DolphinSuccess); + widget_add_string_element(widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Nonces collected"); + widget_add_string_element( + widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "Now you can run"); + widget_add_string_element(widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "script on your"); + widget_add_string_element(widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "PC to recover"); + widget_add_string_element(widget, 0, 42, AlignLeft, AlignTop, FontSecondary, "keys"); + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_nonces_collected_widget_callback, + mifare_nested); + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_nonces_collected_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_nonces_collected_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_settings.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_settings.c new file mode 100644 index 000000000..09d77f94b --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_settings.c @@ -0,0 +1,65 @@ +#include "../mifare_nested_i.h" +#include + +enum MifareNestedSettingsIndex { MifareNestedIndexBlock, MifareNestedIndexHardNested }; + +#define HARD_NESTED_COUNT 2 +const char* const hard_nested_text[HARD_NESTED_COUNT] = { + "No", + "Yes", +}; + +const bool hard_nested_value[HARD_NESTED_COUNT] = { + false, + true, +}; + +static void mifare_nested_scene_settings_set_hard_nested(VariableItem* item) { + MifareNested* mifare_nested = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); + + variable_item_set_current_value_text(item, hard_nested_text[index]); + mifare_nested->settings->only_hardnested = hard_nested_value[index]; +} + +void mifare_nested_scene_settings_on_enter(void* context) { + MifareNested* mifare_nested = context; + VariableItem* item; + uint8_t value_index; + + item = variable_item_list_add( + mifare_nested->variable_item_list, + "Hard Nested only:", + HARD_NESTED_COUNT, + mifare_nested_scene_settings_set_hard_nested, + mifare_nested); + + value_index = value_index_bool( + mifare_nested->settings->only_hardnested, hard_nested_value, HARD_NESTED_COUNT); + + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, hard_nested_text[value_index]); + + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewVariableList); +} + +bool mifare_nested_scene_settings_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == MifareNestedCustomEventSceneSettingLock) { + scene_manager_previous_scene(mifare_nested->scene_manager); + consumed = true; + } + } + + return consumed; +} + +void mifare_nested_scene_settings_on_exit(void* context) { + MifareNested* mifare_nested = context; + variable_item_list_set_selected_item(mifare_nested->variable_item_list, 0); + variable_item_list_reset(mifare_nested->variable_item_list); + scene_manager_set_scene_state(mifare_nested->scene_manager, MifareNestedSceneStart, 0); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_start.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_start.c new file mode 100644 index 000000000..e8ff25c67 --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_start.c @@ -0,0 +1,84 @@ +#include "../mifare_nested_i.h" +enum SubmenuIndex { + SubmenuIndexCollect, + SubmenuIndexCheck, + SubmenuIndexSettings, + SubmenuIndexAbout +}; + +void mifare_nested_scene_start_submenu_callback(void* context, uint32_t index) { + MifareNested* mifare_nested = context; + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, index); +} + +void mifare_nested_scene_start_on_enter(void* context) { + MifareNested* mifare_nested = context; + + Submenu* submenu = mifare_nested->submenu; + submenu_add_item( + submenu, + "Nested attack", + SubmenuIndexCollect, + mifare_nested_scene_start_submenu_callback, + mifare_nested); + + submenu_add_item( + submenu, + "Check found keys", + SubmenuIndexCheck, + mifare_nested_scene_start_submenu_callback, + mifare_nested); + + submenu_add_item( + submenu, + "Settings", + SubmenuIndexSettings, + mifare_nested_scene_start_submenu_callback, + mifare_nested); + + submenu_add_item( + submenu, + "About", + SubmenuIndexAbout, + mifare_nested_scene_start_submenu_callback, + mifare_nested); + + submenu_set_selected_item( + submenu, + scene_manager_get_scene_state(mifare_nested->scene_manager, MifareNestedSceneStart)); + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewMenu); +} + +bool mifare_nested_scene_start_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubmenuIndexCollect) { + mifare_nested->run = NestedRunAttack; + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneCheck); + consumed = true; + } else if(event.event == SubmenuIndexCheck) { + mifare_nested->run = NestedRunCheckKeys; + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneCheck); + consumed = true; + } else if(event.event == SubmenuIndexSettings) { + mifare_nested->keys->found_keys = 123; + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneSettings); + consumed = true; + } else if(event.event == SubmenuIndexAbout) { + scene_manager_next_scene(mifare_nested->scene_manager, MifareNestedSceneAbout); + consumed = true; + } + + scene_manager_set_scene_state( + mifare_nested->scene_manager, MifareNestedSceneStart, event.event); + } + + return consumed; +} + +void mifare_nested_scene_start_on_exit(void* context) { + MifareNested* mifare_nested = context; + submenu_reset(mifare_nested->submenu); +} diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_static_encrypted_nonce.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_static_encrypted_nonce.c new file mode 100644 index 000000000..92cefa72c --- /dev/null +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_static_encrypted_nonce.c @@ -0,0 +1,58 @@ +#include "../mifare_nested_i.h" + +void mifare_nested_scene_static_encrypted_nonce_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + MifareNested* mifare_nested = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(mifare_nested->view_dispatcher, result); + } +} + +void mifare_nested_scene_static_encrypted_nonce_on_enter(void* context) { + MifareNested* mifare_nested = context; + Widget* widget = mifare_nested->widget; + + notification_message(mifare_nested->notifications, &sequence_error); + + widget_add_icon_element(widget, 73, 12, &I_DolphinCry); + widget_add_string_element( + widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Static encrypted nonce"); + widget_add_string_element(widget, 0, 12, AlignLeft, AlignTop, FontSecondary, "This tag isn't"); + widget_add_string_element(widget, 0, 22, AlignLeft, AlignTop, FontSecondary, "vulnerable to"); + widget_add_string_element(widget, 0, 32, AlignLeft, AlignTop, FontSecondary, "Nested attack"); + + widget_add_button_element( + widget, + GuiButtonTypeLeft, + "Back", + mifare_nested_scene_static_encrypted_nonce_widget_callback, + mifare_nested); + + // Setup and start worker + view_dispatcher_switch_to_view(mifare_nested->view_dispatcher, MifareNestedViewWidget); +} + +bool mifare_nested_scene_static_encrypted_nonce_on_event(void* context, SceneManagerEvent event) { + MifareNested* mifare_nested = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeCenter || event.event == GuiButtonTypeLeft) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeBack) { + scene_manager_search_and_switch_to_previous_scene(mifare_nested->scene_manager, 0); + consumed = true; + } + + return consumed; +} + +void mifare_nested_scene_static_encrypted_nonce_on_exit(void* context) { + MifareNested* mifare_nested = context; + + widget_reset(mifare_nested->widget); +} diff --git a/applications/external/nfc_magic/application.fam b/applications/external/nfc_magic/application.fam index db0af81d4..717387d58 100644 --- a/applications/external/nfc_magic/application.fam +++ b/applications/external/nfc_magic/application.fam @@ -11,7 +11,7 @@ App( stack_size=4 * 1024, order=30, fap_icon="../../../assets/icons/Archive/Nfc_10px.png", - fap_category="Tools", + fap_category="NFC", fap_private_libs=[ Lib( name="magic", diff --git a/applications/external/nfc_magic/lib/magic/classic_gen1.c b/applications/external/nfc_magic/lib/magic/classic_gen1.c new file mode 100644 index 000000000..ebd2b0805 --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/classic_gen1.c @@ -0,0 +1,175 @@ +#include "classic_gen1.h" + +#include + +#define TAG "Magic" + +#define MAGIC_CMD_WUPA (0x40) +#define MAGIC_CMD_WIPE (0x41) +#define MAGIC_CMD_ACCESS (0x43) + +#define MAGIC_MIFARE_READ_CMD (0x30) +#define MAGIC_MIFARE_WRITE_CMD (0xA0) + +#define MAGIC_ACK (0x0A) + +#define MAGIC_BUFFER_SIZE (32) + +bool magic_gen1_wupa() { + bool magic_activated = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + // Start communication + tx_data[0] = MAGIC_CMD_WUPA; + ret = furi_hal_nfc_ll_txrx_bits( + tx_data, + 7, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_TX_MANUAL | FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON | + FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_RX_KEEP, + furi_hal_nfc_ll_ms2fc(20)); + if(ret != FuriHalNfcReturnIncompleteByte) break; + if(rx_len != 4) break; + if(rx_data[0] != MAGIC_ACK) break; + magic_activated = true; + } while(false); + + return magic_activated; +} + +bool magic_gen1_data_access_cmd() { + bool write_cmd_success = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + tx_data[0] = MAGIC_CMD_ACCESS; + ret = furi_hal_nfc_ll_txrx_bits( + tx_data, + 8, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_TX_MANUAL | FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON | + FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_RX_KEEP, + furi_hal_nfc_ll_ms2fc(20)); + if(ret != FuriHalNfcReturnIncompleteByte) break; + if(rx_len != 4) break; + if(rx_data[0] != MAGIC_ACK) break; + + write_cmd_success = true; + } while(false); + + return write_cmd_success; +} + +bool magic_gen1_read_block(uint8_t block_num, MfClassicBlock* data) { + furi_assert(data); + + bool read_success = false; + + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + tx_data[0] = MAGIC_MIFARE_READ_CMD; + tx_data[1] = block_num; + ret = furi_hal_nfc_ll_txrx_bits( + tx_data, + 2 * 8, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON, + furi_hal_nfc_ll_ms2fc(20)); + + if(ret != FuriHalNfcReturnOk) break; + if(rx_len != 16 * 8) break; + memcpy(data->value, rx_data, sizeof(data->value)); + read_success = true; + } while(false); + + return read_success; +} + +bool magic_gen1_write_blk(uint8_t block_num, MfClassicBlock* data) { + furi_assert(data); + + bool write_success = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + tx_data[0] = MAGIC_MIFARE_WRITE_CMD; + tx_data[1] = block_num; + ret = furi_hal_nfc_ll_txrx_bits( + tx_data, + 2 * 8, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON | FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_RX_KEEP, + furi_hal_nfc_ll_ms2fc(20)); + if(ret != FuriHalNfcReturnIncompleteByte) break; + if(rx_len != 4) break; + if(rx_data[0] != MAGIC_ACK) break; + + memcpy(tx_data, data->value, sizeof(data->value)); + ret = furi_hal_nfc_ll_txrx_bits( + tx_data, + 16 * 8, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON | FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_RX_KEEP, + furi_hal_nfc_ll_ms2fc(20)); + if(ret != FuriHalNfcReturnIncompleteByte) break; + if(rx_len != 4) break; + if(rx_data[0] != MAGIC_ACK) break; + + write_success = true; + } while(false); + + return write_success; +} + +bool magic_gen1_wipe() { + bool wipe_success = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + tx_data[0] = MAGIC_CMD_WIPE; + ret = furi_hal_nfc_ll_txrx_bits( + tx_data, + 8, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_TX_MANUAL | FURI_HAL_NFC_LL_TXRX_FLAGS_AGC_ON | + FURI_HAL_NFC_LL_TXRX_FLAGS_CRC_RX_KEEP, + furi_hal_nfc_ll_ms2fc(2000)); + + if(ret != FuriHalNfcReturnIncompleteByte) break; + if(rx_len != 4) break; + if(rx_data[0] != MAGIC_ACK) break; + + wipe_success = true; + } while(false); + + return wipe_success; +} \ No newline at end of file diff --git a/applications/external/nfc_magic/lib/magic/classic_gen1.h b/applications/external/nfc_magic/lib/magic/classic_gen1.h new file mode 100644 index 000000000..6d4ff6dcd --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/classic_gen1.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +bool magic_gen1_wupa(); + +bool magic_gen1_read_block(uint8_t block_num, MfClassicBlock* data); + +bool magic_gen1_data_access_cmd(); + +bool magic_gen1_write_blk(uint8_t block_num, MfClassicBlock* data); + +bool magic_gen1_wipe(); \ No newline at end of file diff --git a/applications/external/nfc_magic/lib/magic/common.c b/applications/external/nfc_magic/lib/magic/common.c new file mode 100644 index 000000000..0ea3cb218 --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/common.c @@ -0,0 +1,33 @@ +#include "common.h" + +#include + +#define REQA (0x26) +#define CL1_PREFIX (0x93) +#define SELECT (0x70) + +#define MAGIC_BUFFER_SIZE (32) + +bool magic_activate() { + FuriHalNfcReturn ret = 0; + + // Setup nfc poller + furi_hal_nfc_exit_sleep(); + furi_hal_nfc_ll_txrx_on(); + furi_hal_nfc_ll_poll(); + ret = furi_hal_nfc_ll_set_mode( + FuriHalNfcModePollNfca, FuriHalNfcBitrate106, FuriHalNfcBitrate106); + if(ret != FuriHalNfcReturnOk) return false; + + furi_hal_nfc_ll_set_fdt_listen(FURI_HAL_NFC_LL_FDT_LISTEN_NFCA_POLLER); + furi_hal_nfc_ll_set_fdt_poll(FURI_HAL_NFC_LL_FDT_POLL_NFCA_POLLER); + furi_hal_nfc_ll_set_error_handling(FuriHalNfcErrorHandlingNfc); + furi_hal_nfc_ll_set_guard_time(FURI_HAL_NFC_LL_GT_NFCA); + + return true; +} + +void magic_deactivate() { + furi_hal_nfc_ll_txrx_off(); + furi_hal_nfc_sleep(); +} \ No newline at end of file diff --git a/applications/external/nfc_magic/lib/magic/common.h b/applications/external/nfc_magic/lib/magic/common.h new file mode 100644 index 000000000..bef166c8f --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/common.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include + +typedef enum { + MagicTypeClassicGen1, + MagicTypeClassicDirectWrite, + MagicTypeClassicAPDU, + MagicTypeUltralightGen1, + MagicTypeUltralightDirectWrite, + MagicTypeUltralightC_Gen1, + MagicTypeUltralightC_DirectWrite, + MagicTypeGen4, +} MagicType; + +bool magic_activate(); + +void magic_deactivate(); \ No newline at end of file diff --git a/applications/external/nfc_magic/lib/magic/gen4.c b/applications/external/nfc_magic/lib/magic/gen4.c new file mode 100644 index 000000000..31be649a0 --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/gen4.c @@ -0,0 +1,199 @@ +#include "gen4.h" + +#include +#include + +#define TAG "Magic" + +#define MAGIC_CMD_PREFIX (0xCF) + +#define MAGIC_CMD_GET_CFG (0xC6) +#define MAGIC_CMD_WRITE (0xCD) +#define MAGIC_CMD_READ (0xCE) +#define MAGIC_CMD_SET_CFG (0xF0) +#define MAGIC_CMD_FUSE_CFG (0xF1) +#define MAGIC_CMD_SET_PWD (0xFE) + +#define MAGIC_BUFFER_SIZE (40) + +const uint8_t MAGIC_DEFAULT_CONFIG[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x78, 0x00, 0x91, 0x02, 0xDA, 0xBC, 0x19, 0x10, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x04, 0x00, 0x08, 0x00 +}; + +const uint8_t MAGIC_DEFAULT_BLOCK0[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x04, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +const uint8_t MAGIC_EMPTY_BLOCK[16] = { 0 }; + +const uint8_t MAGIC_DEFAULT_SECTOR_TRAILER[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; + +static bool magic_gen4_is_block_num_trailer(uint8_t n) { + n++; + if (n < 32 * 4) { + return (n % 4 == 0); + } + + return (n % 16 == 0); +} + +bool magic_gen4_get_cfg(uint32_t pwd, uint8_t* config) { + bool is_valid_config_len = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + // Start communication + tx_data[0] = MAGIC_CMD_PREFIX; + tx_data[1] = (uint8_t)(pwd >> 24); + tx_data[2] = (uint8_t)(pwd >> 16); + tx_data[3] = (uint8_t)(pwd >> 8); + tx_data[4] = (uint8_t)pwd; + tx_data[5] = MAGIC_CMD_GET_CFG; + ret = furi_hal_nfc_ll_txrx( + tx_data, + 6, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_TXRX_DEFAULT, + furi_hal_nfc_ll_ms2fc(20)); + if(ret != FuriHalNfcReturnOk) break; + if(rx_len != 30 && rx_len != 32) break; + memcpy(config, rx_data, rx_len); + is_valid_config_len = true; + } while(false); + + return is_valid_config_len; +} + +bool magic_gen4_set_cfg(uint32_t pwd, const uint8_t* config, uint8_t config_length, bool fuse) { + bool write_success = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + // Start communication + tx_data[0] = MAGIC_CMD_PREFIX; + tx_data[1] = (uint8_t)(pwd >> 24); + tx_data[2] = (uint8_t)(pwd >> 16); + tx_data[3] = (uint8_t)(pwd >> 8); + tx_data[4] = (uint8_t)pwd; + tx_data[5] = fuse ? MAGIC_CMD_FUSE_CFG : MAGIC_CMD_SET_CFG; + memcpy(tx_data + 6, config, config_length); + ret = furi_hal_nfc_ll_txrx( + tx_data, + 6 + config_length, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_TXRX_DEFAULT, + furi_hal_nfc_ll_ms2fc(20)); + if(ret != FuriHalNfcReturnOk) break; + if(rx_len != 2) break; + write_success = true; + } while(false); + + return write_success; +} + +bool magic_gen4_set_pwd(uint32_t old_pwd, uint32_t new_pwd) { + bool change_success = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + // Start communication + tx_data[0] = MAGIC_CMD_PREFIX; + tx_data[1] = (uint8_t)(old_pwd >> 24); + tx_data[2] = (uint8_t)(old_pwd >> 16); + tx_data[3] = (uint8_t)(old_pwd >> 8); + tx_data[4] = (uint8_t)old_pwd; + tx_data[5] = MAGIC_CMD_SET_PWD; + tx_data[6] = (uint8_t)(new_pwd >> 24); + tx_data[7] = (uint8_t)(new_pwd >> 16); + tx_data[8] = (uint8_t)(new_pwd >> 8); + tx_data[9] = (uint8_t)new_pwd; + ret = furi_hal_nfc_ll_txrx( + tx_data, + 10, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_TXRX_DEFAULT, + furi_hal_nfc_ll_ms2fc(20)); + FURI_LOG_I(TAG, "ret %d, len %d", ret, rx_len); + if(ret != FuriHalNfcReturnOk) break; + if(rx_len != 2) break; + change_success = true; + } while(false); + + return change_success; +} + +bool magic_gen4_write_blk(uint32_t pwd, uint8_t block_num, const uint8_t* data) { + bool write_success = false; + uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; + uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; + uint16_t rx_len = 0; + FuriHalNfcReturn ret = 0; + + do { + // Start communication + tx_data[0] = MAGIC_CMD_PREFIX; + tx_data[1] = (uint8_t)(pwd >> 24); + tx_data[2] = (uint8_t)(pwd >> 16); + tx_data[3] = (uint8_t)(pwd >> 8); + tx_data[4] = (uint8_t)pwd; + tx_data[5] = MAGIC_CMD_WRITE; + tx_data[6] = block_num; + memcpy(tx_data + 7, data, 16); + ret = furi_hal_nfc_ll_txrx( + tx_data, + 23, + rx_data, + sizeof(rx_data), + &rx_len, + FURI_HAL_NFC_TXRX_DEFAULT, + furi_hal_nfc_ll_ms2fc(200)); + if(ret != FuriHalNfcReturnOk) break; + if(rx_len != 2) break; + write_success = true; + } while(false); + + return write_success; +} + +bool magic_gen4_wipe(uint32_t pwd) { + if(!magic_gen4_set_cfg(pwd, MAGIC_DEFAULT_CONFIG, sizeof(MAGIC_DEFAULT_CONFIG), false)) { + FURI_LOG_E(TAG, "Set config failed"); + return false; + } + if(!magic_gen4_write_blk(pwd, 0, MAGIC_DEFAULT_BLOCK0)) { + FURI_LOG_E(TAG, "Block 0 write failed"); + return false; + } + for(size_t i = 1; i < 64; i++) { + const uint8_t* block = magic_gen4_is_block_num_trailer(i) ? MAGIC_DEFAULT_SECTOR_TRAILER : MAGIC_EMPTY_BLOCK; + if(!magic_gen4_write_blk(pwd, i, block)) { + FURI_LOG_E(TAG, "Block %d write failed", i); + return false; + } + } + for(size_t i = 65; i < 256; i++) { + if(!magic_gen4_write_blk(pwd, i, MAGIC_EMPTY_BLOCK)) { + FURI_LOG_E(TAG, "Block %d write failed", i); + return false; + } + } + + return true; +} \ No newline at end of file diff --git a/applications/external/nfc_magic/lib/magic/gen4.h b/applications/external/nfc_magic/lib/magic/gen4.h new file mode 100644 index 000000000..c515af820 --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/gen4.h @@ -0,0 +1,48 @@ +#pragma once + +#include + +#define MAGIC_GEN4_DEFAULT_PWD 0x00000000 +#define MAGIC_GEN4_CONFIG_LEN 32 + +#define NFCID1_SINGLE_SIZE 4 +#define NFCID1_DOUBLE_SIZE 7 +#define NFCID1_TRIPLE_SIZE 10 + +typedef enum { + MagicGen4UIDLengthSingle = 0x00, + MagicGen4UIDLengthDouble = 0x01, + MagicGen4UIDLengthTriple = 0x02 +} MagicGen4UIDLength; + +typedef enum { + MagicGen4UltralightModeUL_EV1 = 0x00, + MagicGen4UltralightModeNTAG = 0x01, + MagicGen4UltralightModeUL_C = 0x02, + MagicGen4UltralightModeUL = 0x03 +} MagicGen4UltralightMode; + +typedef enum { + // for writing original (shadow) data + MagicGen4ShadowModePreWrite = 0x00, + // written data can be read once before restored to original + MagicGen4ShadowModeRestore = 0x01, + // written data is discarded + MagicGen4ShadowModeIgnore = 0x02, + // apparently for UL? + MagicGen4ShadowModeHighSpeedIgnore = 0x03 +} MagicGen4ShadowMode; + +bool magic_gen4_get_cfg(uint32_t pwd, uint8_t* config); + +bool magic_gen4_set_cfg(uint32_t pwd, const uint8_t* config, uint8_t config_length, bool fuse); + +bool magic_gen4_set_pwd(uint32_t old_pwd, uint32_t new_pwd); + +bool magic_gen4_read_blk(uint32_t pwd, uint8_t block_num, uint8_t* data); + +bool magic_gen4_write_blk(uint32_t pwd, uint8_t block_num, const uint8_t* data); + +bool magic_gen4_wipe(uint32_t pwd); + +void magic_gen4_deactivate(); diff --git a/applications/external/nfc_magic/lib/magic/magic.c b/applications/external/nfc_magic/lib/magic/magic.c index 9a71daaa0..ebd2b0805 100644 --- a/applications/external/nfc_magic/lib/magic/magic.c +++ b/applications/external/nfc_magic/lib/magic/magic.c @@ -1,4 +1,4 @@ -#include "magic.h" +#include "classic_gen1.h" #include @@ -15,7 +15,7 @@ #define MAGIC_BUFFER_SIZE (32) -bool magic_wupa() { +bool magic_gen1_wupa() { bool magic_activated = false; uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; @@ -23,19 +23,6 @@ bool magic_wupa() { FuriHalNfcReturn ret = 0; do { - // Setup nfc poller - furi_hal_nfc_exit_sleep(); - furi_hal_nfc_ll_txrx_on(); - furi_hal_nfc_ll_poll(); - ret = furi_hal_nfc_ll_set_mode( - FuriHalNfcModePollNfca, FuriHalNfcBitrate106, FuriHalNfcBitrate106); - if(ret != FuriHalNfcReturnOk) break; - - furi_hal_nfc_ll_set_fdt_listen(FURI_HAL_NFC_LL_FDT_LISTEN_NFCA_POLLER); - furi_hal_nfc_ll_set_fdt_poll(FURI_HAL_NFC_LL_FDT_POLL_NFCA_POLLER); - furi_hal_nfc_ll_set_error_handling(FuriHalNfcErrorHandlingNfc); - furi_hal_nfc_ll_set_guard_time(FURI_HAL_NFC_LL_GT_NFCA); - // Start communication tx_data[0] = MAGIC_CMD_WUPA; ret = furi_hal_nfc_ll_txrx_bits( @@ -53,15 +40,10 @@ bool magic_wupa() { magic_activated = true; } while(false); - if(!magic_activated) { - furi_hal_nfc_ll_txrx_off(); - furi_hal_nfc_start_sleep(); - } - return magic_activated; } -bool magic_data_access_cmd() { +bool magic_gen1_data_access_cmd() { bool write_cmd_success = false; uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; @@ -86,15 +68,10 @@ bool magic_data_access_cmd() { write_cmd_success = true; } while(false); - if(!write_cmd_success) { - furi_hal_nfc_ll_txrx_off(); - furi_hal_nfc_start_sleep(); - } - return write_cmd_success; } -bool magic_read_block(uint8_t block_num, MfClassicBlock* data) { +bool magic_gen1_read_block(uint8_t block_num, MfClassicBlock* data) { furi_assert(data); bool read_success = false; @@ -122,15 +99,10 @@ bool magic_read_block(uint8_t block_num, MfClassicBlock* data) { read_success = true; } while(false); - if(!read_success) { - furi_hal_nfc_ll_txrx_off(); - furi_hal_nfc_start_sleep(); - } - return read_success; } -bool magic_write_blk(uint8_t block_num, MfClassicBlock* data) { +bool magic_gen1_write_blk(uint8_t block_num, MfClassicBlock* data) { furi_assert(data); bool write_success = false; @@ -170,15 +142,10 @@ bool magic_write_blk(uint8_t block_num, MfClassicBlock* data) { write_success = true; } while(false); - if(!write_success) { - furi_hal_nfc_ll_txrx_off(); - furi_hal_nfc_start_sleep(); - } - return write_success; } -bool magic_wipe() { +bool magic_gen1_wipe() { bool wipe_success = false; uint8_t tx_data[MAGIC_BUFFER_SIZE] = {}; uint8_t rx_data[MAGIC_BUFFER_SIZE] = {}; @@ -205,9 +172,4 @@ bool magic_wipe() { } while(false); return wipe_success; -} - -void magic_deactivate() { - furi_hal_nfc_ll_txrx_off(); - furi_hal_nfc_sleep(); -} +} \ No newline at end of file diff --git a/applications/external/nfc_magic/lib/magic/magic.h b/applications/external/nfc_magic/lib/magic/magic.h deleted file mode 100644 index 64c60a0a7..000000000 --- a/applications/external/nfc_magic/lib/magic/magic.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -bool magic_wupa(); - -bool magic_read_block(uint8_t block_num, MfClassicBlock* data); - -bool magic_data_access_cmd(); - -bool magic_write_blk(uint8_t block_num, MfClassicBlock* data); - -bool magic_wipe(); - -void magic_deactivate(); diff --git a/applications/external/nfc_magic/lib/magic/types.c b/applications/external/nfc_magic/lib/magic/types.c new file mode 100644 index 000000000..77c6c0a4e --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/types.c @@ -0,0 +1,23 @@ +#include "types.h" + +const char* nfc_magic_type(MagicType type) { + if(type == MagicTypeClassicGen1) { + return "Classic Gen 1A/B"; + } else if(type == MagicTypeClassicDirectWrite) { + return "Classic DirectWrite"; + } else if(type == MagicTypeClassicAPDU) { + return "Classic APDU"; + } else if(type == MagicTypeUltralightGen1) { + return "Ultralight Gen 1"; + } else if(type == MagicTypeUltralightDirectWrite) { + return "Ultralight DirectWrite"; + } else if(type == MagicTypeUltralightC_Gen1) { + return "Ultralight-C Gen 1"; + } else if(type == MagicTypeUltralightC_DirectWrite) { + return "Ultralight-C DirectWrite"; + } else if(type == MagicTypeGen4) { + return "Gen 4 GTU"; + } else { + return "Unknown"; + } +} diff --git a/applications/external/nfc_magic/lib/magic/types.h b/applications/external/nfc_magic/lib/magic/types.h new file mode 100644 index 000000000..dbf554063 --- /dev/null +++ b/applications/external/nfc_magic/lib/magic/types.h @@ -0,0 +1,5 @@ +#pragma once + +#include "common.h" + +const char* nfc_magic_type(MagicType type); \ No newline at end of file diff --git a/applications/external/nfc_magic/nfc_magic.c b/applications/external/nfc_magic/nfc_magic.c index 1805f35ed..68c9a65b5 100644 --- a/applications/external/nfc_magic/nfc_magic.c +++ b/applications/external/nfc_magic/nfc_magic.c @@ -48,8 +48,9 @@ NfcMagic* nfc_magic_alloc() { nfc_magic->view_dispatcher, nfc_magic_tick_event_callback, 100); // Nfc device - nfc_magic->nfc_dev = nfc_device_alloc(); - furi_string_set(nfc_magic->nfc_dev->folder, NFC_APP_FOLDER); + nfc_magic->dev = malloc(sizeof(NfcMagicDevice)); + nfc_magic->source_dev = nfc_device_alloc(); + furi_string_set(nfc_magic->source_dev->folder, NFC_APP_FOLDER); // Open GUI record nfc_magic->gui = furi_record_open(RECORD_GUI); @@ -81,6 +82,13 @@ NfcMagic* nfc_magic_alloc() { NfcMagicViewTextInput, text_input_get_view(nfc_magic->text_input)); + // Byte Input + nfc_magic->byte_input = byte_input_alloc(); + view_dispatcher_add_view( + nfc_magic->view_dispatcher, + NfcMagicViewByteInput, + byte_input_get_view(nfc_magic->byte_input)); + // Custom Widget nfc_magic->widget = widget_alloc(); view_dispatcher_add_view( @@ -93,7 +101,8 @@ void nfc_magic_free(NfcMagic* nfc_magic) { furi_assert(nfc_magic); // Nfc device - nfc_device_free(nfc_magic->nfc_dev); + free(nfc_magic->dev); + nfc_device_free(nfc_magic->source_dev); // Submenu view_dispatcher_remove_view(nfc_magic->view_dispatcher, NfcMagicViewMenu); @@ -107,10 +116,14 @@ void nfc_magic_free(NfcMagic* nfc_magic) { view_dispatcher_remove_view(nfc_magic->view_dispatcher, NfcMagicViewLoading); loading_free(nfc_magic->loading); - // TextInput + // Text Input view_dispatcher_remove_view(nfc_magic->view_dispatcher, NfcMagicViewTextInput); text_input_free(nfc_magic->text_input); + // Byte Input + view_dispatcher_remove_view(nfc_magic->view_dispatcher, NfcMagicViewByteInput); + byte_input_free(nfc_magic->byte_input); + // Custom Widget view_dispatcher_remove_view(nfc_magic->view_dispatcher, NfcMagicViewWidget); widget_free(nfc_magic->widget); @@ -164,6 +177,7 @@ int32_t nfc_magic_app(void* p) { view_dispatcher_run(nfc_magic->view_dispatcher); + magic_deactivate(); nfc_magic_free(nfc_magic); return 0; diff --git a/applications/external/nfc_magic/nfc_magic.h b/applications/external/nfc_magic/nfc_magic.h index 1abf1371e..f9cf395d8 100644 --- a/applications/external/nfc_magic/nfc_magic.h +++ b/applications/external/nfc_magic/nfc_magic.h @@ -1,3 +1,5 @@ #pragma once +typedef struct NfcMagicDevice NfcMagicDevice; + typedef struct NfcMagic NfcMagic; diff --git a/applications/external/nfc_magic/nfc_magic_i.h b/applications/external/nfc_magic/nfc_magic_i.h index 378912e5b..4d6b89103 100644 --- a/applications/external/nfc_magic/nfc_magic_i.h +++ b/applications/external/nfc_magic/nfc_magic_i.h @@ -3,7 +3,10 @@ #include "nfc_magic.h" #include "nfc_magic_worker.h" -#include "lib/magic/magic.h" +#include "lib/magic/common.h" +#include "lib/magic/types.h" +#include "lib/magic/classic_gen1.h" +#include "lib/magic/gen4.h" #include #include @@ -15,6 +18,7 @@ #include #include #include +#include #include #include @@ -39,14 +43,22 @@ enum NfcMagicCustomEvent { NfcMagicCustomEventTextInputDone, }; +struct NfcMagicDevice { + MagicType type; + uint32_t cuid; + uint32_t password; +}; + struct NfcMagic { NfcMagicWorker* worker; ViewDispatcher* view_dispatcher; Gui* gui; NotificationApp* notifications; SceneManager* scene_manager; - // NfcMagicDevice* dev; - NfcDevice* nfc_dev; + struct NfcMagicDevice* dev; + NfcDevice* source_dev; + + uint32_t new_password; FuriString* text_box_store; @@ -55,6 +67,7 @@ struct NfcMagic { Popup* popup; Loading* loading; TextInput* text_input; + ByteInput* byte_input; Widget* widget; }; @@ -63,6 +76,7 @@ typedef enum { NfcMagicViewPopup, NfcMagicViewLoading, NfcMagicViewTextInput, + NfcMagicViewByteInput, NfcMagicViewWidget, } NfcMagicView; diff --git a/applications/external/nfc_magic/nfc_magic_worker.c b/applications/external/nfc_magic/nfc_magic_worker.c index 1564c87cd..cc13476c4 100644 --- a/applications/external/nfc_magic/nfc_magic_worker.c +++ b/applications/external/nfc_magic/nfc_magic_worker.c @@ -1,6 +1,9 @@ #include "nfc_magic_worker_i.h" -#include "lib/magic/magic.h" +#include "nfc_magic_i.h" +#include "lib/magic/common.h" +#include "lib/magic/classic_gen1.h" +#include "lib/magic/gen4.h" #define TAG "NfcMagicWorker" @@ -43,10 +46,13 @@ void nfc_magic_worker_stop(NfcMagicWorker* nfc_magic_worker) { void nfc_magic_worker_start( NfcMagicWorker* nfc_magic_worker, NfcMagicWorkerState state, + NfcMagicDevice* magic_dev, NfcDeviceData* dev_data, + uint32_t new_password, NfcMagicWorkerCallback callback, void* context) { furi_assert(nfc_magic_worker); + furi_assert(magic_dev); furi_assert(dev_data); furi_hal_nfc_deinit(); @@ -54,7 +60,9 @@ void nfc_magic_worker_start( nfc_magic_worker->callback = callback; nfc_magic_worker->context = context; + nfc_magic_worker->magic_dev = magic_dev; nfc_magic_worker->dev_data = dev_data; + nfc_magic_worker->new_password = new_password; nfc_magic_worker_change_state(nfc_magic_worker, state); furi_thread_start(nfc_magic_worker->thread); } @@ -66,6 +74,8 @@ int32_t nfc_magic_worker_task(void* context) { nfc_magic_worker_check(nfc_magic_worker); } else if(nfc_magic_worker->state == NfcMagicWorkerStateWrite) { nfc_magic_worker_write(nfc_magic_worker); + } else if(nfc_magic_worker->state == NfcMagicWorkerStateRekey) { + nfc_magic_worker_rekey(nfc_magic_worker); } else if(nfc_magic_worker->state == NfcMagicWorkerStateWipe) { nfc_magic_worker_wipe(nfc_magic_worker); } @@ -77,59 +87,245 @@ int32_t nfc_magic_worker_task(void* context) { void nfc_magic_worker_write(NfcMagicWorker* nfc_magic_worker) { bool card_found_notified = false; + bool done = false; FuriHalNfcDevData nfc_data = {}; - MfClassicData* src_data = &nfc_magic_worker->dev_data->mf_classic_data; + NfcMagicDevice* magic_dev = nfc_magic_worker->magic_dev; + NfcDeviceData* dev_data = nfc_magic_worker->dev_data; + NfcProtocol dev_protocol = dev_data->protocol; while(nfc_magic_worker->state == NfcMagicWorkerStateWrite) { - if(furi_hal_nfc_detect(&nfc_data, 200)) { - if(!card_found_notified) { - nfc_magic_worker->callback( - NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); - card_found_notified = true; - } - furi_hal_nfc_sleep(); - if(!magic_wupa()) { - FURI_LOG_E(TAG, "No card response to WUPA (not a magic card)"); - nfc_magic_worker->callback( - NfcMagicWorkerEventWrongCard, nfc_magic_worker->context); - break; - } - furi_hal_nfc_sleep(); - } - if(magic_wupa()) { - if(!magic_data_access_cmd()) { - FURI_LOG_E(TAG, "No card response to data access command (not a magic card)"); - nfc_magic_worker->callback( - NfcMagicWorkerEventWrongCard, nfc_magic_worker->context); - break; - } - for(size_t i = 0; i < 64; i++) { - FURI_LOG_D(TAG, "Writing block %d", i); - if(!magic_write_blk(i, &src_data->block[i])) { - FURI_LOG_E(TAG, "Failed to write %d block", i); - nfc_magic_worker->callback(NfcMagicWorkerEventFail, nfc_magic_worker->context); + do { + if(furi_hal_nfc_detect(&nfc_data, 200)) { + if(nfc_data.cuid != magic_dev->cuid) break; + if(!card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); + card_found_notified = true; + } + furi_hal_nfc_sleep(); + + magic_activate(); + if(magic_dev->type == MagicTypeClassicGen1) { + if(dev_protocol != NfcDeviceProtocolMifareClassic) break; + MfClassicData* mfc_data = &dev_data->mf_classic_data; + + if(mfc_data->type != MfClassicType1k) break; + if(!magic_gen1_wupa()) { + FURI_LOG_E(TAG, "Not Magic card"); + nfc_magic_worker->callback( + NfcMagicWorkerEventWrongCard, nfc_magic_worker->context); + done = true; + break; + } + if(!magic_gen1_data_access_cmd()) { + FURI_LOG_E(TAG, "Not Magic card"); + nfc_magic_worker->callback( + NfcMagicWorkerEventWrongCard, nfc_magic_worker->context); + done = true; + break; + } + for(size_t i = 0; i < 64; i++) { + FURI_LOG_D(TAG, "Writing block %d", i); + if(!magic_gen1_write_blk(i, &mfc_data->block[i])) { + FURI_LOG_E(TAG, "Failed to write %d block", i); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + } + + nfc_magic_worker->callback( + NfcMagicWorkerEventSuccess, nfc_magic_worker->context); + done = true; + break; + } else if(magic_dev->type == MagicTypeGen4) { + uint8_t gen4_config[28]; + uint32_t password = magic_dev->password; + + uint32_t cuid; + if(dev_protocol == NfcDeviceProtocolMifareClassic) { + gen4_config[0] = 0x00; + gen4_config[27] = 0x00; + } else if(dev_protocol == NfcDeviceProtocolMifareUl) { + MfUltralightData* mf_ul_data = &dev_data->mf_ul_data; + gen4_config[0] = 0x01; + switch(mf_ul_data->type) { + case MfUltralightTypeUL11: + case MfUltralightTypeUL21: + // UL-C? + // UL? + default: + gen4_config[27] = MagicGen4UltralightModeUL_EV1; + break; + case MfUltralightTypeNTAG203: + case MfUltralightTypeNTAG213: + case MfUltralightTypeNTAG215: + case MfUltralightTypeNTAG216: + case MfUltralightTypeNTAGI2C1K: + case MfUltralightTypeNTAGI2C2K: + case MfUltralightTypeNTAGI2CPlus1K: + case MfUltralightTypeNTAGI2CPlus2K: + gen4_config[27] = MagicGen4UltralightModeNTAG; + break; + } + } + + if(dev_data->nfc_data.uid_len == 4) { + gen4_config[1] = MagicGen4UIDLengthSingle; + } else if(dev_data->nfc_data.uid_len == 7) { + gen4_config[1] = MagicGen4UIDLengthDouble; + } else { + FURI_LOG_E(TAG, "Unexpected UID length %d", dev_data->nfc_data.uid_len); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + + gen4_config[2] = (uint8_t)(password >> 24); + gen4_config[3] = (uint8_t)(password >> 16); + gen4_config[4] = (uint8_t)(password >> 8); + gen4_config[5] = (uint8_t)password; + + if(dev_protocol == NfcDeviceProtocolMifareUl) { + gen4_config[6] = MagicGen4ShadowModeHighSpeedIgnore; + } else { + gen4_config[6] = MagicGen4ShadowModeIgnore; + } + gen4_config[7] = 0x00; + memset(gen4_config + 8, 0, 16); + gen4_config[24] = dev_data->nfc_data.atqa[0]; + gen4_config[25] = dev_data->nfc_data.atqa[1]; + gen4_config[26] = dev_data->nfc_data.sak; + + furi_hal_nfc_activate_nfca(200, &cuid); + if(!magic_gen4_set_cfg(password, gen4_config, sizeof(gen4_config), false)) { + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + if(dev_protocol == NfcDeviceProtocolMifareClassic) { + MfClassicData* mfc_data = &dev_data->mf_classic_data; + size_t block_count = 64; + if(mfc_data->type == MfClassicType4k) block_count = 256; + for(size_t i = 0; i < block_count; i++) { + FURI_LOG_D(TAG, "Writing block %d", i); + if(!magic_gen4_write_blk(password, i, mfc_data->block[i].value)) { + FURI_LOG_E(TAG, "Failed to write %d block", i); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + } + } else if(dev_protocol == NfcDeviceProtocolMifareUl) { + MfUltralightData* mf_ul_data = &dev_data->mf_ul_data; + for(size_t i = 0; (i * 4) < mf_ul_data->data_read; i++) { + size_t data_offset = i * 4; + FURI_LOG_D( + TAG, + "Writing page %zu (%zu/%u)", + i, + data_offset, + mf_ul_data->data_read); + uint8_t* block = mf_ul_data->data + data_offset; + if(!magic_gen4_write_blk(password, i, block)) { + FURI_LOG_E(TAG, "Failed to write %zu page", i); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + } + + uint8_t buffer[16] = {0}; + + for(size_t i = 0; i < 8; i++) { + memcpy(buffer, &mf_ul_data->signature[i * 4], 4); //-V1086 + if(!magic_gen4_write_blk(password, 0xF2 + i, buffer)) { + FURI_LOG_E(TAG, "Failed to write signature block %d", i); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + } + + buffer[0] = mf_ul_data->version.header; + buffer[1] = mf_ul_data->version.vendor_id; + buffer[2] = mf_ul_data->version.prod_type; + buffer[3] = mf_ul_data->version.prod_subtype; + if(!magic_gen4_write_blk(password, 0xFA, buffer)) { + FURI_LOG_E(TAG, "Failed to write version block 0"); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + + buffer[0] = mf_ul_data->version.prod_ver_major; + buffer[1] = mf_ul_data->version.prod_ver_minor; + buffer[2] = mf_ul_data->version.storage_size; + buffer[3] = mf_ul_data->version.protocol_type; + if(!magic_gen4_write_blk(password, 0xFB, buffer)) { + FURI_LOG_E(TAG, "Failed to write version block 1"); + nfc_magic_worker->callback( + NfcMagicWorkerEventFail, nfc_magic_worker->context); + done = true; + break; + } + } + + nfc_magic_worker->callback( + NfcMagicWorkerEventSuccess, nfc_magic_worker->context); + done = true; break; } } - nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); - break; - } else { - if(card_found_notified) { - nfc_magic_worker->callback( - NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context); - card_found_notified = false; - } + } while(false); + + if(done) break; + + if(card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context); + card_found_notified = false; } + furi_delay_ms(300); } magic_deactivate(); } void nfc_magic_worker_check(NfcMagicWorker* nfc_magic_worker) { + NfcMagicDevice* magic_dev = nfc_magic_worker->magic_dev; bool card_found_notified = false; + uint8_t gen4_config[MAGIC_GEN4_CONFIG_LEN]; while(nfc_magic_worker->state == NfcMagicWorkerStateCheck) { - if(magic_wupa()) { + magic_activate(); + if(magic_gen1_wupa()) { + magic_dev->type = MagicTypeClassicGen1; + if(!card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); + card_found_notified = true; + } + + furi_hal_nfc_activate_nfca(200, &magic_dev->cuid); + nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); + break; + } + + magic_deactivate(); + furi_delay_ms(300); + magic_activate(); + + furi_hal_nfc_activate_nfca(200, &magic_dev->cuid); + if(magic_gen4_get_cfg(magic_dev->password, gen4_config)) { + magic_dev->type = MagicTypeGen4; if(!card_found_notified) { nfc_magic_worker->callback( NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); @@ -138,12 +334,56 @@ void nfc_magic_worker_check(NfcMagicWorker* nfc_magic_worker) { nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); break; - } else { + } + + if(card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context); + card_found_notified = false; + } + + magic_deactivate(); + furi_delay_ms(300); + } + + magic_deactivate(); +} + +void nfc_magic_worker_rekey(NfcMagicWorker* nfc_magic_worker) { + NfcMagicDevice* magic_dev = nfc_magic_worker->magic_dev; + bool card_found_notified = false; + + if(magic_dev->type != MagicTypeGen4) { + nfc_magic_worker->callback(NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); + return; + } + + while(nfc_magic_worker->state == NfcMagicWorkerStateRekey) { + magic_activate(); + uint32_t cuid; + furi_hal_nfc_activate_nfca(200, &cuid); + if(cuid != magic_dev->cuid) { if(card_found_notified) { nfc_magic_worker->callback( NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context); card_found_notified = false; } + continue; + } + + nfc_magic_worker->callback(NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); + card_found_notified = true; + + if(magic_gen4_set_pwd(magic_dev->password, nfc_magic_worker->new_password)) { + magic_dev->password = nfc_magic_worker->new_password; + nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); + break; + } + + if(card_found_notified) { //-V547 + nfc_magic_worker->callback( + NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context); + card_found_notified = false; } furi_delay_ms(300); } @@ -151,6 +391,10 @@ void nfc_magic_worker_check(NfcMagicWorker* nfc_magic_worker) { } void nfc_magic_worker_wipe(NfcMagicWorker* nfc_magic_worker) { + NfcMagicDevice* magic_dev = nfc_magic_worker->magic_dev; + bool card_found_notified = false; + bool card_wiped = false; + MfClassicBlock block; memset(&block, 0, sizeof(MfClassicBlock)); block.value[0] = 0x01; @@ -162,14 +406,48 @@ void nfc_magic_worker_wipe(NfcMagicWorker* nfc_magic_worker) { block.value[6] = 0x04; while(nfc_magic_worker->state == NfcMagicWorkerStateWipe) { - magic_deactivate(); - furi_delay_ms(300); - if(!magic_wupa()) continue; - if(!magic_wipe()) continue; - if(!magic_data_access_cmd()) continue; - if(!magic_write_blk(0, &block)) continue; - nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); - break; + do { + magic_deactivate(); + furi_delay_ms(300); + if(!magic_activate()) break; + if(magic_dev->type == MagicTypeClassicGen1) { + if(!magic_gen1_wupa()) break; + if(!card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); + card_found_notified = true; + } + + if(!magic_gen1_wipe()) break; + if(!magic_gen1_data_access_cmd()) break; + if(!magic_gen1_write_blk(0, &block)) break; + + card_wiped = true; + nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); + } else if(magic_dev->type == MagicTypeGen4) { + uint32_t cuid; + if(!furi_hal_nfc_activate_nfca(200, &cuid)) break; + if(cuid != magic_dev->cuid) break; + if(!card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventCardDetected, nfc_magic_worker->context); + card_found_notified = true; + } + + if(!magic_gen4_wipe(magic_dev->password)) break; + + card_wiped = true; + nfc_magic_worker->callback(NfcMagicWorkerEventSuccess, nfc_magic_worker->context); + } + } while(false); + + if(card_wiped) break; + + if(card_found_notified) { + nfc_magic_worker->callback( + NfcMagicWorkerEventNoCardDetected, nfc_magic_worker->context); + card_found_notified = false; + } } magic_deactivate(); } diff --git a/applications/external/nfc_magic/nfc_magic_worker.h b/applications/external/nfc_magic/nfc_magic_worker.h index 9d29bb3a8..51ff4ee43 100644 --- a/applications/external/nfc_magic/nfc_magic_worker.h +++ b/applications/external/nfc_magic/nfc_magic_worker.h @@ -1,6 +1,7 @@ #pragma once #include +#include "nfc_magic.h" typedef struct NfcMagicWorker NfcMagicWorker; @@ -9,6 +10,7 @@ typedef enum { NfcMagicWorkerStateCheck, NfcMagicWorkerStateWrite, + NfcMagicWorkerStateRekey, NfcMagicWorkerStateWipe, NfcMagicWorkerStateStop, @@ -33,6 +35,8 @@ void nfc_magic_worker_stop(NfcMagicWorker* nfc_magic_worker); void nfc_magic_worker_start( NfcMagicWorker* nfc_magic_worker, NfcMagicWorkerState state, + NfcMagicDevice* magic_dev, NfcDeviceData* dev_data, + uint32_t new_password, NfcMagicWorkerCallback callback, void* context); diff --git a/applications/external/nfc_magic/nfc_magic_worker_i.h b/applications/external/nfc_magic/nfc_magic_worker_i.h index 0cde2e712..a354f8047 100644 --- a/applications/external/nfc_magic/nfc_magic_worker_i.h +++ b/applications/external/nfc_magic/nfc_magic_worker_i.h @@ -3,11 +3,14 @@ #include #include "nfc_magic_worker.h" +#include "lib/magic/common.h" struct NfcMagicWorker { FuriThread* thread; + NfcMagicDevice* magic_dev; NfcDeviceData* dev_data; + uint32_t new_password; NfcMagicWorkerCallback callback; void* context; @@ -21,4 +24,6 @@ void nfc_magic_worker_check(NfcMagicWorker* nfc_magic_worker); void nfc_magic_worker_write(NfcMagicWorker* nfc_magic_worker); +void nfc_magic_worker_rekey(NfcMagicWorker* nfc_magic_worker); + void nfc_magic_worker_wipe(NfcMagicWorker* nfc_magic_worker); diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_actions.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_actions.c new file mode 100644 index 000000000..675262a9b --- /dev/null +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_actions.c @@ -0,0 +1,50 @@ +#include "../nfc_magic_i.h" +enum SubmenuIndex { + SubmenuIndexWrite, + SubmenuIndexWipe, +}; + +void nfc_magic_scene_actions_submenu_callback(void* context, uint32_t index) { + NfcMagic* nfc_magic = context; + view_dispatcher_send_custom_event(nfc_magic->view_dispatcher, index); +} + +void nfc_magic_scene_actions_on_enter(void* context) { + NfcMagic* nfc_magic = context; + + Submenu* submenu = nfc_magic->submenu; + submenu_add_item( + submenu, "Write", SubmenuIndexWrite, nfc_magic_scene_actions_submenu_callback, nfc_magic); + submenu_add_item( + submenu, "Wipe", SubmenuIndexWipe, nfc_magic_scene_actions_submenu_callback, nfc_magic); + + submenu_set_selected_item( + submenu, scene_manager_get_scene_state(nfc_magic->scene_manager, NfcMagicSceneActions)); + view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewMenu); +} + +bool nfc_magic_scene_actions_on_event(void* context, SceneManagerEvent event) { + NfcMagic* nfc_magic = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubmenuIndexWrite) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneFileSelect); + consumed = true; + } else if(event.event == SubmenuIndexWipe) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWipe); + consumed = true; + } + scene_manager_set_scene_state(nfc_magic->scene_manager, NfcMagicSceneActions, event.event); + } else if(event.type == SceneManagerEventTypeBack) { + consumed = scene_manager_search_and_switch_to_previous_scene( + nfc_magic->scene_manager, NfcMagicSceneStart); + } + + return consumed; +} + +void nfc_magic_scene_actions_on_exit(void* context) { + NfcMagic* nfc_magic = context; + submenu_reset(nfc_magic->submenu); +} diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_check.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_check.c index d51797242..90b43d7d3 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_check.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_check.c @@ -42,7 +42,9 @@ void nfc_magic_scene_check_on_enter(void* context) { nfc_magic_worker_start( nfc_magic->worker, NfcMagicWorkerStateCheck, - &nfc_magic->nfc_dev->dev_data, + nfc_magic->dev, + &nfc_magic->source_dev->dev_data, + nfc_magic->new_password, nfc_magic_check_worker_callback, nfc_magic); nfc_magic_blink_start(nfc_magic); diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_config.h b/applications/external/nfc_magic/scenes/nfc_magic_scene_config.h index 557e26914..2f9860d96 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_config.h +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_config.h @@ -1,4 +1,8 @@ ADD_SCENE(nfc_magic, start, Start) +ADD_SCENE(nfc_magic, key_input, KeyInput) +ADD_SCENE(nfc_magic, actions, Actions) +ADD_SCENE(nfc_magic, gen4_actions, Gen4Actions) +ADD_SCENE(nfc_magic, new_key_input, NewKeyInput) ADD_SCENE(nfc_magic, file_select, FileSelect) ADD_SCENE(nfc_magic, write_confirm, WriteConfirm) ADD_SCENE(nfc_magic, wrong_card, WrongCard) @@ -8,5 +12,7 @@ ADD_SCENE(nfc_magic, success, Success) ADD_SCENE(nfc_magic, check, Check) ADD_SCENE(nfc_magic, not_magic, NotMagic) ADD_SCENE(nfc_magic, magic_info, MagicInfo) +ADD_SCENE(nfc_magic, rekey, Rekey) +ADD_SCENE(nfc_magic, rekey_fail, RekeyFail) ADD_SCENE(nfc_magic, wipe, Wipe) ADD_SCENE(nfc_magic, wipe_fail, WipeFail) diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_file_select.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_file_select.c index d78422eeb..baa6bcccc 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_file_select.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_file_select.c @@ -1,22 +1,60 @@ #include "../nfc_magic_i.h" -static bool nfc_magic_scene_file_select_is_file_suitable(NfcDevice* nfc_dev) { - return (nfc_dev->format == NfcDeviceSaveFormatMifareClassic) && - (nfc_dev->dev_data.mf_classic_data.type == MfClassicType1k) && - (nfc_dev->dev_data.nfc_data.uid_len == 4); +static bool nfc_magic_scene_file_select_is_file_suitable(NfcMagic* nfc_magic) { + NfcDevice* nfc_dev = nfc_magic->source_dev; + if(nfc_dev->format == NfcDeviceSaveFormatMifareClassic) { + switch(nfc_magic->dev->type) { + case MagicTypeClassicGen1: + case MagicTypeClassicDirectWrite: + case MagicTypeClassicAPDU: + if((nfc_dev->dev_data.mf_classic_data.type != MfClassicType1k) || + (nfc_dev->dev_data.nfc_data.uid_len != 4)) { + return false; + } + return true; + + case MagicTypeGen4: + return true; + default: + return false; + } + } else if( + (nfc_dev->format == NfcDeviceSaveFormatMifareUl) && + (nfc_dev->dev_data.nfc_data.uid_len == 7)) { + switch(nfc_magic->dev->type) { + case MagicTypeUltralightGen1: + case MagicTypeUltralightDirectWrite: + case MagicTypeUltralightC_Gen1: + case MagicTypeUltralightC_DirectWrite: + case MagicTypeGen4: + switch(nfc_dev->dev_data.mf_ul_data.type) { + case MfUltralightTypeNTAGI2C1K: + case MfUltralightTypeNTAGI2C2K: + case MfUltralightTypeNTAGI2CPlus1K: + case MfUltralightTypeNTAGI2CPlus2K: + return false; + default: + return true; + } + default: + return false; + } + } + + return false; } void nfc_magic_scene_file_select_on_enter(void* context) { NfcMagic* nfc_magic = context; // Process file_select return - nfc_device_set_loading_callback(nfc_magic->nfc_dev, nfc_magic_show_loading_popup, nfc_magic); + nfc_device_set_loading_callback( + nfc_magic->source_dev, nfc_magic_show_loading_popup, nfc_magic); - if(!furi_string_size(nfc_magic->nfc_dev->load_path)) { - furi_string_set_str(nfc_magic->nfc_dev->load_path, NFC_APP_FOLDER); + if(!furi_string_size(nfc_magic->source_dev->load_path)) { + furi_string_set_str(nfc_magic->source_dev->load_path, NFC_APP_FOLDER); } - - if(nfc_file_select(nfc_magic->nfc_dev)) { - if(nfc_magic_scene_file_select_is_file_suitable(nfc_magic->nfc_dev)) { + if(nfc_file_select(nfc_magic->source_dev)) { + if(nfc_magic_scene_file_select_is_file_suitable(nfc_magic)) { scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWriteConfirm); } else { scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWrongCard); @@ -34,5 +72,5 @@ bool nfc_magic_scene_file_select_on_event(void* context, SceneManagerEvent event void nfc_magic_scene_file_select_on_exit(void* context) { NfcMagic* nfc_magic = context; - nfc_device_set_loading_callback(nfc_magic->nfc_dev, NULL, nfc_magic); + nfc_device_set_loading_callback(nfc_magic->source_dev, NULL, nfc_magic); } diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_gen4_actions.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_gen4_actions.c new file mode 100644 index 000000000..ceaa33e29 --- /dev/null +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_gen4_actions.c @@ -0,0 +1,70 @@ +#include "../nfc_magic_i.h" +enum SubmenuIndex { + SubmenuIndexWrite, + SubmenuIndexChangePassword, + SubmenuIndexWipe, +}; + +void nfc_magic_scene_gen4_actions_submenu_callback(void* context, uint32_t index) { + NfcMagic* nfc_magic = context; + view_dispatcher_send_custom_event(nfc_magic->view_dispatcher, index); +} + +void nfc_magic_scene_gen4_actions_on_enter(void* context) { + NfcMagic* nfc_magic = context; + + Submenu* submenu = nfc_magic->submenu; + submenu_add_item( + submenu, + "Write", + SubmenuIndexWrite, + nfc_magic_scene_gen4_actions_submenu_callback, + nfc_magic); + submenu_add_item( + submenu, + "Change password", + SubmenuIndexChangePassword, + nfc_magic_scene_gen4_actions_submenu_callback, + nfc_magic); + submenu_add_item( + submenu, + "Wipe", + SubmenuIndexWipe, + nfc_magic_scene_gen4_actions_submenu_callback, + nfc_magic); + + submenu_set_selected_item( + submenu, + scene_manager_get_scene_state(nfc_magic->scene_manager, NfcMagicSceneGen4Actions)); + view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewMenu); +} + +bool nfc_magic_scene_gen4_actions_on_event(void* context, SceneManagerEvent event) { + NfcMagic* nfc_magic = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubmenuIndexWrite) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneFileSelect); + consumed = true; + } else if(event.event == SubmenuIndexChangePassword) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneNewKeyInput); + consumed = true; + } else if(event.event == SubmenuIndexWipe) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWipe); + consumed = true; + } + scene_manager_set_scene_state( + nfc_magic->scene_manager, NfcMagicSceneGen4Actions, event.event); + } else if(event.type == SceneManagerEventTypeBack) { + consumed = scene_manager_search_and_switch_to_previous_scene( + nfc_magic->scene_manager, NfcMagicSceneStart); + } + + return consumed; +} + +void nfc_magic_scene_gen4_actions_on_exit(void* context) { + NfcMagic* nfc_magic = context; + submenu_reset(nfc_magic->submenu); +} diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_key_input.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_key_input.c new file mode 100644 index 000000000..58b487a09 --- /dev/null +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_key_input.c @@ -0,0 +1,45 @@ +#include "../nfc_magic_i.h" + +void nfc_magic_scene_key_input_byte_input_callback(void* context) { + NfcMagic* nfc_magic = context; + + view_dispatcher_send_custom_event( + nfc_magic->view_dispatcher, NfcMagicCustomEventByteInputDone); +} + +void nfc_magic_scene_key_input_on_enter(void* context) { + NfcMagic* nfc_magic = context; + + // Setup view + ByteInput* byte_input = nfc_magic->byte_input; + byte_input_set_header_text(byte_input, "Enter the password in hex"); + byte_input_set_result_callback( + byte_input, + nfc_magic_scene_key_input_byte_input_callback, + NULL, + nfc_magic, + (uint8_t*)&nfc_magic->dev->password, + 4); + view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewByteInput); +} + +bool nfc_magic_scene_key_input_on_event(void* context, SceneManagerEvent event) { + NfcMagic* nfc_magic = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == NfcMagicCustomEventByteInputDone) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneCheck); + consumed = true; + } + } + return consumed; +} + +void nfc_magic_scene_key_input_on_exit(void* context) { + NfcMagic* nfc_magic = context; + + // Clear view + byte_input_set_result_callback(nfc_magic->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(nfc_magic->byte_input, ""); +} diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_magic_info.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_magic_info.c index e9b226b3a..c147ac438 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_magic_info.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_magic_info.c @@ -1,4 +1,5 @@ #include "../nfc_magic_i.h" +#include "../lib/magic/types.h" void nfc_magic_scene_magic_info_widget_callback( GuiButtonType result, @@ -13,14 +14,18 @@ void nfc_magic_scene_magic_info_widget_callback( void nfc_magic_scene_magic_info_on_enter(void* context) { NfcMagic* nfc_magic = context; Widget* widget = nfc_magic->widget; + const char* card_type = nfc_magic_type(nfc_magic->dev->type); notification_message(nfc_magic->notifications, &sequence_success); widget_add_icon_element(widget, 73, 17, &I_DolphinCommon_56x48); widget_add_string_element( widget, 3, 4, AlignLeft, AlignTop, FontPrimary, "Magic card detected"); + widget_add_string_element(widget, 3, 17, AlignLeft, AlignTop, FontSecondary, card_type); widget_add_button_element( widget, GuiButtonTypeLeft, "Retry", nfc_magic_scene_magic_info_widget_callback, nfc_magic); + widget_add_button_element( + widget, GuiButtonTypeRight, "More", nfc_magic_scene_magic_info_widget_callback, nfc_magic); // Setup and start worker view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewWidget); @@ -33,6 +38,15 @@ bool nfc_magic_scene_magic_info_on_event(void* context, SceneManagerEvent event) if(event.type == SceneManagerEventTypeCustom) { if(event.event == GuiButtonTypeLeft) { consumed = scene_manager_previous_scene(nfc_magic->scene_manager); + } else if(event.event == GuiButtonTypeRight) { + MagicType type = nfc_magic->dev->type; + if(type == MagicTypeGen4) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneGen4Actions); + consumed = true; + } else { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneActions); + consumed = true; + } } } return consumed; diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_new_key_input.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_new_key_input.c new file mode 100644 index 000000000..b5247f6c5 --- /dev/null +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_new_key_input.c @@ -0,0 +1,45 @@ +#include "../nfc_magic_i.h" + +void nfc_magic_scene_new_key_input_byte_input_callback(void* context) { + NfcMagic* nfc_magic = context; + + view_dispatcher_send_custom_event( + nfc_magic->view_dispatcher, NfcMagicCustomEventByteInputDone); +} + +void nfc_magic_scene_new_key_input_on_enter(void* context) { + NfcMagic* nfc_magic = context; + + // Setup view + ByteInput* byte_input = nfc_magic->byte_input; + byte_input_set_header_text(byte_input, "Enter the password in hex"); + byte_input_set_result_callback( + byte_input, + nfc_magic_scene_new_key_input_byte_input_callback, + NULL, + nfc_magic, + (uint8_t*)&nfc_magic->new_password, + 4); + view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewByteInput); +} + +bool nfc_magic_scene_new_key_input_on_event(void* context, SceneManagerEvent event) { + NfcMagic* nfc_magic = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == NfcMagicCustomEventByteInputDone) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneRekey); + consumed = true; + } + } + return consumed; +} + +void nfc_magic_scene_new_key_input_on_exit(void* context) { + NfcMagic* nfc_magic = context; + + // Clear view + byte_input_set_result_callback(nfc_magic->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(nfc_magic->byte_input, ""); +} diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_rekey.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_rekey.c new file mode 100644 index 000000000..259dc78ea --- /dev/null +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_rekey.c @@ -0,0 +1,95 @@ +#include "../nfc_magic_i.h" + +enum { + NfcMagicSceneRekeyStateCardSearch, + NfcMagicSceneRekeyStateCardFound, +}; + +bool nfc_magic_rekey_worker_callback(NfcMagicWorkerEvent event, void* context) { + furi_assert(context); + + NfcMagic* nfc_magic = context; + view_dispatcher_send_custom_event(nfc_magic->view_dispatcher, event); + + return true; +} + +static void nfc_magic_scene_rekey_setup_view(NfcMagic* nfc_magic) { + Popup* popup = nfc_magic->popup; + popup_reset(popup); + uint32_t state = scene_manager_get_scene_state(nfc_magic->scene_manager, NfcMagicSceneRekey); + + if(state == NfcMagicSceneRekeyStateCardSearch) { + popup_set_text( + nfc_magic->popup, + "Apply the\nsame card\nto the back", + 128, + 32, + AlignRight, + AlignCenter); + popup_set_icon(nfc_magic->popup, 0, 8, &I_NFC_manual_60x50); + } else { + popup_set_icon(popup, 12, 23, &I_Loading_24); + popup_set_header(popup, "Writing\nDon't move...", 52, 32, AlignLeft, AlignCenter); + } + + view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewPopup); +} + +void nfc_magic_scene_rekey_on_enter(void* context) { + NfcMagic* nfc_magic = context; + + scene_manager_set_scene_state( + nfc_magic->scene_manager, NfcMagicSceneRekey, NfcMagicSceneRekeyStateCardSearch); + nfc_magic_scene_rekey_setup_view(nfc_magic); + + // Setup and start worker + nfc_magic_worker_start( + nfc_magic->worker, + NfcMagicWorkerStateRekey, + nfc_magic->dev, + &nfc_magic->source_dev->dev_data, + nfc_magic->new_password, + nfc_magic_rekey_worker_callback, + nfc_magic); + nfc_magic_blink_start(nfc_magic); +} + +bool nfc_magic_scene_rekey_on_event(void* context, SceneManagerEvent event) { + NfcMagic* nfc_magic = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == NfcMagicWorkerEventSuccess) { + nfc_magic->dev->password = nfc_magic->new_password; + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneSuccess); + consumed = true; + } else if(event.event == NfcMagicWorkerEventFail) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneRekeyFail); + consumed = true; + } else if(event.event == NfcMagicWorkerEventCardDetected) { + scene_manager_set_scene_state( + nfc_magic->scene_manager, NfcMagicSceneRekey, NfcMagicSceneRekeyStateCardFound); + nfc_magic_scene_rekey_setup_view(nfc_magic); + consumed = true; + } else if(event.event == NfcMagicWorkerEventNoCardDetected) { + scene_manager_set_scene_state( + nfc_magic->scene_manager, NfcMagicSceneRekey, NfcMagicSceneRekeyStateCardSearch); + nfc_magic_scene_rekey_setup_view(nfc_magic); + consumed = true; + } + } + return consumed; +} + +void nfc_magic_scene_rekey_on_exit(void* context) { + NfcMagic* nfc_magic = context; + + nfc_magic_worker_stop(nfc_magic->worker); + scene_manager_set_scene_state( + nfc_magic->scene_manager, NfcMagicSceneRekey, NfcMagicSceneRekeyStateCardSearch); + // Clear view + popup_reset(nfc_magic->popup); + + nfc_magic_blink_stop(nfc_magic); +} diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_rekey_fail.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_rekey_fail.c new file mode 100644 index 000000000..d30ee57bc --- /dev/null +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_rekey_fail.c @@ -0,0 +1,50 @@ +#include "../nfc_magic_i.h" + +void nfc_magic_scene_rekey_fail_widget_callback( + GuiButtonType result, + InputType type, + void* context) { + NfcMagic* nfc_magic = context; + if(type == InputTypeShort) { + view_dispatcher_send_custom_event(nfc_magic->view_dispatcher, result); + } +} + +void nfc_magic_scene_rekey_fail_on_enter(void* context) { + NfcMagic* nfc_magic = context; + Widget* widget = nfc_magic->widget; + + notification_message(nfc_magic->notifications, &sequence_error); + + widget_add_icon_element(widget, 72, 17, &I_DolphinCommon_56x48); + widget_add_string_element( + widget, 7, 4, AlignLeft, AlignTop, FontPrimary, "Can't change password!"); + + widget_add_button_element( + widget, GuiButtonTypeLeft, "Finish", nfc_magic_scene_rekey_fail_widget_callback, nfc_magic); + + // Setup and start worker + view_dispatcher_switch_to_view(nfc_magic->view_dispatcher, NfcMagicViewWidget); +} + +bool nfc_magic_scene_rekey_fail_on_event(void* context, SceneManagerEvent event) { + NfcMagic* nfc_magic = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == GuiButtonTypeLeft) { + consumed = scene_manager_search_and_switch_to_previous_scene( + nfc_magic->scene_manager, NfcMagicSceneStart); + } + } else if(event.type == SceneManagerEventTypeBack) { + consumed = scene_manager_search_and_switch_to_previous_scene( + nfc_magic->scene_manager, NfcMagicSceneStart); + } + return consumed; +} + +void nfc_magic_scene_rekey_fail_on_exit(void* context) { + NfcMagic* nfc_magic = context; + + widget_reset(nfc_magic->widget); +} diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_start.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_start.c index a70eb8acc..b5861629e 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_start.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_start.c @@ -1,8 +1,7 @@ #include "../nfc_magic_i.h" enum SubmenuIndex { SubmenuIndexCheck, - SubmenuIndexWriteGen1A, - SubmenuIndexWipe, + SubmenuIndexAuthenticateGen4, }; void nfc_magic_scene_start_submenu_callback(void* context, uint32_t index) { @@ -22,12 +21,10 @@ void nfc_magic_scene_start_on_enter(void* context) { nfc_magic); submenu_add_item( submenu, - "Write Gen1A", - SubmenuIndexWriteGen1A, + "Authenticate Gen4", + SubmenuIndexAuthenticateGen4, nfc_magic_scene_start_submenu_callback, nfc_magic); - submenu_add_item( - submenu, "Wipe", SubmenuIndexWipe, nfc_magic_scene_start_submenu_callback, nfc_magic); submenu_set_selected_item( submenu, scene_manager_get_scene_state(nfc_magic->scene_manager, NfcMagicSceneStart)); @@ -40,23 +37,13 @@ bool nfc_magic_scene_start_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == SubmenuIndexCheck) { + nfc_magic->dev->password = MAGIC_GEN4_DEFAULT_PWD; scene_manager_set_scene_state( nfc_magic->scene_manager, NfcMagicSceneStart, SubmenuIndexCheck); scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneCheck); consumed = true; - } else if(event.event == SubmenuIndexWriteGen1A) { - // Explicitly save state in each branch so that the - // correct option is reselected if the user cancels - // loading a file. - scene_manager_set_scene_state( - nfc_magic->scene_manager, NfcMagicSceneStart, SubmenuIndexWriteGen1A); - scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneFileSelect); - consumed = true; - } else if(event.event == SubmenuIndexWipe) { - scene_manager_set_scene_state( - nfc_magic->scene_manager, NfcMagicSceneStart, SubmenuIndexWipe); - scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneWipe); - consumed = true; + } else if(event.event == SubmenuIndexAuthenticateGen4) { + scene_manager_next_scene(nfc_magic->scene_manager, NfcMagicSceneKeyInput); } } diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_wipe.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_wipe.c index 1ca194286..29640f89c 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_wipe.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_wipe.c @@ -22,7 +22,12 @@ static void nfc_magic_scene_wipe_setup_view(NfcMagic* nfc_magic) { if(state == NfcMagicSceneWipeStateCardSearch) { popup_set_icon(nfc_magic->popup, 0, 8, &I_NFC_manual_60x50); popup_set_text( - nfc_magic->popup, "Apply card to\nthe back", 128, 32, AlignRight, AlignCenter); + nfc_magic->popup, + "Apply the\nsame card\nto the back", + 128, + 32, + AlignRight, + AlignCenter); } else { popup_set_icon(popup, 12, 23, &I_Loading_24); popup_set_header(popup, "Wiping\nDon't move...", 52, 32, AlignLeft, AlignCenter); @@ -42,7 +47,9 @@ void nfc_magic_scene_wipe_on_enter(void* context) { nfc_magic_worker_start( nfc_magic->worker, NfcMagicWorkerStateWipe, - &nfc_magic->nfc_dev->dev_data, + nfc_magic->dev, + &nfc_magic->source_dev->dev_data, + nfc_magic->new_password, nfc_magic_wipe_worker_callback, nfc_magic); nfc_magic_blink_start(nfc_magic); diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_write.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_write.c index c3e6f962a..45c54557f 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_write.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_write.c @@ -21,7 +21,12 @@ static void nfc_magic_scene_write_setup_view(NfcMagic* nfc_magic) { if(state == NfcMagicSceneWriteStateCardSearch) { popup_set_text( - nfc_magic->popup, "Apply card to\nthe back", 128, 32, AlignRight, AlignCenter); + nfc_magic->popup, + "Apply the\nsame card\nto the back", + 128, + 32, + AlignRight, + AlignCenter); popup_set_icon(nfc_magic->popup, 0, 8, &I_NFC_manual_60x50); } else { popup_set_icon(popup, 12, 23, &I_Loading_24); @@ -42,7 +47,9 @@ void nfc_magic_scene_write_on_enter(void* context) { nfc_magic_worker_start( nfc_magic->worker, NfcMagicWorkerStateWrite, - &nfc_magic->nfc_dev->dev_data, + nfc_magic->dev, + &nfc_magic->source_dev->dev_data, + nfc_magic->new_password, nfc_magic_write_worker_callback, nfc_magic); nfc_magic_blink_start(nfc_magic); diff --git a/applications/external/nfc_magic/scenes/nfc_magic_scene_wrong_card.c b/applications/external/nfc_magic/scenes/nfc_magic_scene_wrong_card.c index 4b8089693..857d50c1f 100644 --- a/applications/external/nfc_magic/scenes/nfc_magic_scene_wrong_card.c +++ b/applications/external/nfc_magic/scenes/nfc_magic_scene_wrong_card.c @@ -26,7 +26,7 @@ void nfc_magic_scene_wrong_card_on_enter(void* context) { AlignLeft, AlignTop, FontSecondary, - "Writing is supported\nonly for 4 bytes UID\nMifare Classic 1k"); + "Writing this file is\nnot supported for\nthis magic card."); widget_add_button_element( widget, GuiButtonTypeLeft, "Retry", nfc_magic_scene_wrong_card_widget_callback, nfc_magic); diff --git a/applications/external/picopass/application.fam b/applications/external/picopass/application.fam index 387566646..34c3f785c 100644 --- a/applications/external/picopass/application.fam +++ b/applications/external/picopass/application.fam @@ -11,7 +11,7 @@ App( stack_size=4 * 1024, order=30, fap_icon="125_10px.png", - fap_category="Tools", + fap_category="NFC", fap_libs=["mbedtls"], fap_private_libs=[ Lib( diff --git a/applications/external/subghz_remote_configurator/application.fam b/applications/external/subghz_remote_configurator/application.fam new file mode 100644 index 000000000..f43dbcbd8 --- /dev/null +++ b/applications/external/subghz_remote_configurator/application.fam @@ -0,0 +1,16 @@ +App( + appid="subrem_configurator", + name="Remote Maker", + apptype=FlipperAppType.EXTERNAL, + entry_point="subghz_remote_config_app", + requires=[ + "gui", + "dialogs", + ], + stack_size=2 * 1024, + order=50, + fap_description="File Editor for the SubGhz Remote app", + fap_category="Sub-Ghz", + fap_icon_assets="icons", + fap_icon="icons/subrem_10px.png", +) \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/helpers/subrem_custom_event.h b/applications/external/subghz_remote_configurator/helpers/subrem_custom_event.h new file mode 100644 index 000000000..779458c20 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/subrem_custom_event.h @@ -0,0 +1,52 @@ +#pragma once + +typedef enum { + SubRemEditMenuStateUP = 0, + SubRemEditMenuStateDOWN, + SubRemEditMenuStateLEFT, + SubRemEditMenuStateRIGHT, + SubRemEditMenuStateOK, +} SubRemEditMenuState; + +typedef enum { + // SubmenuIndex + SubmenuIndexSubRemEditMapFile = 0, + SubmenuIndexSubRemNewMapFile, + SubmenuIndexSubRemRemoteView, + SubmenuIndexSubRemAbout, + + // EditSubmenuIndex + EditSubmenuIndexEditLabel, + EditSubmenuIndexEditFile, + + // SubRemCustomEvent + SubRemCustomEventViewRemoteStartUP = 100, + SubRemCustomEventViewRemoteStartDOWN, + SubRemCustomEventViewRemoteStartLEFT, + SubRemCustomEventViewRemoteStartRIGHT, + SubRemCustomEventViewRemoteStartOK, + SubRemCustomEventViewRemoteBack, + SubRemCustomEventViewRemoteStop, + SubRemCustomEventViewRemoteForcedStop, + + SubRemCustomEventViewEditMenuBack, + SubRemCustomEventViewEditMenuUP, + SubRemCustomEventViewEditMenuDOWN, + SubRemCustomEventViewEditMenuEdit, + SubRemCustomEventViewEditMenuSave, + + SubRemCustomEventSceneEditsubmenu, + SubRemCustomEventSceneEditLabelInputDone, + SubRemCustomEventSceneEditLabelWidgetAcces, + SubRemCustomEventSceneEditLabelWidgetBack, + + SubRemCustomEventSceneEditOpenSubErrorPopup, + + SubRemCustomEventSceneEditPreviewSaved, + + SubRemCustomEventSceneNewName, + + // // SceneStates + // SubRemSceneOpenMapFileStateOpen, + // SubRemSceneOpenMapFileStateEdit, +} SubRemCustomEvent; \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/helpers/subrem_presets.c b/applications/external/subghz_remote_configurator/helpers/subrem_presets.c new file mode 100644 index 000000000..dc298c069 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/subrem_presets.c @@ -0,0 +1,180 @@ +#include "subrem_presets.h" + +#define TAG "SubRemPresets" + +SubRemSubFilePreset* subrem_sub_file_preset_alloc() { + SubRemSubFilePreset* sub_preset = malloc(sizeof(SubRemSubFilePreset)); + + sub_preset->fff_data = flipper_format_string_alloc(); + sub_preset->file_path = furi_string_alloc(); + sub_preset->protocaol_name = furi_string_alloc(); + sub_preset->label = furi_string_alloc(); + + sub_preset->freq_preset.name = furi_string_alloc(); + + sub_preset->type = SubGhzProtocolTypeUnknown; + sub_preset->load_state = SubRemLoadSubStateNotSet; + + return sub_preset; +} + +void subrem_sub_file_preset_free(SubRemSubFilePreset* sub_preset) { + furi_assert(sub_preset); + + furi_string_free(sub_preset->label); + furi_string_free(sub_preset->protocaol_name); + furi_string_free(sub_preset->file_path); + flipper_format_free(sub_preset->fff_data); + + furi_string_free(sub_preset->freq_preset.name); + + free(sub_preset); +} + +void subrem_sub_file_preset_reset(SubRemSubFilePreset* sub_preset) { + furi_assert(sub_preset); + + furi_string_set_str(sub_preset->label, ""); + furi_string_reset(sub_preset->protocaol_name); + furi_string_reset(sub_preset->file_path); + + Stream* fff_data_stream = flipper_format_get_raw_stream(sub_preset->fff_data); + stream_clean(fff_data_stream); + + sub_preset->type = SubGhzProtocolTypeUnknown; + sub_preset->load_state = SubRemLoadSubStateNotSet; +} + +SubRemLoadSubState subrem_sub_preset_load( + SubRemSubFilePreset* sub_preset, + SubGhzTxRx* txrx, + FlipperFormat* fff_data_file) { + furi_assert(sub_preset); + furi_assert(txrx); + furi_assert(fff_data_file); + + Stream* fff_data_stream = flipper_format_get_raw_stream(sub_preset->fff_data); + + SubRemLoadSubState ret; + FuriString* temp_str = furi_string_alloc(); + uint32_t temp_data32; + uint32_t repeat = 200; + + ret = SubRemLoadSubStateError; + + do { + stream_clean(fff_data_stream); + if(!flipper_format_read_header(fff_data_file, temp_str, &temp_data32)) { + FURI_LOG_E(TAG, "Missing or incorrect header"); + break; + } + + if(((!strcmp(furi_string_get_cstr(temp_str), SUBGHZ_KEY_FILE_TYPE)) || + (!strcmp(furi_string_get_cstr(temp_str), SUBGHZ_RAW_FILE_TYPE))) && + temp_data32 == SUBGHZ_KEY_FILE_VERSION) { + } else { + FURI_LOG_E(TAG, "Type or version mismatch"); + break; + } + + SubGhzSetting* setting = subghz_txrx_get_setting(txrx); + + //Load frequency or using default from settings + ret = SubRemLoadSubStateErrorFreq; + if(!flipper_format_read_uint32(fff_data_file, "Frequency", &temp_data32, 1)) { + FURI_LOG_W(TAG, "Cannot read frequency. Set default frequency"); + sub_preset->freq_preset.frequency = subghz_setting_get_default_frequency(setting); + } else if(!furi_hal_subghz_is_tx_allowed(temp_data32)) { + FURI_LOG_E(TAG, "This frequency can only be used for RX"); + break; + } + sub_preset->freq_preset.frequency = temp_data32; + + //Load preset + ret = SubRemLoadSubStateErrorMod; + if(!flipper_format_read_string(fff_data_file, "Preset", temp_str)) { + FURI_LOG_E(TAG, "Missing Preset"); + break; + } + + furi_string_set_str( + temp_str, subghz_txrx_get_preset_name(txrx, furi_string_get_cstr(temp_str))); + if(!strcmp(furi_string_get_cstr(temp_str), "")) { + break; + } + + if(!strcmp(furi_string_get_cstr(temp_str), "CUSTOM")) { + FURI_LOG_E(TAG, "CUSTOM preset is not supported"); + break; + // TODO Custom preset loading logic if need + // sub_preset->freq_preset.preset_index = + // subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(temp_str)); + } + + furi_string_set(sub_preset->freq_preset.name, temp_str); + + // Load protocol + ret = SubRemLoadSubStateErrorProtocol; + if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) { + FURI_LOG_E(TAG, "Missing Protocol"); + break; + } + + FlipperFormat* fff_data = sub_preset->fff_data; + if(!strcmp(furi_string_get_cstr(temp_str), "RAW")) { + //if RAW + subghz_protocol_raw_gen_fff_data( + fff_data, furi_string_get_cstr(sub_preset->file_path)); + } else { + stream_copy_full( + flipper_format_get_raw_stream(fff_data_file), + flipper_format_get_raw_stream(fff_data)); + } + + if(subghz_txrx_load_decoder_by_name_protocol(txrx, furi_string_get_cstr(temp_str))) { + SubGhzProtocolStatus status = + subghz_protocol_decoder_base_deserialize(subghz_txrx_get_decoder(txrx), fff_data); + if(status != SubGhzProtocolStatusOk) { + break; + } + } else { + FURI_LOG_E(TAG, "Protocol not found"); + break; + } + + const SubGhzProtocol* protocol = subghz_txrx_get_decoder(txrx)->protocol; + + if(protocol->flag & SubGhzProtocolFlag_Send) { + if((protocol->type == SubGhzProtocolTypeStatic) || + (protocol->type == SubGhzProtocolTypeDynamic) || + // TODO: BINRAW It probably works, but checks are needed. + // (protocol->type == SubGhzProtocolTypeBinRAW) || + (protocol->type == SubGhzProtocolTypeRAW)) { + sub_preset->type = protocol->type; + } else { + FURI_LOG_E(TAG, "Unsuported Protocol"); + break; + } + + furi_string_set(sub_preset->protocaol_name, temp_str); + } else { + FURI_LOG_E(TAG, "Protocol does not support transmission"); + break; + } + + if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &repeat, 1)) { + FURI_LOG_E(TAG, "Unable Repeat"); + break; + } + + ret = SubRemLoadSubStateOK; + +#if FURI_DEBUG + FURI_LOG_I(TAG, "%-16s - protocol Loaded", furi_string_get_cstr(sub_preset->label)); +#endif + } while(false); + + furi_string_free(temp_str); + sub_preset->load_state = ret; + return ret; +} diff --git a/applications/external/subghz_remote_configurator/helpers/subrem_presets.h b/applications/external/subghz_remote_configurator/helpers/subrem_presets.h new file mode 100644 index 000000000..d66181b90 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/subrem_presets.h @@ -0,0 +1,39 @@ +#pragma once + +#include "subrem_types.h" +#include "txrx/subghz_txrx.h" + +#include +#include + +typedef struct { + FuriString* name; + uint32_t frequency; + // size_t preset_index; // Need for custom preset +} FreqPreset; + +// Sub File preset +typedef struct { + FlipperFormat* fff_data; + FreqPreset freq_preset; + FuriString* file_path; + FuriString* protocaol_name; + FuriString* label; + SubGhzProtocolType type; + SubRemLoadSubState load_state; +} SubRemSubFilePreset; + +typedef struct { + SubRemSubFilePreset* subs_preset[SubRemSubKeyNameMaxCount]; +} SubRemMapPreset; + +SubRemSubFilePreset* subrem_sub_file_preset_alloc(); + +void subrem_sub_file_preset_free(SubRemSubFilePreset* sub_preset); + +void subrem_sub_file_preset_reset(SubRemSubFilePreset* sub_preset); + +SubRemLoadSubState subrem_sub_preset_load( + SubRemSubFilePreset* sub_preset, + SubGhzTxRx* txrx, + FlipperFormat* fff_data_file); diff --git a/applications/external/subghz_remote_configurator/helpers/subrem_types.h b/applications/external/subghz_remote_configurator/helpers/subrem_types.h new file mode 100644 index 000000000..b43f8499d --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/subrem_types.h @@ -0,0 +1,48 @@ +#pragma once + +#include +#include + +#define SUBREM_APP_APP_FILE_VERSION 1 +#define SUBREM_APP_APP_FILE_TYPE "Flipper SubRem Map file" +#define SUBREM_APP_EXTENSION ".txt" + +typedef enum { + SubRemSubKeyNameUp = (0U), + SubRemSubKeyNameDown, + SubRemSubKeyNameLeft, + SubRemSubKeyNameRight, + SubRemSubKeyNameOk, + SubRemSubKeyNameMaxCount, +} SubRemSubKeyName; + +typedef enum { + SubRemViewIDSubmenu, + SubRemViewIDWidget, + SubRemViewIDPopup, + SubRemViewIDTextInput, + SubRemViewIDRemote, + SubRemViewIDEditMenu, +} SubRemViewID; + +typedef enum { + SubRemLoadSubStateNotSet = 0, + SubRemLoadSubStatePreloaded, + SubRemLoadSubStateError, + SubRemLoadSubStateErrorIncorectPath, + SubRemLoadSubStateErrorNoFile, + SubRemLoadSubStateErrorFreq, + SubRemLoadSubStateErrorMod, + SubRemLoadSubStateErrorProtocol, + SubRemLoadSubStateOK, +} SubRemLoadSubState; + +typedef enum { + SubRemLoadMapStateBack = 0, + SubRemLoadMapStateError, + SubRemLoadMapStateErrorOpenError, + SubRemLoadMapStateErrorStorage, + SubRemLoadMapStateErrorBrokenFile, + SubRemLoadMapStateNotAllOK, + SubRemLoadMapStateOK, +} SubRemLoadMapState; \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/helpers/txrx/Readme.md b/applications/external/subghz_remote_configurator/helpers/txrx/Readme.md new file mode 100644 index 000000000..918160198 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/txrx/Readme.md @@ -0,0 +1,4 @@ +This is part of the official `SubGhz` app from [flipperzero-firmware](https://github.com/flipperdevices/flipperzero-firmware/tree/3217f286f03da119398586daf94c0723d28b872a/applications/main/subghz) + +With changes from [unleashed-firmware +](https://github.com/DarkFlippers/unleashed-firmware/tree/3eac6ccd48a3851cf5d63bf7899b387a293e5319/applications/main/subghz) \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx.c b/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx.c new file mode 100644 index 000000000..c1f519ba0 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx.c @@ -0,0 +1,563 @@ +#include "subghz_txrx_i.h" +#include + +#define TAG "SubGhz" + +SubGhzTxRx* subghz_txrx_alloc() { + SubGhzTxRx* instance = malloc(sizeof(SubGhzTxRx)); + instance->setting = subghz_setting_alloc(); + subghz_setting_load(instance->setting, EXT_PATH("subghz/assets/setting_user")); + + instance->preset = malloc(sizeof(SubGhzRadioPreset)); + instance->preset->name = furi_string_alloc(); + subghz_txrx_set_preset( + instance, "AM650", subghz_setting_get_default_frequency(instance->setting), NULL, 0); + + instance->txrx_state = SubGhzTxRxStateSleep; + + subghz_txrx_hopper_set_state(instance, SubGhzHopperStateOFF); + subghz_txrx_speaker_set_state(instance, SubGhzSpeakerStateDisable); + subghz_txrx_set_debug_pin_state(instance, false); + + instance->worker = subghz_worker_alloc(); + instance->fff_data = flipper_format_string_alloc(); + + instance->environment = subghz_environment_alloc(); + instance->is_database_loaded = subghz_environment_load_keystore( + instance->environment, EXT_PATH("subghz/assets/keeloq_mfcodes")); + subghz_environment_load_keystore( + instance->environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user")); + subghz_environment_set_came_atomo_rainbow_table_file_name( + instance->environment, EXT_PATH("subghz/assets/came_atomo")); + subghz_environment_set_alutech_at_4n_rainbow_table_file_name( + instance->environment, EXT_PATH("subghz/assets/alutech_at_4n")); + subghz_environment_set_nice_flor_s_rainbow_table_file_name( + instance->environment, EXT_PATH("subghz/assets/nice_flor_s")); + subghz_environment_set_protocol_registry( + instance->environment, (void*)&subghz_protocol_registry); + instance->receiver = subghz_receiver_alloc_init(instance->environment); + + subghz_worker_set_overrun_callback( + instance->worker, (SubGhzWorkerOverrunCallback)subghz_receiver_reset); + subghz_worker_set_pair_callback( + instance->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode); + subghz_worker_set_context(instance->worker, instance->receiver); + + return instance; +} + +void subghz_txrx_free(SubGhzTxRx* instance) { + furi_assert(instance); + + subghz_worker_free(instance->worker); + subghz_receiver_free(instance->receiver); + subghz_environment_free(instance->environment); + flipper_format_free(instance->fff_data); + furi_string_free(instance->preset->name); + subghz_setting_free(instance->setting); + free(instance->preset); + free(instance); +} + +bool subghz_txrx_is_database_loaded(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->is_database_loaded; +} + +void subghz_txrx_set_preset( + SubGhzTxRx* instance, + const char* preset_name, + uint32_t frequency, + uint8_t* preset_data, + size_t preset_data_size) { + furi_assert(instance); + furi_string_set(instance->preset->name, preset_name); + SubGhzRadioPreset* preset = instance->preset; + preset->frequency = frequency; + preset->data = preset_data; + preset->data_size = preset_data_size; +} + +const char* subghz_txrx_get_preset_name(SubGhzTxRx* instance, const char* preset) { + UNUSED(instance); + const char* preset_name = ""; + if(!strcmp(preset, "FuriHalSubGhzPresetOok270Async")) { + preset_name = "AM270"; + } else if(!strcmp(preset, "FuriHalSubGhzPresetOok650Async")) { + preset_name = "AM650"; + } else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev238Async")) { + preset_name = "FM238"; + } else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev476Async")) { + preset_name = "FM476"; + } else if(!strcmp(preset, "FuriHalSubGhzPresetCustom")) { + preset_name = "CUSTOM"; + } else { + FURI_LOG_E(TAG, "Unknown preset"); + } + return preset_name; +} + +SubGhzRadioPreset subghz_txrx_get_preset(SubGhzTxRx* instance) { + furi_assert(instance); + return *instance->preset; +} + +void subghz_txrx_get_frequency_and_modulation( + SubGhzTxRx* instance, + FuriString* frequency, + FuriString* modulation, + bool long_name) { + furi_assert(instance); + SubGhzRadioPreset* preset = instance->preset; + if(frequency != NULL) { + furi_string_printf( + frequency, + "%03ld.%02ld", + preset->frequency / 1000000 % 1000, + preset->frequency / 10000 % 100); + } + if(modulation != NULL) { + if(long_name) { + furi_string_printf(modulation, "%s", furi_string_get_cstr(preset->name)); + } else { + furi_string_printf(modulation, "%.2s", furi_string_get_cstr(preset->name)); + } + } +} + +static void subghz_txrx_begin(SubGhzTxRx* instance, uint8_t* preset_data) { + furi_assert(instance); + furi_hal_subghz_reset(); + furi_hal_subghz_idle(); + furi_hal_subghz_load_custom_preset(preset_data); + furi_hal_gpio_init(furi_hal_subghz.cc1101_g0_pin, GpioModeInput, GpioPullNo, GpioSpeedLow); + instance->txrx_state = SubGhzTxRxStateIDLE; +} + +static uint32_t subghz_txrx_rx(SubGhzTxRx* instance, uint32_t frequency) { + furi_assert(instance); + if(!furi_hal_subghz_is_frequency_valid(frequency)) { + furi_crash("SubGhz: Incorrect RX frequency."); + } + furi_assert( + instance->txrx_state != SubGhzTxRxStateRx && instance->txrx_state != SubGhzTxRxStateSleep); + + furi_hal_subghz_idle(); + uint32_t value = furi_hal_subghz_set_frequency_and_path(frequency); + furi_hal_gpio_init(furi_hal_subghz.cc1101_g0_pin, GpioModeInput, GpioPullNo, GpioSpeedLow); + furi_hal_subghz_flush_rx(); + subghz_txrx_speaker_on(instance); + furi_hal_subghz_rx(); + + furi_hal_subghz_start_async_rx(subghz_worker_rx_callback, instance->worker); + subghz_worker_start(instance->worker); + instance->txrx_state = SubGhzTxRxStateRx; + return value; +} + +static void subghz_txrx_idle(SubGhzTxRx* instance) { + furi_assert(instance); + furi_assert(instance->txrx_state != SubGhzTxRxStateSleep); + furi_hal_subghz_idle(); + subghz_txrx_speaker_off(instance); + instance->txrx_state = SubGhzTxRxStateIDLE; +} + +static void subghz_txrx_rx_end(SubGhzTxRx* instance) { + furi_assert(instance); + furi_assert(instance->txrx_state == SubGhzTxRxStateRx); + + if(subghz_worker_is_running(instance->worker)) { + subghz_worker_stop(instance->worker); + furi_hal_subghz_stop_async_rx(); + } + furi_hal_subghz_idle(); + subghz_txrx_speaker_off(instance); + instance->txrx_state = SubGhzTxRxStateIDLE; +} + +void subghz_txrx_sleep(SubGhzTxRx* instance) { + furi_assert(instance); + furi_hal_subghz_sleep(); + instance->txrx_state = SubGhzTxRxStateSleep; +} + +static bool subghz_txrx_tx(SubGhzTxRx* instance, uint32_t frequency) { + furi_assert(instance); + if(!furi_hal_subghz_is_frequency_valid(frequency)) { + furi_crash("SubGhz: Incorrect TX frequency."); + } + furi_assert(instance->txrx_state != SubGhzTxRxStateSleep); + furi_hal_subghz_idle(); + furi_hal_subghz_set_frequency_and_path(frequency); + furi_hal_gpio_write(furi_hal_subghz.cc1101_g0_pin, false); + furi_hal_gpio_init( + furi_hal_subghz.cc1101_g0_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); + bool ret = furi_hal_subghz_tx(); + if(ret) { + subghz_txrx_speaker_on(instance); + instance->txrx_state = SubGhzTxRxStateTx; + } + + return ret; +} + +SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat* flipper_format) { + furi_assert(instance); + furi_assert(flipper_format); + + subghz_txrx_stop(instance); + + SubGhzTxRxStartTxState ret = SubGhzTxRxStartTxStateErrorParserOthers; + FuriString* temp_str = furi_string_alloc(); + uint32_t repeat = 200; + do { + if(!flipper_format_rewind(flipper_format)) { + FURI_LOG_E(TAG, "Rewind error"); + break; + } + if(!flipper_format_read_string(flipper_format, "Protocol", temp_str)) { + FURI_LOG_E(TAG, "Missing Protocol"); + break; + } + if(!flipper_format_insert_or_update_uint32(flipper_format, "Repeat", &repeat, 1)) { + FURI_LOG_E(TAG, "Unable Repeat"); + break; + } + ret = SubGhzTxRxStartTxStateOk; + + SubGhzRadioPreset* preset = instance->preset; + instance->transmitter = + subghz_transmitter_alloc_init(instance->environment, furi_string_get_cstr(temp_str)); + + if(instance->transmitter) { + if(subghz_transmitter_deserialize(instance->transmitter, flipper_format) == + SubGhzProtocolStatusOk) { + if(strcmp(furi_string_get_cstr(preset->name), "") != 0) { + subghz_txrx_begin( + instance, + subghz_setting_get_preset_data_by_name( + instance->setting, furi_string_get_cstr(preset->name))); + if(preset->frequency) { + if(!subghz_txrx_tx(instance, preset->frequency)) { + FURI_LOG_E(TAG, "Only Rx"); + ret = SubGhzTxRxStartTxStateErrorOnlyRx; + } + } else { + ret = SubGhzTxRxStartTxStateErrorParserOthers; + } + + } else { + FURI_LOG_E( + TAG, "Unknown name preset \" %s \"", furi_string_get_cstr(preset->name)); + ret = SubGhzTxRxStartTxStateErrorParserOthers; + } + + if(ret == SubGhzTxRxStartTxStateOk) { + //Start TX + furi_hal_subghz_start_async_tx( + subghz_transmitter_yield, instance->transmitter); + } + } else { + ret = SubGhzTxRxStartTxStateErrorParserOthers; + } + } else { + ret = SubGhzTxRxStartTxStateErrorParserOthers; + } + if(ret != SubGhzTxRxStartTxStateOk) { + subghz_transmitter_free(instance->transmitter); + if(instance->txrx_state != SubGhzTxRxStateIDLE) { + subghz_txrx_idle(instance); + } + } + + } while(false); + furi_string_free(temp_str); + return ret; +} + +void subghz_txrx_rx_start(SubGhzTxRx* instance) { + furi_assert(instance); + subghz_txrx_stop(instance); + subghz_txrx_begin( + instance, + subghz_setting_get_preset_data_by_name( + subghz_txrx_get_setting(instance), furi_string_get_cstr(instance->preset->name))); + subghz_txrx_rx(instance, instance->preset->frequency); +} + +void subghz_txrx_set_need_save_callback( + SubGhzTxRx* instance, + SubGhzTxRxNeedSaveCallback callback, + void* context) { + furi_assert(instance); + instance->need_save_callback = callback; + instance->need_save_context = context; +} + +static void subghz_txrx_tx_stop(SubGhzTxRx* instance) { + furi_assert(instance); + furi_assert(instance->txrx_state == SubGhzTxRxStateTx); + //Stop TX + furi_hal_subghz_stop_async_tx(); + subghz_transmitter_stop(instance->transmitter); + subghz_transmitter_free(instance->transmitter); + + //if protocol dynamic then we save the last upload + if(instance->decoder_result->protocol->type == SubGhzProtocolTypeDynamic) { + if(instance->need_save_callback) { + instance->need_save_callback(instance->need_save_context); + } + } + subghz_txrx_idle(instance); + subghz_txrx_speaker_off(instance); + //Todo: Show message + // notification_message(notifications, &sequence_reset_red); +} + +FlipperFormat* subghz_txrx_get_fff_data(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->fff_data; +} + +SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->setting; +} + +void subghz_txrx_stop(SubGhzTxRx* instance) { + furi_assert(instance); + + switch(instance->txrx_state) { + case SubGhzTxRxStateTx: + subghz_txrx_tx_stop(instance); + subghz_txrx_speaker_unmute(instance); + break; + case SubGhzTxRxStateRx: + subghz_txrx_rx_end(instance); + subghz_txrx_speaker_mute(instance); + break; + + default: + break; + } +} + +void subghz_txrx_hopper_update(SubGhzTxRx* instance) { + furi_assert(instance); + + switch(instance->hopper_state) { + case SubGhzHopperStateOFF: + case SubGhzHopperStatePause: + return; + case SubGhzHopperStateRSSITimeOut: + if(instance->hopper_timeout != 0) { + instance->hopper_timeout--; + return; + } + break; + default: + break; + } + float rssi = -127.0f; + if(instance->hopper_state != SubGhzHopperStateRSSITimeOut) { + // See RSSI Calculation timings in CC1101 17.3 RSSI + rssi = furi_hal_subghz_get_rssi(); + + // Stay if RSSI is high enough + if(rssi > -90.0f) { + instance->hopper_timeout = 10; + instance->hopper_state = SubGhzHopperStateRSSITimeOut; + return; + } + } else { + instance->hopper_state = SubGhzHopperStateRunning; + } + // Select next frequency + if(instance->hopper_idx_frequency < + subghz_setting_get_hopper_frequency_count(instance->setting) - 1) { + instance->hopper_idx_frequency++; + } else { + instance->hopper_idx_frequency = 0; + } + + if(instance->txrx_state == SubGhzTxRxStateRx) { + subghz_txrx_rx_end(instance); + }; + if(instance->txrx_state == SubGhzTxRxStateIDLE) { + subghz_receiver_reset(instance->receiver); + instance->preset->frequency = + subghz_setting_get_hopper_frequency(instance->setting, instance->hopper_idx_frequency); + subghz_txrx_rx(instance, instance->preset->frequency); + } +} + +SubGhzHopperState subghz_txrx_hopper_get_state(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->hopper_state; +} + +void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state) { + furi_assert(instance); + instance->hopper_state = state; +} + +void subghz_txrx_hopper_unpause(SubGhzTxRx* instance) { + furi_assert(instance); + if(instance->hopper_state == SubGhzHopperStatePause) { + instance->hopper_state = SubGhzHopperStateRunning; + } +} + +void subghz_txrx_hopper_pause(SubGhzTxRx* instance) { + furi_assert(instance); + if(instance->hopper_state == SubGhzHopperStateRunning) { + instance->hopper_state = SubGhzHopperStatePause; + } +} + +void subghz_txrx_speaker_on(SubGhzTxRx* instance) { + furi_assert(instance); + if(instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(&gpio_ibutton); + } + + if(instance->speaker_state == SubGhzSpeakerStateEnable) { + if(furi_hal_speaker_acquire(30)) { + if(!instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(&gpio_speaker); + } + } else { + instance->speaker_state = SubGhzSpeakerStateDisable; + } + } +} + +void subghz_txrx_speaker_off(SubGhzTxRx* instance) { + furi_assert(instance); + if(instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(NULL); + } + if(instance->speaker_state != SubGhzSpeakerStateDisable) { + if(furi_hal_speaker_is_mine()) { + if(!instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(NULL); + } + furi_hal_speaker_release(); + if(instance->speaker_state == SubGhzSpeakerStateShutdown) + instance->speaker_state = SubGhzSpeakerStateDisable; + } + } +} + +void subghz_txrx_speaker_mute(SubGhzTxRx* instance) { + furi_assert(instance); + if(instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(NULL); + } + if(instance->speaker_state == SubGhzSpeakerStateEnable) { + if(furi_hal_speaker_is_mine()) { + if(!instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(NULL); + } + } + } +} + +void subghz_txrx_speaker_unmute(SubGhzTxRx* instance) { + furi_assert(instance); + if(instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(&gpio_ibutton); + } + if(instance->speaker_state == SubGhzSpeakerStateEnable) { + if(furi_hal_speaker_is_mine()) { + if(!instance->debug_pin_state) { + furi_hal_subghz_set_async_mirror_pin(&gpio_speaker); + } + } + } +} + +void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state) { + furi_assert(instance); + instance->speaker_state = state; +} + +SubGhzSpeakerState subghz_txrx_speaker_get_state(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->speaker_state; +} + +bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* instance, const char* name_protocol) { + furi_assert(instance); + furi_assert(name_protocol); + bool res = false; + instance->decoder_result = + subghz_receiver_search_decoder_base_by_name(instance->receiver, name_protocol); + if(instance->decoder_result) { + res = true; + } + return res; +} + +SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->decoder_result; +} + +bool subghz_txrx_protocol_is_serializable(SubGhzTxRx* instance) { + furi_assert(instance); + return ( + (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) == + SubGhzProtocolFlag_Save); +} + +bool subghz_txrx_protocol_is_transmittable(SubGhzTxRx* instance, bool check_type) { + furi_assert(instance); + const SubGhzProtocol* protocol = instance->decoder_result->protocol; + if(check_type) { + return ( + ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && + protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic); + } + return ( + ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) && + protocol->encoder->deserialize); +} + +void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) { + furi_assert(instance); + subghz_receiver_set_filter(instance->receiver, filter); +} + +void subghz_txrx_set_rx_calback( + SubGhzTxRx* instance, + SubGhzReceiverCallback callback, + void* context) { + subghz_receiver_set_rx_callback(instance->receiver, callback, context); +} + +void subghz_txrx_set_raw_file_encoder_worker_callback_end( + SubGhzTxRx* instance, + SubGhzProtocolEncoderRAWCallbackEnd callback, + void* context) { + subghz_protocol_raw_file_encoder_worker_set_callback_end( + (SubGhzProtocolEncoderRAW*)subghz_transmitter_get_protocol_instance(instance->transmitter), + callback, + context); +} + +void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state) { + furi_assert(instance); + instance->debug_pin_state = state; +} + +bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->debug_pin_state; +} + +SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance) { + furi_assert(instance); + return instance->receiver; +} \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx.h b/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx.h new file mode 100644 index 000000000..b2ebcc5f3 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx.h @@ -0,0 +1,318 @@ +#pragma once + +#include +#include +#include +#include +#include + +typedef struct SubGhzTxRx SubGhzTxRx; + +typedef void (*SubGhzTxRxNeedSaveCallback)(void* context); + +typedef enum { + SubGhzTxRxStartTxStateOk, + SubGhzTxRxStartTxStateErrorOnlyRx, + SubGhzTxRxStartTxStateErrorParserOthers, +} SubGhzTxRxStartTxState; + +// Type from subghz_types.h need for txrx working +/** SubGhzTxRx state */ +typedef enum { + SubGhzTxRxStateIDLE, + SubGhzTxRxStateRx, + SubGhzTxRxStateTx, + SubGhzTxRxStateSleep, +} SubGhzTxRxState; + +/** SubGhzHopperState state */ +typedef enum { + SubGhzHopperStateOFF, + SubGhzHopperStateRunning, + SubGhzHopperStatePause, + SubGhzHopperStateRSSITimeOut, +} SubGhzHopperState; + +/** SubGhzSpeakerState state */ +typedef enum { + SubGhzSpeakerStateDisable, + SubGhzSpeakerStateShutdown, + SubGhzSpeakerStateEnable, +} SubGhzSpeakerState; + +/** + * Allocate SubGhzTxRx + * + * @return SubGhzTxRx* pointer to SubGhzTxRx + */ +SubGhzTxRx* subghz_txrx_alloc(); + +/** + * Free SubGhzTxRx + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_free(SubGhzTxRx* instance); + +/** + * Check if the database is loaded + * + * @param instance Pointer to a SubGhzTxRx + * @return bool True if the database is loaded + */ +bool subghz_txrx_is_database_loaded(SubGhzTxRx* instance); + +/** + * Set preset + * + * @param instance Pointer to a SubGhzTxRx + * @param preset_name Name of preset + * @param frequency Frequency in Hz + * @param preset_data Data of preset + * @param preset_data_size Size of preset data + */ +void subghz_txrx_set_preset( + SubGhzTxRx* instance, + const char* preset_name, + uint32_t frequency, + uint8_t* preset_data, + size_t preset_data_size); + +/** + * Get name of preset + * + * @param instance Pointer to a SubGhzTxRx + * @param preset String of preset + * @return const char* Name of preset + */ +const char* subghz_txrx_get_preset_name(SubGhzTxRx* instance, const char* preset); + +/** + * Get of preset + * + * @param instance Pointer to a SubGhzTxRx + * @return SubGhzRadioPreset Preset + */ +SubGhzRadioPreset subghz_txrx_get_preset(SubGhzTxRx* instance); + +/** + * Get string frequency and modulation + * + * @param instance Pointer to a SubGhzTxRx + * @param frequency Pointer to a string frequency + * @param modulation Pointer to a string modulation + */ +void subghz_txrx_get_frequency_and_modulation( + SubGhzTxRx* instance, + FuriString* frequency, + FuriString* modulation, + bool long_name); + +/** + * Start TX CC1101 + * + * @param instance Pointer to a SubGhzTxRx + * @param flipper_format Pointer to a FlipperFormat + * @return SubGhzTxRxStartTxState + */ +SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat* flipper_format); + +/** + * Start RX CC1101 + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_rx_start(SubGhzTxRx* instance); + +/** + * Stop TX/RX CC1101 + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_stop(SubGhzTxRx* instance); + +/** + * Set sleep mode CC1101 + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_sleep(SubGhzTxRx* instance); + +/** + * Update frequency CC1101 in automatic mode (hopper) + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_hopper_update(SubGhzTxRx* instance); + +/** + * Get state hopper + * + * @param instance Pointer to a SubGhzTxRx + * @return SubGhzHopperState + */ +SubGhzHopperState subghz_txrx_hopper_get_state(SubGhzTxRx* instance); + +/** + * Set state hopper + * + * @param instance Pointer to a SubGhzTxRx + * @param state State hopper + */ +void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state); + +/** + * Unpause hopper + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_hopper_unpause(SubGhzTxRx* instance); + +/** + * Set pause hopper + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_hopper_pause(SubGhzTxRx* instance); + +/** + * Speaker on + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_speaker_on(SubGhzTxRx* instance); + +/** + * Speaker off + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_speaker_off(SubGhzTxRx* instance); + +/** + * Speaker mute + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_speaker_mute(SubGhzTxRx* instance); + +/** + * Speaker unmute + * + * @param instance Pointer to a SubGhzTxRx + */ +void subghz_txrx_speaker_unmute(SubGhzTxRx* instance); + +/** + * Set state speaker + * + * @param instance Pointer to a SubGhzTxRx + * @param state State speaker + */ +void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state); + +/** + * Get state speaker + * + * @param instance Pointer to a SubGhzTxRx + * @return SubGhzSpeakerState + */ +SubGhzSpeakerState subghz_txrx_speaker_get_state(SubGhzTxRx* instance); + +/** + * load decoder by name protocol + * + * @param instance Pointer to a SubGhzTxRx + * @param name_protocol Name protocol + * @return bool True if the decoder is loaded + */ +bool subghz_txrx_load_decoder_by_name_protocol(SubGhzTxRx* instance, const char* name_protocol); + +/** + * Get decoder + * + * @param instance Pointer to a SubGhzTxRx + * @return SubGhzProtocolDecoderBase* Pointer to a SubGhzProtocolDecoderBase + */ +SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance); + +/** + * Set callback for save data + * + * @param instance Pointer to a SubGhzTxRx + * @param callback Callback for save data + * @param context Context for callback + */ +void subghz_txrx_set_need_save_callback( + SubGhzTxRx* instance, + SubGhzTxRxNeedSaveCallback callback, + void* context); + +/** + * Get pointer to a load data key + * + * @param instance Pointer to a SubGhzTxRx + * @return FlipperFormat* + */ +FlipperFormat* subghz_txrx_get_fff_data(SubGhzTxRx* instance); + +/** + * Get pointer to a SugGhzSetting + * + * @param instance Pointer to a SubGhzTxRx + * @return SubGhzSetting* + */ +SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* instance); + +/** + * Is it possible to save this protocol + * + * @param instance Pointer to a SubGhzTxRx + * @return bool True if it is possible to save this protocol + */ +bool subghz_txrx_protocol_is_serializable(SubGhzTxRx* instance); + +/** + * Is it possible to send this protocol + * + * @param instance Pointer to a SubGhzTxRx + * @return bool True if it is possible to send this protocol + */ +bool subghz_txrx_protocol_is_transmittable(SubGhzTxRx* instance, bool check_type); + +/** + * Set filter, what types of decoder to use + * + * @param instance Pointer to a SubGhzTxRx + * @param filter Filter + */ +void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter); + +/** + * Set callback for receive data + * + * @param instance Pointer to a SubGhzTxRx + * @param callback Callback for receive data + * @param context Context for callback + */ +void subghz_txrx_set_rx_calback( + SubGhzTxRx* instance, + SubGhzReceiverCallback callback, + void* context); + +/** + * Set callback for Raw decoder, end of data transfer + * + * @param instance Pointer to a SubGhzTxRx + * @param callback Callback for Raw decoder, end of data transfer + * @param context Context for callback + */ +void subghz_txrx_set_raw_file_encoder_worker_callback_end( + SubGhzTxRx* instance, + SubGhzProtocolEncoderRAWCallbackEnd callback, + void* context); + +void subghz_txrx_set_debug_pin_state(SubGhzTxRx* instance, bool state); +bool subghz_txrx_get_debug_pin_state(SubGhzTxRx* instance); + +SubGhzReceiver* subghz_txrx_get_receiver(SubGhzTxRx* instance); // TODO use only in DecodeRaw diff --git a/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx_i.h b/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx_i.h new file mode 100644 index 000000000..680d27158 --- /dev/null +++ b/applications/external/subghz_remote_configurator/helpers/txrx/subghz_txrx_i.h @@ -0,0 +1,29 @@ + +#pragma once +#include "subghz_txrx.h" + +struct SubGhzTxRx { + SubGhzWorker* worker; + + SubGhzEnvironment* environment; + SubGhzReceiver* receiver; + SubGhzTransmitter* transmitter; + SubGhzProtocolDecoderBase* decoder_result; + FlipperFormat* fff_data; + + SubGhzRadioPreset* preset; + SubGhzSetting* setting; + + uint8_t hopper_timeout; + uint8_t hopper_idx_frequency; + bool is_database_loaded; + SubGhzHopperState hopper_state; + + SubGhzTxRxState txrx_state; + SubGhzSpeakerState speaker_state; + + SubGhzTxRxNeedSaveCallback need_save_callback; + void* need_save_context; + + bool debug_pin_state; +}; \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/icons/DolphinNice_96x59.png b/applications/external/subghz_remote_configurator/icons/DolphinNice_96x59.png new file mode 100644 index 000000000..a299d3630 Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/DolphinNice_96x59.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonDown_7x4.png b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonDown_7x4.png new file mode 100644 index 000000000..2954bb6a6 Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonDown_7x4.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonLeft_4x7.png b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonLeft_4x7.png new file mode 100644 index 000000000..0b4655d43 Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonLeft_4x7.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonRight_4x7.png b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonRight_4x7.png new file mode 100644 index 000000000..8e1c74c1c Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonRight_4x7.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonUp_7x4.png b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonUp_7x4.png new file mode 100644 index 000000000..1be79328b Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/ButtonUp_7x4.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/Ok_btn_9x9.png b/applications/external/subghz_remote_configurator/icons/remote_scene/Ok_btn_9x9.png new file mode 100644 index 000000000..9a1539da2 Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/Ok_btn_9x9.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_arrow_up_7x9.png b/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_arrow_up_7x9.png new file mode 100644 index 000000000..a91a6fd5e Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_arrow_up_7x9.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_cell_13x13.png b/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_cell_13x13.png new file mode 100644 index 000000000..1b1ff0c2f Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_cell_13x13.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_star_7x7.png b/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_star_7x7.png new file mode 100644 index 000000000..42fdea86e Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/Pin_star_7x7.png differ diff --git a/applications/external/subghz_remote_configurator/icons/remote_scene/back_10px.png b/applications/external/subghz_remote_configurator/icons/remote_scene/back_10px.png new file mode 100644 index 000000000..f9c615a99 Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/remote_scene/back_10px.png differ diff --git a/applications/external/subghz_remote_configurator/icons/sub1_10px.png b/applications/external/subghz_remote_configurator/icons/sub1_10px.png new file mode 100644 index 000000000..5a25fdf4e Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/sub1_10px.png differ diff --git a/applications/external/subghz_remote_configurator/icons/subrem_10px.png b/applications/external/subghz_remote_configurator/icons/subrem_10px.png new file mode 100644 index 000000000..c6b410f4c Binary files /dev/null and b/applications/external/subghz_remote_configurator/icons/subrem_10px.png differ diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene.c new file mode 100644 index 000000000..c45285b96 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene.c @@ -0,0 +1,30 @@ +#include "../subghz_remote_app_i.h" + +// Generate scene on_enter handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, +void (*const subrem_scene_on_enter_handlers[])(void*) = { +#include "subrem_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_event handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, +bool (*const subrem_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { +#include "subrem_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_exit handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, +void (*const subrem_scene_on_exit_handlers[])(void* context) = { +#include "subrem_scene_config.h" +}; +#undef ADD_SCENE + +// Initialize scene handlers configuration structure +const SceneManagerHandlers subrem_scene_handlers = { + .on_enter_handlers = subrem_scene_on_enter_handlers, + .on_event_handlers = subrem_scene_on_event_handlers, + .on_exit_handlers = subrem_scene_on_exit_handlers, + .scene_num = SubRemSceneNum, +}; diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene.h b/applications/external/subghz_remote_configurator/scenes/subrem_scene.h new file mode 100644 index 000000000..5c01f8ca5 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +// Generate scene id and total number +#define ADD_SCENE(prefix, name, id) SubRemScene##id, +typedef enum { +#include "subrem_scene_config.h" + SubRemSceneNum, +} SubRemScene; +#undef ADD_SCENE + +extern const SceneManagerHandlers subrem_scene_handlers; + +// Generate scene on_enter handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); +#include "subrem_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_event handlers declaration +#define ADD_SCENE(prefix, name, id) \ + bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); +#include "subrem_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_exit handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); +#include "subrem_scene_config.h" +#undef ADD_SCENE diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_config.h b/applications/external/subghz_remote_configurator/scenes/subrem_scene_config.h new file mode 100644 index 000000000..720eba42f --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_config.h @@ -0,0 +1,8 @@ +ADD_SCENE(subrem, start, Start) +ADD_SCENE(subrem, open_map_file, OpenMapFile) +ADD_SCENE(subrem, edit_menu, EditMenu) +ADD_SCENE(subrem, edit_submenu, EditSubMenu) +ADD_SCENE(subrem, edit_label, EditLabel) +ADD_SCENE(subrem, open_sub_file, OpenSubFile) +ADD_SCENE(subrem, edit_preview, EditPreview) +ADD_SCENE(subrem, enter_new_name, EnterNewName) \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_label.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_label.c new file mode 100644 index 000000000..baec60145 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_label.c @@ -0,0 +1,133 @@ +#include "../subghz_remote_app_i.h" + +#include + +typedef enum { + SubRemSceneEditLabelStateTextInput, + SubRemSceneEditLabelStateWidget, +} SubRemSceneEditLabelState; + +void subrem_scene_edit_label_text_input_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event( + app->view_dispatcher, SubRemCustomEventSceneEditLabelInputDone); +} + +void subrem_scene_edit_label_widget_callback(GuiButtonType result, InputType type, void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + if((result == GuiButtonTypeCenter) && (type == InputTypeShort)) { + view_dispatcher_send_custom_event( + app->view_dispatcher, SubRemCustomEventSceneEditLabelWidgetAcces); + } else if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) { + view_dispatcher_send_custom_event( + app->view_dispatcher, SubRemCustomEventSceneEditLabelWidgetBack); + } +} + +void subrem_scene_edit_label_on_enter(void* context) { + SubGhzRemoteApp* app = context; + + SubRemSubFilePreset* sub_preset = app->map_preset->subs_preset[app->chusen_sub]; + + FuriString* temp_str = furi_string_alloc(); + + if(furi_string_empty(sub_preset->label)) { + if(furi_string_empty(sub_preset->file_path)) { + path_extract_filename(sub_preset->file_path, temp_str, true); + strcpy(app->file_name_tmp, furi_string_get_cstr(temp_str)); + } else { + strcpy(app->file_name_tmp, ""); + } + } else { + strcpy(app->file_name_tmp, furi_string_get_cstr(sub_preset->label)); + } + + TextInput* text_input = app->text_input; + text_input_set_header_text(text_input, "Label name"); + text_input_set_result_callback( + text_input, + subrem_scene_edit_label_text_input_callback, + app, + app->file_name_tmp, + 25, + false); + + text_input_set_minimum_length(app->text_input, 0); + + widget_add_string_element( + app->widget, 63, 12, AlignCenter, AlignCenter, FontPrimary, "Empty Label Name"); + widget_add_string_element( + app->widget, 63, 32, AlignCenter, AlignCenter, FontSecondary, "Continue?"); + + widget_add_button_element( + app->widget, GuiButtonTypeCenter, "Ok", subrem_scene_edit_label_widget_callback, app); + widget_add_button_element( + app->widget, GuiButtonTypeLeft, "Back", subrem_scene_edit_label_widget_callback, app); + + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneEditLabel, SubRemSceneEditLabelStateTextInput); + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDTextInput); + + furi_string_free(temp_str); +} + +bool subrem_scene_edit_label_on_event(void* context, SceneManagerEvent event) { + SubGhzRemoteApp* app = context; + + FuriString* label = app->map_preset->subs_preset[app->chusen_sub]->label; + + if(event.type == SceneManagerEventTypeBack) { + if(scene_manager_get_scene_state(app->scene_manager, SubRemSceneEditLabel) == + SubRemSceneEditLabelStateWidget) { + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneEditLabel, SubRemSceneEditLabelStateTextInput); + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDTextInput); + return true; + } else if( + scene_manager_get_scene_state(app->scene_manager, SubRemSceneEditLabel) == + SubRemSceneEditLabelStateTextInput) { + scene_manager_previous_scene(app->scene_manager); + return true; + } + + scene_manager_previous_scene(app->scene_manager); + return true; + } else if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubRemCustomEventSceneEditLabelInputDone) { + if(strcmp(app->file_name_tmp, "") == 0) { + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneEditLabel, SubRemSceneEditLabelStateWidget); + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDWidget); + + } else { + furi_string_set(label, app->file_name_tmp); + app->map_not_saved = true; + scene_manager_previous_scene(app->scene_manager); + } + return true; + } else if(event.event == SubRemCustomEventSceneEditLabelWidgetAcces) { + furi_string_set(label, app->file_name_tmp); + app->map_not_saved = true; + scene_manager_previous_scene(app->scene_manager); + + return true; + } else if(event.event == SubRemCustomEventSceneEditLabelWidgetBack) { + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneEditLabel, SubRemSceneEditLabelStateTextInput); + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDTextInput); + + return true; + } + } + return false; +} + +void subrem_scene_edit_label_on_exit(void* context) { + SubGhzRemoteApp* app = context; + + // Clear view + text_input_reset(app->text_input); + widget_reset(app->widget); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_menu.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_menu.c new file mode 100644 index 000000000..a8882009a --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_menu.c @@ -0,0 +1,123 @@ +#include "../subghz_remote_app_i.h" + +void subrem_scene_edit_menu_callback(SubRemCustomEvent event, void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, event); +} + +void subrem_scene_edit_menu_widget_callback(GuiButtonType result, InputType type, void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + if((result == GuiButtonTypeRight) && (type == InputTypeShort)) { + app->map_not_saved = false; + view_dispatcher_send_custom_event(app->view_dispatcher, SubRemCustomEventViewEditMenuBack); + } else if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) { + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDEditMenu); + } +} + +static uint8_t subrem_scene_edit_menu_state_to_index(SubRemEditMenuState event_id) { + uint8_t ret = 0; + + if(event_id == SubRemEditMenuStateUP) { + ret = SubRemSubKeyNameUp; + } else if(event_id == SubRemEditMenuStateDOWN) { + ret = SubRemSubKeyNameDown; + } else if(event_id == SubRemEditMenuStateLEFT) { + ret = SubRemSubKeyNameLeft; + } else if(event_id == SubRemEditMenuStateRIGHT) { + ret = SubRemSubKeyNameRight; + } else if(event_id == SubRemEditMenuStateOK) { + ret = SubRemSubKeyNameOk; + } + + return ret; +} + +static void subrem_scene_edit_menu_update_data(SubGhzRemoteApp* app) { + furi_assert(app); + uint8_t index = subrem_scene_edit_menu_state_to_index( + scene_manager_get_scene_state(app->scene_manager, SubRemSceneEditMenu)); + + subrem_view_edit_menu_add_data_to_show( + app->subrem_edit_menu, + index, + app->map_preset->subs_preset[index]->label, + app->map_preset->subs_preset[index]->file_path, + app->map_preset->subs_preset[index]->load_state); +} + +void subrem_scene_edit_menu_on_enter(void* context) { + SubGhzRemoteApp* app = context; + + subrem_view_edit_menu_set_callback( + app->subrem_edit_menu, subrem_scene_edit_menu_callback, app); + + subrem_scene_edit_menu_update_data(app); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDEditMenu); + + Widget* widget = app->widget; + + widget_add_string_element( + widget, 63, 12, AlignCenter, AlignBottom, FontPrimary, "Changes are not saved"); + widget_add_string_element( + widget, 63, 32, AlignCenter, AlignBottom, FontPrimary, "do you want to exit?"); + + widget_add_button_element( + widget, GuiButtonTypeRight, "Yes", subrem_scene_edit_menu_widget_callback, app); + widget_add_button_element( + widget, GuiButtonTypeLeft, "No", subrem_scene_edit_menu_widget_callback, app); +} + +bool subrem_scene_edit_menu_on_event(void* context, SceneManagerEvent event) { + SubGhzRemoteApp* app = context; + + if(event.type == SceneManagerEventTypeBack) { + // Catch widget backEvent + return true; + } + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubRemCustomEventViewEditMenuBack) { + if(app->map_not_saved) { + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDWidget); + } else if(!scene_manager_search_and_switch_to_previous_scene( + app->scene_manager, SubRemSceneStart)) { + scene_manager_stop(app->scene_manager); + view_dispatcher_stop(app->view_dispatcher); + } + + return true; + } else if( + event.event == SubRemCustomEventViewEditMenuUP || + event.event == SubRemCustomEventViewEditMenuDOWN) { + scene_manager_set_scene_state( + app->scene_manager, + SubRemSceneEditMenu, + subrem_view_edit_menu_get_index(app->subrem_edit_menu)); + subrem_scene_edit_menu_update_data(app); + + return true; + } else if(event.event == SubRemCustomEventViewEditMenuEdit) { + app->chusen_sub = subrem_view_edit_menu_get_index(app->subrem_edit_menu); + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneEditSubMenu, EditSubmenuIndexEditLabel); + scene_manager_next_scene(app->scene_manager, SubRemSceneEditSubMenu); + + return true; + } else if(event.event == SubRemCustomEventViewEditMenuSave) { + scene_manager_next_scene(app->scene_manager, SubRemSceneEditPreview); + + return true; + } + } + + return false; +} + +void subrem_scene_edit_menu_on_exit(void* context) { + SubGhzRemoteApp* app = context; + widget_reset(app->widget); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_preview.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_preview.c new file mode 100644 index 000000000..98a423202 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_preview.c @@ -0,0 +1,74 @@ +#include "../subghz_remote_app_i.h" +#include "../views/remote.h" + +#define TAG "SubRemScenRemote" + +void subghz_scene_edit_preview_save_popup_callback(void* context) { + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event( + app->view_dispatcher, SubRemCustomEventSceneEditPreviewSaved); +} + +void subrem_scene_edit_preview_callback(SubRemCustomEvent event, void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, event); +} + +void subrem_scene_edit_preview_on_enter(void* context) { + SubGhzRemoteApp* app = context; + + // Setup view + Popup* popup = app->popup; + popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59); + popup_set_header(popup, "Saved!", 13, 22, AlignLeft, AlignBottom); + popup_set_timeout(popup, 1500); + popup_set_context(popup, app); + popup_set_callback(popup, subghz_scene_edit_preview_save_popup_callback); + popup_enable_timeout(popup); + + subrem_view_remote_update_data_labels(app->subrem_remote_view, app->map_preset->subs_preset); + subrem_view_remote_set_state(app->subrem_remote_view, SubRemViewRemoteStateOFF, 0); + + subrem_view_remote_set_callback( + app->subrem_remote_view, subrem_scene_edit_preview_callback, app); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDRemote); +} + +bool subrem_scene_edit_preview_on_event(void* context, SceneManagerEvent event) { + SubGhzRemoteApp* app = context; + + if(event.type == SceneManagerEventTypeBack || + (event.type == SceneManagerEventTypeCustom && + (event.event == SubRemCustomEventViewRemoteStartLEFT || + event.event == SubRemCustomEventViewRemoteForcedStop))) { + scene_manager_previous_scene(app->scene_manager); + return true; + } else if( + event.type == SceneManagerEventTypeCustom && + (event.event == SubRemCustomEventViewRemoteStartRIGHT || + event.event == SubRemCustomEventViewRemoteStartOK)) { + if(subrem_save_map_to_file(app)) { + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDPopup); + app->map_not_saved = false; + return true; + } + // TODO error screen + return true; + } else if( + event.type == SceneManagerEventTypeCustom && + event.event == SubRemCustomEventSceneEditPreviewSaved) { + scene_manager_search_and_switch_to_previous_scene(app->scene_manager, SubRemSceneEditMenu); + } + // } else if(event.type == SceneManagerEventTypeTick) { + // } + return false; +} + +void subrem_scene_edit_preview_on_exit(void* context) { + SubGhzRemoteApp* app = context; + + subrem_view_remote_set_state(app->subrem_remote_view, SubRemViewRemoteStateIdle, 0); + popup_reset(app->popup); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_submenu.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_submenu.c new file mode 100644 index 000000000..447beb96d --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_edit_submenu.c @@ -0,0 +1,54 @@ +#include "../subghz_remote_app_i.h" +#include "../helpers/subrem_custom_event.h" + +void subrem_scene_edit_submenu_text_input_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, SubRemCustomEventSceneEditsubmenu); +} + +void subrem_scene_edit_submenu_callback(void* context, uint32_t index) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + view_dispatcher_send_custom_event(app->view_dispatcher, index); +} + +void subrem_scene_edit_submenu_on_enter(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + Submenu* submenu = app->submenu; + submenu_add_item( + submenu, "Edit Label", EditSubmenuIndexEditLabel, subrem_scene_edit_submenu_callback, app); + submenu_add_item( + submenu, "Edit File", EditSubmenuIndexEditFile, subrem_scene_edit_submenu_callback, app); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDSubmenu); +} + +bool subrem_scene_edit_submenu_on_event(void* context, SceneManagerEvent event) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == EditSubmenuIndexEditLabel) { + scene_manager_next_scene(app->scene_manager, SubRemSceneEditLabel); + consumed = true; + } else if(event.event == EditSubmenuIndexEditFile) { + scene_manager_next_scene(app->scene_manager, SubRemSceneOpenSubFile); + consumed = true; + } + } + + return consumed; +} + +void subrem_scene_edit_submenu_on_exit(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + submenu_reset(app->submenu); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_enter_new_name.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_enter_new_name.c new file mode 100644 index 000000000..b829723a3 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_enter_new_name.c @@ -0,0 +1,70 @@ +#include "../subghz_remote_app_i.h" +#include "../helpers/subrem_custom_event.h" + +#include + +void subrem_scene_enter_new_name_text_input_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, SubRemCustomEventSceneNewName); +} + +void subrem_scene_enter_new_name_on_enter(void* context) { + SubGhzRemoteApp* app = context; + + // Setup view + TextInput* text_input = app->text_input; + + //strncpy(app->file_name_tmp, "subrem_", SUBREM_MAX_LEN_NAME); + text_input_set_header_text(text_input, "Map file Name"); + text_input_set_result_callback( + text_input, + subrem_scene_enter_new_name_text_input_callback, + app, + app->file_name_tmp, + 25, + false); + + ValidatorIsFile* validator_is_file = validator_is_file_alloc_init( + furi_string_get_cstr(app->file_path), SUBREM_APP_EXTENSION, ""); + text_input_set_validator(text_input, validator_is_file_callback, validator_is_file); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDTextInput); +} + +bool subrem_scene_enter_new_name_on_event(void* context, SceneManagerEvent event) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubRemCustomEventSceneNewName) { + if(strcmp(app->file_name_tmp, "") != 0) { + furi_string_set(app->file_path, SUBREM_APP_FOLDER); + furi_string_cat_printf( + app->file_path, "/%s%s", app->file_name_tmp, SUBREM_APP_EXTENSION); + + subrem_map_preset_reset(app->map_preset); + scene_manager_next_scene(app->scene_manager, SubRemSceneEditMenu); + } else { //error + } + consumed = true; + } + } + + return consumed; +} + +void subrem_scene_enter_new_name_on_exit(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + submenu_reset(app->submenu); + + // Clear validator & view + void* validator_context = text_input_get_validator_callback_context(app->text_input); + text_input_set_validator(app->text_input, NULL, NULL); + validator_is_file_free(validator_context); + text_input_reset(app->text_input); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_open_map_file.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_open_map_file.c new file mode 100644 index 000000000..77f2d2d56 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_open_map_file.c @@ -0,0 +1,29 @@ +#include "../subghz_remote_app_i.h" + +void subrem_scene_open_map_file_on_enter(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + SubRemLoadMapState load_state = subrem_load_from_file(app); + uint32_t start_scene_state = + scene_manager_get_scene_state(app->scene_manager, SubRemSceneStart); + + // TODO if optimization + + if(load_state == SubRemLoadMapStateBack) { + scene_manager_previous_scene(app->scene_manager); + } else if(start_scene_state == SubmenuIndexSubRemEditMapFile) { + scene_manager_set_scene_state(app->scene_manager, SubRemSceneEditMenu, SubRemSubKeyNameUp); + scene_manager_next_scene(app->scene_manager, SubRemSceneEditMenu); + } +} + +bool subrem_scene_open_map_file_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + return false; +} + +void subrem_scene_open_map_file_on_exit(void* context) { + UNUSED(context); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_open_sub_file.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_open_sub_file.c new file mode 100644 index 000000000..eb438cb92 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_open_sub_file.c @@ -0,0 +1,118 @@ +#include "../subghz_remote_app_i.h" + +void subrem_scene_open_sub_file_error_popup_callback(void* context) { + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event( + app->view_dispatcher, SubRemCustomEventSceneEditOpenSubErrorPopup); +} + +SubRemLoadSubState subrem_scene_open_sub_file_dialog(SubGhzRemoteApp* app) { + furi_assert(app); + + SubRemSubFilePreset* sub = app->map_preset->subs_preset[app->chusen_sub]; + + FuriString* temp_file_path = furi_string_alloc(); + + if(furi_string_empty(sub->file_path)) { + furi_string_set(temp_file_path, SUBGHZ_RAW_FOLDER); + } else { + furi_string_set(temp_file_path, sub->file_path); + } + + SubRemLoadSubState ret = SubRemLoadSubStateNotSet; + + DialogsFileBrowserOptions browser_options; + + dialog_file_browser_set_basic_options(&browser_options, SUBGHZ_APP_EXTENSION, &I_sub1_10px); + browser_options.base_path = SUBGHZ_RAW_FOLDER; + + // Input events and views are managed by file_select + if(!dialog_file_browser_show(app->dialogs, temp_file_path, temp_file_path, &browser_options)) { + } else { + // Check sub file + SubRemSubFilePreset* sub_candidate = subrem_sub_file_preset_alloc(); + furi_string_set(sub_candidate->label, sub->label); + furi_string_set(sub_candidate->file_path, temp_file_path); + + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* fff_file = flipper_format_file_alloc(storage); + + if(flipper_format_file_open_existing( + fff_file, furi_string_get_cstr(sub_candidate->file_path))) { + ret = subrem_sub_preset_load(sub_candidate, app->txrx, fff_file); + } + + flipper_format_file_close(fff_file); + flipper_format_free(fff_file); + furi_record_close(RECORD_STORAGE); + + if(ret == SubRemLoadSubStateOK) { + subrem_sub_file_preset_free(app->map_preset->subs_preset[app->chusen_sub]); + app->map_preset->subs_preset[app->chusen_sub] = sub_candidate; + app->map_not_saved = true; + } else { + subrem_sub_file_preset_free(sub_candidate); + } + } + + furi_string_free(temp_file_path); + + return ret; +} + +void subrem_scene_open_sub_file_on_enter(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + SubRemLoadSubState load_state = subrem_scene_open_sub_file_dialog(app); + + Popup* popup = app->popup; + // popup_set_icon(); + popup_set_header(popup, "ERROR", 63, 16, AlignCenter, AlignBottom); + popup_set_timeout(popup, 1500); + popup_set_context(popup, app); + popup_set_callback(popup, subrem_scene_open_sub_file_error_popup_callback); + popup_enable_timeout(popup); + + if(load_state == SubRemLoadSubStateOK) { + scene_manager_previous_scene(app->scene_manager); + } else if(load_state == SubRemLoadSubStateNotSet) { + scene_manager_previous_scene(app->scene_manager); + } else { + switch(load_state) { + case SubRemLoadSubStateErrorFreq: + + popup_set_text(popup, "Bad frequency", 63, 30, AlignCenter, AlignBottom); + break; + case SubRemLoadSubStateErrorMod: + + popup_set_text(popup, "Bad modulation", 63, 30, AlignCenter, AlignBottom); + break; + case SubRemLoadSubStateErrorProtocol: + + popup_set_text(popup, "Unsupported protocol", 63, 30, AlignCenter, AlignBottom); + break; + + default: + break; + } + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDPopup); + } +} + +bool subrem_scene_open_sub_file_on_event(void* context, SceneManagerEvent event) { + SubGhzRemoteApp* app = context; + + if(event.type == SceneManagerEventTypeCustom && + event.event == SubRemCustomEventSceneEditOpenSubErrorPopup) { + scene_manager_previous_scene(app->scene_manager); + return true; + } + return false; +} + +void subrem_scene_open_sub_file_on_exit(void* context) { + SubGhzRemoteApp* app = context; + + popup_reset(app->popup); +} diff --git a/applications/external/subghz_remote_configurator/scenes/subrem_scene_start.c b/applications/external/subghz_remote_configurator/scenes/subrem_scene_start.c new file mode 100644 index 000000000..e5a254111 --- /dev/null +++ b/applications/external/subghz_remote_configurator/scenes/subrem_scene_start.c @@ -0,0 +1,73 @@ +#include "../subghz_remote_app_i.h" +#include "../helpers/subrem_custom_event.h" + +void subrem_scene_start_submenu_callback(void* context, uint32_t index) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + view_dispatcher_send_custom_event(app->view_dispatcher, index); +} + +void subrem_scene_start_on_enter(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + Submenu* submenu = app->submenu; + submenu_add_item( + submenu, + "Edit Map File", + SubmenuIndexSubRemEditMapFile, + subrem_scene_start_submenu_callback, + app); + submenu_add_item( + submenu, + "New Map File", + SubmenuIndexSubRemNewMapFile, + subrem_scene_start_submenu_callback, + app); + // submenu_add_item( + // submenu, + // "About", + // SubmenuIndexSubGhzRemoteAbout, + // subrem_scene_start_submenu_callback, + // app); + + submenu_set_selected_item( + submenu, scene_manager_get_scene_state(app->scene_manager, SubRemSceneStart)); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDSubmenu); +} + +bool subrem_scene_start_on_event(void* context, SceneManagerEvent event) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubmenuIndexSubRemEditMapFile) { + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemEditMapFile); + scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); + consumed = true; + } else if(event.event == SubmenuIndexSubRemNewMapFile) { + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemNewMapFile); + scene_manager_next_scene(app->scene_manager, SubRemSceneEnterNewName); + consumed = true; + } + // } else if(event.event == SubmenuIndexSubRemAbout) { + // scene_manager_next_scene(app->scene_manager, SubRemSceneAbout); + // consumed = true; + // } + } + + return consumed; +} + +void subrem_scene_start_on_exit(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + submenu_reset(app->submenu); +} diff --git a/applications/external/subghz_remote_configurator/subghz_remote_app.c b/applications/external/subghz_remote_configurator/subghz_remote_app.c new file mode 100644 index 000000000..84100a233 --- /dev/null +++ b/applications/external/subghz_remote_configurator/subghz_remote_app.c @@ -0,0 +1,197 @@ +#include "subghz_remote_app_i.h" + +static bool subghz_remote_app_custom_event_callback(void* context, uint32_t event) { + furi_assert(context); + SubGhzRemoteApp* app = context; + return scene_manager_handle_custom_event(app->scene_manager, event); +} + +static bool subghz_remote_app_back_event_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + return scene_manager_handle_back_event(app->scene_manager); +} + +static void subghz_remote_app_tick_event_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + scene_manager_handle_tick_event(app->scene_manager); +} + +SubGhzRemoteApp* subghz_remote_app_alloc() { + SubGhzRemoteApp* app = malloc(sizeof(SubGhzRemoteApp)); + + Storage* storage = furi_record_open(RECORD_STORAGE); + storage_common_migrate(storage, EXT_PATH("unirf"), SUBREM_APP_FOLDER); + + if(!storage_simply_mkdir(storage, SUBREM_APP_FOLDER)) { + //FURI_LOG_E(TAG, "Could not create folder %s", SUBREM_APP_FOLDER); + } + furi_record_close(RECORD_STORAGE); + /* + // Enable power for External CC1101 if it is connected + furi_hal_subghz_enable_ext_power(); + // Auto switch to internal radio if external radio is not available + furi_delay_ms(15); + if(!furi_hal_subghz_check_radio()) { + furi_hal_subghz_select_radio_type(SubGhzRadioInternal); + furi_hal_subghz_init_radio_type(SubGhzRadioInternal); + } + + furi_hal_power_suppress_charge_enter(); +*/ + app->file_path = furi_string_alloc(); + furi_string_set(app->file_path, SUBREM_APP_FOLDER); + + // GUI + app->gui = furi_record_open(RECORD_GUI); + + // View Dispatcher + app->view_dispatcher = view_dispatcher_alloc(); + + app->scene_manager = scene_manager_alloc(&subrem_scene_handlers, app); + view_dispatcher_enable_queue(app->view_dispatcher); + + view_dispatcher_set_event_callback_context(app->view_dispatcher, app); + view_dispatcher_set_custom_event_callback( + app->view_dispatcher, subghz_remote_app_custom_event_callback); + view_dispatcher_set_navigation_event_callback( + app->view_dispatcher, subghz_remote_app_back_event_callback); + view_dispatcher_set_tick_event_callback( + app->view_dispatcher, subghz_remote_app_tick_event_callback, 100); + + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + + // Open Notification record + app->notifications = furi_record_open(RECORD_NOTIFICATION); + + // SubMenu + app->submenu = submenu_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, SubRemViewIDSubmenu, submenu_get_view(app->submenu)); + + // Dialog + app->dialogs = furi_record_open(RECORD_DIALOGS); + + // TextInput + app->text_input = text_input_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, SubRemViewIDTextInput, text_input_get_view(app->text_input)); + + // Widget + app->widget = widget_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, SubRemViewIDWidget, widget_get_view(app->widget)); + + // Popup + app->popup = popup_alloc(); + view_dispatcher_add_view(app->view_dispatcher, SubRemViewIDPopup, popup_get_view(app->popup)); + + // Remote view + app->subrem_remote_view = subrem_view_remote_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, + SubRemViewIDRemote, + subrem_view_remote_get_view(app->subrem_remote_view)); + + // Edit Menu view + app->subrem_edit_menu = subrem_view_edit_menu_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, + SubRemViewIDEditMenu, + subrem_view_edit_menu_get_view(app->subrem_edit_menu)); + + app->map_preset = malloc(sizeof(SubRemMapPreset)); + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + app->map_preset->subs_preset[i] = subrem_sub_file_preset_alloc(); + } + + app->txrx = subghz_txrx_alloc(); + + subghz_txrx_set_need_save_callback(app->txrx, subrem_save_active_sub, app); + + app->map_not_saved = false; + +#ifdef SUBREM_LIGHT + scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); +#else + scene_manager_next_scene(app->scene_manager, SubRemSceneStart); + scene_manager_set_scene_state( + app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemEditMapFile); +#endif + + return app; +} + +void subghz_remote_app_free(SubGhzRemoteApp* app) { + furi_assert(app); + /* + furi_hal_power_suppress_charge_exit(); + + // Disable power for External CC1101 if it was enabled and module is connected + furi_hal_subghz_disable_ext_power(); + // Reinit SPI handles for internal radio / nfc + furi_hal_subghz_init_radio_type(SubGhzRadioInternal); +*/ + // Submenu + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDSubmenu); + submenu_free(app->submenu); + + // Dialog + furi_record_close(RECORD_DIALOGS); + + // TextInput + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDTextInput); + text_input_free(app->text_input); + + // Widget + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDWidget); + widget_free(app->widget); + + // Popup + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDPopup); + popup_free(app->popup); + + // Remote view + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDRemote); + subrem_view_remote_free(app->subrem_remote_view); + + // Edit view + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDEditMenu); + subrem_view_edit_menu_free(app->subrem_edit_menu); + + scene_manager_free(app->scene_manager); + view_dispatcher_free(app->view_dispatcher); + + subghz_txrx_free(app->txrx); + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + subrem_sub_file_preset_free(app->map_preset->subs_preset[i]); + } + free(app->map_preset); + + // Notifications + furi_record_close(RECORD_NOTIFICATION); + app->notifications = NULL; + + // Close records + furi_record_close(RECORD_GUI); + + // Path strings + furi_string_free(app->file_path); + + free(app); +} + +int32_t subghz_remote_config_app(void* p) { + UNUSED(p); + SubGhzRemoteApp* subghz_remote_app = subghz_remote_app_alloc(); + + furi_string_set(subghz_remote_app->file_path, SUBREM_APP_FOLDER); + + view_dispatcher_run(subghz_remote_app->view_dispatcher); + + subghz_remote_app_free(subghz_remote_app); + + return 0; +} diff --git a/applications/external/subghz_remote_configurator/subghz_remote_app_i.c b/applications/external/subghz_remote_configurator/subghz_remote_app_i.c new file mode 100644 index 000000000..1eb64541f --- /dev/null +++ b/applications/external/subghz_remote_configurator/subghz_remote_app_i.c @@ -0,0 +1,270 @@ +#include "subghz_remote_app_i.h" +#include +#include + +#include "helpers/txrx/subghz_txrx.h" + +// #include +// #include + +// #include +// #include + +#define TAG "SubGhzRemote" + +static const char* map_file_labels[SubRemSubKeyNameMaxCount][2] = { + [SubRemSubKeyNameUp] = {"UP", "ULABEL"}, + [SubRemSubKeyNameDown] = {"DOWN", "DLABEL"}, + [SubRemSubKeyNameLeft] = {"LEFT", "LLABEL"}, + [SubRemSubKeyNameRight] = {"RIGHT", "RLABEL"}, + [SubRemSubKeyNameOk] = {"OK", "OKLABEL"}, +}; + +void subrem_map_preset_reset(SubRemMapPreset* map_preset) { + furi_assert(map_preset); + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + subrem_sub_file_preset_reset(map_preset->subs_preset[i]); + } +} + +static SubRemLoadMapState subrem_map_preset_check( + SubRemMapPreset* map_preset, + SubGhzTxRx* txrx, + FlipperFormat* fff_data_file) { + furi_assert(map_preset); + furi_assert(txrx); + + bool all_loaded = true; + SubRemLoadMapState ret = SubRemLoadMapStateErrorBrokenFile; + + SubRemLoadSubState sub_loadig_state; + SubRemSubFilePreset* sub_preset; + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = map_preset->subs_preset[i]; + + sub_loadig_state = SubRemLoadSubStateErrorNoFile; + + if(furi_string_empty(sub_preset->file_path)) { + // FURI_LOG_I(TAG, "Empty file path"); + } else if(!flipper_format_file_open_existing( + fff_data_file, furi_string_get_cstr(sub_preset->file_path))) { + sub_preset->load_state = SubRemLoadSubStateErrorNoFile; + FURI_LOG_W(TAG, "Error open file %s", furi_string_get_cstr(sub_preset->file_path)); + } else { + sub_loadig_state = subrem_sub_preset_load(sub_preset, txrx, fff_data_file); + } + + if(sub_loadig_state != SubRemLoadSubStateOK) { + all_loaded = false; + } else { + ret = SubRemLoadMapStateNotAllOK; + } + + if(ret != SubRemLoadMapStateErrorBrokenFile && all_loaded) { + ret = SubRemLoadMapStateOK; + } + + flipper_format_file_close(fff_data_file); + } + + return ret; +} + +static bool subrem_map_preset_load(SubRemMapPreset* map_preset, FlipperFormat* fff_data_file) { + furi_assert(map_preset); + bool ret = false; + SubRemSubFilePreset* sub_preset; + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = map_preset->subs_preset[i]; + if(!flipper_format_read_string( + fff_data_file, map_file_labels[i][0], sub_preset->file_path)) { +#if FURI_DEBUG + FURI_LOG_W(TAG, "No file patch for %s", map_file_labels[i][0]); +#endif + sub_preset->type = SubGhzProtocolTypeUnknown; + } else if(!path_contains_only_ascii(furi_string_get_cstr(sub_preset->file_path))) { + FURI_LOG_E(TAG, "Incorrect characters in [%s] file path", map_file_labels[i][0]); + sub_preset->type = SubGhzProtocolTypeUnknown; + } else if(!flipper_format_rewind(fff_data_file)) { + // Rewind error + } else if(!flipper_format_read_string( + fff_data_file, map_file_labels[i][1], sub_preset->label)) { +#if FURI_DEBUG + FURI_LOG_W(TAG, "No Label for %s", map_file_labels[i][0]); +#endif + ret = true; + } else { + ret = true; + } + if(ret) { + // Preload seccesful + FURI_LOG_I( + TAG, + "%-5s: %s %s", + map_file_labels[i][0], + furi_string_get_cstr(sub_preset->label), + furi_string_get_cstr(sub_preset->file_path)); + sub_preset->load_state = SubRemLoadSubStatePreloaded; + } + + flipper_format_rewind(fff_data_file); + } + return ret; +} + +SubRemLoadMapState subrem_map_file_load(SubGhzRemoteApp* app, const char* file_path) { + furi_assert(app); + furi_assert(file_path); +#if FURI_DEBUG + FURI_LOG_I(TAG, "Load Map File Start"); +#endif + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); + SubRemLoadMapState ret = SubRemLoadMapStateErrorOpenError; +#if FURI_DEBUG + FURI_LOG_I(TAG, "Open Map File.."); +#endif + subrem_map_preset_reset(app->map_preset); + + if(!flipper_format_file_open_existing(fff_data_file, file_path)) { + FURI_LOG_E(TAG, "Could not open MAP file %s", file_path); + ret = SubRemLoadMapStateErrorOpenError; + } else { + if(!subrem_map_preset_load(app->map_preset, fff_data_file)) { + FURI_LOG_E(TAG, "Could no Sub file path in MAP file"); + // ret = // error for popup + } else if(!flipper_format_file_close(fff_data_file)) { + ret = SubRemLoadMapStateErrorOpenError; + } else { + ret = subrem_map_preset_check(app->map_preset, app->txrx, fff_data_file); + } + } + + if(ret == SubRemLoadMapStateOK) { + FURI_LOG_I(TAG, "Load Map File Seccesful"); + } else if(ret == SubRemLoadMapStateNotAllOK) { + FURI_LOG_I(TAG, "Load Map File Seccesful [Not all files]"); + } else { + FURI_LOG_E(TAG, "Broken Map File"); + } + + flipper_format_file_close(fff_data_file); + flipper_format_free(fff_data_file); + + furi_record_close(RECORD_STORAGE); + return ret; +} + +bool subrem_save_protocol_to_file(FlipperFormat* flipper_format, const char* sub_file_name) { + furi_assert(flipper_format); + furi_assert(sub_file_name); + + Storage* storage = furi_record_open(RECORD_STORAGE); + Stream* flipper_format_stream = flipper_format_get_raw_stream(flipper_format); + + bool saved = false; + uint32_t repeat = 200; + FuriString* file_dir = furi_string_alloc(); + + path_extract_dirname(sub_file_name, file_dir); + do { + // removing additional fields + flipper_format_delete_key(flipper_format, "Repeat"); + // flipper_format_delete_key(flipper_format, "Manufacture"); + + if(!storage_simply_remove(storage, sub_file_name)) { + break; + } + + //ToDo check Write + stream_seek(flipper_format_stream, 0, StreamOffsetFromStart); + stream_save_to_file(flipper_format_stream, storage, sub_file_name, FSOM_CREATE_ALWAYS); + + if(!flipper_format_insert_or_update_uint32(flipper_format, "Repeat", &repeat, 1)) { + FURI_LOG_E(TAG, "Unable Repeat"); + break; + } + + saved = true; + } while(0); + + furi_string_free(file_dir); + furi_record_close(RECORD_STORAGE); + return saved; +} + +void subrem_save_active_sub(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + SubRemSubFilePreset* sub_preset = app->map_preset->subs_preset[app->chusen_sub]; + subrem_save_protocol_to_file( + sub_preset->fff_data, furi_string_get_cstr(sub_preset->file_path)); +} + +SubRemLoadMapState subrem_load_from_file(SubGhzRemoteApp* app) { + furi_assert(app); + + FuriString* file_path = furi_string_alloc(); + SubRemLoadMapState ret = SubRemLoadMapStateBack; + + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options(&browser_options, SUBREM_APP_EXTENSION, &I_subrem_10px); + browser_options.base_path = SUBREM_APP_FOLDER; + + // Input events and views are managed by file_select + if(!dialog_file_browser_show(app->dialogs, app->file_path, app->file_path, &browser_options)) { + } else { + ret = subrem_map_file_load(app, furi_string_get_cstr(app->file_path)); + } + + furi_string_free(file_path); + + return ret; +} + +bool subrem_save_map_to_file(SubGhzRemoteApp* app) { + furi_assert(app); + + const char* file_name = furi_string_get_cstr(app->file_path); + bool saved = false; + FlipperFormat* fff_data = flipper_format_string_alloc(); + + SubRemSubFilePreset* sub_preset; + + flipper_format_write_header_cstr( + fff_data, SUBREM_APP_APP_FILE_TYPE, SUBREM_APP_APP_FILE_VERSION); + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = app->map_preset->subs_preset[i]; + if(!furi_string_empty(sub_preset->file_path)) { + flipper_format_write_string(fff_data, map_file_labels[i][0], sub_preset->file_path); + } + } + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = app->map_preset->subs_preset[i]; + if(!furi_string_empty(sub_preset->file_path)) { + flipper_format_write_string(fff_data, map_file_labels[i][1], sub_preset->label); + } + } + + Storage* storage = furi_record_open(RECORD_STORAGE); + Stream* flipper_format_stream = flipper_format_get_raw_stream(fff_data); + + do { + if(!storage_simply_remove(storage, file_name)) { + break; + } + //ToDo check Write + stream_seek(flipper_format_stream, 0, StreamOffsetFromStart); + stream_save_to_file(flipper_format_stream, storage, file_name, FSOM_CREATE_ALWAYS); + + saved = true; + } while(0); + + furi_record_close(RECORD_STORAGE); + flipper_format_free(fff_data); + + return saved; +} \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/subghz_remote_app_i.h b/applications/external/subghz_remote_configurator/subghz_remote_app_i.h new file mode 100644 index 000000000..ce5f31009 --- /dev/null +++ b/applications/external/subghz_remote_configurator/subghz_remote_app_i.h @@ -0,0 +1,67 @@ +#pragma once + +#include "helpers/subrem_types.h" +#include "helpers/subrem_presets.h" +#include "scenes/subrem_scene.h" + +#include "helpers/txrx/subghz_txrx.h" +#include + +#include "views/remote.h" +#include "views/edit_menu.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#define SUBREM_APP_FOLDER EXT_PATH("subghz_remote") +#define SUBREM_MAX_LEN_NAME 64 + +typedef struct { + Gui* gui; + ViewDispatcher* view_dispatcher; + SceneManager* scene_manager; + NotificationApp* notifications; + DialogsApp* dialogs; + Widget* widget; + Popup* popup; + TextInput* text_input; + Submenu* submenu; + + FuriString* file_path; + char file_name_tmp[SUBREM_MAX_LEN_NAME]; + + SubRemViewRemote* subrem_remote_view; + SubRemViewEditMenu* subrem_edit_menu; + + SubRemMapPreset* map_preset; + + SubGhzTxRx* txrx; + + bool map_not_saved; + + uint8_t chusen_sub; +} SubGhzRemoteApp; + +SubRemLoadMapState subrem_load_from_file(SubGhzRemoteApp* app); + +SubRemLoadMapState subrem_map_file_load(SubGhzRemoteApp* app, const char* file_path); + +void subrem_map_preset_reset(SubRemMapPreset* map_preset); + +bool subrem_save_map_to_file(SubGhzRemoteApp* app); + +void subrem_save_active_sub(void* context); \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/views/edit_menu.c b/applications/external/subghz_remote_configurator/views/edit_menu.c new file mode 100644 index 000000000..9b88182b5 --- /dev/null +++ b/applications/external/subghz_remote_configurator/views/edit_menu.c @@ -0,0 +1,290 @@ +#include "edit_menu.h" +#include "../subghz_remote_app_i.h" + +#include +#include + +#define subrem_view_edit_menu_MAX_LABEL_LENGTH 12 + +#define FRAME_HEIGHT 12 + +struct SubRemViewEditMenu { + View* view; + SubRemViewEditMenuCallback callback; + void* context; +}; + +typedef struct { + FuriString* label; + FuriString* file_path; + SubRemLoadSubState sub_state; + + uint8_t chusen; +} SubRemViewEditMenuModel; + +void subrem_view_edit_menu_set_callback( + SubRemViewEditMenu* subrem_view_edit_menu, + SubRemViewEditMenuCallback callback, + void* context) { + furi_assert(subrem_view_edit_menu); + + subrem_view_edit_menu->callback = callback; + subrem_view_edit_menu->context = context; +} + +void subrem_view_edit_menu_add_data_to_show( + SubRemViewEditMenu* subrem_view_edit_remote, + uint8_t index, + FuriString* label, + FuriString* path, + SubRemLoadSubState state) { + furi_assert(subrem_view_edit_remote); + + with_view_model( + subrem_view_edit_remote->view, + SubRemViewEditMenuModel * model, + { + model->chusen = index; + if(!furi_string_empty(label)) { + furi_string_set(model->label, label); + } else { + furi_string_set(model->label, "Empty label"); + } + furi_string_set(model->file_path, path); + model->sub_state = state; + }, + true); +} + +uint8_t subrem_view_edit_menu_get_index(SubRemViewEditMenu* subrem_view_edit_remote) { + furi_assert(subrem_view_edit_remote); + uint8_t index; + + with_view_model( + subrem_view_edit_remote->view, + SubRemViewEditMenuModel * model, + { index = model->chusen; }, + true); + return index; +} + +void subrem_view_edit_menu_draw(Canvas* canvas, SubRemViewEditMenuModel* model) { + canvas_clear(canvas); + canvas_set_color(canvas, ColorBlack); + + canvas_clear(canvas); + + // Draw bottom btn + canvas_set_font(canvas, FontSecondary); + elements_button_left(canvas, "Back"); + elements_button_center(canvas, "Edit"); + elements_button_right(canvas, "Save"); + + // Draw top frame + canvas_draw_line(canvas, 1, 0, 125, 0); + canvas_draw_box(canvas, 0, 1, 127, FRAME_HEIGHT - 2); + canvas_draw_line(canvas, 1, FRAME_HEIGHT - 1, 125, FRAME_HEIGHT - 1); + + canvas_set_color(canvas, ColorWhite); + + // Draw btn name + canvas_set_font(canvas, FontPrimary); + switch(model->chusen) { + case SubRemSubKeyNameUp: + canvas_draw_str(canvas, 3, FRAME_HEIGHT - 2, "UP"); + break; + + case SubRemSubKeyNameDown: + canvas_draw_str(canvas, 3, FRAME_HEIGHT - 2, "DOWN"); + break; + + case SubRemSubKeyNameLeft: + canvas_draw_str(canvas, 3, FRAME_HEIGHT - 2, "LEFT"); + break; + + case SubRemSubKeyNameRight: + canvas_draw_str(canvas, 3, FRAME_HEIGHT - 2, "RIGHT"); + break; + + case SubRemSubKeyNameOk: + canvas_draw_str(canvas, 3, FRAME_HEIGHT - 2, "OK"); + break; + + default: + break; + } + + // Draw Label + canvas_set_font(canvas, FontSecondary); + elements_text_box( + canvas, + 38, + 2, + 127 - 38, + FRAME_HEIGHT, + AlignCenter, + AlignBottom, + furi_string_empty(model->label) ? "Empty label" : furi_string_get_cstr(model->label), + true); + + // Draw arrow + canvas_set_color(canvas, ColorBlack); + if(model->chusen != 0) { + canvas_draw_icon(canvas, 119, 13, &I_Pin_arrow_up_7x9); + } + if(model->chusen != 4) { + canvas_draw_icon_ex(canvas, 119, 42, &I_Pin_arrow_up_7x9, IconRotation180); + } + + // Draw file_path + if(model->sub_state == SubRemLoadSubStateOK) { + canvas_set_font(canvas, FontSecondary); + elements_text_box( + canvas, + 1, + FRAME_HEIGHT + 1, + 118, + (63 - FRAME_HEIGHT * 2), + AlignLeft, + AlignTop, + furi_string_get_cstr(model->file_path), + false); + } else if(furi_string_empty(model->file_path)) { + canvas_set_font(canvas, FontPrimary); + canvas_draw_str(canvas, 1, FRAME_HEIGHT * 2 - 2, "Button not set"); + } else { + canvas_set_font(canvas, FontPrimary); + canvas_draw_str(canvas, 1, FRAME_HEIGHT * 2 - 2, "ERR:"); + canvas_set_font(canvas, FontSecondary); + switch(model->sub_state) { + case SubRemLoadSubStateErrorNoFile: + canvas_draw_str(canvas, 26, FRAME_HEIGHT * 2 - 2, "File not found"); + break; + case SubRemLoadSubStateErrorFreq: + canvas_draw_str(canvas, 26, FRAME_HEIGHT * 2 - 2, "Bad frequency"); + break; + case SubRemLoadSubStateErrorMod: + canvas_draw_str(canvas, 26, FRAME_HEIGHT * 2 - 2, "Bad modulation"); + break; + case SubRemLoadSubStateErrorProtocol: + canvas_draw_str(canvas, 26, FRAME_HEIGHT * 2 - 2, "Unsupported protocol"); + break; + + default: + break; + } + elements_text_box( + canvas, + 1, + FRAME_HEIGHT * 2, + 118, + 30, + AlignLeft, + AlignTop, + furi_string_get_cstr(model->file_path), + false); + } +} + +bool subrem_view_edit_menu_input(InputEvent* event, void* context) { + furi_assert(context); + SubRemViewEditMenu* subrem_view_edit_menu = context; + + if((event->key == InputKeyBack || event->key == InputKeyLeft) && + event->type == InputTypeShort) { + subrem_view_edit_menu->callback( + SubRemCustomEventViewEditMenuBack, subrem_view_edit_menu->context); + return true; + } else if(event->key == InputKeyUp && event->type == InputTypeShort) { + with_view_model( + subrem_view_edit_menu->view, + SubRemViewEditMenuModel * model, + { + if(model->chusen > 0) { + model->chusen -= 1; + }; + }, + true); + subrem_view_edit_menu->callback( + SubRemCustomEventViewEditMenuUP, subrem_view_edit_menu->context); + return true; + } else if(event->key == InputKeyDown && event->type == InputTypeShort) { + with_view_model( + subrem_view_edit_menu->view, + SubRemViewEditMenuModel * model, + { + if(model->chusen < 4) { + model->chusen += 1; + }; + }, + true); + subrem_view_edit_menu->callback( + SubRemCustomEventViewEditMenuDOWN, subrem_view_edit_menu->context); + return true; + } else if(event->key == InputKeyOk && event->type == InputTypeShort) { + subrem_view_edit_menu->callback( + SubRemCustomEventViewEditMenuEdit, subrem_view_edit_menu->context); + return true; + } else if(event->key == InputKeyRight && event->type == InputTypeShort) { + subrem_view_edit_menu->callback( + SubRemCustomEventViewEditMenuSave, subrem_view_edit_menu->context); + return true; + } + + return true; +} + +void subrem_view_edit_menu_enter(void* context) { + furi_assert(context); +} + +void subrem_view_edit_menu_exit(void* context) { + furi_assert(context); +} + +SubRemViewEditMenu* subrem_view_edit_menu_alloc() { + SubRemViewEditMenu* subrem_view_edit_menu = malloc(sizeof(SubRemViewEditMenu)); + + // View allocation and configuration + subrem_view_edit_menu->view = view_alloc(); + view_allocate_model( + subrem_view_edit_menu->view, ViewModelTypeLocking, sizeof(SubRemViewEditMenuModel)); + view_set_context(subrem_view_edit_menu->view, subrem_view_edit_menu); + view_set_draw_callback( + subrem_view_edit_menu->view, (ViewDrawCallback)subrem_view_edit_menu_draw); + view_set_input_callback(subrem_view_edit_menu->view, subrem_view_edit_menu_input); + view_set_enter_callback(subrem_view_edit_menu->view, subrem_view_edit_menu_enter); + view_set_exit_callback(subrem_view_edit_menu->view, subrem_view_edit_menu_exit); + + with_view_model( + subrem_view_edit_menu->view, + SubRemViewEditMenuModel * model, + { + model->label = furi_string_alloc(); // furi_string_alloc_set_str("LABEL"); + model->file_path = furi_string_alloc(); // furi_string_alloc_set_str("FILE_PATH"); + + model->chusen = 0; + }, + true); + return subrem_view_edit_menu; +} + +void subrem_view_edit_menu_free(SubRemViewEditMenu* subghz_edit_menu) { + furi_assert(subghz_edit_menu); + + with_view_model( + subghz_edit_menu->view, + SubRemViewEditMenuModel * model, + { + furi_string_free(model->label); + furi_string_free(model->file_path); + }, + true); + view_free(subghz_edit_menu->view); + free(subghz_edit_menu); +} + +View* subrem_view_edit_menu_get_view(SubRemViewEditMenu* subrem_view_edit_menu) { + furi_assert(subrem_view_edit_menu); + return subrem_view_edit_menu->view; +} \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/views/edit_menu.h b/applications/external/subghz_remote_configurator/views/edit_menu.h new file mode 100644 index 000000000..7ceb7fac0 --- /dev/null +++ b/applications/external/subghz_remote_configurator/views/edit_menu.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include "../helpers/subrem_custom_event.h" +#include "../helpers/subrem_presets.h" + +typedef struct SubRemViewEditMenu SubRemViewEditMenu; + +typedef void (*SubRemViewEditMenuCallback)(SubRemCustomEvent event, void* context); + +void subrem_view_edit_menu_set_callback( + SubRemViewEditMenu* subrem_view_edit_menu, + SubRemViewEditMenuCallback callback, + void* context); + +SubRemViewEditMenu* subrem_view_edit_menu_alloc(); + +void subrem_view_edit_menu_free(SubRemViewEditMenu* subrem_view_edit_menu); + +View* subrem_view_edit_menu_get_view(SubRemViewEditMenu* subrem_view_edit_menu); + +void subrem_view_edit_menu_add_data_to_show( + SubRemViewEditMenu* subrem_view_edit_remote, + uint8_t index, + FuriString* label, + FuriString* path, + SubRemLoadSubState state); + +uint8_t subrem_view_edit_menu_get_index(SubRemViewEditMenu* subrem_view_edit_remote); \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/views/remote.c b/applications/external/subghz_remote_configurator/views/remote.c new file mode 100644 index 000000000..c2b41cfd6 --- /dev/null +++ b/applications/external/subghz_remote_configurator/views/remote.c @@ -0,0 +1,294 @@ +#include "remote.h" +#include "../subghz_remote_app_i.h" + +#include +#include + +#include + +#define SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH 30 +#define SUBREM_VIEW_REMOTE_LEFT_OFFSET 10 +#define SUBREM_VIEW_REMOTE_RIGHT_OFFSET 22 + +struct SubRemViewRemote { + View* view; + SubRemViewRemoteCallback callback; + void* context; +}; + +typedef struct { + char* labels[SubRemSubKeyNameMaxCount]; + + SubRemViewRemoteState state; + + uint8_t pressed_btn; +} SubRemViewRemoteModel; + +void subrem_view_remote_set_callback( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteCallback callback, + void* context) { + furi_assert(subrem_view_remote); + + subrem_view_remote->callback = callback; + subrem_view_remote->context = context; +} + +void subrem_view_remote_update_data_labels( + SubRemViewRemote* subrem_view_remote, + SubRemSubFilePreset** subs_presets) { + furi_assert(subrem_view_remote); + furi_assert(subs_presets); + + FuriString* labels[SubRemSubKeyNameMaxCount]; + SubRemSubFilePreset* sub_preset; + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = subs_presets[i]; + switch(sub_preset->load_state) { + case SubRemLoadSubStateOK: + if(!furi_string_empty(sub_preset->label)) { + labels[i] = furi_string_alloc_set(sub_preset->label); + } else if(!furi_string_empty(sub_preset->file_path)) { + labels[i] = furi_string_alloc(); + path_extract_filename(sub_preset->file_path, labels[i], true); + } else { + labels[i] = furi_string_alloc_set("Empty Label"); + } + break; + + case SubRemLoadSubStateErrorNoFile: + labels[i] = furi_string_alloc_set("[X] Can't open file"); + break; + + case SubRemLoadSubStateErrorFreq: + case SubRemLoadSubStateErrorMod: + case SubRemLoadSubStateErrorProtocol: + labels[i] = furi_string_alloc_set("[X] Error in .sub file"); + break; + + default: + labels[i] = furi_string_alloc_set(""); + break; + } + } + + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + strncpy( + model->labels[i], + furi_string_get_cstr(labels[i]), + SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH); + } + }, + true); + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + furi_string_free(labels[i]); + } +} + +void subrem_view_remote_set_state( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteState state, + uint8_t presed_btn) { + furi_assert(subrem_view_remote); + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + model->state = state; + model->pressed_btn = presed_btn; + }, + true); +} + +void subrem_view_remote_draw(Canvas* canvas, SubRemViewRemoteModel* model) { + canvas_clear(canvas); + canvas_set_color(canvas, ColorBlack); + + canvas_clear(canvas); + + //Icons for Labels + //canvas_draw_icon(canvas, 0, 0, &I_SubGHzRemote_LeftAlignedButtons_9x64); + canvas_draw_icon(canvas, 1, 5, &I_ButtonUp_7x4); + canvas_draw_icon(canvas, 1, 15, &I_ButtonDown_7x4); + canvas_draw_icon(canvas, 2, 23, &I_ButtonLeft_4x7); + canvas_draw_icon(canvas, 2, 33, &I_ButtonRight_4x7); + canvas_draw_icon(canvas, 0, 42, &I_Ok_btn_9x9); + canvas_draw_icon(canvas, 0, 53, &I_back_10px); + + //Labels + canvas_set_font(canvas, FontSecondary); + uint8_t y = 0; + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + elements_text_box( + canvas, + SUBREM_VIEW_REMOTE_LEFT_OFFSET, + y + 2, + 126 - SUBREM_VIEW_REMOTE_LEFT_OFFSET - SUBREM_VIEW_REMOTE_RIGHT_OFFSET, + 12, + AlignLeft, + AlignBottom, + model->labels[i], + false); + y += 10; + } + + if(model->state == SubRemViewRemoteStateOFF) { + elements_button_left(canvas, "Back"); + elements_button_right(canvas, "Save"); + } else { + canvas_draw_str_aligned(canvas, 11, 62, AlignLeft, AlignBottom, "Hold=Exit."); + } + + //Status text and indicator + canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); + + if(model->state == SubRemViewRemoteStateIdle || model->state == SubRemViewRemoteStateOFF) { + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Idle"); + } else { + switch(model->state) { + case SubRemViewRemoteStateSending: + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Send"); + break; + case SubRemViewRemoteStateLoading: + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Load"); + break; + default: +#if FURI_DEBUG + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Wrong_state"); +#endif + break; + } + + switch(model->pressed_btn) { + case SubRemSubKeyNameUp: + canvas_draw_icon(canvas, 116, 17, &I_Pin_arrow_up_7x9); + break; + case SubRemSubKeyNameDown: + canvas_draw_icon_ex(canvas, 116, 17, &I_Pin_arrow_up_7x9, IconRotation180); + break; + case SubRemSubKeyNameLeft: + canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation270); + break; + case SubRemSubKeyNameRight: + canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation90); + break; + case SubRemSubKeyNameOk: + canvas_draw_icon(canvas, 116, 18, &I_Pin_star_7x7); + break; + } + } +} + +bool subrem_view_remote_input(InputEvent* event, void* context) { + furi_assert(context); + SubRemViewRemote* subrem_view_remote = context; + + if(event->key == InputKeyBack && event->type == InputTypeLong) { + subrem_view_remote->callback(SubRemCustomEventViewRemoteBack, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyBack && event->type == InputTypeShort) { + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { model->pressed_btn = 0; }, + true); + subrem_view_remote->callback( + SubRemCustomEventViewRemoteForcedStop, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyBack) { + return true; + } + // BACK button processing end + + if(event->key == InputKeyUp && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartUP, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyDown && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartDOWN, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyLeft && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartLEFT, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyRight && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartRIGHT, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyOk && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartOK, subrem_view_remote->context); + return true; + } else if(event->type == InputTypeRelease) { + subrem_view_remote->callback(SubRemCustomEventViewRemoteStop, subrem_view_remote->context); + return true; + } + + return true; +} + +void subrem_view_remote_enter(void* context) { + furi_assert(context); +} + +void subrem_view_remote_exit(void* context) { + furi_assert(context); +} + +SubRemViewRemote* subrem_view_remote_alloc() { + SubRemViewRemote* subrem_view_remote = malloc(sizeof(SubRemViewRemote)); + + // View allocation and configuration + subrem_view_remote->view = view_alloc(); + view_allocate_model( + subrem_view_remote->view, ViewModelTypeLocking, sizeof(SubRemViewRemoteModel)); + view_set_context(subrem_view_remote->view, subrem_view_remote); + view_set_draw_callback(subrem_view_remote->view, (ViewDrawCallback)subrem_view_remote_draw); + view_set_input_callback(subrem_view_remote->view, subrem_view_remote_input); + view_set_enter_callback(subrem_view_remote->view, subrem_view_remote_enter); + view_set_exit_callback(subrem_view_remote->view, subrem_view_remote_exit); + + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + model->state = SubRemViewRemoteStateIdle; + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + model->labels[i] = malloc(sizeof(char) * SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH + 1); + strcpy(model->labels[i], ""); + } + + model->pressed_btn = 0; + }, + true); + return subrem_view_remote; +} + +void subrem_view_remote_free(SubRemViewRemote* subghz_remote) { + furi_assert(subghz_remote); + + with_view_model( + subghz_remote->view, + SubRemViewRemoteModel * model, + { + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + free(model->labels[i]); + } + }, + true); + view_free(subghz_remote->view); + free(subghz_remote); +} + +View* subrem_view_remote_get_view(SubRemViewRemote* subrem_view_remote) { + furi_assert(subrem_view_remote); + return subrem_view_remote->view; +} \ No newline at end of file diff --git a/applications/external/subghz_remote_configurator/views/remote.h b/applications/external/subghz_remote_configurator/views/remote.h new file mode 100644 index 000000000..5b1e8153a --- /dev/null +++ b/applications/external/subghz_remote_configurator/views/remote.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include "../helpers/subrem_custom_event.h" +#include "../helpers/subrem_presets.h" + +typedef enum { + SubRemViewRemoteStateIdle, + SubRemViewRemoteStateLoading, + SubRemViewRemoteStateSending, + SubRemViewRemoteStateOFF, +} SubRemViewRemoteState; + +typedef struct SubRemViewRemote SubRemViewRemote; + +typedef void (*SubRemViewRemoteCallback)(SubRemCustomEvent event, void* context); + +void subrem_view_remote_set_callback( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteCallback callback, + void* context); + +SubRemViewRemote* subrem_view_remote_alloc(); + +void subrem_view_remote_free(SubRemViewRemote* subrem_view_remote); + +View* subrem_view_remote_get_view(SubRemViewRemote* subrem_view_remote); + +void subrem_view_remote_update_data_labels( + SubRemViewRemote* subrem_view_remote, + SubRemSubFilePreset** subs_presets); + +void subrem_view_remote_set_state( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteState state, + uint8_t presed_btn); \ No newline at end of file diff --git a/applications/external/tetris_game/tetris_game.c b/applications/external/tetris_game/tetris_game.c index a569f46d4..5752e1fc3 100644 --- a/applications/external/tetris_game/tetris_game.c +++ b/applications/external/tetris_game/tetris_game.c @@ -367,11 +367,8 @@ int32_t tetris_game_app() { // Not doing this eventually causes issues with TimerSvc due to not sleeping/yielding enough in this task TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME); - TaskHandle_t curr_task = xTaskGetHandle("Tetris Game"); - uint32_t origTimerPrio = uxTaskPriorityGet(timer_task); - uint32_t myPrio = uxTaskPriorityGet(curr_task); - vTaskPrioritySet(timer_task, myPrio + 1); + vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1); ViewPort* view_port = view_port_alloc(); view_port_set_orientation(view_port, ViewPortOrientationVertical); @@ -475,7 +472,7 @@ int32_t tetris_game_app() { view_port_free(view_port); furi_message_queue_free(event_queue); furi_mutex_free(tetris_state->mutex); - vTaskPrioritySet(timer_task, origTimerPrio); + vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY); free(newPiece); free(tetris_state); diff --git a/applications/external/totp/features_config.h b/applications/external/totp/features_config.h index 683eff2fc..c789af27b 100644 --- a/applications/external/totp/features_config.h +++ b/applications/external/totp/features_config.h @@ -7,8 +7,8 @@ // List of compatible firmwares #define TOTP_FIRMWARE_OFFICIAL_STABLE 1 #define TOTP_FIRMWARE_OFFICIAL_DEV 2 -#define TOTP_FIRMWARE_XTREME 3 +#define TOTP_FIRMWARE_UL_XFW 3 // XFW and UL now has same bluetooth mac/advname changing API // End of list // Target firmware to build for -#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_XTREME \ No newline at end of file +#define TOTP_TARGET_FIRMWARE TOTP_FIRMWARE_UL_XFW diff --git a/applications/external/totp/services/config/config.c b/applications/external/totp/services/config/config.c index f97bc6b26..7b935e1ea 100644 --- a/applications/external/totp/services/config/config.c +++ b/applications/external/totp/services/config/config.c @@ -177,6 +177,10 @@ static bool totp_open_config_file(Storage* storage, FlipperFormat** file) { flipper_format_write_uint32( fff_data_file, TOTP_CONFIG_KEY_AUTOMATION_METHOD, &tmp_uint32, 1); + // Default Font = 0 + tmp_uint32 = 0; + flipper_format_write_uint32(fff_data_file, TOTP_CONFIG_KEY_SELECTED_FONT, &tmp_uint32, 1); + if(!flipper_format_rewind(fff_data_file)) { totp_close_config_file(fff_data_file); FURI_LOG_E(LOGGING_TAG, "Rewind error"); @@ -259,6 +263,24 @@ bool totp_config_file_update_automation_method(const PluginState* plugin_state) return update_result; } +bool totp_config_file_update_selected_font(const PluginState* plugin_state) { + FlipperFormat* file = plugin_state->config_file_context->config_file; + flipper_format_rewind(file); + bool update_result = false; + + do { + uint32_t tmp_uint32 = plugin_state->selected_font; + if(!flipper_format_insert_or_update_uint32( + file, TOTP_CONFIG_KEY_SELECTED_FONT, &tmp_uint32, 1)) { + break; + } + + update_result = true; + } while(false); + + return update_result; +} + bool totp_config_file_update_user_settings(const PluginState* plugin_state) { FlipperFormat* file = plugin_state->config_file_context->config_file; flipper_format_rewind(file); @@ -280,6 +302,12 @@ bool totp_config_file_update_user_settings(const PluginState* plugin_state) { break; } + tmp_uint32 = plugin_state->selected_font; + if(!flipper_format_insert_or_update_uint32( + file, TOTP_CONFIG_KEY_SELECTED_FONT, &tmp_uint32, 1)) { + break; + } + update_result = true; } while(false); @@ -428,6 +456,16 @@ bool totp_config_file_load(PluginState* const plugin_state) { plugin_state->automation_method = tmp_uint32; + // Load selected font + flipper_format_rewind(fff_data_file); + + if(!flipper_format_read_uint32( + fff_data_file, TOTP_CONFIG_KEY_SELECTED_FONT, &tmp_uint32, 1)) { + tmp_uint32 = 0; + } + + plugin_state->selected_font = tmp_uint32; + plugin_state->config_file_context = malloc(sizeof(ConfigFileContext)); furi_check(plugin_state->config_file_context != NULL); plugin_state->config_file_context->storage = storage; diff --git a/applications/external/totp/services/config/config.h b/applications/external/totp/services/config/config.h index d2fe957c6..cc278ab5a 100644 --- a/applications/external/totp/services/config/config.h +++ b/applications/external/totp/services/config/config.h @@ -44,6 +44,13 @@ bool totp_config_file_update_notification_method(const PluginState* plugin_state */ bool totp_config_file_update_automation_method(const PluginState* plugin_state); +/** + * @brief Updates selected font in an application config file + * @param plugin_state application state + * @return Config file update result + */ +bool totp_config_file_update_selected_font(const PluginState* plugin_state); + /** * @brief Updates application user settings * @param plugin_state application state diff --git a/applications/external/totp/services/config/constants.h b/applications/external/totp/services/config/constants.h index 3a33c80b3..27a4f56c4 100644 --- a/applications/external/totp/services/config/constants.h +++ b/applications/external/totp/services/config/constants.h @@ -18,3 +18,4 @@ #define TOTP_CONFIG_KEY_PINSET "PinIsSet" #define TOTP_CONFIG_KEY_NOTIFICATION_METHOD "NotificationMethod" #define TOTP_CONFIG_KEY_AUTOMATION_METHOD "AutomationMethod" +#define TOTP_CONFIG_KEY_SELECTED_FONT "SelectedFont" diff --git a/applications/external/totp/services/config/migrations/common_migration.c b/applications/external/totp/services/config/migrations/common_migration.c index 07026fb1f..9cee422a5 100644 --- a/applications/external/totp/services/config/migrations/common_migration.c +++ b/applications/external/totp/services/config/migrations/common_migration.c @@ -58,6 +58,15 @@ bool totp_config_migrate_to_latest( flipper_format_rewind(fff_backup_data_file); + // Font + + if(flipper_format_read_string( + fff_backup_data_file, TOTP_CONFIG_KEY_SELECTED_FONT, temp_str)) { + flipper_format_write_string(fff_data_file, TOTP_CONFIG_KEY_SELECTED_FONT, temp_str); + } + + flipper_format_rewind(fff_backup_data_file); + while(true) { if(!flipper_format_read_string( fff_backup_data_file, TOTP_CONFIG_KEY_TOKEN_NAME, temp_str)) { diff --git a/applications/external/totp/totp_app.c b/applications/external/totp/totp_app.c index f620a3b48..8b0a8c1fa 100644 --- a/applications/external/totp/totp_app.c +++ b/applications/external/totp/totp_app.c @@ -107,6 +107,7 @@ static bool totp_activate_initial_scene(PluginState* const plugin_state) { } static bool totp_plugin_state_init(PluginState* const plugin_state) { + plugin_state->selected_font = 0; plugin_state->gui = furi_record_open(RECORD_GUI); plugin_state->notification_app = furi_record_open(RECORD_NOTIFICATION); plugin_state->dialogs_app = furi_record_open(RECORD_DIALOGS); diff --git a/applications/external/totp/types/plugin_state.h b/applications/external/totp/types/plugin_state.h index c20594f37..97d126330 100644 --- a/applications/external/totp/types/plugin_state.h +++ b/applications/external/totp/types/plugin_state.h @@ -80,6 +80,11 @@ typedef struct { */ NotificationMethod notification_method; + /** + * @brief Numbers Font + */ + uint8_t selected_font; + /** * @brief Main rendering loop mutex */ diff --git a/applications/external/totp/ui/fonts/712serif/712serif.c b/applications/external/totp/ui/fonts/712serif/712serif.c new file mode 100644 index 000000000..0fe73378c --- /dev/null +++ b/applications/external/totp/ui/fonts/712serif/712serif.c @@ -0,0 +1,940 @@ +#include "712serif.h" + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +/* +** Font data for 7:12 Serif 24pt +*/ + +/* Character bitmaps for 7:12 Serif 24pt */ +const uint8_t _712Serif_24ptBitmaps[] = { + /* @0 '-' (14 pixels wide) */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + /* @28 '0' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @56 '1' (14 pixels wide) */ + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xFC, + 0x00, + 0xFC, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + + /* @84 '2' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0xC0, + 0x03, + 0xC0, + 0x03, + 0x30, + 0x00, + 0x30, + 0x00, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + + /* @112 '3' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0xC0, + 0x03, + 0xC0, + 0x03, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @140 '4' (14 pixels wide) */ + 0x30, + 0x03, + 0x30, + 0x03, + 0x30, + 0x03, + 0x30, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x00, + 0x03, + 0x00, + 0x03, + 0xC0, + 0x0F, + 0xC0, + 0x0F, + + /* @168 '5' (14 pixels wide) */ + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0xFC, + 0x03, + 0xFC, + 0x03, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @196 '6' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0xFC, + 0x03, + 0xFC, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @224 '7' (14 pixels wide) */ + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + + /* @252 '8' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @280 '9' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x0F, + 0xF0, + 0x0F, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @308 'B' (14 pixels wide) */ + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0xFF, + 0x0F, + 0xFF, + 0x0F, + + /* @336 'C' (14 pixels wide) */ + 0xF0, + 0x33, + 0xF0, + 0x33, + 0x0C, + 0x3C, + 0x0C, + 0x3C, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x30, + 0x03, + 0x30, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @364 'D' (14 pixels wide) */ + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xFF, + 0x03, + 0xFF, + 0x03, + + /* @392 'F' (14 pixels wide) */ + 0xFF, + 0x3F, + 0xFF, + 0x3F, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0xFC, + 0x03, + 0xFC, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x3F, + 0x00, + 0x3F, + 0x00, + + /* @420 'G' (14 pixels wide) */ + 0xF0, + 0x33, + 0xF0, + 0x33, + 0x0C, + 0x3C, + 0x0C, + 0x3C, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x3F, + 0x03, + 0x3F, + 0x03, + 0x30, + 0x03, + 0x30, + 0x0C, + 0x3C, + 0x0C, + 0x3C, + 0xF0, + 0x33, + 0xF0, + 0x33, + + /* @448 'H' (14 pixels wide) */ + 0x3F, + 0x3F, + 0x3F, + 0x3F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x3F, + 0x3F, + 0x3F, + 0x3F, + + /* @476 'J' (14 pixels wide) */ + 0x00, + 0x3F, + 0x00, + 0x3F, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @504 'K' (14 pixels wide) */ + 0x3F, + 0x3F, + 0x3F, + 0x3F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x3F, + 0x3F, + 0x3F, + 0x3F, + + /* @532 'M' (14 pixels wide) */ + 0x0F, + 0x3C, + 0x0F, + 0x3C, + 0x3C, + 0x0F, + 0x3C, + 0x0F, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x3F, + 0x3F, + 0x3F, + 0x3F, + + /* @560 'N' (14 pixels wide) */ + 0x0F, + 0x3F, + 0x0F, + 0x3F, + 0x3C, + 0x0C, + 0x3C, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0x0C, + 0x0F, + 0x0C, + 0x0F, + 0x3F, + 0x0C, + 0x3F, + 0x0C, + + /* @588 'P' (14 pixels wide) */ + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x3C, + 0x30, + 0x3C, + 0x30, + 0xCC, + 0x0F, + 0xCC, + 0x0F, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x3F, + 0x00, + 0x3F, + 0x00, + + /* @616 'Q' (14 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x03, + 0x30, + 0x03, + 0x30, + 0xF3, + 0x30, + 0xF3, + 0x30, + 0x03, + 0x33, + 0x03, + 0x33, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xF0, + 0x33, + 0xF0, + 0x33, + + /* @644 'R' (14 pixels wide) */ + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0x0C, + 0x30, + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x0C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x3F, + 0x3F, + 0x3F, + 0x3F, + + /* @672 'T' (14 pixels wide) */ + 0xFF, + 0x3F, + 0xFF, + 0x3F, + 0xC3, + 0x30, + 0xC3, + 0x30, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xF0, + 0x03, + 0xF0, + 0x03, + + /* @700 'V' (14 pixels wide) */ + 0x3F, + 0x3F, + 0x3F, + 0x3F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x30, + 0x03, + 0x30, + 0x03, + 0x30, + 0x03, + 0x30, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + + /* @728 'W' (14 pixels wide) */ + 0x3F, + 0x3F, + 0x3F, + 0x3F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0xCC, + 0x0C, + 0x30, + 0x03, + 0x30, + 0x03, + 0x30, + 0x03, + 0x30, + 0x03, + + /* @756 'X' (14 pixels wide) */ + 0x3F, + 0x3F, + 0x3F, + 0x3F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x30, + 0x03, + 0x30, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0x30, + 0x03, + 0x30, + 0x03, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x3F, + 0x3F, + 0x3F, + 0x3F, + + /* @784 'Y' (14 pixels wide) */ + 0x3F, + 0x3F, + 0x3F, + 0x3F, + 0x0C, + 0x0C, + 0x0C, + 0x0C, + 0x30, + 0x03, + 0x30, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xF0, + 0x03, + 0xF0, + 0x03, +}; + +/* Character descriptors for 7:12 Serif 24pt */ +/* { [Char width in bits], [Offset into _712Serif_24ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO _712Serif_24ptDescriptors[] = { + {14, 0}, /* - */ + {0, 0}, /* . */ + {0, 0}, /* / */ + {14, 28}, /* 0 */ + {14, 56}, /* 1 */ + {14, 84}, /* 2 */ + {14, 112}, /* 3 */ + {14, 140}, /* 4 */ + {14, 168}, /* 5 */ + {14, 196}, /* 6 */ + {14, 224}, /* 7 */ + {14, 252}, /* 8 */ + {14, 280}, /* 9 */ + {0, 0}, /* : */ + {0, 0}, /* ; */ + {0, 0}, /* < */ + {0, 0}, /* = */ + {0, 0}, /* > */ + {0, 0}, /* ? */ + {0, 0}, /* @ */ + {0, 0}, /* A */ + {14, 308}, /* B */ + {14, 336}, /* C */ + {14, 364}, /* D */ + {0, 0}, /* E */ + {14, 392}, /* F */ + {14, 420}, /* G */ + {14, 448}, /* H */ + {0, 0}, /* I */ + {14, 476}, /* J */ + {14, 504}, /* K */ + {0, 0}, /* L */ + {14, 532}, /* M */ + {14, 560}, /* N */ + {0, 0}, /* O */ + {14, 588}, /* P */ + {14, 616}, /* Q */ + {14, 644}, /* R */ + {0, 0}, /* S */ + {14, 672}, /* T */ + {0, 0}, /* U */ + {14, 700}, /* V */ + {14, 728}, /* W */ + {14, 756}, /* X */ + {14, 784}, /* Y */ +}; + +/* Font information for 7:12 Serif 24pt */ +const FONT_INFO _712Serif_24ptFontInfo = { + 14, /* Character height */ + '-', /* Start character */ + 'Y', /* End character */ + 2, /* Width, in pixels, of space character */ + _712Serif_24ptDescriptors, /* Character descriptor array */ + _712Serif_24ptBitmaps, /* Character bitmap array */ +}; diff --git a/applications/external/totp/ui/fonts/712serif/712serif.h b/applications/external/totp/ui/fonts/712serif/712serif.h new file mode 100644 index 000000000..81959064d --- /dev/null +++ b/applications/external/totp/ui/fonts/712serif/712serif.h @@ -0,0 +1,8 @@ +#pragma once + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +#include "../font_info.h" + +/* Font data for 7:12 Serif 24pt */ +extern const FONT_INFO _712Serif_24ptFontInfo; diff --git a/applications/external/totp/ui/fonts/active_font.h b/applications/external/totp/ui/fonts/active_font.h new file mode 100644 index 000000000..054fa4a55 --- /dev/null +++ b/applications/external/totp/ui/fonts/active_font.h @@ -0,0 +1,12 @@ +#pragma once + +#include "../../features_config.h" +#include "font_info.h" + +#include "mode_nine/mode_nine.h" +#include "redhat_mono/redhat_mono.h" +#include "bedstead/bedstead.h" +#include "zector/zector.h" +#include "712serif/712serif.h" +#include "graph35pix/graph35pix.h" +#include "karma_future/karma_future.h" diff --git a/applications/external/totp/ui/fonts/bedstead/bedstead.c b/applications/external/totp/ui/fonts/bedstead/bedstead.c new file mode 100644 index 000000000..ec6680fab --- /dev/null +++ b/applications/external/totp/ui/fonts/bedstead/bedstead.c @@ -0,0 +1,1056 @@ +#include "bedstead.h" + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +/* +** Font data for Bedstead 17pt +*/ + +/* Character bitmaps for Bedstead 17pt */ +const uint8_t bedstead_17ptBitmaps[] = { + /* @0 '-' (13 pixels wide) */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xF8, + 0x07, + 0xF8, + 0x07, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + /* @32 '0' (13 pixels wide) */ + 0xE0, + 0x00, + 0xF0, + 0x01, + 0xF8, + 0x03, + 0xBC, + 0x07, + 0x1E, + 0x0F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0x1E, + 0x0F, + 0xBC, + 0x07, + 0xF8, + 0x03, + 0xF0, + 0x01, + 0xE0, + 0x00, + + /* @64 '1' (13 pixels wide) */ + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xF8, + 0x00, + 0xF8, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xF8, + 0x03, + 0xF8, + 0x03, + + /* @96 '2' (13 pixels wide) */ + 0xF0, + 0x07, + 0xFC, + 0x0F, + 0x1E, + 0x1E, + 0x1E, + 0x1C, + 0x0E, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1E, + 0xC0, + 0x0F, + 0xE0, + 0x07, + 0xF0, + 0x00, + 0x7C, + 0x00, + 0x3E, + 0x00, + 0x1E, + 0x00, + 0x0E, + 0x00, + 0xFE, + 0x1F, + 0xFE, + 0x1F, + + /* @128 '3' (13 pixels wide) */ + 0xFE, + 0x1F, + 0xFE, + 0x1F, + 0x00, + 0x1C, + 0x00, + 0x1E, + 0x00, + 0x0F, + 0x00, + 0x0F, + 0x00, + 0x07, + 0xE0, + 0x07, + 0xE0, + 0x0F, + 0x00, + 0x1E, + 0x00, + 0x1C, + 0x0E, + 0x1C, + 0x1E, + 0x1C, + 0x3E, + 0x0E, + 0xFC, + 0x0F, + 0xF8, + 0x07, + + /* @160 '4' (13 pixels wide) */ + 0x80, + 0x03, + 0x80, + 0x03, + 0xE0, + 0x03, + 0xF0, + 0x03, + 0xF8, + 0x03, + 0xBC, + 0x03, + 0x9E, + 0x03, + 0x8F, + 0x03, + 0x87, + 0x03, + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0x80, + 0x03, + 0x80, + 0x03, + 0x80, + 0x03, + 0x80, + 0x03, + 0x80, + 0x03, + + /* @192 '5' (13 pixels wide) */ + 0xFF, + 0x1F, + 0xFF, + 0x1F, + 0x07, + 0x00, + 0x07, + 0x00, + 0xFF, + 0x07, + 0xFF, + 0x0F, + 0x00, + 0x1E, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0xFE, + 0x0F, + 0xFC, + 0x07, + 0xFC, + 0x07, + + /* @224 '6' (13 pixels wide) */ + 0xE0, + 0x07, + 0xF0, + 0x07, + 0x78, + 0x00, + 0x3C, + 0x00, + 0x1E, + 0x00, + 0x0F, + 0x00, + 0x07, + 0x00, + 0xFF, + 0x07, + 0xFF, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0x1E, + 0x0F, + 0xFE, + 0x0F, + 0xFC, + 0x07, + + /* @256 '7' (13 pixels wide) */ + 0xFE, + 0x1F, + 0xFE, + 0x1F, + 0x00, + 0x1C, + 0x00, + 0x1E, + 0x00, + 0x0F, + 0x80, + 0x07, + 0xC0, + 0x03, + 0xE0, + 0x01, + 0xF0, + 0x00, + 0x78, + 0x00, + 0x38, + 0x00, + 0x38, + 0x00, + 0x38, + 0x00, + 0x38, + 0x00, + 0x38, + 0x00, + 0x38, + 0x00, + + /* @288 '8' (13 pixels wide) */ + 0xFC, + 0x07, + 0xFE, + 0x0F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0xFE, + 0x0F, + 0xFE, + 0x0F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0x1E, + 0x0F, + 0xFE, + 0x0F, + 0xFC, + 0x07, + + /* @320 '9' (13 pixels wide) */ + 0xFC, + 0x07, + 0xFE, + 0x0F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1C, + 0xFE, + 0x1F, + 0xFC, + 0x1F, + 0x00, + 0x1C, + 0x00, + 0x1E, + 0x00, + 0x0F, + 0x80, + 0x07, + 0xC0, + 0x03, + 0xFC, + 0x01, + 0xFC, + 0x00, + + /* @352 'B' (13 pixels wide) */ + 0xFF, + 0x07, + 0xFF, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1E, + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1E, + 0x07, + 0x0F, + 0xFF, + 0x0F, + 0xFF, + 0x07, + + /* @384 'C' (13 pixels wide) */ + 0xFC, + 0x01, + 0xFE, + 0x07, + 0x0F, + 0x0F, + 0x07, + 0x0F, + 0x07, + 0x0E, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x0F, + 0x8F, + 0x0F, + 0xFE, + 0x07, + 0xFC, + 0x03, + + /* @416 'D' (13 pixels wide) */ + 0xFF, + 0x07, + 0xFF, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1E, + 0x07, + 0x0F, + 0xFF, + 0x0F, + 0xFF, + 0x07, + + /* @448 'F' (13 pixels wide) */ + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + + /* @480 'G' (13 pixels wide) */ + 0xFC, + 0x07, + 0xFE, + 0x0F, + 0x0F, + 0x1F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x87, + 0x1F, + 0x87, + 0x1F, + 0x07, + 0x1C, + 0x0F, + 0x1C, + 0xFE, + 0x1F, + 0xFC, + 0x1F, + 0xFC, + 0x1F, + + /* @512 'H' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0xFF, + 0x1F, + 0xFF, + 0x1F, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + + /* @544 'J' (13 pixels wide) */ + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x00, + 0x1C, + 0x0E, + 0x1C, + 0x1E, + 0x1C, + 0x3E, + 0x1E, + 0xFC, + 0x0F, + 0xF8, + 0x07, + + /* @576 'K' (13 pixels wide) */ + 0x07, + 0x0E, + 0x07, + 0x0F, + 0x87, + 0x07, + 0xC7, + 0x03, + 0xE7, + 0x01, + 0xF7, + 0x00, + 0x7F, + 0x00, + 0x3F, + 0x00, + 0x3F, + 0x00, + 0x7F, + 0x00, + 0xF7, + 0x00, + 0xE7, + 0x01, + 0xC7, + 0x03, + 0x87, + 0x07, + 0x07, + 0x0F, + 0x07, + 0x0E, + + /* @608 'M' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0xBF, + 0x1F, + 0xFF, + 0x1F, + 0xFF, + 0x1F, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + + /* @640 'N' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x3F, + 0x1C, + 0x7F, + 0x1C, + 0xFF, + 0x1C, + 0xE7, + 0x1F, + 0xC7, + 0x1F, + 0x87, + 0x1F, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + + /* @672 'P' (13 pixels wide) */ + 0xFF, + 0x07, + 0xFF, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1E, + 0xFF, + 0x0F, + 0xFF, + 0x07, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + 0x07, + 0x00, + + /* @704 'Q' (13 pixels wide) */ + 0xFC, + 0x07, + 0xFE, + 0x0F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1F, + 0xC7, + 0x0F, + 0x8F, + 0x07, + 0xDE, + 0x0F, + 0xFE, + 0x1F, + 0xFC, + 0x1C, + + /* @736 'R' (13 pixels wide) */ + 0xFF, + 0x07, + 0xFF, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1E, + 0xFF, + 0x0F, + 0xFF, + 0x07, + 0xE7, + 0x00, + 0xE7, + 0x01, + 0xC7, + 0x03, + 0x87, + 0x07, + 0x07, + 0x0F, + 0x07, + 0x1E, + 0x07, + 0x1C, + + /* @768 'T' (13 pixels wide) */ + 0xFF, + 0x1F, + 0xFF, + 0x1F, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + + /* @800 'V' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x1F, + 0x1F, + 0xBC, + 0x07, + 0xB8, + 0x03, + 0xB8, + 0x03, + 0xF8, + 0x07, + 0xF0, + 0x03, + 0xE0, + 0x01, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + + /* @832 'W' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0xE7, + 0x1C, + 0xFF, + 0x1F, + 0xFE, + 0x0F, + 0xFE, + 0x0F, + 0xBC, + 0x07, + + /* @864 'X' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0x1E, + 0x0F, + 0xBC, + 0x07, + 0xF8, + 0x03, + 0xF0, + 0x01, + 0xF0, + 0x01, + 0xF8, + 0x03, + 0xBC, + 0x07, + 0x1E, + 0x0F, + 0x0F, + 0x1E, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + + /* @896 'Y' (13 pixels wide) */ + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x0F, + 0x1E, + 0x1E, + 0x0F, + 0xBC, + 0x07, + 0xF8, + 0x03, + 0xF0, + 0x01, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, +}; + +/* Character descriptors for Bedstead 17pt */ +/* { [Char width in bits], [Offset into bedstead_17ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO bedstead_17ptDescriptors[] = { + {13, 0}, /* - */ + {0, 0}, /* . */ + {0, 0}, /* / */ + {13, 32}, /* 0 */ + {13, 64}, /* 1 */ + {13, 96}, /* 2 */ + {13, 128}, /* 3 */ + {13, 160}, /* 4 */ + {13, 192}, /* 5 */ + {13, 224}, /* 6 */ + {13, 256}, /* 7 */ + {13, 288}, /* 8 */ + {13, 320}, /* 9 */ + {0, 0}, /* : */ + {0, 0}, /* ; */ + {0, 0}, /* < */ + {0, 0}, /* = */ + {0, 0}, /* > */ + {0, 0}, /* ? */ + {0, 0}, /* @ */ + {0, 0}, /* A */ + {13, 352}, /* B */ + {13, 384}, /* C */ + {13, 416}, /* D */ + {0, 0}, /* E */ + {13, 448}, /* F */ + {13, 480}, /* G */ + {13, 512}, /* H */ + {0, 0}, /* I */ + {13, 544}, /* J */ + {13, 576}, /* K */ + {0, 0}, /* L */ + {13, 608}, /* M */ + {13, 640}, /* N */ + {0, 0}, /* O */ + {13, 672}, /* P */ + {13, 704}, /* Q */ + {13, 736}, /* R */ + {0, 0}, /* S */ + {13, 768}, /* T */ + {0, 0}, /* U */ + {13, 800}, /* V */ + {13, 832}, /* W */ + {13, 864}, /* X */ + {13, 896}, /* Y */ +}; + +/* Font information for Bedstead 17pt */ +const FONT_INFO bedstead_17ptFontInfo = { + 16, /* Character height */ + '-', /* Start character */ + 'Y', /* End character */ + 2, /* Width, in pixels, of space character */ + bedstead_17ptDescriptors, /* Character descriptor array */ + bedstead_17ptBitmaps, /* Character bitmap array */ +}; diff --git a/applications/external/totp/ui/fonts/bedstead/bedstead.h b/applications/external/totp/ui/fonts/bedstead/bedstead.h new file mode 100644 index 000000000..0f4c10949 --- /dev/null +++ b/applications/external/totp/ui/fonts/bedstead/bedstead.h @@ -0,0 +1,8 @@ +#pragma once + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +#include "../font_info.h" + +/* Font data for Bedstead 17pt */ +extern const FONT_INFO bedstead_17ptFontInfo; diff --git a/applications/external/totp/ui/fonts/graph35pix/graph35pix.c b/applications/external/totp/ui/fonts/graph35pix/graph35pix.c new file mode 100644 index 000000000..fd93d4de9 --- /dev/null +++ b/applications/external/totp/ui/fonts/graph35pix/graph35pix.c @@ -0,0 +1,940 @@ +#include "graph35pix.h" + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +/* +** Font data for Graph 35+ pix 12pt +*/ + +/* Character bitmaps for Graph 35+ pix 12pt */ +const uint8_t graph35pix_12ptBitmaps[] = { + /* @0 '-' (10 pixels wide) */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + /* @28 '0' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0xC3, + 0x03, + 0xC3, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x0F, + 0x03, + 0x0F, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @56 '1' (10 pixels wide) */ + 0x30, + 0x00, + 0x30, + 0x00, + 0x3C, + 0x00, + 0x3C, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @84 '2' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0xFF, + 0x03, + 0xFF, + 0x03, + + /* @112 '3' (10 pixels wide) */ + 0xFF, + 0x03, + 0xFF, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0x00, + 0x03, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @140 '4' (10 pixels wide) */ + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xF0, + 0x00, + 0xF0, + 0x00, + 0xCC, + 0x00, + 0xCC, + 0x00, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0xFF, + 0x03, + 0xFF, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + + /* @168 '5' (10 pixels wide) */ + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x03, + 0x00, + 0x03, + 0x00, + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @196 '6' (10 pixels wide) */ + 0xF0, + 0x00, + 0xF0, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @224 '7' (10 pixels wide) */ + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + + /* @252 '8' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @280 '9' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x03, + 0xFC, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0x3C, + 0x00, + 0x3C, + 0x00, + + /* @308 'B' (10 pixels wide) */ + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFF, + 0x00, + 0xFF, + 0x00, + + /* @336 'C' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x00, + 0xFC, + 0x00, + + /* @364 'D' (10 pixels wide) */ + 0x3F, + 0x00, + 0x3F, + 0x00, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x3F, + 0x00, + 0x3F, + 0x00, + + /* @392 'F' (10 pixels wide) */ + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + + /* @420 'G' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x00, + 0x03, + 0x00, + 0xF3, + 0x03, + 0xF3, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFC, + 0x03, + 0xFC, + 0x03, + + /* @448 'H' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + + /* @476 'J' (10 pixels wide) */ + 0xF0, + 0x03, + 0xF0, + 0x03, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC0, + 0x00, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x3C, + 0x00, + 0x3C, + 0x00, + + /* @504 'K' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x33, + 0x00, + 0x33, + 0x00, + 0x0F, + 0x00, + 0x0F, + 0x00, + 0x33, + 0x00, + 0x33, + 0x00, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + + /* @532 'M' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0xCF, + 0x03, + 0xCF, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + + /* @560 'N' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0x0F, + 0x03, + 0x0F, + 0x03, + 0x0F, + 0x03, + 0x0F, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0xC3, + 0x03, + 0xC3, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + + /* @588 'P' (10 pixels wide) */ + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + + /* @616 'Q' (10 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x3C, + 0x03, + 0x3C, + 0x03, + + /* @644 'R' (10 pixels wide) */ + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xFF, + 0x00, + 0xFF, + 0x00, + 0x33, + 0x00, + 0x33, + 0x00, + 0xC3, + 0x00, + 0xC3, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + + /* @672 'T' (10 pixels wide) */ + 0xFF, + 0x03, + 0xFF, + 0x03, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + + /* @700 'V' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xCC, + 0x00, + 0xCC, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + + /* @728 'W' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0x33, + 0x03, + 0xCC, + 0x00, + 0xCC, + 0x00, + + /* @756 'X' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xCC, + 0x00, + 0xCC, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0xCC, + 0x00, + 0xCC, + 0x00, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + + /* @784 'Y' (10 pixels wide) */ + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0x03, + 0xCC, + 0x00, + 0xCC, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, +}; + +/* Character descriptors for Graph 35+ pix 12pt */ +/* { [Char width in bits], [Offset into graph35pix_12ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO graph35pix_12ptDescriptors[] = { + {10, 0}, /* - */ + {0, 0}, /* . */ + {0, 0}, /* / */ + {10, 28}, /* 0 */ + {10, 56}, /* 1 */ + {10, 84}, /* 2 */ + {10, 112}, /* 3 */ + {10, 140}, /* 4 */ + {10, 168}, /* 5 */ + {10, 196}, /* 6 */ + {10, 224}, /* 7 */ + {10, 252}, /* 8 */ + {10, 280}, /* 9 */ + {0, 0}, /* : */ + {0, 0}, /* ; */ + {0, 0}, /* < */ + {0, 0}, /* = */ + {0, 0}, /* > */ + {0, 0}, /* ? */ + {0, 0}, /* @ */ + {0, 0}, /* A */ + {10, 308}, /* B */ + {10, 336}, /* C */ + {10, 364}, /* D */ + {0, 0}, /* E */ + {10, 392}, /* F */ + {10, 420}, /* G */ + {10, 448}, /* H */ + {0, 0}, /* I */ + {10, 476}, /* J */ + {10, 504}, /* K */ + {0, 0}, /* L */ + {10, 532}, /* M */ + {10, 560}, /* N */ + {0, 0}, /* O */ + {10, 588}, /* P */ + {10, 616}, /* Q */ + {10, 644}, /* R */ + {0, 0}, /* S */ + {10, 672}, /* T */ + {0, 0}, /* U */ + {10, 700}, /* V */ + {10, 728}, /* W */ + {10, 756}, /* X */ + {10, 784}, /* Y */ +}; + +/* Font information for Graph 35+ pix 12pt */ +const FONT_INFO graph35pix_12ptFontInfo = { + 14, /* Character height */ + '-', /* Start character */ + 'Y', /* End character */ + 2, /* Width, in pixels, of space character */ + graph35pix_12ptDescriptors, /* Character descriptor array */ + graph35pix_12ptBitmaps, /* Character bitmap array */ +}; diff --git a/applications/external/totp/ui/fonts/graph35pix/graph35pix.h b/applications/external/totp/ui/fonts/graph35pix/graph35pix.h new file mode 100644 index 000000000..07838e3ba --- /dev/null +++ b/applications/external/totp/ui/fonts/graph35pix/graph35pix.h @@ -0,0 +1,8 @@ +#pragma once + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +#include "../font_info.h" + +/* Font data for Graph 35+ pix 12pt */ +extern const FONT_INFO graph35pix_12ptFontInfo; diff --git a/applications/external/totp/ui/fonts/karma_future/karma_future.c b/applications/external/totp/ui/fonts/karma_future/karma_future.c new file mode 100644 index 000000000..ed6201441 --- /dev/null +++ b/applications/external/totp/ui/fonts/karma_future/karma_future.c @@ -0,0 +1,1172 @@ +#include "karma_future.h" + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +/* +** Font data for Karma Future 14pt +*/ + +/* Character bitmaps for Karma Future 14pt */ +const uint8_t karmaFuture_14ptBitmaps[] = { + /* @0 '-' (12 pixels wide) */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xFE, + 0x03, + 0x02, + 0x02, + 0x02, + 0x02, + 0xFE, + 0x03, + 0xFC, + 0x03, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + /* @36 '0' (12 pixels wide) */ + 0xF8, + 0x01, + 0x0E, + 0x03, + 0x02, + 0x06, + 0xF3, + 0x06, + 0xF9, + 0x0C, + 0x79, + 0x0C, + 0x39, + 0x0D, + 0x99, + 0x0C, + 0xC9, + 0x0C, + 0xE9, + 0x0C, + 0xF1, + 0x0C, + 0xF1, + 0x0C, + 0xF1, + 0x0C, + 0xF3, + 0x0E, + 0x02, + 0x0E, + 0x0E, + 0x07, + 0xFC, + 0x07, + 0xF8, + 0x01, + + /* @72 '1' (12 pixels wide) */ + 0x70, + 0x00, + 0xD8, + 0x00, + 0xCE, + 0x00, + 0xC2, + 0x00, + 0xC2, + 0x00, + 0xDE, + 0x00, + 0xDC, + 0x00, + 0xDC, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xDE, + 0x03, + 0x02, + 0x02, + 0x02, + 0x02, + 0xFE, + 0x03, + 0xFC, + 0x03, + + /* @108 '2' (12 pixels wide) */ + 0xFC, + 0x03, + 0x06, + 0x03, + 0x03, + 0x06, + 0xF1, + 0x04, + 0xF9, + 0x0C, + 0xF9, + 0x0C, + 0x7F, + 0x0E, + 0x3E, + 0x0F, + 0x1E, + 0x0F, + 0x90, + 0x07, + 0xC8, + 0x03, + 0xE4, + 0x01, + 0xE6, + 0x00, + 0xF3, + 0x07, + 0x01, + 0x0C, + 0x01, + 0x0C, + 0xFF, + 0x0F, + 0xFE, + 0x0F, + + /* @144 '3' (12 pixels wide) */ + 0xFC, + 0x03, + 0x06, + 0x03, + 0x03, + 0x06, + 0xF1, + 0x04, + 0xF9, + 0x0C, + 0xFF, + 0x0C, + 0xFE, + 0x0C, + 0x0E, + 0x0E, + 0x08, + 0x0F, + 0xF8, + 0x0E, + 0xF8, + 0x04, + 0xFF, + 0x0C, + 0xF9, + 0x0C, + 0xF1, + 0x0C, + 0x03, + 0x0E, + 0x06, + 0x0F, + 0xFC, + 0x07, + 0xFC, + 0x03, + + /* @180 '4' (12 pixels wide) */ + 0xE0, + 0x03, + 0x30, + 0x03, + 0x10, + 0x03, + 0x08, + 0x03, + 0x4C, + 0x03, + 0x64, + 0x03, + 0x72, + 0x03, + 0x73, + 0x03, + 0x79, + 0x03, + 0x01, + 0x04, + 0x01, + 0x0C, + 0x7F, + 0x0F, + 0x7E, + 0x0F, + 0x7E, + 0x0F, + 0x40, + 0x03, + 0x40, + 0x03, + 0xC0, + 0x03, + 0x80, + 0x03, + + /* @216 '5' (12 pixels wide) */ + 0xFF, + 0x07, + 0x01, + 0x0C, + 0x01, + 0x0C, + 0xF9, + 0x0F, + 0xF9, + 0x0F, + 0xF9, + 0x0F, + 0x01, + 0x03, + 0x03, + 0x06, + 0xFE, + 0x04, + 0xFE, + 0x0C, + 0xFC, + 0x0C, + 0xFF, + 0x0C, + 0xF9, + 0x0C, + 0xF1, + 0x0C, + 0x03, + 0x0E, + 0x06, + 0x0F, + 0xFC, + 0x07, + 0xF8, + 0x03, + + /* @252 '6' (12 pixels wide) */ + 0xF0, + 0x03, + 0x10, + 0x03, + 0x08, + 0x03, + 0xCC, + 0x03, + 0xE6, + 0x03, + 0xF2, + 0x03, + 0xF2, + 0x00, + 0x01, + 0x03, + 0x01, + 0x06, + 0xF1, + 0x04, + 0xF9, + 0x0C, + 0xF9, + 0x0C, + 0xF9, + 0x0C, + 0xF1, + 0x0C, + 0x03, + 0x0E, + 0x06, + 0x0F, + 0xFC, + 0x07, + 0xF8, + 0x03, + + /* @288 '7' (12 pixels wide) */ + 0xFF, + 0x07, + 0x01, + 0x0C, + 0x01, + 0x0C, + 0xFF, + 0x0E, + 0xFE, + 0x0E, + 0x7E, + 0x0F, + 0x40, + 0x07, + 0x60, + 0x07, + 0x20, + 0x03, + 0x30, + 0x03, + 0x90, + 0x01, + 0x90, + 0x01, + 0xD0, + 0x00, + 0xC8, + 0x00, + 0xE8, + 0x00, + 0xE8, + 0x00, + 0x78, + 0x00, + 0x78, + 0x00, + + /* @324 '8' (12 pixels wide) */ + 0xF8, + 0x01, + 0x0C, + 0x01, + 0x06, + 0x03, + 0x72, + 0x06, + 0xF2, + 0x06, + 0xF2, + 0x06, + 0x72, + 0x06, + 0x06, + 0x07, + 0x02, + 0x06, + 0xF1, + 0x04, + 0xF9, + 0x0C, + 0xF9, + 0x0C, + 0xF9, + 0x0C, + 0xF1, + 0x0C, + 0x03, + 0x0E, + 0x06, + 0x0F, + 0xFC, + 0x07, + 0xF8, + 0x03, + + /* @360 '9' (12 pixels wide) */ + 0xFC, + 0x03, + 0x06, + 0x03, + 0x03, + 0x06, + 0xF1, + 0x04, + 0xF9, + 0x0C, + 0xF9, + 0x0C, + 0xF1, + 0x0C, + 0x03, + 0x0C, + 0x06, + 0x0C, + 0xFE, + 0x0E, + 0x7C, + 0x0E, + 0x38, + 0x0F, + 0x30, + 0x07, + 0x1C, + 0x07, + 0x84, + 0x03, + 0xC4, + 0x01, + 0xFC, + 0x00, + 0xF8, + 0x00, + + /* @396 'B' (12 pixels wide) */ + 0xFE, + 0x01, + 0x02, + 0x03, + 0x02, + 0x02, + 0x72, + 0x06, + 0xF2, + 0x06, + 0xF2, + 0x06, + 0x72, + 0x06, + 0x02, + 0x06, + 0x02, + 0x06, + 0xF2, + 0x0C, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0C, + 0x02, + 0x0E, + 0x02, + 0x0E, + 0xFE, + 0x07, + 0xFC, + 0x03, + + /* @432 'C' (12 pixels wide) */ + 0xF0, + 0x03, + 0x18, + 0x02, + 0x0C, + 0x06, + 0xE4, + 0x0C, + 0xE6, + 0x0D, + 0xF2, + 0x0F, + 0x72, + 0x0F, + 0x32, + 0x0F, + 0x12, + 0x00, + 0x12, + 0x00, + 0x12, + 0x00, + 0x32, + 0x07, + 0xA6, + 0x0D, + 0xE4, + 0x0C, + 0x08, + 0x0E, + 0x18, + 0x0E, + 0xF0, + 0x07, + 0xF0, + 0x03, + + /* @468 'D' (12 pixels wide) */ + 0xFE, + 0x01, + 0x02, + 0x03, + 0x02, + 0x02, + 0x72, + 0x06, + 0xF2, + 0x06, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0E, + 0xF2, + 0x0E, + 0x72, + 0x0E, + 0x02, + 0x06, + 0x02, + 0x07, + 0xFE, + 0x03, + 0xFC, + 0x01, + + /* @504 'F' (12 pixels wide) */ + 0xFE, + 0x07, + 0x02, + 0x0C, + 0x02, + 0x0C, + 0xF2, + 0x0F, + 0xF2, + 0x0F, + 0xF2, + 0x0F, + 0x12, + 0x00, + 0xF2, + 0x03, + 0x02, + 0x02, + 0xF2, + 0x03, + 0xF2, + 0x03, + 0xF2, + 0x03, + 0x12, + 0x00, + 0x12, + 0x00, + 0x12, + 0x00, + 0x12, + 0x00, + 0x1E, + 0x00, + 0x1C, + 0x00, + + /* @540 'G' (12 pixels wide) */ + 0xF0, + 0x07, + 0x18, + 0x06, + 0x0C, + 0x0C, + 0xE4, + 0x0D, + 0xE6, + 0x0F, + 0xF2, + 0x0F, + 0xF2, + 0x0F, + 0x32, + 0x04, + 0x32, + 0x0C, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xE6, + 0x0D, + 0xE6, + 0x0D, + 0xE4, + 0x0D, + 0x08, + 0x0C, + 0x18, + 0x0C, + 0xF0, + 0x0F, + 0xF0, + 0x0F, + + /* @576 'H' (12 pixels wide) */ + 0x1E, + 0x07, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0xF2, + 0x0D, + 0x02, + 0x0C, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x1E, + 0x0F, + 0x1C, + 0x0F, + + /* @612 'J' (12 pixels wide) */ + 0x80, + 0x03, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x80, + 0x06, + 0x8E, + 0x06, + 0x8A, + 0x06, + 0xDA, + 0x06, + 0x72, + 0x06, + 0x02, + 0x06, + 0x06, + 0x03, + 0xFC, + 0x03, + 0xF8, + 0x01, + + /* @648 'K' (12 pixels wide) */ + 0x1E, + 0x07, + 0x92, + 0x0D, + 0xD2, + 0x0C, + 0x72, + 0x0E, + 0x32, + 0x0E, + 0x12, + 0x0F, + 0x92, + 0x07, + 0xC2, + 0x03, + 0xC2, + 0x01, + 0x92, + 0x01, + 0x12, + 0x01, + 0x32, + 0x02, + 0x32, + 0x02, + 0x72, + 0x06, + 0xD2, + 0x0C, + 0x92, + 0x0D, + 0x9E, + 0x0F, + 0x1C, + 0x0F, + + /* @684 'M' (12 pixels wide) */ + 0x1E, + 0x07, + 0x92, + 0x0D, + 0xA2, + 0x0C, + 0xE2, + 0x0C, + 0x62, + 0x0C, + 0x62, + 0x0C, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x92, + 0x0D, + 0x92, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x1E, + 0x0F, + 0x1C, + 0x0F, + + /* @720 'N' (12 pixels wide) */ + 0x1E, + 0x07, + 0x12, + 0x0D, + 0x22, + 0x0D, + 0x62, + 0x0D, + 0x62, + 0x0D, + 0xD2, + 0x0D, + 0xD2, + 0x0D, + 0x92, + 0x0D, + 0x92, + 0x0D, + 0x32, + 0x0D, + 0x32, + 0x0D, + 0x72, + 0x0C, + 0x52, + 0x0C, + 0xD2, + 0x0C, + 0x92, + 0x0C, + 0x92, + 0x0D, + 0x1E, + 0x0F, + 0x1C, + 0x0F, + + /* @756 'P' (12 pixels wide) */ + 0xFE, + 0x03, + 0x02, + 0x02, + 0x02, + 0x06, + 0xF2, + 0x0C, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0C, + 0x02, + 0x0E, + 0x02, + 0x0E, + 0xF2, + 0x0F, + 0xF2, + 0x07, + 0xF2, + 0x03, + 0x12, + 0x00, + 0x12, + 0x00, + 0x12, + 0x00, + 0x1E, + 0x00, + 0x1C, + 0x00, + + /* @792 'Q' (12 pixels wide) */ + 0xF0, + 0x01, + 0x18, + 0x03, + 0x0C, + 0x02, + 0x64, + 0x06, + 0xE6, + 0x06, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0x32, + 0x0D, + 0x26, + 0x0E, + 0x26, + 0x0E, + 0x64, + 0x0E, + 0x08, + 0x0C, + 0x18, + 0x0D, + 0xF0, + 0x0F, + 0xF0, + 0x0F, + + /* @828 'R' (12 pixels wide) */ + 0xFE, + 0x03, + 0x02, + 0x02, + 0x02, + 0x06, + 0xF2, + 0x0C, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0D, + 0xF2, + 0x0C, + 0x02, + 0x0E, + 0x02, + 0x0E, + 0x12, + 0x0F, + 0x32, + 0x06, + 0x32, + 0x06, + 0x72, + 0x06, + 0xD2, + 0x0C, + 0x92, + 0x0D, + 0x9E, + 0x0F, + 0x1C, + 0x0F, + + /* @864 'T' (12 pixels wide) */ + 0xFE, + 0x03, + 0x02, + 0x02, + 0x02, + 0x02, + 0xDE, + 0x03, + 0xDC, + 0x03, + 0xDC, + 0x03, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xD0, + 0x00, + 0xF0, + 0x00, + 0xF0, + 0x00, + + /* @900 'V' (12 pixels wide) */ + 0x1E, + 0x07, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x92, + 0x0D, + 0xA6, + 0x0E, + 0xA4, + 0x0E, + 0xA4, + 0x0E, + 0xE4, + 0x06, + 0x6C, + 0x06, + 0x68, + 0x06, + 0x68, + 0x02, + 0x18, + 0x03, + 0x10, + 0x03, + 0x10, + 0x01, + 0x90, + 0x01, + 0x90, + 0x01, + 0xE0, + 0x01, + 0xE0, + 0x01, + + /* @936 'W' (12 pixels wide) */ + 0x1E, + 0x07, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0x12, + 0x0D, + 0xF2, + 0x0D, + 0x92, + 0x0D, + 0x12, + 0x0D, + 0x62, + 0x0C, + 0x62, + 0x0C, + 0xE2, + 0x0C, + 0xE2, + 0x0C, + 0xB2, + 0x0D, + 0x3E, + 0x0F, + 0x1C, + 0x0F, + + /* @972 'X' (12 pixels wide) */ + 0x1E, + 0x07, + 0x12, + 0x0D, + 0xB2, + 0x0D, + 0xA6, + 0x0E, + 0xE4, + 0x0E, + 0x6C, + 0x0E, + 0x18, + 0x07, + 0x98, + 0x07, + 0x90, + 0x03, + 0x10, + 0x01, + 0x68, + 0x02, + 0xE4, + 0x02, + 0xE4, + 0x06, + 0xE6, + 0x06, + 0xB2, + 0x0D, + 0x32, + 0x0D, + 0x1E, + 0x0F, + 0x1C, + 0x0E, + + /* @1008 'Y' (12 pixels wide) */ + 0x1E, + 0x07, + 0x12, + 0x0D, + 0xB2, + 0x0D, + 0xA6, + 0x0E, + 0xE4, + 0x0E, + 0x6C, + 0x0E, + 0x68, + 0x06, + 0x18, + 0x07, + 0x18, + 0x03, + 0x90, + 0x03, + 0x90, + 0x01, + 0x90, + 0x01, + 0xA0, + 0x01, + 0xA0, + 0x01, + 0xA0, + 0x01, + 0xE0, + 0x01, + 0xE0, + 0x01, + 0xE0, + 0x01, +}; + +/* Character descriptors for Karma Future 14pt */ +/* { [Char width in bits], [Offset into karmaFuture_14ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO karmaFuture_14ptDescriptors[] = { + {12, 0}, /* - */ + {0, 0}, /* . */ + {0, 0}, /* / */ + {12, 36}, /* 0 */ + {12, 72}, /* 1 */ + {12, 108}, /* 2 */ + {12, 144}, /* 3 */ + {12, 180}, /* 4 */ + {12, 216}, /* 5 */ + {12, 252}, /* 6 */ + {12, 288}, /* 7 */ + {12, 324}, /* 8 */ + {12, 360}, /* 9 */ + {0, 0}, /* : */ + {0, 0}, /* ; */ + {0, 0}, /* < */ + {0, 0}, /* = */ + {0, 0}, /* > */ + {0, 0}, /* ? */ + {0, 0}, /* @ */ + {0, 0}, /* A */ + {12, 396}, /* B */ + {12, 432}, /* C */ + {12, 468}, /* D */ + {0, 0}, /* E */ + {12, 504}, /* F */ + {12, 540}, /* G */ + {12, 576}, /* H */ + {0, 0}, /* I */ + {12, 612}, /* J */ + {12, 648}, /* K */ + {0, 0}, /* L */ + {12, 684}, /* M */ + {12, 720}, /* N */ + {0, 0}, /* O */ + {12, 756}, /* P */ + {12, 792}, /* Q */ + {12, 828}, /* R */ + {0, 0}, /* S */ + {12, 864}, /* T */ + {0, 0}, /* U */ + {12, 900}, /* V */ + {12, 936}, /* W */ + {12, 972}, /* X */ + {12, 1008}, /* Y */ +}; + +/* Font information for Karma Future 14pt */ +const FONT_INFO karmaFuture_14ptFontInfo = { + 18, /* Character height */ + '-', /* Start character */ + 'Y', /* End character */ + 2, /* Width, in pixels, of space character */ + karmaFuture_14ptDescriptors, /* Character descriptor array */ + karmaFuture_14ptBitmaps, /* Character bitmap array */ +}; diff --git a/applications/external/totp/ui/fonts/karma_future/karma_future.h b/applications/external/totp/ui/fonts/karma_future/karma_future.h new file mode 100644 index 000000000..3a6352ef1 --- /dev/null +++ b/applications/external/totp/ui/fonts/karma_future/karma_future.h @@ -0,0 +1,8 @@ +#pragma once + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +#include "../font_info.h" + +/* Font data for Karma Future 14pt */ +extern const FONT_INFO karmaFuture_14ptFontInfo; diff --git a/applications/external/totp/ui/fonts/mode-nine/mode_nine.c b/applications/external/totp/ui/fonts/mode_nine/mode_nine.c similarity index 100% rename from applications/external/totp/ui/fonts/mode-nine/mode_nine.c rename to applications/external/totp/ui/fonts/mode_nine/mode_nine.c diff --git a/applications/external/totp/ui/fonts/mode-nine/mode_nine.h b/applications/external/totp/ui/fonts/mode_nine/mode_nine.h similarity index 100% rename from applications/external/totp/ui/fonts/mode-nine/mode_nine.h rename to applications/external/totp/ui/fonts/mode_nine/mode_nine.h diff --git a/applications/external/totp/ui/fonts/redhat_mono/redhat_mono.c b/applications/external/totp/ui/fonts/redhat_mono/redhat_mono.c new file mode 100644 index 000000000..77f639d4a --- /dev/null +++ b/applications/external/totp/ui/fonts/redhat_mono/redhat_mono.c @@ -0,0 +1,1057 @@ +#include "redhat_mono.h" +#include + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +/* +** Font data for Red Hat Mono 16pt +*/ + +/* Character bitmaps for Red Hat Mono 16pt */ +const uint8_t redHatMono_16ptBitmaps[] = { + /* @0 '-' (12 pixels wide) */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xF8, + 0x03, + 0xF8, + 0x03, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + /* @32 '0' (12 pixels wide) */ + 0xF0, + 0x00, + 0xF8, + 0x03, + 0x1C, + 0x07, + 0x0E, + 0x07, + 0x8E, + 0x07, + 0x86, + 0x0E, + 0xC6, + 0x0C, + 0x66, + 0x0C, + 0x66, + 0x0C, + 0x36, + 0x0E, + 0x36, + 0x0E, + 0x1E, + 0x06, + 0x1C, + 0x07, + 0xF8, + 0x03, + 0xF0, + 0x01, + 0x00, + 0x00, + + /* @64 '1' (12 pixels wide) */ + 0x40, + 0x00, + 0x78, + 0x00, + 0x7E, + 0x00, + 0x66, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0x60, + 0x00, + 0xFE, + 0x07, + 0xFE, + 0x07, + 0x00, + 0x00, + + /* @96 '2' (12 pixels wide) */ + 0xF0, + 0x01, + 0xFC, + 0x03, + 0x0E, + 0x07, + 0x04, + 0x06, + 0x00, + 0x06, + 0x00, + 0x07, + 0x00, + 0x03, + 0x80, + 0x03, + 0xC0, + 0x01, + 0xE0, + 0x00, + 0x70, + 0x00, + 0x38, + 0x00, + 0x1C, + 0x00, + 0xFE, + 0x07, + 0xFE, + 0x07, + 0x00, + 0x00, + + /* @128 '3' (12 pixels wide) */ + 0xF0, + 0x00, + 0xFC, + 0x03, + 0x0E, + 0x07, + 0x04, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x80, + 0x03, + 0xE0, + 0x00, + 0xE0, + 0x03, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x0E, + 0x06, + 0x07, + 0xFE, + 0x07, + 0xF8, + 0x01, + 0x00, + 0x00, + + /* @160 '4' (12 pixels wide) */ + 0x00, + 0x03, + 0x80, + 0x03, + 0xC0, + 0x03, + 0xE0, + 0x03, + 0x70, + 0x03, + 0x30, + 0x03, + 0x18, + 0x03, + 0x0C, + 0x03, + 0x0E, + 0x03, + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x03, + 0x00, + 0x00, + + /* @192 '5' (12 pixels wide) */ + 0xFC, + 0x07, + 0xFC, + 0x07, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0xFC, + 0x01, + 0xFE, + 0x07, + 0x00, + 0x07, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x06, + 0x07, + 0xFE, + 0x03, + 0xF8, + 0x01, + 0x00, + 0x00, + + /* @224 '6' (12 pixels wide) */ + 0xE0, + 0x03, + 0xF8, + 0x07, + 0x3C, + 0x06, + 0x0C, + 0x00, + 0x0E, + 0x00, + 0x06, + 0x00, + 0xE6, + 0x03, + 0xFE, + 0x07, + 0x0E, + 0x0E, + 0x06, + 0x0C, + 0x06, + 0x0C, + 0x0E, + 0x0E, + 0x1C, + 0x06, + 0xF8, + 0x07, + 0xF0, + 0x03, + 0x00, + 0x00, + + /* @256 '7' (12 pixels wide) */ + 0xFE, + 0x0F, + 0xFE, + 0x0F, + 0x00, + 0x0E, + 0x00, + 0x06, + 0x00, + 0x07, + 0x00, + 0x03, + 0x80, + 0x01, + 0xC0, + 0x01, + 0xC0, + 0x00, + 0xE0, + 0x00, + 0x60, + 0x00, + 0x70, + 0x00, + 0x30, + 0x00, + 0x38, + 0x00, + 0x1C, + 0x00, + 0x00, + 0x00, + + /* @288 '8' (12 pixels wide) */ + 0xF0, + 0x01, + 0xFC, + 0x03, + 0x1C, + 0x07, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0C, + 0x06, + 0xBC, + 0x03, + 0xF0, + 0x01, + 0x1C, + 0x07, + 0x0E, + 0x06, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x0E, + 0x06, + 0xFC, + 0x07, + 0xF8, + 0x03, + 0x00, + 0x00, + + /* @320 '9' (12 pixels wide) */ + 0xF8, + 0x01, + 0xFC, + 0x03, + 0x0C, + 0x07, + 0x0E, + 0x0E, + 0x06, + 0x0C, + 0x06, + 0x0C, + 0x0E, + 0x0E, + 0xFC, + 0x0F, + 0xF8, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0E, + 0x00, + 0x06, + 0x8C, + 0x07, + 0xFC, + 0x03, + 0xF8, + 0x00, + 0x00, + 0x00, + + /* @352 'B' (12 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x03, + 0x8C, + 0x07, + 0x0C, + 0x06, + 0x0C, + 0x06, + 0x0C, + 0x07, + 0xFC, + 0x03, + 0xFC, + 0x01, + 0x8C, + 0x07, + 0x0C, + 0x06, + 0x0C, + 0x0E, + 0x0C, + 0x0E, + 0x0C, + 0x07, + 0xFC, + 0x07, + 0xFC, + 0x01, + 0x00, + 0x00, + + /* @384 'C' (12 pixels wide) */ + 0xF0, + 0x01, + 0xF8, + 0x03, + 0xBC, + 0x07, + 0x0C, + 0x06, + 0x0E, + 0x0E, + 0x0E, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x1C, + 0x07, + 0xF8, + 0x03, + 0xF0, + 0x01, + 0x00, + 0x00, + + /* @416 'D' (12 pixels wide) */ + 0x7E, + 0x00, + 0xFE, + 0x01, + 0xCE, + 0x03, + 0x0E, + 0x07, + 0x0E, + 0x06, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0E, + 0x0C, + 0x0E, + 0x0C, + 0x0E, + 0x0C, + 0x06, + 0x0C, + 0x07, + 0x8C, + 0x07, + 0xFC, + 0x03, + 0xFC, + 0x00, + 0x00, + 0x00, + + /* @448 'F' (12 pixels wide) */ + 0xFC, + 0x0F, + 0xFC, + 0x0F, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0xFC, + 0x01, + 0xFC, + 0x01, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x00, + 0x00, + + /* @480 'G' (12 pixels wide) */ + 0xF0, + 0x01, + 0xF8, + 0x03, + 0xBC, + 0x07, + 0x0C, + 0x06, + 0x0E, + 0x0E, + 0x06, + 0x00, + 0x06, + 0x00, + 0x86, + 0x0F, + 0x86, + 0x0F, + 0x06, + 0x0C, + 0x0E, + 0x0E, + 0x0E, + 0x06, + 0x1C, + 0x07, + 0xF8, + 0x03, + 0xF0, + 0x01, + 0x00, + 0x00, + + /* @512 'H' (12 pixels wide) */ + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0xFE, + 0x07, + 0xFE, + 0x07, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x00, + 0x00, + + /* @544 'J' (12 pixels wide) */ + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x00, + 0x06, + 0x04, + 0x06, + 0x07, + 0x07, + 0x8E, + 0x07, + 0xFC, + 0x03, + 0xF8, + 0x01, + 0x00, + 0x00, + + /* @576 'K' (12 pixels wide) */ + 0x0E, + 0x0E, + 0x0E, + 0x07, + 0x0E, + 0x03, + 0x8E, + 0x01, + 0xCE, + 0x01, + 0xEE, + 0x00, + 0x7E, + 0x00, + 0x3E, + 0x00, + 0x7E, + 0x00, + 0xEE, + 0x00, + 0xCE, + 0x01, + 0x8E, + 0x03, + 0x8E, + 0x03, + 0x0E, + 0x07, + 0x0E, + 0x0E, + 0x00, + 0x00, + + /* @608 'M' (12 pixels wide) */ + 0x0E, + 0x0E, + 0x0E, + 0x0F, + 0x1E, + 0x0F, + 0x9E, + 0x0F, + 0xB6, + 0x0F, + 0xB6, + 0x0F, + 0xF6, + 0x0E, + 0xE6, + 0x0E, + 0x66, + 0x0E, + 0x46, + 0x0E, + 0x26, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x00, + 0x00, + + /* @640 'N' (12 pixels wide) */ + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x1E, + 0x06, + 0x3E, + 0x06, + 0x3E, + 0x06, + 0x76, + 0x06, + 0x66, + 0x06, + 0xE6, + 0x06, + 0xC6, + 0x06, + 0xC6, + 0x07, + 0x86, + 0x07, + 0x86, + 0x07, + 0x06, + 0x07, + 0x06, + 0x07, + 0x06, + 0x06, + 0x00, + 0x00, + + /* @672 'P' (12 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x03, + 0x8C, + 0x07, + 0x0C, + 0x0E, + 0x0C, + 0x0E, + 0x0C, + 0x0E, + 0x0C, + 0x06, + 0xFC, + 0x07, + 0xFC, + 0x03, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x0C, + 0x00, + 0x00, + 0x00, + + /* @704 'Q' (12 pixels wide) */ + 0xF0, + 0x00, + 0xF8, + 0x03, + 0x9C, + 0x07, + 0x0E, + 0x07, + 0x0E, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0x06, + 0x0E, + 0xEE, + 0x0E, + 0xCE, + 0x07, + 0x9C, + 0x07, + 0xFC, + 0x07, + 0xF0, + 0x07, + 0x00, + 0x0A, + + /* @736 'R' (12 pixels wide) */ + 0xFC, + 0x00, + 0xFC, + 0x03, + 0x8C, + 0x07, + 0x0C, + 0x06, + 0x0C, + 0x0E, + 0x0C, + 0x0E, + 0x0C, + 0x07, + 0xFC, + 0x07, + 0xFC, + 0x01, + 0x8C, + 0x01, + 0x8C, + 0x03, + 0x0C, + 0x03, + 0x0C, + 0x07, + 0x0C, + 0x06, + 0x0C, + 0x0E, + 0x00, + 0x00, + + /* @768 'T' (12 pixels wide) */ + 0xFF, + 0x0F, + 0xFF, + 0x0F, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0x00, + 0x00, + + /* @800 'V' (12 pixels wide) */ + 0x07, + 0x0C, + 0x06, + 0x0C, + 0x06, + 0x0E, + 0x0E, + 0x06, + 0x0C, + 0x06, + 0x0C, + 0x07, + 0x1C, + 0x03, + 0x1C, + 0x03, + 0x98, + 0x03, + 0x98, + 0x03, + 0xB8, + 0x01, + 0xB0, + 0x01, + 0xF0, + 0x01, + 0xF0, + 0x00, + 0xE0, + 0x00, + 0x00, + 0x00, + + /* @832 'W' (12 pixels wide) */ + 0x67, + 0x0C, + 0xE6, + 0x0C, + 0xE6, + 0x0C, + 0xE6, + 0x0C, + 0xE6, + 0x0C, + 0xF6, + 0x0C, + 0xB6, + 0x0E, + 0xB6, + 0x07, + 0xB6, + 0x07, + 0x96, + 0x07, + 0x9C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x1C, + 0x07, + 0x0C, + 0x07, + 0x00, + 0x00, + + /* @864 'X' (12 pixels wide) */ + 0x0E, + 0x0E, + 0x0E, + 0x06, + 0x1C, + 0x07, + 0x98, + 0x03, + 0xB8, + 0x01, + 0xF0, + 0x01, + 0xF0, + 0x00, + 0xE0, + 0x00, + 0xF0, + 0x00, + 0xF0, + 0x01, + 0xB8, + 0x03, + 0x9C, + 0x03, + 0x0C, + 0x07, + 0x0E, + 0x06, + 0x07, + 0x0E, + 0x00, + 0x00, + + /* @896 'Y' (12 pixels wide) */ + 0x07, + 0x0C, + 0x0E, + 0x0E, + 0x0E, + 0x06, + 0x1C, + 0x07, + 0x18, + 0x03, + 0xB8, + 0x03, + 0xF0, + 0x01, + 0xF0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0xE0, + 0x00, + 0x00, + 0x00, +}; + +/* Character descriptors for Red Hat Mono 16pt */ +/* { [Char width in bits], [Offset into redHatMono_16ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO redHatMono_16ptDescriptors[] = { + {12, 0}, /* - */ + {0, 0}, /* . */ + {0, 0}, /* / */ + {12, 32}, /* 0 */ + {12, 64}, /* 1 */ + {12, 96}, /* 2 */ + {12, 128}, /* 3 */ + {12, 160}, /* 4 */ + {12, 192}, /* 5 */ + {12, 224}, /* 6 */ + {12, 256}, /* 7 */ + {12, 288}, /* 8 */ + {12, 320}, /* 9 */ + {0, 0}, /* : */ + {0, 0}, /* ; */ + {0, 0}, /* < */ + {0, 0}, /* = */ + {0, 0}, /* > */ + {0, 0}, /* ? */ + {0, 0}, /* @ */ + {0, 0}, /* A */ + {12, 352}, /* B */ + {12, 384}, /* C */ + {12, 416}, /* D */ + {0, 0}, /* E */ + {12, 448}, /* F */ + {12, 480}, /* G */ + {12, 512}, /* H */ + {0, 0}, /* I */ + {12, 544}, /* J */ + {12, 576}, /* K */ + {0, 0}, /* L */ + {12, 608}, /* M */ + {12, 640}, /* N */ + {0, 0}, /* O */ + {12, 672}, /* P */ + {12, 704}, /* Q */ + {12, 736}, /* R */ + {0, 0}, /* S */ + {12, 768}, /* T */ + {0, 0}, /* U */ + {12, 800}, /* V */ + {12, 832}, /* W */ + {12, 864}, /* X */ + {12, 896}, /* Y */ +}; + +/* Font information for Red Hat Mono 16pt */ +const FONT_INFO redHatMono_16ptFontInfo = { + 16, /* Character height */ + '-', /* Start character */ + 'Y', /* End character */ + 2, /* Width, in pixels, of space character */ + redHatMono_16ptDescriptors, /* Character descriptor array */ + redHatMono_16ptBitmaps, /* Character bitmap array */ +}; diff --git a/applications/external/totp/ui/fonts/redhat_mono/redhat_mono.h b/applications/external/totp/ui/fonts/redhat_mono/redhat_mono.h new file mode 100644 index 000000000..ac9214d6b --- /dev/null +++ b/applications/external/totp/ui/fonts/redhat_mono/redhat_mono.h @@ -0,0 +1,8 @@ +#pragma once + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +#include "../font_info.h" + +/* Font data for Redhat Mono 16pt */ +extern const FONT_INFO redHatMono_16ptFontInfo; \ No newline at end of file diff --git a/applications/external/totp/ui/fonts/zector/zector.c b/applications/external/totp/ui/fonts/zector/zector.c new file mode 100644 index 000000000..f49d8b306 --- /dev/null +++ b/applications/external/totp/ui/fonts/zector/zector.c @@ -0,0 +1,1056 @@ +#include "zector.h" + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +/* +** Font data for Zector 18pt +*/ + +/* Character bitmaps for Zector 18pt */ +const uint8_t zector_18ptBitmaps[] = { + /* @0 '-' (9 pixels wide) */ + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xFF, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + + /* @32 '0' (9 pixels wide) */ + 0x3C, + 0x00, + 0xC2, + 0x00, + 0x83, + 0x00, + 0x85, + 0x00, + 0x85, + 0x00, + 0x89, + 0x00, + 0x89, + 0x00, + 0x91, + 0x00, + 0x91, + 0x00, + 0xA1, + 0x00, + 0xA1, + 0x00, + 0xC1, + 0x00, + 0xC1, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @64 '1' (9 pixels wide) */ + 0x10, + 0x00, + 0x18, + 0x00, + 0x18, + 0x00, + 0x14, + 0x00, + 0x14, + 0x00, + 0x12, + 0x00, + 0x12, + 0x00, + 0x11, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0xFF, + 0x00, + + /* @96 '2' (9 pixels wide) */ + 0x3C, + 0x00, + 0x42, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x40, + 0x00, + 0x20, + 0x00, + 0x20, + 0x00, + 0x10, + 0x00, + 0x08, + 0x00, + 0x08, + 0x00, + 0x04, + 0x00, + 0x02, + 0x00, + 0x02, + 0x00, + 0xFF, + 0x00, + + /* @128 '3' (9 pixels wide) */ + 0xFF, + 0x01, + 0x80, + 0x00, + 0x80, + 0x00, + 0x40, + 0x00, + 0x40, + 0x00, + 0x20, + 0x00, + 0x20, + 0x00, + 0x10, + 0x00, + 0x60, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x00, + 0x01, + 0x01, + 0x01, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @160 '4' (9 pixels wide) */ + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0xFF, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + + /* @192 '5' (9 pixels wide) */ + 0xFF, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x3F, + 0x00, + 0x40, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0xC2, + 0x00, + 0x3C, + 0x00, + + /* @224 '6' (9 pixels wide) */ + 0x3C, + 0x00, + 0x42, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x3D, + 0x00, + 0x43, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0xC2, + 0x00, + 0x3C, + 0x00, + + /* @256 '7' (9 pixels wide) */ + 0xFF, + 0x01, + 0x80, + 0x00, + 0x80, + 0x00, + 0x40, + 0x00, + 0x40, + 0x00, + 0x20, + 0x00, + 0x20, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x08, + 0x00, + 0x08, + 0x00, + 0x04, + 0x00, + 0x04, + 0x00, + 0x02, + 0x00, + 0x02, + 0x00, + 0x01, + 0x00, + + /* @288 '8' (9 pixels wide) */ + 0x3C, + 0x00, + 0xC2, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + 0x42, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @320 '9' (9 pixels wide) */ + 0x3C, + 0x00, + 0x42, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0xC2, + 0x00, + 0xBC, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @352 'B' (9 pixels wide) */ + 0x3F, + 0x00, + 0xC1, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x41, + 0x00, + 0x3F, + 0x00, + 0x41, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x41, + 0x00, + 0x3F, + 0x00, + + /* @384 'C' (9 pixels wide) */ + 0x3C, + 0x00, + 0x42, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @416 'D' (9 pixels wide) */ + 0x3F, + 0x00, + 0x41, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x41, + 0x00, + 0x3F, + 0x00, + + /* @448 'F' (9 pixels wide) */ + 0xFF, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0xFF, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + + /* @480 'G' (9 pixels wide) */ + 0x3C, + 0x00, + 0xC2, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0xF1, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @512 'H' (9 pixels wide) */ + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0xFF, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + + /* @544 'J' (9 pixels wide) */ + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x80, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x42, + 0x00, + 0x3C, + 0x00, + + /* @576 'K' (9 pixels wide) */ + 0x81, + 0x00, + 0xC1, + 0x00, + 0x61, + 0x00, + 0x21, + 0x00, + 0x11, + 0x00, + 0x09, + 0x00, + 0x05, + 0x00, + 0x03, + 0x00, + 0x01, + 0x00, + 0x03, + 0x00, + 0x05, + 0x00, + 0x09, + 0x00, + 0x11, + 0x00, + 0x21, + 0x00, + 0x41, + 0x00, + 0x81, + 0x00, + + /* @608 'M' (9 pixels wide) */ + 0x81, + 0x00, + 0x81, + 0x00, + 0x83, + 0x00, + 0xC3, + 0x00, + 0xC5, + 0x00, + 0xA5, + 0x00, + 0xA9, + 0x00, + 0x91, + 0x00, + 0x91, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + + /* @640 'N' (9 pixels wide) */ + 0x81, + 0x00, + 0x81, + 0x00, + 0x83, + 0x00, + 0x83, + 0x00, + 0x85, + 0x00, + 0x85, + 0x00, + 0x89, + 0x00, + 0x89, + 0x00, + 0x91, + 0x00, + 0xA1, + 0x00, + 0xA1, + 0x00, + 0xC1, + 0x00, + 0xC1, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + + /* @672 'P' (9 pixels wide) */ + 0x3F, + 0x00, + 0x41, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x41, + 0x00, + 0x3F, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + + /* @704 'Q' (9 pixels wide) */ + 0x3C, + 0x00, + 0x42, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x91, + 0x00, + 0xA1, + 0x00, + 0xC2, + 0x00, + 0xBC, + 0x00, + + /* @736 'R' (9 pixels wide) */ + 0x3F, + 0x00, + 0x41, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x41, + 0x00, + 0x3F, + 0x00, + 0x03, + 0x00, + 0x05, + 0x00, + 0x09, + 0x00, + 0x11, + 0x00, + 0x21, + 0x00, + 0x41, + 0x00, + 0x81, + 0x00, + + /* @768 'T' (9 pixels wide) */ + 0xFF, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + + /* @800 'V' (9 pixels wide) */ + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x82, + 0x00, + 0x42, + 0x00, + 0x44, + 0x00, + 0x24, + 0x00, + 0x28, + 0x00, + 0x18, + 0x00, + 0x10, + 0x00, + + /* @832 'W' (9 pixels wide) */ + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + 0x91, + 0x00, + 0x91, + 0x00, + 0x99, + 0x00, + 0xA9, + 0x00, + 0xA5, + 0x00, + 0xC5, + 0x00, + 0x83, + 0x00, + 0x81, + 0x00, + 0x81, + 0x00, + + /* @864 'X' (9 pixels wide) */ + 0x81, + 0x00, + 0x82, + 0x00, + 0x82, + 0x00, + 0x44, + 0x00, + 0x44, + 0x00, + 0x28, + 0x00, + 0x28, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x28, + 0x00, + 0x28, + 0x00, + 0x44, + 0x00, + 0x44, + 0x00, + 0x82, + 0x00, + 0x82, + 0x00, + 0x81, + 0x00, + + /* @896 'Y' (9 pixels wide) */ + 0x81, + 0x00, + 0x82, + 0x00, + 0x82, + 0x00, + 0x44, + 0x00, + 0x44, + 0x00, + 0x28, + 0x00, + 0x28, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, + 0x10, + 0x00, +}; + +/* Character descriptors for Zector 18pt */ +/* { [Char width in bits], [Offset into zector_18ptCharBitmaps in bytes] } */ +const FONT_CHAR_INFO zector_18ptDescriptors[] = { + {9, 0}, /* - */ + {0, 0}, /* . */ + {0, 0}, /* / */ + {9, 32}, /* 0 */ + {9, 64}, /* 1 */ + {9, 96}, /* 2 */ + {9, 128}, /* 3 */ + {9, 160}, /* 4 */ + {9, 192}, /* 5 */ + {9, 224}, /* 6 */ + {9, 256}, /* 7 */ + {9, 288}, /* 8 */ + {9, 320}, /* 9 */ + {0, 0}, /* : */ + {0, 0}, /* ; */ + {0, 0}, /* < */ + {0, 0}, /* = */ + {0, 0}, /* > */ + {0, 0}, /* ? */ + {0, 0}, /* @ */ + {0, 0}, /* A */ + {9, 352}, /* B */ + {9, 384}, /* C */ + {9, 416}, /* D */ + {0, 0}, /* E */ + {9, 448}, /* F */ + {9, 480}, /* G */ + {9, 512}, /* H */ + {0, 0}, /* I */ + {9, 544}, /* J */ + {9, 576}, /* K */ + {0, 0}, /* L */ + {9, 608}, /* M */ + {9, 640}, /* N */ + {0, 0}, /* O */ + {9, 672}, /* P */ + {9, 704}, /* Q */ + {9, 736}, /* R */ + {0, 0}, /* S */ + {9, 768}, /* T */ + {0, 0}, /* U */ + {9, 800}, /* V */ + {9, 832}, /* W */ + {9, 864}, /* X */ + {9, 896}, /* Y */ +}; + +/* Font information for Zector 18pt */ +const FONT_INFO zector_18ptFontInfo = { + 16, /* Character height */ + '-', /* Start character */ + 'Y', /* End character */ + 2, /* Width, in pixels, of space character */ + zector_18ptDescriptors, /* Character descriptor array */ + zector_18ptBitmaps, /* Character bitmap array */ +}; diff --git a/applications/external/totp/ui/fonts/zector/zector.h b/applications/external/totp/ui/fonts/zector/zector.h new file mode 100644 index 000000000..2a5cf5907 --- /dev/null +++ b/applications/external/totp/ui/fonts/zector/zector.h @@ -0,0 +1,8 @@ +#pragma once + +/* GENERATED BY https://github.com/pavius/the-dot-factory */ + +#include "../font_info.h" + +/* Font information for Zector 18pt */ +extern const FONT_INFO zector_18ptFontInfo; \ No newline at end of file diff --git a/applications/external/totp/ui/scenes/add_new_token/totp_input_text.c b/applications/external/totp/ui/scenes/add_new_token/totp_input_text.c index bbe0b7726..5eb1231d9 100644 --- a/applications/external/totp/ui/scenes/add_new_token/totp_input_text.c +++ b/applications/external/totp/ui/scenes/add_new_token/totp_input_text.c @@ -29,7 +29,7 @@ void view_unlock_model(View* view) { static void commit_text_input_callback(void* context) { InputTextSceneState* text_input_state = (InputTextSceneState*)context; - if(text_input_state->callback != 0) { + if(text_input_state->callback != NULL) { InputTextSceneCallbackResult* result = malloc(sizeof(InputTextSceneCallbackResult)); furi_check(result != NULL); result->user_input_length = diff --git a/applications/external/totp/ui/scenes/add_new_token/totp_scene_add_new_token.c b/applications/external/totp/ui/scenes/add_new_token/totp_scene_add_new_token.c index d525e3399..327185cf7 100644 --- a/applications/external/totp/ui/scenes/add_new_token/totp_scene_add_new_token.c +++ b/applications/external/totp/ui/scenes/add_new_token/totp_scene_add_new_token.c @@ -36,7 +36,7 @@ typedef struct { InputTextSceneContext* token_name_input_context; InputTextSceneContext* token_secret_input_context; InputTextSceneState* input_state; - uint32_t input_started_at; + bool text_input_mode; int16_t screen_y_offset; TokenHashAlgo algo; uint8_t digits_count_index; @@ -56,7 +56,7 @@ static void on_token_name_user_comitted(InputTextSceneCallbackResult* result) { free(scene_state->token_name); scene_state->token_name = result->user_input; scene_state->token_name_length = result->user_input_length; - scene_state->input_started_at = 0; + scene_state->text_input_mode = false; free(result); } @@ -65,7 +65,7 @@ static void on_token_secret_user_comitted(InputTextSceneCallbackResult* result) free(scene_state->token_secret); scene_state->token_secret = result->user_input; scene_state->token_secret_length = result->user_input_length; - scene_state->input_started_at = 0; + scene_state->text_input_mode = false; free(result); } @@ -127,8 +127,8 @@ void totp_scene_add_new_token_activate(PluginState* plugin_state) { } void totp_scene_add_new_token_render(Canvas* const canvas, PluginState* plugin_state) { - SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; - if(scene_state->input_started_at > 0) { + SceneState* scene_state = plugin_state->current_scene_state; + if(scene_state->text_input_mode) { totp_input_text_render(canvas, scene_state->input_state); return; } @@ -200,63 +200,81 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState return true; } - SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; - if(scene_state->input_started_at > 0 && - furi_get_tick() - scene_state->input_started_at > 300) { + SceneState* scene_state = plugin_state->current_scene_state; + + if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) { + if(scene_state->text_input_mode) { + scene_state->text_input_mode = false; + } else { + return false; + } + } + + if(scene_state->text_input_mode) { + if(event->input.type == InputTypeShort && event->input.key == InputKeyBack) { + PluginEvent long_back_cb_evt = { + .type = event->type, .input.key = InputKeyBack, .input.type = InputTypeLong}; + return totp_input_text_handle_event(&long_back_cb_evt, scene_state->input_state); + } + return totp_input_text_handle_event(event, scene_state->input_state); } - if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) { - return false; - } - - if(event->input.type != InputTypePress) { - return true; - } - - switch(event->input.key) { - case InputKeyUp: - totp_roll_value_uint8_t( - &scene_state->selected_control, - -1, - TokenNameTextBox, - ConfirmButton, - RollOverflowBehaviorStop); - update_screen_y_offset(scene_state); - break; - case InputKeyDown: - totp_roll_value_uint8_t( - &scene_state->selected_control, - 1, - TokenNameTextBox, - ConfirmButton, - RollOverflowBehaviorStop); - update_screen_y_offset(scene_state); - break; - case InputKeyRight: - if(scene_state->selected_control == TokenAlgoSelect) { - totp_roll_value_uint8_t(&scene_state->algo, 1, SHA1, STEAM, RollOverflowBehaviorRoll); - } else if(scene_state->selected_control == TokenLengthSelect) { + if(event->input.type == InputTypePress) { + switch(event->input.key) { + case InputKeyUp: totp_roll_value_uint8_t( - &scene_state->digits_count_index, 1, 0, 2, RollOverflowBehaviorRoll); - } else if(scene_state->selected_control == TokenDurationSelect) { - totp_roll_value_uint8_t(&scene_state->duration, 15, 15, 255, RollOverflowBehaviorStop); - update_duration_text(scene_state); + &scene_state->selected_control, + -1, + TokenNameTextBox, + ConfirmButton, + RollOverflowBehaviorStop); + update_screen_y_offset(scene_state); + break; + case InputKeyDown: + totp_roll_value_uint8_t( + &scene_state->selected_control, + 1, + TokenNameTextBox, + ConfirmButton, + RollOverflowBehaviorStop); + update_screen_y_offset(scene_state); + break; + case InputKeyRight: + if(scene_state->selected_control == TokenAlgoSelect) { + totp_roll_value_uint8_t( + &scene_state->algo, 1, SHA1, STEAM, RollOverflowBehaviorRoll); + } else if(scene_state->selected_control == TokenLengthSelect) { + totp_roll_value_uint8_t( + &scene_state->digits_count_index, 1, 0, 2, RollOverflowBehaviorRoll); + } else if(scene_state->selected_control == TokenDurationSelect) { + totp_roll_value_uint8_t( + &scene_state->duration, 15, 15, 255, RollOverflowBehaviorStop); + update_duration_text(scene_state); + } + break; + case InputKeyLeft: + if(scene_state->selected_control == TokenAlgoSelect) { + totp_roll_value_uint8_t( + &scene_state->algo, -1, SHA1, STEAM, RollOverflowBehaviorRoll); + } else if(scene_state->selected_control == TokenLengthSelect) { + totp_roll_value_uint8_t( + &scene_state->digits_count_index, -1, 0, 2, RollOverflowBehaviorRoll); + } else if(scene_state->selected_control == TokenDurationSelect) { + totp_roll_value_uint8_t( + &scene_state->duration, -15, 15, 255, RollOverflowBehaviorStop); + update_duration_text(scene_state); + } + break; + case InputKeyOk: + break; + case InputKeyBack: + totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken); + break; + default: + break; } - break; - case InputKeyLeft: - if(scene_state->selected_control == TokenAlgoSelect) { - totp_roll_value_uint8_t(&scene_state->algo, -1, SHA1, STEAM, RollOverflowBehaviorRoll); - } else if(scene_state->selected_control == TokenLengthSelect) { - totp_roll_value_uint8_t( - &scene_state->digits_count_index, -1, 0, 2, RollOverflowBehaviorRoll); - } else if(scene_state->selected_control == TokenDurationSelect) { - totp_roll_value_uint8_t( - &scene_state->duration, -15, 15, 255, RollOverflowBehaviorStop); - update_duration_text(scene_state); - } - break; - case InputKeyOk: + } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) { switch(scene_state->selected_control) { case TokenNameTextBox: if(scene_state->input_state != NULL) { @@ -264,7 +282,8 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState } scene_state->input_state = totp_input_text_activate(scene_state->token_name_input_context); - scene_state->input_started_at = furi_get_tick(); + + scene_state->text_input_mode = true; break; case TokenSecretTextBox: if(scene_state->input_state != NULL) { @@ -272,7 +291,8 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState } scene_state->input_state = totp_input_text_activate(scene_state->token_secret_input_context); - scene_state->input_started_at = furi_get_tick(); + + scene_state->text_input_mode = true; break; case TokenAlgoSelect: break; @@ -313,12 +333,6 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState default: break; } - break; - case InputKeyBack: - totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken); - break; - default: - break; } return true; diff --git a/applications/external/totp/ui/scenes/app_settings/totp_app_settings.c b/applications/external/totp/ui/scenes/app_settings/totp_app_settings.c index 6dcf0dbc9..0bdc7aee3 100644 --- a/applications/external/totp/ui/scenes/app_settings/totp_app_settings.c +++ b/applications/external/totp/ui/scenes/app_settings/totp_app_settings.c @@ -22,6 +22,7 @@ typedef enum { MinutesInput, Sound, Vibro, + FontSelector, BadUsb, #ifdef TOTP_BADBT_TYPE_ENABLED BadBt, @@ -34,6 +35,7 @@ typedef struct { uint8_t tz_offset_minutes; bool notification_sound; bool notification_vibro; + uint8_t selected_font; bool badusb_enabled; #ifdef TOTP_BADBT_TYPE_ENABLED bool badbt_enabled; @@ -54,23 +56,24 @@ void totp_scene_app_settings_activate(PluginState* plugin_state) { scene_state->notification_sound = plugin_state->notification_method & NotificationMethodSound; scene_state->notification_vibro = plugin_state->notification_method & NotificationMethodVibro; scene_state->badusb_enabled = plugin_state->automation_method & AutomationMethodBadUsb; + scene_state->selected_font = plugin_state->selected_font; #ifdef TOTP_BADBT_TYPE_ENABLED scene_state->badbt_enabled = plugin_state->automation_method & AutomationMethodBadBt; #endif } static void two_digit_to_str(int8_t num, char* str) { - uint8_t index = 0; + char* s = str; if(num < 0) { - str[index++] = '-'; + *(s++) = '-'; num = -num; } uint8_t d1 = (num / 10) % 10; uint8_t d2 = num % 10; - str[index++] = CONVERT_DIGIT_TO_CHAR(d1); - str[index++] = CONVERT_DIGIT_TO_CHAR(d2); - str[index++] = '\0'; + *(s++) = CONVERT_DIGIT_TO_CHAR(d1); + *(s++) = CONVERT_DIGIT_TO_CHAR(d2); + *(s++) = '\0'; } void totp_scene_app_settings_render(Canvas* const canvas, const PluginState* plugin_state) { @@ -111,27 +114,38 @@ void totp_scene_app_settings_render(Canvas* const canvas, const PluginState* plu canvas_set_font(canvas, FontPrimary); canvas_draw_str_aligned( - canvas, 0, 64 - scene_state->y_offset, AlignLeft, AlignTop, "Notifications"); + canvas, 0, 64 - scene_state->y_offset, AlignLeft, AlignTop, "Notifications / UI"); canvas_set_font(canvas, FontSecondary); - canvas_draw_str_aligned(canvas, 0, 81 - scene_state->y_offset, AlignLeft, AlignTop, "Sound:"); + canvas_draw_str_aligned(canvas, 0, 78 - scene_state->y_offset, AlignLeft, AlignTop, "Sound:"); ui_control_select_render( canvas, 36, - 74 - scene_state->y_offset, + 71 - scene_state->y_offset, SCREEN_WIDTH - 36, YES_NO_LIST[scene_state->notification_sound], scene_state->selected_control == Sound); - canvas_draw_str_aligned(canvas, 0, 99 - scene_state->y_offset, AlignLeft, AlignTop, "Vibro:"); + canvas_draw_str_aligned(canvas, 0, 94 - scene_state->y_offset, AlignLeft, AlignTop, "Vibro:"); ui_control_select_render( canvas, 36, - 92 - scene_state->y_offset, + 87 - scene_state->y_offset, SCREEN_WIDTH - 36, YES_NO_LIST[scene_state->notification_vibro], scene_state->selected_control == Vibro); + two_digit_to_str(scene_state->selected_font, &tmp_str[0]); + canvas_draw_str_aligned( + canvas, 0, 110 - scene_state->y_offset, AlignLeft, AlignTop, "UI Font:"); + ui_control_select_render( + canvas, + 36, + 103 - scene_state->y_offset, + SCREEN_WIDTH - 36, + &tmp_str[0], + scene_state->selected_control == FontSelector); + canvas_draw_icon( canvas, SCREEN_WIDTH_CENTER - 5, 123 - scene_state->y_offset, &I_totp_arrow_bottom_10x5); @@ -183,116 +197,126 @@ bool totp_scene_app_settings_handle_event( } SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; - if(event->input.type != InputTypePress && event->input.type != InputTypeRepeat) { - return true; - } - - switch(event->input.key) { - case InputKeyUp: - totp_roll_value_uint8_t( - &scene_state->selected_control, - -1, - HoursInput, - ConfirmButton, - RollOverflowBehaviorStop); - if(scene_state->selected_control > Vibro) { - scene_state->y_offset = 128; - } else if(scene_state->selected_control > MinutesInput) { - scene_state->y_offset = 64; - } else { - scene_state->y_offset = 0; - } - break; - case InputKeyDown: - totp_roll_value_uint8_t( - &scene_state->selected_control, 1, HoursInput, ConfirmButton, RollOverflowBehaviorStop); - if(scene_state->selected_control > Vibro) { - scene_state->y_offset = 128; - } else if(scene_state->selected_control > MinutesInput) { - scene_state->y_offset = 64; - } else { - scene_state->y_offset = 0; - } - break; - case InputKeyRight: - if(scene_state->selected_control == HoursInput) { - totp_roll_value_int8_t( - &scene_state->tz_offset_hours, 1, -12, 12, RollOverflowBehaviorStop); - } else if(scene_state->selected_control == MinutesInput) { + if(event->input.type == InputTypePress || event->input.type == InputTypeRepeat) { + switch(event->input.key) { + case InputKeyUp: totp_roll_value_uint8_t( - &scene_state->tz_offset_minutes, 15, 0, 45, RollOverflowBehaviorRoll); - } else if(scene_state->selected_control == Sound) { - scene_state->notification_sound = !scene_state->notification_sound; - } else if(scene_state->selected_control == Vibro) { - scene_state->notification_vibro = !scene_state->notification_vibro; - } else if(scene_state->selected_control == BadUsb) { - scene_state->badusb_enabled = !scene_state->badusb_enabled; - } -#ifdef TOTP_BADBT_TYPE_ENABLED - else if(scene_state->selected_control == BadBt) { - scene_state->badbt_enabled = !scene_state->badbt_enabled; - } -#endif - break; - case InputKeyLeft: - if(scene_state->selected_control == HoursInput) { - totp_roll_value_int8_t( - &scene_state->tz_offset_hours, -1, -12, 12, RollOverflowBehaviorStop); - } else if(scene_state->selected_control == MinutesInput) { - totp_roll_value_uint8_t( - &scene_state->tz_offset_minutes, -15, 0, 45, RollOverflowBehaviorRoll); - } else if(scene_state->selected_control == Sound) { - scene_state->notification_sound = !scene_state->notification_sound; - } else if(scene_state->selected_control == Vibro) { - scene_state->notification_vibro = !scene_state->notification_vibro; - } else if(scene_state->selected_control == BadUsb) { - scene_state->badusb_enabled = !scene_state->badusb_enabled; - } -#ifdef TOTP_BADBT_TYPE_ENABLED - else if(scene_state->selected_control == BadBt) { - scene_state->badbt_enabled = !scene_state->badbt_enabled; - } -#endif - break; - case InputKeyOk: - if(scene_state->selected_control == ConfirmButton) { - plugin_state->timezone_offset = (float)scene_state->tz_offset_hours + - (float)scene_state->tz_offset_minutes / 60.0f; - - plugin_state->notification_method = - (scene_state->notification_sound ? NotificationMethodSound : - NotificationMethodNone) | - (scene_state->notification_vibro ? NotificationMethodVibro : - NotificationMethodNone); - - plugin_state->automation_method = - scene_state->badusb_enabled ? AutomationMethodBadUsb : AutomationMethodNone; -#ifdef TOTP_BADBT_TYPE_ENABLED - plugin_state->automation_method |= scene_state->badbt_enabled ? AutomationMethodBadBt : - AutomationMethodNone; -#endif - - if(!totp_config_file_update_user_settings(plugin_state)) { - totp_dialogs_config_updating_error(plugin_state); - return false; + &scene_state->selected_control, + -1, + HoursInput, + ConfirmButton, + RollOverflowBehaviorStop); + if(scene_state->selected_control > FontSelector) { + scene_state->y_offset = 128; + } else if(scene_state->selected_control > MinutesInput) { + scene_state->y_offset = 64; + } else { + scene_state->y_offset = 0; + } + break; + case InputKeyDown: + totp_roll_value_uint8_t( + &scene_state->selected_control, + 1, + HoursInput, + ConfirmButton, + RollOverflowBehaviorStop); + if(scene_state->selected_control > FontSelector) { + scene_state->y_offset = 128; + } else if(scene_state->selected_control > MinutesInput) { + scene_state->y_offset = 64; + } else { + scene_state->y_offset = 0; + } + break; + case InputKeyRight: + if(scene_state->selected_control == HoursInput) { + totp_roll_value_int8_t( + &scene_state->tz_offset_hours, 1, -12, 12, RollOverflowBehaviorStop); + } else if(scene_state->selected_control == MinutesInput) { + totp_roll_value_uint8_t( + &scene_state->tz_offset_minutes, 15, 0, 45, RollOverflowBehaviorRoll); + } else if(scene_state->selected_control == Sound) { + scene_state->notification_sound = !scene_state->notification_sound; + } else if(scene_state->selected_control == Vibro) { + scene_state->notification_vibro = !scene_state->notification_vibro; + } else if(scene_state->selected_control == BadUsb) { + scene_state->badusb_enabled = !scene_state->badusb_enabled; } - #ifdef TOTP_BADBT_TYPE_ENABLED - if(!scene_state->badbt_enabled && plugin_state->bt_type_code_worker_context != NULL) { - totp_bt_type_code_worker_free(plugin_state->bt_type_code_worker_context); - plugin_state->bt_type_code_worker_context = NULL; + else if(scene_state->selected_control == BadBt) { + scene_state->badbt_enabled = !scene_state->badbt_enabled; } #endif - + else if(scene_state->selected_control == FontSelector) { + totp_roll_value_uint8_t( + &scene_state->selected_font, 1, 0, 6, RollOverflowBehaviorStop); + } + break; + case InputKeyLeft: + if(scene_state->selected_control == HoursInput) { + totp_roll_value_int8_t( + &scene_state->tz_offset_hours, -1, -12, 12, RollOverflowBehaviorStop); + } else if(scene_state->selected_control == MinutesInput) { + totp_roll_value_uint8_t( + &scene_state->tz_offset_minutes, -15, 0, 45, RollOverflowBehaviorRoll); + } else if(scene_state->selected_control == Sound) { + scene_state->notification_sound = !scene_state->notification_sound; + } else if(scene_state->selected_control == Vibro) { + scene_state->notification_vibro = !scene_state->notification_vibro; + } else if(scene_state->selected_control == BadUsb) { + scene_state->badusb_enabled = !scene_state->badusb_enabled; + } +#ifdef TOTP_BADBT_TYPE_ENABLED + else if(scene_state->selected_control == BadBt) { + scene_state->badbt_enabled = !scene_state->badbt_enabled; + } +#endif + else if(scene_state->selected_control == FontSelector) { + totp_roll_value_uint8_t( + &scene_state->selected_font, -1, 0, 6, RollOverflowBehaviorStop); + } + break; + case InputKeyOk: + break; + case InputKeyBack: { totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu); + break; } - break; - case InputKeyBack: { + default: + break; + } + } else if( + event->input.type == InputTypeRelease && event->input.key == InputKeyOk && + scene_state->selected_control == ConfirmButton) { + plugin_state->timezone_offset = + (float)scene_state->tz_offset_hours + (float)scene_state->tz_offset_minutes / 60.0f; + + plugin_state->notification_method = + (scene_state->notification_sound ? NotificationMethodSound : NotificationMethodNone) | + (scene_state->notification_vibro ? NotificationMethodVibro : NotificationMethodNone); + + plugin_state->automation_method = scene_state->badusb_enabled ? AutomationMethodBadUsb : + AutomationMethodNone; +#ifdef TOTP_BADBT_TYPE_ENABLED + plugin_state->automation_method |= scene_state->badbt_enabled ? AutomationMethodBadBt : + AutomationMethodNone; +#endif + plugin_state->selected_font = scene_state->selected_font; + + if(!totp_config_file_update_user_settings(plugin_state)) { + totp_dialogs_config_updating_error(plugin_state); + return false; + } + +#ifdef TOTP_BADBT_TYPE_ENABLED + if(!scene_state->badbt_enabled && plugin_state->bt_type_code_worker_context != NULL) { + totp_bt_type_code_worker_free(plugin_state->bt_type_code_worker_context); + plugin_state->bt_type_code_worker_context = NULL; + } +#endif + totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu); - break; - } - default: - break; } return true; diff --git a/applications/external/totp/ui/scenes/authenticate/totp_scene_authenticate.c b/applications/external/totp/ui/scenes/authenticate/totp_scene_authenticate.c index 86e1e8e2b..218e5e397 100644 --- a/applications/external/totp/ui/scenes/authenticate/totp_scene_authenticate.c +++ b/applications/external/totp/ui/scenes/authenticate/totp_scene_authenticate.c @@ -83,38 +83,45 @@ bool totp_scene_authenticate_handle_event( return false; } - if(event->input.type != InputTypePress) { - return true; - } - - SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; - - switch(event->input.key) { - case InputKeyUp: - if(scene_state->code_length < MAX_CODE_LENGTH) { - scene_state->code_input[scene_state->code_length] = PinCodeArrowUp; - scene_state->code_length++; + SceneState* scene_state = plugin_state->current_scene_state; + if(event->input.type == InputTypePress) { + switch(event->input.key) { + case InputKeyUp: + if(scene_state->code_length < MAX_CODE_LENGTH) { + scene_state->code_input[scene_state->code_length] = PinCodeArrowUp; + scene_state->code_length++; + } + break; + case InputKeyDown: + if(scene_state->code_length < MAX_CODE_LENGTH) { + scene_state->code_input[scene_state->code_length] = PinCodeArrowDown; + scene_state->code_length++; + } + break; + case InputKeyRight: + if(scene_state->code_length < MAX_CODE_LENGTH) { + scene_state->code_input[scene_state->code_length] = PinCodeArrowRight; + scene_state->code_length++; + } + break; + case InputKeyLeft: + if(scene_state->code_length < MAX_CODE_LENGTH) { + scene_state->code_input[scene_state->code_length] = PinCodeArrowLeft; + scene_state->code_length++; + } + break; + case InputKeyOk: + break; + case InputKeyBack: + if(scene_state->code_length > 0) { + scene_state->code_input[scene_state->code_length - 1] = 0; + scene_state->code_length--; + } + break; + default: + break; } - break; - case InputKeyDown: - if(scene_state->code_length < MAX_CODE_LENGTH) { - scene_state->code_input[scene_state->code_length] = PinCodeArrowDown; - scene_state->code_length++; - } - break; - case InputKeyRight: - if(scene_state->code_length < MAX_CODE_LENGTH) { - scene_state->code_input[scene_state->code_length] = PinCodeArrowRight; - scene_state->code_length++; - } - break; - case InputKeyLeft: - if(scene_state->code_length < MAX_CODE_LENGTH) { - scene_state->code_input[scene_state->code_length] = PinCodeArrowLeft; - scene_state->code_length++; - } - break; - case InputKeyOk: { + } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) { CryptoSeedIVResult seed_result = totp_crypto_seed_iv( plugin_state, &scene_state->code_input[0], scene_state->code_length); @@ -145,16 +152,6 @@ bool totp_scene_authenticate_handle_event( dialog_message_show(plugin_state->dialogs_app, message); dialog_message_free(message); } - break; - } - case InputKeyBack: - if(scene_state->code_length > 0) { - scene_state->code_input[scene_state->code_length - 1] = 0; - scene_state->code_length--; - } - break; - default: - break; } return true; diff --git a/applications/external/totp/ui/scenes/generate_token/totp_scene_generate_token.c b/applications/external/totp/ui/scenes/generate_token/totp_scene_generate_token.c index b111242dc..e55f34ea2 100644 --- a/applications/external/totp/ui/scenes/generate_token/totp_scene_generate_token.c +++ b/applications/external/totp/ui/scenes/generate_token/totp_scene_generate_token.c @@ -16,7 +16,7 @@ #ifdef TOTP_BADBT_TYPE_ENABLED #include "../../../workers/bt_type_code/bt_type_code.h" #endif -#include "../../fonts/mode-nine/mode_nine.h" +#include "../../fonts/active_font.h" #define PROGRESS_BAR_MARGIN (3) #define PROGRESS_BAR_HEIGHT (4) @@ -142,19 +142,46 @@ static void draw_totp_code(Canvas* const canvas, const PluginState* const plugin totp_config_get_token_iterator_context(plugin_state); uint8_t code_length = totp_token_info_iterator_get_current_token(iterator_context)->digits; uint8_t offset_x = scene_state->ui_precalculated_dimensions.code_offset_x; - uint8_t char_width = modeNine_15ptFontInfo.charInfo[0].width; + const FONT_INFO* current_font; + switch(plugin_state->selected_font) { + case 0: + current_font = &modeNine_15ptFontInfo; + break; + case 1: + current_font = &redHatMono_16ptFontInfo; + break; + case 2: + current_font = &bedstead_17ptFontInfo; + break; + case 3: + current_font = &zector_18ptFontInfo; + break; + case 4: + current_font = &_712Serif_24ptFontInfo; + break; + case 5: + current_font = &graph35pix_12ptFontInfo; + break; + case 6: + current_font = &karmaFuture_14ptFontInfo; + break; + default: + current_font = &modeNine_15ptFontInfo; + break; + } + uint8_t char_width = current_font->charInfo[0].width; uint8_t offset_x_inc = scene_state->ui_precalculated_dimensions.code_offset_x_inc; for(uint8_t i = 0; i < code_length; i++) { char ch = scene_state->last_code[i]; - if(ch >= modeNine_15ptFontInfo.startChar && ch <= modeNine_15ptFontInfo.endChar) { - uint8_t char_index = ch - modeNine_15ptFontInfo.startChar; + if(ch >= current_font->startChar && ch <= current_font->endChar) { + uint8_t char_index = ch - current_font->startChar; canvas_draw_xbm( canvas, offset_x, scene_state->ui_precalculated_dimensions.code_offset_y, char_width, - modeNine_15ptFontInfo.height, - &modeNine_15ptFontInfo.data[modeNine_15ptFontInfo.charInfo[char_index].offset]); + current_font->height, + ¤t_font->data[current_font->charInfo[char_index].offset]); } offset_x += offset_x_inc; @@ -172,15 +199,43 @@ static void on_new_token_code_generated(bool time_left, void* context) { SceneState* scene_state = plugin_state->current_scene_state; const TokenInfo* current_token = totp_token_info_iterator_get_current_token(iterator_context); - uint8_t char_width = modeNine_15ptFontInfo.charInfo[0].width; + const FONT_INFO* current_font; + switch(plugin_state->selected_font) { + case 0: + current_font = &modeNine_15ptFontInfo; + break; + case 1: + current_font = &redHatMono_16ptFontInfo; + break; + case 2: + current_font = &bedstead_17ptFontInfo; + break; + case 3: + current_font = &zector_18ptFontInfo; + break; + case 4: + current_font = &_712Serif_24ptFontInfo; + break; + case 5: + current_font = &graph35pix_12ptFontInfo; + break; + case 6: + current_font = &karmaFuture_14ptFontInfo; + break; + default: + current_font = &modeNine_15ptFontInfo; + break; + } + + uint8_t char_width = current_font->charInfo[0].width; scene_state->ui_precalculated_dimensions.code_total_length = - current_token->digits * (char_width + modeNine_15ptFontInfo.spacePixels); + current_token->digits * (char_width + current_font->spacePixels); scene_state->ui_precalculated_dimensions.code_offset_x = (SCREEN_WIDTH - scene_state->ui_precalculated_dimensions.code_total_length) >> 1; scene_state->ui_precalculated_dimensions.code_offset_x_inc = - char_width + modeNine_15ptFontInfo.spacePixels; + char_width + current_font->spacePixels; scene_state->ui_precalculated_dimensions.code_offset_y = - SCREEN_HEIGHT_CENTER - (modeNine_15ptFontInfo.height >> 1); + SCREEN_HEIGHT_CENTER - (current_font->height >> 1); if(time_left) { notification_message( @@ -381,54 +436,51 @@ bool totp_scene_generate_token_handle_event( return true; } #endif - } + } else if(event->input.type == InputTypePress || event->input.type == InputTypeRepeat) { + switch(event->input.key) { + case InputKeyUp: + break; + case InputKeyDown: + break; + case InputKeyRight: { + const TokenInfoIteratorContext* iterator_context = + totp_config_get_token_iterator_context(plugin_state); + size_t current_token_index = + totp_token_info_iterator_get_current_token_index(iterator_context); + totp_roll_value_size_t( + ¤t_token_index, + 1, + 0, + totp_token_info_iterator_get_total_count(iterator_context) - 1, + RollOverflowBehaviorRoll); - if(event->input.type != InputTypePress && event->input.type != InputTypeRepeat) { - return true; - } + update_totp_params(plugin_state, current_token_index); + break; + } + case InputKeyLeft: { + const TokenInfoIteratorContext* iterator_context = + totp_config_get_token_iterator_context(plugin_state); + size_t current_token_index = + totp_token_info_iterator_get_current_token_index(iterator_context); + totp_roll_value_size_t( + ¤t_token_index, + -1, + 0, + totp_token_info_iterator_get_total_count(iterator_context) - 1, + RollOverflowBehaviorRoll); - switch(event->input.key) { - case InputKeyUp: - break; - case InputKeyDown: - break; - case InputKeyRight: { - const TokenInfoIteratorContext* iterator_context = - totp_config_get_token_iterator_context(plugin_state); - size_t current_token_index = - totp_token_info_iterator_get_current_token_index(iterator_context); - totp_roll_value_size_t( - ¤t_token_index, - 1, - 0, - totp_token_info_iterator_get_total_count(iterator_context) - 1, - RollOverflowBehaviorRoll); - - update_totp_params(plugin_state, current_token_index); - break; - } - case InputKeyLeft: { - const TokenInfoIteratorContext* iterator_context = - totp_config_get_token_iterator_context(plugin_state); - size_t current_token_index = - totp_token_info_iterator_get_current_token_index(iterator_context); - totp_roll_value_size_t( - ¤t_token_index, - -1, - 0, - totp_token_info_iterator_get_total_count(iterator_context) - 1, - RollOverflowBehaviorRoll); - - update_totp_params(plugin_state, current_token_index); - break; - } - case InputKeyOk: + update_totp_params(plugin_state, current_token_index); + break; + } + case InputKeyOk: + break; + case InputKeyBack: + break; + default: + break; + } + } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) { totp_scene_director_activate_scene(plugin_state, TotpSceneTokenMenu); - break; - case InputKeyBack: - break; - default: - break; } return true; diff --git a/applications/external/totp/ui/scenes/token_menu/totp_scene_token_menu.c b/applications/external/totp/ui/scenes/token_menu/totp_scene_token_menu.c index a8c8de28a..1340b5a8e 100644 --- a/applications/external/totp/ui/scenes/token_menu/totp_scene_token_menu.c +++ b/applications/external/totp/ui/scenes/token_menu/totp_scene_token_menu.c @@ -82,38 +82,52 @@ bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginSt } SceneState* scene_state = (SceneState*)plugin_state->current_scene_state; - if(event->input.type != InputTypePress) { - return true; - } - - switch(event->input.key) { - case InputKeyUp: { - const TokenInfoIteratorContext* iterator_context = - totp_config_get_token_iterator_context(plugin_state); - totp_roll_value_uint8_t( - &scene_state->selected_control, -1, AddNewToken, AppSettings, RollOverflowBehaviorRoll); - if(scene_state->selected_control == DeleteToken && - totp_token_info_iterator_get_total_count(iterator_context) == 0) { - scene_state->selected_control--; + if(event->input.type == InputTypePress) { + switch(event->input.key) { + case InputKeyUp: { + const TokenInfoIteratorContext* iterator_context = + totp_config_get_token_iterator_context(plugin_state); + totp_roll_value_uint8_t( + &scene_state->selected_control, + -1, + AddNewToken, + AppSettings, + RollOverflowBehaviorRoll); + if(scene_state->selected_control == DeleteToken && + totp_token_info_iterator_get_total_count(iterator_context) == 0) { + scene_state->selected_control--; + } + break; } - break; - } - case InputKeyDown: { - const TokenInfoIteratorContext* iterator_context = - totp_config_get_token_iterator_context(plugin_state); - totp_roll_value_uint8_t( - &scene_state->selected_control, 1, AddNewToken, AppSettings, RollOverflowBehaviorRoll); - if(scene_state->selected_control == DeleteToken && - totp_token_info_iterator_get_total_count(iterator_context) == 0) { - scene_state->selected_control++; + case InputKeyDown: { + const TokenInfoIteratorContext* iterator_context = + totp_config_get_token_iterator_context(plugin_state); + totp_roll_value_uint8_t( + &scene_state->selected_control, + 1, + AddNewToken, + AppSettings, + RollOverflowBehaviorRoll); + if(scene_state->selected_control == DeleteToken && + totp_token_info_iterator_get_total_count(iterator_context) == 0) { + scene_state->selected_control++; + } + break; } - break; - } - case InputKeyRight: - break; - case InputKeyLeft: - break; - case InputKeyOk: + case InputKeyRight: + break; + case InputKeyLeft: + break; + case InputKeyOk: + break; + case InputKeyBack: { + totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken); + break; + } + default: + break; + } + } else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) { switch(scene_state->selected_control) { case AddNewToken: { totp_scene_director_activate_scene(plugin_state, TotpSceneAddNewToken); @@ -153,13 +167,6 @@ bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginSt default: break; } - break; - case InputKeyBack: { - totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken); - break; - } - default: - break; } return true; diff --git a/applications/external/totp/workers/bt_type_code/bt_type_code.c b/applications/external/totp/workers/bt_type_code/bt_type_code.c index bf55dba6a..8024dba78 100644 --- a/applications/external/totp/workers/bt_type_code/bt_type_code.c +++ b/applications/external/totp/workers/bt_type_code/bt_type_code.c @@ -13,7 +13,7 @@ #include "../type_code_common.h" #include "../../features_config.h" -#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME +#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_UL_XFW #define TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN FURI_HAL_BT_ADV_NAME_LENGTH #define TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN GAP_MAC_ADDR_SIZE #endif @@ -29,7 +29,7 @@ struct TotpBtTypeCodeWorkerContext { Bt* bt; bool is_advertising; bool is_connected; -#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME +#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_UL_XFW char previous_bt_name[TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN]; uint8_t previous_bt_mac[TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN]; #endif @@ -39,7 +39,7 @@ static inline bool totp_type_code_worker_stop_requested() { return furi_thread_flags_get() & TotpBtTypeCodeWorkerEventStop; } -#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME +#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_UL_XFW static void totp_type_code_worker_bt_set_app_mac(uint8_t* mac) { uint8_t max_i; size_t uid_size = furi_hal_version_uid_size(); @@ -161,7 +161,7 @@ TotpBtTypeCodeWorkerContext* totp_bt_type_code_worker_init() { furi_delay_ms(200); bt_keys_storage_set_storage_path(context->bt, HID_BT_KEYS_STORAGE_PATH); -#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME +#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_UL_XFW memcpy( &context->previous_bt_name[0], furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard), @@ -184,7 +184,7 @@ TotpBtTypeCodeWorkerContext* totp_bt_type_code_worker_init() { furi_hal_bt_start_advertising(); -#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME +#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_UL_XFW bt_enable_peer_key_update(context->bt); #endif @@ -211,7 +211,7 @@ void totp_bt_type_code_worker_free(TotpBtTypeCodeWorkerContext* context) { furi_delay_ms(200); bt_keys_storage_set_default_path(context->bt); -#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME +#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_UL_XFW furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, context->previous_bt_name); furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, context->previous_bt_mac); #endif diff --git a/applications/external/totp/workers/generate_totp_code/generate_totp_code.c b/applications/external/totp/workers/generate_totp_code/generate_totp_code.c index 7e9356c45..6dbe329fd 100644 --- a/applications/external/totp/workers/generate_totp_code/generate_totp_code.c +++ b/applications/external/totp/workers/generate_totp_code/generate_totp_code.c @@ -25,18 +25,21 @@ static const char* STEAM_ALGO_ALPHABET = "23456789BCDFGHJKMNPQRTVWXY"; static void int_token_to_str(uint64_t i_token_code, char* str, TokenDigitsCount len, TokenHashAlgo algo) { - str[len] = '\0'; + char* last_char = str + len; + *last_char = '\0'; if(i_token_code == OTP_ERROR) { - memset(&str[0], '-', len); + memset(str, '-', len); } else { if(algo == STEAM) { - for(uint8_t i = 0; i < len; i++) { - str[i] = STEAM_ALGO_ALPHABET[i_token_code % 26]; + char* s = str; + for(uint8_t i = 0; i < len; i++, s++) { + *s = STEAM_ALGO_ALPHABET[i_token_code % 26]; i_token_code = i_token_code / 26; } } else { - for(int8_t i = len - 1; i >= 0; i--) { - str[i] = CONVERT_DIGIT_TO_CHAR(i_token_code % 10); + char* s = --last_char; + for(int8_t i = len - 1; i >= 0; i--, s--) { + *s = CONVERT_DIGIT_TO_CHAR(i_token_code % 10); i_token_code = i_token_code / 10; } } diff --git a/applications/external/totp/workers/type_code_common.c b/applications/external/totp/workers/type_code_common.c index bf5818ab2..bc42fadaa 100644 --- a/applications/external/totp/workers/type_code_common.c +++ b/applications/external/totp/workers/type_code_common.c @@ -47,11 +47,12 @@ void totp_type_code_worker_execute_automation( TokenAutomationFeature features) { furi_delay_ms(500); uint8_t i = 0; + char cb_char; - while(i < code_buffer_size && code_buffer[i] != 0) { - uint8_t char_index = CONVERT_CHAR_TO_DIGIT(code_buffer[i]); + while(i < code_buffer_size && (cb_char = code_buffer[i]) != 0) { + uint8_t char_index = CONVERT_CHAR_TO_DIGIT(cb_char); if(char_index > 9) { - char_index = code_buffer[i] - 0x41 + 10; + char_index = cb_char - 0x41 + 10; } if(char_index > 35) break; diff --git a/applications/external/wifi_marauder_companion/assets/KeyKeyboardSelected_10x11.png b/applications/external/wifi_marauder_companion/assets/KeyKeyboardSelected_10x11.png new file mode 100644 index 000000000..231880386 Binary files /dev/null and b/applications/external/wifi_marauder_companion/assets/KeyKeyboardSelected_10x11.png differ diff --git a/applications/external/wifi_marauder_companion/assets/KeyKeyboard_10x11.png b/applications/external/wifi_marauder_companion/assets/KeyKeyboard_10x11.png new file mode 100644 index 000000000..1f4c03478 Binary files /dev/null and b/applications/external/wifi_marauder_companion/assets/KeyKeyboard_10x11.png differ diff --git a/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_config.h b/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_config.h index ae976c6bf..d223af79a 100644 --- a/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_config.h +++ b/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_config.h @@ -12,3 +12,4 @@ ADD_SCENE(wifi_marauder, script_confirm_delete, ScriptConfirmDelete) ADD_SCENE(wifi_marauder, script_stage_edit, ScriptStageEdit) ADD_SCENE(wifi_marauder, script_stage_add, ScriptStageAdd) ADD_SCENE(wifi_marauder, script_stage_edit_list, ScriptStageEditList) +ADD_SCENE(wifi_marauder, sniffpmkid_options, SniffPmkidOptions) diff --git a/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_sniffpmkid_options.c b/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_sniffpmkid_options.c new file mode 100644 index 000000000..02869030e --- /dev/null +++ b/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_sniffpmkid_options.c @@ -0,0 +1,117 @@ +#include "../wifi_marauder_app_i.h" + +enum SubmenuIndex { + SubmenuIndexPassive, + SubmenuIndexActive, + SubmenuIndexTargetedPassive, + SubmenuIndexTargetedActive, + SubmenuIndexChannelPassive, + SubmenuIndexChannelActive, +}; + +static void wifi_marauder_scene_sniffpmkid_options_callback(void* context, uint32_t index) { + WifiMarauderApp* app = context; + + app->is_custom_tx_string = false; // this will be set if needed by text input + switch(index) { + case SubmenuIndexPassive: + app->selected_tx_string = "sniffpmkid"; + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneSniffPmkidOptions, index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneConsoleOutput); + break; + case SubmenuIndexActive: + app->selected_tx_string = "sniffpmkid -d"; + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneSniffPmkidOptions, index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneConsoleOutput); + break; + case SubmenuIndexTargetedPassive: + app->selected_tx_string = "sniffpmkid -l"; + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneSniffPmkidOptions, index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneConsoleOutput); + break; + case SubmenuIndexTargetedActive: + app->selected_tx_string = "sniffpmkid -d -l"; + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneSniffPmkidOptions, index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneConsoleOutput); + break; + case SubmenuIndexChannelPassive: + app->selected_tx_string = "sniffpmkid -c"; + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneSniffPmkidOptions, index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneTextInput); + break; + case SubmenuIndexChannelActive: + app->selected_tx_string = "sniffpmkid -d -c"; + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneSniffPmkidOptions, index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneTextInput); + break; + } +} + +void wifi_marauder_scene_sniffpmkid_options_on_enter(void* context) { + WifiMarauderApp* app = context; + + Submenu* submenu = app->submenu; + + submenu_set_header(submenu, "Sniff PMKID"); + submenu_add_item( + submenu, + "Passive", + SubmenuIndexPassive, + wifi_marauder_scene_sniffpmkid_options_callback, + app); + submenu_add_item( + submenu, + "Active (Force Deauth)", + SubmenuIndexActive, + wifi_marauder_scene_sniffpmkid_options_callback, + app); + submenu_add_item( + submenu, + "Targeted Passive (List)", + SubmenuIndexTargetedPassive, + wifi_marauder_scene_sniffpmkid_options_callback, + app); + submenu_add_item( + submenu, + "Targeted Active (List)", + SubmenuIndexTargetedActive, + wifi_marauder_scene_sniffpmkid_options_callback, + app); + submenu_add_item( + submenu, + "On Channel # - Passive", + SubmenuIndexChannelPassive, + wifi_marauder_scene_sniffpmkid_options_callback, + app); + submenu_add_item( + submenu, + "On Channel # - Active", + SubmenuIndexChannelActive, + wifi_marauder_scene_sniffpmkid_options_callback, + app); + + submenu_set_selected_item( + submenu, + scene_manager_get_scene_state(app->scene_manager, WifiMarauderSceneSniffPmkidOptions)); + view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewSubmenu); +} + +bool wifi_marauder_scene_sniffpmkid_options_on_event(void* context, SceneManagerEvent event) { + //WifiMarauderApp* app = context; + UNUSED(context); + UNUSED(event); + bool consumed = false; + + return consumed; +} + +void wifi_marauder_scene_sniffpmkid_options_on_exit(void* context) { + WifiMarauderApp* app = context; + submenu_reset(app->submenu); +} diff --git a/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c b/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c index 6f22d0adb..b2bd39d3e 100644 --- a/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c +++ b/applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c @@ -97,13 +97,7 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = { NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP}, - {"Sniff PMKID", - {"ap", "channel"}, - 2, - {"sniffpmkid -d -l", "sniffpmkid -c"}, - TOGGLE_ARGS, - FOCUS_CONSOLE_END, - SHOW_STOPSCAN_TIP}, + {"Signal Monitor", {""}, 1, {"sigmon"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP}, {"Channel", {"get", "set"}, 2, @@ -161,6 +155,14 @@ static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uin return; } + if(app->selected_tx_string && + strncmp("sniffpmkid", app->selected_tx_string, strlen("sniffpmkid")) == 0) { + // sniffpmkid submenu + view_dispatcher_send_custom_event( + app->view_dispatcher, WifiMarauderEventStartSniffPmkidOptions); + return; + } + // Select automation script if(index == NUM_MENU_ITEMS - 2) { view_dispatcher_send_custom_event( @@ -254,6 +256,10 @@ bool wifi_marauder_scene_start_on_event(void* context, SceneManagerEvent event) scene_manager_set_scene_state( app->scene_manager, WifiMarauderSceneStart, app->selected_menu_index); scene_manager_next_scene(app->scene_manager, WifiMarauderSceneScriptSelect); + } else if(event.event == WifiMarauderEventStartSniffPmkidOptions) { + scene_manager_set_scene_state( + app->scene_manager, WifiMarauderSceneStart, app->selected_menu_index); + scene_manager_next_scene(app->scene_manager, WifiMarauderSceneSniffPmkidOptions); } consumed = true; } else if(event.type == SceneManagerEventTypeTick) { diff --git a/applications/external/wifi_marauder_companion/wifi_marauder_app.h b/applications/external/wifi_marauder_companion/wifi_marauder_app.h index 303fb59b4..5457f89d8 100644 --- a/applications/external/wifi_marauder_companion/wifi_marauder_app.h +++ b/applications/external/wifi_marauder_companion/wifi_marauder_app.h @@ -4,7 +4,7 @@ extern "C" { #endif -#define WIFI_MARAUDER_APP_VERSION "v0.3.5" +#define WIFI_MARAUDER_APP_VERSION "v0.3.7" typedef struct WifiMarauderApp WifiMarauderApp; diff --git a/applications/external/wifi_marauder_companion/wifi_marauder_custom_event.h b/applications/external/wifi_marauder_companion/wifi_marauder_custom_event.h index 5acdfa38e..b6d9f8274 100644 --- a/applications/external/wifi_marauder_companion/wifi_marauder_custom_event.h +++ b/applications/external/wifi_marauder_companion/wifi_marauder_custom_event.h @@ -8,5 +8,6 @@ typedef enum { WifiMarauderEventSaveDestinationMac, WifiMarauderEventStartSettingsInit, WifiMarauderEventStartLogViewer, - WifiMarauderEventStartScriptSelect + WifiMarauderEventStartScriptSelect, + WifiMarauderEventStartSniffPmkidOptions } WifiMarauderCustomEvent; diff --git a/applications/external/wifi_marauder_companion/wifi_marauder_text_input.c b/applications/external/wifi_marauder_companion/wifi_marauder_text_input.c index d9eee83c9..663d0130e 100644 --- a/applications/external/wifi_marauder_companion/wifi_marauder_text_input.c +++ b/applications/external/wifi_marauder_companion/wifi_marauder_text_input.c @@ -15,149 +15,215 @@ typedef struct { const uint8_t y; } WIFI_TextInputKey; +typedef struct { + const WIFI_TextInputKey* rows[3]; + const uint8_t keyboard_index; +} Keyboard; + typedef struct { const char* header; char* text_buffer; size_t text_buffer_size; + size_t minimum_length; bool clear_default_text; + bool cursor_select; + size_t cursor_pos; + WIFI_TextInputCallback callback; void* callback_context; uint8_t selected_row; uint8_t selected_column; + uint8_t selected_keyboard; WIFI_TextInputValidatorCallback validator_callback; void* validator_callback_context; FuriString* validator_text; - bool valadator_message_visible; + bool validator_message_visible; } WIFI_TextInputModel; static const uint8_t keyboard_origin_x = 1; static const uint8_t keyboard_origin_y = 29; -static const uint8_t keyboard_row_count = 4; +static const uint8_t keyboard_row_count = 3; +static const uint8_t keyboard_count = 2; #define ENTER_KEY '\r' #define BACKSPACE_KEY '\b' +#define SWITCH_KEYBOARD_KEY 0xfe static const WIFI_TextInputKey keyboard_keys_row_1[] = { - {'{', 1, 0}, - {'(', 9, 0}, - {'[', 17, 0}, - {'|', 25, 0}, - {'@', 33, 0}, - {'&', 41, 0}, - {'#', 49, 0}, - {';', 57, 0}, - {'^', 65, 0}, - {'*', 73, 0}, - {'`', 81, 0}, - {'"', 89, 0}, - {'~', 97, 0}, - {'\'', 105, 0}, - {'.', 113, 0}, - {'/', 120, 0}, + {'q', 1, 8}, + {'w', 10, 8}, + {'e', 19, 8}, + {'r', 28, 8}, + {'t', 37, 8}, + {'y', 46, 8}, + {'u', 55, 8}, + {'i', 64, 8}, + {'o', 73, 8}, + {'p', 82, 8}, + {'0', 91, 8}, + {'1', 100, 8}, + {'2', 110, 8}, + {'3', 120, 8}, }; static const WIFI_TextInputKey keyboard_keys_row_2[] = { - {'q', 1, 10}, - {'w', 9, 10}, - {'e', 17, 10}, - {'r', 25, 10}, - {'t', 33, 10}, - {'y', 41, 10}, - {'u', 49, 10}, - {'i', 57, 10}, - {'o', 65, 10}, - {'p', 73, 10}, - {'0', 81, 10}, - {'1', 89, 10}, - {'2', 97, 10}, - {'3', 105, 10}, - {'=', 113, 10}, - {'-', 120, 10}, + {'a', 1, 20}, + {'s', 10, 20}, + {'d', 19, 20}, + {'f', 28, 20}, + {'g', 37, 20}, + {'h', 46, 20}, + {'j', 55, 20}, + {'k', 64, 20}, + {'l', 73, 20}, + {BACKSPACE_KEY, 82, 12}, + {'4', 100, 20}, + {'5', 110, 20}, + {'6', 120, 20}, }; static const WIFI_TextInputKey keyboard_keys_row_3[] = { - {'a', 1, 21}, - {'s', 9, 21}, - {'d', 18, 21}, - {'f', 25, 21}, - {'g', 33, 21}, - {'h', 41, 21}, - {'j', 49, 21}, - {'k', 57, 21}, - {'l', 65, 21}, - {BACKSPACE_KEY, 72, 13}, - {'4', 89, 21}, - {'5', 97, 21}, - {'6', 105, 21}, - {'$', 113, 21}, - {'%', 120, 21}, - + {SWITCH_KEYBOARD_KEY, 1, 23}, + {'z', 13, 32}, + {'x', 21, 32}, + {'c', 28, 32}, + {'v', 36, 32}, + {'b', 44, 32}, + {'n', 52, 32}, + {'m', 59, 32}, + {'_', 67, 32}, + {ENTER_KEY, 74, 23}, + {'7', 100, 32}, + {'8', 110, 32}, + {'9', 120, 32}, }; -static const WIFI_TextInputKey keyboard_keys_row_4[] = { - {'z', 1, 33}, - {'x', 9, 33}, - {'c', 18, 33}, - {'v', 25, 33}, - {'b', 33, 33}, - {'n', 41, 33}, - {'m', 49, 33}, - {'_', 57, 33}, - {ENTER_KEY, 64, 24}, - {'7', 89, 33}, - {'8', 97, 33}, - {'9', 105, 33}, - {'!', 113, 33}, - {'+', 120, 33}, +static const WIFI_TextInputKey symbol_keyboard_keys_row_1[] = { + {'!', 2, 8}, + {'@', 12, 8}, + {'#', 22, 8}, + {'$', 32, 8}, + {'%', 42, 8}, + {'^', 52, 8}, + {'&', 62, 8}, + {'(', 71, 8}, + {')', 81, 8}, + {'0', 91, 8}, + {'1', 100, 8}, + {'2', 110, 8}, + {'3', 120, 8}, }; -static uint8_t get_row_size(uint8_t row_index) { +static const WIFI_TextInputKey symbol_keyboard_keys_row_2[] = { + {'~', 2, 20}, + {'+', 12, 20}, + {'-', 22, 20}, + {'=', 32, 20}, + {'[', 42, 20}, + {']', 52, 20}, + {'{', 62, 20}, + {'}', 72, 20}, + {BACKSPACE_KEY, 82, 12}, + {'4', 100, 20}, + {'5', 110, 20}, + {'6', 120, 20}, +}; + +static const WIFI_TextInputKey symbol_keyboard_keys_row_3[] = { + {SWITCH_KEYBOARD_KEY, 1, 23}, + {'.', 15, 32}, + {',', 29, 32}, + {';', 41, 32}, + {'`', 53, 32}, + {'\'', 65, 32}, + {ENTER_KEY, 74, 23}, + {'7', 100, 32}, + {'8', 110, 32}, + {'9', 120, 32}, +}; + +static const Keyboard keyboard = { + .rows = + { + keyboard_keys_row_1, + keyboard_keys_row_2, + keyboard_keys_row_3, + }, + .keyboard_index = 0, +}; + +static const Keyboard symbol_keyboard = { + .rows = + { + symbol_keyboard_keys_row_1, + symbol_keyboard_keys_row_2, + symbol_keyboard_keys_row_3, + }, + .keyboard_index = 1, +}; + +static const Keyboard* keyboards[] = { + &keyboard, + &symbol_keyboard, +}; + +static void switch_keyboard(WIFI_TextInputModel* model) { + model->selected_keyboard = (model->selected_keyboard + 1) % keyboard_count; +} + +static uint8_t get_row_size(const Keyboard* keyboard, uint8_t row_index) { uint8_t row_size = 0; - - switch(row_index + 1) { - case 1: - row_size = sizeof(keyboard_keys_row_1) / sizeof(WIFI_TextInputKey); - break; - case 2: - row_size = sizeof(keyboard_keys_row_2) / sizeof(WIFI_TextInputKey); - break; - case 3: - row_size = sizeof(keyboard_keys_row_3) / sizeof(WIFI_TextInputKey); - break; - case 4: - row_size = sizeof(keyboard_keys_row_4) / sizeof(WIFI_TextInputKey); - break; + if(keyboard == &symbol_keyboard) { + switch(row_index + 1) { + case 1: + row_size = COUNT_OF(symbol_keyboard_keys_row_1); + break; + case 2: + row_size = COUNT_OF(symbol_keyboard_keys_row_2); + break; + case 3: + row_size = COUNT_OF(symbol_keyboard_keys_row_3); + break; + default: + furi_crash(NULL); + } + } else { + switch(row_index + 1) { + case 1: + row_size = COUNT_OF(keyboard_keys_row_1); + break; + case 2: + row_size = COUNT_OF(keyboard_keys_row_2); + break; + case 3: + row_size = COUNT_OF(keyboard_keys_row_3); + break; + default: + furi_crash(NULL); + } } return row_size; } -static const WIFI_TextInputKey* get_row(uint8_t row_index) { +static const WIFI_TextInputKey* get_row(const Keyboard* keyboard, uint8_t row_index) { const WIFI_TextInputKey* row = NULL; - - switch(row_index + 1) { - case 1: - row = keyboard_keys_row_1; - break; - case 2: - row = keyboard_keys_row_2; - break; - case 3: - row = keyboard_keys_row_3; - break; - case 4: - row = keyboard_keys_row_4; - break; + if(row_index < 3) { + row = keyboard->rows[row_index]; + } else { + furi_crash(NULL); } return row; } static char get_selected_char(WIFI_TextInputModel* model) { - return get_row(model->selected_row)[model->selected_column].text; + return get_row( + keyboards[model->selected_keyboard], model->selected_row)[model->selected_column] + .text; } static bool char_is_lowercase(char letter) { @@ -165,36 +231,9 @@ static bool char_is_lowercase(char letter) { } static char char_to_uppercase(const char letter) { - switch(letter) { - case '_': + if(letter == '_') { return 0x20; - break; - case '(': - return 0x29; - break; - case '{': - return 0x7d; - break; - case '[': - return 0x5d; - break; - case '/': - return 0x5c; - break; - case ';': - return 0x3a; - break; - case '.': - return 0x2c; - break; - case '!': - return 0x3f; - break; - case '<': - return 0x3e; - break; - } - if(char_is_lowercase(letter)) { + } else if(char_is_lowercase(letter)) { return (letter - 0x20); } else { return letter; @@ -202,86 +241,96 @@ static char char_to_uppercase(const char letter) { } static void wifi_text_input_backspace_cb(WIFI_TextInputModel* model) { - uint8_t text_length = model->clear_default_text ? 1 : strlen(model->text_buffer); - if(text_length > 0) { - model->text_buffer[text_length - 1] = 0; + if(model->clear_default_text) { + model->text_buffer[0] = 0; + model->cursor_pos = 0; + } else if(model->cursor_pos > 0) { + char* move = model->text_buffer + model->cursor_pos; + memmove(move - 1, move, strlen(move) + 1); + model->cursor_pos--; } } static void wifi_text_input_view_draw_callback(Canvas* canvas, void* _model) { WIFI_TextInputModel* model = _model; - //uint8_t text_length = model->text_buffer ? strlen(model->text_buffer) : 0; + uint8_t text_length = model->text_buffer ? strlen(model->text_buffer) : 0; uint8_t needed_string_width = canvas_width(canvas) - 8; uint8_t start_pos = 4; - const char* text = model->text_buffer; + model->cursor_pos = model->cursor_pos > text_length ? text_length : model->cursor_pos; + size_t cursor_pos = model->cursor_pos; canvas_clear(canvas); canvas_set_color(canvas, ColorBlack); - canvas_draw_str(canvas, 2, 7, model->header); - elements_slightly_rounded_frame(canvas, 1, 8, 126, 12); + canvas_draw_str(canvas, 2, 8, model->header); + elements_slightly_rounded_frame(canvas, 1, 12, 126, 15); - if(canvas_string_width(canvas, text) > needed_string_width) { - canvas_draw_str(canvas, start_pos, 17, "..."); - start_pos += 6; - needed_string_width -= 8; - } - - while(text != 0 && canvas_string_width(canvas, text) > needed_string_width) { - text++; + char buf[model->text_buffer_size + 1]; + if(model->text_buffer) { + strlcpy(buf, model->text_buffer, sizeof(buf)); } + char* str = buf; if(model->clear_default_text) { elements_slightly_rounded_box( - canvas, start_pos - 1, 14, canvas_string_width(canvas, text) + 2, 10); + canvas, start_pos - 1, 14, canvas_string_width(canvas, str) + 2, 10); canvas_set_color(canvas, ColorWhite); } else { - canvas_draw_str(canvas, start_pos + canvas_string_width(canvas, text) + 1, 18, "|"); - canvas_draw_str(canvas, start_pos + canvas_string_width(canvas, text) + 2, 18, "|"); + char* move = str + cursor_pos; + memmove(move + 1, move, strlen(move) + 1); + str[cursor_pos] = '|'; } - canvas_draw_str(canvas, start_pos, 17, text); + + if(cursor_pos > 0 && canvas_string_width(canvas, str) > needed_string_width) { + canvas_draw_str(canvas, start_pos, 22, "..."); + start_pos += 6; + needed_string_width -= 8; + for(uint32_t off = 0; + strlen(str) && canvas_string_width(canvas, str) > needed_string_width && + off < cursor_pos; + off++) { + str++; + } + } + + if(canvas_string_width(canvas, str) > needed_string_width) { + needed_string_width -= 4; + size_t len = strlen(str); + while(len && canvas_string_width(canvas, str) > needed_string_width) { + str[len--] = '\0'; + } + strcat(str, "..."); + } + + canvas_draw_str(canvas, start_pos, 22, str); canvas_set_font(canvas, FontKeyboard); - for(uint8_t row = 0; row <= keyboard_row_count; row++) { - const uint8_t column_count = get_row_size(row); - const WIFI_TextInputKey* keys = get_row(row); + for(uint8_t row = 0; row < keyboard_row_count; row++) { + const uint8_t column_count = get_row_size(keyboards[model->selected_keyboard], row); + const WIFI_TextInputKey* keys = get_row(keyboards[model->selected_keyboard], row); for(size_t column = 0; column < column_count; column++) { + bool selected = !model->cursor_select && model->selected_row == row && + model->selected_column == column; + const Icon* icon = NULL; if(keys[column].text == ENTER_KEY) { - canvas_set_color(canvas, ColorBlack); - if(model->selected_row == row && model->selected_column == column) { - canvas_draw_icon( - canvas, - keyboard_origin_x + keys[column].x, - keyboard_origin_y + keys[column].y, - &I_KeySaveSelected_24x11); - } else { - canvas_draw_icon( - canvas, - keyboard_origin_x + keys[column].x, - keyboard_origin_y + keys[column].y, - &I_KeySave_24x11); - } + icon = selected ? &I_KeySaveSelected_24x11 : &I_KeySave_24x11; + } else if(keys[column].text == SWITCH_KEYBOARD_KEY) { + icon = selected ? &I_KeyKeyboardSelected_10x11 : &I_KeyKeyboard_10x11; } else if(keys[column].text == BACKSPACE_KEY) { - canvas_set_color(canvas, ColorBlack); - if(model->selected_row == row && model->selected_column == column) { - canvas_draw_icon( - canvas, - keyboard_origin_x + keys[column].x, - keyboard_origin_y + keys[column].y, - &I_KeyBackspaceSelected_16x9); - } else { - canvas_draw_icon( - canvas, - keyboard_origin_x + keys[column].x, - keyboard_origin_y + keys[column].y, - &I_KeyBackspace_16x9); - } + icon = selected ? &I_KeyBackspaceSelected_16x9 : &I_KeyBackspace_16x9; + } + canvas_set_color(canvas, ColorBlack); + if(icon != NULL) { + canvas_draw_icon( + canvas, + keyboard_origin_x + keys[column].x, + keyboard_origin_y + keys[column].y, + icon); } else { - if(model->selected_row == row && model->selected_column == column) { - canvas_set_color(canvas, ColorBlack); + if(selected) { canvas_draw_box( canvas, keyboard_origin_x + keys[column].x - 1, @@ -289,19 +338,25 @@ static void wifi_text_input_view_draw_callback(Canvas* canvas, void* _model) { 7, 10); canvas_set_color(canvas, ColorWhite); - } else { - canvas_set_color(canvas, ColorBlack); } - canvas_draw_glyph( - canvas, - keyboard_origin_x + keys[column].x, - keyboard_origin_y + keys[column].y, - keys[column].text); + if(model->clear_default_text || text_length == 0) { + canvas_draw_glyph( + canvas, + keyboard_origin_x + keys[column].x, + keyboard_origin_y + keys[column].y, + char_to_uppercase(keys[column].text)); + } else { + canvas_draw_glyph( + canvas, + keyboard_origin_x + keys[column].x, + keyboard_origin_y + keys[column].y, + keys[column].text); + } } } } - if(model->valadator_message_visible) { + if(model->validator_message_visible) { canvas_set_font(canvas, FontSecondary); canvas_set_color(canvas, ColorWhite); canvas_draw_box(canvas, 8, 10, 110, 48); @@ -319,37 +374,69 @@ static void UNUSED(wifi_text_input); if(model->selected_row > 0) { model->selected_row--; - if(model->selected_column > get_row_size(model->selected_row) - 6) { + if(model->selected_row == 0 && + model->selected_column > + get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 6) { model->selected_column = model->selected_column + 1; } + if(model->selected_row == 1 && + model->selected_keyboard == symbol_keyboard.keyboard_index) { + if(model->selected_column > 5) + model->selected_column += 2; + else if(model->selected_column > 1) + model->selected_column += 1; + } + } else { + model->cursor_select = true; + model->clear_default_text = false; } } static void wifi_text_input_handle_down(WIFI_TextInput* wifi_text_input, WIFI_TextInputModel* model) { UNUSED(wifi_text_input); - if(model->selected_row < keyboard_row_count - 1) { + if(model->cursor_select) { + model->cursor_select = false; + } else if(model->selected_row < keyboard_row_count - 1) { model->selected_row++; - if(model->selected_column > get_row_size(model->selected_row) - 4) { + if(model->selected_row == 1 && + model->selected_column > + get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 4) { model->selected_column = model->selected_column - 1; } + if(model->selected_row == 2 && + model->selected_keyboard == symbol_keyboard.keyboard_index) { + if(model->selected_column > 7) + model->selected_column -= 2; + else if(model->selected_column > 1) + model->selected_column -= 1; + } } } static void wifi_text_input_handle_left(WIFI_TextInput* wifi_text_input, WIFI_TextInputModel* model) { UNUSED(wifi_text_input); - if(model->selected_column > 0) { + if(model->cursor_select) { + if(model->cursor_pos > 0) { + model->cursor_pos = CLAMP(model->cursor_pos - 1, strlen(model->text_buffer), 0u); + } + } else if(model->selected_column > 0) { model->selected_column--; } else { - model->selected_column = get_row_size(model->selected_row) - 1; + model->selected_column = + get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 1; } } static void wifi_text_input_handle_right(WIFI_TextInput* wifi_text_input, WIFI_TextInputModel* model) { UNUSED(wifi_text_input); - if(model->selected_column < get_row_size(model->selected_row) - 1) { + if(model->cursor_select) { + model->cursor_pos = CLAMP(model->cursor_pos + 1, strlen(model->text_buffer), 0u); + } else if( + model->selected_column < + get_row_size(keyboards[model->selected_keyboard], model->selected_row) - 1) { model->selected_column++; } else { model->selected_column = 0; @@ -359,35 +446,49 @@ static void static void wifi_text_input_handle_ok( WIFI_TextInput* wifi_text_input, WIFI_TextInputModel* model, - bool shift) { + InputType type) { + if(model->cursor_select) return; + bool shift = type == InputTypeLong; + bool repeat = type == InputTypeRepeat; char selected = get_selected_char(model); - uint8_t text_length = strlen(model->text_buffer); - - if(shift) { - selected = char_to_uppercase(selected); - } + size_t text_length = strlen(model->text_buffer); if(selected == ENTER_KEY) { if(model->validator_callback && (!model->validator_callback( model->text_buffer, model->validator_text, model->validator_callback_context))) { - model->valadator_message_visible = true; + model->validator_message_visible = true; furi_timer_start(wifi_text_input->timer, furi_kernel_get_tick_frequency() * 4); - } else if(model->callback != 0 && text_length > 0) { + } else if(model->callback != 0 && text_length >= model->minimum_length) { model->callback(model->callback_context); } - } else if(selected == BACKSPACE_KEY) { - wifi_text_input_backspace_cb(model); + } else if(selected == SWITCH_KEYBOARD_KEY) { + switch_keyboard(model); } else { - if(model->clear_default_text) { - text_length = 0; - } - if(text_length < (model->text_buffer_size - 1)) { - model->text_buffer[text_length] = selected; - model->text_buffer[text_length + 1] = 0; + if(selected == BACKSPACE_KEY) { + wifi_text_input_backspace_cb(model); + } else if(!repeat) { + if(model->clear_default_text) { + text_length = 0; + } + if(text_length < (model->text_buffer_size - 1)) { + if(shift != (text_length == 0)) { + selected = char_to_uppercase(selected); + } + if(model->clear_default_text) { + model->text_buffer[0] = selected; + model->text_buffer[1] = '\0'; + model->cursor_pos = 1; + } else { + char* move = model->text_buffer + model->cursor_pos; + memmove(move + 1, move, strlen(move) + 1); + model->text_buffer[model->cursor_pos] = selected; + model->cursor_pos++; + } + } } + model->clear_default_text = false; } - model->clear_default_text = false; } static bool wifi_text_input_view_input_callback(InputEvent* event, void* context) { @@ -400,8 +501,8 @@ static bool wifi_text_input_view_input_callback(InputEvent* event, void* context WIFI_TextInputModel* model = view_get_model(wifi_text_input->view); if((!(event->type == InputTypePress) && !(event->type == InputTypeRelease)) && - model->valadator_message_visible) { - model->valadator_message_visible = false; + model->validator_message_visible) { + model->validator_message_visible = false; consumed = true; } else if(event->type == InputTypeShort) { consumed = true; @@ -419,7 +520,7 @@ static bool wifi_text_input_view_input_callback(InputEvent* event, void* context wifi_text_input_handle_right(wifi_text_input, model); break; case InputKeyOk: - wifi_text_input_handle_ok(wifi_text_input, model, false); + wifi_text_input_handle_ok(wifi_text_input, model, event->type); break; default: consumed = false; @@ -441,7 +542,7 @@ static bool wifi_text_input_view_input_callback(InputEvent* event, void* context wifi_text_input_handle_right(wifi_text_input, model); break; case InputKeyOk: - wifi_text_input_handle_ok(wifi_text_input, model, true); + wifi_text_input_handle_ok(wifi_text_input, model, event->type); break; case InputKeyBack: wifi_text_input_backspace_cb(model); @@ -465,6 +566,9 @@ static bool wifi_text_input_view_input_callback(InputEvent* event, void* context case InputKeyRight: wifi_text_input_handle_right(wifi_text_input, model); break; + case InputKeyOk: + wifi_text_input_handle_ok(wifi_text_input, model, event->type); + break; case InputKeyBack: wifi_text_input_backspace_cb(model); break; @@ -487,7 +591,7 @@ void wifi_text_input_timer_callback(void* context) { with_view_model( wifi_text_input->view, WIFI_TextInputModel * model, - { model->valadator_message_visible = false; }, + { model->validator_message_visible = false; }, true); } @@ -505,7 +609,12 @@ WIFI_TextInput* wifi_text_input_alloc() { with_view_model( wifi_text_input->view, WIFI_TextInputModel * model, - { model->validator_text = furi_string_alloc(); }, + { + model->validator_text = furi_string_alloc(); + model->minimum_length = 1; + model->cursor_pos = 0; + model->cursor_select = false; + }, false); wifi_text_input_reset(wifi_text_input); @@ -537,11 +646,14 @@ void wifi_text_input_reset(WIFI_TextInput* wifi_text_input) { wifi_text_input->view, WIFI_TextInputModel * model, { - model->text_buffer_size = 0; model->header = ""; model->selected_row = 0; model->selected_column = 0; + model->selected_keyboard = 0; + model->minimum_length = 1; model->clear_default_text = false; + model->cursor_pos = 0; + model->cursor_select = false; model->text_buffer = NULL; model->text_buffer_size = 0; model->callback = NULL; @@ -549,7 +661,7 @@ void wifi_text_input_reset(WIFI_TextInput* wifi_text_input) { model->validator_callback = NULL; model->validator_callback_context = NULL; furi_string_reset(model->validator_text); - model->valadator_message_visible = false; + model->validator_message_visible = false; }, true); } @@ -575,15 +687,28 @@ void wifi_text_input_set_result_callback( model->text_buffer = text_buffer; model->text_buffer_size = text_buffer_size; model->clear_default_text = clear_default_text; + model->cursor_select = false; if(text_buffer && text_buffer[0] != '\0') { + model->cursor_pos = strlen(text_buffer); // Set focus on Save model->selected_row = 2; - model->selected_column = 8; + model->selected_column = 9; + model->selected_keyboard = 0; + } else { + model->cursor_pos = 0; } }, true); } +void wifi_text_input_set_minimum_length(WIFI_TextInput* wifi_text_input, size_t minimum_length) { + with_view_model( + wifi_text_input->view, + WIFI_TextInputModel * model, + { model->minimum_length = minimum_length; }, + true); +} + void wifi_text_input_set_validator( WIFI_TextInput* wifi_text_input, WIFI_TextInputValidatorCallback callback, diff --git a/applications/external/wifi_marauder_companion/wifi_marauder_text_input.h b/applications/external/wifi_marauder_companion/wifi_marauder_text_input.h index b6b1f7bdf..f5efe9234 100644 --- a/applications/external/wifi_marauder_companion/wifi_marauder_text_input.h +++ b/applications/external/wifi_marauder_companion/wifi_marauder_text_input.h @@ -22,27 +22,27 @@ WIFI_TextInput* wifi_text_input_alloc(); /** Deinitialize and free text input * - * @param wifi_text_input WIFI_TextInput instance + * @param text_input WIFI_TextInput instance */ -void wifi_text_input_free(WIFI_TextInput* wifi_text_input); +void wifi_text_input_free(WIFI_TextInput* text_input); /** Clean text input view Note: this function does not free memory * - * @param wifi_text_input Text input instance + * @param text_input Text input instance */ -void wifi_text_input_reset(WIFI_TextInput* wifi_text_input); +void wifi_text_input_reset(WIFI_TextInput* text_input); /** Get text input view * - * @param wifi_text_input WIFI_TextInput instance + * @param text_input WIFI_TextInput instance * * @return View instance that can be used for embedding */ -View* wifi_text_input_get_view(WIFI_TextInput* wifi_text_input); +View* wifi_text_input_get_view(WIFI_TextInput* text_input); /** Set text input result callback * - * @param wifi_text_input WIFI_TextInput instance + * @param text_input WIFI_TextInput instance * @param callback callback fn * @param callback_context callback context * @param text_buffer pointer to YOUR text buffer, that we going @@ -53,7 +53,7 @@ View* wifi_text_input_get_view(WIFI_TextInput* wifi_text_input); * event */ void wifi_text_input_set_result_callback( - WIFI_TextInput* wifi_text_input, + WIFI_TextInput* text_input, WIFI_TextInputCallback callback, void* callback_context, char* text_buffer, @@ -61,22 +61,23 @@ void wifi_text_input_set_result_callback( bool clear_default_text); void wifi_text_input_set_validator( - WIFI_TextInput* wifi_text_input, + WIFI_TextInput* text_input, WIFI_TextInputValidatorCallback callback, void* callback_context); -WIFI_TextInputValidatorCallback - wifi_text_input_get_validator_callback(WIFI_TextInput* wifi_text_input); +void wifi_text_input_set_minimum_length(WIFI_TextInput* text_input, size_t minimum_length); -void* wifi_text_input_get_validator_callback_context(WIFI_TextInput* wifi_text_input); +WIFI_TextInputValidatorCallback wifi_text_input_get_validator_callback(WIFI_TextInput* text_input); + +void* wifi_text_input_get_validator_callback_context(WIFI_TextInput* text_input); /** Set text input header text * - * @param wifi_text_input WIFI_TextInput instance + * @param text_input WIFI_TextInput instance * @param text text to be shown */ -void wifi_text_input_set_header_text(WIFI_TextInput* wifi_text_input, const char* text); +void wifi_text_input_set_header_text(WIFI_TextInput* text_input, const char* text); #ifdef __cplusplus } -#endif +#endif \ No newline at end of file diff --git a/applications/external/wifi_scanner/wifi_scanner.c b/applications/external/wifi_scanner/wifi_scanner.c index 341287b54..127bee0cd 100644 --- a/applications/external/wifi_scanner/wifi_scanner.c +++ b/applications/external/wifi_scanner/wifi_scanner.c @@ -11,8 +11,6 @@ #include #include -#include - #include "FlipperZeroWiFiModuleDefines.h" #define WIFI_APP_DEBUG 0 @@ -104,6 +102,238 @@ typedef struct SWiFiScannerApp { uint8_t m_animtaionCounter; } SWiFiScannerApp; +/* + Fontname: -FreeType-Inconsolata LGC-Bold-R-Normal--36-360-72-72-P-176-ISO10646-1 + Copyright: Original Roman version created by Raph Levien using his own tools and FontForge. Copyright 2006 Raph Levien. Hellenisation of the Roman font, by Dimosthenis Kaponis, using FontForge. Hellenic glyphs Copyright 2010-2012 Dimosthenis Kaponis. Released under the SIL Open Font License, http://scripts.sil.org/OFL. Cyrillic glyphs added by MihailJP, using FontForge. Cyrillic glyphs Copyright 2012 MihailJP. Released under the SIL Open Font License, http://scripts.sil.org/OFL. Emboldened by MihailJP. Some glyphs modified by Greg Omelaenko, using FontForge. + Glyphs: 95/658 + BBX Build Mode: 2 +*/ +const uint8_t u8g2_font_inb27_mr[4414] = + "_\2\5\4\5\6\1\4\6\26%\0\370\33\371\35\371\5e\13\313\21! \13\266\14\366\207\377\377\377" + "\20\0!\30\266\14\366\7`\310\22\353E\42\351\177r|(\220h\240-\222\17\37\42%\266\14v\37" + "d,\62\310\42\203,\62\310\42\203,\62\310\42\203,\62\310\42\203,\62\310\42\203|\370\377\307\1#" + "M\266\14\366\7u\220\261\310 \213\14\262\310 \213\14\262\310 k\20b\36 \343\1\62\36 \3;" + "d\220E\6Yd\220\65\10Y\203\220\365\306\3c<@\306\3\344\220A\26\31d\221A\326 d\15" + "\62\330 \203\15\62\26!\343\303\63\0$A\266\14\366\7\200H\352\251\325\320;$\220P\14\21d\210" + "C\4\31\1\21AX\11\244e.\271\325\64F\202YD\224E\6Yd\20\23\10\31\244\214AD!" + "&\220P\314Cm\251G$\365\341\42\0%I\266\14\366\7\261\34RN!%\21B\226 \205\14\42" + "H!\203\4b\310H\346!\227N \253\204\22I,\221\222d\10F\302Q\15\221\220N\32\304\220@" + "\6)%\220A\12\21d\20R\304\42\204$R\312)\344\224\17/\3&F\266\14\366\7\264\274\304\326" + "b\251\214\222H!\211\24\222H!\212\14\262\310 \214\4\322\220;\16\65E\302!\202\220A\250A\221" + "\22\310 &\15r\16!\250\224bL)\5\225\7Fa\241\224\64\310\61F|x\30\0'\17\266\14" + "\366\7aH\372\357\303\377\177\1\0((\266\14v\14sD\363\216\63\317@\22\13,\221\304\22\211$" + "\261D\42\351\223ER\262\304\42K,\262\212v\261L\241\1)$\266\14\266\26\263D\233\254\305\42K" + ",\222\310\42\351_$\222\304\22I,\260\304\2\313\263\301\22\307\7\7\0*/\266\14\366\207\207\210\244" + "\261PH\11\205\14\62F\61a\10C\36\30\306\261\2\317C\215\10\262\310(\251\20\202\212!h\234\261" + "\2\12\37\376,\0+\33\266\14\366\207\207\210\244\267\36\30\344\201A\36\30\344\201\261\210\244\337\207\277\14" + "\0,\30\266\14\366\207\377\377\300\220%\32hI\42\307\34rH\42\7\15\15\0-\26\266\14\366\207\177" + "\352\201`\36\10\346\201`\36\10\37\376\277\4\0.\21\266\14\366\207\377\377\0\211\6\332\42\371p\22\0" + "/.\266\14\366\33\223\304\22I,\221H\22\211$\221H\22\211$\221H\22K$\261D\22K$\261" + "D\42I$\222D\42\211\34\65|x\17\0\60I\266\14\366\7\266<\324\324b\251\220\202\210!\247\230" + "b\310)\206\30SJA\204\24\22\10!e\10B\10\31\203\20\62(B\306 \224\30\205\20\22\206!" + "\4\31R\214)\245\34b\312!\247\224r\12)\211-\325\20,\37^\7\61\26\266\14\366\7\226@\363" + "NKL\265!\210\244\377\377\367\341y\0\62'\266\14\366\7\325\70\265Xr\247\24s\306)($\42" + "i\261D\22\13\254\277H\311g\36\10\346\201`\36\10\37\36\6\63-\266\14\366\7\324\70\265Xri" + "\230\222\2\42\222\26\313\63,\265\363RS\261\310\42i) \202\304)\207\224r\36jj\265\363\341y" + "\0\64\65\266\14\366\7\232H\22\13\264\336q\310\215@\32\11\204\21A\330\30d\221A\24!$\221B" + "\22)\4\21C\316\3\203<\60\310\3\203<\60\36\221\364}x\32\0\65*\266\14\366\7\361\235\337!" + "\222N\20\306TK\16\25b\316\70%\5T$\275#P)\4\21cJ\61\17\265\245\234\371\360:\0" + "\66>\266\14\366\7\327\70\265Xj\250\224\221\310\11\211H\22K$\243(\22\22z\347\201`L)\246" + "\234R\10*\205$RH\42\205$R\12\42\206\234b\212!\250\220\202\232b+=\363\341q\0\67-" + "\266\14\366\7\360\201`\36\10\346\201`\236$\261D\22K$\222\304\22I,\221H\22K$\222\304\22" + "I\254\42\211U$\261|\370\4\0\70;\266\14\366\7\325\70\265Xj\250\224r\212!\207\356\24C\20" + ")$\225Q\324b\251)U\204I\244\224C\31\202J!\211\24\222H!\211\224r\212)\245\234\207\232" + "Z\355|x\35\0\71\71\266\14\366\7\265\274\304\326b\251\220\202\210!\247\230b\10\42\206 b\10\42" + "\206 b\312\241L\71\205\30\344\251\23\10\33\203H\42\207$*\34\222D)\251%\266\322+\37>:" + "\27\266\14\366\207\77A\242\201\266H>|\210D\3m\221|\70\11\0;\34\266\14\366\207\77A\242\201" + "\266H>|\210D\3\255X$\221C\222HM\361\1\1< \266\14\366\207\271\60G,\357\264\304\360" + "\265\363J<\20\301\23/\210\301\3\215$T|\370\25\0= \266\14\366\207\317=\60\310\3\203<\60" + "\310\3\343\303\352\3\203<\60\310\3\203<\60>\374g\1>\36\266\14\366\207\266\240D\32\210\37<\261" + "\274\323\20\303\332\325P;\257\304\61\305\207\277\6\0\77%\266\14\266\67N\251\206\236\61\245\34r\312\21" + "\211H*\226Hb\201u\221H\352C\226D\3m\221|x\36\0@G\266\14\366\7\266\274\264\32r" + "\247\230b\10\42\205(B\306Ad\24\65\6ac\20\66\306(\204\214\61H!c\14R\310\30\203\24" + "\62\306\250\306\30m\220\301\310 \213\20R\2!d\222YNH.\265\245\234\371\360\70\0A<\266\14" + "\366\7\67PA\307\34\262\304\2\15<\357\70\22H#\201\264!\10#\203,\62\310\32e(RHj" + "\311\235\357\220S\12I\244\220T\6Yd\220E\6Y%\220F><\13\0BD\266\14\366\7\217)" + "\207\36\10\346\201`\310\61\205\240RH\42\205$RH\42\205\240R\310)\346\201`\336\371@\60\4\225" + "BR!D\21B\24!D\21B\24!$\25B\220!\17\210\362@\60\357\264\17\217\3C/\266\14" + "\366\7\327\264\245\32z\306\24S\312)\244$B\210\22\206\304\22\211\244'K,\222\310\22\213\12\247\240" + "a\214)\346\241\246V\63\37\36\7DC\266\14\366\7o\255\226\336y\207\30c\10*\205\240RH\42" + "\205\244B\210\42\204(B\210\42\204(B\210\42\204(B\210\42\204(B\210\42\204\244BH\42\205\240" + "R\10\42\206\30c\336q\250\245\365\341y\0E'\266\14\366\7\357\1Q\36\20\345\1Q\36\20\205H" + "\372\344;\277C$\375\344\3\242< \312\3\242< ><\14\0F\35\266\14\366\7\360\201`\36\10" + "\346\201`\36\10\206H\372\244C>D$\375\357\303W\0G:\266\14\366\7\326\70\245\32z\306\24S" + "\312)\244$a\210$\261D\42i&\15b\322 &\15b\322(\212\20\242\10!\212\220\222H)\210" + "\24c\212y \34\227\30;\37\36\7HM\266\14\366\7\217$RH\42\205$RH\42\205$RH" + "\42\205$RH\42\205$RH\42\205$R\36\20\345\1Q\36\20\345\1QH\42\205$RH\42\205" + "$RH\42\205$RH\42\205$RH\42\205$RH\42\205$\362\341a\0I\24\266\14\366\7\320" + "!_#\222\376\377k\357\374>\274\14\0J\33\266\14\366\7\264\245\236#\222\376\377\222\60%\215BR" + "S\213\245W>|\1\0KI\266\14\366\7\257\244\62H*\204\240R\310)\206\230rH)\210\24\222" + "\10!\212\14\262\210(\213\204\302RKM\261\22\312\42\203,\62\212\42\244$RH\42\245 b\312!" + "\247\30r\212!\250\24\222\12!\251\20\242\312\207g\1L\32\266\14\366\7\260D\42\351\377\377\311\7D" + "y@\224\7Dy@|x\27\0MU\266\14\366\7\217,\62\310\42\243\244\62J*\303\34\63\314\61" + "\343\224\63N\71\3\33$\214\61\2\31$\320\6\21#\14A\6\21#\14A\6\31eP\243\14\32!" + "\203\220A\310 \213\14\262\310 \213\14\262\310 \213\14\262\310 \213\14\262\310 \213\14\262\310\207g\1" + "NS\266\14\366\7\217(BJ\42\244$B\14\42\304 B\316!\344\34B\220!\204\4R\10!\201" + "\24B\210 \204\22\204P\203\42dP\204\22\204P\202\20RH \204\230\21\10!\6\21r\16!\347" + "\20\202\14!\310\20\222\12!\251\20\242\10!\212|x\27\0OC\266\14\366\7\325\70\265Xr\247\224" + "r\310)\245 RH*\204(\62\212\42\203,\62\310\42\203,\62\310\42\203,\62\310\42\203,\62\212" + "\42\204(BH*\244 b\310)\246\224\202\134bK\71\363\341u\0P\60\266\14\366\7\257\245w\36" + "\10\346\1Q\10*\205\244B\210\42\204(B\210\42\204(BH*\204\240R\36\20\345\201`\34b\212" + "H\372\357\303g\0QJ\266\14\366\7\325\70\265Xr\247\224r\310)\245 RH*\204\244\62\212\42" + "\203,\62\310\42\203,\62\310\42\203,\62\310\42\203,\62\212\42\204\244BH*\244 b\310)\246\224" + "\202\134b+\271\23\211$R\265\344\20\64\37@\0RC\266\14\366\7\217)\207\336y \30rL!" + "\250\24\222H!\211\24\222H!\211\24\202J!\247\230\7\202y\307!\246H!\211\24\222H)\210\30" + "\202\210)\207v\212!\210\30\202J!\211\24\222\312\207w\1S\61\266\14\366\7\365\264\245\32z\207\230" + "\12\211C\222\70DV\321D\364\262\207\242\221ER&,b\302\42e\244B\214)\345\1a^b\354" + "|x\35\0T\27\266\14\366\7\356\1\62\36 \343\1\62\36 \212H\372\377\377>|UH\266\14\366" + "\7\257$B\210\42\204(B\210\42\204(B\210\42\204(B\210\42\204(B\210\42\204(B\210\42\204" + "(B\210\42\204(B\210\42\204(B\210\42\204(B\210\42\244\240B\12*\245\230b\36rJ\71\363" + "\341u\0V>\266\14\366\7\216\60\42\10#\203(B\210\42\204(R\10\42\206 b\10\42\207\30\202" + "\210!\210\30\222H\31\212\20\242\10!\213\214\301\210 \214\10\322H\30\16{\6Z\221H\42\7\25\37" + ">W\134\266\14\366\7n\22\303\15A\212(D\220\62\10\21\244\14B\4!\204\214A\10!\23)c" + "\20\62\312\30\204\10\63\6!\302\10B\210\70\201\20\42N\30f\204!F\30\346\210\21\206\71\342\230#" + "\216\61\304\30C\12*\244\240B\12\42\206 b\10\42\206\240q\206\22H(\201\304\207\247\1XB\266" + "\14\366\7\217(BH\42\206 b\212!\210\224\202\12!\212\214\242\212 \214\204\302\222;\320\300\22K" + "\64\357<\324\24#\202,\62\212\42\204$R\12\42\206\34rJ)\210\24\222\312(\252|x\26\0Y" + "\60\266\14\366\7\216\254\42\212\42\204\244B\12\42\206 b\212!\210\30\202\12!\212\20\242\212 \214\10" + "\322H\30\16\275\363L,\221H\372\357\303\363\0Z\63\266\14\366\7\360\1Q\36\20\345\1Q\36\10\222" + "D\22K\244b\211$\226H\305\22I,\260D\22\13,\261\300\22\37\20\344\201A\36\30\344\201\361\341" + "]\0[\23\266\14\366n\251\227\210\244\377\377\77\331R\357C\10\0\134+\266\14\66\21\262H\42\213$" + "\262H\42\213$\262Hj\22I&\221d\22Id\221D\26Id\221D\26IM\42\311\14\37\36\1" + "]\20\266\14vn\251'\351\377\377_\352\373\220\2^!\266\14\366\7WL\42I\64\357<\324\210 " + "\213\14\262\10!\211\24\222\210!I\34\361\341\377\17\2_\26\266\14\366\207\377\377\247\36 \343\1\62\36" + " \343\1\362!\3\0`\33\266\14\266\11UPA\307$\222\310\22\213,\261\310\42\251\71Q\361\341\377" + "g\0a\60\266\14\366\207\217\236\266\222C.\15S$\325Rj\347\231\7\202)\207\224\202H!\211\24" + "\202J)\345\230\7\202y \34\25H\62\203|x\30\0b;\266\14\66.\221H\372\215\242HH\350" + "\235\7\202\61\305\224rJ!\251\20\222\12!\212\20\242\10!\212\20\242\10!\212\20\222\12)\210\24c" + "Jy \230w\206Hh\220\362\341u\0c(\266\14\366\207\257\32\247\224;\17\4S\225\202\206!I" + "\230\22\211\244\311\42\211,H\240b\310y \34\247\224\63\37\36\7d;\266\14\366\7\207H\372\251\62" + "\10J\201\234g\36\10\245\30S\10*\244\240BH*\204(B\210\42\204(B\210\42\244\240B\12*" + "\245\234R,\363@\70\17\245@T\31\344\303\273\0e,\266\14\366\207\217\236\266TC\317T\206 b" + "H\42\344\201A\36\30\344\201A\36\30\204H\42\253\24\216\61\344<\344\322r\346\303\343\0f\35\266\14" + "\366\7\302\70\265Xj\250\230\201\312\11\211H\312\71\344cD\322\377\367\341\23\0g=\266\14\366\207o" + "\26R\314\3\241< \10!j\224R\16}\247\224r\314(\251\251\265\324\42a\64\42[z \234\7" + "\202y@\20\222\312 \213\14\262\310(\251\214\7Fy \34\267\220\7h<\266\14v.\221H\372\215" + "\242\210@\210\4u\336\71\244\30c\210)\207\30\202\210!\210\30\202\210!\210\30\202\210!\210\30\202\210" + "!\210\30\202\210!\210\30\202\210!\210\30\202\310\207\207\1i\30\266\14\366\7`\310\22+\71>$S" + "\313I\372\277\326R\357\303\323\0j\37\266\14\366\7d\310\22+\71>\364\230\342I\372\377\227\204)\210" + "\220\202\134bK\71\363A\0k\71\266\14v.\221H\372\241R\310)\206\230rH)\210\220\222\310(" + "\212\210\262H(Lck\25Q\24!%\221R\20)\5\21S\16\71\305\20T\12A\206\220d>\274" + "\12\0l\21\266\14vVL'\351\377\377\330;\277\17/\3m@\266\14\366\207\257\221PF!+\234" + "\361\0\31\17\24QF\21\325 \204\10B(A\10%\10\241\4!\224 \204\22\204P\202\20J\20B" + "\11B(A\10%\10\241\4!\224 \204\22\204P\37\236\5n:\266\14\366\207\357\221Q\24\21\10\275" + "\363\316!\305\224CL\71\304\20D\14A\304\20D\14A\304\20D\14A\304\20D\14A\304\20D\14" + "A\304\20D\14A\304\20D><\14\0o\62\266\14\366\207\257\32\247TC\357\224bJ\71\245\220T" + "FIe\220E\6Yd\220E\6Yd\24E\10I\244\224SL)\306<\324\324r\346\303\343\0p" + "=\266\14\366\207\317\221Q\24\11\11=\20\314\3\301\230bJ\71\245\220T\10I\205\20E\10Q\204\20" + "E\10Q\204\20E\10I\205\24D\212\61\245<\20\314;$$DFQD\322\367\301\1q\71\266\14" + "\366\207\217\32AP\12\344<\363@(\305\230BP!\5\25B\24!D\21B\24!D\21B\24!" + "%\221BP)\345\224b\231\7\302y(\5\242\312 \222~\30\0r\37\266\14\366\207\17\22R\22\21" + "\351<\20\314\3\301\34#\216\71\342\224X\42\221\364\277\17\37\1s,\266\14\366\207\217\232\306\222C\317" + "\24C\16A\343\24\24R\211\351)\227\340\221\305\10E\214P\244\224S\312\3\341\270\304\332\371\360:\0" + "t\35\266\14\366\207\234\220\364\332;\277E$\375\223\305\4U\212XL\261\245\232\371\360\66\0u;\266" + "\14\366\207\317\221D\12I\244\220D\12I\244\220D\12I\244\220D\12I\244\220D\12I\244\220D\12" + "I\244\220DJ\71\245\224SL)\306<\20\316C)\20U\6\371\360\60\0v\63\266\14\366\207\257\25" + "E\10Q\204\20E\12I\303\20DL\71\3\21C\20\61$\221\62\24!D\21\62\30\21\204\21A\32" + "\11\303!w\240\201E\22\71>|wH\266\14\366\207\217Q\202\60\42H\31\204\214Q\6!c\224A" + "\310 \243\14j\224A\215\62F\31\303\210Q\206\30a\210QH\230\304($Lb\24\22\204@\306\14" + "s\314\60\307\14sJ)\247\224\202H!\211\24\362\341i\0x\63\266\14\366\207\317\221DJ\71\305\24" + "C\20)D\221QT\21\204%\207\334\201%\232w\36j$\224U\4Q\205\220DJ\71\305\224R\20" + ")$\225\17\357\2y<\266\14\366\207\317\225T\10I\244\220DJA\304\220CC\304\20D\12I\205" + "\20E\310Xd\20F\4aD\14\67\2q\347\35h`\221T$,\24\262\4!L-\325\320+\37" + "\24\0z&\266\14\366\207\357=\20\314\3\301<\20\314\213$\26X\213$\26X\27\13|@\220\7\6" + "y`\220\7\306\207w\1{$\266\14\366\7\342\264\304\324Z\253\300\22\211\244_$\357<\3\15<\262" + "H\372'K,r\255\305\224C\32\0|\16\266\14\366\7\200H\372\377\377\377\357\3}#\266\14\266\66" + "\20\271\324\224,\222\376d\221d\36h\336q\310\221H$\375\213e)\246Xj\347\3\1\0~\31\266" + "\14\366\207/\232\23\214\42d<\60\306\3\303\210\202`\371\360\377\303\0\0\0\0\4\377\377\0"; + +/* + Fontname: open_iconic_arrow_2x + Copyright: https://github.com/iconic/open-iconic, SIL OPEN FONT LICENSE + Glyphs: 28/28 + BBX Build Mode: 0 +*/ +const uint8_t u8g2_font_open_iconic_arrow_2x_t[644] = + "\34\0\4\4\5\5\4\4\6\20\20\0\0\16\0\16\0\0\17\0\0\2g@\17\352i\302$P\376\221" + "\12\64\246\310\11\2A\22O%\303\24Z\360X\242\17^\20\36-<(\0B\22O!\303\32\134\364" + "`\22\17\236\222\35,:\20\0C\17\352)\302$\216\224\31\24\212\4\312\77\2D\37\20\42\302eP" + "\25!\62\205\212\24*a\210#\304E\17\222 F\244P\231\42\245\24\232\2E \20\42\302ePU" + "\11\63E\216\220\71Ah-a\302e\15\241 s\244\310\231\22\246\24\232\2F\37\20\42\302eP\225" + "\211\62G\212\234!\201\310laj\27\221\70C\344H\31\23\245\24\232\2G\37\20\42\302ePU\221" + "\62\205\212\20#A\360haD\34\231(T\244P\31B\244\24\232\2H\21\12.\302C\214\376\215\212" + "$\207\212\15\14\4\0I\23P\341\302\25\134\364`\27\17\36\204xBz\270P\0J\23P\341\302*" + "|\64\221\27\17\36\204px \0U\23\20\42" + "\302\360\201x\230\212&k\22\235J\302\364\14\0V\34\320\241\302\34\36\200\30\27/\204\12\21\32\36\302" + "\240B\204\212x\341F<\200\300\0W\32\220\241\302&\230\354hq\202\304\221\21\306L\14\71A\342D" + "\217%,\14\0X\37\20\42\302\302\210\221@A\2\205K$\314\210\70\42\344\204\30\23$\134BA\2" + "\5q\2\0Y$\17\42\302\34\134\304\270TF\306\214\20\64bH\260\262\203\211\226\34\42$\320\230\21" + "\42H\245+,:\10\0Z\30\220!\303\32\36\200\360\321\4S\61\351\206\324 q\202\4\206\12\17\0" + "[\34\320\241\302`\324X\30q&D-J!&\211\230`a\204\313P\220@A\34\1\0\0\0\4" + "\377\377\0"; + +/* + Fontname: -Adobe-Courier-Bold-R-Normal--11-80-100-100-M-60-ISO10646-1 + Copyright: Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved. + Glyphs: 18/873 + BBX Build Mode: 0 +*/ +const uint8_t u8g2_font_courB08_tn[199] = + "\22\0\3\3\3\4\2\3\4\6\11\0\376\6\376\7\377\0\0\0\0\0\252 \5\0\353\0*\11$\357" + "\212P$\241\0+\12-\353\12\206J\301\20\0,\7\233\345\221$\1-\5\15\357(.\5\212\351\20" + "/\14\304\347K\212\205b\241X\14\0\60\12=\351\231Hx\221L\0\61\10>\351\22\21u\62\62\11" + "=\351\231\250\211\264\34\63\14=\351\231\250I\206\24\311\4\0\64\14>\351\223\215\42ZlB\11\0\65" + "\12=\351\270Q\324F\26\0\66\14=\351\231Hh\24\11E\62\1\67\13=\351\270\310D\62\221L\4" + "\70\15=\351\231H(\222\211\204\42\231\0\71\14=\351\231H(\22\32E\62\1:\6\242\351\20\12\0" + "\0\0\4\377\377\0"; + +/* + Fontname: -Misc-Fixed-Bold-R-Normal--13-120-75-75-C-70-ISO10646-1 + Copyright: Public domain font. Share and enjoy. + Glyphs: 95/1003 + BBX Build Mode: 0 +*/ +const uint8_t u8g2_font_7x13B_tr[1083] = + "_\0\3\3\3\4\3\5\4\6\15\0\376\11\376\11\0\1}\2\330\4\36 \5\0\356\7!\7J\303" + "\307\241D\42\10\235\332\207\204E\0#\20\315\302OR$r\230\244\34&I\221\10\0$\17N\302\227" + "\214\22\321F\223\250Dh\42\0%\17N\302\307H\22\251\4e\212\221JD\64&\17N\302\317H\242" + "\247\221$\62\251\210&\1'\7\42\327\307!\0(\14\314\302\227D$\21\251\211d\2)\15\314\302\207" + "L$\23\251\210$\42\0*\15\66\306O(&:\224d\241\10\0+\13\66\306\227Pt(\11E\0" + ",\10\244\276\317\212\22\0-\6\16\316\207\1.\10\234\276\217\204\42\1/\14N\302\247\232P\246(\23" + "\12\1\60\16N\302\227,\24\21\361$\11\305D\0\61\13N\302\227l\24\21\352\311\0\62\16N\302\17" + "ED\22\212F\62\241\320\0\63\15N\302\207Q\246F\25\222$\24\0\64\15N\302\247lD\221\220H" + "\207\240\2\65\16N\302\307!(\254\210\204B\222\204\2\66\16N\302\17ED\24VDL\22\12\0\67" + "\15N\302\207QM(\23\312\204\62\0\70\16N\302\17E\304$\241\210\230$\24\0\71\16N\302\17E" + "\304$)\12I\22\12\0:\14\304\276\217\204\42\207I(\22\0;\13\304\276\217\204\42\236L\224\0<" + "\10N\302\247LW\35=\7&\312\207\35j>\11N\302\207T\67\35\1\77\16N\302\17ED\22\212" + "fr\230P\4@\17N\302\17%\266R\211L\252\61\11\5\0A\13N\302\17E\304t\30q\22B" + "\14N\302GE\304t\21\61]\0C\13N\302\17ED\324\223\204\2D\12N\302GE\304O\27\0" + "E\13N\302\307!\250X\21*\32F\13N\302\307!\250X\21j\4G\14N\302\17EDT)\61" + "I\12H\13N\302\207\210\323a\304I\0I\11N\302\207I\250O\6J\12N\302\247>\222$\24\0" + "K\17N\302\207lD\221\220f$\211\22-\0L\10N\302\207P\77\32M\13N\302Gpt\70\210" + "x\22N\15N\302\207\210T\251\34&M$\1O\13N\302\17E\304O\22\12\0P\13N\302GE" + "\304t\21j\4Q\14V\276\17E\304S\205\62\241\12R\15N\302GE\304t!I\224h\1S\16" + "N\302\17ED\224R\205$\11\5\0T\11N\302\207I\250\237\0U\12N\302\207\210\77I(\0V" + "\15N\302\207\210I\22\312D\23*\1W\13N\302\207\210\247\303A\64\14X\17N\302Gp$\11\205" + "h\62R\212h\30Y\14N\302\207\210$!\321\204:\1Z\12N\302\207QMG\241\1[\10\314\302" + "\207I\237\10\134\14N\302\207P*\224*J\205\2]\10\314\302\7I\237\14^\11&\326\227\214\42\32" + "\6_\7\26\276\307\241\0`\7\234\336\207L\1a\12\66\302\17Ur\42I\12b\13N\302\207P\261" + "\42\342t\1c\13\66\302\17EDT\222P\0d\12N\302\247\226\23'I\1e\14\66\302\17Et" + "\30\212$\24\0f\14N\302\327H\242(\243\11\265\1g\16F\272\317\22IB\221RD\22\12\0h" + "\13N\302\207P\261\42\342I\0i\12N\302\227P\16\32\352dj\14^\272\247:L\250#IB\1" + "k\15N\302\207P\23EB\42I\224\4l\10N\302\317P\77\31m\12\66\302\207Dr\70\61\11n" + "\11\66\302GE\304\223\0o\12\66\302\17E\304IB\1p\13F\272GE\304t\21*\2q\12F" + "\272\317\211IR\324\0r\11\66\302GED\324\10s\15\66\302\17E$\21KD\22\12\0t\14F" + "\302\217PV\22j\21M\0u\11\66\302\207\210'I\1v\13\66\302\207\210IB\242\211\0w\13\66" + "\302\207\210\351p\11E\0x\14\66\302\207\210$!QD$\1y\14F\272\207\210\223\244H\222P\0" + "z\12\66\302\207Q&\222\11\15{\14\314\302OI&\221ID\262\1|\7J\303\307\3\1}\15\314" + "\302\307L$\221Id\242\12\0~\11\36\332\217\350\20\222\0\0\0\0\4\377\377\0"; + /////// INIT STATE /////// static void wifi_scanner_app_init(SWiFiScannerApp* const app) { app->m_context = Undefined; @@ -153,8 +383,8 @@ int16_t dBmtoPercentage(int16_t dBm) { void DrawSignalStrengthBar(Canvas* canvas, int rssi, int x, int y, int width, int height) { int16_t percents = dBmtoPercentage(rssi); - u8g2_DrawHLine(&canvas->fb, x, y, width); - u8g2_DrawHLine(&canvas->fb, x, y + height, width); + //u8g2_DrawHLine(&canvas->fb, x, y, width); + //u8g2_DrawHLine(&canvas->fb, x, y + height, width); if(rssi != NA && height > 0) { uint8_t barHeight = floor((height / 100.f) * percents); @@ -177,10 +407,8 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { const char* strError = "Something wrong"; canvas_draw_str( canvas, - (u8g2_GetDisplayWidth(&canvas->fb) / 2) - - (canvas_string_width(canvas, strError) / 2), - (u8g2_GetDisplayHeight(&canvas->fb) / - 2) /* - (u8g2_GetMaxCharHeight(&canvas->fb) / 2)*/, + (128 / 2) - (canvas_string_width(canvas, strError) / 2), + (64 / 2) /* - (canvas_current_font_height(canvas) / 2)*/, strError); } break; case WaitingForModule: @@ -192,10 +420,8 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { const char* strConnectModule = "Attach WiFi scanner module"; canvas_draw_str( canvas, - (u8g2_GetDisplayWidth(&canvas->fb) / 2) - - (canvas_string_width(canvas, strConnectModule) / 2), - (u8g2_GetDisplayHeight(&canvas->fb) / - 2) /* - (u8g2_GetMaxCharHeight(&canvas->fb) / 2)*/, + (128 / 2) - (canvas_string_width(canvas, strConnectModule) / 2), + (64 / 2) /* - (canvas_current_font_height(canvas) / 2)*/, strConnectModule); } #endif @@ -208,26 +434,19 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { const char* strInitializing = "Initializing..."; canvas_draw_str( canvas, - (u8g2_GetDisplayWidth(&canvas->fb) / 2) - - (canvas_string_width(canvas, strInitializing) / 2), - (u8g2_GetDisplayHeight(&canvas->fb) / 2) - - (u8g2_GetMaxCharHeight(&canvas->fb) / 2), + (128 / 2) - (canvas_string_width(canvas, strInitializing) / 2), + (64 / 2) - (canvas_current_font_height(canvas) / 2), strInitializing); } } break; case ScanMode: { uint8_t offsetY = 0; uint8_t offsetX = 0; - canvas_draw_frame( - canvas, - 0, - 0, - u8g2_GetDisplayWidth(&canvas->fb), - u8g2_GetDisplayHeight(&canvas->fb)); + canvas_draw_frame(canvas, 0, 0, 128, 64); //canvas_set_font(canvas, FontPrimary); - u8g2_SetFont(&canvas->fb, u8g2_font_7x13B_tr); - uint8_t fontHeight = u8g2_GetMaxCharHeight(&canvas->fb); + canvas_set_custom_u8g2_font(canvas, u8g2_font_7x13B_tr); + uint8_t fontHeight = canvas_current_font_height(canvas); offsetX += 5; offsetY += fontHeight; @@ -248,8 +467,8 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { furi_string_get_cstr(app->m_currentAccesspointDescription.m_bssid)); canvas_set_font(canvas, FontSecondary); - //u8g2_SetFont(&canvas->fb, u8g2_font_tinytim_tf); - fontHeight = u8g2_GetMaxCharHeight(&canvas->fb); + //canvas_set_custom_u8g2_font(canvas, u8g2_font_tinytim_tf); + fontHeight = canvas_current_font_height(canvas); offsetY += fontHeight + 1; @@ -276,24 +495,20 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { offsetY += fontHeight; offsetY -= fontHeight; - u8g2_SetFont(&canvas->fb, u8g2_font_courB08_tn); + canvas_set_custom_u8g2_font(canvas, u8g2_font_courB08_tn); snprintf( string, sizeof(string), "%d/%d", app->m_currentIndexAccessPoint, app->m_totalAccessPoints); - offsetX = u8g2_GetDisplayWidth(&canvas->fb) - canvas_string_width(canvas, string) - 5; + offsetX = 128 - canvas_string_width(canvas, string) - 5; canvas_draw_str(canvas, offsetX, offsetY, string); canvas_draw_frame( - canvas, - offsetX - 6, - offsetY - u8g2_GetMaxCharHeight(&canvas->fb) - 3, - u8g2_GetDisplayWidth(&canvas->fb), - u8g2_GetDisplayHeight(&canvas->fb)); + canvas, offsetX - 6, offsetY - canvas_current_font_height(canvas) - 3, 128, 64); - u8g2_SetFont(&canvas->fb, u8g2_font_open_iconic_arrow_2x_t); + canvas_set_custom_u8g2_font(canvas, u8g2_font_open_iconic_arrow_2x_t); if(app->m_currentIndexAccessPoint != app->m_totalAccessPoints) { //canvas_draw_triangle(canvas, offsetX - 5 - 20, offsetY + 5, 4, 4, CanvasDirectionBottomToTop); canvas_draw_str(canvas, offsetX - 0 - 35, offsetY + 5, "\x4C"); @@ -308,25 +523,21 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { uint8_t offsetY = 0; uint8_t offsetX = 0; - canvas_draw_frame( - canvas, - 0, - 0, - u8g2_GetDisplayWidth(&canvas->fb), - u8g2_GetDisplayHeight(&canvas->fb)); + canvas_draw_frame(canvas, 0, 0, 128, 64); //canvas_set_font(canvas, FontBigNumbers); - u8g2_SetFont(&canvas->fb, u8g2_font_inb27_mr); - uint8_t fontHeight = u8g2_GetMaxCharHeight(&canvas->fb); - uint8_t fontWidth = u8g2_GetMaxCharWidth(&canvas->fb); + //canvas_set_custom_u8g2_font(canvas, u8g2_font_inb27_mr); + canvas_set_custom_u8g2_font(canvas, u8g2_font_inb27_mr); + uint8_t fontHeight = canvas_current_font_height(canvas); + uint8_t fontWidth = canvas_current_font_width(canvas); if(app->m_currentAccesspointDescription.m_rssi == NA) { - offsetX += floor(u8g2_GetDisplayWidth(&canvas->fb) / 2) - fontWidth - 10; + offsetX += floor(128 / 2) - fontWidth - 10; offsetY += fontHeight - 5; canvas_draw_str(canvas, offsetX, offsetY, "N/A"); } else { - offsetX += floor(u8g2_GetDisplayWidth(&canvas->fb) / 2) - 2 * fontWidth; + offsetX += floor(128 / 2) - 2 * fontWidth; offsetY += fontHeight - 5; char rssi[8]; @@ -335,12 +546,12 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { } //canvas_set_font(canvas, FontPrimary); - u8g2_SetFont(&canvas->fb, u8g2_font_7x13B_tr); - fontHeight = u8g2_GetMaxCharHeight(&canvas->fb); - fontWidth = u8g2_GetMaxCharWidth(&canvas->fb); + canvas_set_custom_u8g2_font(canvas, u8g2_font_7x13B_tr); + fontHeight = canvas_current_font_height(canvas); + fontWidth = canvas_current_font_width(canvas); offsetX = 5; - offsetY = u8g2_GetDisplayHeight(&canvas->fb) - 7 - fontHeight; + offsetY = 64 - 7 - fontHeight; canvas_draw_str( canvas, offsetX, @@ -358,12 +569,7 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { DrawSignalStrengthBar( canvas, app->m_currentAccesspointDescription.m_rssi, 5, 5, 12, 25); DrawSignalStrengthBar( - canvas, - app->m_currentAccesspointDescription.m_rssi, - u8g2_GetDisplayWidth(&canvas->fb) - 5 - 12, - 5, - 12, - 25); + canvas, app->m_currentAccesspointDescription.m_rssi, 128 - 5 - 12, 5, 12, 25); } break; case ScanAnimation: { uint32_t currentTime = furi_get_tick(); @@ -380,18 +586,15 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { canvas_draw_disc( canvas, offsetX + 30 + 25 * i, - u8g2_GetDisplayHeight(&canvas->fb) / 2 - 7, + 64 / 2 - 7, 5 * (app->m_animtaionCounter == i ? mutliplier : 1)); } - u8g2_SetFont(&canvas->fb, u8g2_font_7x13B_tr); + canvas_set_custom_u8g2_font(canvas, u8g2_font_7x13B_tr); //canvas_set_font(canvas, FontPrimary); const char* message = "Scanning"; canvas_draw_str( - canvas, - u8g2_GetDisplayWidth(&canvas->fb) / 2 - canvas_string_width(canvas, message) / 2, - 55, - message); + canvas, 128 / 2 - canvas_string_width(canvas, message) / 2, 55, message); } break; case MonitorAnimation: { uint32_t currentTime = furi_get_tick(); @@ -407,27 +610,24 @@ static void wifi_module_render_callback(Canvas* const canvas, void* ctx) { canvas_draw_disc( canvas, offsetX + 30, - u8g2_GetDisplayHeight(&canvas->fb) / 2 - 7, + 64 / 2 - 7, 5 * (app->m_animtaionCounter == 0 ? mutliplier : 1)); canvas_draw_disc( canvas, offsetX + 55, - u8g2_GetDisplayHeight(&canvas->fb) / 2 - 7, + 64 / 2 - 7, 5 * (app->m_animtaionCounter == 1 ? mutliplier : 1)); canvas_draw_disc( canvas, offsetX + 80, - u8g2_GetDisplayHeight(&canvas->fb) / 2 - 7, + 64 / 2 - 7, 5 * (app->m_animtaionCounter == 0 ? mutliplier : 1)); - u8g2_SetFont(&canvas->fb, u8g2_font_7x13B_tr); + canvas_set_custom_u8g2_font(canvas, u8g2_font_7x13B_tr); //canvas_set_font(canvas, FontPrimary); const char* message = "Monitor Mode"; canvas_draw_str( - canvas, - u8g2_GetDisplayWidth(&canvas->fb) / 2 - canvas_string_width(canvas, message) / 2, - 55, - message); + canvas, 128 / 2 - canvas_string_width(canvas, message) / 2, 55, message); } break; default: break; diff --git a/applications/main/archive/scenes/archive_scene_rename.c b/applications/main/archive/scenes/archive_scene_rename.c index 346383162..e6c728f03 100644 --- a/applications/main/archive/scenes/archive_scene_rename.c +++ b/applications/main/archive/scenes/archive_scene_rename.c @@ -22,17 +22,21 @@ void archive_scene_rename_on_enter(void* context) { TextInput* text_input = archive->text_input; ArchiveFile_t* current = archive_get_current_file(archive->browser); - FuriString* path_name; - path_name = furi_string_alloc(); + FuriString* path_name = furi_string_alloc(); + FuriString* path_folder = furi_string_alloc(); if(current->type == ArchiveFileTypeFolder) { + // Set file ext to empty since we need to see folder name here + strcpy(archive->file_extension, ""); + // Extract folder name and copy into text_store path_extract_basename(furi_string_get_cstr(current->path), path_name); strlcpy(archive->text_store, furi_string_get_cstr(path_name), MAX_NAME_LEN); text_input_set_header_text(text_input, "Rename directory:"); } else /*if(current->type != ArchiveFileTypeUnknown) */ { + // Extract file name and copy into text_store path_extract_filename(current->path, path_name, true); strlcpy(archive->text_store, furi_string_get_cstr(path_name), MAX_NAME_LEN); - + // Extract file extension for validator and rename func path_extract_extension(current->path, archive->file_extension, MAX_EXT_LEN); text_input_set_header_text(text_input, "Rename file:"); } /*else { @@ -41,6 +45,9 @@ void archive_scene_rename_on_enter(void* context) { text_input_set_header_text(text_input, "Rename unknown file:"); }*/ + // Get current folder (for file) or previous folder (for folder) for validator + path_extract_dirname(furi_string_get_cstr(current->path), path_folder); + text_input_set_result_callback( text_input, archive_scene_rename_text_input_callback, @@ -49,7 +56,13 @@ void archive_scene_rename_on_enter(void* context) { MAX_TEXT_INPUT_LEN, false); + // Init validator to show message to user that name already exist + ValidatorIsFile* validator_is_file = validator_is_file_alloc_init( + furi_string_get_cstr(path_folder), archive->file_extension, archive->text_store); + text_input_set_validator(text_input, validator_is_file_callback, validator_is_file); + furi_string_free(path_name); + furi_string_free(path_folder); view_dispatcher_switch_to_view(archive->view_dispatcher, ArchiveViewTextInput); } diff --git a/applications/main/infrared/infrared.c b/applications/main/infrared/infrared.c index b2be5f1af..2d35f4805 100644 --- a/applications/main/infrared/infrared.c +++ b/applications/main/infrared/infrared.c @@ -326,7 +326,8 @@ void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) { if(infrared_signal_is_raw(signal)) { InfraredRawSignal* raw = infrared_signal_get_raw_signal(signal); - infrared_worker_set_raw_signal(infrared->worker, raw->timings, raw->timings_size); + infrared_worker_set_raw_signal( + infrared->worker, raw->timings, raw->timings_size, raw->frequency, raw->duty_cycle); } else { InfraredMessage* message = infrared_signal_get_message(signal); infrared_worker_set_decoded_signal(infrared->worker, message); diff --git a/applications/main/lfrfid/lfrfid.c b/applications/main/lfrfid/lfrfid.c index a82d2dd03..8030d785d 100644 --- a/applications/main/lfrfid/lfrfid.c +++ b/applications/main/lfrfid/lfrfid.c @@ -252,8 +252,7 @@ bool lfrfid_load_raw_key_from_file_select(LfRfid* app) { furi_assert(app); DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options( - &browser_options, LFRFID_APP_RAW_ASK_EXTENSION, &I_125_10px); + dialog_file_browser_set_basic_options(&browser_options, ".raw", &I_125_10px); browser_options.base_path = LFRFID_APP_FOLDER; // Input events and views are managed by file_browser @@ -261,9 +260,9 @@ bool lfrfid_load_raw_key_from_file_select(LfRfid* app) { dialog_file_browser_show(app->dialogs, app->file_path, app->file_path, &browser_options); if(result) { - // Extract .raw and then .ask + // Extract .raw path_extract_filename(app->file_path, app->file_name, true); - path_extract_filename(app->file_name, app->file_name, true); + //path_extract_filename(app->file_name, app->file_name, true); } return result; diff --git a/applications/main/lfrfid/scenes/lfrfid_scene_raw_emulate.c b/applications/main/lfrfid/scenes/lfrfid_scene_raw_emulate.c index c06a5eebf..11fa25744 100644 --- a/applications/main/lfrfid/scenes/lfrfid_scene_raw_emulate.c +++ b/applications/main/lfrfid/scenes/lfrfid_scene_raw_emulate.c @@ -3,7 +3,6 @@ #define TAG "ADC" typedef struct { - FuriString* string_file_name; bool error; } LfRfidEmulateRawState; @@ -23,26 +22,15 @@ void lfrfid_scene_raw_emulate_on_enter(void* context) { LfRfidEmulateRawState* state = malloc(sizeof(LfRfidEmulateRawState)); scene_manager_set_scene_state(app->scene_manager, LfRfidSceneRawEmulate, (uint32_t)state); - state->string_file_name = furi_string_alloc(); popup_set_icon(popup, 0, 3, &I_RFIDDolphinReceive_97x61); view_dispatcher_switch_to_view(app->view_dispatcher, LfRfidViewPopup); lfrfid_worker_start_thread(app->lfworker); lfrfid_make_app_folder(app); - furi_string_printf( - state->string_file_name, - "%s/%s%s", - LFRFID_SD_FOLDER, - furi_string_get_cstr(app->file_name), - LFRFID_APP_RAW_ASK_EXTENSION); - FURI_LOG_D(TAG, "raw_emulate->file_name=%s", furi_string_get_cstr(state->string_file_name)); - popup_set_header(popup, "Emulating\nRAW RFID\nASK", 89, 30, AlignCenter, AlignTop); + popup_set_header(popup, "Emulating\nRAW RFID", 89, 30, AlignCenter, AlignTop); lfrfid_worker_emulate_raw_start( - app->lfworker, - furi_string_get_cstr(state->string_file_name), - lfrfid_raw_emulate_callback, - app); + app->lfworker, furi_string_get_cstr(app->file_path), lfrfid_raw_emulate_callback, app); notification_message(app->notifications, &sequence_blink_start_cyan); @@ -63,7 +51,7 @@ bool lfrfid_scene_raw_emulate_on_event(void* context, SceneManagerEvent event) { consumed = true; state->error = true; popup_set_header( - popup, "Reading\nRAW RFID\nFile error", 89, 30, AlignCenter, AlignTop); + popup, "Emulating\nRAW RFID\nFile error", 89, 30, AlignCenter, AlignTop); notification_message(app->notifications, &sequence_blink_start_red); } } @@ -81,6 +69,5 @@ void lfrfid_scene_raw_emulate_on_exit(void* context) { lfrfid_worker_stop(app->lfworker); lfrfid_worker_stop_thread(app->lfworker); - furi_string_free(state->string_file_name); free(state); } diff --git a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_menu.c b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_menu.c index c511e9dcb..e7a494d27 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_ultralight_menu.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_ultralight_menu.c @@ -19,7 +19,7 @@ void nfc_scene_mf_ultralight_menu_on_enter(void* context) { Submenu* submenu = nfc->submenu; MfUltralightData* data = &nfc->dev->dev_data.mf_ul_data; - if(!mf_ul_is_full_capture(data)) { + if(!mf_ul_is_full_capture(data) && data->type != MfUltralightTypeULC) { submenu_add_item( submenu, "Unlock", @@ -29,12 +29,14 @@ void nfc_scene_mf_ultralight_menu_on_enter(void* context) { } submenu_add_item( submenu, "Save", SubmenuIndexSave, nfc_scene_mf_ultralight_menu_submenu_callback, nfc); - submenu_add_item( - submenu, - "Emulate", - SubmenuIndexEmulate, - nfc_scene_mf_ultralight_menu_submenu_callback, - nfc); + if(mf_ul_emulation_supported(data)) { + submenu_add_item( + submenu, + "Emulate", + SubmenuIndexEmulate, + nfc_scene_mf_ultralight_menu_submenu_callback, + nfc); + } submenu_add_item( submenu, "Info", SubmenuIndexInfo, nfc_scene_mf_ultralight_menu_submenu_callback, nfc); diff --git a/applications/main/nfc/scenes/nfc_scene_saved_menu.c b/applications/main/nfc/scenes/nfc_scene_saved_menu.c index 15771bcc3..ae2f5ef6b 100644 --- a/applications/main/nfc/scenes/nfc_scene_saved_menu.c +++ b/applications/main/nfc/scenes/nfc_scene_saved_menu.c @@ -43,7 +43,8 @@ void nfc_scene_saved_menu_on_enter(void* context) { nfc); } } else if( - nfc->dev->format == NfcDeviceSaveFormatMifareUl || + (nfc->dev->format == NfcDeviceSaveFormatMifareUl && + mf_ul_emulation_supported(&nfc->dev->dev_data.mf_ul_data)) || nfc->dev->format == NfcDeviceSaveFormatNfcV || nfc->dev->format == NfcDeviceSaveFormatMifareClassic) { submenu_add_item( @@ -74,6 +75,7 @@ void nfc_scene_saved_menu_on_enter(void* context) { submenu_add_item( submenu, "Info", SubmenuIndexInfo, nfc_scene_saved_menu_submenu_callback, nfc); if(nfc->dev->format == NfcDeviceSaveFormatMifareUl && + nfc->dev->dev_data.mf_ul_data.type != MfUltralightTypeULC && !mf_ul_is_full_capture(&nfc->dev->dev_data.mf_ul_data)) { submenu_add_item( submenu, diff --git a/applications/main/subghz/application.fam b/applications/main/subghz/application.fam index f0dc66e89..0b403feda 100644 --- a/applications/main/subghz/application.fam +++ b/applications/main/subghz/application.fam @@ -10,7 +10,10 @@ App( "cli", "dialogs", ], - provides=["subghz_start"], + provides=[ + "subghz_start", + "subghz_load_dangerous_settings", + ], icon="A_Sub1ghz_14", stack_size=3 * 1024, order=10, @@ -23,3 +26,11 @@ App( requires=["subghz"], order=40, ) + +App( + appid="subghz_load_dangerous_settings", + apptype=FlipperAppType.STARTUP, + entry_point="subghz_dangerous_freq", + requires=["storage", "subghz"], + order=650, +) diff --git a/applications/main/subghz/scenes/subghz_scene_decode_raw.c b/applications/main/subghz/scenes/subghz_scene_decode_raw.c index e88da3749..102965df5 100644 --- a/applications/main/subghz/scenes/subghz_scene_decode_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_decode_raw.c @@ -179,11 +179,12 @@ void subghz_scene_decode_raw_on_enter(void* context) { furi_string_get_cstr(item_time), subghz_history_get_type_protocol(subghz->history, i)); } - furi_string_free(item_name); - furi_string_free(item_time); subghz_view_receiver_set_idx_menu(subghz->subghz_receiver, subghz->idx_menu_chosen); } + furi_string_free(item_name); + furi_string_free(item_time); + subghz_scene_receiver_update_statusbar(subghz); view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdReceiver); diff --git a/applications/main/subghz/scenes/subghz_scene_radio_settings.c b/applications/main/subghz/scenes/subghz_scene_radio_settings.c index 8e8d05019..b60ea0b2d 100644 --- a/applications/main/subghz/scenes/subghz_scene_radio_settings.c +++ b/applications/main/subghz/scenes/subghz_scene_radio_settings.c @@ -25,11 +25,14 @@ const char* const debug_pin_text[DEBUG_P_COUNT] = { "17(1W)", }; -#define DEBUG_COUNTER_COUNT 3 +#define DEBUG_COUNTER_COUNT 6 const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = { "+1", "+2", "+3", + "+4", + "+5", + "+10", }; static void subghz_scene_ext_module_changed(VariableItem* item) { @@ -71,6 +74,15 @@ static void subghz_scene_receiver_config_set_debug_counter(VariableItem* item) { case 2: furi_hal_subghz_set_rolling_counter_mult(3); break; + case 3: + furi_hal_subghz_set_rolling_counter_mult(4); + break; + case 4: + furi_hal_subghz_set_rolling_counter_mult(5); + break; + case 5: + furi_hal_subghz_set_rolling_counter_mult(10); + break; default: break; } @@ -140,24 +152,58 @@ void subghz_scene_radio_settings_on_enter(void* context) { variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, timestamp_names_text[value_index]); - item = variable_item_list_add( - subghz->variable_item_list, - "Counter incr.", - DEBUG_COUNTER_COUNT, - subghz_scene_receiver_config_set_debug_counter, - subghz); - switch(furi_hal_subghz_get_rolling_counter_mult()) { - case 1: - value_index = 0; - break; - case 2: - value_index = 1; - break; - case 3: - value_index = 2; - break; - default: - break; + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { + item = variable_item_list_add( + subghz->variable_item_list, + "Counter incr.", + DEBUG_COUNTER_COUNT, + subghz_scene_receiver_config_set_debug_counter, + subghz); + switch(furi_hal_subghz_get_rolling_counter_mult()) { + case 1: + value_index = 0; + break; + case 2: + value_index = 1; + break; + case 3: + value_index = 2; + break; + case 4: + value_index = 3; + break; + case 5: + value_index = 4; + break; + case 10: + value_index = 5; + break; + default: + break; + } + } else { + item = variable_item_list_add( + subghz->variable_item_list, + "Counter incr.", + 3, + subghz_scene_receiver_config_set_debug_counter, + subghz); + switch(furi_hal_subghz_get_rolling_counter_mult()) { + case 1: + value_index = 0; + break; + case 2: + value_index = 1; + break; + case 3: + value_index = 2; + break; + default: + // Reset to default value + value_index = 0; + furi_hal_subghz_set_rolling_counter_mult(1); + break; + } } variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, debug_counter_text[value_index]); diff --git a/applications/main/subghz/subghz_dangerous_freq.c b/applications/main/subghz/subghz_dangerous_freq.c new file mode 100644 index 000000000..69a54f04b --- /dev/null +++ b/applications/main/subghz/subghz_dangerous_freq.c @@ -0,0 +1,23 @@ +#include +#include + +#include + +#include + +void subghz_dangerous_freq() { + bool is_extended_i = false; + + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); + + if(flipper_format_file_open_existing(fff_data_file, "/ext/subghz/assets/dangerous_settings")) { + flipper_format_read_bool( + fff_data_file, "yes_i_want_to_destroy_my_flipper", &is_extended_i, 1); + } + + furi_hal_subghz_set_dangerous_frequency(is_extended_i); + + flipper_format_free(fff_data_file); + furi_record_close(RECORD_STORAGE); +} diff --git a/applications/main/subghz_remote/application.fam b/applications/main/subghz_remote/application.fam index e09f8500f..e785043e6 100644 --- a/applications/main/subghz_remote/application.fam +++ b/applications/main/subghz_remote/application.fam @@ -3,7 +3,10 @@ App( name="Sub-GHz Remote", apptype=FlipperAppType.APP, entry_point="subghz_remote_app", - cdefines=["APP_SUBGHZREMOTE"], + cdefines=[ + "APP_SUBGHZREMOTE", + "SUBREM_LIGHT", + ], requires=[ "gui", "dialogs", @@ -11,4 +14,4 @@ App( icon="A_SubGHzRemote_14", stack_size=4 * 1024, order=11, -) +) \ No newline at end of file diff --git a/applications/main/subghz_remote/helpers/subrem_custom_event.h b/applications/main/subghz_remote/helpers/subrem_custom_event.h new file mode 100644 index 000000000..46ab8ad54 --- /dev/null +++ b/applications/main/subghz_remote/helpers/subrem_custom_event.h @@ -0,0 +1,18 @@ +#pragma once + +typedef enum { + //SubmenuIndex + SubmenuIndexSubRemOpenMapFile, + SubmenuIndexSubRemRemoteView, + SubmenuIndexSubRemAbout, + + //SubRemCustomEvent + SubRemCustomEventViewRemoteStartUP = 100, + SubRemCustomEventViewRemoteStartDOWN, + SubRemCustomEventViewRemoteStartLEFT, + SubRemCustomEventViewRemoteStartRIGHT, + SubRemCustomEventViewRemoteStartOK, + SubRemCustomEventViewRemoteBack, + SubRemCustomEventViewRemoteStop, + SubRemCustomEventViewRemoteForcedStop, +} SubRemCustomEvent; \ No newline at end of file diff --git a/applications/main/subghz_remote/helpers/subrem_presets.c b/applications/main/subghz_remote/helpers/subrem_presets.c new file mode 100644 index 000000000..9601aae6c --- /dev/null +++ b/applications/main/subghz_remote/helpers/subrem_presets.c @@ -0,0 +1,179 @@ +#include "subrem_presets.h" + +#define TAG "SubRemPresets" + +SubRemSubFilePreset* subrem_sub_file_preset_alloc() { + SubRemSubFilePreset* sub_preset = malloc(sizeof(SubRemSubFilePreset)); + + sub_preset->fff_data = flipper_format_string_alloc(); + sub_preset->file_path = furi_string_alloc(); + sub_preset->protocaol_name = furi_string_alloc(); + sub_preset->label = furi_string_alloc_set_str("N/A"); + + sub_preset->freq_preset.name = furi_string_alloc(); + + sub_preset->type = SubGhzProtocolTypeUnknown; + sub_preset->load_state = SubRemLoadSubStateNotSet; + + return sub_preset; +} + +void subrem_sub_file_preset_free(SubRemSubFilePreset* sub_preset) { + furi_assert(sub_preset); + + furi_string_free(sub_preset->label); + furi_string_free(sub_preset->protocaol_name); + furi_string_free(sub_preset->file_path); + flipper_format_free(sub_preset->fff_data); + + furi_string_free(sub_preset->freq_preset.name); + + free(sub_preset); +} + +void subrem_sub_file_preset_reset(SubRemSubFilePreset* sub_preset) { + furi_assert(sub_preset); + + furi_string_set_str(sub_preset->label, "N/A"); + furi_string_reset(sub_preset->protocaol_name); + furi_string_reset(sub_preset->file_path); + + Stream* fff_data_stream = flipper_format_get_raw_stream(sub_preset->fff_data); + stream_clean(fff_data_stream); + + sub_preset->type = SubGhzProtocolTypeUnknown; + sub_preset->load_state = SubRemLoadSubStateNotSet; +} + +SubRemLoadSubState subrem_sub_preset_load( + SubRemSubFilePreset* sub_preset, + SubGhzTxRx* txrx, + FlipperFormat* fff_data_file) { + furi_assert(sub_preset); + furi_assert(txrx); + furi_assert(fff_data_file); + + Stream* fff_data_stream = flipper_format_get_raw_stream(sub_preset->fff_data); + + SubRemLoadSubState ret; + FuriString* temp_str = furi_string_alloc(); + uint32_t temp_data32; + uint32_t repeat = 200; + + ret = SubRemLoadSubStateError; + + do { + stream_clean(fff_data_stream); + if(!flipper_format_read_header(fff_data_file, temp_str, &temp_data32)) { + FURI_LOG_E(TAG, "Missing or incorrect header"); + break; + } + + if(((!strcmp(furi_string_get_cstr(temp_str), SUBGHZ_KEY_FILE_TYPE)) || + (!strcmp(furi_string_get_cstr(temp_str), SUBGHZ_RAW_FILE_TYPE))) && + temp_data32 == SUBGHZ_KEY_FILE_VERSION) { + } else { + FURI_LOG_E(TAG, "Type or version mismatch"); + break; + } + + SubGhzSetting* setting = subghz_txrx_get_setting(txrx); // txrx->setting; + + //Load frequency or using default from settings + ret = SubRemLoadSubStateErrorFreq; + if(!flipper_format_read_uint32(fff_data_file, "Frequency", &temp_data32, 1)) { + FURI_LOG_W(TAG, "Cannot read frequency. Set default frequency"); + sub_preset->freq_preset.frequency = subghz_setting_get_default_frequency(setting); + } else if(!furi_hal_subghz_is_tx_allowed(temp_data32)) { + FURI_LOG_E(TAG, "This frequency can only be used for RX"); + break; + } + sub_preset->freq_preset.frequency = temp_data32; + + //Load preset + ret = SubRemLoadSubStateErrorMod; + if(!flipper_format_read_string(fff_data_file, "Preset", temp_str)) { + FURI_LOG_E(TAG, "Missing Preset"); + break; + } + + furi_string_set_str( + temp_str, subghz_txrx_get_preset_name(txrx, furi_string_get_cstr(temp_str))); + if(!strcmp(furi_string_get_cstr(temp_str), "")) { + break; + } + + if(!strcmp(furi_string_get_cstr(temp_str), "CUSTOM")) { + FURI_LOG_E(TAG, "CUSTOM preset is not supported"); + break; + // TODO Custom preset loading logic if need + // sub_preset->freq_preset.preset_index = + // subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(temp_str)); + } + + furi_string_set(sub_preset->freq_preset.name, temp_str); + + // Load protocol + ret = SubRemLoadSubStateErrorProtocol; + if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) { + FURI_LOG_E(TAG, "Missing Protocol"); + break; + } + + FlipperFormat* fff_data = sub_preset->fff_data; + if(!strcmp(furi_string_get_cstr(temp_str), "RAW")) { + //if RAW + subghz_protocol_raw_gen_fff_data( + fff_data, furi_string_get_cstr(sub_preset->file_path)); + } else { + stream_copy_full( + flipper_format_get_raw_stream(fff_data_file), + flipper_format_get_raw_stream(fff_data)); + } + + if(subghz_txrx_load_decoder_by_name_protocol(txrx, furi_string_get_cstr(temp_str))) { + SubGhzProtocolStatus status = + subghz_protocol_decoder_base_deserialize(subghz_txrx_get_decoder(txrx), fff_data); + if(status != SubGhzProtocolStatusOk) { + break; + } + } else { + FURI_LOG_E(TAG, "Protocol not found"); + break; + } + + const SubGhzProtocol* protocol = subghz_txrx_get_decoder(txrx)->protocol; + + if(protocol->flag & SubGhzProtocolFlag_Send) { + if((protocol->type == SubGhzProtocolTypeStatic) || + (protocol->type == SubGhzProtocolTypeDynamic) || + // TODO: BINRAW It probably works, but checks are needed. + // (protocol->type == SubGhzProtocolTypeBinRAW) || + (protocol->type == SubGhzProtocolTypeRAW)) { + sub_preset->type = protocol->type; + } else { + FURI_LOG_E(TAG, "Unsuported Protocol"); + break; + } + + furi_string_set(sub_preset->protocaol_name, temp_str); + } else { + FURI_LOG_E(TAG, "Protocol does not support transmission"); + break; + } + + if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &repeat, 1)) { + FURI_LOG_E(TAG, "Unable Repeat"); + break; + } + + ret = SubRemLoadSubStateOK; + +#if FURI_DEBUG + FURI_LOG_I(TAG, "%-16s - protocol Loaded", furi_string_get_cstr(sub_preset->label)); +#endif + } while(false); + + furi_string_free(temp_str); + return ret; +} diff --git a/applications/main/subghz_remote/helpers/subrem_presets.h b/applications/main/subghz_remote/helpers/subrem_presets.h new file mode 100644 index 000000000..fd4a2d780 --- /dev/null +++ b/applications/main/subghz_remote/helpers/subrem_presets.h @@ -0,0 +1,38 @@ +#pragma once + +#include "subrem_types.h" +#include +#include +#include "../../subghz/helpers/subghz_txrx.h" + +typedef struct { + FuriString* name; + uint32_t frequency; + // size_t preset_index; // Need for custom preset +} FreqPreset; + +// Sub File preset +typedef struct { + FlipperFormat* fff_data; + FreqPreset freq_preset; + FuriString* file_path; + FuriString* protocaol_name; + FuriString* label; + SubGhzProtocolType type; + SubRemLoadSubState load_state; +} SubRemSubFilePreset; + +typedef struct { + SubRemSubFilePreset* subs_preset[SubRemSubKeyNameMaxCount]; +} SubRemMapPreset; + +SubRemSubFilePreset* subrem_sub_file_preset_alloc(); + +void subrem_sub_file_preset_free(SubRemSubFilePreset* sub_preset); + +void subrem_sub_file_preset_reset(SubRemSubFilePreset* sub_preset); + +SubRemLoadSubState subrem_sub_preset_load( + SubRemSubFilePreset* sub_preset, + SubGhzTxRx* txrx, + FlipperFormat* fff_data_file); diff --git a/applications/main/subghz_remote/helpers/subrem_types.h b/applications/main/subghz_remote/helpers/subrem_types.h new file mode 100644 index 000000000..def807898 --- /dev/null +++ b/applications/main/subghz_remote/helpers/subrem_types.h @@ -0,0 +1,47 @@ +#pragma once + +#include +#include + +// TODO: File version/type logic +// #define SUBREM_APP_APP_FILE_VERSION 1 +// #define SUBREM_APP_APP_FILE_TYPE "Flipper SubRem Map file" +#define SUBREM_APP_EXTENSION ".txt" + +typedef enum { + SubRemSubKeyNameUp = (0U), + SubRemSubKeyNameDown, + SubRemSubKeyNameLeft, + SubRemSubKeyNameRight, + SubRemSubKeyNameOk, + SubRemSubKeyNameMaxCount, +} SubRemSubKeyName; + +typedef enum { + SubRemViewSubmenu, + SubRemViewWidget, + SubRemViewPopup, + SubRemViewTextInput, + SubRemViewIDRemote, +} SubRemViewID; + +typedef enum { + SubRemLoadSubStateNotSet = 0, + SubRemLoadSubStatePreloaded, + SubRemLoadSubStateError, + SubRemLoadSubStateErrorNoFile, + SubRemLoadSubStateErrorFreq, + SubRemLoadSubStateErrorMod, + SubRemLoadSubStateErrorProtocol, + SubRemLoadSubStateOK, +} SubRemLoadSubState; + +typedef enum { + SubRemLoadMapStateBack = 0, + SubRemLoadMapStateError, + SubRemLoadMapStateErrorOpenError, + SubRemLoadMapStateErrorStorage, + SubRemLoadMapStateErrorBrokenFile, + SubRemLoadMapStateNotAllOK, + SubRemLoadMapStateOK, +} SubRemLoadMapState; \ No newline at end of file diff --git a/applications/main/subghz_remote/scenes/subrem_scene.c b/applications/main/subghz_remote/scenes/subrem_scene.c new file mode 100644 index 000000000..c45285b96 --- /dev/null +++ b/applications/main/subghz_remote/scenes/subrem_scene.c @@ -0,0 +1,30 @@ +#include "../subghz_remote_app_i.h" + +// Generate scene on_enter handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, +void (*const subrem_scene_on_enter_handlers[])(void*) = { +#include "subrem_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_event handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, +bool (*const subrem_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { +#include "subrem_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_exit handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, +void (*const subrem_scene_on_exit_handlers[])(void* context) = { +#include "subrem_scene_config.h" +}; +#undef ADD_SCENE + +// Initialize scene handlers configuration structure +const SceneManagerHandlers subrem_scene_handlers = { + .on_enter_handlers = subrem_scene_on_enter_handlers, + .on_event_handlers = subrem_scene_on_event_handlers, + .on_exit_handlers = subrem_scene_on_exit_handlers, + .scene_num = SubRemSceneNum, +}; diff --git a/applications/main/subghz_remote/scenes/subrem_scene.h b/applications/main/subghz_remote/scenes/subrem_scene.h new file mode 100644 index 000000000..5c01f8ca5 --- /dev/null +++ b/applications/main/subghz_remote/scenes/subrem_scene.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +// Generate scene id and total number +#define ADD_SCENE(prefix, name, id) SubRemScene##id, +typedef enum { +#include "subrem_scene_config.h" + SubRemSceneNum, +} SubRemScene; +#undef ADD_SCENE + +extern const SceneManagerHandlers subrem_scene_handlers; + +// Generate scene on_enter handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); +#include "subrem_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_event handlers declaration +#define ADD_SCENE(prefix, name, id) \ + bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); +#include "subrem_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_exit handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); +#include "subrem_scene_config.h" +#undef ADD_SCENE diff --git a/applications/main/subghz_remote/scenes/subrem_scene_config.h b/applications/main/subghz_remote/scenes/subrem_scene_config.h new file mode 100644 index 000000000..93d4de642 --- /dev/null +++ b/applications/main/subghz_remote/scenes/subrem_scene_config.h @@ -0,0 +1,3 @@ +ADD_SCENE(subrem, start, Start) +ADD_SCENE(subrem, openmapfile, OpenMapFile) +ADD_SCENE(subrem, remote, Remote) \ No newline at end of file diff --git a/applications/main/subghz_remote/scenes/subrem_scene_openmapfile.c b/applications/main/subghz_remote/scenes/subrem_scene_openmapfile.c new file mode 100644 index 000000000..796699c83 --- /dev/null +++ b/applications/main/subghz_remote/scenes/subrem_scene_openmapfile.c @@ -0,0 +1,42 @@ +#include "../subghz_remote_app_i.h" + +void subrem_scene_openmapfile_on_enter(void* context) { + SubGhzRemoteApp* app = context; + SubRemLoadMapState load_state = subrem_load_from_file(app); + + if(load_state != SubRemLoadMapStateOK && load_state != SubRemLoadMapStateNotAllOK && + load_state != SubRemLoadMapStateBack) { +#ifdef SUBREM_LIGHT + dialog_message_show_storage_error(app->dialogs, "Can't load\nMap file"); +#else + DialogMessage* message = dialog_message_alloc(); + + dialog_message_set_header(message, "Map File Error", 64, 8, AlignCenter, AlignCenter); + dialog_message_set_text(message, "Can't load\nMap file", 64, 32, AlignCenter, AlignCenter); + dialog_message_set_buttons(message, "Back", NULL, NULL); + dialog_message_show(app->dialogs, message); + + dialog_message_free(message); +#endif + } + if(load_state == SubRemLoadMapStateOK || load_state == SubRemLoadMapStateNotAllOK) { + scene_manager_next_scene(app->scene_manager, SubRemSceneRemote); + } else { + // TODO: Map Preset Reset + if(!scene_manager_search_and_switch_to_previous_scene( + app->scene_manager, SubRemSceneStart)) { + scene_manager_stop(app->scene_manager); + view_dispatcher_stop(app->view_dispatcher); + } + } +} + +bool subrem_scene_openmapfile_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + return false; +} + +void subrem_scene_openmapfile_on_exit(void* context) { + UNUSED(context); +} diff --git a/applications/main/subghz_remote/scenes/subrem_scene_remote.c b/applications/main/subghz_remote/scenes/subrem_scene_remote.c new file mode 100644 index 000000000..eaa1c41d9 --- /dev/null +++ b/applications/main/subghz_remote/scenes/subrem_scene_remote.c @@ -0,0 +1,133 @@ +#include "../subghz_remote_app_i.h" +#include "../views/remote.h" + +#include + +#define TAG "SubRemScenRemote" + +void subrem_scene_remote_callback(SubRemCustomEvent event, void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, event); +} + +void subrem_scene_remote_raw_callback_end_tx(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, SubRemCustomEventViewRemoteForcedStop); +} + +static uint8_t subrem_scene_remote_event_to_index(SubRemCustomEvent event_id) { + uint8_t ret = 0; + + if(event_id == SubRemCustomEventViewRemoteStartUP) { + ret = SubRemSubKeyNameUp; + } else if(event_id == SubRemCustomEventViewRemoteStartDOWN) { + ret = SubRemSubKeyNameDown; + } else if(event_id == SubRemCustomEventViewRemoteStartLEFT) { + ret = SubRemSubKeyNameLeft; + } else if(event_id == SubRemCustomEventViewRemoteStartRIGHT) { + ret = SubRemSubKeyNameRight; + } else if(event_id == SubRemCustomEventViewRemoteStartOK) { + ret = SubRemSubKeyNameOk; + } + + return ret; +} + +static bool subrem_scene_remote_update_data_show(void* context) { + SubGhzRemoteApp* app = context; + + const char* labels[SubRemSubKeyNameMaxCount]; + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + labels[i] = furi_string_get_cstr(app->map_preset->subs_preset[i]->label); + } + + subrem_view_remote_add_data_to_show(app->subrem_remote_view, labels); + + return true; +} + +void subrem_scene_remote_on_enter(void* context) { + SubGhzRemoteApp* app = context; + + subrem_scene_remote_update_data_show(app); + + subrem_view_remote_set_callback(app->subrem_remote_view, subrem_scene_remote_callback, app); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDRemote); +} + +bool subrem_scene_remote_on_event(void* context, SceneManagerEvent event) { + SubGhzRemoteApp* app = context; + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubRemCustomEventViewRemoteBack) { + if(!scene_manager_search_and_switch_to_previous_scene( + app->scene_manager, SubRemSceneOpenMapFile)) { + if(!scene_manager_search_and_switch_to_previous_scene( + app->scene_manager, SubRemSceneStart)) { + scene_manager_stop(app->scene_manager); + view_dispatcher_stop(app->view_dispatcher); + } + } + return true; + } else if( + event.event == SubRemCustomEventViewRemoteStartUP || + event.event == SubRemCustomEventViewRemoteStartDOWN || + event.event == SubRemCustomEventViewRemoteStartLEFT || + event.event == SubRemCustomEventViewRemoteStartRIGHT || + event.event == SubRemCustomEventViewRemoteStartOK) { + // Start sending sub + subrem_tx_stop_sub(app, true); + + uint8_t chusen_sub = subrem_scene_remote_event_to_index(event.event); + app->chusen_sub = chusen_sub; + + subrem_view_remote_set_state( + app->subrem_remote_view, SubRemViewRemoteStateLoading, chusen_sub); + + if(subrem_tx_start_sub(app, app->map_preset->subs_preset[chusen_sub])) { + if(app->map_preset->subs_preset[chusen_sub]->type == SubGhzProtocolTypeRAW) { + subghz_txrx_set_raw_file_encoder_worker_callback_end( + app->txrx, subrem_scene_remote_raw_callback_end_tx, app); + } + subrem_view_remote_set_state( + app->subrem_remote_view, SubRemViewRemoteStateSending, chusen_sub); + notification_message(app->notifications, &sequence_blink_start_magenta); + } else { + subrem_view_remote_set_state( + app->subrem_remote_view, SubRemViewRemoteStateIdle, 0); + notification_message(app->notifications, &sequence_blink_stop); + } + return true; + } else if(event.event == SubRemCustomEventViewRemoteForcedStop) { + subrem_tx_stop_sub(app, true); + subrem_view_remote_set_state(app->subrem_remote_view, SubRemViewRemoteStateIdle, 0); + + notification_message(app->notifications, &sequence_blink_stop); + return true; + } else if(event.event == SubRemCustomEventViewRemoteStop) { + if(subrem_tx_stop_sub(app, false)) { + subrem_view_remote_set_state( + app->subrem_remote_view, SubRemViewRemoteStateIdle, 0); + + notification_message(app->notifications, &sequence_blink_stop); + } + return true; + } + } + // } else if(event.type == SceneManagerEventTypeTick) { + // } + return false; +} + +void subrem_scene_remote_on_exit(void* context) { + SubGhzRemoteApp* app = context; + + subrem_tx_stop_sub(app, true); + + subrem_view_remote_set_state(app->subrem_remote_view, SubRemViewRemoteStateIdle, 0); + + notification_message(app->notifications, &sequence_blink_stop); +} diff --git a/applications/main/subghz_remote/scenes/subrem_scene_start.c b/applications/main/subghz_remote/scenes/subrem_scene_start.c new file mode 100644 index 000000000..a4bfa5047 --- /dev/null +++ b/applications/main/subghz_remote/scenes/subrem_scene_start.c @@ -0,0 +1,76 @@ +#include "../subghz_remote_app_i.h" +#include "../helpers/subrem_custom_event.h" + +void subrem_scene_start_submenu_callback(void* context, uint32_t index) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + view_dispatcher_send_custom_event(app->view_dispatcher, index); +} + +void subrem_scene_start_on_enter(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + Submenu* submenu = app->submenu; + submenu_add_item( + submenu, + "Open Map File", + SubmenuIndexSubRemOpenMapFile, + subrem_scene_start_submenu_callback, + app); +#if FURI_DEBUG + submenu_add_item( + submenu, + "Remote_Debug", + SubmenuIndexSubRemRemoteView, + subrem_scene_start_submenu_callback, + app); +#endif + // submenu_add_item( + // submenu, + // "About", + // SubmenuIndexSubGhzRemoteAbout, + // subrem_scene_start_submenu_callback, + // app); + + // TODO: set scene state in subrem alloc + // submenu_set_selected_item( + // submenu, scene_manager_get_scene_state(app->scene_manager, SubRemSceneStart)); + submenu_set_selected_item(submenu, SubmenuIndexSubRemOpenMapFile); + + view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewSubmenu); +} + +bool subrem_scene_start_on_event(void* context, SceneManagerEvent event) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == SubmenuIndexSubRemOpenMapFile) { + scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); + consumed = true; + } + // } else if(event.event == SubmenuIndexSubRemAbout) { + // scene_manager_next_scene(app->scene_manager, SubRemSceneAbout); + // consumed = true; + // } +#if FURI_DEBUG + else if(event.event == SubmenuIndexSubRemRemoteView) { + scene_manager_next_scene(app->scene_manager, SubRemSceneRemote); + consumed = true; + } +#endif + } + + return consumed; +} + +void subrem_scene_start_on_exit(void* context) { + furi_assert(context); + + SubGhzRemoteApp* app = context; + submenu_reset(app->submenu); +} diff --git a/applications/main/subghz_remote/subghz_remote_app.c b/applications/main/subghz_remote/subghz_remote_app.c index 8cef4da3a..e57b1ac2d 100644 --- a/applications/main/subghz_remote/subghz_remote_app.c +++ b/applications/main/subghz_remote/subghz_remote_app.c @@ -1,766 +1,35 @@ -#include +#include "subghz_remote_app_i.h" -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include #include -#include -#include -#include -#include - -#define SUBREMOTEMAP_FOLDER "/ext/subghz_remote" -#define SUBREMOTEMAP_EXTENSION ".txt" - -#define TAG "SubGHzRemote" - -typedef struct { - uint32_t frequency; - FuriString* name; - - FuriString* protocol; - uint32_t repeat; - - uint8_t* data; - size_t data_size; - - SubGhzProtocolDecoderBase* decoder; -} SubRemotePreset; - -typedef struct { - FuriMutex* model_mutex; - - FuriMessageQueue* input_queue; - - ViewPort* view_port; - Gui* gui; - - SubGhzSetting* setting; - SubGhzEnvironment* environment; - SubGhzReceiver* subghz_receiver; - NotificationApp* notification; - SubRemotePreset* txpreset; - - FuriString* up_file; - FuriString* down_file; - FuriString* left_file; - FuriString* right_file; - FuriString* ok_file; - - FuriString* file_path; - - char* up_label; - char* down_label; - char* left_label; - char* right_label; - char* ok_label; - - int up_enabled; - int down_enabled; - int left_enabled; - int right_enabled; - int ok_enabled; - - char* send_status; - int send_status_c; - int processing; - - SubGhzTransmitter* tx_transmitter; - FlipperFormat* tx_fff_data; - const char* tx_file_path; - int button; - - int file_result; - bool tx_not_allowed; - - FuriString* signal; -} SubGHzRemote; - -SubRemotePreset* subghz_remote_preset_alloc(void) { - SubRemotePreset* preset = malloc(sizeof(SubRemotePreset)); - preset->name = furi_string_alloc(); - preset->protocol = furi_string_alloc(); - preset->repeat = 200; - return preset; +static bool subghz_remote_app_custom_event_callback(void* context, uint32_t event) { + furi_assert(context); + SubGhzRemoteApp* app = context; + return scene_manager_handle_custom_event(app->scene_manager, event); } -void subghz_remote_preset_free(SubRemotePreset* preset) { - furi_string_free(preset->name); - furi_string_free(preset->protocol); - free(preset); +static bool subghz_remote_app_back_event_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + return scene_manager_handle_back_event(app->scene_manager); } -static char* char_to_str(char* str, int i) { - char* converted = malloc(sizeof(char) * i + 1); - memcpy(converted, str, i); - - converted[i] = '\0'; - - return converted; +static void subghz_remote_app_tick_event_callback(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + scene_manager_handle_tick_event(app->scene_manager); } -//get filename without path -static char* extract_filename(const char* name, int len) { - FuriString* tmp; - tmp = furi_string_alloc(); - - //remove path - path_extract_filename_no_ext(name, tmp); - - return char_to_str((char*)furi_string_get_cstr(tmp), len); -} - -static void cfg_read_file_path( - FlipperFormat* fff_file, - FuriString* text_file_path, - char** text_file_label, - const char* read_key, - int* is_enabled) { - if(!flipper_format_read_string(fff_file, read_key, text_file_path)) { - FURI_LOG_W(TAG, "Could not read %s string", read_key); - *text_file_label = "N/A"; - *is_enabled = 0; - } else { - *text_file_label = extract_filename(furi_string_get_cstr(text_file_path), 16); - //FURI_LOG_D(TAG, "%s file: %s", read_key, furi_string_get_cstr(text_file_path)); - *is_enabled = 1; - } - flipper_format_rewind(fff_file); -} - -static void cfg_read_file_label( - FlipperFormat* fff_file, - char** text_file_label, - const char* read_key, - bool is_enabled) { - FuriString* temp_label = furi_string_alloc(); - - if(!flipper_format_read_string(fff_file, read_key, temp_label)) { - FURI_LOG_W(TAG, "Could not read %s string", read_key); - } else { - if(is_enabled == 1) { - *text_file_label = char_to_str((char*)furi_string_get_cstr(temp_label), 16); - } - //FURI_LOG_D(TAG, "%s label: %s", read_key, *text_file_label); - } - flipper_format_rewind(fff_file); - furi_string_free(temp_label); -} - -/* - * check that map file exists - * assign variables to values within map file - * set missing filenames to N/A - * set filename as label if label definitions are missing - * set error flag if all buttons are N/A - * set error flag if missing map file - */ - -void subghz_remote_cfg_set_check(SubGHzRemote* app, FuriString* file_name) { - Storage* storage = furi_record_open(RECORD_STORAGE); - FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); - - app->file_result = 1; - - app->up_enabled = 0; - app->down_enabled = 0; - app->left_enabled = 0; - app->right_enabled = 0; - app->ok_enabled = 0; - - //check that map file exists - if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) { - FURI_LOG_E(TAG, "Could not open MAP file %s", furi_string_get_cstr(file_name)); - } else { - //Filename Assignment/Check Start - - //assign variables to values within map file - //set missing filenames to N/A - cfg_read_file_path(fff_data_file, app->up_file, &app->up_label, "UP", &app->up_enabled); - - cfg_read_file_path( - fff_data_file, app->down_file, &app->down_label, "DOWN", &app->down_enabled); - - cfg_read_file_path( - fff_data_file, app->left_file, &app->left_label, "LEFT", &app->left_enabled); - - cfg_read_file_path( - fff_data_file, app->right_file, &app->right_label, "RIGHT", &app->right_enabled); - - cfg_read_file_path(fff_data_file, app->ok_file, &app->ok_label, "OK", &app->ok_enabled); - - //File definitions are done. - //File checks will follow after label assignment in order to close the universal_rf_map file without the need to reopen it again. - - //Label Assignment/Check Start - - cfg_read_file_label(fff_data_file, &app->up_label, "ULABEL", app->up_enabled); - cfg_read_file_label(fff_data_file, &app->down_label, "DLABEL", app->down_enabled); - cfg_read_file_label(fff_data_file, &app->left_label, "LLABEL", app->left_enabled); - cfg_read_file_label(fff_data_file, &app->right_label, "RLABEL", app->right_enabled); - cfg_read_file_label(fff_data_file, &app->ok_label, "OKLABEL", app->ok_enabled); - } - - flipper_format_file_close(fff_data_file); - flipper_format_free(fff_data_file); - - //File Existence Check - //Check each file definition if not already set to "N/A" - - //determine if files exist. - //determine whether or not to continue to launch app with missing variables - //if 5 files are missing, throw error - - //if button is still enabled, check that file exists - if(app->up_enabled == 1) { - furi_string_set(file_name, app->up_file); - fff_data_file = flipper_format_file_alloc(storage); - - if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) { - FURI_LOG_W(TAG, "Could not open UP file %s", furi_string_get_cstr(file_name)); - - //disable button, and set label to "N/A" - app->up_enabled = 0; - app->up_label = "N/A"; - } - - //close the file - flipper_format_file_close(fff_data_file); - flipper_format_free(fff_data_file); - } - - if(app->down_enabled == 1) { - furi_string_set(file_name, app->down_file); - fff_data_file = flipper_format_file_alloc(storage); - - if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) { - FURI_LOG_W(TAG, "Could not open DOWN file %s", furi_string_get_cstr(file_name)); - - app->down_enabled = 0; - app->down_label = "N/A"; - } - - flipper_format_file_close(fff_data_file); - flipper_format_free(fff_data_file); - } - - if(app->left_enabled == 1) { - furi_string_set(file_name, app->left_file); - fff_data_file = flipper_format_file_alloc(storage); - - if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) { - FURI_LOG_W(TAG, "Could not open LEFT file %s", furi_string_get_cstr(file_name)); - - app->left_enabled = 0; - app->left_label = "N/A"; - } - - flipper_format_file_close(fff_data_file); - flipper_format_free(fff_data_file); - } - - if(app->right_enabled == 1) { - furi_string_set(file_name, app->right_file); - fff_data_file = flipper_format_file_alloc(storage); - - if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) { - FURI_LOG_W(TAG, "Could not open RIGHT file %s", furi_string_get_cstr(file_name)); - - app->right_enabled = 0; - app->right_label = "N/A"; - } - - flipper_format_file_close(fff_data_file); - flipper_format_free(fff_data_file); - } - - if(app->ok_enabled == 1) { - furi_string_set(file_name, app->ok_file); - fff_data_file = flipper_format_file_alloc(storage); - - if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) { - FURI_LOG_W(TAG, "Could not open OK file %s", furi_string_get_cstr(file_name)); - - app->ok_enabled = 0; - app->ok_label = "N/A"; - } - - flipper_format_file_close(fff_data_file); - flipper_format_free(fff_data_file); - } - - furi_record_close(RECORD_STORAGE); - - if(app->up_enabled == 0 && app->down_enabled == 0 && app->left_enabled == 0 && - app->right_enabled == 0 && app->ok_enabled == 0) { - app->file_result = 1; - } else { - app->file_result = 2; - } -} - -static void subghz_remote_end_send(SubGHzRemote* app) { - app->processing = 0; -} - -bool subghz_remote_set_preset(SubRemotePreset* p, const char* preset) { - if(!strcmp(preset, "FuriHalSubGhzPresetOok270Async")) { - furi_string_set(p->name, "AM270"); - } else if(!strcmp(preset, "FuriHalSubGhzPresetOok650Async")) { - furi_string_set(p->name, "AM650"); - } else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev238Async")) { - furi_string_set(p->name, "FM238"); - } else if(!strcmp(preset, "FuriHalSubGhzPreset2FSKDev476Async")) { - furi_string_set(p->name, "FM476"); - } else if(!strcmp(preset, "FuriHalSubGhzPresetCustom")) { - FURI_LOG_E(TAG, "Custom preset unsupported now"); - return false; - // furi_string_set(p->name, "CUSTOM"); - } else { - FURI_LOG_E(TAG, "Unsupported preset"); - return false; - } - return true; -} - -bool subghz_remote_key_load( - SubRemotePreset* preset, - FlipperFormat* fff_file, - FlipperFormat* fff_data, - SubGhzSetting* setting, - SubGhzReceiver* receiver, - const char* path) { - // - if(!flipper_format_rewind(fff_file)) { - FURI_LOG_E(TAG, "Rewind error"); - return false; - } - - FuriString* temp_str; - temp_str = furi_string_alloc(); - - bool res = false; - - subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK); - keeloq_reset_original_btn(); - subghz_custom_btns_reset(); - - do { - // load frequency from file - if(!flipper_format_read_uint32(fff_file, "Frequency", &preset->frequency, 1)) { - FURI_LOG_W(TAG, "Cannot read frequency. Defaulting to 433.92 MHz"); - preset->frequency = 433920000; - } - - // load preset from file - if(!flipper_format_read_string(fff_file, "Preset", temp_str)) { - FURI_LOG_W(TAG, "Could not read Preset. Defaulting to Ook650Async"); - furi_string_set(temp_str, "FuriHalSubGhzPresetOok650Async"); - } - if(!subghz_remote_set_preset(preset, furi_string_get_cstr(temp_str))) { - FURI_LOG_E(TAG, "Could not set preset"); - break; - } - if(!strcmp(furi_string_get_cstr(temp_str), "FuriHalSubGhzPresetCustom")) { - // TODO: check if preset is custom - FURI_LOG_E(TAG, "Could not use custom preset"); - break; - } - size_t preset_index = - subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(preset->name)); - preset->data = subghz_setting_get_preset_data(setting, preset_index); - preset->data_size = subghz_setting_get_preset_data_size(setting, preset_index); - - // load protocol from file - if(!flipper_format_read_string(fff_file, "Protocol", preset->protocol)) { - FURI_LOG_E(TAG, "Could not read Protocol."); - break; - } - if(!flipper_format_rewind(fff_data)) { - FURI_LOG_E(TAG, "Rewind error"); - return false; - } - - if(!furi_string_cmp_str(preset->protocol, "RAW")) { - subghz_protocol_raw_gen_fff_data(fff_data, path); - // repeat - if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &preset->repeat, 1)) { - FURI_LOG_E(TAG, "Unable to insert or update Repeat"); - break; - } - - } else { - stream_copy_full( - flipper_format_get_raw_stream(fff_file), flipper_format_get_raw_stream(fff_data)); - // repeat - if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &preset->repeat, 1)) { - FURI_LOG_E(TAG, "Unable to insert or update Repeat"); - break; - } - } - - if(!flipper_format_rewind(fff_file)) { - FURI_LOG_E(TAG, "Rewind error"); - return false; - } - - preset->decoder = subghz_receiver_search_decoder_base_by_name( - receiver, furi_string_get_cstr(preset->protocol)); - if(preset->decoder) { - SubGhzProtocolStatus status = - subghz_protocol_decoder_base_deserialize(preset->decoder, fff_data); - if(status != SubGhzProtocolStatusOk) { - FURI_LOG_E(TAG, "Protocol deserialize failed, status = %d", status); - break; - } - } else { - FURI_LOG_E(TAG, "Protocol %s not found", furi_string_get_cstr(temp_str)); - } - - res = true; - } while(0); - - furi_string_free(temp_str); - - return res; -} - -// method modified from subghz_i.c -// https://github.com/flipperdevices/flipperzero-firmware/blob/b0daa601ad5b87427a45f9089c8b403a01f72c2a/applications/subghz/subghz_i.c#L417-L456 -bool subghz_remote_save_protocol_to_file(FlipperFormat* fff_file, const char* dev_file_name) { - furi_assert(fff_file); - furi_assert(dev_file_name); +SubGhzRemoteApp* subghz_remote_app_alloc() { + SubGhzRemoteApp* app = malloc(sizeof(SubGhzRemoteApp)); Storage* storage = furi_record_open(RECORD_STORAGE); - Stream* flipper_format_stream = flipper_format_get_raw_stream(fff_file); + storage_common_migrate(storage, EXT_PATH("unirf"), SUBREM_APP_FOLDER); - bool saved = false; - FuriString* file_dir; - file_dir = furi_string_alloc(); - - path_extract_dirname(dev_file_name, file_dir); - do { - if(!storage_simply_mkdir(storage, furi_string_get_cstr(file_dir))) { - FURI_LOG_E(TAG, "(save) Cannot mkdir"); - break; - } - - if(!storage_simply_remove(storage, dev_file_name)) { - FURI_LOG_E(TAG, "(save) Cannot remove"); - break; - } - - stream_seek(flipper_format_stream, 0, StreamOffsetFromStart); - stream_save_to_file(flipper_format_stream, storage, dev_file_name, FSOM_CREATE_ALWAYS); - - saved = true; - //FURI_LOG_D(TAG, "(save) OK Save"); - } while(0); - furi_string_free(file_dir); + if(!storage_simply_mkdir(storage, SUBREM_APP_FOLDER)) { + //FURI_LOG_E(TAG, "Could not create folder %s", SUBREM_APP_FOLDER); + } furi_record_close(RECORD_STORAGE); - return saved; -} - -void subghz_remote_tx_stop(SubGHzRemote* app) { - if(app->processing == 0) { - return; - } - - if(!furi_string_cmp_str(app->txpreset->protocol, "RAW")) { - while(!furi_hal_subghz_is_async_tx_complete()) { - furi_delay_ms(15); - } - } - - //Stop TX - furi_hal_subghz_stop_async_tx(); - //FURI_LOG_I(TAG, "TX Done!"); - subghz_transmitter_stop(app->tx_transmitter); - - //FURI_LOG_D(TAG, "Checking if protocol is dynamic"); - const SubGhzProtocolRegistry* protocol_registry_items = - subghz_environment_get_protocol_registry(app->environment); - const SubGhzProtocol* proto = subghz_protocol_registry_get_by_name( - protocol_registry_items, furi_string_get_cstr(app->txpreset->protocol)); - //FURI_LOG_D(TAG, "Protocol-TYPE %d", proto->type); - - if(proto && proto->type == SubGhzProtocolTypeDynamic) { - //FURI_LOG_D(TAG, "Protocol is dynamic. Saving key"); - // Remove repeat if it was present - flipper_format_delete_key(app->tx_fff_data, "Repeat"); - - subghz_remote_save_protocol_to_file(app->tx_fff_data, app->tx_file_path); - - keeloq_reset_mfname(); - keeloq_reset_kl_type(); - keeloq_reset_original_btn(); - subghz_custom_btns_reset(); - star_line_reset_mfname(); - star_line_reset_kl_type(); - } - - subghz_transmitter_free(app->tx_transmitter); - furi_hal_subghz_idle(); - - notification_message(app->notification, &sequence_blink_stop); - - subghz_remote_preset_free(app->txpreset); - flipper_format_free(app->tx_fff_data); - subghz_remote_end_send(app); -} - -static bool subghz_remote_send_sub(SubGHzRemote* app, FlipperFormat* fff_data) { - // - bool res = false; - do { - if(!furi_hal_subghz_is_tx_allowed(app->txpreset->frequency)) { - FURI_LOG_E( - TAG, - "In your settings, only reception on this frequency (%lu) is allowed,\r\n" - "the actual operation of the subghz remote app is not possible\r\n ", - app->txpreset->frequency); - app->tx_not_allowed = true; - subghz_remote_end_send(app); - break; - } else { - app->tx_not_allowed = false; - } - - app->tx_transmitter = subghz_transmitter_alloc_init( - app->environment, furi_string_get_cstr(app->txpreset->protocol)); - if(!app->tx_transmitter) { - break; - } - - if(subghz_transmitter_deserialize(app->tx_transmitter, fff_data) != - SubGhzProtocolStatusOk) { - FURI_LOG_E(TAG, "Deserialize error!"); - break; - } - - furi_hal_subghz_reset(); - furi_hal_subghz_idle(); - furi_hal_subghz_load_custom_preset(app->txpreset->data); - furi_hal_gpio_init(furi_hal_subghz.cc1101_g0_pin, GpioModeInput, GpioPullNo, GpioSpeedLow); - - furi_hal_subghz_idle(); - - furi_hal_subghz_set_frequency_and_path(app->txpreset->frequency); - furi_hal_gpio_write(furi_hal_subghz.cc1101_g0_pin, false); - furi_hal_gpio_init( - furi_hal_subghz.cc1101_g0_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); - - if(!furi_hal_subghz_tx()) { - FURI_LOG_E(TAG, "Sending not allowed"); - break; - } - - //FURI_LOG_I(TAG, "Sending..."); - notification_message(app->notification, &sequence_blink_start_magenta); - - furi_hal_subghz_start_async_tx(subghz_transmitter_yield, app->tx_transmitter); - - res = true; - } while(0); - - return res; -} - -static void subghz_remote_send_signal(SubGHzRemote* app, Storage* storage, const char* path) { - //FURI_LOG_D(TAG, "Sending: %s", path); - - app->tx_file_path = path; - - app->tx_fff_data = flipper_format_string_alloc(); - - app->txpreset = subghz_remote_preset_alloc(); - - // load settings/stream from .sub file - FlipperFormat* fff_file = flipper_format_file_alloc(storage); - bool open_ok = false; - do { - if(!flipper_format_file_open_existing(fff_file, path)) { - FURI_LOG_E(TAG, "Could not open file %s", path); - break; - } - if(!subghz_remote_key_load( - app->txpreset, - fff_file, - app->tx_fff_data, - app->setting, - app->subghz_receiver, - path)) { - FURI_LOG_E(TAG, "Could not load key"); - break; - } - open_ok = true; - } while(0); - flipper_format_free(fff_file); - if(!open_ok) { - FURI_LOG_E(TAG, "Could not load file!"); - return; - } - - subghz_remote_send_sub(app, app->tx_fff_data); -} - -static void subghz_remote_process_signal(SubGHzRemote* app, FuriString* signal) { - view_port_update(app->view_port); - - //FURI_LOG_D(TAG, "signal = %s", furi_string_get_cstr(signal)); - - if(strlen(furi_string_get_cstr(signal)) > 12) { - Storage* storage = furi_record_open(RECORD_STORAGE); - subghz_remote_send_signal(app, storage, furi_string_get_cstr(signal)); - furi_record_close(RECORD_STORAGE); - } else if(strlen(furi_string_get_cstr(signal)) < 10) { - subghz_remote_end_send(app); - } -} - -static void render_callback(Canvas* canvas, void* ctx) { - SubGHzRemote* app = ctx; - furi_check(furi_mutex_acquire(app->model_mutex, FuriWaitForever) == FuriStatusOk); - - //setup different canvas settings - if(app->file_result == 1) { - //if map has no valid filenames defined - canvas_clear(canvas); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Config is incorrect."); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignTop, "Please configure map."); - canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Press Back to Exit."); - } else if(app->file_result == 3) { - //if map has no valid filenames defined - canvas_clear(canvas); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Checking config."); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignTop, "If app is stuck..."); - canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Press Back to Exit."); - } else if(app->tx_not_allowed) { - canvas_clear(canvas); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Transmission is blocked."); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str_aligned(canvas, 62, 15, AlignCenter, AlignTop, "Frequency is outside of"); - canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignTop, "default range."); - canvas_draw_str_aligned(canvas, 62, 35, AlignCenter, AlignTop, "Check docs."); - canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Press Back to Exit."); - } else { - //map found, draw all the things - canvas_clear(canvas); - - //canvas_set_font(canvas, FontPrimary); - //canvas_draw_str(canvas, 0, 10, "U: "); - //canvas_draw_str(canvas, 0, 20, "L: "); - //canvas_draw_str(canvas, 0, 30, "R: "); - //canvas_draw_str(canvas, 0, 40, "D: "); - //canvas_draw_str(canvas, 0, 50, "Ok: "); - - //PNGs are located in assets/icons/SubGHzRemote before compilation - - //Icons for Labels - //canvas_draw_icon(canvas, 0, 0, &I_SubGHzRemote_LeftAlignedButtons_9x64); - canvas_draw_icon(canvas, 1, 5, &I_ButtonUp_7x4); - canvas_draw_icon(canvas, 1, 15, &I_ButtonDown_7x4); - canvas_draw_icon(canvas, 2, 23, &I_ButtonLeft_4x7); - canvas_draw_icon(canvas, 2, 33, &I_ButtonRight_4x7); - canvas_draw_icon(canvas, 0, 42, &I_Ok_btn_9x9); - canvas_draw_icon(canvas, 0, 53, &I_back_10px); - - //Labels - canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas, 10, 10, app->up_label); - canvas_draw_str(canvas, 10, 20, app->down_label); - canvas_draw_str(canvas, 10, 30, app->left_label); - canvas_draw_str(canvas, 10, 40, app->right_label); - canvas_draw_str(canvas, 10, 50, app->ok_label); - - canvas_draw_str_aligned(canvas, 11, 62, AlignLeft, AlignBottom, "Press=Exit."); - - //Status text and indicator - canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, app->send_status); - - switch(app->send_status_c) { - case 0: - canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); - break; - case 1: - canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); - canvas_draw_icon(canvas, 116, 17, &I_Pin_arrow_up_7x9); - break; - case 2: - canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); - canvas_draw_icon_ex(canvas, 116, 17, &I_Pin_arrow_up_7x9, IconRotation180); - break; - case 3: - canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); - canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation90); - break; - case 4: - canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); - canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation270); - break; - case 5: - canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); - canvas_draw_icon(canvas, 116, 18, &I_Pin_star_7x7); - break; - } - - //Repeat indicator - //canvas_draw_str_aligned(canvas, 125, 40, AlignRight, AlignBottom, "Repeat:"); - //canvas_draw_icon(canvas, 115, 39, &I_SubGHzRemote_Repeat_12x14); - //canvas_draw_str_aligned(canvas, 125, 62, AlignRight, AlignBottom, int_to_char(app->repeat)); - } - - furi_mutex_release(app->model_mutex); -} - -static void input_callback(InputEvent* input_event, void* ctx) { - SubGHzRemote* app = ctx; - furi_message_queue_put(app->input_queue, input_event, 0); -} - -void subghz_remote_subghz_alloc(SubGHzRemote* app) { - // load subghz presets - app->setting = subghz_setting_alloc(); - subghz_setting_load(app->setting, EXT_PATH("subghz/assets/setting_user")); - - // load mfcodes - app->environment = subghz_environment_alloc(); - subghz_environment_load_keystore(app->environment, EXT_PATH("subghz/assets/keeloq_mfcodes")); - subghz_environment_load_keystore( - app->environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user")); - subghz_environment_set_came_atomo_rainbow_table_file_name( - app->environment, EXT_PATH("subghz/assets/came_atomo")); - subghz_environment_set_nice_flor_s_rainbow_table_file_name( - app->environment, EXT_PATH("subghz/assets/nice_flor_s")); - subghz_environment_set_alutech_at_4n_rainbow_table_file_name( - app->environment, EXT_PATH("subghz/assets/alutech_at_4n")); - subghz_environment_set_protocol_registry(app->environment, (void*)&subghz_protocol_registry); - - app->subghz_receiver = subghz_receiver_alloc_init(app->environment); -} - -SubGHzRemote* subghz_remote_alloc(void) { - SubGHzRemote* app = malloc(sizeof(SubGHzRemote)); // Enable power for External CC1101 if it is connected furi_hal_subghz_enable_ext_power(); @@ -773,24 +42,69 @@ SubGHzRemote* subghz_remote_alloc(void) { furi_hal_power_suppress_charge_enter(); - app->model_mutex = furi_mutex_alloc(FuriMutexTypeNormal); + app->file_path = furi_string_alloc(); + furi_string_set(app->file_path, SUBREM_APP_FOLDER); - app->input_queue = furi_message_queue_alloc(32, sizeof(InputEvent)); - - app->view_port = view_port_alloc(); - view_port_draw_callback_set(app->view_port, render_callback, app); - view_port_input_callback_set(app->view_port, input_callback, app); - - // Open GUI and register view_port + // GUI app->gui = furi_record_open(RECORD_GUI); - gui_add_view_port(app->gui, app->view_port, GuiLayerFullscreen); - app->notification = furi_record_open(RECORD_NOTIFICATION); + // View Dispatcher + app->view_dispatcher = view_dispatcher_alloc(); + + app->scene_manager = scene_manager_alloc(&subrem_scene_handlers, app); + view_dispatcher_enable_queue(app->view_dispatcher); + + view_dispatcher_set_event_callback_context(app->view_dispatcher, app); + view_dispatcher_set_custom_event_callback( + app->view_dispatcher, subghz_remote_app_custom_event_callback); + view_dispatcher_set_navigation_event_callback( + app->view_dispatcher, subghz_remote_app_back_event_callback); + view_dispatcher_set_tick_event_callback( + app->view_dispatcher, subghz_remote_app_tick_event_callback, 100); + + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + + // Open Notification record + app->notifications = furi_record_open(RECORD_NOTIFICATION); + + // SubMenu + app->submenu = submenu_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, SubRemViewSubmenu, submenu_get_view(app->submenu)); + + //Dialog + app->dialogs = furi_record_open(RECORD_DIALOGS); + + // Remote view + app->subrem_remote_view = subrem_view_remote_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, + SubRemViewIDRemote, + subrem_view_remote_get_view(app->subrem_remote_view)); + + app->map_preset = malloc(sizeof(SubRemMapPreset)); + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + app->map_preset->subs_preset[i] = subrem_sub_file_preset_alloc(); + } + + app->txrx = subghz_txrx_alloc(); + + subghz_txrx_set_need_save_callback(app->txrx, subrem_save_active_sub, app); + + app->tx_running = false; + +#ifdef SUBREM_LIGHT + scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); +#else + scene_manager_next_scene(app->scene_manager, SubRemSceneStart); +#endif return app; } -void subghz_remote_free(SubGHzRemote* app, bool with_subghz) { +void subghz_remote_app_free(SubGhzRemoteApp* app) { + furi_assert(app); + furi_hal_power_suppress_charge_exit(); // Disable power for External CC1101 if it was enabled and module is connected @@ -798,304 +112,49 @@ void subghz_remote_free(SubGHzRemote* app, bool with_subghz) { // Reinit SPI handles for internal radio / nfc furi_hal_subghz_init_radio_type(SubGhzRadioInternal); - furi_string_free(app->up_file); - furi_string_free(app->down_file); - furi_string_free(app->left_file); - furi_string_free(app->right_file); - furi_string_free(app->ok_file); + // Submenu + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewSubmenu); + submenu_free(app->submenu); - furi_string_free(app->file_path); - furi_string_free(app->signal); + //Dialog + furi_record_close(RECORD_DIALOGS); - gui_remove_view_port(app->gui, app->view_port); - furi_record_close(RECORD_GUI); - view_port_free(app->view_port); - app->gui = NULL; + // Remote view + view_dispatcher_remove_view(app->view_dispatcher, SubRemViewIDRemote); + subrem_view_remote_free(app->subrem_remote_view); - furi_message_queue_free(app->input_queue); + scene_manager_free(app->scene_manager); + view_dispatcher_free(app->view_dispatcher); - furi_mutex_free(app->model_mutex); + subghz_txrx_free(app->txrx); - if(with_subghz) { - furi_hal_subghz_sleep(); - subghz_setting_free(app->setting); - subghz_receiver_free(app->subghz_receiver); - subghz_environment_free(app->environment); + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + subrem_sub_file_preset_free(app->map_preset->subs_preset[i]); } + free(app->map_preset); + // Notifications furi_record_close(RECORD_NOTIFICATION); - app->notification = NULL; + app->notifications = NULL; + + // Close records + furi_record_close(RECORD_GUI); + + // Path strings + furi_string_free(app->file_path); free(app); } int32_t subghz_remote_app(void* p) { UNUSED(p); - SubGHzRemote* app = subghz_remote_alloc(); + SubGhzRemoteApp* subghz_remote_app = subghz_remote_app_alloc(); - app->file_path = furi_string_alloc(); - app->signal = furi_string_alloc(); + furi_string_set(subghz_remote_app->file_path, SUBREM_APP_FOLDER); - //setup variables before population - app->up_file = furi_string_alloc(); - app->down_file = furi_string_alloc(); - app->left_file = furi_string_alloc(); - app->right_file = furi_string_alloc(); - app->ok_file = furi_string_alloc(); + view_dispatcher_run(subghz_remote_app->view_dispatcher); - app->file_result = 3; - - Storage* storage = furi_record_open(RECORD_STORAGE); - storage_common_migrate(storage, EXT_PATH("unirf"), SUBREMOTEMAP_FOLDER); - - if(!storage_simply_mkdir(storage, SUBREMOTEMAP_FOLDER)) { - FURI_LOG_E(TAG, "Could not create folder %s", SUBREMOTEMAP_FOLDER); - } - furi_record_close(RECORD_STORAGE); - - furi_string_set(app->file_path, SUBREMOTEMAP_FOLDER); - - DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); - - DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options(&browser_options, SUBREMOTEMAP_EXTENSION, &I_sub1_10px); - browser_options.base_path = SUBREMOTEMAP_FOLDER; - - bool res = dialog_file_browser_show(dialogs, app->file_path, app->file_path, &browser_options); - - furi_record_close(RECORD_DIALOGS); - if(!res) { - FURI_LOG_E(TAG, "No file selected"); - subghz_remote_free(app, false); - return 255; - } else { - //check map and population variables - subghz_remote_cfg_set_check(app, app->file_path); - } - - // init subghz stuff - subghz_remote_subghz_alloc(app); - - bool exit_loop = false; - - if(app->file_result == 2) { - //FURI_LOG_D( - //TAG, - //"U: %s - D: %s - L: %s - R: %s - O: %s ", - //furi_string_get_cstr(app->up_file), - //furi_string_get_cstr(app->down_file), - //furi_string_get_cstr(app->left_file), - //furi_string_get_cstr(app->right_file), - //furi_string_get_cstr(app->ok_file)); - - //variables to control multiple button presses and status updates - app->send_status = "Idle"; - app->send_status_c = 0; - app->processing = 0; - //app->repeat = 1; - app->button = 0; - - //refresh screen to update variables before processing main screen or error screens - furi_mutex_release(app->model_mutex); - view_port_update(app->view_port); - - //input detect loop start - InputEvent input; - while(1) { - furi_check( - furi_message_queue_get(app->input_queue, &input, FuriWaitForever) == FuriStatusOk); - //FURI_LOG_D( - //TAG, - //"key: %s type: %s", - //input_get_key_name(input.key), - //input_get_type_name(input.type)); - - switch(input.key) { - case InputKeyUp: - if(input.type == InputTypePress) { - if(app->up_enabled) { - if(app->processing == 0) { - furi_string_reset(app->signal); - furi_string_set(app->signal, app->up_file); - app->button = 1; - app->processing = 1; - } - } - } - if(input.type == InputTypeRelease) { - if(app->up_enabled) { - subghz_remote_tx_stop(app); - } - } - break; - - case InputKeyDown: - if(input.type == InputTypePress) { - if(app->down_enabled) { - if(app->processing == 0) { - furi_string_reset(app->signal); - furi_string_set(app->signal, app->down_file); - app->button = 2; - app->processing = 1; - } - } - } - if(input.type == InputTypeRelease) { - if(app->down_enabled) { - subghz_remote_tx_stop(app); - } - } - break; - - case InputKeyRight: - if(input.type == InputTypePress) { - if(app->right_enabled) { - if(app->processing == 0) { - furi_string_reset(app->signal); - furi_string_set(app->signal, app->right_file); - app->button = 3; - app->processing = 1; - } - } - } - if(input.type == InputTypeRelease) { - if(app->right_enabled) { - subghz_remote_tx_stop(app); - } - } - break; - - case InputKeyLeft: - if(input.type == InputTypePress) { - if(app->left_enabled) { - if(app->processing == 0) { - furi_string_reset(app->signal); - furi_string_set(app->signal, app->left_file); - app->button = 4; - app->processing = 1; - } - } - } - if(input.type == InputTypeRelease) { - if(app->left_enabled) { - subghz_remote_tx_stop(app); - } - } - break; - - case InputKeyOk: - if(input.type == InputTypePress) { - if(app->ok_enabled) { - if(app->processing == 0) { - furi_string_reset(app->signal); - furi_string_set(app->signal, app->ok_file); - app->button = 5; - app->processing = 1; - } - } - } - if(input.type == InputTypeRelease) { - if(app->ok_enabled) { - subghz_remote_tx_stop(app); - } - } - break; - - case InputKeyBack: - subghz_remote_tx_stop(app); - exit_loop = true; - break; - default: - break; - } - - if(app->processing == 0) { - //FURI_LOG_D(TAG, "processing 0"); - app->send_status = "Idle"; - app->send_status_c = 0; - app->button = 0; - } else if(app->processing == 1) { - //FURI_LOG_D(TAG, "processing 1"); - - app->send_status = "Send"; - - switch(app->button) { - case 1: - app->send_status_c = 1; - break; - case 2: - app->send_status_c = 2; - break; - case 3: - app->send_status_c = 3; - break; - case 4: - app->send_status_c = 4; - break; - case 5: - app->send_status_c = 5; - break; - } - - app->processing = 2; - - subghz_remote_process_signal(app, app->signal); - } - - if(exit_loop == true) { - furi_mutex_release(app->model_mutex); - break; - } - - furi_mutex_release(app->model_mutex); - view_port_update(app->view_port); - } - } else if(app->file_result == 1 || app->file_result == 3) { - //refresh screen to update variables before processing main screen or error screens - view_port_update(app->view_port); - - InputEvent input; - while(1) { - furi_check( - furi_message_queue_get(app->input_queue, &input, FuriWaitForever) == FuriStatusOk); - //FURI_LOG_D( - //TAG, - //"key: %s type: %s", - //input_get_key_name(input.key), - //input_get_type_name(input.type)); - - switch(input.key) { - case InputKeyRight: - break; - case InputKeyLeft: - break; - case InputKeyUp: - break; - case InputKeyDown: - break; - case InputKeyOk: - break; - case InputKeyBack: - exit_loop = true; - break; - default: - break; - } - - if(exit_loop == true) { - furi_mutex_release(app->model_mutex); - break; - } - - furi_mutex_release(app->model_mutex); - view_port_update(app->view_port); - } - } else { - furi_mutex_release(app->model_mutex); - } - - // remove & free all stuff created by app - subghz_remote_free(app, true); + subghz_remote_app_free(subghz_remote_app); return 0; } diff --git a/applications/main/subghz_remote/subghz_remote_app_i.c b/applications/main/subghz_remote/subghz_remote_app_i.c new file mode 100644 index 000000000..fb34b59f7 --- /dev/null +++ b/applications/main/subghz_remote/subghz_remote_app_i.c @@ -0,0 +1,299 @@ +#include "subghz_remote_app_i.h" +#include +#include + +#include + +#include "../subghz/helpers/subghz_txrx_i.h" + +// #include +// #include + +#include + +#define TAG "SubGhzRemote" + +// XXX Using TxRx +// [x] use TxRx preset subrem_sub_preset_load & subrem_tx_start_sub +// [x] subrem_sub_preset_load & drop subrem_set_preset_data +// [x] subrem_tx_start_sub +// [x] subrem_tx_stop_sub + +static const char* map_file_labels[SubRemSubKeyNameMaxCount][2] = { + [SubRemSubKeyNameUp] = {"UP", "ULABEL"}, + [SubRemSubKeyNameDown] = {"DOWN", "DLABEL"}, + [SubRemSubKeyNameLeft] = {"LEFT", "LLABEL"}, + [SubRemSubKeyNameRight] = {"RIGHT", "RLABEL"}, + [SubRemSubKeyNameOk] = {"OK", "OKLABEL"}, +}; + +static void subrem_map_preset_reset(SubRemMapPreset* map_preset) { + furi_assert(map_preset); + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + subrem_sub_file_preset_reset(map_preset->subs_preset[i]); + } +} + +static SubRemLoadMapState subrem_map_preset_check( + SubRemMapPreset* map_preset, + SubGhzTxRx* txrx, + FlipperFormat* fff_data_file) { + furi_assert(map_preset); + furi_assert(txrx); + + bool all_loaded = true; + SubRemLoadMapState ret = SubRemLoadMapStateErrorBrokenFile; + + SubRemLoadSubState sub_preset_loaded; + SubRemSubFilePreset* sub_preset; + + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = map_preset->subs_preset[i]; + + sub_preset_loaded = SubRemLoadSubStateErrorNoFile; + + if(furi_string_empty(sub_preset->file_path)) { + // FURI_LOG_I(TAG, "Empty file path"); + } else if(!flipper_format_file_open_existing( + fff_data_file, furi_string_get_cstr(sub_preset->file_path))) { + FURI_LOG_W(TAG, "Error open file %s", furi_string_get_cstr(sub_preset->file_path)); + } else { + sub_preset_loaded = subrem_sub_preset_load(sub_preset, txrx, fff_data_file); + } + + // TODO: + // Load file state logic + // Label depending on the state + // Move to remote scene + + if(sub_preset_loaded != SubRemLoadSubStateOK) { + furi_string_set_str(sub_preset->label, "N/A"); + all_loaded = false; + } else { + ret = SubRemLoadMapStateNotAllOK; + } + + if(ret != SubRemLoadMapStateErrorBrokenFile && all_loaded) { + ret = SubRemLoadMapStateOK; + } + + flipper_format_file_close(fff_data_file); + } + + return ret; +} + +static bool subrem_map_preset_load(SubRemMapPreset* map_preset, FlipperFormat* fff_data_file) { + furi_assert(map_preset); + bool ret = false; + SubRemSubFilePreset* sub_preset; + for(uint8_t i = 0; i < SubRemSubKeyNameMaxCount; i++) { + sub_preset = map_preset->subs_preset[i]; + if(!flipper_format_read_string( + fff_data_file, map_file_labels[i][0], sub_preset->file_path)) { +#if FURI_DEBUG + FURI_LOG_W(TAG, "No file patch for %s", map_file_labels[i][0]); +#endif + sub_preset->type = SubGhzProtocolTypeUnknown; + } else if(!flipper_format_rewind(fff_data_file)) { + // Rewind error + } else if(!flipper_format_read_string( + fff_data_file, map_file_labels[i][1], sub_preset->label)) { +#if FURI_DEBUG + FURI_LOG_W(TAG, "No Label for %s", map_file_labels[i][0]); +#endif + // TODO move to remote scene + path_extract_filename(sub_preset->file_path, sub_preset->label, true); + ret = true; + } else { + ret = true; + } + if(ret) { + // Preload seccesful + FURI_LOG_I( + TAG, + "%-5s: %s %s", + map_file_labels[i][0], + furi_string_get_cstr(sub_preset->label), + furi_string_get_cstr(sub_preset->file_path)); + sub_preset->load_state = SubRemLoadSubStatePreloaded; + } + + flipper_format_rewind(fff_data_file); + } + return ret; +} + +SubRemLoadMapState subrem_map_file_load(SubGhzRemoteApp* app, const char* file_path) { + furi_assert(app); + furi_assert(file_path); +#if FURI_DEBUG + FURI_LOG_I(TAG, "Load Map File Start"); +#endif + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); + SubRemLoadMapState ret = SubRemLoadMapStateErrorOpenError; +#if FURI_DEBUG + FURI_LOG_I(TAG, "Open Map File.."); +#endif + subrem_map_preset_reset(app->map_preset); + + if(!flipper_format_file_open_existing(fff_data_file, file_path)) { + FURI_LOG_E(TAG, "Could not open MAP file %s", file_path); + ret = SubRemLoadMapStateErrorOpenError; + } else { + if(!subrem_map_preset_load(app->map_preset, fff_data_file)) { + FURI_LOG_E(TAG, "Could no Sub file path in MAP file"); + // ret = // error for popup + } else if(!flipper_format_file_close(fff_data_file)) { + ret = SubRemLoadMapStateErrorOpenError; + } else { + ret = subrem_map_preset_check(app->map_preset, app->txrx, fff_data_file); + } + } + + if(ret == SubRemLoadMapStateOK) { + FURI_LOG_I(TAG, "Load Map File Seccesful"); + } else if(ret == SubRemLoadMapStateNotAllOK) { + FURI_LOG_I(TAG, "Load Map File Seccesful [Not all files]"); + } else { + FURI_LOG_E(TAG, "Broken Map File"); + } + + flipper_format_file_close(fff_data_file); + flipper_format_free(fff_data_file); + + furi_record_close(RECORD_STORAGE); + return ret; +} + +bool subrem_save_protocol_to_file(FlipperFormat* flipper_format, const char* sub_file_name) { + furi_assert(flipper_format); + furi_assert(sub_file_name); + + Storage* storage = furi_record_open(RECORD_STORAGE); + Stream* flipper_format_stream = flipper_format_get_raw_stream(flipper_format); + + bool saved = false; + uint32_t repeat = 200; + FuriString* file_dir = furi_string_alloc(); + + path_extract_dirname(sub_file_name, file_dir); + do { + // removing additional fields + flipper_format_delete_key(flipper_format, "Repeat"); + // flipper_format_delete_key(flipper_format, "Manufacture"); + + if(!storage_simply_remove(storage, sub_file_name)) { + break; + } + + //ToDo check Write + stream_seek(flipper_format_stream, 0, StreamOffsetFromStart); + stream_save_to_file(flipper_format_stream, storage, sub_file_name, FSOM_CREATE_ALWAYS); + + if(!flipper_format_insert_or_update_uint32(flipper_format, "Repeat", &repeat, 1)) { + FURI_LOG_E(TAG, "Unable Repeat"); + break; + } + + saved = true; + } while(0); + + furi_string_free(file_dir); + furi_record_close(RECORD_STORAGE); + return saved; +} + +void subrem_save_active_sub(void* context) { + furi_assert(context); + SubGhzRemoteApp* app = context; + + SubRemSubFilePreset* sub_preset = app->map_preset->subs_preset[app->chusen_sub]; + subrem_save_protocol_to_file( + sub_preset->fff_data, furi_string_get_cstr(sub_preset->file_path)); +} + +bool subrem_tx_start_sub(SubGhzRemoteApp* app, SubRemSubFilePreset* sub_preset) { + furi_assert(app); + furi_assert(sub_preset); + bool ret = false; + + subrem_tx_stop_sub(app, true); + + if(sub_preset->type == SubGhzProtocolTypeUnknown) { + ret = false; + } else { + FURI_LOG_I(TAG, "Send %s", furi_string_get_cstr(sub_preset->label)); + + subghz_txrx_load_decoder_by_name_protocol( + app->txrx, furi_string_get_cstr(sub_preset->protocaol_name)); + + subghz_txrx_set_preset( + app->txrx, + furi_string_get_cstr(sub_preset->freq_preset.name), + sub_preset->freq_preset.frequency, + NULL, + 0); + + subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK); + keeloq_reset_original_btn(); + subghz_custom_btns_reset(); + + if(subghz_txrx_tx_start(app->txrx, sub_preset->fff_data) == SubGhzTxRxStartTxStateOk) { + ret = true; + } + } + + app->tx_running = ret; + + return ret; +} + +bool subrem_tx_stop_sub(SubGhzRemoteApp* app, bool forced) { + furi_assert(app); + SubRemSubFilePreset* sub_preset = app->map_preset->subs_preset[app->chusen_sub]; + + if(forced || (sub_preset->type != SubGhzProtocolTypeRAW)) { + // XXX drop app->tx_running + if(app->tx_running) { + subghz_txrx_stop(app->txrx); + + if(sub_preset->type == SubGhzProtocolTypeDynamic) { + keeloq_reset_mfname(); + keeloq_reset_kl_type(); + keeloq_reset_original_btn(); + subghz_custom_btns_reset(); + star_line_reset_mfname(); + star_line_reset_kl_type(); + } + + app->tx_running = false; + return true; + } + } + + return false; +} + +SubRemLoadMapState subrem_load_from_file(SubGhzRemoteApp* app) { + furi_assert(app); + + FuriString* file_path = furi_string_alloc(); + SubRemLoadMapState ret = SubRemLoadMapStateBack; + + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options(&browser_options, SUBREM_APP_EXTENSION, &I_sub1_10px); + browser_options.base_path = SUBREM_APP_FOLDER; + + // Input events and views are managed by file_select + if(!dialog_file_browser_show(app->dialogs, app->file_path, app->file_path, &browser_options)) { + } else { + ret = subrem_map_file_load(app, furi_string_get_cstr(app->file_path)); + } + + furi_string_free(file_path); + + return ret; +} diff --git a/applications/main/subghz_remote/subghz_remote_app_i.h b/applications/main/subghz_remote/subghz_remote_app_i.h new file mode 100644 index 000000000..50e2bae9f --- /dev/null +++ b/applications/main/subghz_remote/subghz_remote_app_i.h @@ -0,0 +1,64 @@ +#pragma once + +#include "helpers/subrem_types.h" +#include "helpers/subrem_presets.h" + +#include "../subghz/helpers/subghz_txrx.h" + +#include + +#include "views/remote.h" + +#include "scenes/subrem_scene.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#define SUBREM_APP_FOLDER EXT_PATH("subghz_remote") +#define SUBREM_MAX_LEN_NAME 64 + +typedef struct { + Gui* gui; + ViewDispatcher* view_dispatcher; + SceneManager* scene_manager; + NotificationApp* notifications; + DialogsApp* dialogs; + Submenu* submenu; + + FuriString* file_path; + // char file_name_tmp[SUBREM_MAX_LEN_NAME]; + + SubRemViewRemote* subrem_remote_view; + + SubRemMapPreset* map_preset; + + SubGhzTxRx* txrx; + + bool tx_running; + + uint8_t chusen_sub; +} SubGhzRemoteApp; + +SubRemLoadMapState subrem_load_from_file(SubGhzRemoteApp* app); + +bool subrem_tx_start_sub(SubGhzRemoteApp* app, SubRemSubFilePreset* sub_preset); + +bool subrem_tx_stop_sub(SubGhzRemoteApp* app, bool forced); + +void subrem_save_active_sub(void* context); \ No newline at end of file diff --git a/applications/main/subghz_remote/views/remote.c b/applications/main/subghz_remote/views/remote.c new file mode 100644 index 000000000..e062f11b1 --- /dev/null +++ b/applications/main/subghz_remote/views/remote.c @@ -0,0 +1,294 @@ +#include "remote.h" +#include "../subghz_remote_app_i.h" + +#include +#include + +#define SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH 12 + +struct SubRemViewRemote { + View* view; + SubRemViewRemoteCallback callback; + void* context; +}; + +// TODO: model +typedef struct { + // FuriString* up_label; + // FuriString* down_label; + // FuriString* left_label; + // FuriString* right_label; + // FuriString* ok_label; + + char* up_label; + char* down_label; + char* left_label; + char* right_label; + char* ok_label; + + SubRemViewRemoteState state; + + uint8_t pressed_btn; +} SubRemViewRemoteModel; + +void subrem_view_remote_set_callback( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteCallback callback, + void* context) { + furi_assert(subrem_view_remote); + + subrem_view_remote->callback = callback; + subrem_view_remote->context = context; +} + +void subrem_view_remote_add_data_to_show(SubRemViewRemote* subrem_view_remote, const char** labels) { + furi_assert(subrem_view_remote); + + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + strncpy(model->up_label, labels[0], SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH); + strncpy(model->down_label, labels[1], SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH); + strncpy(model->left_label, labels[2], SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH); + strncpy(model->right_label, labels[3], SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH); + strncpy(model->ok_label, labels[4], SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH); + + // furi_string_set(model->up_label, up_label); + // furi_string_set(model->down_label, down_label); + // furi_string_set(model->left_label, left_label); + // furi_string_set(model->right_label, right_label); + // furi_string_set(model->ok_label, ok_label); + }, + true); +} + +void subrem_view_remote_set_state( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteState state, + uint8_t presed_btn) { + furi_assert(subrem_view_remote); + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + model->state = state; + model->pressed_btn = presed_btn; + }, + true); +} + +void subrem_view_remote_draw(Canvas* canvas, SubRemViewRemoteModel* model) { + canvas_clear(canvas); + canvas_set_color(canvas, ColorBlack); + + canvas_clear(canvas); + + //Icons for Labels + //canvas_draw_icon(canvas, 0, 0, &I_SubGHzRemote_LeftAlignedButtons_9x64); + canvas_draw_icon(canvas, 1, 5, &I_ButtonUp_7x4); + canvas_draw_icon(canvas, 1, 15, &I_ButtonDown_7x4); + canvas_draw_icon(canvas, 2, 23, &I_ButtonLeft_4x7); + canvas_draw_icon(canvas, 2, 33, &I_ButtonRight_4x7); + canvas_draw_icon(canvas, 0, 42, &I_Ok_btn_9x9); + canvas_draw_icon(canvas, 0, 53, &I_back_10px); + + //Labels + canvas_set_font(canvas, FontSecondary); + canvas_draw_str(canvas, 10, 10, model->up_label); + canvas_draw_str(canvas, 10, 20, model->down_label); + canvas_draw_str(canvas, 10, 30, model->left_label); + canvas_draw_str(canvas, 10, 40, model->right_label); + canvas_draw_str(canvas, 10, 50, model->ok_label); + + // canvas_draw_str(canvas, 10, 10, furi_string_get_cstr(model->up_label)); + // canvas_draw_str(canvas, 10, 10, furi_string_get_cstr(model->up_label)); + // canvas_draw_str(canvas, 10, 10, furi_string_get_cstr(model->up_label)); + // canvas_draw_str(canvas, 10, 10, furi_string_get_cstr(model->up_label)); + // canvas_draw_str(canvas, 10, 10, furi_string_get_cstr(model->up_label)); + + canvas_draw_str_aligned(canvas, 11, 62, AlignLeft, AlignBottom, "Hold=Exit."); + + //Status text and indicator + canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13); + + if(model->state == SubRemViewRemoteStateIdle) { + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Idle"); + } else { + switch(model->state) { + case SubRemViewRemoteStateSending: + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Send"); + break; + case SubRemViewRemoteStateLoading: + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Load"); + break; + default: +#if FURI_DEBUG + canvas_draw_str_aligned(canvas, 126, 10, AlignRight, AlignBottom, "Wrong_state"); +#endif + break; + } + + switch(model->pressed_btn) { + case SubRemSubKeyNameUp: + canvas_draw_icon(canvas, 116, 17, &I_Pin_arrow_up_7x9); + break; + case SubRemSubKeyNameDown: + canvas_draw_icon_ex(canvas, 116, 17, &I_Pin_arrow_up_7x9, IconRotation180); + break; + case SubRemSubKeyNameLeft: + canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation270); + break; + case SubRemSubKeyNameRight: + canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation90); + break; + case SubRemSubKeyNameOk: + canvas_draw_icon(canvas, 116, 18, &I_Pin_star_7x7); + break; + } + } + //Repeat indicator + //canvas_draw_str_aligned(canvas, 125, 40, AlignRight, AlignBottom, "Repeat:"); + //canvas_draw_icon(canvas, 115, 39, &I_SubGHzRemote_Repeat_12x14); + //canvas_draw_str_aligned(canvas, 125, 62, AlignRight, AlignBottom, int_to_char(app->repeat)); +} + +bool subrem_view_remote_input(InputEvent* event, void* context) { + furi_assert(context); + SubRemViewRemote* subrem_view_remote = context; + + if(event->key == InputKeyBack && event->type == InputTypeLong) { + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + strcpy(model->up_label, "N/A"); + strcpy(model->down_label, "N/A"); + strcpy(model->left_label, "N/A"); + strcpy(model->right_label, "N/A"); + strcpy(model->ok_label, "N/A"); + }, + false); + subrem_view_remote->callback(SubRemCustomEventViewRemoteBack, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyBack && event->type == InputTypeShort) { + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { model->pressed_btn = 0; }, + true); + subrem_view_remote->callback( + SubRemCustomEventViewRemoteForcedStop, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyBack) { + return true; + } + // BACK button processing end + + if(event->key == InputKeyUp && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartUP, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyDown && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartDOWN, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyLeft && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartLEFT, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyRight && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartRIGHT, subrem_view_remote->context); + return true; + } else if(event->key == InputKeyOk && event->type == InputTypePress) { + subrem_view_remote->callback( + SubRemCustomEventViewRemoteStartOK, subrem_view_remote->context); + return true; + } else if(event->type == InputTypeRelease) { + subrem_view_remote->callback(SubRemCustomEventViewRemoteStop, subrem_view_remote->context); + return true; + } + + return true; +} + +void subrem_view_remote_enter(void* context) { + furi_assert(context); +} + +void subrem_view_remote_exit(void* context) { + furi_assert(context); +} + +SubRemViewRemote* subrem_view_remote_alloc() { + SubRemViewRemote* subrem_view_remote = malloc(sizeof(SubRemViewRemote)); + + // View allocation and configuration + subrem_view_remote->view = view_alloc(); + view_allocate_model( + subrem_view_remote->view, ViewModelTypeLocking, sizeof(SubRemViewRemoteModel)); + view_set_context(subrem_view_remote->view, subrem_view_remote); + view_set_draw_callback(subrem_view_remote->view, (ViewDrawCallback)subrem_view_remote_draw); + view_set_input_callback(subrem_view_remote->view, subrem_view_remote_input); + view_set_enter_callback(subrem_view_remote->view, subrem_view_remote_enter); + view_set_exit_callback(subrem_view_remote->view, subrem_view_remote_exit); + + with_view_model( + subrem_view_remote->view, + SubRemViewRemoteModel * model, + { + model->state = SubRemViewRemoteStateIdle; + + model->up_label = malloc(sizeof(char) * SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH + 1); + model->down_label = malloc(sizeof(char) * SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH + 1); + model->left_label = malloc(sizeof(char) * SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH + 1); + model->right_label = malloc(sizeof(char) * SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH + 1); + model->ok_label = malloc(sizeof(char) * SUBREM_VIEW_REMOTE_MAX_LABEL_LENGTH + 1); + + strcpy(model->up_label, "N/A"); + strcpy(model->down_label, "N/A"); + strcpy(model->left_label, "N/A"); + strcpy(model->right_label, "N/A"); + strcpy(model->ok_label, "N/A"); + + // model->up_label = furi_string_alloc_set_str("N/A"); + // model->down_label = furi_string_alloc_set_str("N/A"); + // model->left_label = furi_string_alloc_set_str("N/A"); + // model->right_label = furi_string_alloc_set_str("N/A"); + // model->ok_label = furi_string_alloc_set_str("N/A"); + + model->pressed_btn = 0; + }, + true); + return subrem_view_remote; +} + +void subrem_view_remote_free(SubRemViewRemote* subghz_remote) { + furi_assert(subghz_remote); + + with_view_model( + subghz_remote->view, + SubRemViewRemoteModel * model, + { + free(model->up_label); + free(model->down_label); + free(model->left_label); + free(model->right_label); + free(model->ok_label); + + // furi_string_free(model->up_label); + // furi_string_free(model->down_label); + // furi_string_free(model->left_label); + // furi_string_free(model->right_label); + // furi_string_free(model->ok_label); + }, + true); + view_free(subghz_remote->view); + free(subghz_remote); +} + +View* subrem_view_remote_get_view(SubRemViewRemote* subrem_view_remote) { + furi_assert(subrem_view_remote); + return subrem_view_remote->view; +} \ No newline at end of file diff --git a/applications/main/subghz_remote/views/remote.h b/applications/main/subghz_remote/views/remote.h new file mode 100644 index 000000000..ea274fca4 --- /dev/null +++ b/applications/main/subghz_remote/views/remote.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include "../helpers/subrem_custom_event.h" + +typedef enum { + SubRemViewRemoteStateIdle, + SubRemViewRemoteStateLoading, + SubRemViewRemoteStateSending, +} SubRemViewRemoteState; + +typedef struct SubRemViewRemote SubRemViewRemote; + +typedef void (*SubRemViewRemoteCallback)(SubRemCustomEvent event, void* context); + +void subrem_view_remote_set_callback( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteCallback callback, + void* context); + +SubRemViewRemote* subrem_view_remote_alloc(); + +void subrem_view_remote_free(SubRemViewRemote* subrem_view_remote); + +View* subrem_view_remote_get_view(SubRemViewRemote* subrem_view_remote); + +void subrem_view_remote_add_data_to_show(SubRemViewRemote* subrem_view_remote, const char** labels); + +void subrem_view_remote_set_state( + SubRemViewRemote* subrem_view_remote, + SubRemViewRemoteState state, + uint8_t presed_btn); \ No newline at end of file diff --git a/applications/services/application.fam b/applications/services/application.fam index aec49b231..0b5009096 100644 --- a/applications/services/application.fam +++ b/applications/services/application.fam @@ -9,5 +9,6 @@ App( "desktop", "loader", "power", + "namechanger_srv", ], ) diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index 25e2017c2..bad120abc 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -8,9 +8,7 @@ #include #include #include - -#include -#include +#include #include "animations/animation_manager.h" #include "desktop/scenes/desktop_scene.h" @@ -51,6 +49,77 @@ static void desktop_dummy_mode_icon_draw_callback(Canvas* canvas, void* context) canvas_draw_icon(canvas, 0, 0, &I_GameMode_11x8); } +static void desktop_toggle_clock_view(Desktop* desktop, bool is_enabled) { + furi_assert(desktop); + + // clock type upd after 1 minute + desktop->clock_type = (locale_get_time_format() == LocaleTimeFormat24h); + + if(is_enabled) { // && !furi_timer_is_running(desktop->update_clock_timer)) { + furi_timer_start(desktop->update_clock_timer, furi_ms_to_ticks(1000)); + } else if(!is_enabled) { //&& furi_timer_is_running(desktop->update_clock_timer)) { + furi_timer_stop(desktop->update_clock_timer); + } + + view_port_enabled_set(desktop->clock_viewport, is_enabled); +} + +static uint8_t desktop_clock_get_num_w(uint8_t num) { + if(num == 1) { + return 3; + } else if(num == 4) { + return 6; + } else { + return 5; + } +} + +static const char* digit[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; + +static void desktop_clock_draw_callback(Canvas* canvas, void* context) { + furi_assert(context); + furi_assert(canvas); + + Desktop* desktop = context; + + uint8_t d[4] = { + desktop->minute % 10, + desktop->minute / 10, + desktop->hour % 10, + desktop->hour / 10, + }; + + canvas_set_font(canvas, FontPrimary); + + uint8_t new_w = desktop_clock_get_num_w(d[0]) + //c1 + desktop_clock_get_num_w(d[1]) + //c2 + desktop_clock_get_num_w(d[2]) + //c3 + desktop_clock_get_num_w(d[3]) + //c4 + 2 + 4; // ":" + 4 separators + + // further away from the battery charge indicator, if the smallest minute is 1 + view_port_set_width(desktop->clock_viewport, new_w - !(d[0] == 1)); + + uint8_t x = new_w; + + uint8_t y = 8; + uint8_t offset_r; + + canvas_draw_str_aligned(canvas, x, y, AlignRight, AlignBottom, digit[d[0]]); + offset_r = desktop_clock_get_num_w(d[0]); + + canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y, AlignRight, AlignBottom, digit[d[1]]); + offset_r = desktop_clock_get_num_w(d[1]); + + canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y - 1, AlignRight, AlignBottom, ":"); + offset_r = 2; + + canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y, AlignRight, AlignBottom, digit[d[2]]); + offset_r = desktop_clock_get_num_w(d[2]); + + canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y, AlignRight, AlignBottom, digit[d[3]]); +} + static void desktop_stealth_mode_icon_draw_callback(Canvas* canvas, void* context) { UNUSED(context); furi_assert(canvas); @@ -71,6 +140,9 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) { // TODO: Implement a message mechanism for loading settings and (optionally) // locking and unlocking DESKTOP_SETTINGS_LOAD(&desktop->settings); + + desktop_toggle_clock_view(desktop, desktop->settings.display_clock); + desktop_auto_lock_arm(desktop); return true; case DesktopGlobalAutoLock: @@ -136,6 +208,31 @@ static void desktop_auto_lock_inhibit(Desktop* desktop) { } } +static void desktop_update_clock_timer_callback(void* context) { + furi_assert(context); + Desktop* desktop = context; + + if(gui_get_count_of_enabled_view_port_in_layer(desktop->gui, GuiLayerStatusBarLeft) < 6) { + FuriHalRtcDateTime curr_dt; + furi_hal_rtc_get_datetime(&curr_dt); + + if(desktop->minute != curr_dt.minute) { + if(desktop->clock_type) { + desktop->hour = curr_dt.hour; + } else { + desktop->hour = (curr_dt.hour > 12) ? curr_dt.hour - 12 : + ((curr_dt.hour == 0) ? 12 : curr_dt.hour); + } + desktop->minute = curr_dt.minute; + view_port_update(desktop->clock_viewport); + } + + view_port_enabled_set(desktop->clock_viewport, true); + } else { + view_port_enabled_set(desktop->clock_viewport, false); + } +} + void desktop_lock(Desktop* desktop) { furi_hal_rtc_set_flag(FuriHalRtcFlagLock); @@ -150,6 +247,9 @@ void desktop_lock(Desktop* desktop) { desktop->scene_manager, DesktopSceneLocked, SCENE_LOCKED_FIRST_ENTER); scene_manager_next_scene(desktop->scene_manager, DesktopSceneLocked); notification_message(desktop->notification, &sequence_display_backlight_off_delay_1000); + + DesktopStatus status = {.locked = true}; + furi_pubsub_publish(desktop->status_pubsub, &status); } void desktop_unlock(Desktop* desktop) { @@ -168,6 +268,9 @@ void desktop_unlock(Desktop* desktop) { cli_session_open(cli, &cli_vcp); furi_record_close(RECORD_CLI); } + + DesktopStatus status = {.locked = false}; + furi_pubsub_publish(desktop->status_pubsub, &status); } void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled) { @@ -282,6 +385,13 @@ Desktop* desktop_alloc() { view_port_enabled_set(desktop->dummy_mode_icon_viewport, false); gui_add_view_port(desktop->gui, desktop->dummy_mode_icon_viewport, GuiLayerStatusBarLeft); + // Clock + desktop->clock_viewport = view_port_alloc(); + view_port_set_width(desktop->clock_viewport, 25); + view_port_draw_callback_set(desktop->clock_viewport, desktop_clock_draw_callback, desktop); + view_port_enabled_set(desktop->clock_viewport, false); + gui_add_view_port(desktop->gui, desktop->clock_viewport, GuiLayerStatusBarRight); + // Stealth mode icon desktop->stealth_mode_icon_viewport = view_port_alloc(); view_port_set_width(desktop->stealth_mode_icon_viewport, icon_get_width(&I_Muted_8x8)); @@ -311,63 +421,27 @@ Desktop* desktop_alloc() { desktop->auto_lock_timer = furi_timer_alloc(desktop_auto_lock_timer_callback, FuriTimerTypeOnce, desktop); + desktop->status_pubsub = furi_pubsub_alloc(); + + desktop->update_clock_timer = + furi_timer_alloc(desktop_update_clock_timer_callback, FuriTimerTypePeriodic, desktop); + + FuriHalRtcDateTime curr_dt; + furi_hal_rtc_get_datetime(&curr_dt); + + if(desktop->clock_type) { + desktop->hour = curr_dt.hour; + } else { + desktop->hour = (curr_dt.hour > 12) ? curr_dt.hour - 12 : + ((curr_dt.hour == 0) ? 12 : curr_dt.hour); + } + desktop->minute = curr_dt.minute; + furi_record_create(RECORD_DESKTOP, desktop); return desktop; } -void desktop_free(Desktop* desktop) { - furi_assert(desktop); - furi_check(furi_record_destroy(RECORD_DESKTOP)); - - furi_pubsub_unsubscribe( - loader_get_pubsub(desktop->loader), desktop->app_start_stop_subscription); - - if(desktop->input_events_subscription) { - furi_pubsub_unsubscribe(desktop->input_events_pubsub, desktop->input_events_subscription); - desktop->input_events_subscription = NULL; - } - - desktop->loader = NULL; - desktop->input_events_pubsub = NULL; - furi_record_close(RECORD_LOADER); - furi_record_close(RECORD_NOTIFICATION); - furi_record_close(RECORD_INPUT_EVENTS); - - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdMain); - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLockMenu); - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLocked); - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdDebug); - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdHwMismatch); - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdPinInput); - view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdPinTimeout); - - view_dispatcher_free(desktop->view_dispatcher); - scene_manager_free(desktop->scene_manager); - - animation_manager_free(desktop->animation_manager); - view_stack_free(desktop->main_view_stack); - desktop_main_free(desktop->main_view); - view_stack_free(desktop->locked_view_stack); - desktop_view_locked_free(desktop->locked_view); - desktop_lock_menu_free(desktop->lock_menu); - desktop_view_locked_free(desktop->locked_view); - desktop_debug_free(desktop->debug_view); - popup_free(desktop->hw_mismatch_popup); - desktop_view_pin_timeout_free(desktop->pin_timeout_view); - - furi_record_close(RECORD_GUI); - desktop->gui = NULL; - - furi_thread_free(desktop->scene_thread); - - furi_record_close("menu"); - - furi_timer_free(desktop->auto_lock_timer); - - free(desktop); -} - static bool desktop_check_file_flag(const char* flag_path) { Storage* storage = furi_record_open(RECORD_STORAGE); bool exists = storage_common_stat(storage, flag_path, NULL) == FSE_OK; @@ -386,6 +460,11 @@ void desktop_api_unlock(Desktop* instance) { view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopLockedEventUnlocked); } +FuriPubSub* desktop_api_get_status_pubsub(Desktop* instance) { + furi_assert(instance); + return instance->status_pubsub; +} + int32_t desktop_srv(void* p) { UNUSED(p); @@ -403,6 +482,9 @@ int32_t desktop_srv(void* p) { } view_port_enabled_set(desktop->dummy_mode_icon_viewport, desktop->settings.dummy_mode); + + desktop_toggle_clock_view(desktop, desktop->settings.display_clock); + desktop_main_set_dummy_mode_state(desktop->main_view, desktop->settings.dummy_mode); animation_manager_set_dummy_mode_state( desktop->animation_manager, desktop->settings.dummy_mode); @@ -429,28 +511,9 @@ int32_t desktop_srv(void* p) { scene_manager_next_scene(desktop->scene_manager, DesktopSceneFault); } - // I added some very bydlo kod here, and thrown some delays to make it worse, pls don't look at it, it will make you cry from laugh - if(furi_hal_rtc_get_boot_mode() == FuriHalRtcBootModeNormal) { - if(NameChanger_Init()) { - Cli* cli = furi_record_open(RECORD_CLI); - cli_session_close(cli); - furi_delay_ms(2); - cli_session_open(cli, &cli_vcp); - furi_record_close(RECORD_CLI); - - furi_delay_ms(3); - Bt* bt = furi_record_open(RECORD_BT); - if(!bt_set_profile(bt, BtProfileSerial)) { - FURI_LOG_D(TAG, "Failed to touch bluetooth to name change"); - } - furi_record_close(RECORD_BT); - bt = NULL; - furi_delay_ms(3); - } - } - view_dispatcher_run(desktop->view_dispatcher); - desktop_free(desktop); + + furi_crash("That was unexpected"); return 0; } diff --git a/applications/services/desktop/desktop.h b/applications/services/desktop/desktop.h index 5b12647b8..4eab24fcc 100644 --- a/applications/services/desktop/desktop.h +++ b/applications/services/desktop/desktop.h @@ -1,5 +1,7 @@ #pragma once +#include + typedef struct Desktop Desktop; #define RECORD_DESKTOP "desktop" @@ -7,3 +9,9 @@ typedef struct Desktop Desktop; bool desktop_api_is_locked(Desktop* instance); void desktop_api_unlock(Desktop* instance); + +typedef struct { + bool locked; +} DesktopStatus; + +FuriPubSub* desktop_api_get_status_pubsub(Desktop* instance); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index ede6bbcc3..4cac7711d 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -59,6 +59,7 @@ struct Desktop { ViewPort* lock_icon_viewport; ViewPort* dummy_mode_icon_viewport; + ViewPort* clock_viewport; ViewPort* stealth_mode_icon_viewport; AnimationManager* animation_manager; @@ -70,8 +71,14 @@ struct Desktop { FuriPubSub* input_events_pubsub; FuriPubSubSubscription* input_events_subscription; FuriTimer* auto_lock_timer; + FuriTimer* update_clock_timer; - bool in_transition; + FuriPubSub* status_pubsub; + uint8_t hour; + uint8_t minute; + bool clock_type : 1; // true - 24h false - 12h + + bool in_transition : 1; }; Desktop* desktop_alloc(); diff --git a/applications/services/desktop/desktop_settings.h b/applications/services/desktop/desktop_settings.h index e750c696c..5946873f0 100644 --- a/applications/services/desktop/desktop_settings.h +++ b/applications/services/desktop/desktop_settings.h @@ -8,7 +8,7 @@ #include #include -#define DESKTOP_SETTINGS_VER (9) +#define DESKTOP_SETTINGS_VER (10) #define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME) #define DESKTOP_SETTINGS_MAGIC (0x17) @@ -43,8 +43,6 @@ #define DISPLAY_BATTERY_RETRO_5 4 #define DISPLAY_BATTERY_BAR_PERCENT 5 -#define FAP_LOADER_APP_NAME "Applications" - typedef struct { InputKey data[MAX_PIN_SIZE]; uint8_t length; @@ -63,4 +61,5 @@ typedef struct { uint32_t auto_lock_delay_ms; uint8_t displayBatteryPercentage; uint8_t dummy_mode; + uint8_t display_clock; } DesktopSettings; diff --git a/applications/services/desktop/scenes/desktop_scene_main.c b/applications/services/desktop/scenes/desktop_scene_main.c index f504646bf..3d1b16c57 100644 --- a/applications/services/desktop/scenes/desktop_scene_main.c +++ b/applications/services/desktop/scenes/desktop_scene_main.c @@ -12,6 +12,8 @@ #define TAG "DesktopSrv" +#define FAP_LOADER_APP_NAME "Applications" + static void desktop_scene_main_new_idle_animation_callback(void* context) { furi_assert(context); Desktop* desktop = context; @@ -60,6 +62,36 @@ static void desktop_switch_to_app(Desktop* desktop, const FlipperApplication* fl } #endif +static void desktop_scene_main_open_app_or_profile(Desktop* desktop, const char* path) { + do { + LoaderStatus status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, path); + if(status == LoaderStatusOk) break; + FURI_LOG_E(TAG, "loader_start failed: %d", status); + + status = loader_start(desktop->loader, "Passport", NULL); + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } + } while(false); +} + +static void desktop_scene_main_start_favorite(Desktop* desktop, FavoriteApp* application) { + LoaderStatus status = LoaderStatusErrorInternal; + if(application->is_external) { + status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, application->name_or_path); + } else if(strlen(application->name_or_path) > 0) { + status = loader_start(desktop->loader, application->name_or_path, NULL); + } else { + // No favourite app is set! So we skipping this part + return; + //status = loader_start(desktop->loader, FAP_LOADER_APP_NAME, NULL); + } + + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } +} + void desktop_scene_main_callback(DesktopEvent event, void* context) { Desktop* desktop = (Desktop*)context; if(desktop->in_transition) return; @@ -130,59 +162,17 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) { case DesktopMainEventOpenFavoritePrimary: DESKTOP_SETTINGS_LOAD(&desktop->settings); - if(desktop->settings.favorite_primary.is_external) { - LoaderStatus status = loader_start( - desktop->loader, - FAP_LOADER_APP_NAME, - desktop->settings.favorite_primary.name_or_path); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } - } else { - LoaderStatus status = loader_start( - desktop->loader, desktop->settings.favorite_primary.name_or_path, NULL); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } - } + desktop_scene_main_start_favorite(desktop, &desktop->settings.favorite_primary); consumed = true; break; case DesktopMainEventOpenFavoriteSecondary: DESKTOP_SETTINGS_LOAD(&desktop->settings); - if(desktop->settings.favorite_secondary.is_external) { - LoaderStatus status = loader_start( - desktop->loader, - FAP_LOADER_APP_NAME, - desktop->settings.favorite_secondary.name_or_path); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } - } else { - LoaderStatus status = loader_start( - desktop->loader, desktop->settings.favorite_secondary.name_or_path, NULL); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } - } + desktop_scene_main_start_favorite(desktop, &desktop->settings.favorite_secondary); consumed = true; break; case DesktopMainEventOpenFavoriteTertiary: DESKTOP_SETTINGS_LOAD(&desktop->settings); - if(desktop->settings.favorite_tertiary.is_external) { - LoaderStatus status = loader_start( - desktop->loader, - FAP_LOADER_APP_NAME, - desktop->settings.favorite_tertiary.name_or_path); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } - } else { - LoaderStatus status = loader_start( - desktop->loader, desktop->settings.favorite_tertiary.name_or_path, NULL); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } - } + desktop_scene_main_start_favorite(desktop, &desktop->settings.favorite_tertiary); consumed = true; break; case DesktopAnimationEventCheckAnimation: @@ -210,51 +200,28 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) { break; } case DesktopMainEventOpenGameMenu: { - LoaderStatus status = loader_start( - desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Snake.fap")); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } + desktop_scene_main_open_app_or_profile(desktop, EXT_PATH("/apps/Games/Snake.fap")); break; } case DesktopMainEventOpenTetris: { - LoaderStatus status = loader_start( - desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Tetris.fap")); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } + desktop_scene_main_open_app_or_profile(desktop, EXT_PATH("/apps/Games/Tetris.fap")); break; } case DesktopMainEventOpenArkanoid: { - LoaderStatus status = loader_start( - desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Arkanoid.fap")); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } + desktop_scene_main_open_app_or_profile(desktop, EXT_PATH("/apps/Games/Arkanoid.fap")); break; } case DesktopMainEventOpenDOOM: { - LoaderStatus status = loader_start( - desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/DOOM.fap")); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } + desktop_scene_main_open_app_or_profile(desktop, EXT_PATH("/apps/Games/DOOM.fap")); break; } case DesktopMainEventOpenZombiez: { - LoaderStatus status = loader_start( - desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Zombiez.fap")); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } + desktop_scene_main_open_app_or_profile(desktop, EXT_PATH("/apps/Games/Zombiez.fap")); break; } case DesktopMainEventOpenHeap: { - LoaderStatus status = loader_start( - desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/heap_defence.fap")); - if(status != LoaderStatusOk) { - FURI_LOG_E(TAG, "loader_start failed: %d", status); - } + desktop_scene_main_open_app_or_profile( + desktop, EXT_PATH("/apps/Games/heap_defence.fap")); break; } case DesktopLockedEventUpdate: diff --git a/applications/services/dolphin/dolphin.c b/applications/services/dolphin/dolphin.c index dd8b7105f..93a9b3095 100644 --- a/applications/services/dolphin/dolphin.c +++ b/applications/services/dolphin/dolphin.c @@ -89,15 +89,6 @@ Dolphin* dolphin_alloc() { return dolphin; } -void dolphin_free(Dolphin* dolphin) { - furi_assert(dolphin); - - dolphin_state_free(dolphin->state); - furi_message_queue_free(dolphin->event_queue); - - free(dolphin); -} - void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event) { furi_assert(dolphin); furi_assert(event); @@ -204,7 +195,7 @@ int32_t dolphin_srv(void* p) { } } - dolphin_free(dolphin); + furi_crash("That was unexpected"); return 0; } diff --git a/applications/services/dolphin/dolphin_i.h b/applications/services/dolphin/dolphin_i.h index 4bb0df08e..ceeff1e1a 100644 --- a/applications/services/dolphin/dolphin_i.h +++ b/applications/services/dolphin/dolphin_i.h @@ -37,8 +37,6 @@ struct Dolphin { Dolphin* dolphin_alloc(); -void dolphin_free(Dolphin* dolphin); - void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event); void dolphin_event_send_wait(Dolphin* dolphin, DolphinEvent* event); diff --git a/applications/services/gui/application.fam b/applications/services/gui/application.fam index 193b9dfd3..869d964dd 100644 --- a/applications/services/gui/application.fam +++ b/applications/services/gui/application.fam @@ -14,7 +14,6 @@ App( "gui.h", "icon_i.h", "elements.h", - "canvas_i.h", "view_dispatcher.h", "view_stack.h", "modules/button_menu.h", diff --git a/applications/services/gui/canvas.c b/applications/services/gui/canvas.c index 057bd3e95..0786e8486 100644 --- a/applications/services/gui/canvas.c +++ b/applications/services/gui/canvas.c @@ -100,6 +100,11 @@ uint8_t canvas_current_font_height(const Canvas* canvas) { return font_height; } +uint8_t canvas_current_font_width(const Canvas* canvas) { + furi_assert(canvas); + return (uint8_t)u8g2_GetMaxCharWidth(&canvas->fb); +} + const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font font) { furi_assert(canvas); furi_assert(font < FontTotalNumber); diff --git a/applications/services/gui/canvas.h b/applications/services/gui/canvas.h index 9d8cf607f..7a2ae1873 100644 --- a/applications/services/gui/canvas.h +++ b/applications/services/gui/canvas.h @@ -120,6 +120,14 @@ uint8_t canvas_height(const Canvas* canvas); */ uint8_t canvas_current_font_height(const Canvas* canvas); +/** Get current font width + * + * @param canvas Canvas instance + * + * @return width in pixels. + */ +uint8_t canvas_current_font_width(const Canvas* canvas); + /** Get font parameters * * @param canvas Canvas instance diff --git a/applications/services/gui/gui.c b/applications/services/gui/gui.c index 392011620..87cc962ca 100644 --- a/applications/services/gui/gui.c +++ b/applications/services/gui/gui.c @@ -17,6 +17,23 @@ ViewPort* gui_view_port_find_enabled(ViewPortArray_t array) { return NULL; } +uint8_t gui_get_count_of_enabled_view_port_in_layer(Gui* gui, GuiLayer layer) { + furi_assert(gui); + furi_check(layer < GuiLayerMAX); + uint8_t ret = 0; + + ViewPortArray_it_t it; + ViewPortArray_it_last(it, gui->layers[layer]); + while(!ViewPortArray_end_p(it)) { + ViewPort* view_port = *ViewPortArray_ref(it); + if(view_port_is_enabled(view_port)) { + ret++; + } + ViewPortArray_previous(it); + } + return ret; +} + void gui_update(Gui* gui) { furi_assert(gui); if(!gui->direct_draw) furi_thread_flags_set(gui->thread_id, GUI_THREAD_FLAG_DRAW); diff --git a/applications/services/gui/gui.h b/applications/services/gui/gui.h index 1b5987eda..a59a4ff6a 100644 --- a/applications/services/gui/gui.h +++ b/applications/services/gui/gui.h @@ -132,6 +132,8 @@ Canvas* gui_direct_draw_acquire(Gui* gui); */ void gui_direct_draw_release(Gui* gui); +uint8_t gui_get_count_of_enabled_view_port_in_layer(Gui* gui, GuiLayer layer); + #ifdef __cplusplus } #endif diff --git a/applications/services/namechanger/application.fam b/applications/services/namechanger/application.fam new file mode 100644 index 000000000..0eaeab987 --- /dev/null +++ b/applications/services/namechanger/application.fam @@ -0,0 +1,8 @@ +App( + appid="namechanger_srv", + apptype=FlipperAppType.STARTUP, + entry_point="namechanger_on_system_start", + requires=["storage", "cli", "bt"], + conflicts=["updater"], + order=600, +) \ No newline at end of file diff --git a/applications/services/namechanger/namechanger.c b/applications/services/namechanger/namechanger.c new file mode 100644 index 000000000..796dd2d3b --- /dev/null +++ b/applications/services/namechanger/namechanger.c @@ -0,0 +1,111 @@ +#include "namechanger.h" +#include +#include +#include +#include +#include +#include +#include + +#define TAG "NameChanger" + +static bool namechanger_init() { + Storage* storage = furi_record_open(RECORD_STORAGE); + + // Kostil + velosiped = top ficha + uint8_t timeout = 0; + while(timeout < 11) { + if(storage_sd_status(storage) == FSE_OK) break; + furi_delay_ms(250); + timeout++; + /*if(timeout == 10) { + // Failed to init namechanger, SD card not ready + furi_record_close(RECORD_STORAGE); + return false; + }*/ + } + + FuriString* str = furi_string_alloc(); + FlipperFormat* file = flipper_format_file_alloc(storage); + + bool res = false; + + do { + uint32_t version; + if(!flipper_format_file_open_existing(file, NAMECHANGER_PATH)) break; + if(!flipper_format_read_header(file, str, &version)) break; + if(furi_string_cmp_str(str, NAMECHANGER_HEADER)) break; + if(version != NAMECHANGER_VERSION) break; + + if(!flipper_format_read_string(file, "Name", str)) break; + // Check for size + size_t temp_string_size = furi_string_size(str); + if(temp_string_size > (size_t)8) break; + if(temp_string_size < (size_t)2) break; + + // Check for forbidden characters + const char* name_ptr = furi_string_get_cstr(str); + bool chars_check_failed = false; + + for(; *name_ptr; ++name_ptr) { + const char c = *name_ptr; + if((c < '0' || c > '9') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) { + chars_check_failed = true; + break; + } + } + + if(chars_check_failed) break; + + // If all checks was good we can set the name + version_set_custom_name(NULL, strdup(furi_string_get_cstr(str))); + furi_hal_version_set_name(version_get_custom_name(NULL)); + + res = true; + } while(false); + + flipper_format_free(file); + furi_record_close(RECORD_STORAGE); + furi_string_free(str); + + return res; +} + +int32_t namechanger_on_system_start(void* p) { + UNUSED(p); + if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) { + return 0; + } + + // Wait for all required services to start and create their records + uint8_t timeout = 0; + while(!furi_record_exists(RECORD_CLI) || !furi_record_exists(RECORD_BT) || + !furi_record_exists(RECORD_STORAGE)) { + timeout++; + if(timeout > 250) { + return 0; + } + furi_delay_ms(5); + } + + // Hehe bad code now here, bad bad bad, very bad, bad example, dont take it, make it better + + if(namechanger_init()) { + Cli* cli = furi_record_open(RECORD_CLI); + cli_session_close(cli); + furi_delay_ms(2); // why i added delays here + cli_session_open(cli, &cli_vcp); + furi_record_close(RECORD_CLI); + + furi_delay_ms(3); + Bt* bt = furi_record_open(RECORD_BT); + if(!bt_set_profile(bt, BtProfileSerial)) { + //FURI_LOG_D(TAG, "Failed to touch bluetooth to name change"); + } + furi_record_close(RECORD_BT); + bt = NULL; + furi_delay_ms(3); + } + + return 0; +} \ No newline at end of file diff --git a/applications/services/namechanger/namechanger.h b/applications/services/namechanger/namechanger.h new file mode 100644 index 000000000..dac1b7952 --- /dev/null +++ b/applications/services/namechanger/namechanger.h @@ -0,0 +1,5 @@ +#pragma once + +#define NAMECHANGER_HEADER "Flipper Name File" +#define NAMECHANGER_VERSION 1 +#define NAMECHANGER_PATH EXT_PATH("dolphin/name.settings") diff --git a/applications/services/power/power_service/power.c b/applications/services/power/power_service/power.c index e61776060..a495e5d6c 100644 --- a/applications/services/power/power_service/power.c +++ b/applications/services/power/power_service/power.c @@ -268,30 +268,6 @@ Power* power_alloc() { return power; } -void power_free(Power* power) { - furi_assert(power); - - // Gui - view_dispatcher_remove_view(power->view_dispatcher, PowerViewOff); - power_off_free(power->power_off); - view_dispatcher_remove_view(power->view_dispatcher, PowerViewUnplugUsb); - power_unplug_usb_free(power->power_unplug_usb); - - view_port_free(power->battery_view_port); - - // State - furi_mutex_free(power->api_mtx); - - // FuriPubSub - furi_pubsub_free(power->event_pubsub); - - // Records - furi_record_close(RECORD_NOTIFICATION); - furi_record_close(RECORD_GUI); - - free(power); -} - static void power_check_charging_state(Power* power) { if(furi_hal_power_is_charging()) { if((power->info.charge == 100) || (furi_hal_power_is_charging_done())) { @@ -454,7 +430,7 @@ int32_t power_srv(void* p) { furi_delay_ms(1000); } - power_free(power); + furi_crash("That was unexpected"); return 0; } diff --git a/applications/services/rpc/rpc_desktop.c b/applications/services/rpc/rpc_desktop.c index dbf9796ec..0d72b43d5 100644 --- a/applications/services/rpc/rpc_desktop.c +++ b/applications/services/rpc/rpc_desktop.c @@ -8,6 +8,8 @@ typedef struct { RpcSession* session; Desktop* desktop; + FuriPubSub* status_pubsub; + FuriPubSubSubscription* status_subscription; } RpcDesktop; static void rpc_desktop_on_is_locked_request(const PB_Main* request, void* context) { @@ -39,11 +41,63 @@ static void rpc_desktop_on_unlock_request(const PB_Main* request, void* context) rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_OK); } +static void rpc_desktop_on_desktop_pubsub(const void* message, void* context) { + RpcDesktop* rpc_desktop = context; + RpcSession* session = rpc_desktop->session; + const DesktopStatus* status = message; + + PB_Main rpc_message = { + .command_id = 0, + .command_status = PB_CommandStatus_OK, + .has_next = false, + .which_content = PB_Main_desktop_status_tag, + .content.desktop_status.locked = status->locked, + }; + rpc_send_and_release(session, &rpc_message); +} + +static void rpc_desktop_on_status_subscribe_request(const PB_Main* request, void* context) { + furi_assert(request); + furi_assert(context); + furi_assert(request->which_content == PB_Main_desktop_status_subscribe_request_tag); + + FURI_LOG_D(TAG, "StatusSubscribeRequest"); + RpcDesktop* rpc_desktop = context; + RpcSession* session = rpc_desktop->session; + + if(rpc_desktop->status_subscription) { + rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_ERROR); + } else { + rpc_desktop->status_subscription = furi_pubsub_subscribe( + rpc_desktop->status_pubsub, rpc_desktop_on_desktop_pubsub, rpc_desktop); + rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_OK); + } +} + +static void rpc_desktop_on_status_unsubscribe_request(const PB_Main* request, void* context) { + furi_assert(request); + furi_assert(context); + furi_assert(request->which_content == PB_Main_desktop_status_unsubscribe_request_tag); + + FURI_LOG_D(TAG, "StatusUnsubscribeRequest"); + RpcDesktop* rpc_desktop = context; + RpcSession* session = rpc_desktop->session; + + if(rpc_desktop->status_subscription) { + furi_pubsub_unsubscribe(rpc_desktop->status_pubsub, rpc_desktop->status_subscription); + rpc_desktop->status_subscription = NULL; + rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_OK); + } else { + rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_ERROR); + } +} + void* rpc_desktop_alloc(RpcSession* session) { furi_assert(session); RpcDesktop* rpc_desktop = malloc(sizeof(RpcDesktop)); rpc_desktop->desktop = furi_record_open(RECORD_DESKTOP); + rpc_desktop->status_pubsub = desktop_api_get_status_pubsub(rpc_desktop->desktop); rpc_desktop->session = session; RpcHandler rpc_handler = { @@ -58,6 +112,12 @@ void* rpc_desktop_alloc(RpcSession* session) { rpc_handler.message_handler = rpc_desktop_on_unlock_request; rpc_add_handler(session, PB_Main_desktop_unlock_request_tag, &rpc_handler); + rpc_handler.message_handler = rpc_desktop_on_status_subscribe_request; + rpc_add_handler(session, PB_Main_desktop_status_subscribe_request_tag, &rpc_handler); + + rpc_handler.message_handler = rpc_desktop_on_status_unsubscribe_request; + rpc_add_handler(session, PB_Main_desktop_status_unsubscribe_request_tag, &rpc_handler); + return rpc_desktop; } @@ -65,6 +125,10 @@ void rpc_desktop_free(void* context) { furi_assert(context); RpcDesktop* rpc_desktop = context; + if(rpc_desktop->status_subscription) { + furi_pubsub_unsubscribe(rpc_desktop->status_pubsub, rpc_desktop->status_subscription); + } + furi_assert(rpc_desktop->desktop); furi_record_close(RECORD_DESKTOP); diff --git a/applications/services/storage/storage.h b/applications/services/storage/storage.h index 5991e765f..bcd1d0df6 100644 --- a/applications/services/storage/storage.h +++ b/applications/services/storage/storage.h @@ -226,7 +226,7 @@ FS_Error storage_common_stat(Storage* storage, const char* path, FileInfo* filei */ FS_Error storage_common_remove(Storage* storage, const char* path); -/** Renames file/directory, file/directory must not be open +/** Renames file/directory, file/directory must not be open. Will overwrite existing file. * @param app pointer to the api * @param old_path old path * @param new_path new path diff --git a/applications/services/storage/storage_external_api.c b/applications/services/storage/storage_external_api.c index bf474bc9d..5fcaa5921 100644 --- a/applications/services/storage/storage_external_api.c +++ b/applications/services/storage/storage_external_api.c @@ -422,12 +422,27 @@ 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) { - FS_Error error = storage_common_copy(storage, old_path, new_path); - if(error == FSE_OK) { + FS_Error error; + + do { + if(!storage_common_exists(storage, old_path)) { + error = FSE_INVALID_NAME; + break; + } + + if(storage_file_exists(storage, new_path)) { + storage_common_remove(storage, new_path); + } + + error = storage_common_copy(storage, old_path, new_path); + if(error != FSE_OK) { + break; + } + if(!storage_simply_remove_recursive(storage, old_path)) { error = FSE_INTERNAL; } - } + } while(false); return error; } diff --git a/applications/settings/desktop_settings/desktop_settings_app.c b/applications/settings/desktop_settings/desktop_settings_app.c index 317d57654..7e04271f2 100644 --- a/applications/settings/desktop_settings/desktop_settings_app.c +++ b/applications/settings/desktop_settings/desktop_settings_app.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include 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 c014c97f7..25bab6dd6 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_favorite.c @@ -5,6 +5,9 @@ #include #include +#define EXTERNAL_APPLICATION_NAME ("[External Application]") +#define EXTERNAL_APPLICATION_INDEX (FLIPPER_APPS_COUNT + 1) + static bool favorite_fap_selector_item_callback( FuriString* file_path, void* context, @@ -44,6 +47,20 @@ void desktop_settings_scene_favorite_on_enter(void* context) { uint32_t primary_favorite = scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite); uint32_t pre_select_item = 0; + FavoriteApp* curr_favorite_app = NULL; + if(primary_favorite == 0) { + curr_favorite_app = &app->settings.favorite_primary; + } else if(primary_favorite == 1) { + curr_favorite_app = &app->settings.favorite_secondary; + } else if(primary_favorite == 2) { + curr_favorite_app = &app->settings.favorite_tertiary; + } else { + curr_favorite_app = &app->settings.favorite_primary; + } + if(curr_favorite_app == NULL) { + // This should not happen! + return; + } for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) { submenu_add_item( @@ -53,30 +70,29 @@ void desktop_settings_scene_favorite_on_enter(void* context) { desktop_settings_scene_favorite_submenu_callback, app); - if(primary_favorite == 0) { // Select favorite item in submenu - if((app->settings.favorite_primary.is_external && - !strcmp(FLIPPER_APPS[i].name, FAP_LOADER_APP_NAME)) || - (!strcmp(FLIPPER_APPS[i].name, app->settings.favorite_primary.name_or_path))) { - pre_select_item = i; - } - } else if(primary_favorite == 1) { - if((app->settings.favorite_secondary.is_external && - !strcmp(FLIPPER_APPS[i].name, FAP_LOADER_APP_NAME)) || - (!strcmp(FLIPPER_APPS[i].name, app->settings.favorite_secondary.name_or_path))) { - pre_select_item = i; - } - } else if(primary_favorite == 2) { - if((app->settings.favorite_tertiary.is_external && - !strcmp(FLIPPER_APPS[i].name, FAP_LOADER_APP_NAME)) || - (!strcmp(FLIPPER_APPS[i].name, app->settings.favorite_tertiary.name_or_path))) { - pre_select_item = i; - } + // Select favorite item in submenu + if(!curr_favorite_app->is_external && + !strcmp(FLIPPER_APPS[i].name, curr_favorite_app->name_or_path)) { + pre_select_item = i; } } + +#ifdef APP_FAP_LOADER + submenu_add_item( + submenu, + EXTERNAL_APPLICATION_NAME, + EXTERNAL_APPLICATION_INDEX, + desktop_settings_scene_favorite_submenu_callback, + app); + if(curr_favorite_app->is_external) { + pre_select_item = EXTERNAL_APPLICATION_INDEX; + } +#endif + submenu_add_item( submenu, "None (disable)", - FLIPPER_APPS_COUNT + 1, + FLIPPER_APPS_COUNT + 2, desktop_settings_scene_favorite_submenu_callback, app); @@ -99,46 +115,24 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e uint32_t primary_favorite = scene_manager_get_scene_state(app->scene_manager, DesktopSettingsAppSceneFavorite); + FavoriteApp* curr_favorite_app = NULL; + if(primary_favorite == 0) { + curr_favorite_app = &app->settings.favorite_primary; + } else if(primary_favorite == 1) { + curr_favorite_app = &app->settings.favorite_secondary; + } else if(primary_favorite == 2) { + curr_favorite_app = &app->settings.favorite_tertiary; + } else { + curr_favorite_app = &app->settings.favorite_primary; + } + if(curr_favorite_app == NULL) { + // This should not happen! + furi_string_free(temp_path); + return consumed; + } if(event.type == SceneManagerEventTypeCustom) { - if(event.event >= (FLIPPER_APPS_COUNT + 1)) { - if(primary_favorite == 0) { - app->settings.favorite_primary.is_external = false; - strncpy(app->settings.favorite_primary.name_or_path, "", MAX_APP_LENGTH); - } else if(primary_favorite == 1) { - app->settings.favorite_secondary.is_external = false; - strncpy(app->settings.favorite_secondary.name_or_path, "", MAX_APP_LENGTH); - } else if(primary_favorite == 2) { - app->settings.favorite_tertiary.is_external = false; - strncpy(app->settings.favorite_tertiary.name_or_path, "", MAX_APP_LENGTH); - } - - scene_manager_previous_scene(app->scene_manager); - consumed = true; - furi_string_free(temp_path); - return consumed; - } - if(strcmp(FLIPPER_APPS[event.event].name, FAP_LOADER_APP_NAME) != 0) { - if(primary_favorite == 0) { - app->settings.favorite_primary.is_external = false; - strncpy( - app->settings.favorite_primary.name_or_path, - FLIPPER_APPS[event.event].name, - MAX_APP_LENGTH); - } else if(primary_favorite == 1) { - app->settings.favorite_secondary.is_external = false; - strncpy( - app->settings.favorite_secondary.name_or_path, - FLIPPER_APPS[event.event].name, - MAX_APP_LENGTH); - } else if(primary_favorite == 2) { - app->settings.favorite_tertiary.is_external = false; - strncpy( - app->settings.favorite_tertiary.name_or_path, - FLIPPER_APPS[event.event].name, - MAX_APP_LENGTH); - } - } else { + if(event.event == EXTERNAL_APPLICATION_INDEX) { const DialogsFileBrowserOptions browser_options = { .extension = ".fap", .icon = &I_unknown_10px, @@ -149,47 +143,29 @@ bool desktop_settings_scene_favorite_on_event(void* context, SceneManagerEvent e .base_path = EXT_PATH("apps"), }; - if(primary_favorite == 0) { // Select favorite fap in file browser - if(favorite_fap_selector_file_exists( - app->settings.favorite_primary.name_or_path)) { - furi_string_set_str(temp_path, app->settings.favorite_primary.name_or_path); - } - } else if(primary_favorite == 1) { - if(favorite_fap_selector_file_exists( - app->settings.favorite_secondary.name_or_path)) { - furi_string_set_str(temp_path, app->settings.favorite_secondary.name_or_path); - } - } else if(primary_favorite == 2) { - if(favorite_fap_selector_file_exists( - app->settings.favorite_tertiary.name_or_path)) { - furi_string_set_str(temp_path, app->settings.favorite_tertiary.name_or_path); - } + // Select favorite fap in file browser + if(favorite_fap_selector_file_exists(curr_favorite_app->name_or_path)) { + furi_string_set_str(temp_path, curr_favorite_app->name_or_path); } - submenu_reset(app->submenu); if(dialog_file_browser_show(app->dialogs, temp_path, temp_path, &browser_options)) { - if(primary_favorite == 0) { - app->settings.favorite_primary.is_external = true; - strncpy( - app->settings.favorite_primary.name_or_path, - furi_string_get_cstr(temp_path), - MAX_APP_LENGTH); - } else if(primary_favorite == 1) { - app->settings.favorite_secondary.is_external = true; - strncpy( - app->settings.favorite_secondary.name_or_path, - furi_string_get_cstr(temp_path), - MAX_APP_LENGTH); - } else if(primary_favorite == 2) { - app->settings.favorite_tertiary.is_external = true; - strncpy( - app->settings.favorite_tertiary.name_or_path, - furi_string_get_cstr(temp_path), - MAX_APP_LENGTH); - } + submenu_reset(app->submenu); // Prevent menu from being shown when we exiting scene + curr_favorite_app->is_external = true; + strncpy( + curr_favorite_app->name_or_path, + furi_string_get_cstr(temp_path), + MAX_APP_LENGTH); + consumed = true; } + } else { + curr_favorite_app->is_external = false; + strncpy( + curr_favorite_app->name_or_path, FLIPPER_APPS[event.event].name, MAX_APP_LENGTH); + consumed = true; } - scene_manager_previous_scene(app->scene_manager); + if(consumed) { + scene_manager_previous_scene(app->scene_manager); + }; consumed = true; } diff --git a/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c b/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c index 9d63f6628..43e86cdc6 100644 --- a/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c +++ b/applications/settings/desktop_settings/scenes/desktop_settings_scene_start.c @@ -11,7 +11,8 @@ #define SCENE_EVENT_SELECT_PIN_SETUP 3 #define SCENE_EVENT_SELECT_AUTO_LOCK_DELAY 4 #define SCENE_EVENT_SELECT_BATTERY_DISPLAY 5 -#define SCENE_EVENT_SELECT_CHANGE_NAME 6 +#define SCENE_EVENT_SELECT_CLOCK_DISPLAY 6 +#define SCENE_EVENT_SELECT_CHANGE_NAME 7 #define AUTO_LOCK_DELAY_COUNT 9 const char* const auto_lock_delay_text[AUTO_LOCK_DELAY_COUNT] = { @@ -29,6 +30,14 @@ const char* const auto_lock_delay_text[AUTO_LOCK_DELAY_COUNT] = { const uint32_t auto_lock_delay_value[AUTO_LOCK_DELAY_COUNT] = {0, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000}; +#define CLOCK_ENABLE_COUNT 2 +const char* const clock_enable_text[CLOCK_ENABLE_COUNT] = { + "OFF", + "ON", +}; + +const uint32_t clock_enable_value[CLOCK_ENABLE_COUNT] = {0, 1}; + #define BATTERY_VIEW_COUNT 6 const char* const battery_view_count_text[BATTERY_VIEW_COUNT] = @@ -55,6 +64,14 @@ static void desktop_settings_scene_start_battery_view_changed(VariableItem* item app->settings.displayBatteryPercentage = index; } +static void desktop_settings_scene_start_clock_enable_changed(VariableItem* item) { + DesktopSettingsApp* app = variable_item_get_context(item); + uint8_t index = variable_item_get_current_value_index(item); + + variable_item_set_current_value_text(item, clock_enable_text[index]); + app->settings.display_clock = index; +} + static void desktop_settings_scene_start_auto_lock_delay_changed(VariableItem* item) { DesktopSettingsApp* app = variable_item_get_context(item); uint8_t index = variable_item_get_current_value_index(item); @@ -106,6 +123,18 @@ void desktop_settings_scene_start_on_enter(void* context) { variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_text(item, battery_view_count_text[value_index]); + item = variable_item_list_add( + variable_item_list, + "Show Clock", + CLOCK_ENABLE_COUNT, + desktop_settings_scene_start_clock_enable_changed, // + app); + + value_index = + value_index_uint32(app->settings.display_clock, clock_enable_value, CLOCK_ENABLE_COUNT); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, clock_enable_text[value_index]); + variable_item_list_add(variable_item_list, "Change Flipper Name", 0, NULL, app); view_dispatcher_switch_to_view(app->view_dispatcher, DesktopSettingsAppViewVarItemList); @@ -142,6 +171,9 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even case SCENE_EVENT_SELECT_BATTERY_DISPLAY: consumed = true; break; + case SCENE_EVENT_SELECT_CLOCK_DISPLAY: + consumed = true; + break; case SCENE_EVENT_SELECT_CHANGE_NAME: scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneChangeName); consumed = true; diff --git a/assets/protobuf b/assets/protobuf index a13c5ddd0..f71c4b7f7 160000 --- a/assets/protobuf +++ b/assets/protobuf @@ -1 +1 @@ -Subproject commit a13c5ddd0397511bd4c6de4afdd1031a5b6f5bca +Subproject commit f71c4b7f750f2539a1fed08925d8da3abdc80ff9 diff --git a/documentation/SubGHzRemotePlugin.md b/documentation/SubGHzRemotePlugin.md index fd48eeca2..cbdc0995b 100644 --- a/documentation/SubGHzRemotePlugin.md +++ b/documentation/SubGHzRemotePlugin.md @@ -1,11 +1,21 @@ # Sub-GHz Remote + +# UPDATE!!!!!! +## Now you can create and edit map files directly on flipper, go into Applications->Sub-GHz->Remote Maker + +
+
+
+ + ### The SubGHz Remote Tool *requires* the creation of custom user map with `.txt` extension in the `subghz_remote` folder on the sdcard. #### If these files are not exist or not configured properly, **you will receive an error each time you try to select wrong file in the UniRF Tool**. ## You can add as many `.txt` map files as you want, file name doesn't matter! + ## Incorrect or unconfigured file error If the `.txt` file has not been properly configured, the following error will be thrown when trying to run the UniRF Remix app: diff --git a/firmware/targets/f18/api_symbols.csv b/firmware/targets/f18/api_symbols.csv index ee1ae1154..68248a6d2 100644 --- a/firmware/targets/f18/api_symbols.csv +++ b/firmware/targets/f18/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,26.3,, +Version,+,27.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -129,6 +129,7 @@ Header,+,lib/one_wire/maxim_crc.h,, Header,+,lib/one_wire/one_wire_host.h,, Header,+,lib/one_wire/one_wire_slave.h,, Header,+,lib/print/wrappers.h,, +Header,+,lib/pulse_reader/pulse_reader.h,, Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_adc.h,, Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_bus.h,, Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_comp.h,, @@ -156,7 +157,7 @@ Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_tim.h,, Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_usart.h,, Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_utils.h,, Header,+,lib/stm32wb_hal/Inc/stm32wbxx_ll_wwdg.h,, -Header,+,lib/pulse_reader/pulse_reader.h,, +Header,+,lib/toolbox/api_lock.h,, Header,+,lib/toolbox/args.h,, Header,+,lib/toolbox/crc32_calc.h,, Header,+,lib/toolbox/dir_walk.h,, diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 84d0beda8..ae38d0c84 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,11 +1,10 @@ entry,status,name,type,params -Version,+,26.3,, +Version,+,27.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, Header,+,applications/services/dialogs/dialogs.h,, Header,+,applications/services/dolphin/dolphin.h,, -Header,+,applications/services/gui/canvas_i.h,, Header,+,applications/services/gui/elements.h,, Header,+,applications/services/gui/gui.h,, Header,+,applications/services/gui/icon_i.h,, @@ -192,6 +191,7 @@ Header,+,lib/subghz/subghz_setting.h,, Header,+,lib/subghz/subghz_tx_rx_worker.h,, Header,+,lib/subghz/subghz_worker.h,, Header,+,lib/subghz/transmitter.h,, +Header,+,lib/toolbox/api_lock.h,, Header,+,lib/toolbox/args.h,, Header,+,lib/toolbox/crc32_calc.h,, Header,+,lib/toolbox/dir_walk.h,, @@ -213,7 +213,6 @@ Header,+,lib/toolbox/stream/string_stream.h,, Header,+,lib/toolbox/tar/tar_archive.h,, Header,+,lib/toolbox/value_index.h,, Header,+,lib/toolbox/version.h,, -Header,+,lib/u8g2/u8g2.h,, Function,-,LL_ADC_CommonDeInit,ErrorStatus,ADC_Common_TypeDef* Function,-,LL_ADC_CommonInit,ErrorStatus,"ADC_Common_TypeDef*, const LL_ADC_CommonInitTypeDef*" Function,-,LL_ADC_CommonStructInit,void,LL_ADC_CommonInitTypeDef* @@ -632,6 +631,7 @@ 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_current_font_width,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" @@ -649,17 +649,10 @@ Function,+,canvas_draw_rframe,void,"Canvas*, 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_u8g2_bitmap,void,"u8g2_t*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*, uint8_t" Function,+,canvas_draw_xbm,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" -Function,-,canvas_frame_set,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,-,canvas_free,void,Canvas* -Function,+,canvas_get_buffer,uint8_t*,Canvas* -Function,+,canvas_get_buffer_size,size_t,const Canvas* Function,+,canvas_get_font_params,const CanvasFontParameters*,"const Canvas*, Font" -Function,-,canvas_get_orientation,CanvasOrientation,const Canvas* Function,+,canvas_glyph_width,uint8_t,"Canvas*, char" Function,+,canvas_height,uint8_t,const Canvas* -Function,-,canvas_init,Canvas*, Function,+,canvas_invert_color,void,Canvas* Function,+,canvas_reset,void,Canvas* Function,+,canvas_set_bitmap_mode,void,"Canvas*, _Bool" @@ -667,7 +660,6 @@ Function,+,canvas_set_color,void,"Canvas*, Color" 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_set_orientation,void,"Canvas*, CanvasOrientation" Function,+,canvas_string_width,uint16_t,"Canvas*, const char*" Function,+,canvas_width,uint8_t,const Canvas* Function,-,cbrt,double,double @@ -716,13 +708,6 @@ Function,+,composite_api_resolver_add,void,"CompositeApiResolver*, const ElfApiI Function,+,composite_api_resolver_alloc,CompositeApiResolver*, Function,+,composite_api_resolver_free,void,CompositeApiResolver* Function,+,composite_api_resolver_get,const ElfApiInterface*,CompositeApiResolver* -Function,-,compress_alloc,Compress*,uint16_t -Function,-,compress_decode,_Bool,"Compress*, uint8_t*, size_t, uint8_t*, size_t, size_t*" -Function,-,compress_encode,_Bool,"Compress*, uint8_t*, size_t, uint8_t*, size_t, size_t*" -Function,-,compress_free,void,Compress* -Function,-,compress_icon_alloc,CompressIcon*, -Function,-,compress_icon_decode,void,"CompressIcon*, const uint8_t*, uint8_t**" -Function,-,compress_icon_free,void,CompressIcon* Function,-,copysign,double,"double, double" Function,-,copysignf,float,"float, float" Function,-,copysignl,long double,"long double, long double" @@ -1048,12 +1033,12 @@ Function,+,furi_hal_bt_change_app,_Bool,"FuriHalBtProfile, GapEventCallback, voi Function,+,furi_hal_bt_clear_white_list,_Bool, Function,+,furi_hal_bt_dump_state,void,FuriString* Function,+,furi_hal_bt_ensure_c2_mode,_Bool,BleGlueC2Mode -Function,+,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t* +Function,-,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t* Function,-,furi_hal_bt_get_hardfault_info,const FuriHalBtHardfaultInfo*, Function,+,furi_hal_bt_get_key_storage_buff,void,"uint8_t**, uint16_t*" Function,+,furi_hal_bt_get_profile_adv_name,const char*,FuriHalBtProfile Function,+,furi_hal_bt_get_profile_mac_addr,const uint8_t*,FuriHalBtProfile -Function,+,furi_hal_bt_get_profile_pairing_method,GapPairing,FuriHalBtProfile +Function,-,furi_hal_bt_get_profile_pairing_method,GapPairing,FuriHalBtProfile Function,+,furi_hal_bt_get_radio_stack,FuriHalBtStack, Function,+,furi_hal_bt_get_rssi,float, Function,+,furi_hal_bt_get_transmitted_packets,uint32_t, @@ -1416,7 +1401,7 @@ Function,+,furi_hal_subghz_get_rssi,float, Function,+,furi_hal_subghz_get_timestamp_file_names,_Bool, Function,+,furi_hal_subghz_idle,void, Function,-,furi_hal_subghz_init,void, -Function,+,furi_hal_subghz_init_check,_Bool, +Function,-,furi_hal_subghz_init_check,_Bool, Function,+,furi_hal_subghz_init_radio_type,_Bool,SubGhzRadioType Function,+,furi_hal_subghz_is_async_tx_complete,_Bool, Function,+,furi_hal_subghz_is_frequency_valid,_Bool,uint32_t @@ -1436,8 +1421,8 @@ Function,+,furi_hal_subghz_set_external_power_disable,void,_Bool Function,+,furi_hal_subghz_set_frequency,uint32_t,uint32_t Function,+,furi_hal_subghz_set_frequency_and_path,uint32_t,uint32_t Function,+,furi_hal_subghz_set_path,void,FuriHalSubGhzPath -Function,+,furi_hal_subghz_set_rolling_counter_mult,void,uint8_t -Function,+,furi_hal_subghz_set_timestamp_file_names,void,_Bool +Function,-,furi_hal_subghz_set_rolling_counter_mult,void,uint8_t +Function,-,furi_hal_subghz_set_timestamp_file_names,void,_Bool Function,-,furi_hal_subghz_shutdown,void, Function,+,furi_hal_subghz_sleep,void, Function,+,furi_hal_subghz_start_async_rx,void,"FuriHalSubGhzCaptureCallback, void*" @@ -1654,7 +1639,7 @@ Function,-,gamma,double,double Function,-,gamma_r,double,"double, int*" Function,-,gammaf,float,float Function,-,gammaf_r,float,"float, int*" -Function,+,gap_get_remote_conn_rssi,uint32_t,int8_t* +Function,-,gap_get_remote_conn_rssi,uint32_t,int8_t* Function,-,gap_get_state,GapState, Function,-,gap_init,_Bool,"GapConfig*, GapEventCallback, void*" Function,-,gap_start_advertising,void, @@ -1674,6 +1659,7 @@ Function,+,gui_add_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, voi Function,+,gui_add_view_port,void,"Gui*, ViewPort*, GuiLayer" Function,+,gui_direct_draw_acquire,Canvas*,Gui* Function,+,gui_direct_draw_release,void,Gui* +Function,-,gui_get_count_of_enabled_view_port_in_layer,uint8_t,"Gui*, GuiLayer" Function,+,gui_get_framebuffer_size,size_t,const Gui* Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*" Function,+,gui_remove_view_port,void,"Gui*, ViewPort*" @@ -1775,7 +1761,7 @@ Function,+,infrared_worker_rx_set_received_signal_callback,void,"InfraredWorker* Function,+,infrared_worker_rx_start,void,InfraredWorker* Function,+,infrared_worker_rx_stop,void,InfraredWorker* Function,+,infrared_worker_set_decoded_signal,void,"InfraredWorker*, const InfraredMessage*" -Function,+,infrared_worker_set_raw_signal,void,"InfraredWorker*, const uint32_t*, size_t" +Function,+,infrared_worker_set_raw_signal,void,"InfraredWorker*, const uint32_t*, size_t, uint32_t, float" Function,+,infrared_worker_signal_is_decoded,_Bool,const InfraredWorkerSignal* Function,+,infrared_worker_tx_get_signal_steady_callback,InfraredWorkerGetSignalResponse,"void*, InfraredWorker*" Function,+,infrared_worker_tx_set_get_signal_callback,void,"InfraredWorker*, InfraredWorkerGetSignalCallback, void*" @@ -2075,6 +2061,7 @@ Function,-,mf_df_prepare_read_records,uint16_t,"uint8_t*, uint8_t, uint32_t, uin Function,-,mf_df_prepare_select_application,uint16_t,"uint8_t*, uint8_t[3]" Function,-,mf_df_read_card,_Bool,"FuriHalNfcTxRxContext*, MifareDesfireData*" Function,-,mf_ul_check_card_type,_Bool,"uint8_t, uint8_t, uint8_t" +Function,-,mf_ul_emulation_supported,_Bool,MfUltralightData* Function,-,mf_ul_is_full_capture,_Bool,MfUltralightData* Function,-,mf_ul_prepare_emulation,void,"MfUltralightEmulator*, MfUltralightData*" Function,-,mf_ul_prepare_emulation_response,_Bool,"uint8_t*, uint16_t, uint8_t*, uint16_t*, uint32_t*, void*" @@ -2229,7 +2216,7 @@ Function,+,power_get_pubsub,FuriPubSub*,Power* Function,+,power_is_battery_healthy,_Bool,Power* Function,+,power_off,void,Power* Function,+,power_reboot,void,PowerBootMode -Function,+,power_trigger_ui_update,void,Power* +Function,-,power_trigger_ui_update,void,Power* Function,+,powf,float,"float, float" Function,-,powl,long double,"long double, long double" Function,+,pretty_format_bytes_hex_canonical,void,"FuriString*, size_t, const char*, const uint8_t*, size_t" @@ -2531,7 +2518,7 @@ Function,-,select,int,"int, fd_set*, fd_set*, fd_set*, timeval*" Function,-,serial_svc_is_started,_Bool, Function,-,serial_svc_notify_buffer_is_empty,void, Function,-,serial_svc_set_callbacks,void,"uint16_t, SerialServiceEventCallback, void*" -Function,+,serial_svc_set_rpc_status,void,SerialServiceRpcStatus +Function,-,serial_svc_set_rpc_status,void,SerialServiceRpcStatus Function,-,serial_svc_start,void, Function,-,serial_svc_stop,void, Function,-,serial_svc_update_tx,_Bool,"uint8_t*, uint16_t" @@ -3036,13 +3023,13 @@ Function,-,subghz_protocol_decoder_power_smart_get_hash_data,uint8_t,void* Function,-,subghz_protocol_decoder_power_smart_get_string,void,"void*, FuriString*" Function,-,subghz_protocol_decoder_power_smart_reset,void,void* Function,-,subghz_protocol_decoder_power_smart_serialize,SubGhzProtocolStatus,"void*, FlipperFormat*, SubGhzRadioPreset*" -Function,+,subghz_protocol_decoder_princeton_alloc,void*,SubGhzEnvironment* +Function,-,subghz_protocol_decoder_princeton_alloc,void*,SubGhzEnvironment* Function,-,subghz_protocol_decoder_princeton_deserialize,SubGhzProtocolStatus,"void*, FlipperFormat*" -Function,+,subghz_protocol_decoder_princeton_feed,void,"void*, _Bool, uint32_t" -Function,+,subghz_protocol_decoder_princeton_free,void,void* -Function,+,subghz_protocol_decoder_princeton_get_hash_data,uint8_t,void* -Function,+,subghz_protocol_decoder_princeton_get_string,void,"void*, FuriString*" -Function,+,subghz_protocol_decoder_princeton_reset,void,void* +Function,-,subghz_protocol_decoder_princeton_feed,void,"void*, _Bool, uint32_t" +Function,-,subghz_protocol_decoder_princeton_free,void,void* +Function,-,subghz_protocol_decoder_princeton_get_hash_data,uint8_t,void* +Function,-,subghz_protocol_decoder_princeton_get_string,void,"void*, FuriString*" +Function,-,subghz_protocol_decoder_princeton_reset,void,void* Function,-,subghz_protocol_decoder_princeton_serialize,SubGhzProtocolStatus,"void*, FlipperFormat*, SubGhzRadioPreset*" Function,+,subghz_protocol_decoder_raw_alloc,void*,SubGhzEnvironment* Function,+,subghz_protocol_decoder_raw_deserialize,SubGhzProtocolStatus,"void*, FlipperFormat*" @@ -3261,11 +3248,11 @@ Function,-,subghz_protocol_encoder_power_smart_deserialize,SubGhzProtocolStatus, Function,-,subghz_protocol_encoder_power_smart_free,void,void* Function,-,subghz_protocol_encoder_power_smart_stop,void,void* Function,-,subghz_protocol_encoder_power_smart_yield,LevelDuration,void* -Function,+,subghz_protocol_encoder_princeton_alloc,void*,SubGhzEnvironment* +Function,-,subghz_protocol_encoder_princeton_alloc,void*,SubGhzEnvironment* Function,-,subghz_protocol_encoder_princeton_deserialize,SubGhzProtocolStatus,"void*, FlipperFormat*" -Function,+,subghz_protocol_encoder_princeton_free,void,void* -Function,+,subghz_protocol_encoder_princeton_stop,void,void* -Function,+,subghz_protocol_encoder_princeton_yield,LevelDuration,void* +Function,-,subghz_protocol_encoder_princeton_free,void,void* +Function,-,subghz_protocol_encoder_princeton_stop,void,void* +Function,-,subghz_protocol_encoder_princeton_yield,LevelDuration,void* Function,+,subghz_protocol_encoder_raw_alloc,void*,SubGhzEnvironment* Function,+,subghz_protocol_encoder_raw_deserialize,SubGhzProtocolStatus,"void*, FlipperFormat*" Function,+,subghz_protocol_encoder_raw_free,void,void* @@ -3419,7 +3406,6 @@ Function,+,text_input_set_header_text,void,"TextInput*, const char*" Function,+,text_input_set_minimum_length,void,"TextInput*, size_t" Function,+,text_input_set_result_callback,void,"TextInput*, TextInputCallback, void*, char*, size_t, _Bool" Function,+,text_input_set_validator,void,"TextInput*, TextInputValidatorCallback, void*" -Function,-,tga_save,void,const char* Function,-,tgamma,double,double Function,-,tgammaf,float,float Function,-,tgammal,long double,long double @@ -3443,1060 +3429,6 @@ Function,-,trunc,double,double Function,-,truncf,float,float Function,-,truncl,long double,long double Function,-,tzset,void, -Function,-,u8g2_AddPolygonXY,void,"u8g2_t*, int16_t, int16_t" -Function,-,u8g2_ClearBuffer,void,u8g2_t* -Function,-,u8g2_ClearDisplay,void,u8g2_t* -Function,-,u8g2_ClearPolygonXY,void, -Function,-,u8g2_DrawBitmap,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, const uint8_t*" -Function,-,u8g2_DrawBox,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawCircle,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_DrawDisc,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_DrawEllipse,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_DrawExtUTF8,u8g2_uint_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, uint8_t, const uint16_t*, const char*" -Function,-,u8g2_DrawExtendedUTF8,u8g2_uint_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, uint8_t, u8g2_kerning_t*, const char*" -Function,-,u8g2_DrawFilledEllipse,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_DrawFrame,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawGlyph,u8g2_uint_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, uint16_t" -Function,+,u8g2_DrawHLine,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawHVLine,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_DrawHorizontalBitmap,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, const uint8_t*" -Function,-,u8g2_DrawLine,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawLog,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8log_t*" -Function,-,u8g2_DrawPixel,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawPolygon,void,u8g2_t* -Function,-,u8g2_DrawRBox,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawRFrame,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawStr,u8g2_uint_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, const char*" -Function,-,u8g2_DrawTriangle,void,"u8g2_t*, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t" -Function,-,u8g2_DrawUTF8,u8g2_uint_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, const char*" -Function,-,u8g2_DrawUTF8Line,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, const char*, uint8_t, uint8_t" -Function,-,u8g2_DrawUTF8Lines,u8g2_uint_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, const char*" -Function,-,u8g2_DrawVLine,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_DrawXBM,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, const uint8_t*" -Function,-,u8g2_DrawXBMP,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, const uint8_t*" -Function,-,u8g2_FirstPage,void,u8g2_t* -Function,-,u8g2_GetFontSize,size_t,const uint8_t* -Function,-,u8g2_GetGlyphWidth,int8_t,"u8g2_t*, uint16_t" -Function,-,u8g2_GetKerning,uint8_t,"u8g2_t*, u8g2_kerning_t*, uint16_t, uint16_t" -Function,-,u8g2_GetKerningByTable,uint8_t,"u8g2_t*, const uint16_t*, uint16_t, uint16_t" -Function,-,u8g2_GetStrWidth,u8g2_long_t,"u8g2_t*, const char*" -Function,-,u8g2_GetStrX,int8_t,"u8g2_t*, const char*" -Function,-,u8g2_GetUTF8Width,u8g2_uint_t,"u8g2_t*, const char*" -Function,-,u8g2_IsAllValidUTF8,uint8_t,"u8g2_t*, const char*" -Function,-,u8g2_IsGlyph,uint8_t,"u8g2_t*, uint16_t" -Function,-,u8g2_IsIntersection,uint8_t,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_NextPage,uint8_t,u8g2_t* -Function,-,u8g2_SendBuffer,void,u8g2_t* -Function,-,u8g2_SendF,void,"u8g2_t*, const char*, ..." -Function,-,u8g2_SetBitmapMode,void,"u8g2_t*, uint8_t" -Function,-,u8g2_SetBufferCurrTileRow,void,"u8g2_t*, uint8_t" -Function,-,u8g2_SetClipWindow,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t" -Function,-,u8g2_SetDisplayRotation,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_SetDrawColor,void,"u8g2_t*, uint8_t" -Function,+,u8g2_SetFont,void,"u8g2_t*, const uint8_t*" -Function,-,u8g2_SetFontDirection,void,"u8g2_t*, uint8_t" -Function,-,u8g2_SetFontMode,void,"u8g2_t*, uint8_t" -Function,-,u8g2_SetFontPosBaseline,void,u8g2_t* -Function,-,u8g2_SetFontPosBottom,void,u8g2_t* -Function,-,u8g2_SetFontPosCenter,void,u8g2_t* -Function,-,u8g2_SetFontPosTop,void,u8g2_t* -Function,-,u8g2_SetFontRefHeightAll,void,u8g2_t* -Function,-,u8g2_SetFontRefHeightExtendedText,void,u8g2_t* -Function,-,u8g2_SetFontRefHeightText,void,u8g2_t* -Function,-,u8g2_SetMaxClipWindow,void,u8g2_t* -Function,-,u8g2_SetupBitmap,void,"u8g2_t*, const u8g2_cb_t*, uint16_t, uint16_t" -Function,-,u8g2_SetupBuffer,void,"u8g2_t*, uint8_t*, uint8_t, u8g2_draw_ll_hvline_cb, const u8g2_cb_t*" -Function,-,u8g2_SetupBuffer_SDL_128x64,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_SetupBuffer_SDL_128x64_1,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_SetupBuffer_SDL_128x64_4,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_SetupBuffer_TGA_DESC,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_SetupBuffer_TGA_LCD,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_SetupBuffer_Utf8,void,"u8g2_t*, const u8g2_cb_t*" -Function,-,u8g2_Setup_a2printer_384x240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_a2printer_384x240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_a2printer_384x240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_hx1230_96x68_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_hx1230_96x68_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_hx1230_96x68_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_il3820_296x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_il3820_296x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_il3820_296x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_il3820_v2_296x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_il3820_v2_296x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_il3820_v2_296x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ist3020_erc19264_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ist3020_erc19264_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ist3020_erc19264_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ist7920_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ist7920_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ist7920_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ks0108_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ks0108_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ks0108_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ks0108_erm19264_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ks0108_erm19264_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ks0108_erm19264_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_160x160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_160x160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_160x160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_160x80_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_160x80_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_160x80_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_240x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_240x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_240x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_240x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_240x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_lc7981_240x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ld7032_60x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ld7032_60x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ld7032_60x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ld7032_i2c_60x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ld7032_i2c_60x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ld7032_i2c_60x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls013b7dh03_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls013b7dh03_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls013b7dh03_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls013b7dh05_144x168_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls013b7dh05_144x168_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls013b7dh05_144x168_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls027b7dh01_400x240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls027b7dh01_400x240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ls027b7dh01_400x240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_32x8_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_32x8_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_32x8_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_64x8_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_64x8_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_64x8_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_8x8_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_8x8_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_max7219_8x8_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_nt7534_tg12864r_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_nt7534_tg12864r_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_nt7534_tg12864r_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_null,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_pcd8544_84x48_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_pcd8544_84x48_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_pcd8544_84x48_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_pcf8812_96x65_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_pcf8812_96x65_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_pcf8812_96x65_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ra8835_320x240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ra8835_320x240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ra8835_320x240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ra8835_nhd_240x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ra8835_nhd_240x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ra8835_nhd_240x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sbn1661_122x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sbn1661_122x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sbn1661_122x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sed1330_240x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sed1330_240x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sed1330_240x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sed1520_122x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sed1520_122x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sed1520_122x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_vcomh0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_vcomh0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_vcomh0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_winstar_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_winstar_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_128x64_winstar_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_64x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_64x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_64x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_72x40_wise_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_72x40_wise_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_72x40_wise_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_vcomh0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_vcomh0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_vcomh0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_winstar_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_winstar_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_128x64_winstar_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_64x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_64x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_64x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_72x40_wise_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_72x40_wise_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1106_i2c_72x40_wise_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_64x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_64x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_64x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_64x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_64x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_64x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_pimoroni_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_pimoroni_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_pimoroni_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_seeed_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_seeed_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_seeed_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_seeed_96x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_seeed_96x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_i2c_seeed_96x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_pimoroni_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_pimoroni_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_pimoroni_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_seeed_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_seeed_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_seeed_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_seeed_96x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_seeed_96x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1107_seeed_96x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1108_160x160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1108_160x160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1108_160x160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1108_i2c_160x160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1108_i2c_160x160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1108_i2c_160x160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1122_256x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1122_256x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1122_256x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1122_i2c_256x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1122_i2c_256x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_sh1122_i2c_256x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd0323_i2c_os128064_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd0323_i2c_os128064_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd0323_i2c_os128064_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd0323_os128064_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd0323_os128064_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd0323_os128064_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x32_adafruit_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x32_adafruit_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x32_adafruit_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x32_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x32_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x32_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x64_adafruit_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x64_adafruit_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_128x64_adafruit_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x32_adafruit_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x32_adafruit_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x32_adafruit_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x32_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x32_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x32_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x64_adafruit_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x64_adafruit_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1305_i2c_128x64_adafruit_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x32_univision_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x32_univision_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x32_univision_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x32_winstar_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x32_winstar_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x32_winstar_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_alt0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_alt0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_alt0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_vcomh0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_vcomh0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_128x64_vcomh0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_48x64_winstar_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_48x64_winstar_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_48x64_winstar_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x32_1f_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x32_1f_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x32_1f_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x32_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x32_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x32_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x48_er_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x48_er_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_64x48_er_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_72x40_er_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_72x40_er_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_72x40_er_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_96x16_er_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_96x16_er_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_96x16_er_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x32_univision_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x32_univision_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x32_univision_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x32_winstar_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x32_winstar_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x32_winstar_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_alt0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_alt0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_alt0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_vcomh0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_vcomh0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_128x64_vcomh0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_48x64_winstar_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_48x64_winstar_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_48x64_winstar_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x32_1f_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x32_1f_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x32_1f_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x32_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x32_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x32_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x48_er_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x48_er_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_64x48_er_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_72x40_er_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_72x40_er_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_72x40_er_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_96x16_er_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_96x16_er_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1306_i2c_96x16_er_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_128x64_noname0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_128x64_noname0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_128x64_noname0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_128x64_noname2_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_128x64_noname2_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_128x64_noname2_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_i2c_128x64_noname0_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_i2c_128x64_noname0_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_i2c_128x64_noname0_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_i2c_128x64_noname2_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_i2c_128x64_noname2_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1309_i2c_128x64_noname2_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1316_128x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1316_128x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1316_128x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1316_i2c_128x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1316_i2c_128x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1316_i2c_128x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1317_96x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1317_96x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1317_96x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1317_i2c_96x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1317_i2c_96x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1317_i2c_96x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_128x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_128x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_128x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_128x96_xcp_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_128x96_xcp_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_128x96_xcp_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_i2c_128x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_i2c_128x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_i2c_128x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_i2c_128x96_xcp_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_i2c_128x96_xcp_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1318_i2c_128x96_xcp_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1322_nhd_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1322_nhd_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1322_nhd_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1322_nhd_256x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1322_nhd_256x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1322_nhd_256x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1325_i2c_nhd_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1325_i2c_nhd_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1325_i2c_nhd_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1325_nhd_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1325_nhd_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1325_nhd_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1326_er_256x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1326_er_256x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1326_er_256x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1326_i2c_er_256x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1326_i2c_er_256x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1326_i2c_er_256x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ea_w128128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ea_w128128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ea_w128128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ea_w128128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ea_w128128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ea_w128128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_midas_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_midas_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_midas_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_seeed_96x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_seeed_96x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_seeed_96x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_visionox_128x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_visionox_128x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_visionox_128x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ws_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ws_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ws_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ws_96x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ws_96x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_i2c_ws_96x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_midas_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_midas_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_midas_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_seeed_96x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_seeed_96x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_seeed_96x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_visionox_128x96_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_visionox_128x96_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_visionox_128x96_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ws_128x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ws_128x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ws_128x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ws_96x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ws_96x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1327_ws_96x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1329_128x96_noname_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1329_128x96_noname_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1329_128x96_noname_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1606_172x72_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1606_172x72_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1606_172x72_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_200x200_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_200x200_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_200x200_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_gd_200x200_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_gd_200x200_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_gd_200x200_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_ws_200x200_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_ws_200x200_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_ssd1607_ws_200x200_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7511_avd_320x240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7511_avd_320x240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7511_avd_320x240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx172104_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx172104_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx172104_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx19296_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx19296_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx19296_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx240160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx240160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx240160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160_alt_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160_alt_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160_alt_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160m_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160m_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx256160m_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx25664_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx25664_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_jlx25664_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_wo256x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_wo256x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_i2c_wo256x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx172104_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx172104_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx172104_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx19296_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx19296_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx19296_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx240160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx240160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx240160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160_alt_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160_alt_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160_alt_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160m_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160m_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx256160m_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx25664_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx25664_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_jlx25664_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_wo256x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_wo256x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75256_wo256x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7528_i2c_nhd_c160100_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7528_i2c_nhd_c160100_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7528_i2c_nhd_c160100_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7528_nhd_c160100_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7528_nhd_c160100_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7528_nhd_c160100_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75320_i2c_jlx320240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75320_i2c_jlx320240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75320_i2c_jlx320240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75320_jlx320240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75320_jlx320240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st75320_jlx320240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_64128n_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_64128n_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_64128n_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_ea_dogm128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_ea_dogm128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_ea_dogm128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_ea_dogm132_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_ea_dogm132_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_ea_dogm132_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_erc12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_erc12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_erc12864_alt_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_erc12864_alt_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_erc12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_jlx12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_jlx12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_jlx12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lm6059_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lm6059_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lm6059_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lm6063_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lm6063_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lm6063_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lx12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lx12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_lx12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_nhd_c12832_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_nhd_c12832_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_nhd_c12832_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_nhd_c12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_nhd_c12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_nhd_c12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_zolen_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_zolen_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7565_zolen_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_64x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_64x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_64x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_enh_dg128064_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_enh_dg128064_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_enh_dg128064_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_enh_dg128064i_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_enh_dg128064i_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_enh_dg128064i_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_i2c_64x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_i2c_64x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_i2c_64x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_jlx12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_jlx12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_jlx12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_os12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_os12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_os12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_pi_132x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_pi_132x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7567_pi_132x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7586s_erc240160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7586s_erc240160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7586s_erc240160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7586s_s028hn118a_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7586s_s028hn118a_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7586s_s028hn118a_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7588_i2c_jlx12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7588_i2c_jlx12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7588_i2c_jlx12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7588_jlx12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7588_jlx12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7588_jlx12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_192x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_192x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_192x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_p_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_p_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_p_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_p_192x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_p_192x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_p_192x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_s_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_s_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_s_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_s_192x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_s_192x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_st7920_s_192x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_128x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_128x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_128x64_alt_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_128x64_alt_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_128x64_alt_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_128x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_160x80_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_160x80_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_160x80_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_240x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_240x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_240x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_240x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_240x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_240x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_256x64_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_256x64_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_t6963_256x64_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1601_128x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1601_128x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1601_128x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1601_i2c_128x32_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1601_i2c_128x32_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1601_i2c_128x32_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1604_i2c_jlx19264_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1604_i2c_jlx19264_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1604_i2c_jlx19264_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1604_jlx19264_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1604_jlx19264_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1604_jlx19264_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_240x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_240x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_240x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_erc240120_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_erc240120_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_erc240120_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_erc24064_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_erc24064_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_erc24064_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_240x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_240x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_240x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_erc240120_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_erc240120_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_erc240120_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_erc24064_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_erc24064_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1608_i2c_erc24064_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1610_ea_dogxl160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1610_ea_dogxl160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1610_ea_dogxl160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1610_i2c_ea_dogxl160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1610_i2c_ea_dogxl160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1610_i2c_ea_dogxl160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_cg160160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_cg160160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_cg160160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ea_dogm240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ea_dogm240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ea_dogm240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ea_dogxl240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ea_dogxl240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ea_dogxl240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ew50850_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ew50850_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_ew50850_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_cg160160_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_cg160160_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_cg160160_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ea_dogm240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ea_dogm240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ea_dogm240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ea_dogxl240_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ea_dogxl240_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ea_dogxl240_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ew50850_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ew50850_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1611_i2c_ew50850_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1638_160x128_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1638_160x128_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1638_160x128_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1701_ea_dogs102_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1701_ea_dogs102_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1701_ea_dogs102_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1701_mini12864_1,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1701_mini12864_2,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_Setup_uc1701_mini12864_f,void,"u8g2_t*, const u8g2_cb_t*, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8g2_UpdateDisplay,void,u8g2_t* -Function,-,u8g2_UpdateDisplayArea,void,"u8g2_t*, uint8_t, uint8_t, uint8_t, uint8_t" -Function,-,u8g2_UserInterfaceInputValue,uint8_t,"u8g2_t*, const char*, const char*, uint8_t*, uint8_t, uint8_t, uint8_t, const char*" -Function,-,u8g2_UserInterfaceMessage,uint8_t,"u8g2_t*, const char*, const char*, const char*, const char*" -Function,-,u8g2_UserInterfaceSelectionList,uint8_t,"u8g2_t*, const char*, uint8_t, const char*" -Function,-,u8g2_WriteBufferPBM,void,"u8g2_t*, void (*)(const char*)" -Function,-,u8g2_WriteBufferPBM2,void,"u8g2_t*, void (*)(const char*)" -Function,-,u8g2_WriteBufferXBM,void,"u8g2_t*, void (*)(const char*)" -Function,-,u8g2_WriteBufferXBM2,void,"u8g2_t*, void (*)(const char*)" -Function,-,u8g2_add_vector_x,u8g2_uint_t,"u8g2_uint_t, int8_t, int8_t, uint8_t" -Function,-,u8g2_add_vector_y,u8g2_uint_t,"u8g2_uint_t, int8_t, int8_t, uint8_t" -Function,-,u8g2_draw_l90_r0,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_ll_hvline_horizontal_right_lsb,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_ll_hvline_vertical_top_lsb,void,"u8g2_t*, u8g2_uint_t, u8g2_uint_t, u8g2_uint_t, uint8_t" -Function,-,u8g2_m_11_6_1,uint8_t*,uint8_t* -Function,-,u8g2_m_11_6_2,uint8_t*,uint8_t* -Function,-,u8g2_m_11_6_f,uint8_t*,uint8_t* -Function,-,u8g2_m_12_12_1,uint8_t*,uint8_t* -Function,-,u8g2_m_12_12_2,uint8_t*,uint8_t* -Function,-,u8g2_m_12_12_f,uint8_t*,uint8_t* -Function,-,u8g2_m_12_2_1,uint8_t*,uint8_t* -Function,-,u8g2_m_12_2_2,uint8_t*,uint8_t* -Function,-,u8g2_m_12_2_f,uint8_t*,uint8_t* -Function,-,u8g2_m_12_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_12_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_12_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_12_9_1,uint8_t*,uint8_t* -Function,-,u8g2_m_12_9_2,uint8_t*,uint8_t* -Function,-,u8g2_m_12_9_f,uint8_t*,uint8_t* -Function,-,u8g2_m_13_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_13_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_13_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_16_12_1,uint8_t*,uint8_t* -Function,-,u8g2_m_16_12_2,uint8_t*,uint8_t* -Function,-,u8g2_m_16_12_f,uint8_t*,uint8_t* -Function,-,u8g2_m_16_16_1,uint8_t*,uint8_t* -Function,-,u8g2_m_16_16_2,uint8_t*,uint8_t* -Function,-,u8g2_m_16_16_f,uint8_t*,uint8_t* -Function,-,u8g2_m_16_4_1,uint8_t*,uint8_t* -Function,-,u8g2_m_16_4_2,uint8_t*,uint8_t* -Function,-,u8g2_m_16_4_f,uint8_t*,uint8_t* -Function,-,u8g2_m_16_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_16_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_16_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_17_4_1,uint8_t*,uint8_t* -Function,-,u8g2_m_17_4_2,uint8_t*,uint8_t* -Function,-,u8g2_m_17_4_f,uint8_t*,uint8_t* -Function,-,u8g2_m_17_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_17_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_17_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_18_21_1,uint8_t*,uint8_t* -Function,-,u8g2_m_18_21_2,uint8_t*,uint8_t* -Function,-,u8g2_m_18_21_f,uint8_t*,uint8_t* -Function,-,u8g2_m_1_1_1,uint8_t*,uint8_t* -Function,-,u8g2_m_1_1_2,uint8_t*,uint8_t* -Function,-,u8g2_m_1_1_f,uint8_t*,uint8_t* -Function,-,u8g2_m_20_10_1,uint8_t*,uint8_t* -Function,-,u8g2_m_20_10_2,uint8_t*,uint8_t* -Function,-,u8g2_m_20_10_f,uint8_t*,uint8_t* -Function,-,u8g2_m_20_13_1,uint8_t*,uint8_t* -Function,-,u8g2_m_20_13_2,uint8_t*,uint8_t* -Function,-,u8g2_m_20_13_f,uint8_t*,uint8_t* -Function,-,u8g2_m_20_16_1,uint8_t*,uint8_t* -Function,-,u8g2_m_20_16_2,uint8_t*,uint8_t* -Function,-,u8g2_m_20_16_f,uint8_t*,uint8_t* -Function,-,u8g2_m_20_20_1,uint8_t*,uint8_t* -Function,-,u8g2_m_20_20_2,uint8_t*,uint8_t* -Function,-,u8g2_m_20_20_f,uint8_t*,uint8_t* -Function,-,u8g2_m_22_13_1,uint8_t*,uint8_t* -Function,-,u8g2_m_22_13_2,uint8_t*,uint8_t* -Function,-,u8g2_m_22_13_f,uint8_t*,uint8_t* -Function,-,u8g2_m_22_9_1,uint8_t*,uint8_t* -Function,-,u8g2_m_22_9_2,uint8_t*,uint8_t* -Function,-,u8g2_m_22_9_f,uint8_t*,uint8_t* -Function,-,u8g2_m_24_12_1,uint8_t*,uint8_t* -Function,-,u8g2_m_24_12_2,uint8_t*,uint8_t* -Function,-,u8g2_m_24_12_f,uint8_t*,uint8_t* -Function,-,u8g2_m_24_4_1,uint8_t*,uint8_t* -Function,-,u8g2_m_24_4_2,uint8_t*,uint8_t* -Function,-,u8g2_m_24_4_f,uint8_t*,uint8_t* -Function,-,u8g2_m_24_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_24_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_24_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_25_25_1,uint8_t*,uint8_t* -Function,-,u8g2_m_25_25_2,uint8_t*,uint8_t* -Function,-,u8g2_m_25_25_f,uint8_t*,uint8_t* -Function,-,u8g2_m_30_15_1,uint8_t*,uint8_t* -Function,-,u8g2_m_30_15_2,uint8_t*,uint8_t* -Function,-,u8g2_m_30_15_f,uint8_t*,uint8_t* -Function,-,u8g2_m_30_16_1,uint8_t*,uint8_t* -Function,-,u8g2_m_30_16_2,uint8_t*,uint8_t* -Function,-,u8g2_m_30_16_f,uint8_t*,uint8_t* -Function,-,u8g2_m_30_20_1,uint8_t*,uint8_t* -Function,-,u8g2_m_30_20_2,uint8_t*,uint8_t* -Function,-,u8g2_m_30_20_f,uint8_t*,uint8_t* -Function,-,u8g2_m_30_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_30_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_30_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_32_16_1,uint8_t*,uint8_t* -Function,-,u8g2_m_32_16_2,uint8_t*,uint8_t* -Function,-,u8g2_m_32_16_f,uint8_t*,uint8_t* -Function,-,u8g2_m_32_20_1,uint8_t*,uint8_t* -Function,-,u8g2_m_32_20_2,uint8_t*,uint8_t* -Function,-,u8g2_m_32_20_f,uint8_t*,uint8_t* -Function,-,u8g2_m_32_4_1,uint8_t*,uint8_t* -Function,-,u8g2_m_32_4_2,uint8_t*,uint8_t* -Function,-,u8g2_m_32_4_f,uint8_t*,uint8_t* -Function,-,u8g2_m_32_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_32_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_32_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_37_16_1,uint8_t*,uint8_t* -Function,-,u8g2_m_37_16_2,uint8_t*,uint8_t* -Function,-,u8g2_m_37_16_f,uint8_t*,uint8_t* -Function,-,u8g2_m_40_30_1,uint8_t*,uint8_t* -Function,-,u8g2_m_40_30_2,uint8_t*,uint8_t* -Function,-,u8g2_m_40_30_f,uint8_t*,uint8_t* -Function,-,u8g2_m_48_17_1,uint8_t*,uint8_t* -Function,-,u8g2_m_48_17_2,uint8_t*,uint8_t* -Function,-,u8g2_m_48_17_f,uint8_t*,uint8_t* -Function,-,u8g2_m_48_30_1,uint8_t*,uint8_t* -Function,-,u8g2_m_48_30_2,uint8_t*,uint8_t* -Function,-,u8g2_m_48_30_f,uint8_t*,uint8_t* -Function,-,u8g2_m_4_1_1,uint8_t*,uint8_t* -Function,-,u8g2_m_4_1_2,uint8_t*,uint8_t* -Function,-,u8g2_m_4_1_f,uint8_t*,uint8_t* -Function,-,u8g2_m_50_30_1,uint8_t*,uint8_t* -Function,-,u8g2_m_50_30_2,uint8_t*,uint8_t* -Function,-,u8g2_m_50_30_f,uint8_t*,uint8_t* -Function,-,u8g2_m_6_8_1,uint8_t*,uint8_t* -Function,-,u8g2_m_6_8_2,uint8_t*,uint8_t* -Function,-,u8g2_m_6_8_f,uint8_t*,uint8_t* -Function,-,u8g2_m_8_16_1,uint8_t*,uint8_t* -Function,-,u8g2_m_8_16_2,uint8_t*,uint8_t* -Function,-,u8g2_m_8_16_f,uint8_t*,uint8_t* -Function,-,u8g2_m_8_1_1,uint8_t*,uint8_t* -Function,-,u8g2_m_8_1_2,uint8_t*,uint8_t* -Function,-,u8g2_m_8_1_f,uint8_t*,uint8_t* -Function,-,u8g2_m_8_4_1,uint8_t*,uint8_t* -Function,-,u8g2_m_8_4_2,uint8_t*,uint8_t* -Function,-,u8g2_m_8_4_f,uint8_t*,uint8_t* -Function,-,u8g2_m_8_6_1,uint8_t*,uint8_t* -Function,-,u8g2_m_8_6_2,uint8_t*,uint8_t* -Function,-,u8g2_m_8_6_f,uint8_t*,uint8_t* -Function,-,u8g2_m_9_5_1,uint8_t*,uint8_t* -Function,-,u8g2_m_9_5_2,uint8_t*,uint8_t* -Function,-,u8g2_m_9_5_f,uint8_t*,uint8_t* -Function,-,u8g_sdl_get_key,int, -Function,-,u8log_Init,void,"u8log_t*, uint8_t, uint8_t, uint8_t*" -Function,-,u8log_SetCallback,void,"u8log_t*, u8log_cb, void*" -Function,-,u8log_SetLineHeightOffset,void,"u8log_t*, int8_t" -Function,-,u8log_SetRedrawMode,void,"u8log_t*, uint8_t" -Function,-,u8log_WriteChar,void,"u8log_t*, uint8_t" -Function,-,u8log_WriteDec16,void,"u8log_t*, uint16_t, uint8_t" -Function,-,u8log_WriteDec8,void,"u8log_t*, uint8_t, uint8_t" -Function,-,u8log_WriteHex16,void,"u8log_t*, uint16_t" -Function,-,u8log_WriteHex32,void,"u8log_t*, uint32_t" -Function,-,u8log_WriteHex8,void,"u8log_t*, uint8_t" -Function,-,u8log_WriteString,void,"u8log_t*, const char*" -Function,-,u8log_u8g2_cb,void,u8log_t* -Function,-,u8log_u8x8_cb,void,u8log_t* -Function,-,u8sl_Next,void,u8sl_t* -Function,-,u8sl_Prev,void,u8sl_t* -Function,-,u8x8_ClearDisplay,void,u8x8_t* -Function,-,u8x8_ClearDisplayWithTile,void,"u8x8_t*, const uint8_t*" -Function,-,u8x8_ClearLine,void,"u8x8_t*, uint8_t" -Function,-,u8x8_ConnectBitmapToU8x8,uint8_t,u8x8_t* -Function,-,u8x8_CopyStringLine,void,"char*, uint8_t, const char*" -Function,-,u8x8_Draw1x2Glyph,void,"u8x8_t*, uint8_t, uint8_t, uint8_t" -Function,-,u8x8_Draw1x2String,uint8_t,"u8x8_t*, uint8_t, uint8_t, const char*" -Function,-,u8x8_Draw1x2UTF8,uint8_t,"u8x8_t*, uint8_t, uint8_t, const char*" -Function,-,u8x8_Draw2x2Glyph,void,"u8x8_t*, uint8_t, uint8_t, uint8_t" -Function,-,u8x8_Draw2x2String,uint8_t,"u8x8_t*, uint8_t, uint8_t, const char*" -Function,-,u8x8_Draw2x2UTF8,uint8_t,"u8x8_t*, uint8_t, uint8_t, const char*" -Function,-,u8x8_DrawGlyph,void,"u8x8_t*, uint8_t, uint8_t, uint8_t" -Function,-,u8x8_DrawLog,void,"u8x8_t*, uint8_t, uint8_t, u8log_t*" -Function,-,u8x8_DrawString,uint8_t,"u8x8_t*, uint8_t, uint8_t, const char*" -Function,-,u8x8_DrawTile,uint8_t,"u8x8_t*, uint8_t, uint8_t, uint8_t, uint8_t*" -Function,-,u8x8_DrawUTF8,uint8_t,"u8x8_t*, uint8_t, uint8_t, const char*" -Function,-,u8x8_DrawUTF8Line,uint8_t,"u8x8_t*, uint8_t, uint8_t, uint8_t, const char*" -Function,-,u8x8_DrawUTF8Lines,uint8_t,"u8x8_t*, uint8_t, uint8_t, uint8_t, const char*" -Function,-,u8x8_FillDisplay,void,u8x8_t* -Function,-,u8x8_GetBitmapPixel,uint8_t,"u8x8_t*, uint16_t, uint16_t" -Function,-,u8x8_GetMenuEvent,uint8_t,u8x8_t* -Function,-,u8x8_GetStringLineCnt,uint8_t,const char* -Function,-,u8x8_GetStringLineStart,const char*,"uint8_t, const char*" -Function,-,u8x8_GetUTF8Len,uint8_t,"u8x8_t*, const char*" -Function,-,u8x8_InitDisplay,void,u8x8_t* -Function,-,u8x8_RefreshDisplay,void,u8x8_t* -Function,-,u8x8_SaveBitmapTGA,void,"u8x8_t*, const char*" -Function,-,u8x8_SendF,void,"u8x8_t*, const char*, ..." -Function,-,u8x8_SetContrast,void,"u8x8_t*, uint8_t" -Function,-,u8x8_SetFlipMode,void,"u8x8_t*, uint8_t" -Function,-,u8x8_SetFont,void,"u8x8_t*, const uint8_t*" -Function,-,u8x8_SetPowerSave,void,"u8x8_t*, uint8_t" -Function,-,u8x8_Setup,void,"u8x8_t*, u8x8_msg_cb, u8x8_msg_cb, u8x8_msg_cb, u8x8_msg_cb" -Function,-,u8x8_SetupBitmap,void,"u8x8_t*, uint16_t, uint16_t" -Function,-,u8x8_SetupDefaults,void,u8x8_t* -Function,-,u8x8_SetupMemory,void,u8x8_t* -Function,-,u8x8_SetupStdio,void,u8x8_t* -Function,-,u8x8_Setup_SDL_128x64,void,u8x8_t* -Function,-,u8x8_Setup_SDL_240x160,void,u8x8_t* -Function,-,u8x8_Setup_TGA_DESC,void,u8x8_t* -Function,-,u8x8_Setup_TGA_LCD,void,u8x8_t* -Function,-,u8x8_Setup_Utf8,void,u8x8_t* -Function,-,u8x8_UserInterfaceInputValue,uint8_t,"u8x8_t*, const char*, const char*, uint8_t*, uint8_t, uint8_t, uint8_t, const char*" -Function,-,u8x8_UserInterfaceMessage,uint8_t,"u8x8_t*, const char*, const char*, const char*, const char*" -Function,-,u8x8_UserInterfaceSelectionList,uint8_t,"u8x8_t*, const char*, uint8_t, const char*" -Function,-,u8x8_ascii_next,uint16_t,"u8x8_t*, uint8_t" -Function,-,u8x8_byte_3wire_sw_spi,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_4wire_sw_spi,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_8bit_6800mode,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_8bit_8080mode,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_EndTransfer,uint8_t,u8x8_t* -Function,-,u8x8_byte_SendByte,uint8_t,"u8x8_t*, uint8_t" -Function,-,u8x8_byte_SendBytes,uint8_t,"u8x8_t*, uint8_t, uint8_t*" -Function,-,u8x8_byte_SetDC,uint8_t,"u8x8_t*, uint8_t" -Function,-,u8x8_byte_StartTransfer,uint8_t,u8x8_t* -Function,-,u8x8_byte_empty,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_ks0108,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_sed1520,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_set_ks0108_cs,void,"u8x8_t*, uint8_t" -Function,-,u8x8_byte_ssd13xx_sw_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_byte_sw_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_001,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_011,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_100,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_110,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_EndTransfer,uint8_t,u8x8_t* -Function,-,u8x8_cad_SendArg,uint8_t,"u8x8_t*, uint8_t" -Function,-,u8x8_cad_SendCmd,uint8_t,"u8x8_t*, uint8_t" -Function,-,u8x8_cad_SendData,uint8_t,"u8x8_t*, uint8_t, uint8_t*" -Function,-,u8x8_cad_SendMultipleArg,uint8_t,"u8x8_t*, uint8_t, uint8_t" -Function,-,u8x8_cad_SendSequence,void,"u8x8_t*, const uint8_t*" -Function,-,u8x8_cad_StartTransfer,uint8_t,u8x8_t* -Function,-,u8x8_cad_empty,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_ld7032_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_ssd13xx_fast_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_ssd13xx_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_st75256_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_st7920_spi,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_uc16xx_i2c,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_cad_vsendf,void,"u8x8_t*, const char*, va_list" -Function,-,u8x8_capture_get_pixel_1,uint8_t,"uint16_t, uint16_t, uint8_t*, uint8_t" -Function,-,u8x8_capture_get_pixel_2,uint8_t,"uint16_t, uint16_t, uint8_t*, uint8_t" -Function,-,u8x8_capture_write_pbm_buffer,void,"uint8_t*, uint8_t, uint8_t, uint8_t (*)(uint16_t, uint16_t, uint8_t*, uint8_t), void (*)(const char*)" -Function,-,u8x8_capture_write_pbm_pre,void,"uint8_t, uint8_t, void (*)(const char*)" -Function,-,u8x8_capture_write_xbm_buffer,void,"uint8_t*, uint8_t, uint8_t, uint8_t (*)(uint16_t, uint16_t, uint8_t*, uint8_t), void (*)(const char*)" -Function,-,u8x8_capture_write_xbm_pre,void,"uint8_t, uint8_t, void (*)(const char*)" -Function,-,u8x8_d_a2printer_384x240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_helper_display_init,void,u8x8_t* -Function,-,u8x8_d_helper_display_setup_memory,void,"u8x8_t*, const u8x8_display_info_t*" -Function,-,u8x8_d_hx1230_96x68,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_il3820_296x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_il3820_v2_296x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ist3020_erc19264,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ist7920_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ks0108_128x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ks0108_erm19264,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_lc7981_160x160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_lc7981_160x80,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_lc7981_240x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_lc7981_240x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ld7032_60x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ls013b7dh03_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ls013b7dh05_144x168,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ls027b7dh01_400x240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_max7219_16x16,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_max7219_32x8,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_max7219_64x8,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_max7219_8x8,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_nt7534_tg12864r,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_null_cb,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_pcd8544_84x48,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_pcf8812_96x65,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ra8835_320x240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ra8835_nhd_240x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sbn1661_122x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sed1330_240x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sed1520_122x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1106_128x64_noname,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1106_128x64_vcomh0,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1106_128x64_winstar,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1106_64x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1106_72x40_wise,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1107_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1107_64x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1107_pimoroni_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1107_seeed_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1107_seeed_96x96,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1108_160x160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_sh1122_256x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd0323_os128064,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1305_128x32_adafruit,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1305_128x32_noname,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1305_128x64_adafruit,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_128x32_univision,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_128x32_winstar,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_128x64_alt0,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_128x64_noname,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_128x64_vcomh0,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_48x64_winstar,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_64x32_1f,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_64x32_noname,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_64x48_er,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_72x40_er,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1306_96x16_er,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1309_128x64_noname0,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1309_128x64_noname2,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1316_128x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1317_96x96,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1318_128x96,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1318_128x96_xcp,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1322_nhd_128x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1322_nhd_256x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1325_nhd_128x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1326_er_256x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1327_ea_w128128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1327_midas_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1327_seeed_96x96,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1327_visionox_128x96,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1327_ws_128x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1327_ws_96x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1329_128x96_noname,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1606_172x72,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1607_200x200,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1607_gd_200x200,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1607_v2_200x200,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_ssd1607_ws_200x200,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7511_avd_320x240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx172104,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx19296,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx240160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx256128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx256160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx256160_alt,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx256160m,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_jlx25664,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75256_wo256x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7528_nhd_c160100,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st75320_jlx320240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_64128n,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_ea_dogm128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_ea_dogm132,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_erc12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_erc12864_alt,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_jlx12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_lm6059,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_lm6063,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_lx12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_nhd_c12832,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_nhd_c12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7565_zolen_128x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7567_64x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7567_enh_dg128064,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7567_enh_dg128064i,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7567_jlx12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7567_os12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7567_pi_132x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7586s_erc240160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7586s_s028hn118a,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7588_jlx12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7920_128x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_st7920_192x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_t6963_128x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_t6963_128x64_alt,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_t6963_160x80,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_t6963_240x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_t6963_240x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_t6963_256x64,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1601_128x32,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1604_jlx19264,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1608_240x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1608_erc240120,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1608_erc24064,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1610_ea_dogxl160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1611_cg160160,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1611_ea_dogm240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1611_ea_dogxl240,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1611_ew50850,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1617_jlx128128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1638_160x128,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1701_ea_dogs102,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_d_uc1701_mini12864,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_dummy_cb,uint8_t,"u8x8_t*, uint8_t, uint8_t, void*" -Function,-,u8x8_gpio_call,void,"u8x8_t*, uint8_t, uint8_t" -Function,-,u8x8_u16toa,const char*,"uint16_t, uint8_t" -Function,-,u8x8_u8toa,const char*,"uint8_t, uint8_t" -Function,-,u8x8_upscale_byte,uint16_t,uint8_t -Function,-,u8x8_utf8_init,void,u8x8_t* -Function,-,u8x8_utf8_next,uint16_t,"u8x8_t*, uint8_t" -Function,-,u8x8_utoa,const char*,uint16_t Function,-,uECC_compress,void,"const uint8_t*, uint8_t*, uECC_Curve" Function,+,uECC_compute_public_key,int,"const uint8_t*, uint8_t*, uECC_Curve" Function,-,uECC_curve_private_key_size,int,uECC_Curve @@ -4523,7 +3455,6 @@ Function,-,ulTaskGetIdleRunTimePercent,uint32_t, Function,-,ungetc,int,"int, FILE*" Function,-,unsetenv,int,const char* Function,-,usbd_poll,void,usbd_device* -Function,-,utf8_show,void, Function,-,utoa,char*,"unsigned, char*, int" Function,-,uxListRemove,UBaseType_t,ListItem_t* Function,-,uxTaskGetNumberOfTasks,UBaseType_t, @@ -4531,7 +3462,7 @@ Function,-,uxTaskGetStackHighWaterMark,UBaseType_t,TaskHandle_t Function,-,uxTaskGetStackHighWaterMark2,uint16_t,TaskHandle_t Function,-,uxTaskGetSystemState,UBaseType_t,"TaskStatus_t*, const UBaseType_t, uint32_t*" Function,-,uxTaskGetTaskNumber,UBaseType_t,TaskHandle_t -Function,+,uxTaskPriorityGet,UBaseType_t,const TaskHandle_t +Function,-,uxTaskPriorityGet,UBaseType_t,const TaskHandle_t Function,-,uxTaskPriorityGetFromISR,UBaseType_t,const TaskHandle_t Function,-,uxTaskResetEventItemValue,TickType_t, Function,-,uxTimerGetReloadMode,UBaseType_t,TimerHandle_t @@ -5150,1831 +4081,6 @@ Variable,-,subghz_protocol_star_line,const SubGhzProtocol, Variable,-,subghz_protocol_star_line_decoder,const SubGhzProtocolDecoder, Variable,-,subghz_protocol_star_line_encoder,const SubGhzProtocolEncoder, Variable,-,suboptarg,char*, -Variable,-,u8g2_cb_mirror,const u8g2_cb_t, -Variable,-,u8g2_cb_r0,const u8g2_cb_t, -Variable,-,u8g2_cb_r1,const u8g2_cb_t, -Variable,-,u8g2_cb_r2,const u8g2_cb_t, -Variable,-,u8g2_cb_r3,const u8g2_cb_t, -Variable,-,u8g2_font_10x20_me,const uint8_t[], -Variable,-,u8g2_font_10x20_mf,const uint8_t[], -Variable,-,u8g2_font_10x20_mn,const uint8_t[], -Variable,-,u8g2_font_10x20_mr,const uint8_t[], -Variable,-,u8g2_font_10x20_t_arabic,const uint8_t[], -Variable,-,u8g2_font_10x20_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_10x20_t_greek,const uint8_t[], -Variable,-,u8g2_font_10x20_te,const uint8_t[], -Variable,-,u8g2_font_10x20_tf,const uint8_t[], -Variable,-,u8g2_font_10x20_tn,const uint8_t[], -Variable,-,u8g2_font_10x20_tr,const uint8_t[], -Variable,-,u8g2_font_4x6_mf,const uint8_t[], -Variable,-,u8g2_font_4x6_mn,const uint8_t[], -Variable,-,u8g2_font_4x6_mr,const uint8_t[], -Variable,-,u8g2_font_4x6_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_4x6_tf,const uint8_t[], -Variable,-,u8g2_font_4x6_tn,const uint8_t[], -Variable,-,u8g2_font_4x6_tr,const uint8_t[], -Variable,-,u8g2_font_5x7_mf,const uint8_t[], -Variable,-,u8g2_font_5x7_mn,const uint8_t[], -Variable,-,u8g2_font_5x7_mr,const uint8_t[], -Variable,-,u8g2_font_5x7_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_5x7_tf,const uint8_t[], -Variable,-,u8g2_font_5x7_tn,const uint8_t[], -Variable,-,u8g2_font_5x7_tr,const uint8_t[], -Variable,-,u8g2_font_5x8_mf,const uint8_t[], -Variable,-,u8g2_font_5x8_mn,const uint8_t[], -Variable,-,u8g2_font_5x8_mr,const uint8_t[], -Variable,-,u8g2_font_5x8_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_5x8_tf,const uint8_t[], -Variable,-,u8g2_font_5x8_tn,const uint8_t[], -Variable,-,u8g2_font_5x8_tr,const uint8_t[], -Variable,-,u8g2_font_6x10_mf,const uint8_t[], -Variable,-,u8g2_font_6x10_mn,const uint8_t[], -Variable,-,u8g2_font_6x10_mr,const uint8_t[], -Variable,-,u8g2_font_6x10_tf,const uint8_t[], -Variable,-,u8g2_font_6x10_tn,const uint8_t[], -Variable,-,u8g2_font_6x10_tr,const uint8_t[], -Variable,-,u8g2_font_6x12_m_symbols,const uint8_t[], -Variable,-,u8g2_font_6x12_me,const uint8_t[], -Variable,-,u8g2_font_6x12_mf,const uint8_t[], -Variable,-,u8g2_font_6x12_mn,const uint8_t[], -Variable,-,u8g2_font_6x12_mr,const uint8_t[], -Variable,-,u8g2_font_6x12_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_6x12_t_symbols,const uint8_t[], -Variable,-,u8g2_font_6x12_te,const uint8_t[], -Variable,-,u8g2_font_6x12_tf,const uint8_t[], -Variable,-,u8g2_font_6x12_tn,const uint8_t[], -Variable,-,u8g2_font_6x12_tr,const uint8_t[], -Variable,-,u8g2_font_6x13B_mf,const uint8_t[], -Variable,-,u8g2_font_6x13B_mn,const uint8_t[], -Variable,-,u8g2_font_6x13B_mr,const uint8_t[], -Variable,-,u8g2_font_6x13B_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_6x13B_t_hebrew,const uint8_t[], -Variable,-,u8g2_font_6x13B_tf,const uint8_t[], -Variable,-,u8g2_font_6x13B_tn,const uint8_t[], -Variable,-,u8g2_font_6x13B_tr,const uint8_t[], -Variable,-,u8g2_font_6x13O_mf,const uint8_t[], -Variable,-,u8g2_font_6x13O_mn,const uint8_t[], -Variable,-,u8g2_font_6x13O_mr,const uint8_t[], -Variable,-,u8g2_font_6x13O_tf,const uint8_t[], -Variable,-,u8g2_font_6x13O_tn,const uint8_t[], -Variable,-,u8g2_font_6x13O_tr,const uint8_t[], -Variable,-,u8g2_font_6x13_me,const uint8_t[], -Variable,-,u8g2_font_6x13_mf,const uint8_t[], -Variable,-,u8g2_font_6x13_mn,const uint8_t[], -Variable,-,u8g2_font_6x13_mr,const uint8_t[], -Variable,-,u8g2_font_6x13_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_6x13_t_hebrew,const uint8_t[], -Variable,-,u8g2_font_6x13_te,const uint8_t[], -Variable,-,u8g2_font_6x13_tf,const uint8_t[], -Variable,-,u8g2_font_6x13_tn,const uint8_t[], -Variable,-,u8g2_font_6x13_tr,const uint8_t[], -Variable,-,u8g2_font_7Segments_26x42_mn,const uint8_t[], -Variable,-,u8g2_font_7x13B_mf,const uint8_t[], -Variable,-,u8g2_font_7x13B_mn,const uint8_t[], -Variable,-,u8g2_font_7x13B_mr,const uint8_t[], -Variable,-,u8g2_font_7x13B_tf,const uint8_t[], -Variable,-,u8g2_font_7x13B_tn,const uint8_t[], -Variable,+,u8g2_font_7x13B_tr,const uint8_t[], -Variable,-,u8g2_font_7x13O_mf,const uint8_t[], -Variable,-,u8g2_font_7x13O_mn,const uint8_t[], -Variable,-,u8g2_font_7x13O_mr,const uint8_t[], -Variable,-,u8g2_font_7x13O_tf,const uint8_t[], -Variable,-,u8g2_font_7x13O_tn,const uint8_t[], -Variable,-,u8g2_font_7x13O_tr,const uint8_t[], -Variable,-,u8g2_font_7x13_m_symbols,const uint8_t[], -Variable,-,u8g2_font_7x13_me,const uint8_t[], -Variable,-,u8g2_font_7x13_mf,const uint8_t[], -Variable,-,u8g2_font_7x13_mn,const uint8_t[], -Variable,-,u8g2_font_7x13_mr,const uint8_t[], -Variable,-,u8g2_font_7x13_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_7x13_t_symbols,const uint8_t[], -Variable,-,u8g2_font_7x13_te,const uint8_t[], -Variable,-,u8g2_font_7x13_tf,const uint8_t[], -Variable,-,u8g2_font_7x13_tn,const uint8_t[], -Variable,-,u8g2_font_7x13_tr,const uint8_t[], -Variable,-,u8g2_font_7x14B_mf,const uint8_t[], -Variable,-,u8g2_font_7x14B_mn,const uint8_t[], -Variable,-,u8g2_font_7x14B_mr,const uint8_t[], -Variable,-,u8g2_font_7x14B_tf,const uint8_t[], -Variable,-,u8g2_font_7x14B_tn,const uint8_t[], -Variable,-,u8g2_font_7x14B_tr,const uint8_t[], -Variable,-,u8g2_font_7x14_mf,const uint8_t[], -Variable,-,u8g2_font_7x14_mn,const uint8_t[], -Variable,-,u8g2_font_7x14_mr,const uint8_t[], -Variable,-,u8g2_font_7x14_tf,const uint8_t[], -Variable,-,u8g2_font_7x14_tn,const uint8_t[], -Variable,-,u8g2_font_7x14_tr,const uint8_t[], -Variable,-,u8g2_font_8x13B_mf,const uint8_t[], -Variable,-,u8g2_font_8x13B_mn,const uint8_t[], -Variable,-,u8g2_font_8x13B_mr,const uint8_t[], -Variable,-,u8g2_font_8x13B_tf,const uint8_t[], -Variable,-,u8g2_font_8x13B_tn,const uint8_t[], -Variable,-,u8g2_font_8x13B_tr,const uint8_t[], -Variable,-,u8g2_font_8x13O_mf,const uint8_t[], -Variable,-,u8g2_font_8x13O_mn,const uint8_t[], -Variable,-,u8g2_font_8x13O_mr,const uint8_t[], -Variable,-,u8g2_font_8x13O_tf,const uint8_t[], -Variable,-,u8g2_font_8x13O_tn,const uint8_t[], -Variable,-,u8g2_font_8x13O_tr,const uint8_t[], -Variable,-,u8g2_font_8x13_m_symbols,const uint8_t[], -Variable,-,u8g2_font_8x13_me,const uint8_t[], -Variable,-,u8g2_font_8x13_mf,const uint8_t[], -Variable,-,u8g2_font_8x13_mn,const uint8_t[], -Variable,-,u8g2_font_8x13_mr,const uint8_t[], -Variable,-,u8g2_font_8x13_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_8x13_t_symbols,const uint8_t[], -Variable,-,u8g2_font_8x13_te,const uint8_t[], -Variable,-,u8g2_font_8x13_tf,const uint8_t[], -Variable,-,u8g2_font_8x13_tn,const uint8_t[], -Variable,-,u8g2_font_8x13_tr,const uint8_t[], -Variable,-,u8g2_font_9x15B_mf,const uint8_t[], -Variable,-,u8g2_font_9x15B_mn,const uint8_t[], -Variable,-,u8g2_font_9x15B_mr,const uint8_t[], -Variable,-,u8g2_font_9x15B_tf,const uint8_t[], -Variable,-,u8g2_font_9x15B_tn,const uint8_t[], -Variable,-,u8g2_font_9x15B_tr,const uint8_t[], -Variable,-,u8g2_font_9x15_m_symbols,const uint8_t[], -Variable,-,u8g2_font_9x15_me,const uint8_t[], -Variable,-,u8g2_font_9x15_mf,const uint8_t[], -Variable,-,u8g2_font_9x15_mn,const uint8_t[], -Variable,-,u8g2_font_9x15_mr,const uint8_t[], -Variable,-,u8g2_font_9x15_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_9x15_t_symbols,const uint8_t[], -Variable,-,u8g2_font_9x15_te,const uint8_t[], -Variable,-,u8g2_font_9x15_tf,const uint8_t[], -Variable,-,u8g2_font_9x15_tn,const uint8_t[], -Variable,-,u8g2_font_9x15_tr,const uint8_t[], -Variable,-,u8g2_font_9x18B_mf,const uint8_t[], -Variable,-,u8g2_font_9x18B_mn,const uint8_t[], -Variable,-,u8g2_font_9x18B_mr,const uint8_t[], -Variable,-,u8g2_font_9x18B_tf,const uint8_t[], -Variable,-,u8g2_font_9x18B_tn,const uint8_t[], -Variable,-,u8g2_font_9x18B_tr,const uint8_t[], -Variable,-,u8g2_font_9x18_mf,const uint8_t[], -Variable,-,u8g2_font_9x18_mn,const uint8_t[], -Variable,-,u8g2_font_9x18_mr,const uint8_t[], -Variable,-,u8g2_font_9x18_tf,const uint8_t[], -Variable,-,u8g2_font_9x18_tn,const uint8_t[], -Variable,-,u8g2_font_9x18_tr,const uint8_t[], -Variable,-,u8g2_font_BBSesque_te,const uint8_t[], -Variable,-,u8g2_font_BBSesque_tf,const uint8_t[], -Variable,-,u8g2_font_BBSesque_tr,const uint8_t[], -Variable,-,u8g2_font_BitTypeWriter_te,const uint8_t[], -Variable,-,u8g2_font_BitTypeWriter_tr,const uint8_t[], -Variable,-,u8g2_font_Born2bSportySlab_t_all,const uint8_t[], -Variable,-,u8g2_font_Born2bSportySlab_te,const uint8_t[], -Variable,-,u8g2_font_Born2bSportySlab_tf,const uint8_t[], -Variable,-,u8g2_font_Born2bSportySlab_tr,const uint8_t[], -Variable,-,u8g2_font_Born2bSportyV2_te,const uint8_t[], -Variable,-,u8g2_font_Born2bSportyV2_tf,const uint8_t[], -Variable,-,u8g2_font_Born2bSportyV2_tr,const uint8_t[], -Variable,-,u8g2_font_CursivePixel_tr,const uint8_t[], -Variable,-,u8g2_font_DigitalDiscoThin_te,const uint8_t[], -Variable,-,u8g2_font_DigitalDiscoThin_tf,const uint8_t[], -Variable,-,u8g2_font_DigitalDiscoThin_tn,const uint8_t[], -Variable,-,u8g2_font_DigitalDiscoThin_tr,const uint8_t[], -Variable,-,u8g2_font_DigitalDiscoThin_tu,const uint8_t[], -Variable,-,u8g2_font_DigitalDisco_te,const uint8_t[], -Variable,-,u8g2_font_DigitalDisco_tf,const uint8_t[], -Variable,-,u8g2_font_DigitalDisco_tn,const uint8_t[], -Variable,-,u8g2_font_DigitalDisco_tr,const uint8_t[], -Variable,-,u8g2_font_DigitalDisco_tu,const uint8_t[], -Variable,-,u8g2_font_Engrish_tf,const uint8_t[], -Variable,-,u8g2_font_Engrish_tr,const uint8_t[], -Variable,-,u8g2_font_Georgia7px_te,const uint8_t[], -Variable,-,u8g2_font_Georgia7px_tf,const uint8_t[], -Variable,-,u8g2_font_Georgia7px_tr,const uint8_t[], -Variable,-,u8g2_font_HelvetiPixelOutline_te,const uint8_t[], -Variable,-,u8g2_font_HelvetiPixelOutline_tr,const uint8_t[], -Variable,-,u8g2_font_HelvetiPixel_tr,const uint8_t[], -Variable,-,u8g2_font_IPAandRUSLCD_te,const uint8_t[], -Variable,-,u8g2_font_IPAandRUSLCD_tf,const uint8_t[], -Variable,-,u8g2_font_IPAandRUSLCD_tr,const uint8_t[], -Variable,-,u8g2_font_ImpactBits_tr,const uint8_t[], -Variable,-,u8g2_font_Pixellari_te,const uint8_t[], -Variable,-,u8g2_font_Pixellari_tf,const uint8_t[], -Variable,-,u8g2_font_Pixellari_tn,const uint8_t[], -Variable,-,u8g2_font_Pixellari_tr,const uint8_t[], -Variable,-,u8g2_font_Pixellari_tu,const uint8_t[], -Variable,-,u8g2_font_TimesNewPixel_tr,const uint8_t[], -Variable,-,u8g2_font_Untitled16PixelSansSerifBitmap_tr,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_mf,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_mn,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_mr,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_mu,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_tf,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_tn,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_tr,const uint8_t[], -Variable,-,u8g2_font_VCR_OSD_tu,const uint8_t[], -Variable,-,u8g2_font_Wizzard_tr,const uint8_t[], -Variable,-,u8g2_font_adventurer_t_all,const uint8_t[], -Variable,-,u8g2_font_adventurer_tf,const uint8_t[], -Variable,-,u8g2_font_adventurer_tr,const uint8_t[], -Variable,-,u8g2_font_amstrad_cpc_extended_8f,const uint8_t[], -Variable,-,u8g2_font_amstrad_cpc_extended_8n,const uint8_t[], -Variable,-,u8g2_font_amstrad_cpc_extended_8r,const uint8_t[], -Variable,-,u8g2_font_amstrad_cpc_extended_8u,const uint8_t[], -Variable,-,u8g2_font_artossans8_8n,const uint8_t[], -Variable,-,u8g2_font_artossans8_8r,const uint8_t[], -Variable,-,u8g2_font_artossans8_8u,const uint8_t[], -Variable,-,u8g2_font_artosserif8_8n,const uint8_t[], -Variable,-,u8g2_font_artosserif8_8r,const uint8_t[], -Variable,-,u8g2_font_artosserif8_8u,const uint8_t[], -Variable,-,u8g2_font_astragal_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_astragal_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_astragal_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_b10_b_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_b10_b_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_b10_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_b10_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_b12_b_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_b12_b_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_b12_b_t_japanese3,const uint8_t[], -Variable,-,u8g2_font_b12_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_b12_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_b12_t_japanese3,const uint8_t[], -Variable,-,u8g2_font_b16_b_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_b16_b_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_b16_b_t_japanese3,const uint8_t[], -Variable,-,u8g2_font_b16_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_b16_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_b16_t_japanese3,const uint8_t[], -Variable,-,u8g2_font_baby_tf,const uint8_t[], -Variable,-,u8g2_font_baby_tn,const uint8_t[], -Variable,-,u8g2_font_baby_tr,const uint8_t[], -Variable,-,u8g2_font_balthasar_regular_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_balthasar_regular_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_balthasar_regular_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_balthasar_titling_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_balthasar_titling_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_balthasar_titling_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_battery19_tn,const uint8_t[], -Variable,-,u8g2_font_bauhaus2015_tn,const uint8_t[], -Variable,-,u8g2_font_bauhaus2015_tr,const uint8_t[], -Variable,-,u8g2_font_beanstalk_mel_tn,const uint8_t[], -Variable,-,u8g2_font_beanstalk_mel_tr,const uint8_t[], -Variable,-,u8g2_font_bitcasual_t_all,const uint8_t[], -Variable,-,u8g2_font_bitcasual_tf,const uint8_t[], -Variable,-,u8g2_font_bitcasual_tn,const uint8_t[], -Variable,-,u8g2_font_bitcasual_tr,const uint8_t[], -Variable,-,u8g2_font_bitcasual_tu,const uint8_t[], -Variable,-,u8g2_font_blipfest_07_tn,const uint8_t[], -Variable,-,u8g2_font_blipfest_07_tr,const uint8_t[], -Variable,-,u8g2_font_bracketedbabies_tr,const uint8_t[], -Variable,-,u8g2_font_bubble_tn,const uint8_t[], -Variable,-,u8g2_font_bubble_tr,const uint8_t[], -Variable,-,u8g2_font_calibration_gothic_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_calibration_gothic_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_calibration_gothic_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_calibration_gothic_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_cardimon_pixel_tf,const uint8_t[], -Variable,-,u8g2_font_cardimon_pixel_tn,const uint8_t[], -Variable,-,u8g2_font_cardimon_pixel_tr,const uint8_t[], -Variable,-,u8g2_font_celibatemonk_tr,const uint8_t[], -Variable,-,u8g2_font_chikita_tf,const uint8_t[], -Variable,-,u8g2_font_chikita_tn,const uint8_t[], -Variable,-,u8g2_font_chikita_tr,const uint8_t[], -Variable,-,u8g2_font_chroma48medium8_8n,const uint8_t[], -Variable,-,u8g2_font_chroma48medium8_8r,const uint8_t[], -Variable,-,u8g2_font_chroma48medium8_8u,const uint8_t[], -Variable,-,u8g2_font_courB08_tf,const uint8_t[], -Variable,+,u8g2_font_courB08_tn,const uint8_t[], -Variable,-,u8g2_font_courB08_tr,const uint8_t[], -Variable,-,u8g2_font_courB10_tf,const uint8_t[], -Variable,-,u8g2_font_courB10_tn,const uint8_t[], -Variable,-,u8g2_font_courB10_tr,const uint8_t[], -Variable,-,u8g2_font_courB12_tf,const uint8_t[], -Variable,-,u8g2_font_courB12_tn,const uint8_t[], -Variable,-,u8g2_font_courB12_tr,const uint8_t[], -Variable,-,u8g2_font_courB14_tf,const uint8_t[], -Variable,-,u8g2_font_courB14_tn,const uint8_t[], -Variable,-,u8g2_font_courB14_tr,const uint8_t[], -Variable,-,u8g2_font_courB18_tf,const uint8_t[], -Variable,-,u8g2_font_courB18_tn,const uint8_t[], -Variable,-,u8g2_font_courB18_tr,const uint8_t[], -Variable,-,u8g2_font_courB24_tf,const uint8_t[], -Variable,-,u8g2_font_courB24_tn,const uint8_t[], -Variable,-,u8g2_font_courB24_tr,const uint8_t[], -Variable,-,u8g2_font_courR08_tf,const uint8_t[], -Variable,-,u8g2_font_courR08_tn,const uint8_t[], -Variable,-,u8g2_font_courR08_tr,const uint8_t[], -Variable,-,u8g2_font_courR10_tf,const uint8_t[], -Variable,-,u8g2_font_courR10_tn,const uint8_t[], -Variable,-,u8g2_font_courR10_tr,const uint8_t[], -Variable,-,u8g2_font_courR12_tf,const uint8_t[], -Variable,-,u8g2_font_courR12_tn,const uint8_t[], -Variable,-,u8g2_font_courR12_tr,const uint8_t[], -Variable,-,u8g2_font_courR14_tf,const uint8_t[], -Variable,-,u8g2_font_courR14_tn,const uint8_t[], -Variable,-,u8g2_font_courR14_tr,const uint8_t[], -Variable,-,u8g2_font_courR18_tf,const uint8_t[], -Variable,-,u8g2_font_courR18_tn,const uint8_t[], -Variable,-,u8g2_font_courR18_tr,const uint8_t[], -Variable,-,u8g2_font_courR24_tf,const uint8_t[], -Variable,-,u8g2_font_courR24_tn,const uint8_t[], -Variable,-,u8g2_font_courR24_tr,const uint8_t[], -Variable,-,u8g2_font_crox1c_mf,const uint8_t[], -Variable,-,u8g2_font_crox1c_mn,const uint8_t[], -Variable,-,u8g2_font_crox1c_mr,const uint8_t[], -Variable,-,u8g2_font_crox1c_tf,const uint8_t[], -Variable,-,u8g2_font_crox1c_tn,const uint8_t[], -Variable,-,u8g2_font_crox1c_tr,const uint8_t[], -Variable,-,u8g2_font_crox1cb_mf,const uint8_t[], -Variable,-,u8g2_font_crox1cb_mn,const uint8_t[], -Variable,-,u8g2_font_crox1cb_mr,const uint8_t[], -Variable,-,u8g2_font_crox1cb_tf,const uint8_t[], -Variable,-,u8g2_font_crox1cb_tn,const uint8_t[], -Variable,-,u8g2_font_crox1cb_tr,const uint8_t[], -Variable,-,u8g2_font_crox1h_tf,const uint8_t[], -Variable,-,u8g2_font_crox1h_tn,const uint8_t[], -Variable,-,u8g2_font_crox1h_tr,const uint8_t[], -Variable,-,u8g2_font_crox1hb_tf,const uint8_t[], -Variable,-,u8g2_font_crox1hb_tn,const uint8_t[], -Variable,-,u8g2_font_crox1hb_tr,const uint8_t[], -Variable,-,u8g2_font_crox1t_tf,const uint8_t[], -Variable,-,u8g2_font_crox1t_tn,const uint8_t[], -Variable,-,u8g2_font_crox1t_tr,const uint8_t[], -Variable,-,u8g2_font_crox1tb_tf,const uint8_t[], -Variable,-,u8g2_font_crox1tb_tn,const uint8_t[], -Variable,-,u8g2_font_crox1tb_tr,const uint8_t[], -Variable,-,u8g2_font_crox2c_mf,const uint8_t[], -Variable,-,u8g2_font_crox2c_mn,const uint8_t[], -Variable,-,u8g2_font_crox2c_mr,const uint8_t[], -Variable,-,u8g2_font_crox2c_tf,const uint8_t[], -Variable,-,u8g2_font_crox2c_tn,const uint8_t[], -Variable,-,u8g2_font_crox2c_tr,const uint8_t[], -Variable,-,u8g2_font_crox2cb_mf,const uint8_t[], -Variable,-,u8g2_font_crox2cb_mn,const uint8_t[], -Variable,-,u8g2_font_crox2cb_mr,const uint8_t[], -Variable,-,u8g2_font_crox2cb_tf,const uint8_t[], -Variable,-,u8g2_font_crox2cb_tn,const uint8_t[], -Variable,-,u8g2_font_crox2cb_tr,const uint8_t[], -Variable,-,u8g2_font_crox2h_tf,const uint8_t[], -Variable,-,u8g2_font_crox2h_tn,const uint8_t[], -Variable,-,u8g2_font_crox2h_tr,const uint8_t[], -Variable,-,u8g2_font_crox2hb_tf,const uint8_t[], -Variable,-,u8g2_font_crox2hb_tn,const uint8_t[], -Variable,-,u8g2_font_crox2hb_tr,const uint8_t[], -Variable,-,u8g2_font_crox2t_tf,const uint8_t[], -Variable,-,u8g2_font_crox2t_tn,const uint8_t[], -Variable,-,u8g2_font_crox2t_tr,const uint8_t[], -Variable,-,u8g2_font_crox2tb_tf,const uint8_t[], -Variable,-,u8g2_font_crox2tb_tn,const uint8_t[], -Variable,-,u8g2_font_crox2tb_tr,const uint8_t[], -Variable,-,u8g2_font_crox3c_mf,const uint8_t[], -Variable,-,u8g2_font_crox3c_mn,const uint8_t[], -Variable,-,u8g2_font_crox3c_mr,const uint8_t[], -Variable,-,u8g2_font_crox3c_tf,const uint8_t[], -Variable,-,u8g2_font_crox3c_tn,const uint8_t[], -Variable,-,u8g2_font_crox3c_tr,const uint8_t[], -Variable,-,u8g2_font_crox3cb_mf,const uint8_t[], -Variable,-,u8g2_font_crox3cb_mn,const uint8_t[], -Variable,-,u8g2_font_crox3cb_mr,const uint8_t[], -Variable,-,u8g2_font_crox3cb_tf,const uint8_t[], -Variable,-,u8g2_font_crox3cb_tn,const uint8_t[], -Variable,-,u8g2_font_crox3cb_tr,const uint8_t[], -Variable,-,u8g2_font_crox3h_tf,const uint8_t[], -Variable,-,u8g2_font_crox3h_tn,const uint8_t[], -Variable,-,u8g2_font_crox3h_tr,const uint8_t[], -Variable,-,u8g2_font_crox3hb_tf,const uint8_t[], -Variable,-,u8g2_font_crox3hb_tn,const uint8_t[], -Variable,-,u8g2_font_crox3hb_tr,const uint8_t[], -Variable,-,u8g2_font_crox3t_tf,const uint8_t[], -Variable,-,u8g2_font_crox3t_tn,const uint8_t[], -Variable,-,u8g2_font_crox3t_tr,const uint8_t[], -Variable,-,u8g2_font_crox3tb_tf,const uint8_t[], -Variable,-,u8g2_font_crox3tb_tn,const uint8_t[], -Variable,-,u8g2_font_crox3tb_tr,const uint8_t[], -Variable,-,u8g2_font_crox4h_tf,const uint8_t[], -Variable,-,u8g2_font_crox4h_tn,const uint8_t[], -Variable,-,u8g2_font_crox4h_tr,const uint8_t[], -Variable,-,u8g2_font_crox4hb_tf,const uint8_t[], -Variable,-,u8g2_font_crox4hb_tn,const uint8_t[], -Variable,-,u8g2_font_crox4hb_tr,const uint8_t[], -Variable,-,u8g2_font_crox4t_tf,const uint8_t[], -Variable,-,u8g2_font_crox4t_tn,const uint8_t[], -Variable,-,u8g2_font_crox4t_tr,const uint8_t[], -Variable,-,u8g2_font_crox4tb_tf,const uint8_t[], -Variable,-,u8g2_font_crox4tb_tn,const uint8_t[], -Variable,-,u8g2_font_crox4tb_tr,const uint8_t[], -Variable,-,u8g2_font_crox5h_tf,const uint8_t[], -Variable,-,u8g2_font_crox5h_tn,const uint8_t[], -Variable,-,u8g2_font_crox5h_tr,const uint8_t[], -Variable,-,u8g2_font_crox5hb_tf,const uint8_t[], -Variable,-,u8g2_font_crox5hb_tn,const uint8_t[], -Variable,-,u8g2_font_crox5hb_tr,const uint8_t[], -Variable,-,u8g2_font_crox5t_tf,const uint8_t[], -Variable,-,u8g2_font_crox5t_tn,const uint8_t[], -Variable,-,u8g2_font_crox5t_tr,const uint8_t[], -Variable,-,u8g2_font_crox5tb_tf,const uint8_t[], -Variable,-,u8g2_font_crox5tb_tn,const uint8_t[], -Variable,-,u8g2_font_crox5tb_tr,const uint8_t[], -Variable,-,u8g2_font_cu12_h_symbols,const uint8_t[], -Variable,-,u8g2_font_cu12_he,const uint8_t[], -Variable,-,u8g2_font_cu12_hf,const uint8_t[], -Variable,-,u8g2_font_cu12_hn,const uint8_t[], -Variable,-,u8g2_font_cu12_hr,const uint8_t[], -Variable,-,u8g2_font_cu12_me,const uint8_t[], -Variable,-,u8g2_font_cu12_mf,const uint8_t[], -Variable,-,u8g2_font_cu12_mn,const uint8_t[], -Variable,-,u8g2_font_cu12_mr,const uint8_t[], -Variable,-,u8g2_font_cu12_t_arabic,const uint8_t[], -Variable,-,u8g2_font_cu12_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_cu12_t_greek,const uint8_t[], -Variable,-,u8g2_font_cu12_t_hebrew,const uint8_t[], -Variable,-,u8g2_font_cu12_t_symbols,const uint8_t[], -Variable,-,u8g2_font_cu12_t_tibetan,const uint8_t[], -Variable,-,u8g2_font_cu12_te,const uint8_t[], -Variable,-,u8g2_font_cu12_tf,const uint8_t[], -Variable,-,u8g2_font_cu12_tn,const uint8_t[], -Variable,-,u8g2_font_cu12_tr,const uint8_t[], -Variable,-,u8g2_font_cube_mel_tn,const uint8_t[], -Variable,-,u8g2_font_cube_mel_tr,const uint8_t[], -Variable,-,u8g2_font_cupcakemetoyourleader_tn,const uint8_t[], -Variable,-,u8g2_font_cupcakemetoyourleader_tr,const uint8_t[], -Variable,-,u8g2_font_cupcakemetoyourleader_tu,const uint8_t[], -Variable,-,u8g2_font_cursor_tf,const uint8_t[], -Variable,-,u8g2_font_cursor_tr,const uint8_t[], -Variable,-,u8g2_font_diodesemimono_tr,const uint8_t[], -Variable,-,u8g2_font_disrespectfulteenager_tu,const uint8_t[], -Variable,-,u8g2_font_emoticons21_tr,const uint8_t[], -Variable,-,u8g2_font_etl14thai_t,const uint8_t[], -Variable,-,u8g2_font_etl16thai_t,const uint8_t[], -Variable,-,u8g2_font_etl24thai_t,const uint8_t[], -Variable,-,u8g2_font_f10_b_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_f10_b_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_f10_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_f10_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_f12_b_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_f12_b_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_f12_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_f12_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_f16_b_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_f16_b_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_f16_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_f16_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_fancypixels_tf,const uint8_t[], -Variable,-,u8g2_font_fancypixels_tr,const uint8_t[], -Variable,-,u8g2_font_fewture_tf,const uint8_t[], -Variable,-,u8g2_font_fewture_tn,const uint8_t[], -Variable,-,u8g2_font_fewture_tr,const uint8_t[], -Variable,-,u8g2_font_finderskeepers_tf,const uint8_t[], -Variable,-,u8g2_font_finderskeepers_tn,const uint8_t[], -Variable,-,u8g2_font_finderskeepers_tr,const uint8_t[], -Variable,-,u8g2_font_freedoomr10_mu,const uint8_t[], -Variable,-,u8g2_font_freedoomr10_tu,const uint8_t[], -Variable,-,u8g2_font_freedoomr25_mn,const uint8_t[], -Variable,-,u8g2_font_freedoomr25_tn,const uint8_t[], -Variable,-,u8g2_font_frikativ_t_all,const uint8_t[], -Variable,-,u8g2_font_frikativ_tf,const uint8_t[], -Variable,-,u8g2_font_frikativ_tr,const uint8_t[], -Variable,-,u8g2_font_fub11_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub11_tf,const uint8_t[], -Variable,-,u8g2_font_fub11_tn,const uint8_t[], -Variable,-,u8g2_font_fub11_tr,const uint8_t[], -Variable,-,u8g2_font_fub14_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub14_tf,const uint8_t[], -Variable,-,u8g2_font_fub14_tn,const uint8_t[], -Variable,-,u8g2_font_fub14_tr,const uint8_t[], -Variable,-,u8g2_font_fub17_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub17_tf,const uint8_t[], -Variable,-,u8g2_font_fub17_tn,const uint8_t[], -Variable,-,u8g2_font_fub17_tr,const uint8_t[], -Variable,-,u8g2_font_fub20_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub20_tf,const uint8_t[], -Variable,-,u8g2_font_fub20_tn,const uint8_t[], -Variable,-,u8g2_font_fub20_tr,const uint8_t[], -Variable,-,u8g2_font_fub25_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub25_tf,const uint8_t[], -Variable,-,u8g2_font_fub25_tn,const uint8_t[], -Variable,-,u8g2_font_fub25_tr,const uint8_t[], -Variable,-,u8g2_font_fub30_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub30_tf,const uint8_t[], -Variable,-,u8g2_font_fub30_tn,const uint8_t[], -Variable,-,u8g2_font_fub30_tr,const uint8_t[], -Variable,-,u8g2_font_fub35_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub35_tf,const uint8_t[], -Variable,-,u8g2_font_fub35_tn,const uint8_t[], -Variable,-,u8g2_font_fub35_tr,const uint8_t[], -Variable,-,u8g2_font_fub42_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub42_tf,const uint8_t[], -Variable,-,u8g2_font_fub42_tn,const uint8_t[], -Variable,-,u8g2_font_fub42_tr,const uint8_t[], -Variable,-,u8g2_font_fub49_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fub49_tn,const uint8_t[], -Variable,-,u8g2_font_fur11_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur11_tf,const uint8_t[], -Variable,-,u8g2_font_fur11_tn,const uint8_t[], -Variable,-,u8g2_font_fur11_tr,const uint8_t[], -Variable,-,u8g2_font_fur14_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur14_tf,const uint8_t[], -Variable,-,u8g2_font_fur14_tn,const uint8_t[], -Variable,-,u8g2_font_fur14_tr,const uint8_t[], -Variable,-,u8g2_font_fur17_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur17_tf,const uint8_t[], -Variable,-,u8g2_font_fur17_tn,const uint8_t[], -Variable,-,u8g2_font_fur17_tr,const uint8_t[], -Variable,-,u8g2_font_fur20_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur20_tf,const uint8_t[], -Variable,-,u8g2_font_fur20_tn,const uint8_t[], -Variable,-,u8g2_font_fur20_tr,const uint8_t[], -Variable,-,u8g2_font_fur25_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur25_tf,const uint8_t[], -Variable,-,u8g2_font_fur25_tn,const uint8_t[], -Variable,-,u8g2_font_fur25_tr,const uint8_t[], -Variable,-,u8g2_font_fur30_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur30_tf,const uint8_t[], -Variable,-,u8g2_font_fur30_tn,const uint8_t[], -Variable,-,u8g2_font_fur30_tr,const uint8_t[], -Variable,-,u8g2_font_fur35_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur35_tf,const uint8_t[], -Variable,-,u8g2_font_fur35_tn,const uint8_t[], -Variable,-,u8g2_font_fur35_tr,const uint8_t[], -Variable,-,u8g2_font_fur42_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur42_tf,const uint8_t[], -Variable,-,u8g2_font_fur42_tn,const uint8_t[], -Variable,-,u8g2_font_fur42_tr,const uint8_t[], -Variable,-,u8g2_font_fur49_t_symbol,const uint8_t[], -Variable,-,u8g2_font_fur49_tn,const uint8_t[], -Variable,-,u8g2_font_ganj_nameh_sans10_t_all,const uint8_t[], -Variable,-,u8g2_font_ganj_nameh_sans12_t_all,const uint8_t[], -Variable,-,u8g2_font_ganj_nameh_sans14_t_all,const uint8_t[], -Variable,-,u8g2_font_ganj_nameh_sans16_t_all,const uint8_t[], -Variable,-,u8g2_font_gb16st_t_1,const uint8_t[], -Variable,-,u8g2_font_gb16st_t_2,const uint8_t[], -Variable,-,u8g2_font_gb16st_t_3,const uint8_t[], -Variable,-,u8g2_font_gb24st_t_1,const uint8_t[], -Variable,-,u8g2_font_gb24st_t_2,const uint8_t[], -Variable,-,u8g2_font_gb24st_t_3,const uint8_t[], -Variable,-,u8g2_font_glasstown_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_glasstown_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_glasstown_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_glasstown_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_guildenstern_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_guildenstern_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_guildenstern_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_guildenstern_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_habsburgchancery_t_all,const uint8_t[], -Variable,-,u8g2_font_habsburgchancery_tf,const uint8_t[], -Variable,-,u8g2_font_habsburgchancery_tn,const uint8_t[], -Variable,-,u8g2_font_habsburgchancery_tr,const uint8_t[], -Variable,-,u8g2_font_halftone_tf,const uint8_t[], -Variable,-,u8g2_font_halftone_tn,const uint8_t[], -Variable,-,u8g2_font_halftone_tr,const uint8_t[], -Variable,-,u8g2_font_haxrcorp4089_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_haxrcorp4089_tn,const uint8_t[], -Variable,-,u8g2_font_haxrcorp4089_tr,const uint8_t[], -Variable,-,u8g2_font_heavybottom_tr,const uint8_t[], -Variable,-,u8g2_font_helvB08_te,const uint8_t[], -Variable,-,u8g2_font_helvB08_tf,const uint8_t[], -Variable,-,u8g2_font_helvB08_tn,const uint8_t[], -Variable,-,u8g2_font_helvB08_tr,const uint8_t[], -Variable,-,u8g2_font_helvB10_te,const uint8_t[], -Variable,-,u8g2_font_helvB10_tf,const uint8_t[], -Variable,-,u8g2_font_helvB10_tn,const uint8_t[], -Variable,-,u8g2_font_helvB10_tr,const uint8_t[], -Variable,-,u8g2_font_helvB12_te,const uint8_t[], -Variable,-,u8g2_font_helvB12_tf,const uint8_t[], -Variable,-,u8g2_font_helvB12_tn,const uint8_t[], -Variable,-,u8g2_font_helvB12_tr,const uint8_t[], -Variable,-,u8g2_font_helvB14_te,const uint8_t[], -Variable,-,u8g2_font_helvB14_tf,const uint8_t[], -Variable,-,u8g2_font_helvB14_tn,const uint8_t[], -Variable,-,u8g2_font_helvB14_tr,const uint8_t[], -Variable,-,u8g2_font_helvB18_te,const uint8_t[], -Variable,-,u8g2_font_helvB18_tf,const uint8_t[], -Variable,-,u8g2_font_helvB18_tn,const uint8_t[], -Variable,-,u8g2_font_helvB18_tr,const uint8_t[], -Variable,-,u8g2_font_helvB24_te,const uint8_t[], -Variable,-,u8g2_font_helvB24_tf,const uint8_t[], -Variable,-,u8g2_font_helvB24_tn,const uint8_t[], -Variable,-,u8g2_font_helvB24_tr,const uint8_t[], -Variable,-,u8g2_font_helvR08_te,const uint8_t[], -Variable,-,u8g2_font_helvR08_tf,const uint8_t[], -Variable,-,u8g2_font_helvR08_tn,const uint8_t[], -Variable,-,u8g2_font_helvR08_tr,const uint8_t[], -Variable,-,u8g2_font_helvR10_te,const uint8_t[], -Variable,-,u8g2_font_helvR10_tf,const uint8_t[], -Variable,-,u8g2_font_helvR10_tn,const uint8_t[], -Variable,-,u8g2_font_helvR10_tr,const uint8_t[], -Variable,-,u8g2_font_helvR12_te,const uint8_t[], -Variable,-,u8g2_font_helvR12_tf,const uint8_t[], -Variable,-,u8g2_font_helvR12_tn,const uint8_t[], -Variable,-,u8g2_font_helvR12_tr,const uint8_t[], -Variable,-,u8g2_font_helvR14_te,const uint8_t[], -Variable,-,u8g2_font_helvR14_tf,const uint8_t[], -Variable,-,u8g2_font_helvR14_tn,const uint8_t[], -Variable,-,u8g2_font_helvR14_tr,const uint8_t[], -Variable,-,u8g2_font_helvR18_te,const uint8_t[], -Variable,-,u8g2_font_helvR18_tf,const uint8_t[], -Variable,-,u8g2_font_helvR18_tn,const uint8_t[], -Variable,-,u8g2_font_helvR18_tr,const uint8_t[], -Variable,-,u8g2_font_helvR24_te,const uint8_t[], -Variable,-,u8g2_font_helvR24_tf,const uint8_t[], -Variable,-,u8g2_font_helvR24_tn,const uint8_t[], -Variable,-,u8g2_font_helvR24_tr,const uint8_t[], -Variable,-,u8g2_font_iconquadpix_m_all,const uint8_t[], -Variable,-,u8g2_font_inb16_mf,const uint8_t[], -Variable,-,u8g2_font_inb16_mn,const uint8_t[], -Variable,-,u8g2_font_inb16_mr,const uint8_t[], -Variable,-,u8g2_font_inb19_mf,const uint8_t[], -Variable,-,u8g2_font_inb19_mn,const uint8_t[], -Variable,-,u8g2_font_inb19_mr,const uint8_t[], -Variable,-,u8g2_font_inb21_mf,const uint8_t[], -Variable,-,u8g2_font_inb21_mn,const uint8_t[], -Variable,-,u8g2_font_inb21_mr,const uint8_t[], -Variable,-,u8g2_font_inb24_mf,const uint8_t[], -Variable,-,u8g2_font_inb24_mn,const uint8_t[], -Variable,-,u8g2_font_inb24_mr,const uint8_t[], -Variable,-,u8g2_font_inb27_mf,const uint8_t[], -Variable,-,u8g2_font_inb27_mn,const uint8_t[], -Variable,+,u8g2_font_inb27_mr,const uint8_t[], -Variable,-,u8g2_font_inb30_mf,const uint8_t[], -Variable,-,u8g2_font_inb30_mn,const uint8_t[], -Variable,-,u8g2_font_inb30_mr,const uint8_t[], -Variable,-,u8g2_font_inb33_mf,const uint8_t[], -Variable,-,u8g2_font_inb33_mn,const uint8_t[], -Variable,-,u8g2_font_inb33_mr,const uint8_t[], -Variable,-,u8g2_font_inb38_mf,const uint8_t[], -Variable,-,u8g2_font_inb38_mn,const uint8_t[], -Variable,-,u8g2_font_inb38_mr,const uint8_t[], -Variable,-,u8g2_font_inb42_mf,const uint8_t[], -Variable,-,u8g2_font_inb42_mn,const uint8_t[], -Variable,-,u8g2_font_inb42_mr,const uint8_t[], -Variable,-,u8g2_font_inb46_mf,const uint8_t[], -Variable,-,u8g2_font_inb46_mn,const uint8_t[], -Variable,-,u8g2_font_inb46_mr,const uint8_t[], -Variable,-,u8g2_font_inb49_mf,const uint8_t[], -Variable,-,u8g2_font_inb49_mn,const uint8_t[], -Variable,-,u8g2_font_inb49_mr,const uint8_t[], -Variable,-,u8g2_font_inb53_mf,const uint8_t[], -Variable,-,u8g2_font_inb53_mn,const uint8_t[], -Variable,-,u8g2_font_inb53_mr,const uint8_t[], -Variable,-,u8g2_font_inb57_mn,const uint8_t[], -Variable,-,u8g2_font_inb63_mn,const uint8_t[], -Variable,-,u8g2_font_inr16_mf,const uint8_t[], -Variable,-,u8g2_font_inr16_mn,const uint8_t[], -Variable,-,u8g2_font_inr16_mr,const uint8_t[], -Variable,-,u8g2_font_inr19_mf,const uint8_t[], -Variable,-,u8g2_font_inr19_mn,const uint8_t[], -Variable,-,u8g2_font_inr19_mr,const uint8_t[], -Variable,-,u8g2_font_inr21_mf,const uint8_t[], -Variable,-,u8g2_font_inr21_mn,const uint8_t[], -Variable,-,u8g2_font_inr21_mr,const uint8_t[], -Variable,-,u8g2_font_inr24_mf,const uint8_t[], -Variable,-,u8g2_font_inr24_mn,const uint8_t[], -Variable,-,u8g2_font_inr24_mr,const uint8_t[], -Variable,-,u8g2_font_inr24_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr27_mf,const uint8_t[], -Variable,-,u8g2_font_inr27_mn,const uint8_t[], -Variable,-,u8g2_font_inr27_mr,const uint8_t[], -Variable,-,u8g2_font_inr27_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr30_mf,const uint8_t[], -Variable,-,u8g2_font_inr30_mn,const uint8_t[], -Variable,-,u8g2_font_inr30_mr,const uint8_t[], -Variable,-,u8g2_font_inr30_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr33_mf,const uint8_t[], -Variable,-,u8g2_font_inr33_mn,const uint8_t[], -Variable,-,u8g2_font_inr33_mr,const uint8_t[], -Variable,-,u8g2_font_inr33_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr38_mf,const uint8_t[], -Variable,-,u8g2_font_inr38_mn,const uint8_t[], -Variable,-,u8g2_font_inr38_mr,const uint8_t[], -Variable,-,u8g2_font_inr38_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr42_mf,const uint8_t[], -Variable,-,u8g2_font_inr42_mn,const uint8_t[], -Variable,-,u8g2_font_inr42_mr,const uint8_t[], -Variable,-,u8g2_font_inr42_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr46_mf,const uint8_t[], -Variable,-,u8g2_font_inr46_mn,const uint8_t[], -Variable,-,u8g2_font_inr46_mr,const uint8_t[], -Variable,-,u8g2_font_inr46_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr49_mf,const uint8_t[], -Variable,-,u8g2_font_inr49_mn,const uint8_t[], -Variable,-,u8g2_font_inr49_mr,const uint8_t[], -Variable,-,u8g2_font_inr49_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr53_mf,const uint8_t[], -Variable,-,u8g2_font_inr53_mn,const uint8_t[], -Variable,-,u8g2_font_inr53_mr,const uint8_t[], -Variable,-,u8g2_font_inr53_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_inr57_mn,const uint8_t[], -Variable,-,u8g2_font_inr62_mn,const uint8_t[], -Variable,-,u8g2_font_iranian_sans_10_t_all,const uint8_t[], -Variable,-,u8g2_font_iranian_sans_12_t_all,const uint8_t[], -Variable,-,u8g2_font_iranian_sans_14_t_all,const uint8_t[], -Variable,-,u8g2_font_iranian_sans_16_t_all,const uint8_t[], -Variable,-,u8g2_font_iranian_sans_8_t_all,const uint8_t[], -Variable,-,u8g2_font_jinxedwizards_tr,const uint8_t[], -Variable,-,u8g2_font_koleeko_tf,const uint8_t[], -Variable,-,u8g2_font_koleeko_tn,const uint8_t[], -Variable,-,u8g2_font_koleeko_tr,const uint8_t[], -Variable,-,u8g2_font_koleeko_tu,const uint8_t[], -Variable,-,u8g2_font_lastapprenticebold_tr,const uint8_t[], -Variable,-,u8g2_font_lastapprenticethin_tr,const uint8_t[], -Variable,-,u8g2_font_lastpriestess_tr,const uint8_t[], -Variable,-,u8g2_font_lastpriestess_tu,const uint8_t[], -Variable,-,u8g2_font_logisoso16_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso16_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso16_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso18_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso18_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso18_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso20_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso20_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso20_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso22_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso22_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso22_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso24_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso24_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso24_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso26_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso26_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso26_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso28_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso28_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso28_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso30_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso30_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso30_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso32_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso32_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso32_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso34_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso34_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso34_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso38_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso38_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso38_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso42_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso42_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso42_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso46_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso46_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso46_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso50_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso50_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso50_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso54_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso54_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso54_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso58_tf,const uint8_t[], -Variable,-,u8g2_font_logisoso58_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso58_tr,const uint8_t[], -Variable,-,u8g2_font_logisoso62_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso78_tn,const uint8_t[], -Variable,-,u8g2_font_logisoso92_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS08_te,const uint8_t[], -Variable,-,u8g2_font_luBIS08_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS08_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS08_tr,const uint8_t[], -Variable,-,u8g2_font_luBIS10_te,const uint8_t[], -Variable,-,u8g2_font_luBIS10_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS10_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS10_tr,const uint8_t[], -Variable,-,u8g2_font_luBIS12_te,const uint8_t[], -Variable,-,u8g2_font_luBIS12_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS12_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS12_tr,const uint8_t[], -Variable,-,u8g2_font_luBIS14_te,const uint8_t[], -Variable,-,u8g2_font_luBIS14_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS14_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS14_tr,const uint8_t[], -Variable,-,u8g2_font_luBIS18_te,const uint8_t[], -Variable,-,u8g2_font_luBIS18_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS18_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS18_tr,const uint8_t[], -Variable,-,u8g2_font_luBIS19_te,const uint8_t[], -Variable,-,u8g2_font_luBIS19_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS19_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS19_tr,const uint8_t[], -Variable,-,u8g2_font_luBIS24_te,const uint8_t[], -Variable,-,u8g2_font_luBIS24_tf,const uint8_t[], -Variable,-,u8g2_font_luBIS24_tn,const uint8_t[], -Variable,-,u8g2_font_luBIS24_tr,const uint8_t[], -Variable,-,u8g2_font_luBS08_te,const uint8_t[], -Variable,-,u8g2_font_luBS08_tf,const uint8_t[], -Variable,-,u8g2_font_luBS08_tn,const uint8_t[], -Variable,-,u8g2_font_luBS08_tr,const uint8_t[], -Variable,-,u8g2_font_luBS10_te,const uint8_t[], -Variable,-,u8g2_font_luBS10_tf,const uint8_t[], -Variable,-,u8g2_font_luBS10_tn,const uint8_t[], -Variable,-,u8g2_font_luBS10_tr,const uint8_t[], -Variable,-,u8g2_font_luBS12_te,const uint8_t[], -Variable,-,u8g2_font_luBS12_tf,const uint8_t[], -Variable,-,u8g2_font_luBS12_tn,const uint8_t[], -Variable,-,u8g2_font_luBS12_tr,const uint8_t[], -Variable,-,u8g2_font_luBS14_te,const uint8_t[], -Variable,-,u8g2_font_luBS14_tf,const uint8_t[], -Variable,-,u8g2_font_luBS14_tn,const uint8_t[], -Variable,-,u8g2_font_luBS14_tr,const uint8_t[], -Variable,-,u8g2_font_luBS18_te,const uint8_t[], -Variable,-,u8g2_font_luBS18_tf,const uint8_t[], -Variable,-,u8g2_font_luBS18_tn,const uint8_t[], -Variable,-,u8g2_font_luBS18_tr,const uint8_t[], -Variable,-,u8g2_font_luBS19_te,const uint8_t[], -Variable,-,u8g2_font_luBS19_tf,const uint8_t[], -Variable,-,u8g2_font_luBS19_tn,const uint8_t[], -Variable,-,u8g2_font_luBS19_tr,const uint8_t[], -Variable,-,u8g2_font_luBS24_te,const uint8_t[], -Variable,-,u8g2_font_luBS24_tf,const uint8_t[], -Variable,-,u8g2_font_luBS24_tn,const uint8_t[], -Variable,-,u8g2_font_luBS24_tr,const uint8_t[], -Variable,-,u8g2_font_luIS08_te,const uint8_t[], -Variable,-,u8g2_font_luIS08_tf,const uint8_t[], -Variable,-,u8g2_font_luIS08_tn,const uint8_t[], -Variable,-,u8g2_font_luIS08_tr,const uint8_t[], -Variable,-,u8g2_font_luIS10_te,const uint8_t[], -Variable,-,u8g2_font_luIS10_tf,const uint8_t[], -Variable,-,u8g2_font_luIS10_tn,const uint8_t[], -Variable,-,u8g2_font_luIS10_tr,const uint8_t[], -Variable,-,u8g2_font_luIS12_te,const uint8_t[], -Variable,-,u8g2_font_luIS12_tf,const uint8_t[], -Variable,-,u8g2_font_luIS12_tn,const uint8_t[], -Variable,-,u8g2_font_luIS12_tr,const uint8_t[], -Variable,-,u8g2_font_luIS14_te,const uint8_t[], -Variable,-,u8g2_font_luIS14_tf,const uint8_t[], -Variable,-,u8g2_font_luIS14_tn,const uint8_t[], -Variable,-,u8g2_font_luIS14_tr,const uint8_t[], -Variable,-,u8g2_font_luIS18_te,const uint8_t[], -Variable,-,u8g2_font_luIS18_tf,const uint8_t[], -Variable,-,u8g2_font_luIS18_tn,const uint8_t[], -Variable,-,u8g2_font_luIS18_tr,const uint8_t[], -Variable,-,u8g2_font_luIS19_te,const uint8_t[], -Variable,-,u8g2_font_luIS19_tf,const uint8_t[], -Variable,-,u8g2_font_luIS19_tn,const uint8_t[], -Variable,-,u8g2_font_luIS19_tr,const uint8_t[], -Variable,-,u8g2_font_luIS24_te,const uint8_t[], -Variable,-,u8g2_font_luIS24_tf,const uint8_t[], -Variable,-,u8g2_font_luIS24_tn,const uint8_t[], -Variable,-,u8g2_font_luIS24_tr,const uint8_t[], -Variable,-,u8g2_font_luRS08_te,const uint8_t[], -Variable,-,u8g2_font_luRS08_tf,const uint8_t[], -Variable,-,u8g2_font_luRS08_tn,const uint8_t[], -Variable,-,u8g2_font_luRS08_tr,const uint8_t[], -Variable,-,u8g2_font_luRS10_te,const uint8_t[], -Variable,-,u8g2_font_luRS10_tf,const uint8_t[], -Variable,-,u8g2_font_luRS10_tn,const uint8_t[], -Variable,-,u8g2_font_luRS10_tr,const uint8_t[], -Variable,-,u8g2_font_luRS12_te,const uint8_t[], -Variable,-,u8g2_font_luRS12_tf,const uint8_t[], -Variable,-,u8g2_font_luRS12_tn,const uint8_t[], -Variable,-,u8g2_font_luRS12_tr,const uint8_t[], -Variable,-,u8g2_font_luRS14_te,const uint8_t[], -Variable,-,u8g2_font_luRS14_tf,const uint8_t[], -Variable,-,u8g2_font_luRS14_tn,const uint8_t[], -Variable,-,u8g2_font_luRS14_tr,const uint8_t[], -Variable,-,u8g2_font_luRS18_te,const uint8_t[], -Variable,-,u8g2_font_luRS18_tf,const uint8_t[], -Variable,-,u8g2_font_luRS18_tn,const uint8_t[], -Variable,-,u8g2_font_luRS18_tr,const uint8_t[], -Variable,-,u8g2_font_luRS19_te,const uint8_t[], -Variable,-,u8g2_font_luRS19_tf,const uint8_t[], -Variable,-,u8g2_font_luRS19_tn,const uint8_t[], -Variable,-,u8g2_font_luRS19_tr,const uint8_t[], -Variable,-,u8g2_font_luRS24_te,const uint8_t[], -Variable,-,u8g2_font_luRS24_tf,const uint8_t[], -Variable,-,u8g2_font_luRS24_tn,const uint8_t[], -Variable,-,u8g2_font_luRS24_tr,const uint8_t[], -Variable,-,u8g2_font_lubB08_te,const uint8_t[], -Variable,-,u8g2_font_lubB08_tf,const uint8_t[], -Variable,-,u8g2_font_lubB08_tn,const uint8_t[], -Variable,-,u8g2_font_lubB08_tr,const uint8_t[], -Variable,-,u8g2_font_lubB10_te,const uint8_t[], -Variable,-,u8g2_font_lubB10_tf,const uint8_t[], -Variable,-,u8g2_font_lubB10_tn,const uint8_t[], -Variable,-,u8g2_font_lubB10_tr,const uint8_t[], -Variable,-,u8g2_font_lubB12_te,const uint8_t[], -Variable,-,u8g2_font_lubB12_tf,const uint8_t[], -Variable,-,u8g2_font_lubB12_tn,const uint8_t[], -Variable,-,u8g2_font_lubB12_tr,const uint8_t[], -Variable,-,u8g2_font_lubB14_te,const uint8_t[], -Variable,-,u8g2_font_lubB14_tf,const uint8_t[], -Variable,-,u8g2_font_lubB14_tn,const uint8_t[], -Variable,-,u8g2_font_lubB14_tr,const uint8_t[], -Variable,-,u8g2_font_lubB18_te,const uint8_t[], -Variable,-,u8g2_font_lubB18_tf,const uint8_t[], -Variable,-,u8g2_font_lubB18_tn,const uint8_t[], -Variable,-,u8g2_font_lubB18_tr,const uint8_t[], -Variable,-,u8g2_font_lubB19_te,const uint8_t[], -Variable,-,u8g2_font_lubB19_tf,const uint8_t[], -Variable,-,u8g2_font_lubB19_tn,const uint8_t[], -Variable,-,u8g2_font_lubB19_tr,const uint8_t[], -Variable,-,u8g2_font_lubB24_te,const uint8_t[], -Variable,-,u8g2_font_lubB24_tf,const uint8_t[], -Variable,-,u8g2_font_lubB24_tn,const uint8_t[], -Variable,-,u8g2_font_lubB24_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI08_te,const uint8_t[], -Variable,-,u8g2_font_lubBI08_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI08_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI08_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI10_te,const uint8_t[], -Variable,-,u8g2_font_lubBI10_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI10_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI10_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI12_te,const uint8_t[], -Variable,-,u8g2_font_lubBI12_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI12_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI12_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI14_te,const uint8_t[], -Variable,-,u8g2_font_lubBI14_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI14_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI14_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI18_te,const uint8_t[], -Variable,-,u8g2_font_lubBI18_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI18_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI18_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI19_te,const uint8_t[], -Variable,-,u8g2_font_lubBI19_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI19_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI19_tr,const uint8_t[], -Variable,-,u8g2_font_lubBI24_te,const uint8_t[], -Variable,-,u8g2_font_lubBI24_tf,const uint8_t[], -Variable,-,u8g2_font_lubBI24_tn,const uint8_t[], -Variable,-,u8g2_font_lubBI24_tr,const uint8_t[], -Variable,-,u8g2_font_lubI08_te,const uint8_t[], -Variable,-,u8g2_font_lubI08_tf,const uint8_t[], -Variable,-,u8g2_font_lubI08_tn,const uint8_t[], -Variable,-,u8g2_font_lubI08_tr,const uint8_t[], -Variable,-,u8g2_font_lubI10_te,const uint8_t[], -Variable,-,u8g2_font_lubI10_tf,const uint8_t[], -Variable,-,u8g2_font_lubI10_tn,const uint8_t[], -Variable,-,u8g2_font_lubI10_tr,const uint8_t[], -Variable,-,u8g2_font_lubI12_te,const uint8_t[], -Variable,-,u8g2_font_lubI12_tf,const uint8_t[], -Variable,-,u8g2_font_lubI12_tn,const uint8_t[], -Variable,-,u8g2_font_lubI12_tr,const uint8_t[], -Variable,-,u8g2_font_lubI14_te,const uint8_t[], -Variable,-,u8g2_font_lubI14_tf,const uint8_t[], -Variable,-,u8g2_font_lubI14_tn,const uint8_t[], -Variable,-,u8g2_font_lubI14_tr,const uint8_t[], -Variable,-,u8g2_font_lubI18_te,const uint8_t[], -Variable,-,u8g2_font_lubI18_tf,const uint8_t[], -Variable,-,u8g2_font_lubI18_tn,const uint8_t[], -Variable,-,u8g2_font_lubI18_tr,const uint8_t[], -Variable,-,u8g2_font_lubI19_te,const uint8_t[], -Variable,-,u8g2_font_lubI19_tf,const uint8_t[], -Variable,-,u8g2_font_lubI19_tn,const uint8_t[], -Variable,-,u8g2_font_lubI19_tr,const uint8_t[], -Variable,-,u8g2_font_lubI24_te,const uint8_t[], -Variable,-,u8g2_font_lubI24_tf,const uint8_t[], -Variable,-,u8g2_font_lubI24_tn,const uint8_t[], -Variable,-,u8g2_font_lubI24_tr,const uint8_t[], -Variable,-,u8g2_font_lubR08_te,const uint8_t[], -Variable,-,u8g2_font_lubR08_tf,const uint8_t[], -Variable,-,u8g2_font_lubR08_tn,const uint8_t[], -Variable,-,u8g2_font_lubR08_tr,const uint8_t[], -Variable,-,u8g2_font_lubR10_te,const uint8_t[], -Variable,-,u8g2_font_lubR10_tf,const uint8_t[], -Variable,-,u8g2_font_lubR10_tn,const uint8_t[], -Variable,-,u8g2_font_lubR10_tr,const uint8_t[], -Variable,-,u8g2_font_lubR12_te,const uint8_t[], -Variable,-,u8g2_font_lubR12_tf,const uint8_t[], -Variable,-,u8g2_font_lubR12_tn,const uint8_t[], -Variable,-,u8g2_font_lubR12_tr,const uint8_t[], -Variable,-,u8g2_font_lubR14_te,const uint8_t[], -Variable,-,u8g2_font_lubR14_tf,const uint8_t[], -Variable,-,u8g2_font_lubR14_tn,const uint8_t[], -Variable,-,u8g2_font_lubR14_tr,const uint8_t[], -Variable,-,u8g2_font_lubR18_te,const uint8_t[], -Variable,-,u8g2_font_lubR18_tf,const uint8_t[], -Variable,-,u8g2_font_lubR18_tn,const uint8_t[], -Variable,-,u8g2_font_lubR18_tr,const uint8_t[], -Variable,-,u8g2_font_lubR19_te,const uint8_t[], -Variable,-,u8g2_font_lubR19_tf,const uint8_t[], -Variable,-,u8g2_font_lubR19_tn,const uint8_t[], -Variable,-,u8g2_font_lubR19_tr,const uint8_t[], -Variable,-,u8g2_font_lubR24_te,const uint8_t[], -Variable,-,u8g2_font_lubR24_tf,const uint8_t[], -Variable,-,u8g2_font_lubR24_tn,const uint8_t[], -Variable,-,u8g2_font_lubR24_tr,const uint8_t[], -Variable,-,u8g2_font_lucasarts_scumm_subtitle_o_tf,const uint8_t[], -Variable,-,u8g2_font_lucasarts_scumm_subtitle_o_tn,const uint8_t[], -Variable,-,u8g2_font_lucasarts_scumm_subtitle_o_tr,const uint8_t[], -Variable,-,u8g2_font_lucasarts_scumm_subtitle_r_tf,const uint8_t[], -Variable,-,u8g2_font_lucasarts_scumm_subtitle_r_tn,const uint8_t[], -Variable,-,u8g2_font_lucasarts_scumm_subtitle_r_tr,const uint8_t[], -Variable,-,u8g2_font_lucasfont_alternate_tf,const uint8_t[], -Variable,-,u8g2_font_lucasfont_alternate_tn,const uint8_t[], -Variable,-,u8g2_font_lucasfont_alternate_tr,const uint8_t[], -Variable,-,u8g2_font_m2icon_5_tf,const uint8_t[], -Variable,-,u8g2_font_m2icon_7_tf,const uint8_t[], -Variable,-,u8g2_font_m2icon_9_tf,const uint8_t[], -Variable,-,u8g2_font_mademoiselle_mel_tn,const uint8_t[], -Variable,-,u8g2_font_mademoiselle_mel_tr,const uint8_t[], -Variable,-,u8g2_font_maniac_te,const uint8_t[], -Variable,-,u8g2_font_maniac_tf,const uint8_t[], -Variable,-,u8g2_font_maniac_tn,const uint8_t[], -Variable,-,u8g2_font_maniac_tr,const uint8_t[], -Variable,-,u8g2_font_mercutio_basic_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_mercutio_basic_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_mercutio_basic_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_mercutio_basic_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_mercutio_sc_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_mercutio_sc_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_mercutio_sc_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_mercutio_sc_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_michaelmouse_tu,const uint8_t[], -Variable,-,u8g2_font_micro_mn,const uint8_t[], -Variable,-,u8g2_font_micro_mr,const uint8_t[], -Variable,-,u8g2_font_micro_tn,const uint8_t[], -Variable,-,u8g2_font_micro_tr,const uint8_t[], -Variable,-,u8g2_font_miranda_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_miranda_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_miranda_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_missingplanet_t_all,const uint8_t[], -Variable,-,u8g2_font_missingplanet_tf,const uint8_t[], -Variable,-,u8g2_font_missingplanet_tn,const uint8_t[], -Variable,-,u8g2_font_missingplanet_tr,const uint8_t[], -Variable,-,u8g2_font_mozart_nbp_h_all,const uint8_t[], -Variable,-,u8g2_font_mozart_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_mozart_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_mozart_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_mozart_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_ncenB08_te,const uint8_t[], -Variable,-,u8g2_font_ncenB08_tf,const uint8_t[], -Variable,-,u8g2_font_ncenB08_tn,const uint8_t[], -Variable,-,u8g2_font_ncenB08_tr,const uint8_t[], -Variable,-,u8g2_font_ncenB10_te,const uint8_t[], -Variable,-,u8g2_font_ncenB10_tf,const uint8_t[], -Variable,-,u8g2_font_ncenB10_tn,const uint8_t[], -Variable,-,u8g2_font_ncenB10_tr,const uint8_t[], -Variable,-,u8g2_font_ncenB12_te,const uint8_t[], -Variable,-,u8g2_font_ncenB12_tf,const uint8_t[], -Variable,-,u8g2_font_ncenB12_tn,const uint8_t[], -Variable,-,u8g2_font_ncenB12_tr,const uint8_t[], -Variable,-,u8g2_font_ncenB14_te,const uint8_t[], -Variable,-,u8g2_font_ncenB14_tf,const uint8_t[], -Variable,-,u8g2_font_ncenB14_tn,const uint8_t[], -Variable,-,u8g2_font_ncenB14_tr,const uint8_t[], -Variable,-,u8g2_font_ncenB18_te,const uint8_t[], -Variable,-,u8g2_font_ncenB18_tf,const uint8_t[], -Variable,-,u8g2_font_ncenB18_tn,const uint8_t[], -Variable,-,u8g2_font_ncenB18_tr,const uint8_t[], -Variable,-,u8g2_font_ncenB24_te,const uint8_t[], -Variable,-,u8g2_font_ncenB24_tf,const uint8_t[], -Variable,-,u8g2_font_ncenB24_tn,const uint8_t[], -Variable,-,u8g2_font_ncenB24_tr,const uint8_t[], -Variable,-,u8g2_font_ncenR08_te,const uint8_t[], -Variable,-,u8g2_font_ncenR08_tf,const uint8_t[], -Variable,-,u8g2_font_ncenR08_tn,const uint8_t[], -Variable,-,u8g2_font_ncenR08_tr,const uint8_t[], -Variable,-,u8g2_font_ncenR10_te,const uint8_t[], -Variable,-,u8g2_font_ncenR10_tf,const uint8_t[], -Variable,-,u8g2_font_ncenR10_tn,const uint8_t[], -Variable,-,u8g2_font_ncenR10_tr,const uint8_t[], -Variable,-,u8g2_font_ncenR12_te,const uint8_t[], -Variable,-,u8g2_font_ncenR12_tf,const uint8_t[], -Variable,-,u8g2_font_ncenR12_tn,const uint8_t[], -Variable,-,u8g2_font_ncenR12_tr,const uint8_t[], -Variable,-,u8g2_font_ncenR14_te,const uint8_t[], -Variable,-,u8g2_font_ncenR14_tf,const uint8_t[], -Variable,-,u8g2_font_ncenR14_tn,const uint8_t[], -Variable,-,u8g2_font_ncenR14_tr,const uint8_t[], -Variable,-,u8g2_font_ncenR18_te,const uint8_t[], -Variable,-,u8g2_font_ncenR18_tf,const uint8_t[], -Variable,-,u8g2_font_ncenR18_tn,const uint8_t[], -Variable,-,u8g2_font_ncenR18_tr,const uint8_t[], -Variable,-,u8g2_font_ncenR24_te,const uint8_t[], -Variable,-,u8g2_font_ncenR24_tf,const uint8_t[], -Variable,-,u8g2_font_ncenR24_tn,const uint8_t[], -Variable,-,u8g2_font_ncenR24_tr,const uint8_t[], -Variable,-,u8g2_font_nerhoe_tf,const uint8_t[], -Variable,-,u8g2_font_nerhoe_tn,const uint8_t[], -Variable,-,u8g2_font_nerhoe_tr,const uint8_t[], -Variable,-,u8g2_font_nine_by_five_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_nine_by_five_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_nine_by_five_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_nine_by_five_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_nokiafc22_tf,const uint8_t[], -Variable,-,u8g2_font_nokiafc22_tn,const uint8_t[], -Variable,-,u8g2_font_nokiafc22_tr,const uint8_t[], -Variable,-,u8g2_font_nokiafc22_tu,const uint8_t[], -Variable,-,u8g2_font_oldwizard_tf,const uint8_t[], -Variable,-,u8g2_font_oldwizard_tn,const uint8_t[], -Variable,-,u8g2_font_oldwizard_tr,const uint8_t[], -Variable,-,u8g2_font_oldwizard_tu,const uint8_t[], -Variable,-,u8g2_font_open_iconic_all_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_all_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_all_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_all_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_all_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_app_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_app_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_app_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_app_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_app_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_arrow_1x_t,const uint8_t[], -Variable,+,u8g2_font_open_iconic_arrow_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_arrow_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_arrow_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_arrow_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_check_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_check_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_check_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_check_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_check_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_email_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_email_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_email_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_email_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_email_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_embedded_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_embedded_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_embedded_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_embedded_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_embedded_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_gui_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_gui_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_gui_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_gui_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_gui_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_human_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_human_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_human_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_human_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_human_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_mime_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_mime_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_mime_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_mime_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_mime_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_other_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_other_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_other_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_other_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_other_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_play_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_play_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_play_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_play_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_play_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_text_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_text_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_text_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_text_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_text_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_thing_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_thing_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_thing_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_thing_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_thing_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_weather_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_weather_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_weather_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_weather_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_weather_8x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_www_1x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_www_2x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_www_4x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_www_6x_t,const uint8_t[], -Variable,-,u8g2_font_open_iconic_www_8x_t,const uint8_t[], -Variable,-,u8g2_font_ordinarybasis_t_all,const uint8_t[], -Variable,-,u8g2_font_ordinarybasis_tf,const uint8_t[], -Variable,-,u8g2_font_ordinarybasis_tn,const uint8_t[], -Variable,-,u8g2_font_ordinarybasis_tr,const uint8_t[], -Variable,-,u8g2_font_osb18_tf,const uint8_t[], -Variable,-,u8g2_font_osb18_tn,const uint8_t[], -Variable,-,u8g2_font_osb18_tr,const uint8_t[], -Variable,-,u8g2_font_osb21_tf,const uint8_t[], -Variable,-,u8g2_font_osb21_tn,const uint8_t[], -Variable,-,u8g2_font_osb21_tr,const uint8_t[], -Variable,-,u8g2_font_osb26_tf,const uint8_t[], -Variable,-,u8g2_font_osb26_tn,const uint8_t[], -Variable,-,u8g2_font_osb26_tr,const uint8_t[], -Variable,-,u8g2_font_osb29_tf,const uint8_t[], -Variable,-,u8g2_font_osb29_tn,const uint8_t[], -Variable,-,u8g2_font_osb29_tr,const uint8_t[], -Variable,-,u8g2_font_osb35_tf,const uint8_t[], -Variable,-,u8g2_font_osb35_tn,const uint8_t[], -Variable,-,u8g2_font_osb35_tr,const uint8_t[], -Variable,-,u8g2_font_osb41_tf,const uint8_t[], -Variable,-,u8g2_font_osb41_tn,const uint8_t[], -Variable,-,u8g2_font_osb41_tr,const uint8_t[], -Variable,-,u8g2_font_oskool_tf,const uint8_t[], -Variable,-,u8g2_font_oskool_tn,const uint8_t[], -Variable,-,u8g2_font_oskool_tr,const uint8_t[], -Variable,-,u8g2_font_osr18_tf,const uint8_t[], -Variable,-,u8g2_font_osr18_tn,const uint8_t[], -Variable,-,u8g2_font_osr18_tr,const uint8_t[], -Variable,-,u8g2_font_osr21_tf,const uint8_t[], -Variable,-,u8g2_font_osr21_tn,const uint8_t[], -Variable,-,u8g2_font_osr21_tr,const uint8_t[], -Variable,-,u8g2_font_osr26_tf,const uint8_t[], -Variable,-,u8g2_font_osr26_tn,const uint8_t[], -Variable,-,u8g2_font_osr26_tr,const uint8_t[], -Variable,-,u8g2_font_osr29_tf,const uint8_t[], -Variable,-,u8g2_font_osr29_tn,const uint8_t[], -Variable,-,u8g2_font_osr29_tr,const uint8_t[], -Variable,-,u8g2_font_osr35_tf,const uint8_t[], -Variable,-,u8g2_font_osr35_tn,const uint8_t[], -Variable,-,u8g2_font_osr35_tr,const uint8_t[], -Variable,-,u8g2_font_osr41_tf,const uint8_t[], -Variable,-,u8g2_font_osr41_tn,const uint8_t[], -Variable,-,u8g2_font_osr41_tr,const uint8_t[], -Variable,-,u8g2_font_p01type_tf,const uint8_t[], -Variable,-,u8g2_font_p01type_tn,const uint8_t[], -Variable,-,u8g2_font_p01type_tr,const uint8_t[], -Variable,-,u8g2_font_pcsenior_8f,const uint8_t[], -Variable,-,u8g2_font_pcsenior_8n,const uint8_t[], -Variable,-,u8g2_font_pcsenior_8r,const uint8_t[], -Variable,-,u8g2_font_pcsenior_8u,const uint8_t[], -Variable,-,u8g2_font_pearfont_tr,const uint8_t[], -Variable,-,u8g2_font_pieceofcake_mel_tn,const uint8_t[], -Variable,-,u8g2_font_pieceofcake_mel_tr,const uint8_t[], -Variable,-,u8g2_font_pixelle_micro_tn,const uint8_t[], -Variable,-,u8g2_font_pixelle_micro_tr,const uint8_t[], -Variable,-,u8g2_font_pixelmordred_t_all,const uint8_t[], -Variable,-,u8g2_font_pixelmordred_tf,const uint8_t[], -Variable,-,u8g2_font_pixelmordred_tn,const uint8_t[], -Variable,-,u8g2_font_pixelmordred_tr,const uint8_t[], -Variable,-,u8g2_font_pixelpoiiz_tr,const uint8_t[], -Variable,-,u8g2_font_press_mel_tn,const uint8_t[], -Variable,-,u8g2_font_press_mel_tr,const uint8_t[], -Variable,-,u8g2_font_pressstart2p_8f,const uint8_t[], -Variable,-,u8g2_font_pressstart2p_8n,const uint8_t[], -Variable,-,u8g2_font_pressstart2p_8r,const uint8_t[], -Variable,-,u8g2_font_pressstart2p_8u,const uint8_t[], -Variable,-,u8g2_font_profont10_mf,const uint8_t[], -Variable,-,u8g2_font_profont10_mn,const uint8_t[], -Variable,-,u8g2_font_profont10_mr,const uint8_t[], -Variable,-,u8g2_font_profont10_tf,const uint8_t[], -Variable,-,u8g2_font_profont10_tn,const uint8_t[], -Variable,-,u8g2_font_profont10_tr,const uint8_t[], -Variable,-,u8g2_font_profont11_mf,const uint8_t[], -Variable,-,u8g2_font_profont11_mn,const uint8_t[], -Variable,-,u8g2_font_profont11_mr,const uint8_t[], -Variable,-,u8g2_font_profont11_tf,const uint8_t[], -Variable,-,u8g2_font_profont11_tn,const uint8_t[], -Variable,-,u8g2_font_profont11_tr,const uint8_t[], -Variable,-,u8g2_font_profont12_mf,const uint8_t[], -Variable,-,u8g2_font_profont12_mn,const uint8_t[], -Variable,-,u8g2_font_profont12_mr,const uint8_t[], -Variable,-,u8g2_font_profont12_tf,const uint8_t[], -Variable,-,u8g2_font_profont12_tn,const uint8_t[], -Variable,-,u8g2_font_profont12_tr,const uint8_t[], -Variable,-,u8g2_font_profont15_mf,const uint8_t[], -Variable,-,u8g2_font_profont15_mn,const uint8_t[], -Variable,-,u8g2_font_profont15_mr,const uint8_t[], -Variable,-,u8g2_font_profont15_tf,const uint8_t[], -Variable,-,u8g2_font_profont15_tn,const uint8_t[], -Variable,-,u8g2_font_profont15_tr,const uint8_t[], -Variable,-,u8g2_font_profont17_mf,const uint8_t[], -Variable,-,u8g2_font_profont17_mn,const uint8_t[], -Variable,-,u8g2_font_profont17_mr,const uint8_t[], -Variable,-,u8g2_font_profont17_tf,const uint8_t[], -Variable,-,u8g2_font_profont17_tn,const uint8_t[], -Variable,-,u8g2_font_profont17_tr,const uint8_t[], -Variable,-,u8g2_font_profont22_mf,const uint8_t[], -Variable,-,u8g2_font_profont22_mn,const uint8_t[], -Variable,-,u8g2_font_profont22_mr,const uint8_t[], -Variable,-,u8g2_font_profont22_tf,const uint8_t[], -Variable,-,u8g2_font_profont22_tn,const uint8_t[], -Variable,-,u8g2_font_profont22_tr,const uint8_t[], -Variable,-,u8g2_font_profont29_mf,const uint8_t[], -Variable,-,u8g2_font_profont29_mn,const uint8_t[], -Variable,-,u8g2_font_profont29_mr,const uint8_t[], -Variable,-,u8g2_font_profont29_tf,const uint8_t[], -Variable,-,u8g2_font_profont29_tn,const uint8_t[], -Variable,-,u8g2_font_profont29_tr,const uint8_t[], -Variable,-,u8g2_font_prospero_bold_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_prospero_bold_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_prospero_bold_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_prospero_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_prospero_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_prospero_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_px437wyse700a_mf,const uint8_t[], -Variable,-,u8g2_font_px437wyse700a_mn,const uint8_t[], -Variable,-,u8g2_font_px437wyse700a_mr,const uint8_t[], -Variable,-,u8g2_font_px437wyse700a_tf,const uint8_t[], -Variable,-,u8g2_font_px437wyse700a_tn,const uint8_t[], -Variable,-,u8g2_font_px437wyse700a_tr,const uint8_t[], -Variable,-,u8g2_font_px437wyse700b_mf,const uint8_t[], -Variable,-,u8g2_font_px437wyse700b_mn,const uint8_t[], -Variable,-,u8g2_font_px437wyse700b_mr,const uint8_t[], -Variable,-,u8g2_font_px437wyse700b_tf,const uint8_t[], -Variable,-,u8g2_font_px437wyse700b_tn,const uint8_t[], -Variable,-,u8g2_font_px437wyse700b_tr,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcga_8f,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcga_8n,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcga_8r,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcga_8u,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcgathin_8f,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcgathin_8n,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcgathin_8r,const uint8_t[], -Variable,-,u8g2_font_pxplusibmcgathin_8u,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_m_all,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_mf,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_mn,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_mr,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_t_all,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_tf,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_tn,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga8_tr,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_m_all,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_mf,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_mn,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_mr,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_t_all,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_tf,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_tn,const uint8_t[], -Variable,-,u8g2_font_pxplusibmvga9_tr,const uint8_t[], -Variable,-,u8g2_font_pxplustandynewtv_8_all,const uint8_t[], -Variable,-,u8g2_font_pxplustandynewtv_8f,const uint8_t[], -Variable,-,u8g2_font_pxplustandynewtv_8n,const uint8_t[], -Variable,-,u8g2_font_pxplustandynewtv_8r,const uint8_t[], -Variable,-,u8g2_font_pxplustandynewtv_8u,const uint8_t[], -Variable,-,u8g2_font_pxplustandynewtv_t_all,const uint8_t[], -Variable,-,u8g2_font_questgiver_tr,const uint8_t[], -Variable,-,u8g2_font_repress_mel_tn,const uint8_t[], -Variable,-,u8g2_font_repress_mel_tr,const uint8_t[], -Variable,-,u8g2_font_robot_de_niro_tf,const uint8_t[], -Variable,-,u8g2_font_robot_de_niro_tn,const uint8_t[], -Variable,-,u8g2_font_robot_de_niro_tr,const uint8_t[], -Variable,-,u8g2_font_roentgen_nbp_h_all,const uint8_t[], -Variable,-,u8g2_font_roentgen_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_roentgen_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_roentgen_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_roentgen_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_rosencrantz_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_rosencrantz_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_rosencrantz_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_rosencrantz_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_saikyosansbold8_8n,const uint8_t[], -Variable,-,u8g2_font_saikyosansbold8_8u,const uint8_t[], -Variable,-,u8g2_font_samim_10_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_12_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_14_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_16_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_fd_10_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_fd_12_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_fd_14_t_all,const uint8_t[], -Variable,-,u8g2_font_samim_fd_16_t_all,const uint8_t[], -Variable,-,u8g2_font_sandyforest_tn,const uint8_t[], -Variable,-,u8g2_font_sandyforest_tr,const uint8_t[], -Variable,-,u8g2_font_sandyforest_tu,const uint8_t[], -Variable,-,u8g2_font_secretaryhand_t_all,const uint8_t[], -Variable,-,u8g2_font_secretaryhand_tf,const uint8_t[], -Variable,-,u8g2_font_secretaryhand_tn,const uint8_t[], -Variable,-,u8g2_font_secretaryhand_tr,const uint8_t[], -Variable,-,u8g2_font_seraphimb1_tr,const uint8_t[], -Variable,-,u8g2_font_shylock_nbp_t_all,const uint8_t[], -Variable,-,u8g2_font_shylock_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_shylock_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_shylock_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_siji_t_6x10,const uint8_t[], -Variable,-,u8g2_font_sirclive_tn,const uint8_t[], -Variable,-,u8g2_font_sirclive_tr,const uint8_t[], -Variable,-,u8g2_font_sirclivethebold_tn,const uint8_t[], -Variable,-,u8g2_font_sirclivethebold_tr,const uint8_t[], -Variable,-,u8g2_font_smart_patrol_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_smart_patrol_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_smart_patrol_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_squirrel_tn,const uint8_t[], -Variable,-,u8g2_font_squirrel_tr,const uint8_t[], -Variable,-,u8g2_font_squirrel_tu,const uint8_t[], -Variable,-,u8g2_font_sticker_mel_tn,const uint8_t[], -Variable,-,u8g2_font_sticker_mel_tr,const uint8_t[], -Variable,-,u8g2_font_synchronizer_nbp_tf,const uint8_t[], -Variable,-,u8g2_font_synchronizer_nbp_tn,const uint8_t[], -Variable,-,u8g2_font_synchronizer_nbp_tr,const uint8_t[], -Variable,-,u8g2_font_t0_11_me,const uint8_t[], -Variable,-,u8g2_font_t0_11_mf,const uint8_t[], -Variable,-,u8g2_font_t0_11_mn,const uint8_t[], -Variable,-,u8g2_font_t0_11_mr,const uint8_t[], -Variable,-,u8g2_font_t0_11_t_all,const uint8_t[], -Variable,-,u8g2_font_t0_11_te,const uint8_t[], -Variable,-,u8g2_font_t0_11_tf,const uint8_t[], -Variable,-,u8g2_font_t0_11_tn,const uint8_t[], -Variable,-,u8g2_font_t0_11_tr,const uint8_t[], -Variable,-,u8g2_font_t0_11b_me,const uint8_t[], -Variable,-,u8g2_font_t0_11b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_11b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_11b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_11b_te,const uint8_t[], -Variable,-,u8g2_font_t0_11b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_11b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_11b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_12_me,const uint8_t[], -Variable,-,u8g2_font_t0_12_mf,const uint8_t[], -Variable,-,u8g2_font_t0_12_mn,const uint8_t[], -Variable,-,u8g2_font_t0_12_mr,const uint8_t[], -Variable,-,u8g2_font_t0_12_te,const uint8_t[], -Variable,-,u8g2_font_t0_12_tf,const uint8_t[], -Variable,-,u8g2_font_t0_12_tn,const uint8_t[], -Variable,-,u8g2_font_t0_12_tr,const uint8_t[], -Variable,-,u8g2_font_t0_12b_me,const uint8_t[], -Variable,-,u8g2_font_t0_12b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_12b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_12b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_12b_te,const uint8_t[], -Variable,-,u8g2_font_t0_12b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_12b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_12b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_13_me,const uint8_t[], -Variable,-,u8g2_font_t0_13_mf,const uint8_t[], -Variable,-,u8g2_font_t0_13_mn,const uint8_t[], -Variable,-,u8g2_font_t0_13_mr,const uint8_t[], -Variable,-,u8g2_font_t0_13_te,const uint8_t[], -Variable,-,u8g2_font_t0_13_tf,const uint8_t[], -Variable,-,u8g2_font_t0_13_tn,const uint8_t[], -Variable,-,u8g2_font_t0_13_tr,const uint8_t[], -Variable,-,u8g2_font_t0_13b_me,const uint8_t[], -Variable,-,u8g2_font_t0_13b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_13b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_13b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_13b_te,const uint8_t[], -Variable,-,u8g2_font_t0_13b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_13b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_13b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_14_me,const uint8_t[], -Variable,-,u8g2_font_t0_14_mf,const uint8_t[], -Variable,-,u8g2_font_t0_14_mn,const uint8_t[], -Variable,-,u8g2_font_t0_14_mr,const uint8_t[], -Variable,-,u8g2_font_t0_14_te,const uint8_t[], -Variable,-,u8g2_font_t0_14_tf,const uint8_t[], -Variable,-,u8g2_font_t0_14_tn,const uint8_t[], -Variable,-,u8g2_font_t0_14_tr,const uint8_t[], -Variable,-,u8g2_font_t0_14b_me,const uint8_t[], -Variable,-,u8g2_font_t0_14b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_14b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_14b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_14b_te,const uint8_t[], -Variable,-,u8g2_font_t0_14b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_14b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_14b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_15_me,const uint8_t[], -Variable,-,u8g2_font_t0_15_mf,const uint8_t[], -Variable,-,u8g2_font_t0_15_mn,const uint8_t[], -Variable,-,u8g2_font_t0_15_mr,const uint8_t[], -Variable,-,u8g2_font_t0_15_te,const uint8_t[], -Variable,-,u8g2_font_t0_15_tf,const uint8_t[], -Variable,-,u8g2_font_t0_15_tn,const uint8_t[], -Variable,-,u8g2_font_t0_15_tr,const uint8_t[], -Variable,-,u8g2_font_t0_15b_me,const uint8_t[], -Variable,-,u8g2_font_t0_15b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_15b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_15b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_15b_te,const uint8_t[], -Variable,-,u8g2_font_t0_15b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_15b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_15b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_16_me,const uint8_t[], -Variable,-,u8g2_font_t0_16_mf,const uint8_t[], -Variable,-,u8g2_font_t0_16_mn,const uint8_t[], -Variable,-,u8g2_font_t0_16_mr,const uint8_t[], -Variable,-,u8g2_font_t0_16_te,const uint8_t[], -Variable,-,u8g2_font_t0_16_tf,const uint8_t[], -Variable,-,u8g2_font_t0_16_tn,const uint8_t[], -Variable,-,u8g2_font_t0_16_tr,const uint8_t[], -Variable,-,u8g2_font_t0_16b_me,const uint8_t[], -Variable,-,u8g2_font_t0_16b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_16b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_16b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_16b_te,const uint8_t[], -Variable,-,u8g2_font_t0_16b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_16b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_16b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_17_me,const uint8_t[], -Variable,-,u8g2_font_t0_17_mf,const uint8_t[], -Variable,-,u8g2_font_t0_17_mn,const uint8_t[], -Variable,-,u8g2_font_t0_17_mr,const uint8_t[], -Variable,-,u8g2_font_t0_17_te,const uint8_t[], -Variable,-,u8g2_font_t0_17_tf,const uint8_t[], -Variable,-,u8g2_font_t0_17_tn,const uint8_t[], -Variable,-,u8g2_font_t0_17_tr,const uint8_t[], -Variable,-,u8g2_font_t0_17b_me,const uint8_t[], -Variable,-,u8g2_font_t0_17b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_17b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_17b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_17b_te,const uint8_t[], -Variable,-,u8g2_font_t0_17b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_17b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_17b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_18_me,const uint8_t[], -Variable,-,u8g2_font_t0_18_mf,const uint8_t[], -Variable,-,u8g2_font_t0_18_mn,const uint8_t[], -Variable,-,u8g2_font_t0_18_mr,const uint8_t[], -Variable,-,u8g2_font_t0_18_te,const uint8_t[], -Variable,-,u8g2_font_t0_18_tf,const uint8_t[], -Variable,-,u8g2_font_t0_18_tn,const uint8_t[], -Variable,-,u8g2_font_t0_18_tr,const uint8_t[], -Variable,-,u8g2_font_t0_18b_me,const uint8_t[], -Variable,-,u8g2_font_t0_18b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_18b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_18b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_18b_te,const uint8_t[], -Variable,-,u8g2_font_t0_18b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_18b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_18b_tr,const uint8_t[], -Variable,-,u8g2_font_t0_22_me,const uint8_t[], -Variable,-,u8g2_font_t0_22_mf,const uint8_t[], -Variable,-,u8g2_font_t0_22_mn,const uint8_t[], -Variable,-,u8g2_font_t0_22_mr,const uint8_t[], -Variable,-,u8g2_font_t0_22_te,const uint8_t[], -Variable,-,u8g2_font_t0_22_tf,const uint8_t[], -Variable,-,u8g2_font_t0_22_tn,const uint8_t[], -Variable,-,u8g2_font_t0_22_tr,const uint8_t[], -Variable,-,u8g2_font_t0_22b_me,const uint8_t[], -Variable,-,u8g2_font_t0_22b_mf,const uint8_t[], -Variable,-,u8g2_font_t0_22b_mn,const uint8_t[], -Variable,-,u8g2_font_t0_22b_mr,const uint8_t[], -Variable,-,u8g2_font_t0_22b_te,const uint8_t[], -Variable,-,u8g2_font_t0_22b_tf,const uint8_t[], -Variable,-,u8g2_font_t0_22b_tn,const uint8_t[], -Variable,-,u8g2_font_t0_22b_tr,const uint8_t[], -Variable,-,u8g2_font_tallpix_tr,const uint8_t[], -Variable,-,u8g2_font_tenfatguys_t_all,const uint8_t[], -Variable,-,u8g2_font_tenfatguys_tf,const uint8_t[], -Variable,-,u8g2_font_tenfatguys_tn,const uint8_t[], -Variable,-,u8g2_font_tenfatguys_tr,const uint8_t[], -Variable,-,u8g2_font_tenfatguys_tu,const uint8_t[], -Variable,-,u8g2_font_tenstamps_mf,const uint8_t[], -Variable,-,u8g2_font_tenstamps_mn,const uint8_t[], -Variable,-,u8g2_font_tenstamps_mr,const uint8_t[], -Variable,-,u8g2_font_tenstamps_mu,const uint8_t[], -Variable,-,u8g2_font_tenthinguys_t_all,const uint8_t[], -Variable,-,u8g2_font_tenthinguys_tf,const uint8_t[], -Variable,-,u8g2_font_tenthinguys_tn,const uint8_t[], -Variable,-,u8g2_font_tenthinguys_tr,const uint8_t[], -Variable,-,u8g2_font_tenthinguys_tu,const uint8_t[], -Variable,-,u8g2_font_tenthinnerguys_t_all,const uint8_t[], -Variable,-,u8g2_font_tenthinnerguys_tf,const uint8_t[], -Variable,-,u8g2_font_tenthinnerguys_tn,const uint8_t[], -Variable,-,u8g2_font_tenthinnerguys_tr,const uint8_t[], -Variable,-,u8g2_font_tenthinnerguys_tu,const uint8_t[], -Variable,-,u8g2_font_timB08_tf,const uint8_t[], -Variable,-,u8g2_font_timB08_tn,const uint8_t[], -Variable,-,u8g2_font_timB08_tr,const uint8_t[], -Variable,-,u8g2_font_timB10_tf,const uint8_t[], -Variable,-,u8g2_font_timB10_tn,const uint8_t[], -Variable,-,u8g2_font_timB10_tr,const uint8_t[], -Variable,-,u8g2_font_timB12_tf,const uint8_t[], -Variable,-,u8g2_font_timB12_tn,const uint8_t[], -Variable,-,u8g2_font_timB12_tr,const uint8_t[], -Variable,-,u8g2_font_timB14_tf,const uint8_t[], -Variable,-,u8g2_font_timB14_tn,const uint8_t[], -Variable,-,u8g2_font_timB14_tr,const uint8_t[], -Variable,-,u8g2_font_timB18_tf,const uint8_t[], -Variable,-,u8g2_font_timB18_tn,const uint8_t[], -Variable,-,u8g2_font_timB18_tr,const uint8_t[], -Variable,-,u8g2_font_timB24_tf,const uint8_t[], -Variable,-,u8g2_font_timB24_tn,const uint8_t[], -Variable,-,u8g2_font_timB24_tr,const uint8_t[], -Variable,-,u8g2_font_timR08_tf,const uint8_t[], -Variable,-,u8g2_font_timR08_tn,const uint8_t[], -Variable,-,u8g2_font_timR08_tr,const uint8_t[], -Variable,-,u8g2_font_timR10_tf,const uint8_t[], -Variable,-,u8g2_font_timR10_tn,const uint8_t[], -Variable,-,u8g2_font_timR10_tr,const uint8_t[], -Variable,-,u8g2_font_timR12_tf,const uint8_t[], -Variable,-,u8g2_font_timR12_tn,const uint8_t[], -Variable,-,u8g2_font_timR12_tr,const uint8_t[], -Variable,-,u8g2_font_timR14_tf,const uint8_t[], -Variable,-,u8g2_font_timR14_tn,const uint8_t[], -Variable,-,u8g2_font_timR14_tr,const uint8_t[], -Variable,-,u8g2_font_timR18_tf,const uint8_t[], -Variable,-,u8g2_font_timR18_tn,const uint8_t[], -Variable,-,u8g2_font_timR18_tr,const uint8_t[], -Variable,-,u8g2_font_timR24_tf,const uint8_t[], -Variable,-,u8g2_font_timR24_tn,const uint8_t[], -Variable,-,u8g2_font_timR24_tr,const uint8_t[], -Variable,-,u8g2_font_tinytim_tf,const uint8_t[], -Variable,-,u8g2_font_tinytim_tn,const uint8_t[], -Variable,-,u8g2_font_tinytim_tr,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_me,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_mf,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_mn,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_mr,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_t_all,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_te,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_tf,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_tn,const uint8_t[], -Variable,-,u8g2_font_tom_thumb_4x6_tr,const uint8_t[], -Variable,-,u8g2_font_tooseornament_tf,const uint8_t[], -Variable,-,u8g2_font_tooseornament_tn,const uint8_t[], -Variable,-,u8g2_font_tooseornament_tr,const uint8_t[], -Variable,-,u8g2_font_torussansbold8_8n,const uint8_t[], -Variable,-,u8g2_font_torussansbold8_8r,const uint8_t[], -Variable,-,u8g2_font_torussansbold8_8u,const uint8_t[], -Variable,-,u8g2_font_trixel_square_tf,const uint8_t[], -Variable,-,u8g2_font_trixel_square_tn,const uint8_t[], -Variable,-,u8g2_font_trixel_square_tr,const uint8_t[], -Variable,-,u8g2_font_twelvedings_t_all,const uint8_t[], -Variable,-,u8g2_font_u8glib_4_hf,const uint8_t[], -Variable,-,u8g2_font_u8glib_4_hr,const uint8_t[], -Variable,-,u8g2_font_u8glib_4_tf,const uint8_t[], -Variable,-,u8g2_font_u8glib_4_tr,const uint8_t[], -Variable,-,u8g2_font_unifont_h_symbols,const uint8_t[], -Variable,-,u8g2_font_unifont_t_0_72_73,const uint8_t[], -Variable,-,u8g2_font_unifont_t_0_75,const uint8_t[], -Variable,-,u8g2_font_unifont_t_0_76,const uint8_t[], -Variable,-,u8g2_font_unifont_t_0_77,const uint8_t[], -Variable,-,u8g2_font_unifont_t_0_78_79,const uint8_t[], -Variable,-,u8g2_font_unifont_t_0_86,const uint8_t[], -Variable,-,u8g2_font_unifont_t_72_73,const uint8_t[], -Variable,-,u8g2_font_unifont_t_75,const uint8_t[], -Variable,-,u8g2_font_unifont_t_76,const uint8_t[], -Variable,-,u8g2_font_unifont_t_77,const uint8_t[], -Variable,-,u8g2_font_unifont_t_78_79,const uint8_t[], -Variable,-,u8g2_font_unifont_t_86,const uint8_t[], -Variable,-,u8g2_font_unifont_t_animals,const uint8_t[], -Variable,-,u8g2_font_unifont_t_arabic,const uint8_t[], -Variable,-,u8g2_font_unifont_t_bengali,const uint8_t[], -Variable,-,u8g2_font_unifont_t_cards,const uint8_t[], -Variable,-,u8g2_font_unifont_t_chinese1,const uint8_t[], -Variable,-,u8g2_font_unifont_t_chinese2,const uint8_t[], -Variable,-,u8g2_font_unifont_t_chinese3,const uint8_t[], -Variable,-,u8g2_font_unifont_t_cyrillic,const uint8_t[], -Variable,-,u8g2_font_unifont_t_devanagari,const uint8_t[], -Variable,-,u8g2_font_unifont_t_domino,const uint8_t[], -Variable,-,u8g2_font_unifont_t_emoticons,const uint8_t[], -Variable,-,u8g2_font_unifont_t_extended,const uint8_t[], -Variable,-,u8g2_font_unifont_t_greek,const uint8_t[], -Variable,-,u8g2_font_unifont_t_hebrew,const uint8_t[], -Variable,-,u8g2_font_unifont_t_japanese1,const uint8_t[], -Variable,-,u8g2_font_unifont_t_japanese2,const uint8_t[], -Variable,-,u8g2_font_unifont_t_japanese3,const uint8_t[], -Variable,-,u8g2_font_unifont_t_korean1,const uint8_t[], -Variable,-,u8g2_font_unifont_t_korean2,const uint8_t[], -Variable,-,u8g2_font_unifont_t_latin,const uint8_t[], -Variable,-,u8g2_font_unifont_t_polish,const uint8_t[], -Variable,-,u8g2_font_unifont_t_symbols,const uint8_t[], -Variable,-,u8g2_font_unifont_t_tibetan,const uint8_t[], -Variable,-,u8g2_font_unifont_t_urdu,const uint8_t[], -Variable,-,u8g2_font_unifont_t_vietnamese1,const uint8_t[], -Variable,-,u8g2_font_unifont_t_vietnamese2,const uint8_t[], -Variable,-,u8g2_font_unifont_t_weather,const uint8_t[], -Variable,-,u8g2_font_unifont_te,const uint8_t[], -Variable,-,u8g2_font_unifont_tf,const uint8_t[], -Variable,-,u8g2_font_unifont_tr,const uint8_t[], -Variable,-,u8g2_font_victoriabold8_8n,const uint8_t[], -Variable,-,u8g2_font_victoriabold8_8r,const uint8_t[], -Variable,-,u8g2_font_victoriabold8_8u,const uint8_t[], -Variable,-,u8g2_font_victoriamedium8_8n,const uint8_t[], -Variable,-,u8g2_font_victoriamedium8_8r,const uint8_t[], -Variable,-,u8g2_font_victoriamedium8_8u,const uint8_t[], -Variable,-,u8g2_font_wqy12_t_chinese1,const uint8_t[], -Variable,-,u8g2_font_wqy12_t_chinese2,const uint8_t[], -Variable,-,u8g2_font_wqy12_t_chinese3,const uint8_t[], -Variable,-,u8g2_font_wqy12_t_gb2312,const uint8_t[], -Variable,-,u8g2_font_wqy12_t_gb2312a,const uint8_t[], -Variable,-,u8g2_font_wqy12_t_gb2312b,const uint8_t[], -Variable,-,u8g2_font_wqy13_t_chinese1,const uint8_t[], -Variable,-,u8g2_font_wqy13_t_chinese2,const uint8_t[], -Variable,-,u8g2_font_wqy13_t_chinese3,const uint8_t[], -Variable,-,u8g2_font_wqy13_t_gb2312,const uint8_t[], -Variable,-,u8g2_font_wqy13_t_gb2312a,const uint8_t[], -Variable,-,u8g2_font_wqy13_t_gb2312b,const uint8_t[], -Variable,-,u8g2_font_wqy14_t_chinese1,const uint8_t[], -Variable,-,u8g2_font_wqy14_t_chinese2,const uint8_t[], -Variable,-,u8g2_font_wqy14_t_chinese3,const uint8_t[], -Variable,-,u8g2_font_wqy14_t_gb2312,const uint8_t[], -Variable,-,u8g2_font_wqy14_t_gb2312a,const uint8_t[], -Variable,-,u8g2_font_wqy14_t_gb2312b,const uint8_t[], -Variable,-,u8g2_font_wqy15_t_chinese1,const uint8_t[], -Variable,-,u8g2_font_wqy15_t_chinese2,const uint8_t[], -Variable,-,u8g2_font_wqy15_t_chinese3,const uint8_t[], -Variable,-,u8g2_font_wqy15_t_gb2312,const uint8_t[], -Variable,-,u8g2_font_wqy15_t_gb2312a,const uint8_t[], -Variable,-,u8g2_font_wqy15_t_gb2312b,const uint8_t[], -Variable,-,u8g2_font_wqy16_t_chinese1,const uint8_t[], -Variable,-,u8g2_font_wqy16_t_chinese2,const uint8_t[], -Variable,-,u8g2_font_wqy16_t_chinese3,const uint8_t[], -Variable,-,u8g2_font_wqy16_t_gb2312,const uint8_t[], -Variable,-,u8g2_font_wqy16_t_gb2312a,const uint8_t[], -Variable,-,u8g2_font_wqy16_t_gb2312b,const uint8_t[], -Variable,-,u8x8_font_5x7_f,const uint8_t[], -Variable,-,u8x8_font_5x7_n,const uint8_t[], -Variable,-,u8x8_font_5x7_r,const uint8_t[], -Variable,-,u8x8_font_5x8_f,const uint8_t[], -Variable,-,u8x8_font_5x8_n,const uint8_t[], -Variable,-,u8x8_font_5x8_r,const uint8_t[], -Variable,-,u8x8_font_7x14B_1x2_f,const uint8_t[], -Variable,-,u8x8_font_7x14B_1x2_n,const uint8_t[], -Variable,-,u8x8_font_7x14B_1x2_r,const uint8_t[], -Variable,-,u8x8_font_7x14_1x2_f,const uint8_t[], -Variable,-,u8x8_font_7x14_1x2_n,const uint8_t[], -Variable,-,u8x8_font_7x14_1x2_r,const uint8_t[], -Variable,-,u8x8_font_8x13B_1x2_f,const uint8_t[], -Variable,-,u8x8_font_8x13B_1x2_n,const uint8_t[], -Variable,-,u8x8_font_8x13B_1x2_r,const uint8_t[], -Variable,-,u8x8_font_8x13_1x2_f,const uint8_t[], -Variable,-,u8x8_font_8x13_1x2_n,const uint8_t[], -Variable,-,u8x8_font_8x13_1x2_r,const uint8_t[], -Variable,-,u8x8_font_amstrad_cpc_extended_f,const uint8_t[], -Variable,-,u8x8_font_amstrad_cpc_extended_n,const uint8_t[], -Variable,-,u8x8_font_amstrad_cpc_extended_r,const uint8_t[], -Variable,-,u8x8_font_amstrad_cpc_extended_u,const uint8_t[], -Variable,-,u8x8_font_artossans8_n,const uint8_t[], -Variable,-,u8x8_font_artossans8_r,const uint8_t[], -Variable,-,u8x8_font_artossans8_u,const uint8_t[], -Variable,-,u8x8_font_artosserif8_n,const uint8_t[], -Variable,-,u8x8_font_artosserif8_r,const uint8_t[], -Variable,-,u8x8_font_artosserif8_u,const uint8_t[], -Variable,-,u8x8_font_chroma48medium8_n,const uint8_t[], -Variable,-,u8x8_font_chroma48medium8_r,const uint8_t[], -Variable,-,u8x8_font_chroma48medium8_u,const uint8_t[], -Variable,-,u8x8_font_courB18_2x3_f,const uint8_t[], -Variable,-,u8x8_font_courB18_2x3_n,const uint8_t[], -Variable,-,u8x8_font_courB18_2x3_r,const uint8_t[], -Variable,-,u8x8_font_courB24_3x4_f,const uint8_t[], -Variable,-,u8x8_font_courB24_3x4_n,const uint8_t[], -Variable,-,u8x8_font_courB24_3x4_r,const uint8_t[], -Variable,-,u8x8_font_courR18_2x3_f,const uint8_t[], -Variable,-,u8x8_font_courR18_2x3_n,const uint8_t[], -Variable,-,u8x8_font_courR18_2x3_r,const uint8_t[], -Variable,-,u8x8_font_courR24_3x4_f,const uint8_t[], -Variable,-,u8x8_font_courR24_3x4_n,const uint8_t[], -Variable,-,u8x8_font_courR24_3x4_r,const uint8_t[], -Variable,-,u8x8_font_inb21_2x4_f,const uint8_t[], -Variable,-,u8x8_font_inb21_2x4_n,const uint8_t[], -Variable,-,u8x8_font_inb21_2x4_r,const uint8_t[], -Variable,-,u8x8_font_inb33_3x6_f,const uint8_t[], -Variable,-,u8x8_font_inb33_3x6_n,const uint8_t[], -Variable,-,u8x8_font_inb33_3x6_r,const uint8_t[], -Variable,-,u8x8_font_inb46_4x8_f,const uint8_t[], -Variable,-,u8x8_font_inb46_4x8_n,const uint8_t[], -Variable,-,u8x8_font_inb46_4x8_r,const uint8_t[], -Variable,-,u8x8_font_inr21_2x4_f,const uint8_t[], -Variable,-,u8x8_font_inr21_2x4_n,const uint8_t[], -Variable,-,u8x8_font_inr21_2x4_r,const uint8_t[], -Variable,-,u8x8_font_inr33_3x6_f,const uint8_t[], -Variable,-,u8x8_font_inr33_3x6_n,const uint8_t[], -Variable,-,u8x8_font_inr33_3x6_r,const uint8_t[], -Variable,-,u8x8_font_inr46_4x8_f,const uint8_t[], -Variable,-,u8x8_font_inr46_4x8_n,const uint8_t[], -Variable,-,u8x8_font_inr46_4x8_r,const uint8_t[], -Variable,-,u8x8_font_lucasarts_scumm_subtitle_o_2x2_f,const uint8_t[], -Variable,-,u8x8_font_lucasarts_scumm_subtitle_o_2x2_n,const uint8_t[], -Variable,-,u8x8_font_lucasarts_scumm_subtitle_o_2x2_r,const uint8_t[], -Variable,-,u8x8_font_lucasarts_scumm_subtitle_r_2x2_f,const uint8_t[], -Variable,-,u8x8_font_lucasarts_scumm_subtitle_r_2x2_n,const uint8_t[], -Variable,-,u8x8_font_lucasarts_scumm_subtitle_r_2x2_r,const uint8_t[], -Variable,-,u8x8_font_open_iconic_arrow_1x1,const uint8_t[], -Variable,-,u8x8_font_open_iconic_arrow_2x2,const uint8_t[], -Variable,-,u8x8_font_open_iconic_arrow_4x4,const uint8_t[], -Variable,-,u8x8_font_open_iconic_arrow_8x8,const uint8_t[], -Variable,-,u8x8_font_open_iconic_check_1x1,const uint8_t[], -Variable,-,u8x8_font_open_iconic_check_2x2,const uint8_t[], -Variable,-,u8x8_font_open_iconic_check_4x4,const uint8_t[], -Variable,-,u8x8_font_open_iconic_check_8x8,const uint8_t[], -Variable,-,u8x8_font_open_iconic_embedded_1x1,const uint8_t[], -Variable,-,u8x8_font_open_iconic_embedded_2x2,const uint8_t[], -Variable,-,u8x8_font_open_iconic_embedded_4x4,const uint8_t[], -Variable,-,u8x8_font_open_iconic_embedded_8x8,const uint8_t[], -Variable,-,u8x8_font_open_iconic_play_1x1,const uint8_t[], -Variable,-,u8x8_font_open_iconic_play_2x2,const uint8_t[], -Variable,-,u8x8_font_open_iconic_play_4x4,const uint8_t[], -Variable,-,u8x8_font_open_iconic_play_8x8,const uint8_t[], -Variable,-,u8x8_font_open_iconic_thing_1x1,const uint8_t[], -Variable,-,u8x8_font_open_iconic_thing_2x2,const uint8_t[], -Variable,-,u8x8_font_open_iconic_thing_4x4,const uint8_t[], -Variable,-,u8x8_font_open_iconic_thing_8x8,const uint8_t[], -Variable,-,u8x8_font_open_iconic_weather_1x1,const uint8_t[], -Variable,-,u8x8_font_open_iconic_weather_2x2,const uint8_t[], -Variable,-,u8x8_font_open_iconic_weather_4x4,const uint8_t[], -Variable,-,u8x8_font_open_iconic_weather_8x8,const uint8_t[], -Variable,-,u8x8_font_pcsenior_f,const uint8_t[], -Variable,-,u8x8_font_pcsenior_n,const uint8_t[], -Variable,-,u8x8_font_pcsenior_r,const uint8_t[], -Variable,-,u8x8_font_pcsenior_u,const uint8_t[], -Variable,-,u8x8_font_pressstart2p_f,const uint8_t[], -Variable,-,u8x8_font_pressstart2p_n,const uint8_t[], -Variable,-,u8x8_font_pressstart2p_r,const uint8_t[], -Variable,-,u8x8_font_pressstart2p_u,const uint8_t[], -Variable,-,u8x8_font_profont29_2x3_f,const uint8_t[], -Variable,-,u8x8_font_profont29_2x3_n,const uint8_t[], -Variable,-,u8x8_font_profont29_2x3_r,const uint8_t[], -Variable,-,u8x8_font_px437wyse700a_2x2_f,const uint8_t[], -Variable,-,u8x8_font_px437wyse700a_2x2_n,const uint8_t[], -Variable,-,u8x8_font_px437wyse700a_2x2_r,const uint8_t[], -Variable,-,u8x8_font_px437wyse700b_2x2_f,const uint8_t[], -Variable,-,u8x8_font_px437wyse700b_2x2_n,const uint8_t[], -Variable,-,u8x8_font_px437wyse700b_2x2_r,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcga_f,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcga_n,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcga_r,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcga_u,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcgathin_f,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcgathin_n,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcgathin_r,const uint8_t[], -Variable,-,u8x8_font_pxplusibmcgathin_u,const uint8_t[], -Variable,-,u8x8_font_pxplustandynewtv_f,const uint8_t[], -Variable,-,u8x8_font_pxplustandynewtv_n,const uint8_t[], -Variable,-,u8x8_font_pxplustandynewtv_r,const uint8_t[], -Variable,-,u8x8_font_pxplustandynewtv_u,const uint8_t[], -Variable,-,u8x8_font_saikyosansbold8_n,const uint8_t[], -Variable,-,u8x8_font_saikyosansbold8_u,const uint8_t[], -Variable,-,u8x8_font_torussansbold8_n,const uint8_t[], -Variable,-,u8x8_font_torussansbold8_r,const uint8_t[], -Variable,-,u8x8_font_torussansbold8_u,const uint8_t[], -Variable,-,u8x8_font_victoriabold8_n,const uint8_t[], -Variable,-,u8x8_font_victoriabold8_r,const uint8_t[], -Variable,-,u8x8_font_victoriabold8_u,const uint8_t[], -Variable,-,u8x8_font_victoriamedium8_n,const uint8_t[], -Variable,-,u8x8_font_victoriamedium8_r,const uint8_t[], -Variable,-,u8x8_font_victoriamedium8_u,const uint8_t[], Variable,+,usb_cdc_dual,FuriHalUsbInterface, Variable,+,usb_cdc_single,FuriHalUsbInterface, Variable,+,usb_hid,FuriHalUsbInterface, diff --git a/firmware/targets/f7/furi_hal/furi_hal_infrared.c b/firmware/targets/f7/furi_hal/furi_hal_infrared.c index 8098f8bd0..e833c4731 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_infrared.c +++ b/firmware/targets/f7/furi_hal/furi_hal_infrared.c @@ -1,7 +1,6 @@ #include #include #include "stm32wbxx_ll_dma.h" -#include "sys/_stdint.h" #include #include @@ -332,8 +331,6 @@ static void furi_hal_infrared_tx_dma_isr() { } static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cycle) { - /* LL_DBGMCU_APB2_GRP1_FreezePeriph(LL_DBGMCU_APB2_GRP1_TIM1_STOP); */ - LL_TIM_DisableCounter(TIM1); LL_TIM_SetRepetitionCounter(TIM1, 0); LL_TIM_SetCounter(TIM1, 0); diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz.c b/firmware/targets/f7/furi_hal/furi_hal_subghz.c index 6a566d471..06a7990fb 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_subghz.c +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz.c @@ -41,6 +41,7 @@ volatile FuriHalSubGhz furi_hal_subghz = { .rolling_counter_mult = 1, .ext_module_power_disabled = false, .timestamp_file_names = false, + .dangerous_frequency_i = false, }; void furi_hal_subghz_select_radio_type(SubGhzRadioType state) { @@ -96,6 +97,10 @@ bool furi_hal_subghz_get_timestamp_file_names(void) { return furi_hal_subghz.timestamp_file_names; } +void furi_hal_subghz_set_dangerous_frequency(bool state_i) { + furi_hal_subghz.dangerous_frequency_i = state_i; +} + void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin) { furi_hal_subghz.async_mirror_pin = pin; } @@ -448,29 +453,19 @@ uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value) { } bool furi_hal_subghz_is_tx_allowed(uint32_t value) { - bool is_extended = false; + bool allow_extended_for_int = furi_hal_subghz.dangerous_frequency_i; - // TODO: !!! Move file check to another place - Storage* storage = furi_record_open(RECORD_STORAGE); - FlipperFormat* fff_data_file = flipper_format_file_alloc(storage); - - if(flipper_format_file_open_existing(fff_data_file, "/ext/subghz/assets/dangerous_settings")) { - flipper_format_read_bool( - fff_data_file, "yes_i_want_to_destroy_my_flipper", &is_extended, 1); - } - - flipper_format_free(fff_data_file); - furi_record_close(RECORD_STORAGE); - - if(!(value >= 299999755 && value <= 350000335) && // was increased from 348 to 350 + if(!(allow_extended_for_int) && + !(value >= 299999755 && value <= 350000335) && // was increased from 348 to 350 !(value >= 386999938 && value <= 467750000) && // was increased from 464 to 467.75 - !(value >= 778999847 && value <= 928000000) && !(is_extended)) { + !(value >= 778999847 && value <= 928000000)) { FURI_LOG_I(TAG, "Frequency blocked - outside default range"); return false; } else if( + (allow_extended_for_int) && // !(value >= 281000000 && value <= 361000000) && !(value >= 378000000 && value <= 481000000) && - !(value >= 749000000 && value <= 962000000) && is_extended) { + !(value >= 749000000 && value <= 962000000)) { FURI_LOG_I(TAG, "Frequency blocked - outside dangerous range"); return false; } diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz.h b/firmware/targets/f7/furi_hal/furi_hal_subghz.h index 35eab4faf..0ef7bd90a 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_subghz.h +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz.h @@ -78,8 +78,9 @@ typedef struct { FuriHalSpiBusHandle* spi_bus_handle; const GpioPin* cc1101_g0_pin; uint8_t rolling_counter_mult; - bool ext_module_power_disabled; - bool timestamp_file_names; + bool ext_module_power_disabled : 1; + bool timestamp_file_names : 1; + bool dangerous_frequency_i : 1; } FuriHalSubGhz; extern volatile FuriHalSubGhz furi_hal_subghz; diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz_i.h b/firmware/targets/f7/furi_hal/furi_hal_subghz_i.h new file mode 100644 index 000000000..e7fe2602f --- /dev/null +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz_i.h @@ -0,0 +1,3 @@ +#pragma once + +void furi_hal_subghz_set_dangerous_frequency(bool state_i); \ No newline at end of file diff --git a/firmware/targets/f7/furi_hal/furi_hal_usb_hid.c b/firmware/targets/f7/furi_hal/furi_hal_usb_hid.c index d27613410..334aa0102 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_usb_hid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_usb_hid.c @@ -436,7 +436,11 @@ static bool hid_send_report(uint8_t report_id) { if((hid_semaphore == NULL) || (hid_connected == false)) return false; if((boot_protocol == true) && (report_id != ReportIdKeyboard)) return false; - furi_check(furi_semaphore_acquire(hid_semaphore, FuriWaitForever) == FuriStatusOk); + FuriStatus status = furi_semaphore_acquire(hid_semaphore, HID_INTERVAL * 2); + if(status == FuriStatusErrorTimeout) { + return false; + } + furi_check(status == FuriStatusOk); if(hid_connected == false) { return false; } diff --git a/lib/SConscript b/lib/SConscript index ec5dfda1e..8727746d8 100644 --- a/lib/SConscript +++ b/lib/SConscript @@ -44,7 +44,6 @@ env.Append( "variant", ) ), - File("u8g2/u8g2.h"), ], CPPDEFINES=[ '"M_MEMORY_FULL(x)=abort()"', diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index 5add1413e..46effd420 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -40,8 +40,12 @@ struct InfraredWorkerSignal { size_t timings_cnt; union { InfraredMessage message; - /* +1 is for pause we add at the beginning */ - uint32_t timings[MAX_TIMINGS_AMOUNT + 1]; + struct { + /* +1 is for pause we add at the beginning */ + uint32_t timings[MAX_TIMINGS_AMOUNT + 1]; + uint32_t frequency; + float duty_cycle; + } raw; }; }; @@ -146,7 +150,7 @@ static void } if(instance->signal.timings_cnt < MAX_TIMINGS_AMOUNT) { - instance->signal.timings[instance->signal.timings_cnt] = duration; + instance->signal.raw.timings[instance->signal.timings_cnt] = duration; ++instance->signal.timings_cnt; } else { uint32_t flags_set = furi_thread_flags_set( @@ -300,7 +304,7 @@ void infrared_worker_get_raw_signal( furi_assert(timings); furi_assert(timings_cnt); - *timings = signal->timings; + *timings = signal->raw.timings; *timings_cnt = signal->timings_cnt; } @@ -390,8 +394,8 @@ static bool infrared_get_new_signal(InfraredWorker* instance) { infrared_get_protocol_duty_cycle(instance->signal.message.protocol); } else { furi_assert(instance->signal.timings_cnt > 1); - new_tx_frequency = INFRARED_COMMON_CARRIER_FREQUENCY; - new_tx_duty_cycle = INFRARED_COMMON_DUTY_CYCLE; + new_tx_frequency = instance->signal.raw.frequency; + new_tx_duty_cycle = instance->signal.raw.duty_cycle; } instance->tx.tx_raw_cnt = 0; @@ -426,7 +430,7 @@ static bool infrared_worker_tx_fill_buffer(InfraredWorker* instance) { if(instance->signal.decoded) { status = infrared_encode(instance->infrared_encoder, &timing.duration, &timing.level); } else { - timing.duration = instance->signal.timings[instance->tx.tx_raw_cnt]; + timing.duration = instance->signal.raw.timings[instance->tx.tx_raw_cnt]; /* raw always starts from Mark, but we fill it with space delay at start */ timing.level = (instance->tx.tx_raw_cnt % 2); ++instance->tx.tx_raw_cnt; @@ -597,15 +601,21 @@ void infrared_worker_set_decoded_signal(InfraredWorker* instance, const Infrared void infrared_worker_set_raw_signal( InfraredWorker* instance, const uint32_t* timings, - size_t timings_cnt) { + size_t timings_cnt, + uint32_t frequency, + float duty_cycle) { furi_assert(instance); furi_assert(timings); furi_assert(timings_cnt > 0); - size_t max_copy_num = COUNT_OF(instance->signal.timings) - 1; + furi_assert((frequency <= INFRARED_MAX_FREQUENCY) && (frequency >= INFRARED_MIN_FREQUENCY)); + furi_assert((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); - instance->signal.timings[0] = INFRARED_RAW_TX_TIMING_DELAY_US; - memcpy(&instance->signal.timings[1], timings, timings_cnt * sizeof(uint32_t)); + instance->signal.raw.frequency = frequency; + instance->signal.raw.duty_cycle = duty_cycle; + instance->signal.raw.timings[0] = INFRARED_RAW_TX_TIMING_DELAY_US; + memcpy(&instance->signal.raw.timings[1], timings, timings_cnt * sizeof(uint32_t)); instance->signal.decoded = false; instance->signal.timings_cnt = timings_cnt + 1; } diff --git a/lib/infrared/worker/infrared_worker.h b/lib/infrared/worker/infrared_worker.h index 1a8cd9a76..e0e861983 100644 --- a/lib/infrared/worker/infrared_worker.h +++ b/lib/infrared/worker/infrared_worker.h @@ -130,9 +130,9 @@ void infrared_worker_tx_set_signal_sent_callback( /** Callback to pass to infrared_worker_tx_set_get_signal_callback() if signal * is steady and will not be changed between infrared_worker start and stop. * Before starting transmission, desired steady signal must be set with - * infrared_worker_make_decoded_signal() or infrared_worker_make_raw_signal(). + * infrared_worker_set_decoded_signal() or infrared_worker_set_raw_signal(). * - * This function should not be implicitly called. + * This function should not be called directly. * * @param[in] context - context * @param[out] instance - InfraredWorker instance @@ -172,11 +172,15 @@ void infrared_worker_set_decoded_signal(InfraredWorker* instance, const Infrared * @param[out] instance - InfraredWorker instance * @param[in] timings - array of raw timings * @param[in] timings_cnt - size of array of raw timings + * @param[in] frequency - carrier frequency in Hertz + * @param[in] duty_cycle - carrier duty cycle (0.0 - 1.0) */ void infrared_worker_set_raw_signal( InfraredWorker* instance, const uint32_t* timings, - size_t timings_cnt); + size_t timings_cnt, + uint32_t frequency, + float duty_cycle); #ifdef __cplusplus } diff --git a/lib/lfrfid/protocols/lfrfid_protocols.c b/lib/lfrfid/protocols/lfrfid_protocols.c index 2c1f0ad97..f07218d7f 100644 --- a/lib/lfrfid/protocols/lfrfid_protocols.c +++ b/lib/lfrfid/protocols/lfrfid_protocols.c @@ -16,6 +16,7 @@ #include "protocol_pac_stanley.h" #include "protocol_keri.h" #include "protocol_gallagher.h" +#include "protocol_nexwatch.h" const ProtocolBase* lfrfid_protocols[] = { [LFRFIDProtocolEM4100] = &protocol_em4100, @@ -35,4 +36,5 @@ const ProtocolBase* lfrfid_protocols[] = { [LFRFIDProtocolPACStanley] = &protocol_pac_stanley, [LFRFIDProtocolKeri] = &protocol_keri, [LFRFIDProtocolGallagher] = &protocol_gallagher, -}; \ No newline at end of file + [LFRFIDProtocolNexwatch] = &protocol_nexwatch, +}; diff --git a/lib/lfrfid/protocols/lfrfid_protocols.h b/lib/lfrfid/protocols/lfrfid_protocols.h index 848f003a3..0cb7cbc84 100644 --- a/lib/lfrfid/protocols/lfrfid_protocols.h +++ b/lib/lfrfid/protocols/lfrfid_protocols.h @@ -25,6 +25,7 @@ typedef enum { LFRFIDProtocolPACStanley, LFRFIDProtocolKeri, LFRFIDProtocolGallagher, + LFRFIDProtocolNexwatch, LFRFIDProtocolMax, } LFRFIDProtocol; @@ -39,4 +40,4 @@ typedef struct { union { LFRFIDT5577 t5577; }; -} LFRFIDWriteRequest; \ No newline at end of file +} LFRFIDWriteRequest; diff --git a/lib/lfrfid/protocols/protocol_nexwatch.c b/lib/lfrfid/protocols/protocol_nexwatch.c new file mode 100644 index 000000000..3bbbb42f5 --- /dev/null +++ b/lib/lfrfid/protocols/protocol_nexwatch.c @@ -0,0 +1,323 @@ +#include +#include +#include +#include "lfrfid_protocols.h" + +#define NEXWATCH_PREAMBLE_BIT_SIZE (8) +#define NEXWATCH_PREAMBLE_DATA_SIZE (1) + +#define NEXWATCH_ENCODED_BIT_SIZE (96) +#define NEXWATCH_ENCODED_DATA_SIZE ((NEXWATCH_ENCODED_BIT_SIZE) / 8) + +#define NEXWATCH_DECODED_BIT_SIZE (NEXWATCH_DECODED_DATA_SIZE * 8) +#define NEXWATCH_DECODED_DATA_SIZE (8) + +#define NEXWATCH_US_PER_BIT (255) +#define NEXWATCH_ENCODER_PULSES_PER_BIT (16) + +typedef struct { + uint8_t magic; + char desc[13]; + uint8_t chk; +} ProtocolNexwatchMagic; + +ProtocolNexwatchMagic magic_items[] = { + {0xBE, "Quadrakey", 0}, + {0x88, "Nexkey", 0}, + {0x86, "Honeywell", 0}}; + +typedef struct { + uint8_t data_index; + uint8_t bit_clock_index; + bool last_bit; + bool current_polarity; + bool pulse_phase; +} ProtocolNexwatchEncoder; + +typedef struct { + uint8_t encoded_data[NEXWATCH_ENCODED_DATA_SIZE]; + uint8_t negative_encoded_data[NEXWATCH_ENCODED_DATA_SIZE]; + uint8_t corrupted_encoded_data[NEXWATCH_ENCODED_DATA_SIZE]; + uint8_t corrupted_negative_encoded_data[NEXWATCH_ENCODED_DATA_SIZE]; + + uint8_t data[NEXWATCH_DECODED_DATA_SIZE]; + ProtocolNexwatchEncoder encoder; +} ProtocolNexwatch; + +ProtocolNexwatch* protocol_nexwatch_alloc(void) { + ProtocolNexwatch* protocol = malloc(sizeof(ProtocolNexwatch)); + return protocol; +}; + +void protocol_nexwatch_free(ProtocolNexwatch* protocol) { + free(protocol); +}; + +uint8_t* protocol_nexwatch_get_data(ProtocolNexwatch* protocol) { + return protocol->data; +}; + +void protocol_nexwatch_decoder_start(ProtocolNexwatch* protocol) { + memset(protocol->encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); + memset(protocol->negative_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); + memset(protocol->corrupted_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); + memset(protocol->corrupted_negative_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); +}; + +static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) { + // 01010110 + if(bit_lib_get_bits(data, bit_index, 8) != 0b01010110) return false; + return true; +} + +static uint8_t protocol_nexwatch_parity_swap(uint8_t parity) { + uint8_t a = (((parity >> 3) & 1)); + a |= (((parity >> 1) & 1) << 1); + a |= (((parity >> 2) & 1) << 2); + a |= ((parity & 1) << 3); + return a; +} + +static uint8_t protocol_nexwatch_parity(const uint8_t hexid[5]) { + uint8_t p = 0; + for(uint8_t i = 0; i < 5; i++) { + p ^= ((hexid[i]) & 0xF0) >> 4; + p ^= ((hexid[i]) & 0x0F); + } + return protocol_nexwatch_parity_swap(p); +} + +static uint8_t protocol_nexwatch_checksum(uint8_t magic, uint32_t id, uint8_t parity) { + uint8_t a = ((id >> 24) & 0xFF); + a -= ((id >> 16) & 0xFF); + a -= ((id >> 8) & 0xFF); + a -= (id & 0xFF); + a -= magic; + a -= (bit_lib_reverse_8_fast(parity) >> 4); + return bit_lib_reverse_8_fast(a); +} + +static bool protocol_nexwatch_can_be_decoded(uint8_t* data) { + if(!protocol_nexwatch_check_preamble(data, 0)) return false; + + // Check for reserved word (32-bit) + if(bit_lib_get_bits_32(data, 8, 32) != 0) { + return false; + } + + uint8_t parity = bit_lib_get_bits(data, 76, 4); + + // parity check + // from 32b hex id, 4b mode + uint8_t hex[5] = {0}; + for(uint8_t i = 0; i < 5; i++) { + hex[i] = bit_lib_get_bits(data, 40 + (i * 8), 8); + } + //mode is only 4 bits. + hex[4] &= 0xf0; + uint8_t calc_parity = protocol_nexwatch_parity(hex); + + if(calc_parity != parity) { + return false; + } + + return true; +} + +static bool protocol_nexwatch_decoder_feed_internal(bool polarity, uint32_t time, uint8_t* data) { + time += (NEXWATCH_US_PER_BIT / 2); + + size_t bit_count = (time / NEXWATCH_US_PER_BIT); + bool result = false; + + if(bit_count < NEXWATCH_ENCODED_BIT_SIZE) { + for(size_t i = 0; i < bit_count; i++) { + bit_lib_push_bit(data, NEXWATCH_ENCODED_DATA_SIZE, polarity); + if(protocol_nexwatch_can_be_decoded(data)) { + result = true; + break; + } + } + } + + return result; +} + +static void protocol_nexwatch_descramble(uint32_t* id, uint32_t* scrambled) { + // 255 = Not used/Unknown other values are the bit offset in the ID/FC values + const uint8_t hex_2_id[] = {31, 27, 23, 19, 15, 11, 7, 3, 30, 26, 22, 18, 14, 10, 6, 2, + 29, 25, 21, 17, 13, 9, 5, 1, 28, 24, 20, 16, 12, 8, 4, 0}; + + *id = 0; + for(uint8_t idx = 0; idx < 32; idx++) { + bool bit_state = (*scrambled >> hex_2_id[idx]) & 1; + *id |= (bit_state << (31 - idx)); + } +} + +static void protocol_nexwatch_decoder_save(uint8_t* data_to, const uint8_t* data_from) { + uint32_t id = bit_lib_get_bits_32(data_from, 40, 32); + data_to[4] = (uint8_t)id; + data_to[3] = (uint8_t)(id >>= 8); + data_to[2] = (uint8_t)(id >>= 8); + data_to[1] = (uint8_t)(id >>= 8); + data_to[0] = (uint8_t)(id >>= 8); + uint32_t check = bit_lib_get_bits_32(data_from, 72, 24); + data_to[7] = (uint8_t)check; + data_to[6] = (uint8_t)(check >>= 8); + data_to[5] = (uint8_t)(check >>= 8); +} + +bool protocol_nexwatch_decoder_feed(ProtocolNexwatch* protocol, bool level, uint32_t duration) { + bool result = false; + + if(duration > (NEXWATCH_US_PER_BIT / 2)) { + if(protocol_nexwatch_decoder_feed_internal(level, duration, protocol->encoded_data)) { + protocol_nexwatch_decoder_save(protocol->data, protocol->encoded_data); + result = true; + return result; + } + + if(protocol_nexwatch_decoder_feed_internal( + !level, duration, protocol->negative_encoded_data)) { + protocol_nexwatch_decoder_save(protocol->data, protocol->negative_encoded_data); + result = true; + return result; + } + } + + if(duration > (NEXWATCH_US_PER_BIT / 4)) { + // Try to decode wrong phase synced data + if(level) { + duration += 120; + } else { + if(duration > 120) { + duration -= 120; + } + } + + if(protocol_nexwatch_decoder_feed_internal( + level, duration, protocol->corrupted_encoded_data)) { + protocol_nexwatch_decoder_save(protocol->data, protocol->corrupted_encoded_data); + + result = true; + return result; + } + + if(protocol_nexwatch_decoder_feed_internal( + !level, duration, protocol->corrupted_negative_encoded_data)) { + protocol_nexwatch_decoder_save( + protocol->data, protocol->corrupted_negative_encoded_data); + + result = true; + return result; + } + } + + return result; +}; + +bool protocol_nexwatch_encoder_start(ProtocolNexwatch* protocol) { + memset(protocol->encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE); + *(uint32_t*)&protocol->encoded_data[0] = 0b00000000000000000000000001010110; + bit_lib_copy_bits(protocol->encoded_data, 32, 32, protocol->data, 0); + bit_lib_copy_bits(protocol->encoded_data, 64, 32, protocol->data, 32); + + protocol->encoder.last_bit = + bit_lib_get_bit(protocol->encoded_data, NEXWATCH_ENCODED_BIT_SIZE - 1); + protocol->encoder.data_index = 0; + protocol->encoder.current_polarity = true; + protocol->encoder.pulse_phase = true; + protocol->encoder.bit_clock_index = 0; + + return true; +}; + +LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) { + LevelDuration level_duration; + ProtocolNexwatchEncoder* encoder = &protocol->encoder; + + if(encoder->pulse_phase) { + level_duration = level_duration_make(encoder->current_polarity, 1); + encoder->pulse_phase = false; + } else { + level_duration = level_duration_make(!encoder->current_polarity, 1); + encoder->pulse_phase = true; + + encoder->bit_clock_index++; + if(encoder->bit_clock_index >= NEXWATCH_ENCODER_PULSES_PER_BIT) { + encoder->bit_clock_index = 0; + + bool current_bit = bit_lib_get_bit(protocol->encoded_data, encoder->data_index); + + if(current_bit != encoder->last_bit) { + encoder->current_polarity = !encoder->current_polarity; + } + + encoder->last_bit = current_bit; + + bit_lib_increment_index(encoder->data_index, NEXWATCH_ENCODED_BIT_SIZE); + } + } + + return level_duration; +}; + +void protocol_nexwatch_render_data(ProtocolNexwatch* protocol, FuriString* result) { + uint32_t id = 0; + uint32_t scrambled = bit_lib_get_bits_32(protocol->data, 8, 32); + protocol_nexwatch_descramble(&id, &scrambled); + + uint8_t m_idx; + uint8_t mode = bit_lib_get_bits(protocol->data, 40, 4); + uint8_t parity = bit_lib_get_bits(protocol->data, 44, 4); + uint8_t chk = bit_lib_get_bits(protocol->data, 48, 8); + for(m_idx = 0; m_idx < 3; m_idx++) { + magic_items[m_idx].chk = protocol_nexwatch_checksum(magic_items[m_idx].magic, id, parity); + if(magic_items[m_idx].chk == chk) { + break; + } + } + furi_string_printf(result, "ID: %lu, M:%u\r\nType: %s\r\n", id, mode, magic_items[m_idx].desc); +} + +bool protocol_nexwatch_write_data(ProtocolNexwatch* protocol, void* data) { + LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data; + bool result = false; + + protocol_nexwatch_encoder_start(protocol); + if(request->write_type == LFRFIDWriteTypeT5577) { + request->t5577.block[0] = LFRFID_T5577_MODULATION_PSK1 | LFRFID_T5577_BITRATE_RF_32 | + (3 << LFRFID_T5577_MAXBLOCK_SHIFT); + request->t5577.block[1] = bit_lib_get_bits_32(protocol->encoded_data, 0, 32); + request->t5577.block[2] = bit_lib_get_bits_32(protocol->encoded_data, 32, 32); + request->t5577.block[3] = bit_lib_get_bits_32(protocol->encoded_data, 64, 32); + request->t5577.blocks_to_write = 4; + result = true; + } + return result; +}; + +const ProtocolBase protocol_nexwatch = { + .name = "Nexwatch", + .manufacturer = "Honeywell", + .data_size = NEXWATCH_DECODED_DATA_SIZE, + .features = LFRFIDFeaturePSK, + .validate_count = 6, + .alloc = (ProtocolAlloc)protocol_nexwatch_alloc, + .free = (ProtocolFree)protocol_nexwatch_free, + .get_data = (ProtocolGetData)protocol_nexwatch_get_data, + .decoder = + { + .start = (ProtocolDecoderStart)protocol_nexwatch_decoder_start, + .feed = (ProtocolDecoderFeed)protocol_nexwatch_decoder_feed, + }, + .encoder = + { + .start = (ProtocolEncoderStart)protocol_nexwatch_encoder_start, + .yield = (ProtocolEncoderYield)protocol_nexwatch_encoder_yield, + }, + .render_data = (ProtocolRenderData)protocol_nexwatch_render_data, + .render_brief_data = (ProtocolRenderData)protocol_nexwatch_render_data, + .write_data = (ProtocolWriteData)protocol_nexwatch_write_data, +}; diff --git a/lib/lfrfid/protocols/protocol_nexwatch.h b/lib/lfrfid/protocols/protocol_nexwatch.h new file mode 100644 index 000000000..0872ca7dc --- /dev/null +++ b/lib/lfrfid/protocols/protocol_nexwatch.h @@ -0,0 +1,4 @@ +#pragma once +#include + +extern const ProtocolBase protocol_nexwatch; diff --git a/lib/nfc/nfc_types.c b/lib/nfc/nfc_types.c index 02ca85580..96b92640f 100644 --- a/lib/nfc/nfc_types.c +++ b/lib/nfc/nfc_types.c @@ -45,6 +45,8 @@ const char* nfc_mf_ul_type(MfUltralightType type, bool full_name) { return "NTAG I2C Plus 2K"; } else if(type == MfUltralightTypeNTAG203) { return "NTAG203"; + } else if(type == MfUltralightTypeULC) { + return "Mifare Ultralight C"; } else if(type == MfUltralightTypeUL11 && full_name) { return "Mifare Ultralight 11"; } else if(type == MfUltralightTypeUL21 && full_name) { diff --git a/lib/nfc/protocols/mifare_ultralight.c b/lib/nfc/protocols/mifare_ultralight.c index 6960bd2a1..266b6e2e2 100644 --- a/lib/nfc/protocols/mifare_ultralight.c +++ b/lib/nfc/protocols/mifare_ultralight.c @@ -79,6 +79,8 @@ static MfUltralightFeatures mf_ul_get_features(MfUltralightType type) { MfUltralightSupportSectorSelect; case MfUltralightTypeNTAG203: return MfUltralightSupportCompatWrite | MfUltralightSupportCounterInMemory; + case MfUltralightTypeULC: + return MfUltralightSupportCompatWrite | MfUltralightSupport3DesAuth; default: // Assumed original MFUL 512-bit return MfUltralightSupportCompatWrite; @@ -95,6 +97,11 @@ static void mf_ul_set_version_ntag203(MfUltralightReader* reader, MfUltralightDa reader->pages_to_read = 42; } +static void mf_ul_set_version_ulc(MfUltralightReader* reader, MfUltralightData* data) { + data->type = MfUltralightTypeULC; + reader->pages_to_read = 48; +} + bool mf_ultralight_read_version( FuriHalNfcTxRxContext* tx_rx, MfUltralightReader* reader, @@ -175,7 +182,7 @@ bool mf_ultralight_authenticate(FuriHalNfcTxRxContext* tx_rx, uint32_t key, uint do { FURI_LOG_D(TAG, "Authenticating"); - tx_rx->tx_data[0] = MF_UL_AUTH; + tx_rx->tx_data[0] = MF_UL_PWD_AUTH; nfc_util_num2bytes(key, 4, &tx_rx->tx_data[1]); tx_rx->tx_bits = 40; tx_rx->tx_rx_type = FuriHalNfcTxRxTypeDefault; @@ -716,6 +723,21 @@ bool mf_ultralight_read_tearing_flags(FuriHalNfcTxRxContext* tx_rx, MfUltralight return flag_read == 2; } +static bool mf_ul_probe_3des_auth(FuriHalNfcTxRxContext* tx_rx) { + tx_rx->tx_data[0] = MF_UL_AUTHENTICATE_1; + tx_rx->tx_data[1] = 0; + tx_rx->tx_bits = 16; + tx_rx->tx_rx_type = FuriHalNfcTxRxTypeDefault; + bool rc = furi_hal_nfc_tx_rx(tx_rx, 50) && tx_rx->rx_bits == 9 * 8 && + tx_rx->rx_data[0] == 0xAF; + + // Reset just in case, we're not going to finish authenticating and need to if tag doesn't support auth + furi_hal_nfc_sleep(); + furi_hal_nfc_activate_nfca(300, NULL); + + return rc; +} + bool mf_ul_read_card( FuriHalNfcTxRxContext* tx_rx, MfUltralightReader* reader, @@ -733,16 +755,20 @@ bool mf_ul_read_card( mf_ultralight_read_signature(tx_rx, data); } } else { - // No GET_VERSION command, check for NTAG203 by reading last page (41) uint8_t dummy[16]; - if(mf_ultralight_read_pages_direct(tx_rx, 41, dummy)) { + // No GET_VERSION command, check if AUTHENTICATE command available (detect UL C). + if(mf_ul_probe_3des_auth(tx_rx)) { + mf_ul_set_version_ulc(reader, data); + } else if(mf_ultralight_read_pages_direct(tx_rx, 41, dummy)) { + // No AUTHENTICATE, check for NTAG203 by reading last page (41) mf_ul_set_version_ntag203(reader, data); - reader->supported_features = mf_ul_get_features(data->type); } else { // We're really an original Mifare Ultralight, reset tag for safety furi_hal_nfc_sleep(); furi_hal_nfc_activate_nfca(300, NULL); } + + reader->supported_features = mf_ul_get_features(data->type); } card_read = mf_ultralight_read_pages(tx_rx, reader, data); @@ -1228,6 +1254,10 @@ static void mf_ul_emulate_write( emulator->data_changed = true; } +bool mf_ul_emulation_supported(MfUltralightData* data) { + return data->type != MfUltralightTypeULC; +} + void mf_ul_reset_emulation(MfUltralightEmulator* emulator, bool is_power_cycle) { emulator->comp_write_cmd_started = false; emulator->sector_select_cmd_started = false; @@ -1732,7 +1762,7 @@ bool mf_ul_prepare_emulation_response( } } } - } else if(cmd == MF_UL_AUTH) { + } else if(cmd == MF_UL_PWD_AUTH) { if(emulator->supported_features & MfUltralightSupportAuth) { if(buff_rx_len == (1 + 4) * 8) { // Record password sent by PCD diff --git a/lib/nfc/protocols/mifare_ultralight.h b/lib/nfc/protocols/mifare_ultralight.h index 4ab22e89c..d444fa798 100644 --- a/lib/nfc/protocols/mifare_ultralight.h +++ b/lib/nfc/protocols/mifare_ultralight.h @@ -16,7 +16,8 @@ #define MF_UL_COMP_WRITE (0xA0) #define MF_UL_READ_CNT (0x39) #define MF_UL_INC_CNT (0xA5) -#define MF_UL_AUTH (0x1B) +#define MF_UL_AUTHENTICATE_1 (0x1A) +#define MF_UL_PWD_AUTH (0x1B) #define MF_UL_READ_SIG (0x3C) #define MF_UL_CHECK_TEARING (0x3E) #define MF_UL_READ_VCSL (0x4B) @@ -41,6 +42,7 @@ typedef enum { typedef enum { MfUltralightTypeUnknown, MfUltralightTypeNTAG203, + MfUltralightTypeULC, // Below have config pages and GET_VERSION support MfUltralightTypeUL11, MfUltralightTypeUL21, @@ -77,6 +79,7 @@ typedef enum { MfUltralightSupportAsciiMirror = 1 << 11, // NTAG203 counter that's in memory rather than through a command MfUltralightSupportCounterInMemory = 1 << 12, + MfUltralightSupport3DesAuth = 1 << 13, } MfUltralightFeatures; typedef enum { @@ -237,6 +240,8 @@ bool mf_ul_read_card( MfUltralightReader* reader, MfUltralightData* data); +bool mf_ul_emulation_supported(MfUltralightData* data); + void mf_ul_reset_emulation(MfUltralightEmulator* emulator, bool is_power_cycle); void mf_ul_prepare_emulation(MfUltralightEmulator* emulator, MfUltralightData* data); diff --git a/lib/subghz/protocols/secplus_v2.c b/lib/subghz/protocols/secplus_v2.c index d39f794ab..7acfb74ac 100644 --- a/lib/subghz/protocols/secplus_v2.c +++ b/lib/subghz/protocols/secplus_v2.c @@ -345,7 +345,7 @@ static void if(subghz_custom_btn_get_original() == 0) { subghz_custom_btn_set_original(instance->btn); } - subghz_custom_btn_set_max(3); + subghz_custom_btn_set_max(4); } /** @@ -377,7 +377,7 @@ static uint64_t subghz_protocol_secplus_v2_encode_half(uint8_t roll_array[], uin /** * Defines the button value for the current btn_id - * Basic set | 0x68 | 0x80 | 0x81 | 0xE2 | + * Basic set | 0x68 | 0x80 | 0x81 | 0xE2 | 0x78 * @return Button code */ static uint8_t subghz_protocol_secplus_v2_get_btn_code(); @@ -856,6 +856,9 @@ static uint8_t subghz_protocol_secplus_v2_get_btn_code() { case 0xE2: btn = 0x80; break; + case 0x78: + btn = 0x80; + break; default: break; @@ -874,6 +877,9 @@ static uint8_t subghz_protocol_secplus_v2_get_btn_code() { case 0xE2: btn = 0x81; break; + case 0x78: + btn = 0x81; + break; default: break; @@ -892,6 +898,30 @@ static uint8_t subghz_protocol_secplus_v2_get_btn_code() { case 0xE2: btn = 0x68; break; + case 0x78: + btn = 0xE2; + break; + + default: + break; + } + } else if(custom_btn_id == SUBGHZ_CUSTOM_BTN_RIGHT) { + switch(original_btn_code) { + case 0x68: + btn = 0x78; + break; + case 0x80: + btn = 0x78; + break; + case 0x81: + btn = 0x78; + break; + case 0xE2: + btn = 0x78; + break; + case 0x78: + btn = 0x68; + break; default: break; diff --git a/lib/toolbox/SConscript b/lib/toolbox/SConscript index 2d94336a9..fafedfeb4 100644 --- a/lib/toolbox/SConscript +++ b/lib/toolbox/SConscript @@ -8,6 +8,7 @@ env.Append( "#/lib/toolbox", ], SDK_HEADERS=[ + File("api_lock.h"), File("value_index.h"), File("manchester_decoder.h"), File("manchester_encoder.h"), diff --git a/lib/toolbox/namechanger.c b/lib/toolbox/namechanger.c deleted file mode 100644 index 33842bcd7..000000000 --- a/lib/toolbox/namechanger.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "namechanger.h" -#include -#include - -#define TAG "NameChanger" - -bool NameChanger_Init() { - Storage* storage = furi_record_open(RECORD_STORAGE); - FuriString* str = furi_string_alloc(); - FlipperFormat* file = flipper_format_file_alloc(storage); - - bool res = false; - - do { - uint32_t version; - if(!flipper_format_file_open_existing(file, NAMECHANGER_PATH)) break; - if(!flipper_format_read_header(file, str, &version)) break; - if(furi_string_cmp_str(str, NAMECHANGER_HEADER)) break; - if(version != NAMECHANGER_VERSION) break; - - if(!flipper_format_read_string(file, "Name", str)) break; - // Check for size - size_t temp_string_size = furi_string_size(str); - if(temp_string_size > (size_t)8) break; - if(temp_string_size < (size_t)2) break; - - // Check for forbidden characters - const char* name_ptr = furi_string_get_cstr(str); - bool chars_check_failed = false; - - for(; *name_ptr; ++name_ptr) { - const char c = *name_ptr; - if((c < '0' || c > '9') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) { - chars_check_failed = true; - break; - } - } - - if(chars_check_failed) break; - - // If all checks was good we can set the name - version_set_custom_name(NULL, strdup(furi_string_get_cstr(str))); - furi_hal_version_set_name(version_get_custom_name(NULL)); - - res = true; - } while(false); - - flipper_format_free(file); - furi_record_close(RECORD_STORAGE); - furi_string_free(str); - - return res; -} \ No newline at end of file diff --git a/lib/toolbox/namechanger.h b/lib/toolbox/namechanger.h deleted file mode 100644 index bfaadec15..000000000 --- a/lib/toolbox/namechanger.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#define NAMECHANGER_HEADER "Flipper Name File" -#define NAMECHANGER_VERSION 1 -#define NAMECHANGER_PATH EXT_PATH("dolphin/name.settings") - -#include "stdbool.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Initializes the name changer. (Load name file, apply changes) -bool NameChanger_Init(); - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/scripts/fbt/appmanifest.py b/scripts/fbt/appmanifest.py index ed1654e36..eb265cee8 100644 --- a/scripts/fbt/appmanifest.py +++ b/scripts/fbt/appmanifest.py @@ -1,7 +1,7 @@ import os from dataclasses import dataclass, field from enum import Enum -from typing import Callable, List, Optional, Tuple +from typing import Callable, List, Optional, Tuple, Union class FlipperManifestException(Exception): @@ -56,7 +56,7 @@ class FlipperApplication: # .fap-specific sources: List[str] = field(default_factory=lambda: ["*.c*"]) - fap_version: str | Tuple[int] = "0.1" + fap_version: Union[str, Tuple[int]] = "0.1" fap_icon: Optional[str] = None fap_libs: List[str] = field(default_factory=list) fap_category: str = "" diff --git a/scripts/sconsdist.py b/scripts/sconsdist.py index a3b466898..fc121390d 100644 --- a/scripts/sconsdist.py +++ b/scripts/sconsdist.py @@ -271,7 +271,15 @@ class Main(App): self.note_dist_component( "update", "tgz", self.get_dist_path(bundle_tgz) ) - tar.add(bundle_dir, arcname=bundle_dir_name) + + # Strip uid and gid in case of overflow + def tar_filter(tarinfo): + tarinfo.uid = tarinfo.gid = 0 + tarinfo.mtime = 0 + tarinfo.uname = tarinfo.gname = "furippa" + return tarinfo + + tar.add(bundle_dir, arcname=bundle_dir_name, filter=tar_filter) return bundle_result diff --git a/scripts/update.py b/scripts/update.py index 0f3ee6ea8..9f0d95d94 100755 --- a/scripts/update.py +++ b/scripts/update.py @@ -211,6 +211,9 @@ class Main(App): f"Cannot package resource: name '{tarinfo.name}' too long" ) raise ValueError("Resource name too long") + tarinfo.gid = tarinfo.uid = 0 + tarinfo.mtime = 0 + tarinfo.uname = tarinfo.gname = "furippa" return tarinfo def package_resources(self, srcdir: str, dst_name: str):