### Sub-GHz Remote Map File Setup Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/SubGHzRemotePlugin.md This example demonstrates the basic structure for a Sub-GHz Remote map file. It maps directional inputs (UP, DOWN, LEFT, RIGHT, OK) to specific `.sub` file paths and assigns corresponding display labels (ULABEL, DLABEL, etc.). ```text UP: /ext/subghz/Up.sub DOWN: /ext/subghz/Down.sub LEFT: /ext/subghz/Left.sub RIGHT: /ext/subghz/Right.sub OK: /ext/subghz/Ok.sub ULABEL: Up Label DLABEL: Down Label LLABEL: Left Label RLABEL: Right Label OKLABEL: Ok Label ``` -------------------------------- ### Navigate and Start Flipper Zero Application Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/system/js_app/packages/create-fz-app/README.md After creating the application, navigate into the project directory and run this command to start the development server. ```shell cd my-flip-app npm start ``` -------------------------------- ### Example .sub File Configuration Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/SubGHzCounterMode.md This example shows how to configure a .sub file to use a specific CounterMode. Ensure the CounterMode line is added at the end of the file. ```subghz Filetype: Flipper SubGhz Key File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetOok650Async Protocol: Nice FloR-S Bit: 52 Key: AA AA AA AA AA AA AA CounterMode: 1 ``` -------------------------------- ### Example connection to Developer Board on macOS Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Reading logs via the Dev Board.md Example command to connect to a specific Developer Board port on macOS. ```bash minicom -D /dev/cu.usbmodemblackmagic3 -b 230400 ``` -------------------------------- ### Install minicom on Linux Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Reading logs via the Dev Board.md Install the minicom serial communication program on Linux (Ubuntu example). ```bash sudo apt install minicom ``` -------------------------------- ### macOS qFlipper Installation Script Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/main/bad_usb/resources/badusb/Install_qFlipper_macOS.txt This script is designed to be executed via a BadUSB device on macOS. It bypasses the keyboard setup assistant, downloads the qFlipper DMG, installs the application, and then launches it. Use this script only for the first BadUSB attack against a specific macOS target. ```badusb REM Keep these 3 lines IF (and only if) it's the first time you are performing a badKB attack against a specific macOS target. REM In fact, it helps Flipper Zero bypass the macOS keyboard setup assistant. Otherwise the attack will not start. REM Author: 47LeCoste REM Version 1.0 (Flipper Ducky) REM Target: macOS DELAY 3000 F4 DELAY 2500 STRING Terminal DELAY 2500 ENTER DELAY 1500 STRING (cd /tmp && curl -L -o qFlipper.dmg https://update.flipperzero.one/qFlipper/release/macos-amd64/dmg && hdiutil attach qFlipper.dmg && app_volume=$(ls /Volumes | grep -i "qFlipper") && (test -e /Applications/qFlipper.app && rm -rf /Applications/qFlipper.app ); cp -R "/Volumes/$app_volume/qFlipper.app" /Applications/ && hdiutil detach "/Volumes/$app_volume" && rm qFlipper.dmg && open /Applications/qFlipper.app) DELAY 1000 ENTER ``` -------------------------------- ### iButton Key File Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/iButtonFileFormat.md This snippet shows an example of the Flipper iButton key file format, including the file type, version, protocol, and ROM/SRAM data. ```text Filetype: Flipper iButton key Version: 2 Protocol: DS1992 Rom Data: 08 DE AD BE EF FA CE 4E Sram Data: 4E 65 76 65 72 47 6F 6E 6E 61 47 69 76 65 59 6F 75 55 70 4E 65 76 65 72 47 6F 6E 6E 61 4C 65 74 59 6F 75 44 6F 77 6E 4E 65 76 65 72 47 6F 6E 6E 61 52 75 6E 41 72 6F 75 6E 64 41 6E 64 44 65 73 65 72 74 59 6F 75 4E 65 76 65 72 47 6F 6E 6E 61 4D 61 6B 65 59 6F 75 43 72 79 4E 65 76 65 72 47 6F 6E 6E 61 53 61 79 47 6F 6F 64 62 79 65 4E 65 76 65 72 47 6F 6E 6E 61 54 65 6C 6C 41 4C 69 65 ``` -------------------------------- ### Install micro Flipper Build Tool (uFBT) on Linux/macOS Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Firmware update on Developer Board.md Installs the uFBT tool using pipx on Linux and macOS systems. Ensure pipx is installed first. ```bash pipx install ufbt ``` -------------------------------- ### Install micro Flipper Build Tool (uFBT) on Windows Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Firmware update on Developer Board.md Installs the uFBT tool using pipx on Windows systems. Requires Python and pipx to be installed and PATH configured. ```powershell py -m pip install --user pipx ``` ```powershell py -m pipx ensurepath ``` ```powershell pipx install ufbt ``` -------------------------------- ### Install qFlipper on Linux GNOME Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/main/bad_usb/resources/badusb/Install_qFlipper_gnome.txt This script automates the installation of qFlipper on Linux with GNOME. It downloads the AppImage, sets up necessary directories, makes the application executable, installs the icon and desktop entry, and updates the system's application menu. ```bash ALT F2 DELAY 1000 STRINGLN gnome-terminal --maximize DELAY 1000 STRINGLN mkdir -p $HOME/.local/bin STRINGLN curl -fsSL "https://update.flipperzero.one/qFlipper/release/linux-amd64/AppImage" -o "$HOME/.local/bin/qFlipper" DELAY 1000 STRINGLN chmod +x $HOME/.local/bin/qFlipper STRINGLN cd /tmp STRINGLN $HOME/.local/bin/qFlipper --appimage-extract > /dev/null STRINGLN sed "s@Exec=qFlipper@Exec=$HOME/.local/bin/qFlipper" squashfs-root/usr/share/applications/qFlipper.desktop > $HOME/.local/share/applications/qFlipper.desktop STRINGLN mkdir -p $HOME/.local/share/icons/hicolor/512x512/apps STRINGLN cp squashfs-root/usr/share/icons/hicolor/512x512/apps/qFlipper.png $HOME/.local/share/icons/hicolor/512x512/apps/qFlipper.png STRINGLN rm -rf squashfs-root STRINGLN cd STRINGLN xdg-desktop-menu forceupdate || true STRINGLN update-desktop-database ~/.local/share/applications || true STRINGLN echo " ENTER REPEAT 60 STRINGLN ========================================================================================== STRINGLN qFlipper has been installed to $HOME/.local/bin/ STRINGLN It should appear in your Applications menu. STRINGLN If it does not, you might want to log out and log in again. ENTER STRINGLN If you prefer to run qFlipper from your terminal, either use the absolute path STRINGLN or make sure $HOME/.local/bin/ is included in your PATH environment variable. ENTER STRINGLN Additional configurations might be required by your Linux distribution such as STRINGLN group membership, udev rules or else. STRINGLN ========================================================================================== STRINGLN " ``` -------------------------------- ### Frame Index Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/assets/dolphin/ReadMe.md An example illustrating the real frame order and frame indexes based on passive/active frames and frame order configuration. ```text Passive frames: 6 Active frames: 2 Frames order: 0 1 2 3 4 5 6 7 Active cycles: 4 passive(6) active (2 * 4) Real frames order: 0 1 2 3 4 5 6 7 6 7 6 7 6 7 Frames indexes: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ``` -------------------------------- ### File Naming Convention Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/CODING_STYLE.md File and package names should act as prefixes for their content, aiding in locating related types and functions. This example shows the naming for a 'SubGhz Keystore' abstraction. ```c subghz_keystore.h SubGhzKeystore subghz_keystore_read ``` -------------------------------- ### qFlipper Windows Installation Script Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/main/bad_usb/resources/badusb/Install_qFlipper_windows.txt This script automates the download, extraction, and execution of qFlipper on Windows. It also handles driver installation and creates a desktop shortcut. ```badusb REM Written by @dexv DELAY 2000 GUI r DELAY 500 STRING powershell ENTER DELAY 1000 STRING $url = "https://update.flipperzero.one/qFlipper/release/windows-amd64/portable" ENTER STRING $output = "$env:USERPROFILE\Documents\qFlipper.zip" ENTER STRING $destination = "$env:USERPROFILE\Documents\qFlipper" ENTER STRING $shortcutPath = "$env:USERPROFILE\Desktop\qFlipper.lnk" ENTER STRING $scriptPath = "$env:USERPROFILE\Documents\qFlipperInstall.ps1" ENTER STRING $driverPath = "$destination\STM32 Driver" ENTER STRING $installBat = "$driverPath\install.bat" ENTER STRING (New-Object System.Net.WebClient).DownloadFile($url, $output) ENTER STRING Expand-Archive -Path $output -DestinationPath $destination -Force ENTER STRING Set-Location -Path $destination ENTER STRING Start-Process -FilePath ".\qFlipper.exe" ENTER STRING Start-Process -Wait -FilePath "cmd.exe" -ArgumentList "/c $installBat" ENTER STRING $shell = New-Object -ComObject WScript.Shell ENTER STRING $shortcut = $shell.CreateShortcut($shortcutPath) ENTER STRING $shortcut.TargetPath = "$destination\qFlipper.exe" ENTER STRING $shortcut.Save() ENTER DELAY 500 STRING "powershell -ExecutionPolicy Bypass -File $scriptPath" ENTER ``` -------------------------------- ### Sub-GHz Remote Map File Configuration Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/SubGHzRemotePlugin.md This example shows a more specific configuration for the Sub-GHz Remote map file, assigning different `.sub` files and descriptive labels for actions like controlling fans or opening a garage. ```text UP: /ext/subghz/Fan1.sub DOWN: /ext/subghz/Fan2.sub LEFT: /ext/subghz/Door.sub RIGHT: /ext/subghz/Garage3.sub OK: /ext/subghz/Garage3l.sub ULABEL: Fan ON DLABEL: Fan OFF LLABEL: Doorbell RLABEL: Garage OPEN OKLABEL: Garage CLOSE ``` -------------------------------- ### Setup BadUSB with Custom VID, PID, Manufacturer, and Product Strings Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_badusb.md Initialize the USB HID interface with custom VID, PID, manufacturer name, and product name. ```javascript badusb.setup({ vid: 0xAAAA, pid: 0xBBBB, mfrName: "Flipper Devices", prodName: "Flipper Zero" }); ``` -------------------------------- ### Setup BadUSB with Default Parameters Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_badusb.md Initialize the USB HID interface with default settings. This should be called before any other BadUSB methods. ```javascript badusb.setup(); ``` -------------------------------- ### RAW File Data Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md Example of RAW data format, specifying the protocol and raw timing data. Timings are in microseconds, must be non-zero, start positive, and interleave signs. ```text Protocol: RAW RAW_Data: 29262 361 -68 2635 -66 24113 -66 11 ... ``` -------------------------------- ### Install fatsort on macOS Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/FAQ.md Installs the 'fatsort' utility using Homebrew, which can help speed up file sorting on the Flipper's microSD card. ```bash brew install fatsort ``` -------------------------------- ### Connect to Flipper Zero CLI on Windows Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/FAQ.md This guide is for Windows users. PuTTY is required. Ensure qFlipper is closed to avoid 'Access Denied' errors. ```PuTTY Configuration Set connection type to Serial. Set serial line to the detected COM port (e.g., COM1). Set speed to 115200. Click Open. ``` -------------------------------- ### Control an LED Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_gpio.md Example of initializing a GPIO pin as an output and controlling an LED. It blinks the LED on and off. ```javascript let eventLoop = require("event_loop"); let gpio = require("gpio"); let led = gpio.get("pc3"); led.init({ direction: "out", outMode: "push_pull" }); led.write(true); delay(1000); led.write(false); delay(1000); ``` -------------------------------- ### macOS Shell Script Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/main/bad_usb/resources/badusb/demo_macos.txt This example demonstrates executing a shell script in macOS, including displaying text and ASCII art. It uses a heredoc to pass multi-line input to 'cat /dev/null'. ```BadUSB STRING cat > /dev/null << EOF ENTER STRING Hello World! ENTER DEFAULT_DELAY 50 STRING = REPEAT 59 ENTER ENTER STRING _.-------.._ -, ENTER HOME STRING .-"'''"--..,,_/ /'-, -, \ ENTER HOME STRING .:" /:/ /'\ \ ,_..., '. | | ENTER HOME STRING / ,----/:/ /'\ _\~'-"" _; ENTER HOME STRING ' / /'"""'\ \ \.~'_-' ,-"'/ ENTER HOME STRING | | | 0 | | .-' ,/' / ENTER HOME STRING | ,..,\ \ ,.-"' ,/' / ENTER HOME STRING ; : '/'"\' ,/--==,/-----, ENTER HOME STRING | '-...| -.___-Z:_______J...---; ENTER HOME STRING : ' _-' ENTER HOME STRING _L_ _ ___ ___ ___ ___ ____--"' ENTER HOME STRING | __|| | |_ _|| _ \| _ \| __|| _ \ ENTER HOME STRING | _| | |__ | | | _/| _/| _| | / ENTER HOME STRING |_| |____||___||_| |_| |___||_|_ ENTER HOME ENTER STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format ENTER STRING More information about script syntax can be found here: ENTER STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md ENTER STRING EOF ENTER ``` -------------------------------- ### Example Key Data Block in Princeton Format Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md This snippet shows an example of how key data is represented in a .sub file for the Princeton protocol. It includes the protocol name, bit length, key value, and timing interval. ```text Protocol: Princeton Bit: 24 Key: 00 00 00 00 00 95 D5 D4 TE: 400 ``` -------------------------------- ### RAW File with Standard Preset Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md Example of a Flipper SubGhz RAW File using a standard OOK preset. Includes frequency, preset, protocol, and multiple lines of RAW_Data. ```text Filetype: Flipper SubGhz RAW File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetOok650Async Protocol: RAW RAW_Data: 29262 361 -68 2635 -66 24113 -66 11 ... RAW_Data: -424 205 -412 159 -412 381 -240 181 ... RAW_Data: -1448 361 -17056 131 -134 233 -1462 131 -166 953 -100 ... ``` -------------------------------- ### Pin.pwmWrite() Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_gpio.md Configures and starts PWM on a GPIO pin. ```APIDOC ## Pin.pwmWrite() ### Description Sets PWM parameters and starts the PWM output on the pin. This method automatically configures the pin with `{ direction: "out", outMode: "push_pull" }`. Throws an error if PWM is not supported on this pin. ### Parameters - **freq** (number): The frequency of the PWM signal in Hz. - **duty** (number): The duty cycle of the PWM signal in percent (0-100). ``` -------------------------------- ### Install Flipper udev Rules Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/scripts/debug/README.md These commands copy the Flipper udev rules file to the system directory and reload/trigger the udev rules for debugging and CLI access. ```bash sudo cp 41-flipper.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules sudo udevadm trigger ``` -------------------------------- ### Nice Flor S with CounterMode 1 Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/SubGHzCounterMode.md Example configuration for a Nice Flor S protocol using CounterMode 1. Ensure the protocol supports this mode. ```subghz Filetype: Flipper SubGhz Key File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetOok650Async Protocol: Nice FloR-S Bit: 52 Key: 01 23 45 67 89 AB CD CounterMode: 1 ``` -------------------------------- ### KeeLoq with CounterMode 2 (Doorhan) Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/SubGHzCounterMode.md Example configuration for a KeeLoq protocol (Doorhan) using CounterMode 2. Verify protocol compatibility for this mode. ```subghz Filetype: Flipper SubGhz Key File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetOok650Async Protocol: KeeLoq Bit: 64 Key: DE AD BE EF CA FE BA BE Manufacture: Doorhan CounterMode: 2 ``` -------------------------------- ### Setup Serial Port Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_serial.md Configure a serial port with a specified baudrate. This should be called before any other serial methods. ```javascript // Configure LPUART port with baudrate = 115200 serial.setup("lpuart", 115200); ``` -------------------------------- ### Load a Module Plugin Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `require()` to load external module plugins. Example loads the 'serial' module. ```javascript let serial = require("serial"); // Load "serial" module ``` -------------------------------- ### Mifare Ultralight C Key Dictionary File Format Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/NfcFileFormats.md This example demonstrates the structure of a Mifare Ultralight C key dictionary file, listing hexadecimal keys. Comments and blank lines are ignored. ```Key Dictionary # Hexadecimal-Reversed Sample Key 12E4143455F495649454D4B414542524 # Byte-Reversed Sample Key (!NACUOYFIEMKAERB) 214E4143554F594649454D4B41455242 # Sample Key (BREAKMEIFYOUCAN!) 425245414B4D454946594F5543414E21 # Semnox Key (IEMKAERB!NACUOY ) 49454D4B41455242214E4143554F5900 # Modified Semnox Key (IEMKAERB!NACUOYF) 49454D4B41455242214E4143554F5946 ... ``` -------------------------------- ### LF RFID Key File Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/LfRfidFileFormat.md This snippet shows the basic structure of an LF RFID key file, including file type, version, key type, and data. ```text Filetype: Flipper RFID key Version: 1 Key type: EM4100 Data: 01 23 45 67 89 ``` -------------------------------- ### Compile Everything and Get Updater Package (Linux/macOS) Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/HowToBuild.md Compile the entire firmware and generate an updater package for microSD card updates. Check the 'dist/' directory for build outputs. ```shell ./fbt COMPACT=1 DEBUG=0 updater_package ``` -------------------------------- ### badusb.setup() Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_badusb.md Starts the USB HID emulation. This method should be called before any other BadUSB methods. It accepts an optional configuration object to customize the device's VID, PID, manufacturer name, product name, and keyboard layout path. ```APIDOC ## badusb.setup() ### Description Starts USB HID emulation with optional parameters. This must be called before other BadUSB methods. ### Method ``` setup(config?: { vid: number, pid: number, mfrName?: string, prodName?: string, layoutPath?: string }): void ``` ### Parameters - **config** (object) - Optional configuration object: - **vid** (number) - Required. The Vendor ID for the USB device. - **pid** (number) - Required. The Product ID for the USB device. - **mfrName** (string) - Optional. Manufacturer name (max 32 ASCII characters). - **prodName** (string) - Optional. Product name (max 32 ASCII characters). - **layoutPath** (string) - Optional. Path to the keyboard layout file. ### Examples ```js // Start USB HID with default parameters badusb.setup(); // Start USB HID with custom vid:pid = AAAA:BBBB badusb.setup({ vid: 0xAAAA, pid: 0xBBBB }); // Start USB HID with custom vid:pid, manufacturer and product strings badusb.setup({ vid: 0xAAAA, pid: 0xBBBB, mfrName: "Flipper Devices", prodName: "Flipper Zero" }); ``` ``` -------------------------------- ### Get Character Code Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `String.charCodeAt()` to retrieve the Unicode character code at a specific index within a string. Example gets the code for 'A' at index 0. ```javascript "A".charCodeAt(0) // 65 ``` -------------------------------- ### Basic setTimeout Equivalent Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_event_loop.md This example demonstrates creating a one-shot timer that fires after a specified interval, prints a message, and then stops the event loop. ```javascript // import module let eventLoop = require("event_loop"); // create an event source that will fire once 1 second after it has been created let timer = eventLoop.timer("oneshot", 1000); // subscribe a callback to the event source eventLoop.subscribe(timer, function(_subscription, _item, eventLoop) { print("Hello, World!"); eventLoop.stop(); }, eventLoop); // notice this extra argument. we'll come back to this later // run the loop until it is stopped eventLoop.run(); // the previous line will only finish executing once `.stop()` is called, hence // the following line will execute only after "Hello, World!" is printed print("Stopped"); ``` -------------------------------- ### Extract Substring Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `String.slice()` to extract a portion of a string between two indices. The second index is non-inclusive. Example extracts 'ample' from 'Example' starting at index 2. ```javascript "Example".slice(2) // "ample" ``` -------------------------------- ### Find Substring Index Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `String.indexOf()` to find the first occurrence of a substring within a string, optionally starting from a specified index. Returns -1 if not found. Example finds 'amp' in 'Example'. ```javascript "Example".indexOf("amp") // 2 ``` -------------------------------- ### Remove and Return Array Elements Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `Array.splice()` to remove elements from an array starting at a given index and return the removed elements. Examples show removing all elements from an index and the resulting array. ```javascript let arr = [1, 2, 3]; arr.splice(1); // [2, 3] arr; // [1] ``` -------------------------------- ### Install Homebrew on macOS Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Reading logs via the Dev Board.md Install Homebrew package manager on macOS to manage software installations. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Mifare DESFire Flipper NFC Device File Format Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/NfcFileFormats.md This example shows the structure of a Flipper NFC device file for a Mifare DESFire card, including card type, UID, ISO14443-3A/4A data, PICC version, memory, key configurations, application IDs, and file data. It reflects data written with specific pm3 commands. ```NFC Device File Filetype: Flipper NFC device Version: 4 # Device type can be ISO14443-3A, ISO14443-3B, ISO14443-4A, NTAG/Ultralight, Mifare Classic, Mifare DESFire Device type: Mifare DESFire # UID is common for all formats UID: 04 2F 19 0A CD 66 80 # ISO14443-3A specific data ATQA: 03 44 SAK: 20 # ISO14443-4A specific data ATS: 06 75 77 81 02 80 # Mifare DESFire specific data PICC Version: 04 01 01 12 00 1A 05 04 01 01 02 01 1A 05 04 2F 19 0A CD 66 80 CE ED D4 51 80 31 19 PICC Free Memory: 7520 PICC Change Key ID: 00 PICC Config Changeable: true PICC Free Create Delete: true PICC Free Directory List: true PICC Key Changeable: true PICC Max Keys: 01 PICC Key 0 Version: 00 Application Count: 1 Application IDs: 56 34 12 Application 563412 Change Key ID: 00 Application 563412 Config Changeable: true Application 563412 Free Create Delete: true Application 563412 Free Directory List: true Application 563412 Key Changeable: true Application 563412 Max Keys: 0E Application 563412 Key 0 Version: 00 Application 563412 Key 1 Version: 00 Application 563412 Key 2 Version: 00 Application 563412 Key 3 Version: 00 Application 563412 Key 4 Version: 00 Application 563412 Key 5 Version: 00 Application 563412 Key 6 Version: 00 Application 563412 Key 7 Version: 00 Application 563412 Key 8 Version: 00 Application 563412 Key 9 Version: 00 Application 563412 Key 10 Version: 00 Application 563412 Key 11 Version: 00 Application 563412 Key 12 Version: 00 Application 563412 Key 13 Version: 00 Application 563412 File IDs: 01 Application 563412 File 1 Type: 00 Application 563412 File 1 Communication Settings: 00 Application 563412 File 1 Access Rights: EE EE Application 563412 File 1 Size: 256 Application 563412 File 1: 13 37 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ``` -------------------------------- ### Setup BadUSB with Custom VID and PID Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_badusb.md Initialize the USB HID interface with custom Vendor ID (VID) and Product ID (PID). Manufacturer and product strings are not defined. ```javascript badusb.setup({ vid: 0xAAAA, pid: 0xBBBB }); ``` -------------------------------- ### Convert String to Lowercase Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `String.toLowerCase()` to transform all characters in a string to their lowercase equivalents. Example converts 'Example' to 'example'. ```javascript "Example".toLowerCase() // "example" ``` -------------------------------- ### Convert String to Uppercase Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_builtin.md Use `String.toUpperCase()` to transform all characters in a string to their uppercase equivalents. Example converts 'Example' to 'EXAMPLE'. ```javascript "Example".toUpperCase() // "EXAMPLE" ``` -------------------------------- ### ViewDispatcher Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_gui.md Demonstrates how to use ViewDispatcher to manage multiple views like loading, empty, and submenu screens. It shows how to switch between views based on user interaction and navigation events. ```javascript let eventLoop = require("event_loop"); let gui = require("gui"); let loadingView = require("gui/loading"); let submenuView = require("gui/submenu"); let emptyView = require("gui/empty_screen"); // Common pattern: declare all the views in an object. This is absolutely not // required, but adds clarity to the script. let views = { // the view dispatcher auto-✨magically✨ remembers views as they are created loading: loadingView.make(), empty: emptyView.make(), demos: submenuView.makeWith({ items: [ "Hourglass screen", "Empty screen", "Exit app", ], }), }; // go to different screens depending on what was selected eventLoop.subscribe(views.demos.chosen, function (_sub, index, gui, eventLoop, views) { if (index === 0) { gui.viewDispatcher.switchTo(views.loading); } else if (index === 1) { gui.viewDispatcher.switchTo(views.empty); } else if (index === 2) { eventLoop.stop(); } }, gui, eventLoop, views); // go to the demo chooser screen when the back key is pressed eventLoop.subscribe(gui.viewDispatcher.navigation, function (_sub, _, gui, views) { gui.viewDispatcher.switchTo(views.demos); }, gui, views); // run UI gui.viewDispatcher.switchTo(views.demos); eventLoop.run(); ``` -------------------------------- ### serial.setup() Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_serial.md Configures the serial port. This method must be called before any other serial methods. It also disables the Expansion module service to prevent interference. ```APIDOC ## setup() ### Description Configure serial port. Should be called before all other methods. Automatically disables Expansion module service to prevent interference. ### Parameters - **portName** (string) - Required - The name of the serial port (e.g., "usart", "lpuart"). - **baudrate** (number) - Required - The baud rate for the serial connection. - **framingConfig** (object) - Optional - An object for framing configuration. - **dataBits** (string) - Optional - Number of data bits: "6", "7", "8", "9". Note: 6 data bits require parity enabled, 9 data bits require parity disabled. - **parity** (string) - Optional - Parity setting: "none", "even", "odd". - **stopBits** (string) - Optional - Number of stop bits: "0.5", "1", "1.5", "2". Note: LPUART only supports whole stop bit lengths. ### Example ```js // Configure LPUART port with baudrate = 115200 serial.setup("lpuart", 115200); ``` ``` -------------------------------- ### Install minicom on macOS Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Reading logs via the Dev Board.md Install the minicom serial communication program on macOS using Homebrew. ```bash brew install minicom ``` -------------------------------- ### Key File with Custom Preset Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md Example of a Flipper SubGhz Key File using a custom preset. Includes custom module and data, along with standard key file parameters. ```text Filetype: Flipper SubGhz Key File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetCustom Custom_preset_module: CC1101 Custom_preset_data: 02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 32 10 17 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00 Protocol: Princeton Bit: 24 Key: 00 00 00 00 00 95 D5 D4 TE: 400 ``` -------------------------------- ### setTimeout Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_event_loop.md A standard JavaScript example demonstrating the use of setTimeout to execute a function after a delay. ```javascript setTimeout(function() { console.log("Hello, World!") }, 1000); ``` -------------------------------- ### Parsed Infrared Data Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/InfraredCaptures.md An example of recognized, parsed infrared data. This format is cleaner and indicates a known protocol. ```yaml name: EXAMPLE type: parsed protocol: NEC address: 07 00 00 00 command: 02 00 00 00 ``` -------------------------------- ### Compile Everything and Get Updater Package (Windows) Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/HowToBuild.md Compile the entire firmware and generate an updater package for microSD card updates on Windows. Ensure to use './fbt.cmd' and adjust path separators if necessary. Check the 'dist/' directory for build outputs. ```powershell ./fbt.cmd COMPACT=1 DEBUG=0 updater_package ``` -------------------------------- ### List Available Peripherals Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/scripts/debug/PyCortexMDebug/README.md After loading an SVD file, use this command to list all available peripherals and their descriptions. ```gdb svd ``` -------------------------------- ### Raw Infrared Data Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/InfraredCaptures.md An example of raw infrared data capture. This format is less processed and requires careful capture to avoid excessive data. ```yaml # name: EXAMPLE type: raw frequency: 38000 duty_cycle: 0.330000 data: 2410 597 1189 599 592 600 1186 602 589 603 1183 606 595 597 593 598 1208 605 596 596 594 597 593 599 592 25604 2403 604 1182 606 595 597 1189 599 591 601 1185 603 618 573 617 575 1211 602 588 603 588 605 596 596 594 25605 2402 604 1192 596 594 597 1189 599 592 601 1185 628 593 598 593 600 1186 602 589 603 588 604 597 595 596 ``` -------------------------------- ### Basic Text Input and Automation Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/main/bad_usb/resources/badusb/demo_windows.txt This snippet demonstrates opening Notepad, typing 'Hello World!', and then performing a copy-paste operation. ```badusb REM This is BadUSB demo script for windows REM set slightly slower delay to ensure notepad picks up input without skipping characters DEFAULT_STRING_DELAY 10 REM Open windows notepad DELAY 1000 GUI r DELAY 500 STRING notepad DELAY 500 ENTER DELAY 750 STRING Hello World! ENTER DEFAULT_DELAY 50 REM Copy-Paste previous string UP HOME SHIFT DOWN CTRL c RIGHT CTRL v CTRL v ``` -------------------------------- ### Build Flipper Zero Firmware Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/devboard/Debugging via the Devboard.md Use the Flipper Build Tool (FBT) to build the firmware. This command compiles the source code into a runnable firmware image. ```bash ./fbt ``` -------------------------------- ### Infrared Remote File Format - Parsed Example (NECext) Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/InfraredFileFormats.md Example of an infrared remote button stored in 'parsed' format using the NECext protocol. This format is suitable for known protocols. ```plaintext Filetype: IR signals file Version: 1 # name: Button_1 type: parsed protocol: NECext address: EE 87 00 00 command: 5D A0 00 00 ``` -------------------------------- ### Key File with Standard Preset Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md Example of a Flipper SubGhz Key File using a standard OOK preset. Specifies frequency, preset, protocol, bit length, key data, and timing interval. ```text Filetype: Flipper SubGhz Key File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetOok650Async Protocol: Princeton Bit: 24 Key: 00 00 00 00 00 95 D5 D4 TE: 400 ``` -------------------------------- ### Create Flipper Zero App with Unleashed Firmware Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/system/js_app/packages/create-fz-app/README.md Use this command to initiate the interactive wizard for creating a new JavaScript application for Flipper Zero with the Unleashed Firmware. ```shell npx @darkflippers/create-fz-app-ul@latest ``` -------------------------------- ### Infrared Remote File Format - Parsed Example (SIRC) Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/InfraredFileFormats.md Another example of an infrared remote button in 'parsed' format, this time using the SIRC protocol. It demonstrates different protocol and address/command values. ```plaintext name: Button_3 type: parsed protocol: SIRC address: 01 00 00 00 command: 15 00 00 00 ``` -------------------------------- ### RAW File with Custom Preset Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md Example of a Flipper SubGhz RAW File using a custom preset. Includes custom module and data, along with frequency, protocol, and multiple lines of RAW_Data. ```text Filetype: Flipper SubGhz RAW File Version: 1 Frequency: 433920000 Preset: FuriHalSubGhzPresetCustom Custom_preset_module: CC1101 Custom_preset_data: 02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 32 10 17 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00 Protocol: RAW RAW_Data: 29262 361 -68 2635 -66 24113 -66 11 ... RAW_Data: -424 205 -412 159 -412 381 -240 181 ... RAW_Data: -1448 361 -17056 131 -134 233 -1462 131 -166 953 -100 ... ``` -------------------------------- ### Infrared Remote File Format - Raw Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/InfraredFileFormats.md Example of an infrared remote button stored in 'raw' format. This is used for signals not recognized by known protocols and requires frequency and duty cycle information. ```plaintext name: Button_2 type: raw frequency: 38000 duty_cycle: 0.330000 data: 504 3432 502 483 500 484 510 502 502 482 501 485 509 1452 504 1458 509 1452 504 481 501 474 509 3420 503 ``` -------------------------------- ### CC1101 Custom Preset Data Example (Commented) Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md An example of custom preset data for a CC1101 module, shown with comments indicating it is a custom preset name and module type. This format is used for configuring radio parameters. ```text #Custom_preset_name: AM_2 #Custom_preset_module: CC1101 #Custom_preset_data: 02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 32 10 17 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00 ``` -------------------------------- ### BinRAW File Data Example Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/file_formats/SubGhzFileFormats.md Example data from a BinRAW file, showing protocol, bit length, quantization interval, and encoded raw data. Data_RAW is a sequence of bits representing high/low levels over the TE interval. ```text Protocol: BinRAW Bit: 1572 TE: 597 Bit_RAW: 260 Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 4A B5 55 4C B3 52 AC D5 2D 53 52 AD 4A D5 35 00 Bit_RAW: 263 Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 04 D5 32 D2 AB 2B 33 32 CB 2C CC B3 52 D3 00 Bit_RAW: 259 Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 4A AB 55 34 D5 2D 4C CD 33 4A CD 55 4C D2 B3 00 Bit_RAW: 263 Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 7F 4A AA D5 2A CC B2 B4 CB 34 CC AA AB 4D 53 53 00 Bit_RAW: 264 Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FC 00 00 15 2C CB 34 D3 35 35 4D 4B 32 B2 D3 33 00 Bit_RAW: 263 Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 DE 02 D3 54 D5 4C D2 CC AD 4B 2C B2 B5 54 CC AB 00 ``` -------------------------------- ### fsInfo() Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_storage.md Fetches generic information about a filesystem. ```APIDOC ## fsInfo() ### Description Fetches generic information about a filesystem. ### Parameters - filesystem (string) - Required - The path to the filesystem (e.g. `"/ext"` or `"/int"`) ### Returns - object | undefined - A `fsInfo` structure or `undefined` on failure. ### Example ```js let fsinfo = storage.fsInfo("/ext"); if (fsinfo === undefined) { print("Filesystem access error"); } else { print("Free space on the /ext filesystem:", fsinfo.freeSpace); } ``` ``` -------------------------------- ### Importing Tag Configuration on FlipperZero Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/applications/system/find_my_flipper/README.md Instructions for importing tag data into the Find My Flipper app on the FlipperZero, either from a file or manually. ```text AppsData/FindMyFlipper ``` -------------------------------- ### File.tell() Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_storage.md Gets the current absolute position of the read/write pointer in bytes. ```APIDOC ## File.tell() ### Description Gets the absolute position of the R/W pointer in bytes. ### Method File.tell() ### Response #### Success Response - **number** - The absolute current position in the file. ``` -------------------------------- ### Get File Size Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_storage.md Retrieves the total size of the file in bytes. ```javascript let size = file.size(); ``` -------------------------------- ### Get Device Model Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_flipper.md Retrieve the model name of the Flipper device. ```javascript flipper.getModel(); // "Flipper Zero" ``` -------------------------------- ### Initialize Submodules Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/HowToBuild.md Ensure all submodules are initialized, which is crucial if the repository was not cloned with the --recursive flag. ```shell git submodule update --init --recursive ``` -------------------------------- ### Get Current File Position Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_storage.md Returns the absolute position of the read/write pointer in bytes. ```javascript let position = file.tell(); ``` -------------------------------- ### Get Battery Charge Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_flipper.md Retrieve the current battery charge percentage of the Flipper device. ```javascript flipper.getBatteryCharge(); // 100 ``` -------------------------------- ### Get Device Name Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/js/js_flipper.md Retrieve the name assigned to the virtual dolphin on the Flipper device. ```javascript flipper.getName(); // "Fur1pp44" ``` -------------------------------- ### Compile Plugin and Run on Flipper Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/HowToBuild.md Compile a specific user plugin and launch it on a connected Flipper device. Ensure COMPACT and DEBUG flags are set as needed. ```shell ./fbt COMPACT=1 DEBUG=0 launch_app APPSRC=applications_user/yourplugin ``` -------------------------------- ### Deploy VSCode Configuration Source: https://github.com/darkflippers/unleashed-firmware/blob/dev/documentation/fbt.md Deploys the initial environment configuration for VS Code. Supports specifying alternative language servers. ```bash ./fbt vscode_dist ``` ```bash ./fbt vscode_dist LANG_SERVER= ```