diff --git a/.ci_files/anims_ofw.txt b/.ci_files/anims_ofw.txt
index 2fc22ec8c..187cc2c02 100644
--- a/.ci_files/anims_ofw.txt
+++ b/.ci_files/anims_ofw.txt
@@ -161,3 +161,10 @@ Max butthurt: 5
Min level: 1
Max level: 3
Weight: 4
+
+Name: L1_Sad_song_128x64
+Min butthurt: 8
+Max butthurt: 13
+Min level: 1
+Max level: 3
+Weight: 4
diff --git a/.ci_files/rgb.patch b/.ci_files/rgb.patch
index b5141abb9..afd239160 100644
--- a/.ci_files/rgb.patch
+++ b/.ci_files/rgb.patch
@@ -102,8 +102,8 @@ index 0000000..269b544
+ .settings_is_loaded = false};
+
+static const RGBBacklightColor colors[] = {
-+ {"Orange", 255, 79, 0},
-+ {"Yellow", 255, 170, 0},
++ {"Orange", 255, 60, 0},
++ {"Yellow", 255, 150, 0},
+ {"Spring", 167, 255, 0},
+ {"Lime", 0, 255, 0},
+ {"Aqua", 0, 255, 127},
@@ -114,7 +114,7 @@ index 0000000..269b544
+ {"Magenta", 210, 0, 210},
+ {"Pink", 255, 0, 127},
+ {"Red", 255, 0, 0},
-+ {"White", 140, 140, 140},
++ {"White", 150, 150, 110},
+};
+
+uint8_t rgb_backlight_get_color_count(void) {
diff --git a/.drone.yml b/.drone.yml
index 959534e28..35d2ce2ec 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -15,16 +15,38 @@ steps:
- git submodule foreach git config --local gc.auto 0
- git log -1 --format='%H'
- - name: "Build firmware"
+ - name: "Build clean"
+ image: hfdj/fztools
+ pull: never
+ commands:
+ - export DIST_SUFFIX=${DRONE_TAG}c
+ - export WORKFLOW_BRANCH_OR_TAG=release-cfw
+ - export FORCE_NO_DIRTY=yes
+ - rm -rf assets/resources/apps/
+ - rm -rf build/
+ - rm -rf dist/
+ - rm -rf .sconsign.dblite
+ - ./fbt COMPACT=1 DEBUG=0 updater_package
+ - mkdir artifacts-clean
+ - mv dist/f7-C/* artifacts-clean/
+ - ls -laS artifacts-clean
+ - ls -laS artifacts-clean/f7-update-${DRONE_TAG}c
+ environment:
+ FBT_TOOLS_CUSTOM_LINK:
+ from_secret: fbt_link
+
+ - name: "Build default"
image: hfdj/fztools
pull: never
commands:
- export DIST_SUFFIX=${DRONE_TAG}
- export WORKFLOW_BRANCH_OR_TAG=release-cfw
- - rm -rf assets/resources/apps/
- - rm -rf build/
- - rm -rf dist/
- - rm -rf .sconsign.dblite
+ - export FORCE_NO_DIRTY=yes
+ - wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
+ - tar zxvf all-the-apps-base.tgz
+ - cp -R base_pack_build/artifacts-base/* assets/resources/apps/
+ - rm -rf base_pack_build
+ - rm -rf all-the-apps-base.tgz
- ./fbt COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-default
- mv dist/f7-C/* artifacts-default/
@@ -38,9 +60,10 @@ steps:
image: hfdj/fztools
pull: never
commands:
- - git clone https://github.com/xMasterX/all-the-plugins.git
- - cp -R all-the-plugins/apps/* assets/resources/apps/
- - rm -rf all-the-plugins
+ - wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-extra.tgz
+ - tar zxvf all-the-apps-extra.tgz
+ - cp -R extra_pack_build/artifacts-extra/* assets/resources/apps/
+ - rm -rf extra_pack_build
- export DIST_SUFFIX=${DRONE_TAG}e
- export WORKFLOW_BRANCH_OR_TAG=release-cfw
- export FORCE_NO_DIRTY=yes
@@ -86,6 +109,13 @@ steps:
- export FORCE_NO_DIRTY=yes
- rm -f build/f7-firmware-C/toolbox/version.*
- ./fbt COMPACT=1 DEBUG=0 updater_package
+ - wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
+ - tar zxvf all-the-apps-base.tgz
+ - cp -R base_pack_build/artifacts-base/* assets/resources/apps/
+ - rm -rf base_pack_build
+ - rm -rf all-the-apps-base.tgz
+ - rm -f build/f7-firmware-C/toolbox/version.*
+ - ./fbt COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-ofw-anims
- mv dist/f7-C/* artifacts-ofw-anims/
- ls -laS artifacts-ofw-anims
@@ -93,6 +123,8 @@ steps:
- sed -i 's/(version)/'${DRONE_TAG}'/g' CHANGELOG.md
- echo '# [Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/fw/${DRONE_TAG}/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=release-cfw&version='${DRONE_TAG}')' >> CHANGELOG.md
- echo '' >> CHANGELOG.md
+ - echo '### [Version with only main apps - Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'c.tgz&channel=release-cfw&version='${DRONE_TAG}'c)' >> CHANGELOG.md
+ - echo '' >> CHANGELOG.md
- echo '### [Version without custom animations - Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-'${DRONE_TAG}'n.tgz&channel=release-cfw&version='${DRONE_TAG}'n)' >> CHANGELOG.md
- echo '' >> CHANGELOG.md
- echo '### [Version with RGB patch - only for hardware mod! - Install via Web Updater](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'r.tgz&channel=release-cfw&version='${DRONE_TAG}'r)' >> CHANGELOG.md
@@ -107,19 +139,23 @@ steps:
commands:
- cp artifacts-extra-apps/flipper-z-f7-update-${DRONE_TAG}e.tgz .
- cp artifacts-rgb-patch/flipper-z-f7-update-${DRONE_TAG}r.tgz .
+ - cp artifacts-clean/flipper-z-f7-update-${DRONE_TAG}c.tgz .
- cp artifacts-ofw-anims/flipper-z-f7-update-${DRONE_TAG}n.tgz .
- cp artifacts-default/flipper-z-f7-update-${DRONE_TAG}.tgz .
- zip -r artifacts-extra-apps/flipper-z-f7-update-${DRONE_TAG}e.zip artifacts-extra-apps/f7-update-${DRONE_TAG}e
- zip -r artifacts-rgb-patch/flipper-z-f7-update-${DRONE_TAG}r.zip artifacts-rgb-patch/f7-update-${DRONE_TAG}r
+ - zip -r artifacts-clean/flipper-z-f7-update-${DRONE_TAG}c.zip artifacts-clean/f7-update-${DRONE_TAG}c
- zip -r artifacts-ofw-anims/flipper-z-f7-update-${DRONE_TAG}n.zip artifacts-ofw-anims/f7-update-${DRONE_TAG}n
- zip -r artifacts-default/flipper-z-f7-update-${DRONE_TAG}.zip artifacts-default/f7-update-${DRONE_TAG}
- tar czpf artifacts-default/flipper-z-any-scripts-${DRONE_TAG}.tgz scripts
- rm -rf artifacts-extra-apps/f7-update-${DRONE_TAG}
- rm -rf artifacts-rgb-patch/f7-update-${DRONE_TAG}
+ - rm -rf artifacts-clean/f7-update-${DRONE_TAG}
- rm -rf artifacts-ofw-anims/f7-update-${DRONE_TAG}
- rm -rf artifacts-default/f7-update-${DRONE_TAG}
- ls -laS artifacts-extra-apps
- ls -laS artifacts-rgb-patch
+ - ls -laS artifacts-clean
- ls -laS artifacts-ofw-anims
- ls -laS artifacts-default
- mv artifacts-default/ ${DRONE_TAG}
@@ -191,6 +227,21 @@ steps:
from_secret: dep_target_extra
source: flipper-z-f7-update-${DRONE_TAG}r.tgz
+ - name: "Upload clean version to updates srv"
+ image: appleboy/drone-scp:linux-amd64
+ settings:
+ host:
+ from_secret: dep_host
+ username:
+ from_secret: dep_user
+ password:
+ from_secret: dep_passwd
+ port:
+ from_secret: dep_port
+ target:
+ from_secret: dep_target_extra
+ source: flipper-z-f7-update-${DRONE_TAG}c.tgz
+
- name: "Do Github release"
image: ddplugins/github-release
pull: never
@@ -206,6 +257,7 @@ steps:
- artifacts-ofw-anims/*.tgz
- artifacts-extra-apps/*.tgz
- artifacts-rgb-patch/*.tgz
+ - artifacts-clean/*.tgz
title: ${DRONE_TAG}
note: CHANGELOG.md
checksum:
@@ -247,12 +299,15 @@ steps:
[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)
- [-Download latest extra apps pack-](https://github.com/xMasterX/all-the-plugins/archive/refs/heads/main.zip)
+ [-Download latest extra apps pack-](https://github.com/xMasterX/all-the-plugins/releases/latest)
[-Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/${DRONE_TAG}/flipper-z-f7-update-${DRONE_TAG}.tgz&channel=release-cfw&version=${DRONE_TAG})
+ [-Version with only main apps - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-${DRONE_TAG}c.tgz&channel=release-cfw&version=${DRONE_TAG}c)
+
+
[-Version without custom animations - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-${DRONE_TAG}n.tgz&channel=release-cfw&version=${DRONE_TAG}n)
@@ -275,7 +330,19 @@ steps:
commands:
- wget "https://raw.githubusercontent.com/fieu/discord.sh/e1dc1a7595efad2cad8f072f0b3531c470f5b7c8/discord.sh"
- chmod +x ./discord.sh
- - ./discord.sh --text 'New Unleashed firmware released!\n\nVersion - '${DRONE_TAG}'\n\n[-> Sponsor our project](https://boosty.to/mmxdev)\n\n[[Github - Changelog]](https://github.com/DarkFlippers/unleashed-firmware/releases/tag/'${DRONE_TAG}')\n\n[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)\n\n[-Download latest extra apps pack-](https://github.com/xMasterX/all-the-plugins/archive/refs/heads/main.zip)\n\n[-Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/'${DRONE_TAG}'/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=release-cfw&version='${DRONE_TAG}')\n\n[-Version without custom animations - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-'${DRONE_TAG}'n.tgz&channel=release-cfw&version='${DRONE_TAG}'n)\n\n[-Version with RGB patch - only for hardware mod! - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'r.tgz&channel=release-cfw&version='${DRONE_TAG}'r)\n\n[-Version with RGB patch - only for hardware mod! - Direct download-](https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'r.tgz)\n\n[-Version with Extra apps - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'e.tgz&channel=release-cfw&version='${DRONE_TAG}'e)'
+ - ./discord.sh --text 'New Unleashed firmware released!\n\nVersion - '${DRONE_TAG}'\n\n[-> Sponsor our project](https://boosty.to/mmxdev)\n\n[[Github - Changelog]](https://github.com/DarkFlippers/unleashed-firmware/releases/tag/'${DRONE_TAG}')\n\n[-How to install firmware-](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/HowToInstall.md)\n\n[-Download latest extra apps pack-](https://github.com/xMasterX/all-the-plugins/releases/latest)\n\n[-Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/'${DRONE_TAG}'/flipper-z-f7-update-'${DRONE_TAG}'.tgz&channel=release-cfw&version='${DRONE_TAG}')\n\n[-Version with only main apps - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'c.tgz&channel=release-cfw&version='${DRONE_TAG}'c)\n\n[-Version without custom animations - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_no_anim/flipper-z-f7-update-'${DRONE_TAG}'n.tgz&channel=release-cfw&version='${DRONE_TAG}'n)\n\n[-Version with RGB patch - only for hardware mod! - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'r.tgz&channel=release-cfw&version='${DRONE_TAG}'r)\n\n[-Version with RGB patch - only for hardware mod! - Direct download-](https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'r.tgz)\n\n[-Version with Extra apps - Install FW via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_TAG}'e.tgz&channel=release-cfw&version='${DRONE_TAG}'e)'
+
+ - name: "Send clean build to telegram"
+ image: appleboy/drone-telegram
+ settings:
+ token:
+ from_secret: tgtoken
+ to:
+ from_secret: tgid
+ format: markdown
+ message: "Build with only main apps:"
+ document:
+ - flipper-z-f7-update-${DRONE_TAG}c.tgz
- name: "Send extra pack build to telegram"
image: appleboy/drone-telegram
@@ -314,16 +381,39 @@ steps:
- git submodule foreach git config --local gc.auto 0
- git log -1 --format='%H'
- - name: "Build dev FW"
+ - name: "Build dev clean"
+ image: hfdj/fztools
+ pull: never
+ commands:
+ - export DIST_SUFFIX=${DRONE_BUILD_NUMBER}c
+ - export WORKFLOW_BRANCH_OR_TAG=dev-cfw
+ - export FORCE_NO_DIRTY=yes
+ - rm -rf assets/resources/apps/
+ - rm -rf build/
+ - rm -rf dist/
+ - rm -rf .sconsign.dblite
+ - ./fbt COMPACT=1 DEBUG=0 updater_package
+ - mkdir artifacts-clean
+ - mv dist/f7-C/* artifacts-clean/
+ - ls -laS artifacts-clean
+ - ls -laS artifacts-clean/f7-update-${DRONE_BUILD_NUMBER}c
+ environment:
+ FBT_TOOLS_CUSTOM_LINK:
+ from_secret: fbt_link
+
+
+ - name: "Build dev default"
image: hfdj/fztools
pull: never
commands:
- export DIST_SUFFIX=${DRONE_BUILD_NUMBER}
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- - rm -rf assets/resources/apps/
- - rm -rf build/
- - rm -rf dist/
- - rm -rf .sconsign.dblite
+ - export FORCE_NO_DIRTY=yes
+ - wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-base.tgz
+ - tar zxvf all-the-apps-base.tgz
+ - cp -R base_pack_build/artifacts-base/* assets/resources/apps/
+ - rm -rf base_pack_build
+ - rm -rf all-the-apps-base.tgz
- ./fbt COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-default
- mv dist/f7-C/* artifacts-default/
@@ -337,9 +427,10 @@ steps:
image: hfdj/fztools
pull: never
commands:
- - git clone --branch dev https://github.com/xMasterX/all-the-plugins.git
- - cp -R all-the-plugins/apps/* assets/resources/apps/
- - rm -rf all-the-plugins
+ - wget https://github.com/xMasterX/all-the-plugins/releases/latest/download/all-the-apps-extra.tgz
+ - tar zxvf all-the-apps-extra.tgz
+ - cp -R extra_pack_build/artifacts-extra/* assets/resources/apps/
+ - rm -rf extra_pack_build
- export DIST_SUFFIX=${DRONE_BUILD_NUMBER}e
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- export FORCE_NO_DIRTY=yes
@@ -376,6 +467,7 @@ steps:
commands:
- cp artifacts-extra-apps/flipper-z-f7-update-${DRONE_BUILD_NUMBER}e.tgz .
- cp artifacts-rgb-patch/flipper-z-f7-update-${DRONE_BUILD_NUMBER}r.tgz .
+ - cp artifacts-clean/flipper-z-f7-update-${DRONE_BUILD_NUMBER}c.tgz .
- cp artifacts-default/flipper-z-f7-update-${DRONE_BUILD_NUMBER}.tgz .
- rm -rf artifacts-default/f7-update-${DRONE_BUILD_NUMBER}
- ls -laS artifacts-default
@@ -448,6 +540,21 @@ steps:
from_secret: dep_target_extra
source: flipper-z-f7-update-${DRONE_BUILD_NUMBER}r.tgz
+ - name: "Upload clean version to updates srv"
+ image: appleboy/drone-scp:linux-amd64
+ settings:
+ host:
+ from_secret: dep_host
+ username:
+ from_secret: dep_user
+ password:
+ from_secret: dep_passwd
+ port:
+ from_secret: dep_port
+ target:
+ from_secret: dep_target_extra
+ source: flipper-z-f7-update-${DRONE_BUILD_NUMBER}c.tgz
+
- name: "Trigger update server reindex"
image: hfdj/fztools
pull: never
@@ -482,6 +589,9 @@ steps:
[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/dev/flipper-z-f7-update-${DRONE_BUILD_NUMBER}.tgz&channel=dev-cfw&version=${DRONE_BUILD_NUMBER})
+ [-Version with only main apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-${DRONE_BUILD_NUMBER}c.tgz&channel=dev-cfw&version=${DRONE_BUILD_NUMBER}c)
+
+
[-Version with RGB patch - only for hardware mod! - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-${DRONE_BUILD_NUMBER}r.tgz&channel=dev-cfw&version=${DRONE_BUILD_NUMBER}r)
@@ -502,6 +612,18 @@ steps:
document:
- dev/flipper-z-f7-update-${DRONE_BUILD_NUMBER}.tgz
+ - name: "Send clean build to telegram"
+ image: appleboy/drone-telegram
+ settings:
+ token:
+ from_secret: tgtoken
+ to:
+ from_secret: tgid_dev
+ format: markdown
+ message: "Clean (Main apps only) Build:"
+ document:
+ - flipper-z-f7-update-${DRONE_BUILD_NUMBER}c.tgz
+
- name: "Send extra pack build to telegram"
image: appleboy/drone-telegram
settings:
@@ -523,7 +645,7 @@ steps:
commands:
- wget "https://raw.githubusercontent.com/fieu/discord.sh/e1dc1a7595efad2cad8f072f0b3531c470f5b7c8/discord.sh"
- chmod +x ./discord.sh
- - ./discord.sh --text 'Unleashed firmware dev build successful!\n\nBuild - '${DRONE_BUILD_NUMBER}'\n\nCommit - https://github.com/DarkFlippers/unleashed-firmware/commit/'${DRONE_COMMIT_SHA}'\n\n[-> Sponsor our project](https://boosty.to/mmxdev)\n\n[-Version with Extra apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'e.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'e)\n\n[-Version with RGB patch - only for hardware mod! - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'r.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'r)\n\n[-Version with RGB patch - only for hardware mod! - Direct download-](https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'r.tgz)\n\n[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/dev/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}')'
+ - ./discord.sh --text 'Unleashed firmware dev build successful!\n\nBuild - '${DRONE_BUILD_NUMBER}'\n\nCommit - https://github.com/DarkFlippers/unleashed-firmware/commit/'${DRONE_COMMIT_SHA}'\n\n[-> Sponsor our project](https://boosty.to/mmxdev)\n\n[-Version with Extra apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'e.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'e)\n\n[-Version with only main apps - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'c.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'c)\n\n[-Version with RGB patch - only for hardware mod! - Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'r.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}'r)\n\n[-Version with RGB patch - only for hardware mod! - Direct download-](https://unleashedflip.com/fw_extra_apps/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'r.tgz)\n\n[-Install via Web Updater-](https://lab.flipper.net/?url=https://unleashedflip.com/fw/dev/flipper-z-f7-update-'${DRONE_BUILD_NUMBER}'.tgz&channel=dev-cfw&version='${DRONE_BUILD_NUMBER}')'
trigger:
branch:
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 9187b0748..9a8722cc5 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,3 +1,4 @@
+patreon: mmxdev
custom:
[
"https://boosty.to/mmxdev",
diff --git a/.gitignore b/.gitignore
index 35e5cf2b5..fb6d6b704 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,6 +51,7 @@ null.d
/artifacts-ofw-anims
/artifacts-rgb-patch
/artifacts-extra-apps
+/artifacts-clean
# SCons build dir
/build
diff --git a/.gitmodules b/.gitmodules
index 331177e26..52cf4a207 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,6 +10,7 @@
[submodule "assets/protobuf"]
path = assets/protobuf
url = https://github.com/flipperdevices/flipperzero-protobuf.git
+ shallow = false
[submodule "lib/libusb_stm32"]
path = lib/libusb_stm32
url = https://github.com/flipperdevices/libusb_stm32.git
@@ -25,12 +26,6 @@
[submodule "lib/cxxheaderparser"]
path = lib/cxxheaderparser
url = https://github.com/robotpy/cxxheaderparser.git
-[submodule "applications/external/dap_link/lib/free-dap"]
- path = applications/external/dap_link/lib/free-dap
- url = https://github.com/ataradov/free-dap.git
-[submodule "applications/external/subbrute"]
- path = applications/external/subbrute
- url = https://github.com/DarkFlippers/flipperzero-subbrute.git
[submodule "lib/heatshrink"]
path = lib/heatshrink
url = https://github.com/flipperdevices/heatshrink.git
@@ -43,6 +38,3 @@
[submodule "lib/stm32wb_copro"]
path = lib/stm32wb_copro
url = https://github.com/flipperdevices/stm32wb_copro.git
-[submodule "applications/external/multi_fuzzer"]
- path = applications/external/multi_fuzzer
- url = https://github.com/DarkFlippers/Multi_Fuzzer.git
diff --git a/.pvsoptions b/.pvsoptions
index b25d4633e..2e0b2fb8d 100644
--- a/.pvsoptions
+++ b/.pvsoptions
@@ -1 +1 @@
---ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/cmsis_core -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/stm32wb_cmsis -e lib/stm32wb_copro -e lib/stm32wb_hal -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/* -e applications/external/dap_link/lib/free-dap
+--ignore-ccache -C gccarm --rules-config .pvsconfig -e lib/cmsis_core -e lib/fatfs -e lib/fnv1a-hash -e lib/FreeRTOS-Kernel -e lib/heatshrink -e lib/libusb_stm32 -e lib/littlefs -e lib/mbedtls -e lib/micro-ecc -e lib/microtar -e lib/mlib -e lib/qrcode -e lib/ST25RFAL002 -e lib/stm32wb_cmsis -e lib/stm32wb_copro -e lib/stm32wb_hal -e lib/u8g2 -e lib/nanopb -e */arm-none-eabi/*
diff --git a/.vscode/.gitignore b/.vscode/.gitignore
index 670df7d48..481efcdef 100644
--- a/.vscode/.gitignore
+++ b/.vscode/.gitignore
@@ -1,4 +1,5 @@
-./c_cpp_properties.json
-./launch.json
-./settings.json
-./tasks.json
+/c_cpp_properties.json
+/extensions.json
+/launch.json
+/settings.json
+/tasks.json
diff --git a/.vscode/example/clangd/extensions.json b/.vscode/example/clangd/extensions.json
new file mode 100644
index 000000000..daab417cd
--- /dev/null
+++ b/.vscode/example/clangd/extensions.json
@@ -0,0 +1,19 @@
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+ // List of extensions which should be recommended for users of this workspace.
+ "recommendations": [
+ "ms-python.black-formatter",
+ "llvm-vs-code-extensions.vscode-clangd",
+ "amiralizadeh9480.cpp-helper",
+ "marus25.cortex-debug",
+ "zxh404.vscode-proto3",
+ "augustocdias.tasks-shell-input"
+ ],
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
+ "unwantedRecommendations": [
+ "twxs.cmake",
+ "ms-vscode.cpptools",
+ "ms-vscode.cmake-tools"
+ ]
+}
diff --git a/.vscode/example/c_cpp_properties.json b/.vscode/example/cpptools/c_cpp_properties.json
similarity index 100%
rename from .vscode/example/c_cpp_properties.json
rename to .vscode/example/cpptools/c_cpp_properties.json
diff --git a/.vscode/extensions.json b/.vscode/example/cpptools/extensions.json
similarity index 93%
rename from .vscode/extensions.json
rename to .vscode/example/cpptools/extensions.json
index ead935b08..a8babee1c 100644
--- a/.vscode/extensions.json
+++ b/.vscode/example/cpptools/extensions.json
@@ -13,6 +13,7 @@
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
+ "llvm-vs-code-extensions.vscode-clangd",
"twxs.cmake",
"ms-vscode.cmake-tools"
]
diff --git a/.vscode/example/settings.json b/.vscode/example/settings.json
index 19a03b69d..efa08157b 100644
--- a/.vscode/example/settings.json
+++ b/.vscode/example/settings.json
@@ -21,5 +21,10 @@
"SConscript": "python",
"SConstruct": "python",
"*.fam": "python",
- }
-}
+ },
+ "clangd.arguments": [
+ // We might be able to tighten this a bit more to only include the correct toolchain.
+ "--query-driver=**",
+ "--compile-commands-dir=${workspaceFolder}/build/latest"
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/example/tasks.json b/.vscode/example/tasks.json
index 1d2b55a2c..9861afa1e 100644
--- a/.vscode/example/tasks.json
+++ b/.vscode/example/tasks.json
@@ -28,29 +28,17 @@
"command": "./fbt -c"
},
{
- "label": "[Release] Flash (ST-Link)",
+ "label": "[Release] Flash (SWD)",
"group": "build",
"type": "shell",
"command": "./fbt COMPACT=1 DEBUG=0 FORCE=1 flash"
},
{
- "label": "[Debug] Flash (ST-Link)",
+ "label": "[Debug] Flash (SWD)",
"group": "build",
"type": "shell",
"command": "./fbt FORCE=1 flash"
},
- {
- "label": "[Release] Flash (blackmagic)",
- "group": "build",
- "type": "shell",
- "command": "./fbt COMPACT=1 DEBUG=0 FORCE=1 flash_blackmagic"
- },
- {
- "label": "[Debug] Flash (blackmagic)",
- "group": "build",
- "type": "shell",
- "command": "./fbt FORCE=1 flash_blackmagic"
- },
{
"label": "[Release] Flash (JLink)",
"group": "build",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23a516f08..14c20e5d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,25 +1,11 @@
## New changes
-* SubGHz: Support for Ebyte E07 module power amp switch (works with TehRabbitt's Flux Capacitor Board) (by @Sil333033) (PR #559 by @Z3BRO) -> Remade by @xMasterX -> Driver code fixed and reworked by @gid9798
-* Infrared: Update universal remote assets (by @amec0e | PR #570)
-* Infrared: Update universal AC asset (by @Leptopt1los | PR #569)
-* Plugins: Add * in NFC Maker keyboard (hold `.`)
-* Plugins: Update TOTP (Authenticator) [(by akopachov)](https://github.com/akopachov/flipper-zero_authenticator)
-* Plugins: Update ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-wifi-marauder)
-* Plugins: Update ESP32-CAM -> Camera Suite [(by CodyTolene)](https://github.com/CodyTolene/Flipper-Zero-Camera-Suite) -> (PR #562 by @CodyTolene)
-* OFW PR 2949: IR: buttons move feature rework (by nminaylov)
-* OFW PR 2941: FDX-B temperature now uses system units (by Astrrra)
-* OFW: fbtenv: add additional environ variable to control execution flow
-* OFW: NFC CLI: Fix multiple apdu commands from not working when one of them gives an empty response
-* OFW: NFC: Fix MFC key invalidation
-* OFW: Rename Applications to Apps
-* OFW: Fix about screen
-* OFW: change FuriThreadPriorityIsr to 31 (configMAX_PRIORITIES-1)
-* OFW: External apps icounter
-* OFW: Overly missed feature: Infrared: move button (change button order in a remote)
-* OFW: Move U2F path to ext
-* OFW: New RTC flags in device info
-* OFW: Backlight notification fix
-* OFW: Fix fbtenv restore
+* !!! **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** !!!
+* Desktop: **New way to set favourite apps and fully configurable dummy mode** (now you can set up to 4 favourite apps!) (port of OFW PR 2972 by nminaylov) (by @gid9798 | PR #578)
+* Desktop: Fix lock timer after rebooting (by @gid9798 | PR #578)
+* Infrared: Updated universal assets (by @amec0e | PR #581)
+* Core: Added proper error message on out of memory crash (by @Willy-JL)
+* SubGHz: Fix FAAC SLH add manually issues and fix sending signals with unknown seed
+* SubGHz: Temporarily reverted changes from OFW PR 2984: SubGhz: fix todo (by Skorpionm) - Fixes Enhanced Sub-GHz Chat app and various issues related to receiving signals that was found in 061 release
----
@@ -28,17 +14,20 @@
[-> Download qFlipper (official link)](https://flipperzero.one/update)
## Please support development of the project
-* **Boosty** (patreon alternative): https://boosty.to/mmxdev
-* cloudtips (only RU payments accepted): https://pay.cloudtips.ru/p/7b3e9d65
-* YooMoney (only RU payments accepted): https://yoomoney.ru/fundraise/XA49mgQLPA0.221209
-* USDT(TRC20): `TSXcitMSnWXUFqiUfEXrTVpVewXy2cYhrs`
-* BCH: `qquxfyzntuqufy2dx0hrfr4sndp0tucvky4sw8qyu3`
-* ETH/BSC/ERC20-Tokens: `darkflippers.eth` (or `0xFebF1bBc8229418FF2408C07AF6Afa49152fEc6a`)
-* BTC: `bc1q0np836jk9jwr4dd7p6qv66d04vamtqkxrecck9`
-* DOGE: `D6R6gYgBn5LwTNmPyvAQR6bZ9EtGgFCpvv`
-* LTC: `ltc1q3ex4ejkl0xpx3znwrmth4lyuadr5qgv8tmq8z9`
-* XMR (Monero): `41xUz92suUu1u5Mu4qkrcs52gtfpu9rnZRdBpCJ244KRHf6xXSvVFevdf2cnjS7RAeYr5hn9MsEfxKoFDRSctFjG5fv1Mhn`
-* TON: `EQCOqcnYkvzOZUV_9bPE_8oTbOrOF03MnF-VcJyjisTZmpGf`
+|Service|Remark|Link/Wallet|
+|-|-|-|
+|**Patreon**||https://patreon.com/mmxdev|
+|**Boosty**|patreon alternative|https://boosty.to/mmxdev|
+|cloudtips|only RU payments accepted|https://pay.cloudtips.ru/p/7b3e9d65|
+|YooMoney|only RU payments accepted|https://yoomoney.ru/fundraise/XA49mgQLPA0.221209|
+|USDT|(TRC20)|`TSXcitMSnWXUFqiUfEXrTVpVewXy2cYhrs`|
+|BCH||`qquxfyzntuqufy2dx0hrfr4sndp0tucvky4sw8qyu3`|
+|ETH|(BSC/ERC20-Tokens)|`darkflippers.eth` (or `0xFebF1bBc8229418FF2408C07AF6Afa49152fEc6a`)|
+|BTC||`bc1q0np836jk9jwr4dd7p6qv66d04vamtqkxrecck9`|
+|DOGE||`D6R6gYgBn5LwTNmPyvAQR6bZ9EtGgFCpvv`|
+|LTC||`ltc1q3ex4ejkl0xpx3znwrmth4lyuadr5qgv8tmq8z9`|
+|XMR|(Monero)| `41xUz92suUu1u5Mu4qkrcs52gtfpu9rnZRdBpCJ244KRHf6xXSvVFevdf2cnjS7RAeYr5hn9MsEfxKoFDRSctFjG5fv1Mhn`|
+|TON||`EQCOqcnYkvzOZUV_9bPE_8oTbOrOF03MnF-VcJyjisTZmpGf`|
#### Thanks to our sponsors:
callmezimbra, Quen0n, MERRON, grvpvl (lvpvrg), art_col, ThurstonWaffles, Moneron, UterGrooll, LUCFER, Northpirate, zloepuzo, T.Rat, Alexey B., ionelife, ...
@@ -47,15 +36,21 @@ and all other great people who supported our project and me (xMasterX), thanks t
## **Recommended update option - Web Updater**
-### What `n`, `r`, `e` means? What I need to download if I don't want to use Web updater?
-What build I should download and what this name means - `flipper-z-f7-update-(version)(n / r / e).tgz` ?
+### What `n`, `r`, `e`, ` `, `c` means? What I need to download if I don't want to use Web updater?
+What build I should download and what this name means - `flipper-z-f7-update-(version)(n / r / e / c).tgz` ?
`flipper-z` = for Flipper Zero device
`f7` = Hardware version - same for all flipper zero devices
`update` = Update package, contains updater, all assets (plugins, IR libs, etc.), and firmware itself
`(version)` = Firmware version
-`n` = this build comes without our custom animations (we have only 3 of them), only official flipper animations
-`e` = build has π² [extra apps pack](https://github.com/xMasterX/all-the-plugins) preinstalled
-`r` = RGB patch (+ extra apps) for flippers with rgb backlight mod (this is hardware mod!) (Works only on modded flippers!) (do not install on non modded device!)
+| Designation | 3 Custom Animation | [Base Apps](https://github.com/xMasterX/all-the-plugins#default-pack) | [Extra Apps](https://github.com/xMasterX/all-the-plugins#extra-pack) | β οΈRGB mode* |
+|-----|:---:|:---:|:---:|:---:|
+| ` ` | β
| β
| | |
+| `c` | β
| | | |
+| `n` | | β
| | |
+| `e` | β
| β
| β
| |
+| `r` | β
| β
| β
| β
|
+
+β οΈThis is [hardware mod](https://github.com/quen0n/flipperzero-firmware-rgb#readme), works only on modded flippers! do not install on non modded device!
Firmware Self-update package (update from microSD) - `flipper-z-f7-update-(version).tgz` for mobile app / qFlipper / web
Archive of `scripts` folder (contains scripts for FW/plugins development) - `flipper-z-any-scripts-(version).tgz`
diff --git a/ReadMe.md b/ReadMe.md
index 40c81c3ba..4e21dc3f9 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -3,6 +3,20 @@
+
### Welcome to the Flipper Zero Unleashed Firmware repo!
@@ -16,13 +30,7 @@
##### This software is for experimental purposes only and is not meant for any illegal activity/purposes. We do not condone illegal activity and strongly encourage keeping transmissions to legal/valid uses allowed by law. Also, this software is made without any support from Flipper Devices and is in no way related to the official devs.
-
-Our Discord Community:
-
-
-
-
## Dev builds (unstable)
@@ -32,43 +40,57 @@ Our Discord Community:
- https://t.me/unleashed_fw
# What's changed
-* Sub-GHz regional TX restrictions removed
-* Sub-GHz frequency range can be extended in settings file (Warning: It can damage Flipper's hardware)
-* Many rolling code protocols now have the ability to save & send captured signals
-* FAAC SLH (Spa) & BFT Mitto (keeloq secure with seed) manual creation
-* Sub-GHz static code brute-force plugin
-* LFRFID Fuzzer plugin
-* Custom community plugins and games added + all known working apps can be downloaded in extra pack in every release
-* Extra Sub-GHz frequencies + extra Mifare Classic keys
-* Picopass/iClass plugin included in releases
-* Recompiled IR TV Universal Remote for ALL buttons
-* 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
-- Sub-GHz -> New frequency analyzer - [(by ClusterM)](https://github.com/DarkFlippers/unleashed-firmware/pull/43)
-- Sub-GHz -> Save last used frequency [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
-- Sub-GHz -> Press OK in frequency analyzer to use detected frequency in Read modes [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
-- Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/79)
-- Lock device with pin(or regular lock if pin not set) by holding UP button on main screen [(by an4tur0r)](https://github.com/DarkFlippers/unleashed-firmware/pull/107)
-* Sub-GHz -> Short press OK in frequency analyzer to save detected frequency for usage in Read modes
-* Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu and automatically use selected frequency
-* SubGHz -> New option to use timestamps + protocol name when you saving file, instead of random name - Enable in `Radio Settings -> Time in names = ON`
-* SubGHz Bruteforcer plugin -> Time delay (between signals) setting (hold Up in main screen(says Up to Save)) + configure repeats in protocols list by pressing right button on selected protocol
-* SubGHz -> Read mode UI improvements (scrolling text, + shows time when signal was received) (by @wosk)
-* Sub-GHz -> External CC1101 module support (Hardware SPI used)
-* SubGHz -> **Hold right in received signal list to delete selected signal**
-* SubGHz -> **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S / Somfy Telis / Security+ 2.0 / CAME Atomo** - now you can use arrow buttons to send signal with different button code
-* SubGHz -> BFT Mitto / Somfy Telis / Nice Flor S / CAME Atomo, etc.. manual creation with programming new remote into receiver (use button 0xF for BFT Mitto, 0x8 (Prog) on Somfy Telis)
-* SubGHz -> Debug mode counter increase settings (+1 -> +5, +10, default: +1)
-* SubGHz -> Debug PIN output settings for protocol development
-* Infrared -> `RCA` Protocol
-* Infrared -> Debug TX PIN output settings
-* Other small fixes and changes throughout
-* See other changes in readme below
+- **Sub-GHz** *lib & hal*
+ - Regional TX restrictions removed
+ - Extra Sub-GHz frequencies
+ - Frequency range can be extended in settings file (Warning: It can damage Flipper's hardware)
+ - Many rolling code [protocols](https://github.com/DarkFlippers/unleashed-firmware#current-modified-and-new-sub-ghz-protocols-list) now have the ability to save & send captured signals
+ - FAAC SLH (Spa) & BFT Mitto (keeloq secure with seed) manual creation
+ - External CC1101 module support [(by quen0n)](https://github.com/DarkFlippers/unleashed-firmware/pull/307)
+- **Sub-GHz** *Main App*
+ - Save last used frequency [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
+ - New frequency analyzer [(by ClusterM)](https://github.com/DarkFlippers/unleashed-firmware/pull/43)
+ - Press OK in frequency analyzer to use detected frequency in Read modes [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
+ - Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/79)
+ - New option to use timestamps + protocol name when you saving file, instead of random name - Enable in `Radio Settings -> Time in names = ON`
+ - Read mode UI improvements (scrolling text, + shows time when signal was received) (by @wosk)
+ - External CC1101 module support (Hardware SPI used)
+ - **Hold right in received signal list to delete selected signal**
+ - **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S / Somfy Telis / Security+ 2.0 / CAME Atomo** - now you can use arrow buttons to send signal with different button code
+ - `Add manually` menu extended with new protocols
+ - BFT Mitto / Somfy Telis / Nice Flor S / CAME Atomo, etc.. manual creation with programming new remote into receiver (use button 0xF for BFT Mitto, 0x8 (Prog) on Somfy Telis)
+ - Debug mode counter increase settings (+1 -> +5, +10, default: +1)
+ - Debug PIN output settings for protocol development
+
+- **Sub-GHz apps** *by unleashed team*
+ - Sub-GHz Bruteforce - static code brute-force plugin |
+ - Time delay (between signals) setting (hold Up in main screen(says Up to Save)) + configure repeats in protocols list by pressing right button on selected protocol
+ - Load your own file and select bytes you want to bruteforce or use preconfigured options in protocols list
+ - Sub-GHz Remote - remote control for 5 sub-ghz files | bind one file for each button
+ - use the built-in constructor or make config file by following this [instruction](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemotePlugin.md)
+- **Infrared**
+ - Recompiled IR TV Universal Remote for ALL buttons
+ - Universal remotes for Projectors, Fans, A/Cs and Audio(soundbars, etc.) -> Also always updated and verified by our team
+ - Infrared -> `RCA` Protocol
+ - Infrared -> Debug TX PIN output settings
+- **NFC/RFID/iButton**
+ * LFRFID/iButton Fuzzer plugins
+ * Extra Mifare Classic keys
+ * `Add manually` -> Mifare Classic with custom UID
+ * Picopass/iClass plugin (now with emulation support!) included in releases
+- **Quality of life & other features**
+ - 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)
+ - Byte Input Mini editor -> **Press UP** multiple times until the nibble editor appears
+ - Clock on Desktop -> `Settings -> Desktop -> Show Clock`
+ - Battery percentage display with different styles `Settings -> Desktop -> Battery View`
+ - More games in Dummy Mode -> click or hold any of arrow buttons
+ - Lock device with pin(or regular lock if pin not set) by holding UP button on main screen [(by an4tur0r)](https://github.com/DarkFlippers/unleashed-firmware/pull/107)
+ - **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)
+ - Custom community plugins and games added + all known working apps can be downloaded in extra pack in every release
+ - Other small fixes and changes throughout
+ - See other changes in readme below
Also check the changelog in releases for latest updates!
@@ -124,71 +146,24 @@ Our team is small and the guys are working on this project as much as they can s
The amount of work done on this project is huge and we need your support, no matter how large or small. Even if you just say, "Thank you Unleashed firmware developers!" somewhere. Doing so will help us continue our work and will help drive us to make the firmware better every time.
Also, regarding our releases, every build has and always will be free and open-source. There will be no paywall releases or closed-source apps within the firmware. As long as I am working on this project it will never happen.
You can support us by using links or addresses below:
-* **Boosty** (patreon alternative): https://boosty.to/mmxdev
-* cloudtips (only RU payments accepted): https://pay.cloudtips.ru/p/7b3e9d65
-* YooMoney (only RU payments accepted): https://yoomoney.ru/fundraise/XA49mgQLPA0.221209
-* USDT(TRC20): `TSXcitMSnWXUFqiUfEXrTVpVewXy2cYhrs`
-* BCH: `qquxfyzntuqufy2dx0hrfr4sndp0tucvky4sw8qyu3`
-* ETH/BSC/ERC20-Tokens: `darkflippers.eth` (or `0xFebF1bBc8229418FF2408C07AF6Afa49152fEc6a`)
-* BTC: `bc1q0np836jk9jwr4dd7p6qv66d04vamtqkxrecck9`
-* DOGE: `D6R6gYgBn5LwTNmPyvAQR6bZ9EtGgFCpvv`
-* LTC: `ltc1q3ex4ejkl0xpx3znwrmth4lyuadr5qgv8tmq8z9`
-* XMR (Monero): `41xUz92suUu1u5Mu4qkrcs52gtfpu9rnZRdBpCJ244KRHf6xXSvVFevdf2cnjS7RAeYr5hn9MsEfxKoFDRSctFjG5fv1Mhn`
-* TON: `EQCOqcnYkvzOZUV_9bPE_8oTbOrOF03MnF-VcJyjisTZmpGf`
+|Service|Remark|Link/Wallet|
+|-|-|-|
+|**Patreon**||https://patreon.com/mmxdev|
+|**Boosty**|patreon alternative|https://boosty.to/mmxdev|
+|cloudtips|only RU payments accepted|https://pay.cloudtips.ru/p/7b3e9d65|
+|YooMoney|only RU payments accepted|https://yoomoney.ru/fundraise/XA49mgQLPA0.221209|
+|USDT|(TRC20)|`TSXcitMSnWXUFqiUfEXrTVpVewXy2cYhrs`|
+|BCH||`qquxfyzntuqufy2dx0hrfr4sndp0tucvky4sw8qyu3`|
+|ETH|(BSC/ERC20-Tokens)|`darkflippers.eth` (or `0xFebF1bBc8229418FF2408C07AF6Afa49152fEc6a`)|
+|BTC||`bc1q0np836jk9jwr4dd7p6qv66d04vamtqkxrecck9`|
+|DOGE||`D6R6gYgBn5LwTNmPyvAQR6bZ9EtGgFCpvv`|
+|LTC||`ltc1q3ex4ejkl0xpx3znwrmth4lyuadr5qgv8tmq8z9`|
+|XMR|(Monero)| `41xUz92suUu1u5Mu4qkrcs52gtfpu9rnZRdBpCJ244KRHf6xXSvVFevdf2cnjS7RAeYr5hn9MsEfxKoFDRSctFjG5fv1Mhn`|
+|TON||`EQCOqcnYkvzOZUV_9bPE_8oTbOrOF03MnF-VcJyjisTZmpGf`|
### Community apps included:
-- **RFID Fuzzer** [(by @gid9798)](https://github.com/DarkFlippers/Multi_Fuzzer) (original by Ganapati & xMasterX)
-- **iButton Fuzzer** [(by @gid9798)](https://github.com/DarkFlippers/Multi_Fuzzer) (original by xMasterX)
-- **Sub-GHz bruteforcer** [(by @derskythe & xMasterX)](https://github.com/derskythe/flipperzero-subbrute) [(original by Ganapati & xMasterX)](https://github.com/DarkFlippers/unleashed-firmware/pull/57)
-- **Sub-GHz playlist** [(by darmiel)](https://github.com/DarkFlippers/unleashed-firmware/pull/62)
-- ESP8266 Deauther plugin [(by SequoiaSan)](https://github.com/SequoiaSan/FlipperZero-Wifi-ESP8266-Deauther-Module)
-- WiFi Scanner plugin [(by SequoiaSan)](https://github.com/SequoiaSan/FlipperZero-WiFi-Scanner_Module)
-- MultiConverter plugin [(by theisolinearchip)](https://github.com/theisolinearchip/flipperzero_stuff)
-- WAV Player [(OFW: DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) - Fixed and improved by [LTVA1](https://github.com/LTVA1/wav_player) -> Also outputs audio on `PA6` - `3(A6)` pin
-- Barcode Generator [(by Kingal1337)](https://github.com/Kingal1337/flipper-barcode-generator)
-- GPIO: Sentry Safe plugin [(by H4ckd4ddy)](https://github.com/H4ckd4ddy/flipperzero-sentry-safe-plugin)
-- ESP32: WiFi Marauder companion plugin [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-wifi-marauder) - 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** [(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)
-- **TOTP (Authenticator)** [(by akopachov)](https://github.com/akopachov/flipper-zero_authenticator)
-- GPS [(by ezod)](https://github.com/ezod/flipperzero-gps) works with module `NMEA 0183` via UART (13TX, 14RX, GND pins on Flipper)
-- i2c Tools [(by NaejEL)](https://github.com/NaejEL/flipperzero-i2ctools) - C0 -> SCL / C1 -> SDA / GND -> GND | 3v3 logic levels only!
-- HC-SR04 Distance sensor - Ported and modified by @xMasterX [(original by Sanqui)](https://github.com/Sanqui/flipperzero-firmware/tree/hc_sr04) - How to connect -> (5V -> VCC) / (GND -> GND) / (13|TX -> Trig) / (14|RX -> Echo)
-- Morse Code [(by wh00hw)](https://github.com/wh00hw/MorseCodeFAP)
-- **Unitemp - Temperature sensors reader** (DHT11/22, DS18B20, BMP280, HTU21x and more) [(by quen0n)](https://github.com/quen0n/unitemp-flipperzero)
-- Lightmeter [(by oleksiikutuzov)](https://github.com/oleksiikutuzov/flipperzero-lightmeter)
-- HEX Viewer [(by QtRoS)](https://github.com/QtRoS/flipper-zero-hex-viewer)
-- POCSAG Pager [(by xMasterX & Shmuma)](https://github.com/xMasterX/flipper-pager)
-- Text Viewer [(by kowalski7cc & kyhwana)](https://github.com/kowalski7cc/flipper-zero-text-viewer/tree/refactor-text-app)
-- **UART Terminal** [(by cool4uma)](https://github.com/cool4uma/UART_Terminal/tree/main)
-- **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) (See in Applications->Tools) - (aka BadUSB via Bluetooth)
-- **Mifare Nested** [(by AloneLiberty)](https://github.com/AloneLiberty/FlipperNested) - Works with PC and python app `FlipperNested`
-- **NFC Maker** plugin (make tags with URLs, Wifi and other things) [(by Willy-JL)](https://github.com/ClaraCrazy/Flipper-Xtreme/tree/dev/applications/external/nfc_maker)
-- ESP32-CAM -> Camera Suite [(by CodyTolene)](https://github.com/CodyTolene/Flipper-Zero-Camera-Suite)
-
-Games:
-- DOOM (ported and fixed by @xMasterX & @Svarich & @hedger) [(original by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
-- Zombiez [(Reworked By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/240) [(Original By Dooskington)](https://github.com/Dooskington/flipperzero-zombiez)
-- Flappy Bird [(by DroomOne)](https://github.com/DroomOne/flipperzero-firmware/tree/dev/applications/flappy_bird)
-- Arkanoid (refactored by xMasterX) [(by gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins)
-- Tic Tac Toe (refactored by xMasterX) [(by gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins)
-- Tetris (with fixes) [(by jeffplang)](https://github.com/jeffplang/flipperzero-firmware/tree/tetris_game/applications/tetris_game)
-- Minesweeper [(by panki27)](https://github.com/panki27/minesweeper)
-- Heap Defence (aka Stack Attack) - Ported to latest firmware by @xMasterX - [(original by wquinoa & Vedmein)](https://github.com/Vedmein/flipperzero-firmware/tree/hd/svisto-perdelki)
-- Game15 [(by x27)](https://github.com/x27/flipperzero-game15)
-- Solitaire [(by teeebor)](https://github.com/teeebor/flipper_games)
-- BlackJack [(by teeebor)](https://github.com/teeebor/flipper_games)
-- 2048 game [(by eugene-kirzhanov)](https://github.com/eugene-kirzhanov/flipper-zero-2048-game)
-- Bomberduck [(by leo-need-more-coffee)](https://github.com/leo-need-more-coffee/flipperzero-bomberduck)
-- JetPack Joyride [(by timstrasser)](https://github.com/timstrasser)
+#### See full list and sources here: https://github.com/xMasterX/all-the-plugins/tree/dev
# Instructions
@@ -234,9 +209,9 @@ Games:
## [- How to use: Unitemp - Temperature sensors reader](https://github.com/quen0n/unitemp-flipperzero#readme)
-## [- How to use: [NMEA] GPS](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/applications/external/gps_nmea_uart/README.md)
+## [- How to use: [NMEA] GPS](https://github.com/xMasterX/all-the-plugins/blob/dev/base_pack/gps_nmea_uart/README.md)
-## [- How to use: i2c Tools](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/applications/external/flipper_i2ctools/README.md)
+## [- How to use: i2c Tools](https://github.com/xMasterX/all-the-plugins/blob/dev/base_pack/flipper_i2ctools/README.md)
## [- How to use: [NRF24] plugins](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/NRF24.md)
@@ -274,7 +249,7 @@ Games:
* CLion IDE - How to setup workspace for flipper firmware development: [https://krasovs.ky/2022/11/01/flipper-zero-clion.html](https://krasovs.ky/2022/11/01/flipper-zero-clion.html)
* Docs by atmanos / How to write your own app (outdated API): [https://flipper.atmanos.com/docs/overview/intro](https://flipper.atmanos.com/docs/overview/intro)
-* Official Docs: [http://docs.flipperzero.one](http://docs.flipperzero.one)
+* Official Docs: [docs.flipper.net](https://docs.flipper.net/)
* Official Forum: [forum.flipperzero.one](https://forum.flipperzero.one/)
# Project structure
diff --git a/SConstruct b/SConstruct
index 3ea360979..8d389b70b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -45,6 +45,7 @@ distenv = coreenv.Clone(
],
ENV=os.environ,
UPDATE_BUNDLE_DIR="dist/${DIST_DIR}/f${TARGET_HW}-update-${DIST_SUFFIX}",
+ VSCODE_LANG_SERVER=ARGUMENTS.get("LANG_SERVER", "cpptools"),
)
firmware_env = distenv.AddFwProject(
@@ -184,27 +185,15 @@ copro_dist = distenv.CoproBuilder(
distenv.AlwaysBuild(copro_dist)
distenv.Alias("copro_dist", copro_dist)
-firmware_flash = distenv.AddOpenOCDFlashTarget(firmware_env)
+
+firmware_flash = distenv.AddFwFlashTarget(firmware_env)
distenv.Alias("flash", firmware_flash)
+# To be implemented in fwflash.py
firmware_jflash = distenv.AddJFlashTarget(firmware_env)
distenv.Alias("jflash", firmware_jflash)
-firmware_bm_flash = distenv.PhonyTarget(
- "flash_blackmagic",
- "$GDB $GDBOPTS $SOURCES $GDBFLASH",
- source=firmware_env["FW_ELF"],
- GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}",
- GDBREMOTE="${BLACKMAGIC_ADDR}",
- GDBFLASH=[
- "-ex",
- "load",
- "-ex",
- "quit",
- ],
-)
-
-gdb_backtrace_all_threads = distenv.PhonyTarget(
+distenv.PhonyTarget(
"gdb_trace_all",
"$GDB $GDBOPTS $SOURCES $GDBFLASH",
source=firmware_env["FW_ELF"],
@@ -327,6 +316,9 @@ distenv.PhonyTarget(
"cli", "${PYTHON3} ${FBT_SCRIPT_DIR}/serial_cli.py -p ${FLIP_PORT}"
)
+# Update WiFi devboard firmware
+distenv.PhonyTarget("devboard_flash", "${PYTHON3} ${FBT_SCRIPT_DIR}/wifi_board.py")
+
# Find blackmagic probe
distenv.PhonyTarget(
@@ -345,7 +337,14 @@ distenv.PhonyTarget(
)
# Prepare vscode environment
-vscode_dist = distenv.Install("#.vscode", distenv.Glob("#.vscode/example/*"))
+VSCODE_LANG_SERVER = cmd_environment["LANG_SERVER"]
+vscode_dist = distenv.Install(
+ "#.vscode",
+ [
+ distenv.Glob("#.vscode/example/*.json"),
+ distenv.Glob(f"#.vscode/example/{VSCODE_LANG_SERVER}/*.json"),
+ ],
+)
distenv.Precious(vscode_dist)
distenv.NoClean(vscode_dist)
distenv.Alias("vscode_dist", vscode_dist)
diff --git a/applications/ReadMe.md b/applications/ReadMe.md
index 10e54ce22..de465832a 100644
--- a/applications/ReadMe.md
+++ b/applications/ReadMe.md
@@ -35,21 +35,6 @@ Applications for main Flipper menu.
- `u2f` - U2F Application
-## External
-
-External applications deployed to SD Card
-
-- `clock` - Clock application
-- `dap_link` - DAP Link OnChip debugger
-- `hid_app` - USB/BT Remote controller
-- `music_player` - Music player app (demo)
-- `nfc_magic` - NFC MFC Magic card application
-- `picopass` - Picopass reader / writer
-- `signal_generator` - Signal generator app: PWM and clock generator
-- `snake_game` - Snake game application
-- `spi_mem_manager` - SPI Memory reader / flasher
-- `weather_station` - SubGHz weather station
-
## services
Background services providing system APIs to applications.
diff --git a/applications/debug/accessor/helpers/wiegand.cpp b/applications/debug/accessor/helpers/wiegand.cpp
index 5cb3a85f5..10b284eaa 100644
--- a/applications/debug/accessor/helpers/wiegand.cpp
+++ b/applications/debug/accessor/helpers/wiegand.cpp
@@ -174,7 +174,7 @@ bool WIEGAND::DoWiegandConversion() {
return false;
}
- // TODO: Handle validation failure case!
+ // TODO FL-3490: Handle validation failure case!
} else if(4 == _bitCount) {
// 4-bit Wiegand codes have no data integrity check so we just
// read the LOW nibble.
diff --git a/applications/debug/subghz_test/views/subghz_test_packet.c b/applications/debug/subghz_test/views/subghz_test_packet.c
index bab83ab5b..1f3458296 100644
--- a/applications/debug/subghz_test/views/subghz_test_packet.c
+++ b/applications/debug/subghz_test/views/subghz_test_packet.c
@@ -56,7 +56,6 @@ static void subghz_test_packet_rx_callback(bool level, uint32_t duration, void*
subghz_decoder_princeton_for_testing_parse(instance->decoder, level, duration);
}
-//todo
static void subghz_test_packet_rx_pt_callback(SubGhzDecoderPrinceton* parser, void* context) {
UNUSED(parser);
furi_assert(context);
diff --git a/applications/debug/unit_tests/application.fam b/applications/debug/unit_tests/application.fam
index 949bb3fc2..ad9a278f3 100644
--- a/applications/debug/unit_tests/application.fam
+++ b/applications/debug/unit_tests/application.fam
@@ -3,6 +3,7 @@ App(
apptype=FlipperAppType.STARTUP,
entry_point="unit_tests_on_system_start",
cdefines=["APP_UNIT_TESTS"],
+ requires=["system_settings"],
provides=["delay_test"],
order=100,
)
diff --git a/applications/debug/unit_tests/furi/furi_memmgr_test.c b/applications/debug/unit_tests/furi/furi_memmgr_test.c
index f7bc234a0..05d967a99 100644
--- a/applications/debug/unit_tests/furi/furi_memmgr_test.c
+++ b/applications/debug/unit_tests/furi/furi_memmgr_test.c
@@ -26,7 +26,7 @@ void test_furi_memmgr() {
mu_assert_int_eq(66, ((uint8_t*)ptr)[i]);
}
- // TODO: fix realloc to copy only old size, and write testcase that leftover of reallocated memory is zero-initialized
+ // TODO FL-3492: fix realloc to copy only old size, and write testcase that leftover of reallocated memory is zero-initialized
free(ptr);
// allocate and zero-initialize array (calloc)
diff --git a/applications/debug/unit_tests/furi/furi_string_test.c b/applications/debug/unit_tests/furi/furi_string_test.c
index 3ea95b92b..6cbcc0dcc 100644
--- a/applications/debug/unit_tests/furi/furi_string_test.c
+++ b/applications/debug/unit_tests/furi/furi_string_test.c
@@ -69,7 +69,7 @@ MU_TEST(mu_test_furi_string_mem) {
mu_check(string != NULL);
mu_check(!furi_string_empty(string));
- // TODO: how to test furi_string_reserve?
+ // TODO FL-3493: how to test furi_string_reserve?
// test furi_string_reset
furi_string_reset(string);
diff --git a/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c b/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c
new file mode 100644
index 000000000..b06d51130
--- /dev/null
+++ b/applications/debug/unit_tests/furi_hal/furi_hal_crypto_tests.c
@@ -0,0 +1,602 @@
+#include
+#include
+#include
+#include "../minunit.h"
+
+static const uint8_t key_ctr_1[32] = {
+ 0x77, 0x6B, 0xEF, 0xF2, 0x85, 0x1D, 0xB0, 0x6F, 0x4C, 0x8A, 0x05, 0x42, 0xC8, 0x69, 0x6F, 0x6C,
+ 0x6A, 0x81, 0xAF, 0x1E, 0xEC, 0x96, 0xB4, 0xD3, 0x7F, 0xC1, 0xD6, 0x89, 0xE6, 0xC1, 0xC1, 0x04,
+};
+static const uint8_t iv_ctr_1[16] = {
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x60,
+ 0xDB,
+ 0x56,
+ 0x72,
+ 0xC9,
+ 0x7A,
+ 0xA8,
+ 0xF0,
+ 0xB2,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+};
+static const uint8_t pt_ctr_1[16] = {
+ 0x53,
+ 0x69,
+ 0x6E,
+ 0x67,
+ 0x6C,
+ 0x65,
+ 0x20,
+ 0x62,
+ 0x6C,
+ 0x6F,
+ 0x63,
+ 0x6B,
+ 0x20,
+ 0x6D,
+ 0x73,
+ 0x67,
+};
+static const uint8_t tv_ctr_ct_1[16] = {
+ 0x14,
+ 0x5A,
+ 0xD0,
+ 0x1D,
+ 0xBF,
+ 0x82,
+ 0x4E,
+ 0xC7,
+ 0x56,
+ 0x08,
+ 0x63,
+ 0xDC,
+ 0x71,
+ 0xE3,
+ 0xE0,
+ 0xC0,
+};
+
+static const uint8_t key_ctr_2[32] = {
+ 0x77, 0x6B, 0xEF, 0xF2, 0x85, 0x1D, 0xB0, 0x6F, 0x4C, 0x8A, 0x05, 0x42, 0xC8, 0x69, 0x6F, 0x6C,
+ 0x6A, 0x81, 0xAF, 0x1E, 0xEC, 0x96, 0xB4, 0xD3, 0x7F, 0xC1, 0xD6, 0x89, 0xE6, 0xC1, 0xC1, 0x04,
+};
+static const uint8_t iv_ctr_2[16] = {
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x60,
+ 0xDB,
+ 0x56,
+ 0x72,
+ 0xC9,
+ 0x7A,
+ 0xA8,
+ 0xF0,
+ 0xB2,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+};
+static const uint8_t pt_ctr_2[0] = {};
+//static const uint8_t tv_ctr_ct_2[0] = {};
+
+static const uint8_t key_ctr_3[32] = {
+ 0xF6, 0xD6, 0x6D, 0x6B, 0xD5, 0x2D, 0x59, 0xBB, 0x07, 0x96, 0x36, 0x58, 0x79, 0xEF, 0xF8, 0x86,
+ 0xC6, 0x6D, 0xD5, 0x1A, 0x5B, 0x6A, 0x99, 0x74, 0x4B, 0x50, 0x59, 0x0C, 0x87, 0xA2, 0x38, 0x84,
+};
+static const uint8_t iv_ctr_3[16] = {
+ 0x00,
+ 0xFA,
+ 0xAC,
+ 0x24,
+ 0xC1,
+ 0x58,
+ 0x5E,
+ 0xF1,
+ 0x5A,
+ 0x43,
+ 0xD8,
+ 0x75,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+};
+static const uint8_t pt_ctr_3[32] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+};
+static const uint8_t tv_ctr_ct_3[32] = {
+ 0xF0, 0x5E, 0x23, 0x1B, 0x38, 0x94, 0x61, 0x2C, 0x49, 0xEE, 0x00, 0x0B, 0x80, 0x4E, 0xB2, 0xA9,
+ 0xB8, 0x30, 0x6B, 0x50, 0x8F, 0x83, 0x9D, 0x6A, 0x55, 0x30, 0x83, 0x1D, 0x93, 0x44, 0xAF, 0x1C,
+};
+
+static const uint8_t key_ctr_4[32] = {
+ 0xFF, 0x7A, 0x61, 0x7C, 0xE6, 0x91, 0x48, 0xE4, 0xF1, 0x72, 0x6E, 0x2F, 0x43, 0x58, 0x1D, 0xE2,
+ 0xAA, 0x62, 0xD9, 0xF8, 0x05, 0x53, 0x2E, 0xDF, 0xF1, 0xEE, 0xD6, 0x87, 0xFB, 0x54, 0x15, 0x3D,
+};
+static const uint8_t iv_ctr_4[16] = {
+ 0x00,
+ 0x1C,
+ 0xC5,
+ 0xB7,
+ 0x51,
+ 0xA5,
+ 0x1D,
+ 0x70,
+ 0xA1,
+ 0xC1,
+ 0x11,
+ 0x48,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+};
+static const uint8_t pt_ctr_4[36] = {
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
+};
+static const uint8_t tv_ctr_ct_4[36] = {
+ 0xEB, 0x6C, 0x52, 0x82, 0x1D, 0x0B, 0xBB, 0xF7, 0xCE, 0x75, 0x94, 0x46,
+ 0x2A, 0xCA, 0x4F, 0xAA, 0xB4, 0x07, 0xDF, 0x86, 0x65, 0x69, 0xFD, 0x07,
+ 0xF4, 0x8C, 0xC0, 0xB5, 0x83, 0xD6, 0x07, 0x1F, 0x1E, 0xC0, 0xE6, 0xB8,
+};
+
+static const uint8_t key_ctr_5[32] = {
+ 0xFF, 0x7A, 0x61, 0x7C, 0xE6, 0x91, 0x48, 0xE4, 0xF1, 0x72, 0x6E, 0x2F, 0x43, 0x58, 0x1D, 0xE2,
+ 0xAA, 0x62, 0xD9, 0xF8, 0x05, 0x53, 0x2E, 0xDF, 0xF1, 0xEE, 0xD6, 0x87, 0xFB, 0x54, 0x15, 0x3D,
+};
+static const uint8_t iv_ctr_5[16] = {
+ 0x00,
+ 0x1C,
+ 0xC5,
+ 0xB7,
+ 0x51,
+ 0xA5,
+ 0x1D,
+ 0x70,
+ 0xA1,
+ 0xC1,
+ 0x11,
+ 0x48,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01,
+};
+static const uint8_t pt_ctr_5[0] = {};
+//static const uint8_t tv_ctr_ct_5[0] = {};
+
+static const uint8_t key_gcm_1[32] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t iv_gcm_1[16] = {
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+};
+static const uint8_t pt_gcm_1[0] = {};
+//static const uint8_t tv_gcm_ct_1[0] = {};
+static const uint8_t aad_gcm_1[0] = {};
+static const uint8_t tv_gcm_tag_1[16] = {
+ 0x53,
+ 0x0F,
+ 0x8A,
+ 0xFB,
+ 0xC7,
+ 0x45,
+ 0x36,
+ 0xB9,
+ 0xA9,
+ 0x63,
+ 0xB4,
+ 0xF1,
+ 0xC4,
+ 0xCB,
+ 0x73,
+ 0x8B,
+};
+
+static const uint8_t key_gcm_2[32] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static const uint8_t iv_gcm_2[16] = {
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+};
+static const uint8_t pt_gcm_2[16] = {
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+};
+static const uint8_t tv_gcm_ct_2[16] = {
+ 0xCE,
+ 0xA7,
+ 0x40,
+ 0x3D,
+ 0x4D,
+ 0x60,
+ 0x6B,
+ 0x6E,
+ 0x07,
+ 0x4E,
+ 0xC5,
+ 0xD3,
+ 0xBA,
+ 0xF3,
+ 0x9D,
+ 0x18,
+};
+static const uint8_t aad_gcm_2[0] = {};
+static const uint8_t tv_gcm_tag_2[16] = {
+ 0xD0,
+ 0xD1,
+ 0xC8,
+ 0xA7,
+ 0x99,
+ 0x99,
+ 0x6B,
+ 0xF0,
+ 0x26,
+ 0x5B,
+ 0x98,
+ 0xB5,
+ 0xD4,
+ 0x8A,
+ 0xB9,
+ 0x19,
+};
+
+static const uint8_t key_gcm_3[32] = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t iv_gcm_3[16] = {
+ 0xCA,
+ 0xFE,
+ 0xBA,
+ 0xBE,
+ 0xFA,
+ 0xCE,
+ 0xDB,
+ 0xAD,
+ 0xDE,
+ 0xCA,
+ 0xF8,
+ 0x88,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+};
+static const uint8_t pt_gcm_3[64] = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26, 0x9A,
+ 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31, 0x8A, 0x72,
+ 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2F, 0xCF, 0x0E, 0x24, 0x49, 0xA6, 0xB5, 0x25,
+ 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, 0xBA, 0x63, 0x7B, 0x39, 0x1A, 0xAF, 0xD2, 0x55,
+};
+static const uint8_t tv_gcm_ct_3[64] = {
+ 0x52, 0x2D, 0xC1, 0xF0, 0x99, 0x56, 0x7D, 0x07, 0xF4, 0x7F, 0x37, 0xA3, 0x2A, 0x84, 0x42, 0x7D,
+ 0x64, 0x3A, 0x8C, 0xDC, 0xBF, 0xE5, 0xC0, 0xC9, 0x75, 0x98, 0xA2, 0xBD, 0x25, 0x55, 0xD1, 0xAA,
+ 0x8C, 0xB0, 0x8E, 0x48, 0x59, 0x0D, 0xBB, 0x3D, 0xA7, 0xB0, 0x8B, 0x10, 0x56, 0x82, 0x88, 0x38,
+ 0xC5, 0xF6, 0x1E, 0x63, 0x93, 0xBA, 0x7A, 0x0A, 0xBC, 0xC9, 0xF6, 0x62, 0x89, 0x80, 0x15, 0xAD,
+};
+static const uint8_t aad_gcm_3[0] = {};
+static const uint8_t tv_gcm_tag_3[16] = {
+ 0xB0,
+ 0x94,
+ 0xDA,
+ 0xC5,
+ 0xD9,
+ 0x34,
+ 0x71,
+ 0xBD,
+ 0xEC,
+ 0x1A,
+ 0x50,
+ 0x22,
+ 0x70,
+ 0xE3,
+ 0xCC,
+ 0x6C,
+};
+
+static const uint8_t key_gcm_4[32] = {
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+ 0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08,
+};
+static const uint8_t iv_gcm_4[16] = {
+ 0xCA,
+ 0xFE,
+ 0xBA,
+ 0xBE,
+ 0xFA,
+ 0xCE,
+ 0xDB,
+ 0xAD,
+ 0xDE,
+ 0xCA,
+ 0xF8,
+ 0x88,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+};
+static const uint8_t pt_gcm_4[60] = {
+ 0xD9, 0x31, 0x32, 0x25, 0xF8, 0x84, 0x06, 0xE5, 0xA5, 0x59, 0x09, 0xC5, 0xAF, 0xF5, 0x26,
+ 0x9A, 0x86, 0xA7, 0xA9, 0x53, 0x15, 0x34, 0xF7, 0xDA, 0x2E, 0x4C, 0x30, 0x3D, 0x8A, 0x31,
+ 0x8A, 0x72, 0x1C, 0x3C, 0x0C, 0x95, 0x95, 0x68, 0x09, 0x53, 0x2F, 0xCF, 0x0E, 0x24, 0x49,
+ 0xA6, 0xB5, 0x25, 0xB1, 0x6A, 0xED, 0xF5, 0xAA, 0x0D, 0xE6, 0x57, 0xBA, 0x63, 0x7B, 0x39,
+};
+static const uint8_t tv_gcm_ct_4[60] = {
+ 0x52, 0x2D, 0xC1, 0xF0, 0x99, 0x56, 0x7D, 0x07, 0xF4, 0x7F, 0x37, 0xA3, 0x2A, 0x84, 0x42,
+ 0x7D, 0x64, 0x3A, 0x8C, 0xDC, 0xBF, 0xE5, 0xC0, 0xC9, 0x75, 0x98, 0xA2, 0xBD, 0x25, 0x55,
+ 0xD1, 0xAA, 0x8C, 0xB0, 0x8E, 0x48, 0x59, 0x0D, 0xBB, 0x3D, 0xA7, 0xB0, 0x8B, 0x10, 0x56,
+ 0x82, 0x88, 0x38, 0xC5, 0xF6, 0x1E, 0x63, 0x93, 0xBA, 0x7A, 0x0A, 0xBC, 0xC9, 0xF6, 0x62,
+};
+static const uint8_t aad_gcm_4[20] = {
+ 0xFE, 0xED, 0xFA, 0xCE, 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED,
+ 0xFA, 0xCE, 0xDE, 0xAD, 0xBE, 0xEF, 0xAB, 0xAD, 0xDA, 0xD2,
+};
+static const uint8_t tv_gcm_tag_4[16] = {
+ 0x76,
+ 0xFC,
+ 0x6E,
+ 0xCE,
+ 0x0F,
+ 0x4E,
+ 0x17,
+ 0x68,
+ 0xCD,
+ 0xDF,
+ 0x88,
+ 0x53,
+ 0xBB,
+ 0x2D,
+ 0x55,
+ 0x1B,
+};
+
+static void furi_hal_crypto_ctr_setup() {
+}
+
+static void furi_hal_crypto_ctr_teardown() {
+}
+
+static void furi_hal_crypto_gcm_setup() {
+}
+
+static void furi_hal_crypto_gcm_teardown() {
+}
+
+MU_TEST(furi_hal_crypto_ctr_1) {
+ bool ret = false;
+ uint8_t ct[sizeof(pt_ctr_1)];
+
+ ret = furi_hal_crypto_ctr(key_ctr_1, iv_ctr_1, pt_ctr_1, ct, sizeof(pt_ctr_1));
+ mu_assert(ret, "CTR 1 failed");
+ mu_assert_mem_eq(tv_ctr_ct_1, ct, sizeof(pt_ctr_1));
+}
+
+MU_TEST(furi_hal_crypto_ctr_2) {
+ bool ret = false;
+ uint8_t ct[sizeof(pt_ctr_2)];
+
+ ret = furi_hal_crypto_ctr(key_ctr_2, iv_ctr_2, pt_ctr_2, ct, sizeof(pt_ctr_2));
+ mu_assert(ret, "CTR 2 failed");
+ //mu_assert_mem_eq(tv_ctr_ct_2, ct, sizeof(pt_ctr_2));
+}
+
+MU_TEST(furi_hal_crypto_ctr_3) {
+ bool ret = false;
+ uint8_t ct[sizeof(pt_ctr_3)];
+
+ ret = furi_hal_crypto_ctr(key_ctr_3, iv_ctr_3, pt_ctr_3, ct, sizeof(pt_ctr_3));
+ mu_assert(ret, "CTR 3 failed");
+ mu_assert_mem_eq(tv_ctr_ct_3, ct, sizeof(pt_ctr_3));
+}
+
+MU_TEST(furi_hal_crypto_ctr_4) {
+ bool ret = false;
+ uint8_t ct[sizeof(pt_ctr_4)];
+
+ ret = furi_hal_crypto_ctr(key_ctr_4, iv_ctr_4, pt_ctr_4, ct, sizeof(pt_ctr_4));
+ mu_assert(ret, "CTR 4 failed");
+ mu_assert_mem_eq(tv_ctr_ct_4, ct, sizeof(pt_ctr_4));
+}
+
+MU_TEST(furi_hal_crypto_ctr_5) {
+ bool ret = false;
+ uint8_t ct[sizeof(pt_ctr_5)];
+
+ ret = furi_hal_crypto_ctr(key_ctr_5, iv_ctr_5, pt_ctr_5, ct, sizeof(pt_ctr_5));
+ mu_assert(ret, "CTR 5 failed");
+ //mu_assert_mem_eq(tv_ctr_ct_5, ct, sizeof(pt_ctr_5));
+}
+
+MU_TEST(furi_hal_crypto_gcm_1) {
+ bool ret = false;
+ uint8_t pt[sizeof(pt_gcm_1)];
+ uint8_t ct[sizeof(pt_gcm_1)];
+ uint8_t tag_enc[16];
+ uint8_t tag_dec[16];
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_1,
+ iv_gcm_1,
+ aad_gcm_1,
+ sizeof(aad_gcm_1),
+ pt_gcm_1,
+ ct,
+ sizeof(pt_gcm_1),
+ tag_enc,
+ false);
+ mu_assert(ret, "GCM 1 encryption failed");
+ //mu_assert_mem_eq(tv_gcm_ct_1, ct, sizeof(pt_gcm_1));
+ mu_assert_mem_eq(tv_gcm_tag_1, tag_enc, 16);
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_1, iv_gcm_1, aad_gcm_1, sizeof(aad_gcm_1), ct, pt, sizeof(pt_gcm_1), tag_dec, true);
+ mu_assert(ret, "GCM 1 decryption failed");
+ //mu_assert_mem_eq(pt_gcm_1, pt, sizeof(pt_gcm_1));
+ mu_assert_mem_eq(tv_gcm_tag_1, tag_dec, 16);
+}
+
+MU_TEST(furi_hal_crypto_gcm_2) {
+ bool ret = false;
+ uint8_t pt[sizeof(pt_gcm_2)];
+ uint8_t ct[sizeof(pt_gcm_2)];
+ uint8_t tag_enc[16];
+ uint8_t tag_dec[16];
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_2,
+ iv_gcm_2,
+ aad_gcm_2,
+ sizeof(aad_gcm_2),
+ pt_gcm_2,
+ ct,
+ sizeof(pt_gcm_2),
+ tag_enc,
+ false);
+ mu_assert(ret, "GCM 2 encryption failed");
+ mu_assert_mem_eq(tv_gcm_ct_2, ct, sizeof(pt_gcm_2));
+ mu_assert_mem_eq(tv_gcm_tag_2, tag_enc, 16);
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_2, iv_gcm_2, aad_gcm_2, sizeof(aad_gcm_2), ct, pt, sizeof(pt_gcm_2), tag_dec, true);
+ mu_assert(ret, "GCM 2 decryption failed");
+ mu_assert_mem_eq(pt_gcm_2, pt, sizeof(pt_gcm_2));
+ mu_assert_mem_eq(tv_gcm_tag_2, tag_dec, 16);
+}
+
+MU_TEST(furi_hal_crypto_gcm_3) {
+ bool ret = false;
+ uint8_t pt[sizeof(pt_gcm_3)];
+ uint8_t ct[sizeof(pt_gcm_3)];
+ uint8_t tag_enc[16];
+ uint8_t tag_dec[16];
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_3,
+ iv_gcm_3,
+ aad_gcm_3,
+ sizeof(aad_gcm_3),
+ pt_gcm_3,
+ ct,
+ sizeof(pt_gcm_3),
+ tag_enc,
+ false);
+ mu_assert(ret, "GCM 3 encryption failed");
+ mu_assert_mem_eq(tv_gcm_ct_3, ct, sizeof(pt_gcm_3));
+ mu_assert_mem_eq(tv_gcm_tag_3, tag_enc, 16);
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_3, iv_gcm_3, aad_gcm_3, sizeof(aad_gcm_3), ct, pt, sizeof(pt_gcm_3), tag_dec, true);
+ mu_assert(ret, "GCM 3 decryption failed");
+ mu_assert_mem_eq(pt_gcm_3, pt, sizeof(pt_gcm_3));
+ mu_assert_mem_eq(tv_gcm_tag_3, tag_dec, 16);
+}
+
+MU_TEST(furi_hal_crypto_gcm_4) {
+ bool ret = false;
+ uint8_t pt[sizeof(pt_gcm_4)];
+ uint8_t ct[sizeof(pt_gcm_4)];
+ uint8_t tag_enc[16];
+ uint8_t tag_dec[16];
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_4,
+ iv_gcm_4,
+ aad_gcm_4,
+ sizeof(aad_gcm_4),
+ pt_gcm_4,
+ ct,
+ sizeof(pt_gcm_4),
+ tag_enc,
+ false);
+ mu_assert(ret, "GCM 4 encryption failed");
+ mu_assert_mem_eq(tv_gcm_ct_4, ct, sizeof(pt_gcm_4));
+ mu_assert_mem_eq(tv_gcm_tag_4, tag_enc, 16);
+
+ ret = furi_hal_crypto_gcm(
+ key_gcm_4, iv_gcm_4, aad_gcm_4, sizeof(aad_gcm_4), ct, pt, sizeof(pt_gcm_4), tag_dec, true);
+ mu_assert(ret, "GCM 4 decryption failed");
+ mu_assert_mem_eq(pt_gcm_4, pt, sizeof(pt_gcm_4));
+ mu_assert_mem_eq(tv_gcm_tag_4, tag_dec, 16);
+}
+
+MU_TEST_SUITE(furi_hal_crypto_ctr_test) {
+ MU_SUITE_CONFIGURE(&furi_hal_crypto_ctr_setup, &furi_hal_crypto_ctr_teardown);
+ MU_RUN_TEST(furi_hal_crypto_ctr_1);
+ MU_RUN_TEST(furi_hal_crypto_ctr_2);
+ MU_RUN_TEST(furi_hal_crypto_ctr_3);
+ MU_RUN_TEST(furi_hal_crypto_ctr_4);
+ MU_RUN_TEST(furi_hal_crypto_ctr_5);
+}
+
+MU_TEST_SUITE(furi_hal_crypto_gcm_test) {
+ MU_SUITE_CONFIGURE(&furi_hal_crypto_gcm_setup, &furi_hal_crypto_gcm_teardown);
+ MU_RUN_TEST(furi_hal_crypto_gcm_1);
+ MU_RUN_TEST(furi_hal_crypto_gcm_2);
+ MU_RUN_TEST(furi_hal_crypto_gcm_3);
+ MU_RUN_TEST(furi_hal_crypto_gcm_4);
+}
+
+int run_minunit_test_furi_hal_crypto() {
+ MU_RUN_SUITE(furi_hal_crypto_ctr_test);
+ MU_RUN_SUITE(furi_hal_crypto_gcm_test);
+ return MU_EXIT_CODE;
+}
diff --git a/applications/debug/unit_tests/lfrfid/bit_lib_test.c b/applications/debug/unit_tests/lfrfid/bit_lib_test.c
index 726615703..dcb69de7f 100644
--- a/applications/debug/unit_tests/lfrfid/bit_lib_test.c
+++ b/applications/debug/unit_tests/lfrfid/bit_lib_test.c
@@ -311,7 +311,7 @@ MU_TEST(test_bit_lib_test_parity) {
}
MU_TEST(test_bit_lib_remove_bit_every_nth) {
- // TODO: more tests
+ // TODO FL-3494: more tests
uint8_t data_i[1] = {0b00001111};
uint8_t data_o[1] = {0b00011111};
size_t length;
diff --git a/applications/debug/unit_tests/rpc/rpc_test.c b/applications/debug/unit_tests/rpc/rpc_test.c
index 167266a84..533a8a9ca 100644
--- a/applications/debug/unit_tests/rpc/rpc_test.c
+++ b/applications/debug/unit_tests/rpc/rpc_test.c
@@ -13,7 +13,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -287,7 +287,8 @@ static void test_rpc_create_simple_message(
PB_Main* message,
uint16_t tag,
const char* str,
- uint32_t command_id) {
+ uint32_t command_id,
+ bool flag) {
furi_check(message);
char* str_copy = NULL;
@@ -308,6 +309,7 @@ static void test_rpc_create_simple_message(
break;
case PB_Main_storage_list_request_tag:
message->content.storage_list_request.path = str_copy;
+ message->content.storage_list_request.include_md5 = flag;
break;
case PB_Main_storage_mkdir_request_tag:
message->content.storage_mkdir_request.path = str_copy;
@@ -419,6 +421,7 @@ static void
}
mu_check(result_msg_file->size == expected_msg_file->size);
mu_check(result_msg_file->type == expected_msg_file->type);
+ mu_assert_string_eq(expected_msg_file->md5sum, result_msg_file->md5sum);
if(result_msg_file->data && result_msg_file->type != PB_Storage_File_FileType_DIR) {
mu_check(!result_msg_file->data == !expected_msg_file->data); // Zlo: WTF???
@@ -430,10 +433,10 @@ static void
}
static void test_rpc_compare_messages(PB_Main* result, PB_Main* expected) {
- mu_check(result->command_id == expected->command_id);
- mu_check(result->command_status == expected->command_status);
- mu_check(result->has_next == expected->has_next);
- mu_check(result->which_content == expected->which_content);
+ mu_assert_int_eq(expected->command_id, result->command_id);
+ mu_assert_int_eq(expected->command_status, result->command_status);
+ mu_assert_int_eq(expected->has_next, result->has_next);
+ mu_assert_int_eq(expected->which_content, result->which_content);
if(result->command_status != PB_CommandStatus_OK) {
mu_check(result->which_content == PB_Main_empty_tag);
}
@@ -573,10 +576,15 @@ static void
static void test_rpc_storage_list_create_expected_list(
MsgList_t msg_list,
const char* path,
- uint32_t command_id) {
+ uint32_t command_id,
+ bool append_md5) {
Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* dir = storage_file_alloc(fs_api);
+ FuriString* md5 = furi_string_alloc();
+ FuriString* md5_path = furi_string_alloc();
+ File* file = storage_file_alloc(fs_api);
+
PB_Main response = {
.command_id = command_id,
.has_next = false,
@@ -614,6 +622,17 @@ static void test_rpc_storage_list_create_expected_list(
list->file[i].data = NULL;
/* memory free inside rpc_encode_and_send() -> pb_release() */
list->file[i].name = name;
+
+ if(append_md5 && !file_info_is_dir(&fileinfo)) {
+ furi_string_printf(md5_path, "%s/%s", path, name);
+
+ if(md5_string_calc_file(file, furi_string_get_cstr(md5_path), md5, NULL)) {
+ char* md5sum = list->file[i].md5sum;
+ size_t md5sum_size = sizeof(list->file[i].md5sum);
+ snprintf(md5sum, md5sum_size, "%s", furi_string_get_cstr(md5));
+ }
+ }
+
++i;
}
} else {
@@ -626,6 +645,10 @@ static void test_rpc_storage_list_create_expected_list(
response.has_next = false;
MsgList_push_back(msg_list, response);
+ furi_string_free(md5);
+ furi_string_free(md5_path);
+ storage_file_free(file);
+
storage_dir_close(dir);
storage_file_free(dir);
@@ -675,16 +698,17 @@ static void test_rpc_free_msg_list(MsgList_t msg_list) {
MsgList_clear(msg_list);
}
-static void test_rpc_storage_list_run(const char* path, uint32_t command_id) {
+static void test_rpc_storage_list_run(const char* path, uint32_t command_id, bool md5) {
PB_Main request;
MsgList_t expected_msg_list;
MsgList_init(expected_msg_list);
- test_rpc_create_simple_message(&request, PB_Main_storage_list_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_list_request_tag, path, command_id, md5);
if(!strcmp(path, "/")) {
test_rpc_storage_list_create_expected_list_root(expected_msg_list, command_id);
} else {
- test_rpc_storage_list_create_expected_list(expected_msg_list, path, command_id);
+ test_rpc_storage_list_create_expected_list(expected_msg_list, path, command_id, md5);
}
test_rpc_encode_and_feed_one(&request, 0);
test_rpc_decode_and_compare(expected_msg_list, 0);
@@ -694,15 +718,25 @@ static void test_rpc_storage_list_run(const char* path, uint32_t command_id) {
}
MU_TEST(test_storage_list) {
- test_rpc_storage_list_run("/", ++command_id);
- test_rpc_storage_list_run(EXT_PATH("nfc"), ++command_id);
+ test_rpc_storage_list_run("/", ++command_id, false);
+ test_rpc_storage_list_run(EXT_PATH("nfc"), ++command_id, false);
+ test_rpc_storage_list_run(STORAGE_INT_PATH_PREFIX, ++command_id, false);
+ test_rpc_storage_list_run(STORAGE_EXT_PATH_PREFIX, ++command_id, false);
+ test_rpc_storage_list_run(EXT_PATH("infrared"), ++command_id, false);
+ test_rpc_storage_list_run(EXT_PATH("ibutton"), ++command_id, false);
+ test_rpc_storage_list_run(EXT_PATH("lfrfid"), ++command_id, false);
+ test_rpc_storage_list_run("error_path", ++command_id, false);
+}
- test_rpc_storage_list_run(STORAGE_INT_PATH_PREFIX, ++command_id);
- test_rpc_storage_list_run(STORAGE_EXT_PATH_PREFIX, ++command_id);
- test_rpc_storage_list_run(EXT_PATH("infrared"), ++command_id);
- test_rpc_storage_list_run(EXT_PATH("ibutton"), ++command_id);
- test_rpc_storage_list_run(EXT_PATH("lfrfid"), ++command_id);
- test_rpc_storage_list_run("error_path", ++command_id);
+MU_TEST(test_storage_list_md5) {
+ test_rpc_storage_list_run("/", ++command_id, true);
+ test_rpc_storage_list_run(EXT_PATH("nfc"), ++command_id, true);
+ test_rpc_storage_list_run(STORAGE_INT_PATH_PREFIX, ++command_id, true);
+ test_rpc_storage_list_run(STORAGE_EXT_PATH_PREFIX, ++command_id, true);
+ test_rpc_storage_list_run(EXT_PATH("infrared"), ++command_id, true);
+ test_rpc_storage_list_run(EXT_PATH("ibutton"), ++command_id, true);
+ test_rpc_storage_list_run(EXT_PATH("lfrfid"), ++command_id, true);
+ test_rpc_storage_list_run("error_path", ++command_id, true);
}
static void
@@ -770,7 +804,8 @@ static void test_storage_read_run(const char* path, uint32_t command_id) {
MsgList_init(expected_msg_list);
test_rpc_add_read_to_list_by_reading_real_file(expected_msg_list, path, command_id);
- test_rpc_create_simple_message(&request, PB_Main_storage_read_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_read_request_tag, path, command_id, false);
test_rpc_encode_and_feed_one(&request, 0);
test_rpc_decode_and_compare(expected_msg_list, 0);
@@ -824,7 +859,8 @@ static void test_rpc_storage_info_run(const char* path, uint32_t command_id) {
MsgList_t expected_msg_list;
MsgList_init(expected_msg_list);
- test_rpc_create_simple_message(&request, PB_Main_storage_info_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_info_request_tag, path, command_id, false);
PB_Main* response = MsgList_push_new(expected_msg_list);
response->command_id = command_id;
@@ -856,7 +892,8 @@ static void test_rpc_storage_stat_run(const char* path, uint32_t command_id) {
MsgList_t expected_msg_list;
MsgList_init(expected_msg_list);
- test_rpc_create_simple_message(&request, PB_Main_storage_stat_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_stat_request_tag, path, command_id, false);
Storage* fs_api = furi_record_open(RECORD_STORAGE);
FileInfo fileinfo;
@@ -968,7 +1005,11 @@ static void test_storage_write_read_run(
test_rpc_add_empty_to_list(expected_msg_list, PB_CommandStatus_OK, *command_id);
test_rpc_create_simple_message(
- MsgList_push_raw(input_msg_list), PB_Main_storage_read_request_tag, path, ++*command_id);
+ MsgList_push_raw(input_msg_list),
+ PB_Main_storage_read_request_tag,
+ path,
+ ++*command_id,
+ false);
test_rpc_add_read_or_write_to_list(
expected_msg_list,
READ_RESPONSE,
@@ -1041,7 +1082,8 @@ MU_TEST(test_storage_interrupt_continuous_same_system) {
MsgList_push_new(input_msg_list),
PB_Main_storage_mkdir_request_tag,
TEST_DIR "dir1",
- command_id + 1);
+ command_id + 1,
+ false);
test_rpc_add_read_or_write_to_list(
input_msg_list,
WRITE_REQUEST,
@@ -1121,7 +1163,8 @@ static void test_storage_delete_run(
MsgList_t expected_msg_list;
MsgList_init(expected_msg_list);
- test_rpc_create_simple_message(&request, PB_Main_storage_delete_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_delete_request_tag, path, command_id, false);
request.content.storage_delete_request.recursive = recursive;
test_rpc_add_empty_to_list(expected_msg_list, status, command_id);
@@ -1202,7 +1245,8 @@ static void test_storage_mkdir_run(const char* path, size_t command_id, PB_Comma
MsgList_t expected_msg_list;
MsgList_init(expected_msg_list);
- test_rpc_create_simple_message(&request, PB_Main_storage_mkdir_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_mkdir_request_tag, path, command_id, false);
test_rpc_add_empty_to_list(expected_msg_list, status, command_id);
test_rpc_encode_and_feed_one(&request, 0);
@@ -1229,33 +1273,15 @@ MU_TEST(test_storage_mkdir) {
static void test_storage_calculate_md5sum(const char* path, char* md5sum, size_t md5sum_size) {
Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
+ FuriString* md5 = furi_string_alloc();
- if(storage_file_open(file, path, FSAM_READ, FSOM_OPEN_EXISTING)) {
- const uint16_t once_read_size = 512;
- const uint8_t hash_size = MD5SUM_SIZE;
- uint8_t* data = malloc(once_read_size);
- uint8_t* hash = malloc(sizeof(uint8_t) * hash_size);
- md5_context* md5_ctx = malloc(sizeof(md5_context));
-
- md5_starts(md5_ctx);
- while(true) {
- uint16_t read_size = storage_file_read(file, data, once_read_size);
- if(read_size == 0) break;
- md5_update(md5_ctx, data, read_size);
- }
- md5_finish(md5_ctx, hash);
- free(md5_ctx);
-
- for(uint8_t i = 0; i < hash_size; i++) {
- md5sum += snprintf(md5sum, md5sum_size, "%02x", hash[i]);
- }
-
- free(hash);
- free(data);
+ if(md5_string_calc_file(file, path, md5, NULL)) {
+ snprintf(md5sum, md5sum_size, "%s", furi_string_get_cstr(md5));
} else {
furi_check(0);
}
+ furi_string_free(md5);
storage_file_close(file);
storage_file_free(file);
@@ -1271,11 +1297,12 @@ static void test_storage_md5sum_run(
MsgList_t expected_msg_list;
MsgList_init(expected_msg_list);
- test_rpc_create_simple_message(&request, PB_Main_storage_md5sum_request_tag, path, command_id);
+ test_rpc_create_simple_message(
+ &request, PB_Main_storage_md5sum_request_tag, path, command_id, false);
if(status == PB_CommandStatus_OK) {
PB_Main* response = MsgList_push_new(expected_msg_list);
test_rpc_create_simple_message(
- response, PB_Main_storage_md5sum_response_tag, md5sum, command_id);
+ response, PB_Main_storage_md5sum_response_tag, md5sum, command_id, false);
response->command_status = status;
} else {
test_rpc_add_empty_to_list(expected_msg_list, status, command_id);
@@ -1433,6 +1460,7 @@ MU_TEST_SUITE(test_rpc_storage) {
MU_RUN_TEST(test_storage_info);
MU_RUN_TEST(test_storage_stat);
MU_RUN_TEST(test_storage_list);
+ MU_RUN_TEST(test_storage_list_md5);
MU_RUN_TEST(test_storage_read);
MU_RUN_TEST(test_storage_write_read);
MU_RUN_TEST(test_storage_write);
@@ -1731,7 +1759,8 @@ MU_TEST(test_rpc_multisession_storage) {
MsgList_push_raw(input_0),
PB_Main_storage_read_request_tag,
TEST_DIR "file0.txt",
- ++command_id);
+ ++command_id,
+ false);
test_rpc_add_read_or_write_to_list(
expected_0, READ_RESPONSE, TEST_DIR "file0.txt", pattern, sizeof(pattern), 1, command_id);
@@ -1739,7 +1768,8 @@ MU_TEST(test_rpc_multisession_storage) {
MsgList_push_raw(input_1),
PB_Main_storage_read_request_tag,
TEST_DIR "file1.txt",
- ++command_id);
+ ++command_id,
+ false);
test_rpc_add_read_or_write_to_list(
expected_1, READ_RESPONSE, TEST_DIR "file1.txt", pattern, sizeof(pattern), 1, command_id);
diff --git a/applications/debug/unit_tests/storage/storage_test.c b/applications/debug/unit_tests/storage/storage_test.c
index f0b45c598..13188e5e0 100644
--- a/applications/debug/unit_tests/storage/storage_test.c
+++ b/applications/debug/unit_tests/storage/storage_test.c
@@ -582,6 +582,49 @@ MU_TEST(test_storage_common_migrate) {
furi_record_close(RECORD_STORAGE);
}
+#define MD5_HASH_SIZE (16)
+#include
+
+MU_TEST(test_md5_calc) {
+ Storage* storage = furi_record_open(RECORD_STORAGE);
+ File* file = storage_file_alloc(storage);
+
+ const char* path = UNIT_TESTS_PATH("storage/md5.txt");
+ const char* md5_cstr = "2a456fa43e75088fdde41c93159d62a2";
+ const uint8_t md5[MD5_HASH_SIZE] = {
+ 0x2a,
+ 0x45,
+ 0x6f,
+ 0xa4,
+ 0x3e,
+ 0x75,
+ 0x08,
+ 0x8f,
+ 0xdd,
+ 0xe4,
+ 0x1c,
+ 0x93,
+ 0x15,
+ 0x9d,
+ 0x62,
+ 0xa2,
+ };
+
+ uint8_t md5_output[MD5_HASH_SIZE];
+ FuriString* md5_output_str = furi_string_alloc();
+ memset(md5_output, 0, MD5_HASH_SIZE);
+
+ mu_check(md5_calc_file(file, path, md5_output, NULL));
+ mu_check(md5_string_calc_file(file, path, md5_output_str, NULL));
+
+ mu_assert_mem_eq(md5, md5_output, MD5_HASH_SIZE);
+ mu_assert_string_eq(md5_cstr, furi_string_get_cstr(md5_output_str));
+
+ storage_file_free(file);
+ furi_string_free(md5_output_str);
+ furi_record_close(RECORD_STORAGE);
+}
+
MU_TEST_SUITE(test_data_path) {
MU_RUN_TEST(test_storage_data_path);
MU_RUN_TEST(test_storage_data_path_apps);
@@ -591,11 +634,16 @@ MU_TEST_SUITE(test_storage_common) {
MU_RUN_TEST(test_storage_common_migrate);
}
+MU_TEST_SUITE(test_md5_calc_suite) {
+ MU_RUN_TEST(test_md5_calc);
+}
+
int run_minunit_test_storage() {
MU_RUN_SUITE(storage_file);
MU_RUN_SUITE(storage_dir);
MU_RUN_SUITE(storage_rename);
MU_RUN_SUITE(test_data_path);
MU_RUN_SUITE(test_storage_common);
+ MU_RUN_SUITE(test_md5_calc_suite);
return MU_EXIT_CODE;
}
diff --git a/applications/debug/unit_tests/subghz/subghz_test.c b/applications/debug/unit_tests/subghz/subghz_test.c
index 6bdaa641e..e32a57482 100644
--- a/applications/debug/unit_tests/subghz/subghz_test.c
+++ b/applications/debug/unit_tests/subghz/subghz_test.c
@@ -330,7 +330,12 @@ bool subghz_hal_async_tx_test_run(SubGhzHalAsyncTxTestType type) {
return false;
}
+ FuriHalCortexTimer timer = furi_hal_cortex_timer_get(30000000);
+
while(!furi_hal_subghz_is_async_tx_complete()) {
+ if(furi_hal_cortex_timer_is_expired(timer)) {
+ return false;
+ }
furi_delay_ms(10);
}
furi_hal_subghz_stop_async_tx();
diff --git a/applications/debug/unit_tests/test_index.c b/applications/debug/unit_tests/test_index.c
index 9d7631bfe..edaf950c5 100644
--- a/applications/debug/unit_tests/test_index.c
+++ b/applications/debug/unit_tests/test_index.c
@@ -10,6 +10,7 @@
int run_minunit_test_furi();
int run_minunit_test_furi_hal();
+int run_minunit_test_furi_hal_crypto();
int run_minunit_test_furi_string();
int run_minunit_test_infrared();
int run_minunit_test_rpc();
@@ -39,6 +40,7 @@ typedef struct {
const UnitTest unit_tests[] = {
{.name = "furi", .entry = run_minunit_test_furi},
{.name = "furi_hal", .entry = run_minunit_test_furi_hal},
+ {.name = "furi_hal_crypto", .entry = run_minunit_test_furi_hal_crypto},
{.name = "furi_string", .entry = run_minunit_test_furi_string},
{.name = "storage", .entry = run_minunit_test_storage},
{.name = "stream", .entry = run_minunit_test_stream},
@@ -88,7 +90,7 @@ void unit_tests_cli(Cli* cli, FuriString* args, void* context) {
Loader* loader = furi_record_open(RECORD_LOADER);
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
- // TODO: lock device while test running
+ // TODO FL-3491: lock device while test running
if(loader_is_locked(loader)) {
printf("RPC: stop all applications to run tests\r\n");
notification_message(notification, &sequence_blink_magenta_100);
diff --git a/applications/debug/usb_mouse/application.fam b/applications/debug/usb_mouse/application.fam
index ab91e7aa2..55cec85cc 100644
--- a/applications/debug/usb_mouse/application.fam
+++ b/applications/debug/usb_mouse/application.fam
@@ -7,6 +7,5 @@ App(
requires=["gui"],
stack_size=1 * 1024,
order=60,
- fap_icon="../../external/mousejacker/mouse_10px.png",
fap_category="Debug",
)
diff --git a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c
index db7dcb3ff..e055e1e51 100644
--- a/applications/drivers/subghz/cc1101_ext/cc1101_ext.c
+++ b/applications/drivers/subghz/cc1101_ext/cc1101_ext.c
@@ -357,7 +357,7 @@ bool subghz_device_cc1101_ext_rx_pipe_not_empty() {
(CC1101_STATUS_RXBYTES) | CC1101_BURST,
(uint8_t*)status);
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
- // TODO: you can add a buffer overflow flag if needed
+ // TODO: Find reason why RXFIFO_OVERFLOW doesnt work correctly
if(status->NUM_RXBYTES > 0) {
return true;
} else {
diff --git a/applications/external/application.fam b/applications/external/application.fam
deleted file mode 100644
index 12dc1cc1a..000000000
--- a/applications/external/application.fam
+++ /dev/null
@@ -1,6 +0,0 @@
-# Placeholder
-App(
- appid="external_apps",
- name="External apps bundle",
- apptype=FlipperAppType.METAPACKAGE,
-)
diff --git a/applications/external/arkanoid/application.fam b/applications/external/arkanoid/application.fam
deleted file mode 100644
index cdd5f4e8a..000000000
--- a/applications/external/arkanoid/application.fam
+++ /dev/null
@@ -1,14 +0,0 @@
-App(
- appid="arkanoid",
- name="Arkanoid",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="arkanoid_game_app",
- requires=["gui"],
- stack_size=1 * 1024,
- order=30,
- fap_icon="arkanoid_10px.png",
- fap_category="Games",
- fap_author="@xMasterX & @gotnull",
- fap_version="1.0",
- fap_description="Arkanoid Game",
-)
diff --git a/applications/external/arkanoid/arkanoid_10px.png b/applications/external/arkanoid/arkanoid_10px.png
deleted file mode 100644
index 344d2db73..000000000
Binary files a/applications/external/arkanoid/arkanoid_10px.png and /dev/null differ
diff --git a/applications/external/arkanoid/arkanoid_game.c b/applications/external/arkanoid/arkanoid_game.c
deleted file mode 100644
index 2adf2e30b..000000000
--- a/applications/external/arkanoid/arkanoid_game.c
+++ /dev/null
@@ -1,479 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define TAG "Arkanoid"
-
-#define FLIPPER_LCD_WIDTH 128
-#define FLIPPER_LCD_HEIGHT 64
-#define MAX_SPEED 3
-
-typedef enum { EventTypeTick, EventTypeKey } EventType;
-
-typedef struct {
- //Brick Bounds used in collision detection
- int leftBrick;
- int rightBrick;
- int topBrick;
- int bottomBrick;
- bool isHit[4][13]; //Array of if bricks are hit or not
-} BrickState;
-
-typedef struct {
- int dx; //Initial movement of ball
- int dy; //Initial movement of ball
- int xb; //Balls starting possition
- int yb; //Balls starting possition
- bool released; //If the ball has been released by the player
- //Ball Bounds used in collision detection
- int leftBall;
- int rightBall;
- int topBall;
- int bottomBall;
-} BallState;
-
-typedef struct {
- FuriMutex* mutex;
- BallState ball_state;
- BrickState brick_state;
- NotificationApp* notify;
- unsigned int COLUMNS; //Columns of bricks
- unsigned int ROWS; //Rows of bricks
- bool initialDraw; //If the inital draw has happened
- int xPaddle; //X position of paddle
- char text[16]; //General string buffer
- bool bounced; //Used to fix double bounce glitch
- int lives; //Amount of lives
- int level; //Current level
- unsigned int score; //Score for the game
- unsigned int brickCount; //Amount of bricks hit
- int tick; //Tick counter
- bool gameStarted; // Did the game start?
- int speed; // Ball speed
-} ArkanoidState;
-
-typedef struct {
- EventType type;
- InputEvent input;
-} GameEvent;
-
-static const NotificationSequence sequence_short_sound = {
- &message_note_c5,
- &message_delay_50,
- &message_sound_off,
- NULL,
-};
-
-// generate number in range [min,max)
-int rand_range(int min, int max) {
- return min + rand() % (max - min);
-}
-
-void move_ball(Canvas* canvas, ArkanoidState* st) {
- st->tick++;
-
- int current_speed = abs(st->speed - 1 - MAX_SPEED);
- if(st->tick % current_speed != 0 && st->tick % (current_speed + 1) != 0) {
- return;
- }
-
- if(st->ball_state.released) {
- //Move ball
- if(abs(st->ball_state.dx) == 2) {
- st->ball_state.xb += st->ball_state.dx / 2;
- // 2x speed is really 1.5 speed
- if((st->tick / current_speed) % 2 == 0) st->ball_state.xb += st->ball_state.dx / 2;
- } else {
- st->ball_state.xb += st->ball_state.dx;
- }
- st->ball_state.yb = st->ball_state.yb + st->ball_state.dy;
-
- //Set bounds
- st->ball_state.leftBall = st->ball_state.xb;
- st->ball_state.rightBall = st->ball_state.xb + 2;
- st->ball_state.topBall = st->ball_state.yb;
- st->ball_state.bottomBall = st->ball_state.yb + 2;
-
- //Bounce off top edge
- if(st->ball_state.yb <= 0) {
- st->ball_state.yb = 2;
- st->ball_state.dy = -st->ball_state.dy;
- }
-
- //Lose a life if bottom edge hit
- if(st->ball_state.yb >= FLIPPER_LCD_HEIGHT) {
- canvas_draw_frame(canvas, st->xPaddle, FLIPPER_LCD_HEIGHT - 1, 11, 1);
- st->xPaddle = 54;
- st->ball_state.yb = 60;
- st->ball_state.released = false;
- st->lives--;
- st->gameStarted = false;
-
- if(rand_range(0, 2) == 0) {
- st->ball_state.dx = 1;
- } else {
- st->ball_state.dx = -1;
- }
- }
-
- //Bounce off left side
- if(st->ball_state.xb <= 0) {
- st->ball_state.xb = 2;
- st->ball_state.dx = -st->ball_state.dx;
- }
-
- //Bounce off right side
- if(st->ball_state.xb >= FLIPPER_LCD_WIDTH - 2) {
- st->ball_state.xb = FLIPPER_LCD_WIDTH - 4;
- st->ball_state.dx = -st->ball_state.dx;
- // arduboy.tunes.tone(523, 250);
- }
-
- //Bounce off paddle
- if(st->ball_state.xb + 1 >= st->xPaddle && st->ball_state.xb <= st->xPaddle + 12 &&
- st->ball_state.yb + 2 >= FLIPPER_LCD_HEIGHT - 1 &&
- st->ball_state.yb <= FLIPPER_LCD_HEIGHT) {
- st->ball_state.dy = -st->ball_state.dy;
- st->ball_state.dx =
- ((st->ball_state.xb - (st->xPaddle + 6)) / 3); //Applies spin on the ball
- // prevent straight bounce, but not prevent roguuemaster from stealing
- if(st->ball_state.dx == 0) {
- st->ball_state.dx = (rand_range(0, 2) == 1) ? 1 : -1;
- }
- }
-
- //Bounce off Bricks
- for(unsigned int row = 0; row < st->ROWS; row++) {
- for(unsigned int column = 0; column < st->COLUMNS; column++) {
- if(!st->brick_state.isHit[row][column]) {
- //Sets Brick bounds
- st->brick_state.leftBrick = 10 * column;
- st->brick_state.rightBrick = 10 * column + 10;
- st->brick_state.topBrick = 6 * row + 1;
- st->brick_state.bottomBrick = 6 * row + 7;
-
- //If A collison has occured
- if(st->ball_state.topBall <= st->brick_state.bottomBrick &&
- st->ball_state.bottomBall >= st->brick_state.topBrick &&
- st->ball_state.leftBall <= st->brick_state.rightBrick &&
- st->ball_state.rightBall >= st->brick_state.leftBrick) {
- st->score += st->level;
- // Blink led when we hit some brick
- notification_message(st->notify, &sequence_short_sound);
- //notification_message(st->notify, &sequence_blink_white_100);
-
- st->brickCount++;
- st->brick_state.isHit[row][column] = true;
- canvas_draw_frame(canvas, 10 * column, 2 + 6 * row, 8, 4);
-
- //Vertical collision
- if(st->ball_state.bottomBall > st->brick_state.bottomBrick ||
- st->ball_state.topBall < st->brick_state.topBrick) {
- //Only bounce once each ball move
- if(!st->bounced) {
- st->ball_state.dy = -st->ball_state.dy;
- st->ball_state.yb += st->ball_state.dy;
- st->bounced = true;
- }
- }
-
- //Hoizontal collision
- if(st->ball_state.leftBall < st->brick_state.leftBrick ||
- st->ball_state.rightBall > st->brick_state.rightBrick) {
- //Only bounce once brick each ball move
- if(!st->bounced) {
- st->ball_state.dx = -st->ball_state.dx;
- st->ball_state.xb += st->ball_state.dx;
- st->bounced = true;
- }
- }
- }
- }
- }
- }
-
- //Reset Bounce
- st->bounced = false;
- } else {
- //Ball follows paddle
- st->ball_state.xb = st->xPaddle + 5;
- }
-}
-
-void draw_lives(Canvas* canvas, ArkanoidState* arkanoid_state) {
- if(arkanoid_state->lives == 3) {
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 7);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 7);
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 8);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 8);
-
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 11);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 11);
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 12);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 12);
-
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 15);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 15);
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 16);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 16);
- } else if(arkanoid_state->lives == 2) {
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 7);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 7);
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 8);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 8);
-
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 11);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 11);
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 12);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 12);
- } else {
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 7);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 7);
- canvas_draw_dot(canvas, 4, FLIPPER_LCD_HEIGHT - 8);
- canvas_draw_dot(canvas, 3, FLIPPER_LCD_HEIGHT - 8);
- }
-}
-
-void draw_score(Canvas* canvas, ArkanoidState* arkanoid_state) {
- snprintf(arkanoid_state->text, sizeof(arkanoid_state->text), "%u", arkanoid_state->score);
- canvas_draw_str_aligned(
- canvas,
- FLIPPER_LCD_WIDTH - 2,
- FLIPPER_LCD_HEIGHT - 6,
- AlignRight,
- AlignBottom,
- arkanoid_state->text);
-}
-
-void draw_ball(Canvas* canvas, ArkanoidState* ast) {
- canvas_draw_dot(canvas, ast->ball_state.xb, ast->ball_state.yb);
- canvas_draw_dot(canvas, ast->ball_state.xb + 1, ast->ball_state.yb);
- canvas_draw_dot(canvas, ast->ball_state.xb, ast->ball_state.yb + 1);
- canvas_draw_dot(canvas, ast->ball_state.xb + 1, ast->ball_state.yb + 1);
-
- move_ball(canvas, ast);
-}
-
-void draw_paddle(Canvas* canvas, ArkanoidState* arkanoid_state) {
- canvas_draw_frame(canvas, arkanoid_state->xPaddle, FLIPPER_LCD_HEIGHT - 1, 11, 1);
-}
-
-void reset_level(Canvas* canvas, ArkanoidState* arkanoid_state) {
- //Undraw paddle
- canvas_draw_frame(canvas, arkanoid_state->xPaddle, FLIPPER_LCD_HEIGHT - 1, 11, 1);
-
- //Undraw ball
- canvas_draw_dot(canvas, arkanoid_state->ball_state.xb, arkanoid_state->ball_state.yb);
- canvas_draw_dot(canvas, arkanoid_state->ball_state.xb + 1, arkanoid_state->ball_state.yb);
- canvas_draw_dot(canvas, arkanoid_state->ball_state.xb, arkanoid_state->ball_state.yb + 1);
- canvas_draw_dot(canvas, arkanoid_state->ball_state.xb + 1, arkanoid_state->ball_state.yb + 1);
-
- //Alter various variables to reset the game
- arkanoid_state->xPaddle = 54;
- arkanoid_state->ball_state.yb = 60;
- arkanoid_state->brickCount = 0;
- arkanoid_state->ball_state.released = false;
- arkanoid_state->gameStarted = false;
-
- // Reset all brick hit states
- for(unsigned int row = 0; row < arkanoid_state->ROWS; row++) {
- for(unsigned int column = 0; column < arkanoid_state->COLUMNS; column++) {
- arkanoid_state->brick_state.isHit[row][column] = false;
- }
- }
-}
-
-static void arkanoid_state_init(ArkanoidState* arkanoid_state) {
- // Init notification
- arkanoid_state->notify = furi_record_open(RECORD_NOTIFICATION);
-
- // Set the initial game state
- arkanoid_state->COLUMNS = 13;
- arkanoid_state->ROWS = 4;
- arkanoid_state->ball_state.dx = -1;
- arkanoid_state->ball_state.dy = -1;
- arkanoid_state->speed = 2;
- arkanoid_state->bounced = false;
- arkanoid_state->lives = 3;
- arkanoid_state->level = 1;
- arkanoid_state->score = 0;
- arkanoid_state->COLUMNS = 13;
- arkanoid_state->COLUMNS = 13;
-
- // Reset initial state
- arkanoid_state->initialDraw = false;
- arkanoid_state->gameStarted = false;
-}
-
-static void arkanoid_draw_callback(Canvas* const canvas, void* ctx) {
- furi_assert(ctx);
- ArkanoidState* arkanoid_state = ctx;
- furi_mutex_acquire(arkanoid_state->mutex, FuriWaitForever);
-
- //Initial level draw
- if(!arkanoid_state->initialDraw) {
- arkanoid_state->initialDraw = true;
-
- // Set default font for text
- canvas_set_font(canvas, FontSecondary);
-
- //Draws the new level
- reset_level(canvas, arkanoid_state);
- }
-
- //Draws new bricks and resets their values
- for(unsigned int row = 0; row < arkanoid_state->ROWS; row++) {
- for(unsigned int column = 0; column < arkanoid_state->COLUMNS; column++) {
- if(!arkanoid_state->brick_state.isHit[row][column]) {
- canvas_draw_frame(canvas, 10 * column, 2 + 6 * row, 8, 4);
- }
- }
- }
-
- if(arkanoid_state->lives > 0) {
- draw_paddle(canvas, arkanoid_state);
- draw_ball(canvas, arkanoid_state);
- draw_score(canvas, arkanoid_state);
- draw_lives(canvas, arkanoid_state);
-
- if(arkanoid_state->brickCount == arkanoid_state->ROWS * arkanoid_state->COLUMNS) {
- arkanoid_state->level++;
- reset_level(canvas, arkanoid_state);
- }
- } else {
- reset_level(canvas, arkanoid_state);
- arkanoid_state->initialDraw = false;
- arkanoid_state->lives = 3;
- arkanoid_state->score = 0;
- }
-
- furi_mutex_release(arkanoid_state->mutex);
-}
-
-static void arkanoid_input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
- furi_assert(event_queue);
-
- GameEvent event = {.type = EventTypeKey, .input = *input_event};
- furi_message_queue_put(event_queue, &event, FuriWaitForever);
-}
-
-static void arkanoid_update_timer_callback(FuriMessageQueue* event_queue) {
- furi_assert(event_queue);
-
- GameEvent event = {.type = EventTypeTick};
- furi_message_queue_put(event_queue, &event, 0);
-}
-
-int32_t arkanoid_game_app(void* p) {
- UNUSED(p);
- int32_t return_code = 0;
-
- FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(GameEvent));
-
- ArkanoidState* arkanoid_state = malloc(sizeof(ArkanoidState));
- arkanoid_state_init(arkanoid_state);
-
- arkanoid_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
- if(!arkanoid_state->mutex) {
- FURI_LOG_E(TAG, "Cannot create mutex\r\n");
- return_code = 255;
- goto free_and_exit;
- }
-
- // Set system callbacks
- ViewPort* view_port = view_port_alloc();
- view_port_draw_callback_set(view_port, arkanoid_draw_callback, arkanoid_state);
- view_port_input_callback_set(view_port, arkanoid_input_callback, event_queue);
-
- FuriTimer* timer =
- furi_timer_alloc(arkanoid_update_timer_callback, FuriTimerTypePeriodic, event_queue);
- furi_timer_start(timer, furi_kernel_get_tick_frequency() / 22);
-
- // Open GUI and register view_port
- Gui* gui = furi_record_open(RECORD_GUI);
- gui_add_view_port(gui, view_port, GuiLayerFullscreen);
-
- // Call dolphin deed on game start
- dolphin_deed(DolphinDeedPluginGameStart);
-
- GameEvent event;
- for(bool processing = true; processing;) {
- FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
- furi_mutex_acquire(arkanoid_state->mutex, FuriWaitForever);
-
- if(event_status == FuriStatusOk) {
- // Key events
- if(event.type == EventTypeKey) {
- if(event.input.type == InputTypePress || event.input.type == InputTypeLong ||
- event.input.type == InputTypeRepeat) {
- switch(event.input.key) {
- case InputKeyBack:
- processing = false;
- break;
- case InputKeyRight:
- if(arkanoid_state->xPaddle < FLIPPER_LCD_WIDTH - 12) {
- arkanoid_state->xPaddle += 8;
- }
- break;
- case InputKeyLeft:
- if(arkanoid_state->xPaddle > 0) {
- arkanoid_state->xPaddle -= 8;
- }
- break;
- case InputKeyUp:
- if(arkanoid_state->speed < MAX_SPEED) {
- arkanoid_state->speed++;
- }
- break;
- case InputKeyDown:
- if(arkanoid_state->speed > 1) {
- arkanoid_state->speed--;
- }
- break;
- case InputKeyOk:
- if(arkanoid_state->gameStarted == false) {
- //Release ball if FIRE pressed
- arkanoid_state->ball_state.released = true;
-
- //Apply random direction to ball on release
- if(rand_range(0, 2) == 0) {
- arkanoid_state->ball_state.dx = 1;
- } else {
- arkanoid_state->ball_state.dx = -1;
- }
-
- //Makes sure the ball heads upwards
- arkanoid_state->ball_state.dy = -1;
- //start the game flag
- arkanoid_state->gameStarted = true;
- }
- break;
- default:
- break;
- }
- }
- }
- }
-
- view_port_update(view_port);
- furi_mutex_release(arkanoid_state->mutex);
- }
- furi_timer_free(timer);
- view_port_enabled_set(view_port, false);
- gui_remove_view_port(gui, view_port);
- furi_record_close(RECORD_GUI);
- furi_record_close(RECORD_NOTIFICATION);
- view_port_free(view_port);
- furi_mutex_free(arkanoid_state->mutex);
-
-free_and_exit:
- free(arkanoid_state);
- furi_message_queue_free(event_queue);
-
- return return_code;
-}
diff --git a/applications/external/avr_isp_programmer/application.fam b/applications/external/avr_isp_programmer/application.fam
deleted file mode 100644
index 19556d03d..000000000
--- a/applications/external/avr_isp_programmer/application.fam
+++ /dev/null
@@ -1,17 +0,0 @@
-App(
- appid="avr_isp",
- name="AVR Flasher",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="avr_isp_app",
- requires=["gui"],
- stack_size=4 * 1024,
- order=20,
- fap_icon="avr_app_icon_10x10.png",
- fap_category="GPIO",
- fap_icon_assets="images",
- fap_private_libs=[
- Lib(
- name="driver",
- ),
- ],
-)
diff --git a/applications/external/avr_isp_programmer/avr_app_icon_10x10.png b/applications/external/avr_isp_programmer/avr_app_icon_10x10.png
deleted file mode 100644
index 533787fe3..000000000
Binary files a/applications/external/avr_isp_programmer/avr_app_icon_10x10.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/avr_isp_app.c b/applications/external/avr_isp_programmer/avr_isp_app.c
deleted file mode 100644
index 740dc3610..000000000
--- a/applications/external/avr_isp_programmer/avr_isp_app.c
+++ /dev/null
@@ -1,179 +0,0 @@
-#include "avr_isp_app_i.h"
-
-static bool avr_isp_app_custom_event_callback(void* context, uint32_t event) {
- furi_assert(context);
- AvrIspApp* app = context;
- return scene_manager_handle_custom_event(app->scene_manager, event);
-}
-
-static bool avr_isp_app_back_event_callback(void* context) {
- furi_assert(context);
- AvrIspApp* app = context;
- return scene_manager_handle_back_event(app->scene_manager);
-}
-
-static void avr_isp_app_tick_event_callback(void* context) {
- furi_assert(context);
- AvrIspApp* app = context;
- scene_manager_handle_tick_event(app->scene_manager);
-}
-
-AvrIspApp* avr_isp_app_alloc() {
- AvrIspApp* app = malloc(sizeof(AvrIspApp));
-
- app->file_path = furi_string_alloc();
- furi_string_set(app->file_path, STORAGE_APP_DATA_PATH_PREFIX);
- app->error = AvrIspErrorNoError;
-
- // GUI
- app->gui = furi_record_open(RECORD_GUI);
-
- // View Dispatcher
- app->view_dispatcher = view_dispatcher_alloc();
- app->scene_manager = scene_manager_alloc(&avr_isp_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, avr_isp_app_custom_event_callback);
- view_dispatcher_set_navigation_event_callback(
- app->view_dispatcher, avr_isp_app_back_event_callback);
- view_dispatcher_set_tick_event_callback(
- app->view_dispatcher, avr_isp_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, AvrIspViewSubmenu, submenu_get_view(app->submenu));
-
- // Widget
- app->widget = widget_alloc();
- view_dispatcher_add_view(app->view_dispatcher, AvrIspViewWidget, widget_get_view(app->widget));
-
- // Text Input
- app->text_input = text_input_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, AvrIspViewTextInput, text_input_get_view(app->text_input));
-
- // Popup
- app->popup = popup_alloc();
- view_dispatcher_add_view(app->view_dispatcher, AvrIspViewPopup, popup_get_view(app->popup));
-
- //Dialog
- app->dialogs = furi_record_open(RECORD_DIALOGS);
-
- // Programmer view
- app->avr_isp_programmer_view = avr_isp_programmer_view_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- AvrIspViewProgrammer,
- avr_isp_programmer_view_get_view(app->avr_isp_programmer_view));
-
- // Reader view
- app->avr_isp_reader_view = avr_isp_reader_view_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- AvrIspViewReader,
- avr_isp_reader_view_get_view(app->avr_isp_reader_view));
-
- // Writer view
- app->avr_isp_writer_view = avr_isp_writer_view_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- AvrIspViewWriter,
- avr_isp_writer_view_get_view(app->avr_isp_writer_view));
-
- // Chip detect view
- app->avr_isp_chip_detect_view = avr_isp_chip_detect_view_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- AvrIspViewChipDetect,
- avr_isp_chip_detect_view_get_view(app->avr_isp_chip_detect_view));
-
- // Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
- uint8_t attempts = 0;
- while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
- furi_hal_power_enable_otg();
- furi_delay_ms(10);
- }
-
- scene_manager_next_scene(app->scene_manager, AvrIspSceneStart);
-
- return app;
-} //-V773
-
-void avr_isp_app_free(AvrIspApp* app) {
- furi_assert(app);
-
- // Disable 5v power
- if(furi_hal_power_is_otg_enabled()) {
- furi_hal_power_disable_otg();
- }
-
- // Submenu
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewSubmenu);
- submenu_free(app->submenu);
-
- // Widget
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewWidget);
- widget_free(app->widget);
-
- // TextInput
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewTextInput);
- text_input_free(app->text_input);
-
- // Popup
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewPopup);
- popup_free(app->popup);
-
- //Dialog
- furi_record_close(RECORD_DIALOGS);
-
- // Programmer view
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewProgrammer);
- avr_isp_programmer_view_free(app->avr_isp_programmer_view);
-
- // Reader view
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewReader);
- avr_isp_reader_view_free(app->avr_isp_reader_view);
-
- // Writer view
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewWriter);
- avr_isp_writer_view_free(app->avr_isp_writer_view);
-
- // Chip detect view
- view_dispatcher_remove_view(app->view_dispatcher, AvrIspViewChipDetect);
- avr_isp_chip_detect_view_free(app->avr_isp_chip_detect_view);
-
- // View dispatcher
- view_dispatcher_free(app->view_dispatcher);
- scene_manager_free(app->scene_manager);
-
- // 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 avr_isp_app(void* p) {
- UNUSED(p);
- AvrIspApp* avr_isp_app = avr_isp_app_alloc();
-
- view_dispatcher_run(avr_isp_app->view_dispatcher);
-
- avr_isp_app_free(avr_isp_app);
-
- return 0;
-}
diff --git a/applications/external/avr_isp_programmer/avr_isp_app_i.c b/applications/external/avr_isp_programmer/avr_isp_app_i.c
deleted file mode 100644
index 7a7fa6d7f..000000000
--- a/applications/external/avr_isp_programmer/avr_isp_app_i.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "avr_isp_app_i.h"
-#include
-#include
-
-#define TAG "AvrIsp"
-
-bool avr_isp_load_from_file(AvrIspApp* app) {
- furi_assert(app);
-
- FuriString* file_path = furi_string_alloc();
- FuriString* file_name = furi_string_alloc();
-
- DialogsFileBrowserOptions browser_options;
- dialog_file_browser_set_basic_options(
- &browser_options, AVR_ISP_APP_EXTENSION, &I_avr_app_icon_10x10);
- browser_options.base_path = STORAGE_APP_DATA_PATH_PREFIX;
-
- // Input events and views are managed by file_select
- bool res = dialog_file_browser_show(app->dialogs, file_path, app->file_path, &browser_options);
-
- if(res) {
- path_extract_dirname(furi_string_get_cstr(file_path), app->file_path);
- path_extract_filename(file_path, file_name, true);
- strncpy(app->file_name_tmp, furi_string_get_cstr(file_name), AVR_ISP_MAX_LEN_NAME);
- }
-
- furi_string_free(file_name);
- furi_string_free(file_path);
-
- return res;
-}
diff --git a/applications/external/avr_isp_programmer/avr_isp_app_i.h b/applications/external/avr_isp_programmer/avr_isp_app_i.h
deleted file mode 100644
index 17c69f8f2..000000000
--- a/applications/external/avr_isp_programmer/avr_isp_app_i.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-#include "helpers/avr_isp_types.h"
-#include
-
-#include "scenes/avr_isp_scene.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "views/avr_isp_view_programmer.h"
-#include "views/avr_isp_view_reader.h"
-#include "views/avr_isp_view_writer.h"
-#include "views/avr_isp_view_chip_detect.h"
-
-#define AVR_ISP_MAX_LEN_NAME 64
-
-typedef struct {
- Gui* gui;
- ViewDispatcher* view_dispatcher;
- SceneManager* scene_manager;
- NotificationApp* notifications;
- DialogsApp* dialogs;
- Popup* popup;
- Submenu* submenu;
- Widget* widget;
- TextInput* text_input;
- FuriString* file_path;
- char file_name_tmp[AVR_ISP_MAX_LEN_NAME];
- AvrIspProgrammerView* avr_isp_programmer_view;
- AvrIspReaderView* avr_isp_reader_view;
- AvrIspWriterView* avr_isp_writer_view;
- AvrIspChipDetectView* avr_isp_chip_detect_view;
- AvrIspError error;
-} AvrIspApp;
-
-bool avr_isp_load_from_file(AvrIspApp* app);
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp.c b/applications/external/avr_isp_programmer/helpers/avr_isp.c
deleted file mode 100644
index 283c17bfd..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp.c
+++ /dev/null
@@ -1,496 +0,0 @@
-#include "avr_isp.h"
-#include "../lib/driver/avr_isp_prog_cmd.h"
-#include "../lib/driver/avr_isp_spi_sw.h"
-
-#include
-
-#define AVR_ISP_PROG_TX_RX_BUF_SIZE 320
-#define TAG "AvrIsp"
-
-struct AvrIsp {
- AvrIspSpiSw* spi;
- bool pmode;
- AvrIspCallback callback;
- void* context;
-};
-
-AvrIsp* avr_isp_alloc(void) {
- AvrIsp* instance = malloc(sizeof(AvrIsp));
- return instance;
-}
-
-void avr_isp_free(AvrIsp* instance) {
- furi_assert(instance);
-
- if(instance->spi) avr_isp_end_pmode(instance);
- free(instance);
-}
-
-void avr_isp_set_tx_callback(AvrIsp* instance, AvrIspCallback callback, void* context) {
- furi_assert(instance);
- furi_assert(context);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-uint8_t avr_isp_spi_transaction(
- AvrIsp* instance,
- uint8_t cmd,
- uint8_t addr_hi,
- uint8_t addr_lo,
- uint8_t data) {
- furi_assert(instance);
-
- avr_isp_spi_sw_txrx(instance->spi, cmd);
- avr_isp_spi_sw_txrx(instance->spi, addr_hi);
- avr_isp_spi_sw_txrx(instance->spi, addr_lo);
- return avr_isp_spi_sw_txrx(instance->spi, data);
-}
-
-static bool avr_isp_set_pmode(AvrIsp* instance, uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
- furi_assert(instance);
-
- uint8_t res = 0;
- avr_isp_spi_sw_txrx(instance->spi, a);
- avr_isp_spi_sw_txrx(instance->spi, b);
- res = avr_isp_spi_sw_txrx(instance->spi, c);
- avr_isp_spi_sw_txrx(instance->spi, d);
- return res == 0x53;
-}
-
-void avr_isp_end_pmode(AvrIsp* instance) {
- furi_assert(instance);
-
- if(instance->pmode) {
- avr_isp_spi_sw_res_set(instance->spi, true);
- // We're about to take the target out of reset
- // so configure SPI pins as input
- if(instance->spi) avr_isp_spi_sw_free(instance->spi);
- instance->spi = NULL;
- }
-
- instance->pmode = false;
-}
-
-static bool avr_isp_start_pmode(AvrIsp* instance, AvrIspSpiSwSpeed spi_speed) {
- furi_assert(instance);
-
- // Reset target before driving PIN_SCK or PIN_MOSI
-
- // SPI.begin() will configure SS as output,
- // so SPI master mode is selected.
- // We have defined RESET as pin 10,
- // which for many arduino's is not the SS pin.
- // So we have to configure RESET as output here,
- // (reset_target() first sets the correct level)
- if(instance->spi) avr_isp_spi_sw_free(instance->spi);
- instance->spi = avr_isp_spi_sw_init(spi_speed);
-
- avr_isp_spi_sw_res_set(instance->spi, false);
- // See avr datasheets, chapter "SERIAL_PRG Programming Algorithm":
-
- // Pulse RESET after PIN_SCK is low:
- avr_isp_spi_sw_sck_set(instance->spi, false);
-
- // discharge PIN_SCK, value arbitrally chosen
- furi_delay_ms(20);
- avr_isp_spi_sw_res_set(instance->spi, true);
-
- // Pulse must be minimum 2 target CPU speed cycles
- // so 100 usec is ok for CPU speeds above 20KHz
- furi_delay_ms(1);
-
- avr_isp_spi_sw_res_set(instance->spi, false);
-
- // Send the enable programming command:
- // datasheet: must be > 20 msec
- furi_delay_ms(50);
- if(avr_isp_set_pmode(instance, AVR_ISP_SET_PMODE)) {
- instance->pmode = true;
- return true;
- }
- return false;
-}
-
-bool avr_isp_auto_set_spi_speed_start_pmode(AvrIsp* instance) {
- furi_assert(instance);
-
- AvrIspSpiSwSpeed spi_speed[] = {
- AvrIspSpiSwSpeed1Mhz,
- AvrIspSpiSwSpeed400Khz,
- AvrIspSpiSwSpeed250Khz,
- AvrIspSpiSwSpeed125Khz,
- AvrIspSpiSwSpeed60Khz,
- AvrIspSpiSwSpeed40Khz,
- AvrIspSpiSwSpeed20Khz,
- AvrIspSpiSwSpeed10Khz,
- AvrIspSpiSwSpeed5Khz,
- AvrIspSpiSwSpeed1Khz,
- };
- for(uint8_t i = 0; i < COUNT_OF(spi_speed); i++) {
- if(avr_isp_start_pmode(instance, spi_speed[i])) {
- AvrIspSignature sig = avr_isp_read_signature(instance);
- AvrIspSignature sig_examination = avr_isp_read_signature(instance); //-V656
- uint8_t y = 0;
- while(y < 8) {
- if(memcmp((uint8_t*)&sig, (uint8_t*)&sig_examination, sizeof(AvrIspSignature)) !=
- 0)
- break;
- sig_examination = avr_isp_read_signature(instance);
- y++;
- }
- if(y == 8) {
- if(spi_speed[i] > AvrIspSpiSwSpeed1Mhz) {
- if(i < (COUNT_OF(spi_speed) - 1)) {
- avr_isp_end_pmode(instance);
- i++;
- return avr_isp_start_pmode(instance, spi_speed[i]);
- }
- }
- return true;
- }
- }
- }
-
- if(instance->spi) {
- avr_isp_spi_sw_free(instance->spi);
- instance->spi = NULL;
- }
-
- return false;
-}
-
-static void avr_isp_commit(AvrIsp* instance, uint16_t addr, uint8_t data) {
- furi_assert(instance);
-
- avr_isp_spi_transaction(instance, AVR_ISP_COMMIT(addr));
- /* polling flash */
- if(data == 0xFF) {
- furi_delay_ms(5);
- } else {
- /* polling flash */
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 30) {
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(addr)) != 0xFF) {
- break;
- };
- }
- }
-}
-
-static uint16_t avr_isp_current_page(AvrIsp* instance, uint32_t addr, uint16_t page_size) {
- furi_assert(instance);
-
- uint16_t page = 0;
- switch(page_size) {
- case 32:
- page = addr & 0xFFFFFFF0;
- break;
- case 64:
- page = addr & 0xFFFFFFE0;
- break;
- case 128:
- page = addr & 0xFFFFFFC0;
- break;
- case 256:
- page = addr & 0xFFFFFF80;
- break;
-
- default:
- page = addr;
- break;
- }
-
- return page;
-}
-
-static bool avr_isp_flash_write_pages(
- AvrIsp* instance,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
-
- size_t x = 0;
- uint16_t page = avr_isp_current_page(instance, addr, page_size);
-
- while(x < data_size) {
- if(page != avr_isp_current_page(instance, addr, page_size)) {
- avr_isp_commit(instance, page, data[x - 1]);
- page = avr_isp_current_page(instance, addr, page_size);
- }
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_FLASH_LO(addr, data[x++]));
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_FLASH_HI(addr, data[x++]));
- addr++;
- }
- avr_isp_commit(instance, page, data[x - 1]);
- return true;
-}
-
-bool avr_isp_erase_chip(AvrIsp* instance) {
- furi_assert(instance);
-
- bool ret = false;
- if(!instance->pmode) avr_isp_auto_set_spi_speed_start_pmode(instance);
- if(instance->pmode) {
- avr_isp_spi_transaction(instance, AVR_ISP_ERASE_CHIP);
- furi_delay_ms(100);
- avr_isp_end_pmode(instance);
- ret = true;
- }
- return ret;
-}
-
-static bool
- avr_isp_eeprom_write(AvrIsp* instance, uint16_t addr, uint8_t* data, uint32_t data_size) {
- furi_assert(instance);
-
- for(uint16_t i = 0; i < data_size; i++) {
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_EEPROM(addr, data[i]));
- furi_delay_ms(10);
- addr++;
- }
- return true;
-}
-
-bool avr_isp_write_page(
- AvrIsp* instance,
- uint32_t mem_type,
- uint32_t mem_size,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
-
- bool ret = false;
- switch(mem_type) {
- case STK_SET_FLASH_TYPE:
- if((addr + data_size / 2) <= mem_size) {
- ret = avr_isp_flash_write_pages(instance, addr, page_size, data, data_size);
- }
- break;
-
- case STK_SET_EEPROM_TYPE:
- if((addr + data_size) <= mem_size) {
- ret = avr_isp_eeprom_write(instance, addr, data, data_size);
- }
- break;
-
- default:
- furi_crash(TAG " Incorrect mem type.");
- break;
- }
-
- return ret;
-}
-
-static bool avr_isp_flash_read_page(
- AvrIsp* instance,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
-
- if(page_size > data_size) return false;
- for(uint16_t i = 0; i < page_size; i += 2) {
- data[i] = avr_isp_spi_transaction(instance, AVR_ISP_READ_FLASH_LO(addr));
- data[i + 1] = avr_isp_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(addr));
- addr++;
- }
- return true;
-}
-
-static bool avr_isp_eeprom_read_page(
- AvrIsp* instance,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
-
- if(page_size > data_size) return false;
- for(uint16_t i = 0; i < page_size; i++) {
- data[i] = avr_isp_spi_transaction(instance, AVR_ISP_READ_EEPROM(addr));
- addr++;
- }
- return true;
-}
-
-bool avr_isp_read_page(
- AvrIsp* instance,
- uint32_t mem_type,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
-
- bool res = false;
- if(mem_type == STK_SET_FLASH_TYPE)
- res = avr_isp_flash_read_page(instance, addr, page_size, data, data_size);
- if(mem_type == STK_SET_EEPROM_TYPE)
- res = avr_isp_eeprom_read_page(instance, addr, page_size, data, data_size);
-
- return res;
-}
-
-AvrIspSignature avr_isp_read_signature(AvrIsp* instance) {
- furi_assert(instance);
-
- AvrIspSignature signature;
- signature.vendor = avr_isp_spi_transaction(instance, AVR_ISP_READ_VENDOR);
- signature.part_family = avr_isp_spi_transaction(instance, AVR_ISP_READ_PART_FAMILY);
- signature.part_number = avr_isp_spi_transaction(instance, AVR_ISP_READ_PART_NUMBER);
- return signature;
-}
-
-uint8_t avr_isp_read_lock_byte(AvrIsp* instance) {
- furi_assert(instance);
-
- uint8_t data = 0;
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 300) {
- data = avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE);
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE) == data) {
- break;
- };
- data = 0x00;
- }
- return data;
-}
-
-bool avr_isp_write_lock_byte(AvrIsp* instance, uint8_t lock) {
- furi_assert(instance);
-
- bool ret = false;
- if(avr_isp_read_lock_byte(instance) == lock) {
- ret = true;
- } else {
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_LOCK_BYTE(lock));
- /* polling lock byte */
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 30) {
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE) == lock) {
- ret = true;
- break;
- };
- }
- }
- return ret;
-}
-
-uint8_t avr_isp_read_fuse_low(AvrIsp* instance) {
- furi_assert(instance);
-
- uint8_t data = 0;
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 300) {
- data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW);
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW) == data) {
- break;
- };
- data = 0x00;
- }
- return data;
-}
-
-bool avr_isp_write_fuse_low(AvrIsp* instance, uint8_t lfuse) {
- furi_assert(instance);
-
- bool ret = false;
- if(avr_isp_read_fuse_low(instance) == lfuse) {
- ret = true;
- } else {
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_FUSE_LOW(lfuse));
- /* polling fuse */
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 30) {
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW) == lfuse) {
- ret = true;
- break;
- };
- }
- }
- return ret;
-}
-
-uint8_t avr_isp_read_fuse_high(AvrIsp* instance) {
- furi_assert(instance);
-
- uint8_t data = 0;
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 300) {
- data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH);
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH) == data) {
- break;
- };
- data = 0x00;
- }
- return data;
-}
-
-bool avr_isp_write_fuse_high(AvrIsp* instance, uint8_t hfuse) {
- furi_assert(instance);
-
- bool ret = false;
- if(avr_isp_read_fuse_high(instance) == hfuse) {
- ret = true;
- } else {
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_FUSE_HIGH(hfuse));
- /* polling fuse */
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 30) {
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH) == hfuse) {
- ret = true;
- break;
- };
- }
- }
- return ret;
-}
-
-uint8_t avr_isp_read_fuse_extended(AvrIsp* instance) {
- furi_assert(instance);
-
- uint8_t data = 0;
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 300) {
- data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED);
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED) == data) {
- break;
- };
- data = 0x00;
- }
- return data;
-}
-
-bool avr_isp_write_fuse_extended(AvrIsp* instance, uint8_t efuse) {
- furi_assert(instance);
-
- bool ret = false;
- if(avr_isp_read_fuse_extended(instance) == efuse) {
- ret = true;
- } else {
- avr_isp_spi_transaction(instance, AVR_ISP_WRITE_FUSE_EXTENDED(efuse));
- /* polling fuse */
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 30) {
- if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED) == efuse) {
- ret = true;
- break;
- };
- }
- }
- return ret;
-}
-
-void avr_isp_write_extended_addr(AvrIsp* instance, uint8_t extended_addr) {
- furi_assert(instance);
-
- avr_isp_spi_transaction(instance, AVR_ISP_EXTENDED_ADDR(extended_addr));
- furi_delay_ms(10);
-}
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp.h b/applications/external/avr_isp_programmer/helpers/avr_isp.h
deleted file mode 100644
index 476fc3d64..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct AvrIsp AvrIsp;
-typedef void (*AvrIspCallback)(void* context);
-
-struct AvrIspSignature {
- uint8_t vendor;
- uint8_t part_family;
- uint8_t part_number;
-};
-
-typedef struct AvrIspSignature AvrIspSignature;
-
-AvrIsp* avr_isp_alloc(void);
-
-void avr_isp_free(AvrIsp* instance);
-
-void avr_isp_set_tx_callback(AvrIsp* instance, AvrIspCallback callback, void* context);
-
-bool avr_isp_auto_set_spi_speed_start_pmode(AvrIsp* instance);
-
-AvrIspSignature avr_isp_read_signature(AvrIsp* instance);
-
-void avr_isp_end_pmode(AvrIsp* instance);
-
-bool avr_isp_erase_chip(AvrIsp* instance);
-
-uint8_t avr_isp_spi_transaction(
- AvrIsp* instance,
- uint8_t cmd,
- uint8_t addr_hi,
- uint8_t addr_lo,
- uint8_t data);
-
-bool avr_isp_read_page(
- AvrIsp* instance,
- uint32_t memtype,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size);
-
-bool avr_isp_write_page(
- AvrIsp* instance,
- uint32_t mem_type,
- uint32_t mem_size,
- uint16_t addr,
- uint16_t page_size,
- uint8_t* data,
- uint32_t data_size);
-
-uint8_t avr_isp_read_lock_byte(AvrIsp* instance);
-
-bool avr_isp_write_lock_byte(AvrIsp* instance, uint8_t lock);
-
-uint8_t avr_isp_read_fuse_low(AvrIsp* instance);
-
-bool avr_isp_write_fuse_low(AvrIsp* instance, uint8_t lfuse);
-
-uint8_t avr_isp_read_fuse_high(AvrIsp* instance);
-
-bool avr_isp_write_fuse_high(AvrIsp* instance, uint8_t hfuse);
-
-uint8_t avr_isp_read_fuse_extended(AvrIsp* instance);
-
-bool avr_isp_write_fuse_extended(AvrIsp* instance, uint8_t efuse);
-
-void avr_isp_write_extended_addr(AvrIsp* instance, uint8_t extended_addr);
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_event.h b/applications/external/avr_isp_programmer/helpers/avr_isp_event.h
deleted file mode 100644
index c704b5b35..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp_event.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-typedef enum {
- //SubmenuIndex
- SubmenuIndexAvrIspProgrammer = 10,
- SubmenuIndexAvrIspReader,
- SubmenuIndexAvrIspWriter,
- SubmenuIndexAvrIsWiring,
- SubmenuIndexAvrIspAbout,
-
- //AvrIspCustomEvent
- AvrIspCustomEventSceneChipDetectOk = 100,
- AvrIspCustomEventSceneReadingOk,
- AvrIspCustomEventSceneWritingOk,
- AvrIspCustomEventSceneErrorVerification,
- AvrIspCustomEventSceneErrorReading,
- AvrIspCustomEventSceneErrorWriting,
- AvrIspCustomEventSceneErrorWritingFuse,
- AvrIspCustomEventSceneInputName,
- AvrIspCustomEventSceneSuccess,
- AvrIspCustomEventSceneExit,
- AvrIspCustomEventSceneExitStartMenu,
-} AvrIspCustomEvent;
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_types.h b/applications/external/avr_isp_programmer/helpers/avr_isp_types.h
deleted file mode 100644
index 5e174ec3b..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp_types.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#pragma once
-
-#include
-#include
-
-#define AVR_ISP_VERSION_APP "0.1"
-#define AVR_ISP_DEVELOPED "SkorP"
-#define AVR_ISP_GITHUB "https://github.com/flipperdevices/flipperzero-firmware"
-
-#define AVR_ISP_APP_FILE_VERSION 1
-#define AVR_ISP_APP_FILE_TYPE "Flipper Dump AVR"
-#define AVR_ISP_APP_EXTENSION ".avr"
-
-typedef enum {
- //AvrIspViewVariableItemList,
- AvrIspViewSubmenu,
- AvrIspViewProgrammer,
- AvrIspViewReader,
- AvrIspViewWriter,
- AvrIspViewWidget,
- AvrIspViewPopup,
- AvrIspViewTextInput,
- AvrIspViewChipDetect,
-} AvrIspView;
-
-typedef enum {
- AvrIspErrorNoError,
- AvrIspErrorReading,
- AvrIspErrorWriting,
- AvrIspErrorVerification,
- AvrIspErrorWritingFuse,
-} AvrIspError;
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_worker.c b/applications/external/avr_isp_programmer/helpers/avr_isp_worker.c
deleted file mode 100644
index dfe1f43c2..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp_worker.c
+++ /dev/null
@@ -1,266 +0,0 @@
-#include "avr_isp_worker.h"
-#include
-#include "../lib/driver/avr_isp_prog.h"
-#include "../lib/driver/avr_isp_prog_cmd.h"
-#include "../lib/driver/avr_isp_chip_arr.h"
-
-#include
-
-#define TAG "AvrIspWorker"
-
-typedef enum {
- AvrIspWorkerEvtStop = (1 << 0),
-
- AvrIspWorkerEvtRx = (1 << 1),
- AvrIspWorkerEvtTxCoplete = (1 << 2),
- AvrIspWorkerEvtTx = (1 << 3),
- AvrIspWorkerEvtState = (1 << 4),
-
- //AvrIspWorkerEvtCfg = (1 << 5),
-
-} AvrIspWorkerEvt;
-
-struct AvrIspWorker {
- FuriThread* thread;
- volatile bool worker_running;
- uint8_t connect_usb;
- AvrIspWorkerCallback callback;
- void* context;
-};
-
-#define AVR_ISP_WORKER_PROG_ALL_EVENTS (AvrIspWorkerEvtStop)
-#define AVR_ISP_WORKER_ALL_EVENTS \
- (AvrIspWorkerEvtTx | AvrIspWorkerEvtTxCoplete | AvrIspWorkerEvtRx | AvrIspWorkerEvtStop | \
- AvrIspWorkerEvtState)
-
-//########################/* VCP CDC */#############################################
-#include "usb_cdc.h"
-#include
-#include
-#include
-
-#define AVR_ISP_VCP_CDC_CH 1
-#define AVR_ISP_VCP_CDC_PKT_LEN CDC_DATA_SZ
-#define AVR_ISP_VCP_UART_RX_BUF_SIZE (AVR_ISP_VCP_CDC_PKT_LEN * 5)
-
-static void vcp_on_cdc_tx_complete(void* context);
-static void vcp_on_cdc_rx(void* context);
-static void vcp_state_callback(void* context, uint8_t state);
-static void vcp_on_cdc_control_line(void* context, uint8_t state);
-static void vcp_on_line_config(void* context, struct usb_cdc_line_coding* config);
-
-static const CdcCallbacks cdc_cb = {
- vcp_on_cdc_tx_complete,
- vcp_on_cdc_rx,
- vcp_state_callback,
- vcp_on_cdc_control_line,
- vcp_on_line_config,
-};
-
-/* VCP callbacks */
-
-static void vcp_on_cdc_tx_complete(void* context) {
- furi_assert(context);
- AvrIspWorker* instance = context;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerEvtTxCoplete);
-}
-
-static void vcp_on_cdc_rx(void* context) {
- furi_assert(context);
- AvrIspWorker* instance = context;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerEvtRx);
-}
-
-static void vcp_state_callback(void* context, uint8_t state) {
- UNUSED(context);
-
- AvrIspWorker* instance = context;
- instance->connect_usb = state;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerEvtState);
-}
-
-static void vcp_on_cdc_control_line(void* context, uint8_t state) {
- UNUSED(context);
- UNUSED(state);
-}
-
-static void vcp_on_line_config(void* context, struct usb_cdc_line_coding* config) {
- UNUSED(context);
- UNUSED(config);
-}
-
-static void avr_isp_worker_vcp_cdc_init(void* context) {
- furi_hal_usb_unlock();
- Cli* cli = furi_record_open(RECORD_CLI);
- //close cli
- cli_session_close(cli);
- //disable callbacks VCP_CDC=0
- furi_hal_cdc_set_callbacks(0, NULL, NULL);
- //set 2 cdc
- furi_check(furi_hal_usb_set_config(&usb_cdc_dual, NULL) == true);
- //open cli VCP_CDC=0
- cli_session_open(cli, &cli_vcp);
- furi_record_close(RECORD_CLI);
-
- furi_hal_cdc_set_callbacks(AVR_ISP_VCP_CDC_CH, (CdcCallbacks*)&cdc_cb, context);
-}
-
-static void avr_isp_worker_vcp_cdc_deinit(void) {
- //disable callbacks AVR_ISP_VCP_CDC_CH
- furi_hal_cdc_set_callbacks(AVR_ISP_VCP_CDC_CH, NULL, NULL);
-
- Cli* cli = furi_record_open(RECORD_CLI);
- //close cli
- cli_session_close(cli);
- furi_hal_usb_unlock();
- //set 1 cdc
- furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
- //open cli VCP_CDC=0
- cli_session_open(cli, &cli_vcp);
- furi_record_close(RECORD_CLI);
-}
-
-//#################################################################################
-
-static int32_t avr_isp_worker_prog_thread(void* context) {
- AvrIspProg* prog = context;
- FURI_LOG_D(TAG, "AvrIspProgWorker Start");
- while(1) {
- if(furi_thread_flags_get() & AvrIspWorkerEvtStop) break;
- avr_isp_prog_avrisp(prog);
- }
- FURI_LOG_D(TAG, "AvrIspProgWorker Stop");
- return 0;
-}
-
-static void avr_isp_worker_prog_tx_data(void* context) {
- furi_assert(context);
- AvrIspWorker* instance = context;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerEvtTx);
-}
-
-/** Worker thread
- *
- * @param context
- * @return exit code
- */
-static int32_t avr_isp_worker_thread(void* context) {
- AvrIspWorker* instance = context;
- avr_isp_worker_vcp_cdc_init(instance);
-
- /* start PWM on &gpio_ext_pa4 */
- furi_hal_pwm_start(FuriHalPwmOutputIdLptim2PA4, 4000000, 50);
-
- AvrIspProg* prog = avr_isp_prog_init();
- avr_isp_prog_set_tx_callback(prog, avr_isp_worker_prog_tx_data, instance);
-
- uint8_t buf[AVR_ISP_VCP_UART_RX_BUF_SIZE];
- size_t len = 0;
-
- FuriThread* prog_thread =
- furi_thread_alloc_ex("AvrIspProgWorker", 1024, avr_isp_worker_prog_thread, prog);
- furi_thread_start(prog_thread);
-
- FURI_LOG_D(TAG, "Start");
-
- while(instance->worker_running) {
- uint32_t events =
- furi_thread_flags_wait(AVR_ISP_WORKER_ALL_EVENTS, FuriFlagWaitAny, FuriWaitForever);
-
- if(events & AvrIspWorkerEvtRx) {
- if(avr_isp_prog_spaces_rx(prog) >= AVR_ISP_VCP_CDC_PKT_LEN) {
- len = furi_hal_cdc_receive(AVR_ISP_VCP_CDC_CH, buf, AVR_ISP_VCP_CDC_PKT_LEN);
- // for(uint8_t i = 0; i < len; i++) {
- // FURI_LOG_I(TAG, "--> %X", buf[i]);
- // }
- avr_isp_prog_rx(prog, buf, len);
- } else {
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerEvtRx);
- }
- }
-
- if((events & AvrIspWorkerEvtTxCoplete) || (events & AvrIspWorkerEvtTx)) {
- len = avr_isp_prog_tx(prog, buf, AVR_ISP_VCP_CDC_PKT_LEN);
-
- // for(uint8_t i = 0; i < len; i++) {
- // FURI_LOG_I(TAG, "<-- %X", buf[i]);
- // }
-
- if(len > 0) furi_hal_cdc_send(AVR_ISP_VCP_CDC_CH, buf, len);
- }
-
- if(events & AvrIspWorkerEvtStop) {
- break;
- }
-
- if(events & AvrIspWorkerEvtState) {
- if(instance->callback)
- instance->callback(instance->context, (bool)instance->connect_usb);
- }
- }
-
- FURI_LOG_D(TAG, "Stop");
-
- furi_thread_flags_set(furi_thread_get_id(prog_thread), AvrIspWorkerEvtStop);
- avr_isp_prog_exit(prog);
- furi_delay_ms(10);
- furi_thread_join(prog_thread);
- furi_thread_free(prog_thread);
-
- avr_isp_prog_free(prog);
- furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
- avr_isp_worker_vcp_cdc_deinit();
- return 0;
-}
-
-AvrIspWorker* avr_isp_worker_alloc(void* context) {
- furi_assert(context);
- UNUSED(context);
- AvrIspWorker* instance = malloc(sizeof(AvrIspWorker));
-
- instance->thread = furi_thread_alloc_ex("AvrIspWorker", 2048, avr_isp_worker_thread, instance);
- return instance;
-}
-
-void avr_isp_worker_free(AvrIspWorker* instance) {
- furi_assert(instance);
-
- furi_check(!instance->worker_running);
- furi_thread_free(instance->thread);
- free(instance);
-}
-
-void avr_isp_worker_set_callback(
- AvrIspWorker* instance,
- AvrIspWorkerCallback callback,
- void* context) {
- furi_assert(instance);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-void avr_isp_worker_start(AvrIspWorker* instance) {
- furi_assert(instance);
- furi_assert(!instance->worker_running);
-
- instance->worker_running = true;
-
- furi_thread_start(instance->thread);
-}
-
-void avr_isp_worker_stop(AvrIspWorker* instance) {
- furi_assert(instance);
- furi_assert(instance->worker_running);
-
- instance->worker_running = false;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerEvtStop);
-
- furi_thread_join(instance->thread);
-}
-
-bool avr_isp_worker_is_running(AvrIspWorker* instance) {
- furi_assert(instance);
-
- return instance->worker_running;
-}
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_worker.h b/applications/external/avr_isp_programmer/helpers/avr_isp_worker.h
deleted file mode 100644
index cd9897dff..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp_worker.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct AvrIspWorker AvrIspWorker;
-
-typedef void (*AvrIspWorkerCallback)(void* context, bool connect_usb);
-
-/** Allocate AvrIspWorker
- *
- * @param context AvrIsp* context
- * @return AvrIspWorker*
- */
-AvrIspWorker* avr_isp_worker_alloc(void* context);
-
-/** Free AvrIspWorker
- *
- * @param instance AvrIspWorker instance
- */
-void avr_isp_worker_free(AvrIspWorker* instance);
-
-/** Callback AvrIspWorker
- *
- * @param instance AvrIspWorker instance
- * @param callback AvrIspWorkerOverrunCallback callback
- * @param context
- */
-void avr_isp_worker_set_callback(
- AvrIspWorker* instance,
- AvrIspWorkerCallback callback,
- void* context);
-
-/** Start AvrIspWorker
- *
- * @param instance AvrIspWorker instance
- */
-void avr_isp_worker_start(AvrIspWorker* instance);
-
-/** Stop AvrIspWorker
- *
- * @param instance AvrIspWorker instance
- */
-void avr_isp_worker_stop(AvrIspWorker* instance);
-
-/** Check if worker is running
- * @param instance AvrIspWorker instance
- * @return bool - true if running
- */
-bool avr_isp_worker_is_running(AvrIspWorker* instance);
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c b/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c
deleted file mode 100644
index 121f08565..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.c
+++ /dev/null
@@ -1,1157 +0,0 @@
-#include "avr_isp_worker_rw.h"
-#include
-#include "avr_isp_types.h"
-#include "avr_isp.h"
-#include "../lib/driver/avr_isp_prog_cmd.h"
-#include "../lib/driver/avr_isp_chip_arr.h"
-
-#include "flipper_i32hex_file.h"
-#include
-
-#include
-
-#define TAG "AvrIspWorkerRW"
-
-#define NAME_PATERN_FLASH_FILE "flash.hex"
-#define NAME_PATERN_EEPROM_FILE "eeprom.hex"
-
-struct AvrIspWorkerRW {
- AvrIsp* avr_isp;
- FuriThread* thread;
- volatile bool worker_running;
-
- uint32_t chip_arr_ind;
- bool chip_detect;
- uint8_t lfuse;
- uint8_t hfuse;
- uint8_t efuse;
- uint8_t lock;
- float progress_flash;
- float progress_eeprom;
- const char* file_path;
- const char* file_name;
- AvrIspSignature signature;
- AvrIspWorkerRWCallback callback;
- void* context;
-
- AvrIspWorkerRWStatusCallback callback_status;
- void* context_status;
-};
-
-typedef enum {
- AvrIspWorkerRWEvtStop = (1 << 0),
-
- AvrIspWorkerRWEvtReading = (1 << 1),
- AvrIspWorkerRWEvtVerification = (1 << 2),
- AvrIspWorkerRWEvtWriting = (1 << 3),
- AvrIspWorkerRWEvtWritingFuse = (1 << 4),
-
-} AvrIspWorkerRWEvt;
-#define AVR_ISP_WORKER_ALL_EVENTS \
- (AvrIspWorkerRWEvtWritingFuse | AvrIspWorkerRWEvtWriting | AvrIspWorkerRWEvtVerification | \
- AvrIspWorkerRWEvtReading | AvrIspWorkerRWEvtStop)
-
-/** Worker thread
- *
- * @param context
- * @return exit code
- */
-static int32_t avr_isp_worker_rw_thread(void* context) {
- AvrIspWorkerRW* instance = context;
-
- /* start PWM on &gpio_ext_pa4 */
- if(!furi_hal_pwm_is_running(FuriHalPwmOutputIdLptim2PA4)) {
- furi_hal_pwm_start(FuriHalPwmOutputIdLptim2PA4, 4000000, 50);
- }
-
- FURI_LOG_D(TAG, "Start");
-
- while(1) {
- uint32_t events =
- furi_thread_flags_wait(AVR_ISP_WORKER_ALL_EVENTS, FuriFlagWaitAny, FuriWaitForever);
-
- if(events & AvrIspWorkerRWEvtStop) {
- break;
- }
-
- if(events & AvrIspWorkerRWEvtWritingFuse) {
- if(avr_isp_worker_rw_write_fuse(instance, instance->file_path, instance->file_name)) {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusEndWritingFuse);
- } else {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusErrorWritingFuse);
- }
- }
-
- if(events & AvrIspWorkerRWEvtWriting) {
- if(avr_isp_worker_rw_write_dump(instance, instance->file_path, instance->file_name)) {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusEndWriting);
- } else {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusErrorWriting);
- }
- }
-
- if(events & AvrIspWorkerRWEvtVerification) {
- if(avr_isp_worker_rw_verification(instance, instance->file_path, instance->file_name)) {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusEndVerification);
- } else {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusErrorVerification);
- }
- }
-
- if(events & AvrIspWorkerRWEvtReading) {
- if(avr_isp_worker_rw_read_dump(instance, instance->file_path, instance->file_name)) {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusEndReading);
- } else {
- if(instance->callback_status)
- instance->callback_status(
- instance->context_status, AvrIspWorkerRWStatusErrorReading);
- }
- }
- }
- FURI_LOG_D(TAG, "Stop");
-
- if(furi_hal_pwm_is_running(FuriHalPwmOutputIdLptim2PA4)) {
- furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
- }
-
- return 0;
-}
-
-bool avr_isp_worker_rw_detect_chip(AvrIspWorkerRW* instance) {
- furi_assert(instance);
-
- FURI_LOG_D(TAG, "Detecting AVR chip");
-
- instance->chip_detect = false;
- instance->chip_arr_ind = avr_isp_chip_arr_size + 1;
-
- /* start PWM on &gpio_ext_pa4 */
- bool was_pwm_enabled = false;
- if(!furi_hal_pwm_is_running(FuriHalPwmOutputIdLptim2PA4)) {
- furi_hal_pwm_start(FuriHalPwmOutputIdLptim2PA4, 4000000, 50);
- } else {
- was_pwm_enabled = true;
- }
-
- do {
- if(!avr_isp_auto_set_spi_speed_start_pmode(instance->avr_isp)) {
- FURI_LOG_E(TAG, "Well, I managed to enter the mod program");
- break;
- }
- instance->signature = avr_isp_read_signature(instance->avr_isp);
-
- if(instance->signature.vendor != 0x1E) {
- //No detect chip
- } else {
- for(uint32_t ind = 0; ind < avr_isp_chip_arr_size; ind++) {
- if(avr_isp_chip_arr[ind].avrarch != F_AVR8) continue;
- if(avr_isp_chip_arr[ind].sigs[1] == instance->signature.part_family) {
- if(avr_isp_chip_arr[ind].sigs[2] == instance->signature.part_number) {
- FURI_LOG_D(TAG, "Detect AVR chip = \"%s\"", avr_isp_chip_arr[ind].name);
- FURI_LOG_D(
- TAG,
- "Signature = 0x%02X 0x%02X 0x%02X",
- instance->signature.vendor,
- instance->signature.part_family,
- instance->signature.part_number);
-
- switch(avr_isp_chip_arr[ind].nfuses) {
- case 1:
- instance->lfuse = avr_isp_read_fuse_low(instance->avr_isp);
- FURI_LOG_D(TAG, "Lfuse = %02X", instance->lfuse);
- break;
- case 2:
- instance->lfuse = avr_isp_read_fuse_low(instance->avr_isp);
- instance->hfuse = avr_isp_read_fuse_high(instance->avr_isp);
- FURI_LOG_D(
- TAG, "Lfuse = %02X Hfuse = %02X", instance->lfuse, instance->hfuse);
- break;
- case 3:
- instance->lfuse = avr_isp_read_fuse_low(instance->avr_isp);
- instance->hfuse = avr_isp_read_fuse_high(instance->avr_isp);
- instance->efuse = avr_isp_read_fuse_extended(instance->avr_isp);
- FURI_LOG_D(
- TAG,
- "Lfuse = %02X Hfuse = %02X Efuse = %02X",
- instance->lfuse,
- instance->hfuse,
- instance->efuse);
- break;
- default:
- break;
- }
- if(avr_isp_chip_arr[ind].nlocks == 1) {
- instance->lock = avr_isp_read_lock_byte(instance->avr_isp);
- FURI_LOG_D(TAG, "Lock = %02X", instance->lock);
- }
- instance->chip_detect = true;
- instance->chip_arr_ind = ind;
- break;
- }
- }
- }
- }
- avr_isp_end_pmode(instance->avr_isp);
-
- } while(0);
-
- if(furi_hal_pwm_is_running(FuriHalPwmOutputIdLptim2PA4) && !was_pwm_enabled) {
- furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
- }
-
- if(instance->callback) {
- if(instance->chip_arr_ind > avr_isp_chip_arr_size) {
- instance->callback(instance->context, "No detect", instance->chip_detect, 0);
- } else if(instance->chip_arr_ind < avr_isp_chip_arr_size) {
- instance->callback(
- instance->context,
- avr_isp_chip_arr[instance->chip_arr_ind].name,
- instance->chip_detect,
- avr_isp_chip_arr[instance->chip_arr_ind].flashsize);
- } else {
- instance->callback(instance->context, "Unknown", instance->chip_detect, 0);
- }
- }
-
- return instance->chip_detect;
-}
-
-AvrIspWorkerRW* avr_isp_worker_rw_alloc(void* context) {
- furi_assert(context);
- UNUSED(context);
-
- AvrIspWorkerRW* instance = malloc(sizeof(AvrIspWorkerRW));
- instance->avr_isp = avr_isp_alloc();
-
- instance->thread =
- furi_thread_alloc_ex("AvrIspWorkerRW", 4096, avr_isp_worker_rw_thread, instance);
-
- instance->chip_detect = false;
- instance->lfuse = 0;
- instance->hfuse = 0;
- instance->efuse = 0;
- instance->lock = 0;
- instance->progress_flash = 0.0f;
- instance->progress_eeprom = 0.0f;
-
- return instance;
-}
-
-void avr_isp_worker_rw_free(AvrIspWorkerRW* instance) {
- furi_assert(instance);
-
- avr_isp_free(instance->avr_isp);
-
- furi_check(!instance->worker_running);
- furi_thread_free(instance->thread);
-
- free(instance);
-}
-
-void avr_isp_worker_rw_start(AvrIspWorkerRW* instance) {
- furi_assert(instance);
- furi_assert(!instance->worker_running);
-
- instance->worker_running = true;
-
- furi_thread_start(instance->thread);
-}
-
-void avr_isp_worker_rw_stop(AvrIspWorkerRW* instance) {
- furi_assert(instance);
- furi_assert(instance->worker_running);
-
- instance->worker_running = false;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerRWEvtStop);
-
- furi_thread_join(instance->thread);
-}
-
-bool avr_isp_worker_rw_is_running(AvrIspWorkerRW* instance) {
- furi_assert(instance);
-
- return instance->worker_running;
-}
-
-void avr_isp_worker_rw_set_callback(
- AvrIspWorkerRW* instance,
- AvrIspWorkerRWCallback callback,
- void* context) {
- furi_assert(instance);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-void avr_isp_worker_rw_set_callback_status(
- AvrIspWorkerRW* instance,
- AvrIspWorkerRWStatusCallback callback_status,
- void* context_status) {
- furi_assert(instance);
-
- instance->callback_status = callback_status;
- instance->context_status = context_status;
-}
-
-float avr_isp_worker_rw_get_progress_flash(AvrIspWorkerRW* instance) {
- furi_assert(instance);
-
- return instance->progress_flash;
-}
-
-float avr_isp_worker_rw_get_progress_eeprom(AvrIspWorkerRW* instance) {
- furi_assert(instance);
-
- return instance->progress_eeprom;
-}
-
-static void avr_isp_worker_rw_get_dump_flash(AvrIspWorkerRW* instance, const char* file_path) {
- furi_assert(instance);
- furi_check(instance->avr_isp);
-
- FURI_LOG_D(TAG, "Dump FLASH %s", file_path);
-
- FlipperI32HexFile* flipper_hex_flash = flipper_i32hex_file_open_write(
- file_path, avr_isp_chip_arr[instance->chip_arr_ind].flashoffset);
-
- uint8_t data[272] = {0};
- bool send_extended_addr = ((avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2) > 0x10000);
- uint8_t extended_addr = 0;
-
- for(int32_t i = avr_isp_chip_arr[instance->chip_arr_ind].flashoffset;
- i < avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2;
- i += avr_isp_chip_arr[instance->chip_arr_ind].pagesize / 2) {
- if(send_extended_addr) {
- if(extended_addr <= ((i >> 16) & 0xFF)) {
- avr_isp_write_extended_addr(instance->avr_isp, extended_addr);
- extended_addr = ((i >> 16) & 0xFF) + 1;
- }
- }
- avr_isp_read_page(
- instance->avr_isp,
- STK_SET_FLASH_TYPE,
- (uint16_t)i,
- avr_isp_chip_arr[instance->chip_arr_ind].pagesize,
- data,
- sizeof(data));
- flipper_i32hex_file_bin_to_i32hex_set_data(
- flipper_hex_flash, data, avr_isp_chip_arr[instance->chip_arr_ind].pagesize);
- //FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_flash));
- instance->progress_flash =
- (float)(i) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2.0f);
- }
- flipper_i32hex_file_bin_to_i32hex_set_end_line(flipper_hex_flash);
- //FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_flash));
- flipper_i32hex_file_close(flipper_hex_flash);
- instance->progress_flash = 1.0f;
-}
-
-static void avr_isp_worker_rw_get_dump_eeprom(AvrIspWorkerRW* instance, const char* file_path) {
- furi_assert(instance);
- furi_check(instance->avr_isp);
-
- FURI_LOG_D(TAG, "Dump EEPROM %s", file_path);
-
- FlipperI32HexFile* flipper_hex_eeprom = flipper_i32hex_file_open_write(
- file_path, avr_isp_chip_arr[instance->chip_arr_ind].eepromoffset);
-
- int32_t size_data = 32;
- uint8_t data[256] = {0};
-
- if(size_data > avr_isp_chip_arr[instance->chip_arr_ind].eepromsize)
- size_data = avr_isp_chip_arr[instance->chip_arr_ind].eepromsize;
-
- for(int32_t i = avr_isp_chip_arr[instance->chip_arr_ind].eepromoffset;
- i < avr_isp_chip_arr[instance->chip_arr_ind].eepromsize;
- i += size_data) {
- avr_isp_read_page(
- instance->avr_isp, STK_SET_EEPROM_TYPE, (uint16_t)i, size_data, data, sizeof(data));
- flipper_i32hex_file_bin_to_i32hex_set_data(flipper_hex_eeprom, data, size_data);
- FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_eeprom));
- instance->progress_eeprom =
- (float)(i) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].eepromsize);
- }
- flipper_i32hex_file_bin_to_i32hex_set_end_line(flipper_hex_eeprom);
- FURI_LOG_D(TAG, "%s", flipper_i32hex_file_get_string(flipper_hex_eeprom));
- flipper_i32hex_file_close(flipper_hex_eeprom);
- instance->progress_eeprom = 1.0f;
-}
-
-bool avr_isp_worker_rw_read_dump(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
- furi_assert(file_path);
- furi_assert(file_name);
-
- FURI_LOG_D(TAG, "Read dump chip");
-
- instance->progress_flash = 0.0f;
- instance->progress_eeprom = 0.0f;
- bool ret = false;
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
- FuriString* file_path_name = furi_string_alloc();
-
- if(!avr_isp_worker_rw_detect_chip(instance)) {
- FURI_LOG_E(TAG, "No detect AVR chip");
- } else {
- do {
- furi_string_printf(
- file_path_name, "%s/%s%s", file_path, file_name, AVR_ISP_APP_EXTENSION);
- if(!flipper_format_file_open_always(
- flipper_format, furi_string_get_cstr(file_path_name))) {
- FURI_LOG_E(TAG, "flipper_format_file_open_always");
- break;
- }
- if(!flipper_format_write_header_cstr(
- flipper_format, AVR_ISP_APP_FILE_TYPE, AVR_ISP_APP_FILE_VERSION)) {
- FURI_LOG_E(TAG, "flipper_format_write_header_cstr");
- break;
- }
- if(!flipper_format_write_string_cstr(
- flipper_format, "Chip name", avr_isp_chip_arr[instance->chip_arr_ind].name)) {
- FURI_LOG_E(TAG, "Chip name");
- break;
- }
- if(!flipper_format_write_hex(
- flipper_format,
- "Signature",
- (uint8_t*)&instance->signature,
- sizeof(AvrIspSignature))) {
- FURI_LOG_E(TAG, "Unable to add Signature");
- break;
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 0) {
- if(!flipper_format_write_hex(flipper_format, "Lfuse", &instance->lfuse, 1)) {
- FURI_LOG_E(TAG, "Unable to add Lfuse");
- break;
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 1) {
- if(!flipper_format_write_hex(flipper_format, "Hfuse", &instance->hfuse, 1)) {
- FURI_LOG_E(TAG, "Unable to add Hfuse");
- break;
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 2) {
- if(!flipper_format_write_hex(flipper_format, "Efuse", &instance->efuse, 1)) {
- FURI_LOG_E(TAG, "Unable to add Efuse");
- break;
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nlocks == 1) {
- if(!flipper_format_write_hex(flipper_format, "Lock", &instance->lock, 1)) {
- FURI_LOG_E(TAG, "Unable to add Lock");
- break;
- }
- }
- furi_string_printf(file_path_name, "%s_%s", file_name, NAME_PATERN_FLASH_FILE);
- if(!flipper_format_write_string_cstr(
- flipper_format, "Dump_flash", furi_string_get_cstr(file_path_name))) {
- FURI_LOG_E(TAG, "Unable to add Dump_flash");
- break;
- }
-
- if(avr_isp_chip_arr[instance->chip_arr_ind].eepromsize > 0) {
- furi_string_printf(file_path_name, "%s_%s", file_name, NAME_PATERN_EEPROM_FILE);
- if(avr_isp_chip_arr[instance->chip_arr_ind].eepromsize > 0) {
- if(!flipper_format_write_string_cstr(
- flipper_format, "Dump_eeprom", furi_string_get_cstr(file_path_name))) {
- FURI_LOG_E(TAG, "Unable to add Dump_eeprom");
- break;
- }
- }
- }
- ret = true;
- } while(false);
- }
-
- flipper_format_free(flipper_format);
- furi_record_close(RECORD_STORAGE);
-
- if(ret) {
- if(avr_isp_auto_set_spi_speed_start_pmode(instance->avr_isp)) {
- //Dump flash
- furi_string_printf(
- file_path_name, "%s/%s_%s", file_path, file_name, NAME_PATERN_FLASH_FILE);
- avr_isp_worker_rw_get_dump_flash(instance, furi_string_get_cstr(file_path_name));
- //Dump eeprom
- if(avr_isp_chip_arr[instance->chip_arr_ind].eepromsize > 0) {
- furi_string_printf(
- file_path_name, "%s/%s_%s", file_path, file_name, NAME_PATERN_EEPROM_FILE);
- avr_isp_worker_rw_get_dump_eeprom(instance, furi_string_get_cstr(file_path_name));
- }
-
- avr_isp_end_pmode(instance->avr_isp);
- }
- }
-
- furi_string_free(file_path_name);
-
- return true;
-}
-
-void avr_isp_worker_rw_read_dump_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
-
- instance->file_path = file_path;
- instance->file_name = file_name;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerRWEvtReading);
-}
-
-static bool avr_isp_worker_rw_verification_flash(AvrIspWorkerRW* instance, const char* file_path) {
- furi_assert(instance);
- furi_assert(file_path);
-
- FURI_LOG_D(TAG, "Verification flash %s", file_path);
-
- instance->progress_flash = 0.0;
- bool ret = true;
-
- FlipperI32HexFile* flipper_hex_flash = flipper_i32hex_file_open_read(file_path);
-
- uint8_t data_read_flash[272] = {0};
- uint8_t data_read_hex[272] = {0};
-
- uint32_t addr = avr_isp_chip_arr[instance->chip_arr_ind].flashoffset;
- bool send_extended_addr = ((avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2) > 0x10000);
- uint8_t extended_addr = 0;
-
- FlipperI32HexFileRet flipper_hex_ret = flipper_i32hex_file_i32hex_to_bin_get_data(
- flipper_hex_flash, data_read_hex, sizeof(data_read_hex));
-
- while(((flipper_hex_ret.status == FlipperI32HexFileStatusData) ||
- (flipper_hex_ret.status == FlipperI32HexFileStatusUdateAddr)) &&
- ret) {
- switch(flipper_hex_ret.status) {
- case FlipperI32HexFileStatusData:
-
- if(send_extended_addr) {
- if(extended_addr <= ((addr >> 16) & 0xFF)) {
- avr_isp_write_extended_addr(instance->avr_isp, extended_addr);
- extended_addr = ((addr >> 16) & 0xFF) + 1;
- }
- }
-
- avr_isp_read_page(
- instance->avr_isp,
- STK_SET_FLASH_TYPE,
- (uint16_t)addr,
- flipper_hex_ret.data_size,
- data_read_flash,
- sizeof(data_read_flash));
-
- if(memcmp(data_read_hex, data_read_flash, flipper_hex_ret.data_size) != 0) {
- ret = false;
-
- FURI_LOG_E(TAG, "Verification flash error");
- FURI_LOG_E(TAG, "Addr: 0x%04lX", addr);
- for(uint32_t i = 0; i < flipper_hex_ret.data_size; i++) {
- FURI_LOG_RAW_E("%02X ", data_read_hex[i]);
- }
- FURI_LOG_RAW_E("\r\n");
- for(uint32_t i = 0; i < flipper_hex_ret.data_size; i++) {
- FURI_LOG_RAW_E("%02X ", data_read_flash[i]);
- }
- FURI_LOG_RAW_E("\r\n");
- }
-
- addr += flipper_hex_ret.data_size / 2;
- instance->progress_flash =
- (float)(addr) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2.0f);
- break;
-
- case FlipperI32HexFileStatusUdateAddr:
- addr = (data_read_hex[0] << 24 | data_read_hex[1] << 16) / 2;
- break;
-
- default:
- furi_crash(TAG " Incorrect status.");
- break;
- }
-
- flipper_hex_ret = flipper_i32hex_file_i32hex_to_bin_get_data(
- flipper_hex_flash, data_read_hex, sizeof(data_read_hex));
- }
-
- flipper_i32hex_file_close(flipper_hex_flash);
- instance->progress_flash = 1.0f;
-
- return ret;
-}
-
-static bool
- avr_isp_worker_rw_verification_eeprom(AvrIspWorkerRW* instance, const char* file_path) {
- furi_assert(instance);
- furi_assert(file_path);
-
- FURI_LOG_D(TAG, "Verification eeprom %s", file_path);
-
- instance->progress_eeprom = 0.0;
- bool ret = true;
-
- FlipperI32HexFile* flipper_hex_eeprom = flipper_i32hex_file_open_read(file_path);
-
- uint8_t data_read_eeprom[272] = {0};
- uint8_t data_read_hex[272] = {0};
-
- uint32_t addr = avr_isp_chip_arr[instance->chip_arr_ind].eepromoffset;
-
- FlipperI32HexFileRet flipper_hex_ret = flipper_i32hex_file_i32hex_to_bin_get_data(
- flipper_hex_eeprom, data_read_hex, sizeof(data_read_hex));
-
- while(((flipper_hex_ret.status == FlipperI32HexFileStatusData) ||
- (flipper_hex_ret.status == FlipperI32HexFileStatusUdateAddr)) &&
- ret) {
- switch(flipper_hex_ret.status) {
- case FlipperI32HexFileStatusData:
- avr_isp_read_page(
- instance->avr_isp,
- STK_SET_EEPROM_TYPE,
- (uint16_t)addr,
- flipper_hex_ret.data_size,
- data_read_eeprom,
- sizeof(data_read_eeprom));
-
- if(memcmp(data_read_hex, data_read_eeprom, flipper_hex_ret.data_size) != 0) {
- ret = false;
- FURI_LOG_E(TAG, "Verification eeprom error");
- FURI_LOG_E(TAG, "Addr: 0x%04lX", addr);
- for(uint32_t i = 0; i < flipper_hex_ret.data_size; i++) {
- FURI_LOG_RAW_E("%02X ", data_read_hex[i]);
- }
- FURI_LOG_RAW_E("\r\n");
- for(uint32_t i = 0; i < flipper_hex_ret.data_size; i++) {
- FURI_LOG_RAW_E("%02X ", data_read_eeprom[i]);
- }
- FURI_LOG_RAW_E("\r\n");
- }
-
- addr += flipper_hex_ret.data_size;
- instance->progress_eeprom =
- (float)(addr) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].eepromsize);
- break;
-
- case FlipperI32HexFileStatusUdateAddr:
- addr = (data_read_hex[0] << 24 | data_read_hex[1] << 16);
- break;
-
- default:
- furi_crash(TAG " Incorrect status.");
- break;
- }
-
- flipper_hex_ret = flipper_i32hex_file_i32hex_to_bin_get_data(
- flipper_hex_eeprom, data_read_hex, sizeof(data_read_hex));
- }
-
- flipper_i32hex_file_close(flipper_hex_eeprom);
- instance->progress_eeprom = 1.0f;
-
- return ret;
-}
-
-bool avr_isp_worker_rw_verification(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
- furi_assert(file_path);
- furi_assert(file_name);
-
- FURI_LOG_D(TAG, "Verification chip");
-
- instance->progress_flash = 0.0f;
- instance->progress_eeprom = 0.0f;
- FuriString* file_path_name = furi_string_alloc();
-
- bool ret = false;
-
- if(avr_isp_auto_set_spi_speed_start_pmode(instance->avr_isp)) {
- do {
- furi_string_printf(
- file_path_name, "%s/%s_%s", file_path, file_name, NAME_PATERN_FLASH_FILE);
- if(!avr_isp_worker_rw_verification_flash(
- instance, furi_string_get_cstr(file_path_name)))
- break;
-
- if(avr_isp_chip_arr[instance->chip_arr_ind].eepromsize > 0) {
- furi_string_printf(
- file_path_name, "%s/%s_%s", file_path, file_name, NAME_PATERN_EEPROM_FILE);
-
- if(!avr_isp_worker_rw_verification_eeprom(
- instance, furi_string_get_cstr(file_path_name)))
- break;
- }
- ret = true;
- } while(false);
- avr_isp_end_pmode(instance->avr_isp);
- furi_string_free(file_path_name);
- }
- return ret;
-}
-
-void avr_isp_worker_rw_verification_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
-
- instance->file_path = file_path;
- instance->file_name = file_name;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerRWEvtVerification);
-}
-
-static void avr_isp_worker_rw_write_flash(AvrIspWorkerRW* instance, const char* file_path) {
- furi_assert(instance);
- furi_check(instance->avr_isp);
-
- instance->progress_flash = 0.0;
-
- FURI_LOG_D(TAG, "Write Flash %s", file_path);
-
- uint8_t data[288] = {0};
-
- FlipperI32HexFile* flipper_hex_flash = flipper_i32hex_file_open_read(file_path);
-
- uint32_t addr = avr_isp_chip_arr[instance->chip_arr_ind].flashoffset;
- bool send_extended_addr = ((avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2) > 0x10000);
- uint8_t extended_addr = 0;
-
- FlipperI32HexFileRet flipper_hex_ret =
- flipper_i32hex_file_i32hex_to_bin_get_data(flipper_hex_flash, data, sizeof(data));
-
- while((flipper_hex_ret.status == FlipperI32HexFileStatusData) ||
- (flipper_hex_ret.status == FlipperI32HexFileStatusUdateAddr)) {
- switch(flipper_hex_ret.status) {
- case FlipperI32HexFileStatusData:
-
- if(send_extended_addr) {
- if(extended_addr <= ((addr >> 16) & 0xFF)) {
- avr_isp_write_extended_addr(instance->avr_isp, extended_addr);
- extended_addr = ((addr >> 16) & 0xFF) + 1;
- }
- }
-
- if(!avr_isp_write_page(
- instance->avr_isp,
- STK_SET_FLASH_TYPE,
- avr_isp_chip_arr[instance->chip_arr_ind].flashsize,
- (uint16_t)addr,
- avr_isp_chip_arr[instance->chip_arr_ind].pagesize,
- data,
- flipper_hex_ret.data_size)) {
- break;
- }
- addr += flipper_hex_ret.data_size / 2;
- instance->progress_flash =
- (float)(addr) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].flashsize / 2.0f);
- break;
-
- case FlipperI32HexFileStatusUdateAddr:
- addr = (data[0] << 24 | data[1] << 16) / 2;
- break;
-
- default:
- furi_crash(TAG " Incorrect status.");
- break;
- }
-
- flipper_hex_ret =
- flipper_i32hex_file_i32hex_to_bin_get_data(flipper_hex_flash, data, sizeof(data));
- }
-
- flipper_i32hex_file_close(flipper_hex_flash);
- instance->progress_flash = 1.0f;
-}
-
-static void avr_isp_worker_rw_write_eeprom(AvrIspWorkerRW* instance, const char* file_path) {
- furi_assert(instance);
- furi_check(instance->avr_isp);
-
- instance->progress_eeprom = 0.0;
- uint8_t data[288] = {0};
-
- FURI_LOG_D(TAG, "Write EEPROM %s", file_path);
-
- FlipperI32HexFile* flipper_hex_eeprom_read = flipper_i32hex_file_open_read(file_path);
-
- uint32_t addr = avr_isp_chip_arr[instance->chip_arr_ind].eepromoffset;
- FlipperI32HexFileRet flipper_hex_ret =
- flipper_i32hex_file_i32hex_to_bin_get_data(flipper_hex_eeprom_read, data, sizeof(data));
-
- while((flipper_hex_ret.status == FlipperI32HexFileStatusData) ||
- (flipper_hex_ret.status == FlipperI32HexFileStatusUdateAddr)) {
- switch(flipper_hex_ret.status) {
- case FlipperI32HexFileStatusData:
- if(!avr_isp_write_page(
- instance->avr_isp,
- STK_SET_EEPROM_TYPE,
- avr_isp_chip_arr[instance->chip_arr_ind].eepromsize,
- (uint16_t)addr,
- avr_isp_chip_arr[instance->chip_arr_ind].eeprompagesize,
- data,
- flipper_hex_ret.data_size)) {
- break;
- }
- addr += flipper_hex_ret.data_size;
- instance->progress_eeprom =
- (float)(addr) / ((float)avr_isp_chip_arr[instance->chip_arr_ind].eepromsize);
- break;
-
- case FlipperI32HexFileStatusUdateAddr:
- addr = data[0] << 24 | data[1] << 16;
- break;
-
- default:
- furi_crash(TAG " Incorrect status.");
- break;
- }
-
- flipper_hex_ret = flipper_i32hex_file_i32hex_to_bin_get_data(
- flipper_hex_eeprom_read, data, sizeof(data));
- }
-
- flipper_i32hex_file_close(flipper_hex_eeprom_read);
- instance->progress_eeprom = 1.0f;
-}
-
-bool avr_isp_worker_rw_write_dump(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
- furi_assert(file_path);
- furi_assert(file_name);
-
- FURI_LOG_D(TAG, "Write dump chip");
-
- instance->progress_flash = 0.0f;
- instance->progress_eeprom = 0.0f;
- bool ret = false;
-
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
- FuriString* file_path_name = furi_string_alloc();
-
- FuriString* temp_str_1 = furi_string_alloc();
- FuriString* temp_str_2 = furi_string_alloc();
- uint32_t temp_data32;
-
- if(!avr_isp_worker_rw_detect_chip(instance)) {
- FURI_LOG_E(TAG, "No detect AVR chip");
- } else {
- //upload file with description
- do {
- furi_string_printf(
- file_path_name, "%s/%s%s", file_path, file_name, AVR_ISP_APP_EXTENSION);
- if(!flipper_format_file_open_existing(
- flipper_format, furi_string_get_cstr(file_path_name))) {
- FURI_LOG_E(TAG, "Error open file %s", furi_string_get_cstr(file_path_name));
- break;
- }
-
- if(!flipper_format_read_header(flipper_format, temp_str_1, &temp_data32)) {
- FURI_LOG_E(TAG, "Missing or incorrect header");
- break;
- }
-
- if((!strcmp(furi_string_get_cstr(temp_str_1), AVR_ISP_APP_FILE_TYPE)) &&
- temp_data32 == AVR_ISP_APP_FILE_VERSION) {
- } else {
- FURI_LOG_E(TAG, "Type or version mismatch");
- break;
- }
-
- AvrIspSignature sig_read = {0};
-
- if(!flipper_format_read_hex(
- flipper_format, "Signature", (uint8_t*)&sig_read, sizeof(AvrIspSignature))) {
- FURI_LOG_E(TAG, "Missing Signature");
- break;
- }
-
- if(memcmp(
- (uint8_t*)&instance->signature, (uint8_t*)&sig_read, sizeof(AvrIspSignature)) !=
- 0) {
- FURI_LOG_E(
- TAG,
- "Wrong chip. Connected (%02X %02X %02X), read from file (%02X %02X %02X)",
- instance->signature.vendor,
- instance->signature.part_family,
- instance->signature.part_number,
- sig_read.vendor,
- sig_read.part_family,
- sig_read.part_number);
- break;
- }
-
- if(!flipper_format_read_string(flipper_format, "Dump_flash", temp_str_1)) {
- FURI_LOG_E(TAG, "Missing Dump_flash");
- break;
- }
-
- //may not be
- flipper_format_read_string(flipper_format, "Dump_eeprom", temp_str_2);
- ret = true;
- } while(false);
- }
- flipper_format_free(flipper_format);
- furi_record_close(RECORD_STORAGE);
-
- if(ret) {
- do {
- //checking .hex files for errors
-
- furi_string_printf(
- file_path_name, "%s/%s", file_path, furi_string_get_cstr(temp_str_1));
-
- FURI_LOG_D(TAG, "Check flash file");
- FlipperI32HexFile* flipper_hex_flash_read =
- flipper_i32hex_file_open_read(furi_string_get_cstr(file_path_name));
- if(flipper_i32hex_file_check(flipper_hex_flash_read)) {
- FURI_LOG_D(TAG, "Check flash file: OK");
- } else {
- FURI_LOG_E(TAG, "Check flash file: Error");
- ret = false;
- }
- flipper_i32hex_file_close(flipper_hex_flash_read);
-
- if(furi_string_size(temp_str_2) > 4) {
- furi_string_printf(
- file_path_name, "%s/%s", file_path, furi_string_get_cstr(temp_str_2));
-
- FURI_LOG_D(TAG, "Check eeprom file");
- FlipperI32HexFile* flipper_hex_eeprom_read =
- flipper_i32hex_file_open_read(furi_string_get_cstr(file_path_name));
- if(flipper_i32hex_file_check(flipper_hex_eeprom_read)) {
- FURI_LOG_D(TAG, "Check eeprom file: OK");
- } else {
- FURI_LOG_E(TAG, "Check eeprom file: Error");
- ret = false;
- }
- flipper_i32hex_file_close(flipper_hex_eeprom_read);
- }
-
- if(!ret) break;
- ret = false;
-
- //erase chip
- FURI_LOG_D(TAG, "Erase chip");
- if(!avr_isp_erase_chip(instance->avr_isp)) {
- FURI_LOG_E(TAG, "Erase chip: Error");
- break;
- }
-
- if(!avr_isp_auto_set_spi_speed_start_pmode(instance->avr_isp)) {
- FURI_LOG_E(TAG, "Well, I managed to enter the mod program");
- break;
- }
-
- //write flash
- furi_string_printf(
- file_path_name, "%s/%s", file_path, furi_string_get_cstr(temp_str_1));
- avr_isp_worker_rw_write_flash(instance, furi_string_get_cstr(file_path_name));
-
- //write eeprom
- if(furi_string_size(temp_str_2) > 4) {
- furi_string_printf(
- file_path_name, "%s/%s", file_path, furi_string_get_cstr(temp_str_2));
- avr_isp_worker_rw_write_eeprom(instance, furi_string_get_cstr(file_path_name));
- }
- ret = true;
- avr_isp_end_pmode(instance->avr_isp);
- } while(false);
- }
-
- furi_string_free(file_path_name);
- furi_string_free(temp_str_1);
- furi_string_free(temp_str_2);
-
- return ret;
-}
-
-void avr_isp_worker_rw_write_dump_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
-
- instance->file_path = file_path;
- instance->file_name = file_name;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerRWEvtWriting);
-}
-
-bool avr_isp_worker_rw_write_fuse(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
- furi_assert(file_path);
- furi_assert(file_name);
-
- FURI_LOG_D(TAG, "Write fuse chip");
-
- bool ret = false;
- uint8_t lfuse;
- uint8_t hfuse;
- uint8_t efuse;
- uint8_t lock;
-
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
- FuriString* temp_str = furi_string_alloc();
-
- uint32_t temp_data32;
-
- if(!avr_isp_worker_rw_detect_chip(instance)) {
- FURI_LOG_E(TAG, "No detect AVR chip");
- } else {
- //upload file with description
- do {
- furi_string_printf(temp_str, "%s/%s%s", file_path, file_name, AVR_ISP_APP_EXTENSION);
- if(!flipper_format_file_open_existing(flipper_format, furi_string_get_cstr(temp_str))) {
- FURI_LOG_E(TAG, "Error open file %s", furi_string_get_cstr(temp_str));
- break;
- }
-
- if(!flipper_format_read_header(flipper_format, temp_str, &temp_data32)) {
- FURI_LOG_E(TAG, "Missing or incorrect header");
- break;
- }
-
- if((!strcmp(furi_string_get_cstr(temp_str), AVR_ISP_APP_FILE_TYPE)) &&
- temp_data32 == AVR_ISP_APP_FILE_VERSION) {
- } else {
- FURI_LOG_E(TAG, "Type or version mismatch");
- break;
- }
-
- AvrIspSignature sig_read = {0};
-
- if(!flipper_format_read_hex(
- flipper_format, "Signature", (uint8_t*)&sig_read, sizeof(AvrIspSignature))) {
- FURI_LOG_E(TAG, "Missing Signature");
- break;
- }
-
- if(memcmp(
- (uint8_t*)&instance->signature, (uint8_t*)&sig_read, sizeof(AvrIspSignature)) !=
- 0) {
- FURI_LOG_E(
- TAG,
- "Wrong chip. Connected (%02X %02X %02X), read from file (%02X %02X %02X)",
- instance->signature.vendor,
- instance->signature.part_family,
- instance->signature.part_number,
- sig_read.vendor,
- sig_read.part_family,
- sig_read.part_number);
- break;
- }
-
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 0) {
- if(!flipper_format_read_hex(flipper_format, "Lfuse", &lfuse, 1)) {
- FURI_LOG_E(TAG, "Missing Lfuse");
- break;
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 1) {
- if(!flipper_format_read_hex(flipper_format, "Hfuse", &hfuse, 1)) {
- FURI_LOG_E(TAG, "Missing Hfuse");
- break;
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 2) {
- if(!flipper_format_read_hex(flipper_format, "Efuse", &efuse, 1)) {
- FURI_LOG_E(TAG, "Missing Efuse");
- break;
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nlocks == 1) {
- if(!flipper_format_read_hex(flipper_format, "Lock", &lock, 1)) {
- FURI_LOG_E(TAG, "Missing Lock");
- break;
- }
- }
-
- if(!avr_isp_auto_set_spi_speed_start_pmode(instance->avr_isp)) {
- FURI_LOG_E(TAG, "Well, I managed to enter the mod program");
- break;
- }
-
- ret = true;
-
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 0) {
- if(instance->lfuse != lfuse) {
- if(!avr_isp_write_fuse_low(instance->avr_isp, lfuse)) {
- FURI_LOG_E(TAG, "Write Lfuse: error");
- ret = false;
- }
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 1) {
- if(instance->hfuse != hfuse) {
- if(!avr_isp_write_fuse_high(instance->avr_isp, hfuse)) {
- FURI_LOG_E(TAG, "Write Hfuse: error");
- ret = false;
- }
- }
- }
- if(avr_isp_chip_arr[instance->chip_arr_ind].nfuses > 2) {
- if(instance->efuse != efuse) {
- if(!avr_isp_write_fuse_extended(instance->avr_isp, efuse)) {
- FURI_LOG_E(TAG, "Write Efuse: error");
- ret = false;
- }
- }
- }
-
- if(avr_isp_chip_arr[instance->chip_arr_ind].nlocks == 1) {
- FURI_LOG_D(TAG, "Write lock byte");
- if(instance->lock != lock) {
- if(!avr_isp_write_lock_byte(instance->avr_isp, lock)) {
- FURI_LOG_E(TAG, "Write Lock byte: error");
- ret = false;
- }
- }
- }
- avr_isp_end_pmode(instance->avr_isp);
- } while(false);
- }
-
- flipper_format_free(flipper_format);
- furi_record_close(RECORD_STORAGE);
- furi_string_free(temp_str);
- return ret;
-}
-
-void avr_isp_worker_rw_write_fuse_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
-
- instance->file_path = file_path;
- instance->file_name = file_name;
- furi_thread_flags_set(furi_thread_get_id(instance->thread), AvrIspWorkerRWEvtWritingFuse);
-}
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.h b/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.h
deleted file mode 100644
index 2c52a8700..000000000
--- a/applications/external/avr_isp_programmer/helpers/avr_isp_worker_rw.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct AvrIspWorkerRW AvrIspWorkerRW;
-
-typedef void (*AvrIspWorkerRWCallback)(
- void* context,
- const char* name,
- bool detect_chip,
- uint32_t flash_size);
-
-typedef enum {
- AvrIspWorkerRWStatusILDE = 0,
- AvrIspWorkerRWStatusEndReading = 1,
- AvrIspWorkerRWStatusEndVerification = 2,
- AvrIspWorkerRWStatusEndWriting = 3,
- AvrIspWorkerRWStatusEndWritingFuse = 4,
-
- AvrIspWorkerRWStatusErrorReading = (-1),
- AvrIspWorkerRWStatusErrorVerification = (-2),
- AvrIspWorkerRWStatusErrorWriting = (-3),
- AvrIspWorkerRWStatusErrorWritingFuse = (-4),
-
- AvrIspWorkerRWStatusReserved = 0x7FFFFFFF, ///< Prevents enum down-size compiler optimization.
-} AvrIspWorkerRWStatus;
-
-typedef void (*AvrIspWorkerRWStatusCallback)(void* context, AvrIspWorkerRWStatus status);
-
-AvrIspWorkerRW* avr_isp_worker_rw_alloc(void* context);
-
-void avr_isp_worker_rw_free(AvrIspWorkerRW* instance);
-
-void avr_isp_worker_rw_start(AvrIspWorkerRW* instance);
-
-void avr_isp_worker_rw_stop(AvrIspWorkerRW* instance);
-
-bool avr_isp_worker_rw_is_running(AvrIspWorkerRW* instance);
-
-void avr_isp_worker_rw_set_callback(
- AvrIspWorkerRW* instance,
- AvrIspWorkerRWCallback callback,
- void* context);
-
-void avr_isp_worker_rw_set_callback_status(
- AvrIspWorkerRW* instance,
- AvrIspWorkerRWStatusCallback callback_status,
- void* context_status);
-
-bool avr_isp_worker_rw_detect_chip(AvrIspWorkerRW* instance);
-
-float avr_isp_worker_rw_get_progress_flash(AvrIspWorkerRW* instance);
-
-float avr_isp_worker_rw_get_progress_eeprom(AvrIspWorkerRW* instance);
-
-bool avr_isp_worker_rw_read_dump(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-void avr_isp_worker_rw_read_dump_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-bool avr_isp_worker_rw_verification(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-void avr_isp_worker_rw_verification_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-bool avr_isp_worker_rw_check_hex(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-bool avr_isp_worker_rw_write_dump(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-void avr_isp_worker_rw_write_dump_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-bool avr_isp_worker_rw_write_fuse(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
-
-void avr_isp_worker_rw_write_fuse_start(
- AvrIspWorkerRW* instance,
- const char* file_path,
- const char* file_name);
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.c b/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.c
deleted file mode 100644
index a8c20a0bd..000000000
--- a/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.c
+++ /dev/null
@@ -1,321 +0,0 @@
-#include "flipper_i32hex_file.h"
-#include
-#include
-#include
-#include
-#include
-
-//https://en.wikipedia.org/wiki/Intel_HEX
-
-#define TAG "FlipperI32HexFile"
-
-#define COUNT_BYTE_PAYLOAD 32 //how much payload will be used
-
-#define I32HEX_TYPE_DATA 0x00
-#define I32HEX_TYPE_END_OF_FILE 0x01
-#define I32HEX_TYPE_EXT_LINEAR_ADDR 0x04
-#define I32HEX_TYPE_START_LINEAR_ADDR 0x05
-
-struct FlipperI32HexFile {
- uint32_t addr;
- uint32_t addr_last;
- Storage* storage;
- Stream* stream;
- FuriString* str_data;
- FlipperI32HexFileStatus file_open;
-};
-
-FlipperI32HexFile* flipper_i32hex_file_open_write(const char* name, uint32_t start_addr) {
- furi_assert(name);
-
- FlipperI32HexFile* instance = malloc(sizeof(FlipperI32HexFile));
- instance->addr = start_addr;
- instance->addr_last = 0;
- instance->storage = furi_record_open(RECORD_STORAGE);
- instance->stream = file_stream_alloc(instance->storage);
-
- if(file_stream_open(instance->stream, name, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
- instance->file_open = FlipperI32HexFileStatusOpenFileWrite;
- FURI_LOG_D(TAG, "Open write file %s", name);
- } else {
- FURI_LOG_E(TAG, "Failed to open file %s", name);
- instance->file_open = FlipperI32HexFileStatusErrorNoOpenFile;
- }
- instance->str_data = furi_string_alloc(instance->storage);
-
- return instance;
-}
-
-FlipperI32HexFile* flipper_i32hex_file_open_read(const char* name) {
- furi_assert(name);
-
- FlipperI32HexFile* instance = malloc(sizeof(FlipperI32HexFile));
- instance->addr = 0;
- instance->addr_last = 0;
- instance->storage = furi_record_open(RECORD_STORAGE);
- instance->stream = file_stream_alloc(instance->storage);
-
- if(file_stream_open(instance->stream, name, FSAM_READ, FSOM_OPEN_EXISTING)) {
- instance->file_open = FlipperI32HexFileStatusOpenFileRead;
- FURI_LOG_D(TAG, "Open read file %s", name);
- } else {
- FURI_LOG_E(TAG, "Failed to open file %s", name);
- instance->file_open = FlipperI32HexFileStatusErrorNoOpenFile;
- }
- instance->str_data = furi_string_alloc(instance->storage);
-
- return instance;
-}
-
-void flipper_i32hex_file_close(FlipperI32HexFile* instance) {
- furi_assert(instance);
-
- furi_string_free(instance->str_data);
- file_stream_close(instance->stream);
- stream_free(instance->stream);
- furi_record_close(RECORD_STORAGE);
-}
-
-FlipperI32HexFileRet flipper_i32hex_file_bin_to_i32hex_set_data(
- FlipperI32HexFile* instance,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
- furi_assert(data);
-
- FlipperI32HexFileRet ret = {.status = FlipperI32HexFileStatusOK, .data_size = 0};
- if(instance->file_open != FlipperI32HexFileStatusOpenFileWrite) {
- ret.status = FlipperI32HexFileStatusErrorFileWrite;
- }
- uint8_t count_byte = 0;
- uint32_t ind = 0;
- uint8_t crc = 0;
-
- furi_string_reset(instance->str_data);
-
- if((instance->addr_last & 0xFF0000) < (instance->addr & 0xFF0000)) {
- crc = 0x02 + 0x04 + ((instance->addr >> 24) & 0xFF) + ((instance->addr >> 16) & 0xFF);
- crc = 0x01 + ~crc;
- //I32HEX_TYPE_EXT_LINEAR_ADDR
- furi_string_cat_printf(
- instance->str_data, ":02000004%04lX%02X\r\n", (instance->addr >> 16), crc);
- instance->addr_last = instance->addr;
- }
-
- while(ind < data_size) {
- if((ind + COUNT_BYTE_PAYLOAD) > data_size) {
- count_byte = data_size - ind;
- } else {
- count_byte = COUNT_BYTE_PAYLOAD;
- }
- //I32HEX_TYPE_DATA
- furi_string_cat_printf(
- instance->str_data, ":%02X%04lX00", count_byte, (instance->addr & 0xFFFF));
- crc = count_byte + ((instance->addr >> 8) & 0xFF) + (instance->addr & 0xFF);
-
- for(uint32_t i = 0; i < count_byte; i++) {
- furi_string_cat_printf(instance->str_data, "%02X", *data);
- crc += *data++;
- }
- crc = 0x01 + ~crc;
- furi_string_cat_printf(instance->str_data, "%02X\r\n", crc);
-
- ind += count_byte;
- instance->addr += count_byte;
- }
- if(instance->file_open) stream_write_string(instance->stream, instance->str_data);
- return ret;
-}
-
-FlipperI32HexFileRet flipper_i32hex_file_bin_to_i32hex_set_end_line(FlipperI32HexFile* instance) {
- furi_assert(instance);
-
- FlipperI32HexFileRet ret = {.status = FlipperI32HexFileStatusOK, .data_size = 0};
- if(instance->file_open != FlipperI32HexFileStatusOpenFileWrite) {
- ret.status = FlipperI32HexFileStatusErrorFileWrite;
- }
- furi_string_reset(instance->str_data);
- //I32HEX_TYPE_END_OF_FILE
- furi_string_cat_printf(instance->str_data, ":00000001FF\r\n");
- if(instance->file_open) stream_write_string(instance->stream, instance->str_data);
- return ret;
-}
-
-void flipper_i32hex_file_bin_to_i32hex_set_addr(FlipperI32HexFile* instance, uint32_t addr) {
- furi_assert(instance);
-
- instance->addr = addr;
-}
-
-const char* flipper_i32hex_file_get_string(FlipperI32HexFile* instance) {
- furi_assert(instance);
-
- return furi_string_get_cstr(instance->str_data);
-}
-
-static FlipperI32HexFileRet flipper_i32hex_file_parse_line(
- FlipperI32HexFile* instance,
- const char* str,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
- furi_assert(data);
-
- char* str1;
- uint32_t data_wrire_ind = 0;
- uint32_t data_len = 0;
- FlipperI32HexFileRet ret = {.status = FlipperI32HexFileStatusErrorData, .data_size = 0};
-
- //Search for start of data I32HEX
- str1 = strstr(str, ":");
- do {
- if(str1 == NULL) {
- ret.status = FlipperI32HexFileStatusErrorData;
- break;
- }
- str1++;
- if(!hex_char_to_uint8(*str1, str1[1], data + data_wrire_ind)) {
- ret.status = FlipperI32HexFileStatusErrorData;
- break;
- }
- str1++;
- if(++data_wrire_ind > data_size) {
- ret.status = FlipperI32HexFileStatusErrorOverflow;
- break;
- }
- data_len = 5 + data[0]; // +5 bytes per header and crc
- while(data_len > data_wrire_ind) {
- str1++;
- if(!hex_char_to_uint8(*str1, str1[1], data + data_wrire_ind)) {
- ret.status = FlipperI32HexFileStatusErrorData;
- break;
- }
- str1++;
- if(++data_wrire_ind > data_size) {
- ret.status = FlipperI32HexFileStatusErrorOverflow;
- break;
- }
- }
- ret.status = FlipperI32HexFileStatusOK;
- ret.data_size = data_wrire_ind;
-
- } while(0);
- return ret;
-}
-
-static bool flipper_i32hex_file_check_data(uint8_t* data, uint32_t data_size) {
- furi_assert(data);
-
- uint8_t crc = 0;
- uint32_t data_read_ind = 0;
- if(data[0] > data_size) return false;
- while(data_read_ind < data_size - 1) {
- crc += data[data_read_ind++];
- }
- return data[data_size - 1] == ((1 + ~crc) & 0xFF);
-}
-
-static FlipperI32HexFileRet flipper_i32hex_file_parse(
- FlipperI32HexFile* instance,
- const char* str,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
- furi_assert(data);
-
- FlipperI32HexFileRet ret = flipper_i32hex_file_parse_line(instance, str, data, data_size);
-
- if((ret.status == FlipperI32HexFileStatusOK) && (ret.data_size > 4)) {
- switch(data[3]) {
- case I32HEX_TYPE_DATA:
- if(flipper_i32hex_file_check_data(data, ret.data_size)) {
- ret.data_size -= 5;
- memcpy(data, data + 4, ret.data_size);
- ret.status = FlipperI32HexFileStatusData;
- } else {
- ret.status = FlipperI32HexFileStatusErrorCrc;
- ret.data_size = 0;
- }
- break;
- case I32HEX_TYPE_END_OF_FILE:
- if(flipper_i32hex_file_check_data(data, ret.data_size)) {
- ret.status = FlipperI32HexFileStatusEofFile;
- ret.data_size = 0;
- } else {
- ret.status = FlipperI32HexFileStatusErrorCrc;
- ret.data_size = 0;
- }
- break;
- case I32HEX_TYPE_EXT_LINEAR_ADDR:
- if(flipper_i32hex_file_check_data(data, ret.data_size)) {
- data[0] = data[4];
- data[1] = data[5];
- data[3] = 0;
- data[4] = 0;
- ret.status = FlipperI32HexFileStatusUdateAddr;
- ret.data_size = 4;
- } else {
- ret.status = FlipperI32HexFileStatusErrorCrc;
- ret.data_size = 0;
- }
- break;
- case I32HEX_TYPE_START_LINEAR_ADDR:
- ret.status = FlipperI32HexFileStatusErrorUnsupportedCommand;
- ret.data_size = 0;
- break;
- default:
- ret.status = FlipperI32HexFileStatusErrorUnsupportedCommand;
- ret.data_size = 0;
- break;
- }
- } else {
- ret.status = FlipperI32HexFileStatusErrorData;
- ret.data_size = 0;
- }
- return ret;
-}
-
-bool flipper_i32hex_file_check(FlipperI32HexFile* instance) {
- furi_assert(instance);
-
- uint32_t data_size = 280;
- uint8_t data[280] = {0};
- bool ret = true;
-
- if(instance->file_open != FlipperI32HexFileStatusOpenFileRead) {
- FURI_LOG_E(TAG, "File is not open");
- ret = false;
- } else {
- stream_rewind(instance->stream);
-
- while(stream_read_line(instance->stream, instance->str_data)) {
- FlipperI32HexFileRet parse_ret = flipper_i32hex_file_parse(
- instance, furi_string_get_cstr(instance->str_data), data, data_size);
-
- if(parse_ret.status < 0) {
- ret = false;
- }
- }
- stream_rewind(instance->stream);
- }
- return ret;
-}
-
-FlipperI32HexFileRet flipper_i32hex_file_i32hex_to_bin_get_data(
- FlipperI32HexFile* instance,
- uint8_t* data,
- uint32_t data_size) {
- furi_assert(instance);
- furi_assert(data);
-
- FlipperI32HexFileRet ret = {.status = FlipperI32HexFileStatusOK, .data_size = 0};
- if(instance->file_open != FlipperI32HexFileStatusOpenFileRead) {
- ret.status = FlipperI32HexFileStatusErrorFileRead;
- } else {
- stream_read_line(instance->stream, instance->str_data);
- ret = flipper_i32hex_file_parse(
- instance, furi_string_get_cstr(instance->str_data), data, data_size);
- }
-
- return ret;
-}
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.h b/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.h
deleted file mode 100644
index 765b94beb..000000000
--- a/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct FlipperI32HexFile FlipperI32HexFile;
-
-typedef enum {
- FlipperI32HexFileStatusOK = 0,
- FlipperI32HexFileStatusData = 2,
- FlipperI32HexFileStatusUdateAddr = 3,
- FlipperI32HexFileStatusEofFile = 4,
- FlipperI32HexFileStatusOpenFileWrite = 5,
- FlipperI32HexFileStatusOpenFileRead = 6,
-
- // Errors
- FlipperI32HexFileStatusErrorCrc = (-1),
- FlipperI32HexFileStatusErrorOverflow = (-2),
- FlipperI32HexFileStatusErrorData = (-3),
- FlipperI32HexFileStatusErrorUnsupportedCommand = (-4),
- FlipperI32HexFileStatusErrorNoOpenFile = (-5),
- FlipperI32HexFileStatusErrorFileWrite = (-6),
- FlipperI32HexFileStatusErrorFileRead = (-7),
-
- FlipperI32HexFileStatusReserved =
- 0x7FFFFFFF, ///< Prevents enum down-size compiler optimization.
-} FlipperI32HexFileStatus;
-
-typedef struct {
- FlipperI32HexFileStatus status;
- uint32_t data_size;
-} FlipperI32HexFileRet;
-
-FlipperI32HexFile* flipper_i32hex_file_open_write(const char* name, uint32_t start_addr);
-
-FlipperI32HexFile* flipper_i32hex_file_open_read(const char* name);
-
-void flipper_i32hex_file_close(FlipperI32HexFile* instance);
-
-FlipperI32HexFileRet flipper_i32hex_file_bin_to_i32hex_set_data(
- FlipperI32HexFile* instance,
- uint8_t* data,
- uint32_t data_size);
-
-FlipperI32HexFileRet flipper_i32hex_file_bin_to_i32hex_set_end_line(FlipperI32HexFile* instance);
-
-const char* flipper_i32hex_file_get_string(FlipperI32HexFile* instance);
-
-void flipper_i32hex_file_bin_to_i32hex_set_addr(FlipperI32HexFile* instance, uint32_t addr);
-
-bool flipper_i32hex_file_check(FlipperI32HexFile* instance);
-
-FlipperI32HexFileRet flipper_i32hex_file_i32hex_to_bin_get_data(
- FlipperI32HexFile* instance,
- uint8_t* data,
- uint32_t data_size);
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/images/avr_app_icon_10x10.png b/applications/external/avr_isp_programmer/images/avr_app_icon_10x10.png
deleted file mode 100644
index 533787fe3..000000000
Binary files a/applications/external/avr_isp_programmer/images/avr_app_icon_10x10.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/avr_wiring.png b/applications/external/avr_isp_programmer/images/avr_wiring.png
deleted file mode 100644
index 957012405..000000000
Binary files a/applications/external/avr_isp_programmer/images/avr_wiring.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/chif_not_found_83x37.png b/applications/external/avr_isp_programmer/images/chif_not_found_83x37.png
deleted file mode 100644
index b03bf3567..000000000
Binary files a/applications/external/avr_isp_programmer/images/chif_not_found_83x37.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/chip_error_70x22.png b/applications/external/avr_isp_programmer/images/chip_error_70x22.png
deleted file mode 100644
index 16f81178c..000000000
Binary files a/applications/external/avr_isp_programmer/images/chip_error_70x22.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/chip_long_70x22.png b/applications/external/avr_isp_programmer/images/chip_long_70x22.png
deleted file mode 100644
index 3edfff82d..000000000
Binary files a/applications/external/avr_isp_programmer/images/chip_long_70x22.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/chip_not_found_83x37.png b/applications/external/avr_isp_programmer/images/chip_not_found_83x37.png
deleted file mode 100644
index 6d56dcfa0..000000000
Binary files a/applications/external/avr_isp_programmer/images/chip_not_found_83x37.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/dolphin_nice_96x59.png b/applications/external/avr_isp_programmer/images/dolphin_nice_96x59.png
deleted file mode 100644
index a299d3630..000000000
Binary files a/applications/external/avr_isp_programmer/images/dolphin_nice_96x59.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/isp_active_128x53.png b/applications/external/avr_isp_programmer/images/isp_active_128x53.png
deleted file mode 100644
index 843792123..000000000
Binary files a/applications/external/avr_isp_programmer/images/isp_active_128x53.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/images/link_waiting_77x56.png b/applications/external/avr_isp_programmer/images/link_waiting_77x56.png
deleted file mode 100644
index d7d32aed5..000000000
Binary files a/applications/external/avr_isp_programmer/images/link_waiting_77x56.png and /dev/null differ
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_chip_arr.c b/applications/external/avr_isp_programmer/lib/driver/avr_isp_chip_arr.c
deleted file mode 100644
index 2be54de6a..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_chip_arr.c
+++ /dev/null
@@ -1,386 +0,0 @@
-#include "avr_isp_chip_arr.h"
-
-#include
-
-//https://github.com/avrdudes/avrdude/blob/master/src/avrintel.c
-
-const AvrIspChipArr avr_isp_chip_arr[] = { // Value of -1 typically means unknown
- //{mcu_name, mcuid, family, {sig, na, ture}, flstart, flsize, pgsiz, nb, bootsz, eestart, eesize, ep, rambeg, ramsiz, nf, nl, ni}, // Source
- {"ATtiny4", 0, F_AVR8L, {0x1E, 0x8F, 0x0A}, 0, 0x00200, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 10}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATtiny5", 1, F_AVR8L, {0x1E, 0x8F, 0x09}, 0, 0x00200, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 11}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATtiny9", 2, F_AVR8L, {0x1E, 0x90, 0x08}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 10}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATtiny10", 3, F_AVR8L, {0x1E, 0x90, 0x03}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 11}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATtiny20", 4, F_AVR8L, {0x1E, 0x91, 0x0F}, 0, 0x00800, 0x020, 0, 0, 0, 0, 0, 0x0040, 0x0080, 1, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATtiny40", 5, F_AVR8L, {0x1E, 0x92, 0x0E}, 0, 0x01000, 0x040, 0, 0, 0, 0, 0, 0x0040, 0x0100, 1, 1, 18}, // atdf, avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATtiny102", 6, F_AVR8L, {0x1E, 0x90, 0x0C}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 16}, // atdf, avrdude, boot size (manual)
- {"ATtiny104", 7, F_AVR8L, {0x1E, 0x90, 0x0B}, 0, 0x00400, 0x010, 0, 0, 0, 0, 0, 0x0040, 0x0020, 1, 1, 16}, // atdf, avrdude, boot size (manual)
-
- {"ATtiny11", 8, F_AVR8, {0x1E, 0x90, 0x04}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 1, 0x0060, 0x0020, 1, 1, 5}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny12", 9, F_AVR8, {0x1E, 0x90, 0x05}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 2, 0x0060, 0x0020, 1, 1, 6}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny13", 10, F_AVR8, {0x1E, 0x90, 0x07}, 0, 0x00400, 0x020, 0, 0, 0, 0x0040, 4, 0x0060, 0x0040, 2, 1, 10}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny13A", 11, F_AVR8, {0x1E, 0x90, 0x07}, 0, 0x00400, 0x020, 0, 0, 0, 0x0040, 4, 0x0060, 0x0040, 2, 1, 10}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny15", 12, F_AVR8, {0x1E, 0x90, 0x06}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 2, 0x0060, 0x0020, 1, 1, 9}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny22", 13, F_AVR8, {0x1E, 0x91, 0x06}, 0, 0x00800, -1, 0, 0, -1, -1, -1, 0x0060, 0x0080, 1, 1, 3}, // avr-gcc 12.2.0, boot size (manual)
- {"ATtiny24", 14, F_AVR8, {0x1E, 0x91, 0x0B}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny24A", 15, F_AVR8, {0x1E, 0x91, 0x0B}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny25", 16, F_AVR8, {0x1E, 0x91, 0x08}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 15}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny26", 17, F_AVR8, {0x1E, 0x91, 0x09}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 2, 1, 12}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny28", 18, F_AVR8, {0x1E, 0x91, 0x07}, 0, 0x00800, 0x002, 0, 0, 0, 0, 0, 0x0060, 0x0020, 1, 1, 6}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny43U", 19, F_AVR8, {0x1E, 0x92, 0x0C}, 0, 0x01000, 0x040, 0, 0, 0, 0x0040, 4, 0x0060, 0x0100, 3, 1, 16}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny44", 20, F_AVR8, {0x1E, 0x92, 0x07}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny44A", 21, F_AVR8, {0x1E, 0x92, 0x07}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny45", 22, F_AVR8, {0x1E, 0x92, 0x06}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 15}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny48", 23, F_AVR8, {0x1E, 0x92, 0x09}, 0, 0x01000, 0x040, 0, 0, 0, 0x0040, 4, 0x0100, 0x0100, 3, 1, 20}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny84", 24, F_AVR8, {0x1E, 0x93, 0x0C}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny84A", 25, F_AVR8, {0x1E, 0x93, 0x0C}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny85", 26, F_AVR8, {0x1E, 0x93, 0x0B}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 15}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny87", 27, F_AVR8, {0x1E, 0x93, 0x87}, 0, 0x02000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny88", 28, F_AVR8, {0x1E, 0x93, 0x11}, 0, 0x02000, 0x040, 0, 0, 0, 0x0040, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny167", 29, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny261", 30, F_AVR8, {0x1E, 0x91, 0x0C}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny261A", 31, F_AVR8, {0x1E, 0x91, 0x0C}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny441", 32, F_AVR8, {0x1E, 0x92, 0x15}, 0, 0x01000, 0x010, 0, 0, 0, 0x0100, 4, 0x0100, 0x0100, 3, 1, 30}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny461", 33, F_AVR8, {0x1E, 0x92, 0x08}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny461A", 34, F_AVR8, {0x1E, 0x92, 0x08}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny828", 35, F_AVR8, {0x1E, 0x93, 0x14}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny828R", 36, F_AVR8, {0x1E, 0x93, 0x14}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26}, // avrdude, from ATtiny828
- {"ATtiny841", 37, F_AVR8, {0x1E, 0x93, 0x15}, 0, 0x02000, 0x010, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 30}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny861", 38, F_AVR8, {0x1E, 0x93, 0x0D}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny861A", 39, F_AVR8, {0x1E, 0x93, 0x0D}, 0, 0x02000, 0x040, 0, 0, 0, 0x0200, 4, 0x0060, 0x0200, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1634", 40, F_AVR8, {0x1E, 0x94, 0x12}, 0, 0x04000, 0x020, 0, 0, 0, 0x0100, 4, 0x0100, 0x0400, 3, 1, 28}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1634R", 41, F_AVR8, {0x1E, 0x94, 0x12}, 0, 0x04000, 0x020, 0, 0, 0, 0x0100, 4, 0x0100, 0x0400, 3, 1, 28}, // avrdude, from ATtiny1634
- {"ATtiny2313", 42, F_AVR8, {0x1E, 0x91, 0x0A}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny2313A", 43, F_AVR8, {0x1E, 0x91, 0x0A}, 0, 0x00800, 0x020, 0, 0, 0, 0x0080, 4, 0x0060, 0x0080, 3, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny4313", 44, F_AVR8, {0x1E, 0x92, 0x0D}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0060, 0x0100, 3, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega8", 45, F_AVR8, {0x1E, 0x93, 0x07}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega8A", 46, F_AVR8, {0x1E, 0x93, 0x07}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 19}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega8HVA", 47, F_AVR8, {0x1E, 0x93, 0x10}, 0, 0x02000, 0x080, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 1, 1, 21}, // atdf, avr-gcc 12.2.0
- {"ATmega8U2", 48, F_AVR8, {0x1E, 0x93, 0x89}, 0, 0x02000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega16", 49, F_AVR8, {0x1E, 0x94, 0x03}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega16A", 50, F_AVR8, {0x1E, 0x94, 0x03}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0400, 2, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega16HVA", 51, F_AVR8, {0x1E, 0x94, 0x0C}, 0, 0x04000, 0x080, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 1, 1, 21}, // atdf, avr-gcc 12.2.0
- {"ATmega16HVB", 52, F_AVR8, {0x1E, 0x94, 0x0D}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 2, 1, 29}, // atdf, avr-gcc 12.2.0
- {"ATmega16HVBrevB", 53, F_AVR8, {0x1E, 0x94, 0x0D}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 2, 1, 29}, // atdf, avr-gcc 12.2.0
- {"ATmega16M1", 54, F_AVR8, {0x1E, 0x94, 0x84}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31}, // atdf, avr-gcc 12.2.0
- {"ATmega16HVA2", 55, F_AVR8, {0x1E, 0x94, 0x0E}, 0, 0x04000, 0x080, -1, -1, -1, -1, -1, 0x0100, 0x0400, 2, 1, 22}, // avr-gcc 12.2.0
- {"ATmega16U2", 56, F_AVR8, {0x1E, 0x94, 0x89}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega16U4", 57, F_AVR8, {0x1E, 0x94, 0x88}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0500, 3, 1, 43}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega32", 58, F_AVR8, {0x1E, 0x95, 0x02}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0060, 0x0800, 2, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega32A", 59, F_AVR8, {0x1E, 0x95, 0x02}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0060, 0x0800, 2, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega32HVB", 60, F_AVR8, {0x1E, 0x95, 0x10}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 2, 1, 29}, // atdf, avr-gcc 12.2.0
- {"ATmega32HVBrevB", 61, F_AVR8, {0x1E, 0x95, 0x10}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 2, 1, 29}, // atdf, avr-gcc 12.2.0
- {"ATmega32C1", 62, F_AVR8, {0x1E, 0x95, 0x86}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31}, // atdf, avr-gcc 12.2.0
- {"ATmega32M1", 63, F_AVR8, {0x1E, 0x95, 0x84}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega32U2", 64, F_AVR8, {0x1E, 0x95, 0x8A}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0400, 3, 1, 29}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega32U4", 65, F_AVR8, {0x1E, 0x95, 0x87}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0a00, 3, 1, 43}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega32U6", 66, F_AVR8, {0x1E, 0x95, 0x88}, 0, 0x08000, 0x080, 4, 0x0200, -1, -1, -1, 0x0100, 0x0a00, 3, 1, 38}, // avr-gcc 12.2.0, boot size (manual)
- {"ATmega48", 67, F_AVR8, {0x1E, 0x92, 0x05}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega48A", 68, F_AVR8, {0x1E, 0x92, 0x05}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega48P", 69, F_AVR8, {0x1E, 0x92, 0x0A}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega48PA", 70, F_AVR8, {0x1E, 0x92, 0x0A}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega48PB", 71, F_AVR8, {0x1E, 0x92, 0x10}, 0, 0x01000, 0x040, 0, 0, 0, 0x0100, 4, 0x0100, 0x0200, 3, 1, 27}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega64", 72, F_AVR8, {0x1E, 0x96, 0x02}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 35}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega64A", 73, F_AVR8, {0x1E, 0x96, 0x02}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 35}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega64HVE", 74, F_AVR8, {0x1E, 0x96, 0x10}, 0, 0x10000, 0x080, 4, 0x0400, -1, -1, -1, 0x0100, 0x1000, 2, 1, 25}, // avr-gcc 12.2.0, boot size (manual)
- {"ATmega64C1", 75, F_AVR8, {0x1E, 0x96, 0x86}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31}, // atdf, avr-gcc 12.2.0
- {"ATmega64M1", 76, F_AVR8, {0x1E, 0x96, 0x84}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega64HVE2", 77, F_AVR8, {0x1E, 0x96, 0x10}, 0, 0x10000, 0x080, 4, 0x0400, 0, 0x0400, 4, 0x0100, 0x1000, 2, 1, 25}, // atdf, avr-gcc 12.2.0
- {"ATmega64RFR2", 78, F_AVR8, {0x1E, 0xA6, 0x02}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0200, 0x2000, 3, 1, 77}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega88", 79, F_AVR8, {0x1E, 0x93, 0x0A}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega88A", 80, F_AVR8, {0x1E, 0x93, 0x0A}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega88P", 81, F_AVR8, {0x1E, 0x93, 0x0F}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega88PA", 82, F_AVR8, {0x1E, 0x93, 0x0F}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega88PB", 83, F_AVR8, {0x1E, 0x93, 0x16}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 27}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega103", 84, F_AVR8, {0x1E, 0x97, 0x01}, 0, 0x20000, 0x100, 0, 0, 0, 0x1000, 1, 0x0060, 0x0fa0, 1, 1, 24}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATmega128", 85, F_AVR8, {0x1E, 0x97, 0x02}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x1000, 3, 1, 35}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega128A", 86, F_AVR8, {0x1E, 0x97, 0x02}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x1000, 3, 1, 35}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega128RFA1", 87, F_AVR8, {0x1E, 0xA7, 0x01}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x4000, 3, 1, 72}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega128RFR2", 88, F_AVR8, {0x1E, 0xA7, 0x02}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x4000, 3, 1, 77}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega161", 89, F_AVR8, {0x1E, 0x94, 0x01}, 0, 0x04000, 0x080, 1, 0x0400, 0, 0x0200, 1, 0x0060, 0x0400, 1, 1, 21}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATmega162", 90, F_AVR8, {0x1E, 0x94, 0x04}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 28}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega163", 91, F_AVR8, {0x1E, 0x94, 0x02}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 1, 0x0060, 0x0400, 2, 1, 18}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATmega164A", 92, F_AVR8, {0x1E, 0x94, 0x0F}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega164P", 93, F_AVR8, {0x1E, 0x94, 0x0A}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega164PA", 94, F_AVR8, {0x1E, 0x94, 0x0A}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega165", 95, F_AVR8, {0x1E, 0x94, 0x10}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATmega165A", 96, F_AVR8, {0x1E, 0x94, 0x10}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega165P", 97, F_AVR8, {0x1E, 0x94, 0x07}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega165PA", 98, F_AVR8, {0x1E, 0x94, 0x07}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega168", 99, F_AVR8, {0x1E, 0x94, 0x06}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega168A", 100, F_AVR8, {0x1E, 0x94, 0x06}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega168P", 101, F_AVR8, {0x1E, 0x94, 0x0B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega168PA", 102, F_AVR8, {0x1E, 0x94, 0x0B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega168PB", 103, F_AVR8, {0x1E, 0x94, 0x15}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 27}, // atdf, avr-gcc 7.3.0, avrdude
- {"ATmega169", 104, F_AVR8, {0x1E, 0x94, 0x05}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"ATmega169A", 105, F_AVR8, {0x1E, 0x94, 0x11}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega169P", 106, F_AVR8, {0x1E, 0x94, 0x05}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega169PA", 107, F_AVR8, {0x1E, 0x94, 0x05}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega256RFR2", 108, F_AVR8, {0x1E, 0xA8, 0x02}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x2000, 8, 0x0200, 0x8000, 3, 1, 77}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega323", 109, F_AVR8, {0x1E, 0x95, 0x01}, 0, 0x08000, 0x080, 4, 0x0200, -1, -1, -1, 0x0060, 0x0800, 2, 1, 21}, // avr-gcc 12.2.0, boot size (manual)
- {"ATmega324A", 110, F_AVR8, {0x1E, 0x95, 0x15}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega324P", 111, F_AVR8, {0x1E, 0x95, 0x08}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega324PA", 112, F_AVR8, {0x1E, 0x95, 0x11}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega324PB", 113, F_AVR8, {0x1E, 0x95, 0x17}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 51}, // atdf, avrdude
- {"ATmega325", 114, F_AVR8, {0x1E, 0x95, 0x05}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega325A", 115, F_AVR8, {0x1E, 0x95, 0x05}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega325P", 116, F_AVR8, {0x1E, 0x95, 0x0D}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega325PA", 117, F_AVR8, {0x1E, 0x95, 0x0D}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega328", 118, F_AVR8, {0x1E, 0x95, 0x14}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega328P", 119, F_AVR8, {0x1E, 0x95, 0x0F}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega328PB", 120, F_AVR8, {0x1E, 0x95, 0x16}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 45}, // atdf, avr-gcc 7.3.0, avrdude
- {"ATmega329", 121, F_AVR8, {0x1E, 0x95, 0x03}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega329A", 122, F_AVR8, {0x1E, 0x95, 0x03}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega329P", 123, F_AVR8, {0x1E, 0x95, 0x0B}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega329PA", 124, F_AVR8, {0x1E, 0x95, 0x0B}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega406", 125, F_AVR8, {0x1E, 0x95, 0x07}, 0, 0x0a000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0800, 2, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega640", 126, F_AVR8, {0x1E, 0x96, 0x08}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega644", 127, F_AVR8, {0x1E, 0x96, 0x09}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 28}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega644A", 128, F_AVR8, {0x1E, 0x96, 0x09}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega644P", 129, F_AVR8, {0x1E, 0x96, 0x0A}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega644PA", 130, F_AVR8, {0x1E, 0x96, 0x0A}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega644RFR2", 131, F_AVR8, {0x1E, 0xA6, 0x03}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0200, 0x2000, 3, 1, 77}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega645", 132, F_AVR8, {0x1E, 0x96, 0x05}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega645A", 133, F_AVR8, {0x1E, 0x96, 0x05}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega645P", 134, F_AVR8, {0x1E, 0x96, 0x0D}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 22}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega649", 135, F_AVR8, {0x1E, 0x96, 0x03}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega649A", 136, F_AVR8, {0x1E, 0x96, 0x03}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega649P", 137, F_AVR8, {0x1E, 0x96, 0x0B}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 23}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1280", 138, F_AVR8, {0x1E, 0x97, 0x03}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1281", 139, F_AVR8, {0x1E, 0x97, 0x04}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1284", 140, F_AVR8, {0x1E, 0x97, 0x06}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x4000, 3, 1, 35}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1284P", 141, F_AVR8, {0x1E, 0x97, 0x05}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x4000, 3, 1, 35}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1284RFR2", 142, F_AVR8, {0x1E, 0xA7, 0x03}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x4000, 3, 1, 77}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega2560", 143, F_AVR8, {0x1E, 0x98, 0x01}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega2561", 144, F_AVR8, {0x1E, 0x98, 0x02}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0200, 0x2000, 3, 1, 57}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega2564RFR2", 145, F_AVR8, {0x1E, 0xA8, 0x03}, 0, 0x40000, 0x100, 4, 0x0400, 0, 0x2000, 8, 0x0200, 0x8000, 3, 1, 77}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3250", 146, F_AVR8, {0x1E, 0x95, 0x06}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3250A", 147, F_AVR8, {0x1E, 0x95, 0x06}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3250P", 148, F_AVR8, {0x1E, 0x95, 0x0E}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3250PA", 149, F_AVR8, {0x1E, 0x95, 0x0E}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3290", 150, F_AVR8, {0x1E, 0x95, 0x04}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3290A", 151, F_AVR8, {0x1E, 0x95, 0x04}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3290P", 152, F_AVR8, {0x1E, 0x95, 0x0C}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3290PA", 153, F_AVR8, {0x1E, 0x95, 0x0C}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega6450", 154, F_AVR8, {0x1E, 0x96, 0x06}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega6450A", 155, F_AVR8, {0x1E, 0x96, 0x06}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega6450P", 156, F_AVR8, {0x1E, 0x96, 0x0E}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega6490", 157, F_AVR8, {0x1E, 0x96, 0x04}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega6490A", 158, F_AVR8, {0x1E, 0x96, 0x04}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega6490P", 159, F_AVR8, {0x1E, 0x96, 0x0C}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 25}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega8515", 160, F_AVR8, {0x1E, 0x93, 0x06}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0200, 2, 1, 17}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega8535", 161, F_AVR8, {0x1E, 0x93, 0x08}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0060, 0x0200, 2, 1, 21}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT43USB320", 162, F_AVR8, {0xff, -1, -1}, 0, 0x10000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0200, -1, -1, 0}, // avr-gcc 12.2.0
- {"AT43USB355", 163, F_AVR8, {0xff, -1, -1}, 0, 0x06000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0400, -1, -1, 0}, // avr-gcc 12.2.0
- {"AT76C711", 164, F_AVR8, {0xff, -1, -1}, 0, 0x04000, -1, -1, -1, -1, -1, -1, 0x0060, 0x07a0, -1, -1, 0}, // avr-gcc 12.2.0
- {"AT86RF401", 165, F_AVR8, {0x1E, 0x91, 0x81}, 0, 0x00800, -1, -1, -1, -1, -1, -1, 0x0060, 0x0080, 0, 1, 3}, // avr-gcc 12.2.0
- {"AT90PWM1", 166, F_AVR8, {0x1E, 0x93, 0x83}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32}, // atdf, avr-gcc 12.2.0
- {"AT90PWM2", 167, F_AVR8, {0x1E, 0x93, 0x81}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90PWM2B", 168, F_AVR8, {0x1E, 0x93, 0x83}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90PWM3", 169, F_AVR8, {0x1E, 0x93, 0x81}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90PWM3B", 170, F_AVR8, {0x1E, 0x93, 0x83}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 32}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90CAN32", 171, F_AVR8, {0x1E, 0x95, 0x81}, 0, 0x08000, 0x100, 4, 0x0400, 0, 0x0400, 8, 0x0100, 0x0800, 3, 1, 37}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90CAN64", 172, F_AVR8, {0x1E, 0x96, 0x81}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 37}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90PWM81", 173, F_AVR8, {0x1E, 0x93, 0x88}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0100, 3, 1, 20}, // atdf, avr-gcc 12.2.0
- {"AT90USB82", 174, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90SCR100", 175, F_AVR8, {0x1E, 0x96, 0xC1}, 0, 0x10000, 0x100, 4, 0x0200, -1, -1, -1, 0x0100, 0x1000, 3, 1, 38}, // avr-gcc 12.2.0, boot size (manual)
- {"AT90CAN128", 176, F_AVR8, {0x1E, 0x97, 0x81}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x1000, 3, 1, 37}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90PWM161", 177, F_AVR8, {0x1E, 0x94, 0x8B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 20}, // atdf, avr-gcc 12.2.0
- {"AT90USB162", 178, F_AVR8, {0x1E, 0x94, 0x82}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 29}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90PWM216", 179, F_AVR8, {0x1E, 0x94, 0x83}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 32}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90PWM316", 180, F_AVR8, {0x1E, 0x94, 0x83}, 0, 0x04000, 0x080, 4, 0x0200, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 32}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90USB646", 181, F_AVR8, {0x1E, 0x96, 0x82}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 38}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90USB647", 182, F_AVR8, {0x1E, 0x96, 0x82}, 0, 0x10000, 0x100, 4, 0x0400, 0, 0x0800, 8, 0x0100, 0x1000, 3, 1, 38}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90S1200", 183, F_AVR8, {0x1E, 0x90, 0x01}, 0, 0x00400, 0x001, 0, 0, 0, 0x0040, 1, 0x0060, 0x0020, 1, 1, 4}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90USB1286", 184, F_AVR8, {0x1E, 0x97, 0x82}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x2000, 3, 1, 38}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90USB1287", 185, F_AVR8, {0x1E, 0x97, 0x82}, 0, 0x20000, 0x100, 4, 0x0400, 0, 0x1000, 8, 0x0100, 0x2000, 3, 1, 38}, // atdf, avr-gcc 12.2.0, avrdude
- {"AT90S2313", 186, F_AVR8, {0x1E, 0x91, 0x01}, 0, 0x00800, 0x001, 0, 0, 0, 0x0080, 1, 0x0060, 0x0080, 1, 1, 11}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90S2323", 187, F_AVR8, {0x1E, 0x91, 0x02}, 0, 0x00800, -1, 0, 0, -1, -1, -1, 0x0060, 0x0080, 1, 1, 3}, // avr-gcc 12.2.0, boot size (manual)
- {"AT90S2333", 188, F_AVR8, {0x1E, 0x91, 0x05}, 0, 0x00800, 0x001, 0, 0, 0, 0x0080, 1, 0x0060, 0x0080, -1, -1, 14}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90S2343", 189, F_AVR8, {0x1E, 0x91, 0x03}, 0, 0x00800, 0x001, 0, 0, 0, 0x0080, 1, 0x0060, 0x0080, 1, 1, 3}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90S4414", 190, F_AVR8, {0x1E, 0x92, 0x01}, 0, 0x01000, 0x001, 0, 0, 0, 0x0100, 1, 0x0060, 0x0100, 1, 1, 13}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90S4433", 191, F_AVR8, {0x1E, 0x92, 0x03}, 0, 0x01000, 0x001, 0, 0, 0, 0x0100, 1, 0x0060, 0x0080, 1, 1, 14}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90S4434", 192, F_AVR8, {0x1E, 0x92, 0x02}, 0, 0x01000, 0x001, 0, 0, 0, 0x0100, 1, 0x0060, 0x0100, 1, 1, 17}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90S8515", 193, F_AVR8, {0x1E, 0x93, 0x01}, 0, 0x02000, 0x001, 0, 0, 0, 0x0200, 1, 0x0060, 0x0200, 1, 1, 13}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT90C8534", 194, F_AVR8, {0xff, -1, -1}, 0, 0x02000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0100, -1, -1, 0}, // avr-gcc 12.2.0
- {"AT90S8535", 195, F_AVR8, {0x1E, 0x93, 0x03}, 0, 0x02000, 0x001, 0, 0, 0, 0x0200, 1, 0x0060, 0x0200, 1, 1, 17}, // avr-gcc 12.2.0, avrdude, boot size (manual)
- {"AT94K", 196, F_AVR8, {0xff, -1, -1}, 0, 0x08000, -1, -1, -1, -1, -1, -1, 0x0060, 0x0fa0, -1, -1, 0}, // avr-gcc 12.2.0
- {"ATA5272", 197, F_AVR8, {0x1E, 0x93, 0x87}, 0, 0x02000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 37}, // atdf, avr-gcc 12.2.0
- {"ATA5505", 198, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0
- {"ATA5700M322", 199, F_AVR8, {0x1E, 0x95, 0x67}, 0x08000, 0x08000, 0x040, 0, 0, 0, 0x0880, 16, 0x0200, 0x0400, 1, 1, 51}, // atdf
- {"ATA5702M322", 200, F_AVR8, {0x1E, 0x95, 0x69}, 0x08000, 0x08000, 0x040, 0, 0, 0, 0x0880, 16, 0x0200, 0x0400, 1, 1, 51}, // atdf, avr-gcc 12.2.0
- {"ATA5781", 201, F_AVR8, {0x1E, 0x95, 0x64}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf
- {"ATA5782", 202, F_AVR8, {0x1E, 0x95, 0x65}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf, avr-gcc 12.2.0
- {"ATA5783", 203, F_AVR8, {0x1E, 0x95, 0x66}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf
- {"ATA5787", 204, F_AVR8, {0x1E, 0x94, 0x6C}, 0x08000, 0x05200, 0x040, 0, 0, 0, 0x0400, 16, 0x0200, 0x0800, 1, 1, 44}, // atdf
- {"ATA5790", 205, F_AVR8, {0x1E, 0x94, 0x61}, 0, 0x04000, 0x080, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 30}, // atdf, avr-gcc 12.2.0
- {"ATA5790N", 206, F_AVR8, {0x1E, 0x94, 0x62}, 0, 0x04000, 0x080, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 31}, // atdf, avr-gcc 12.2.0
- {"ATA5791", 207, F_AVR8, {0x1E, 0x94, 0x62}, 0, 0x04000, 0x080, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 31}, // atdf, avr-gcc 7.3.0
- {"ATA5795", 208, F_AVR8, {0x1E, 0x93, 0x61}, 0, 0x02000, 0x040, 1, 0x0800, 0, 0x0800, 16, 0x0100, 0x0200, 1, 1, 23}, // atdf, avr-gcc 12.2.0
- {"ATA5831", 209, F_AVR8, {0x1E, 0x95, 0x61}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf, avr-gcc 12.2.0
- {"ATA5832", 210, F_AVR8, {0x1E, 0x95, 0x62}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf
- {"ATA5833", 211, F_AVR8, {0x1E, 0x95, 0x63}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf
- {"ATA5835", 212, F_AVR8, {0x1E, 0x94, 0x6B}, 0x08000, 0x05200, 0x040, 0, 0, 0, 0x0400, 16, 0x0200, 0x0800, 1, 1, 44}, // atdf
- {"ATA6285", 213, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0140, 4, 0x0100, 0x0200, 2, 1, 27}, // atdf, avr-gcc 12.2.0
- {"ATA6286", 214, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0140, 4, 0x0100, 0x0200, 2, 1, 27}, // atdf, avr-gcc 12.2.0
- {"ATA6289", 215, F_AVR8, {0x1E, 0x93, 0x82}, 0, 0x02000, 0x040, 4, 0x0100, -1, -1, -1, 0x0100, 0x0200, 2, 1, 27}, // avr-gcc 12.2.0, boot size (manual)
- {"ATA6612C", 216, F_AVR8, {0x1E, 0x93, 0x0A}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0
- {"ATA6613C", 217, F_AVR8, {0x1E, 0x94, 0x06}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // atdf, avr-gcc 12.2.0
- {"ATA6614Q", 218, F_AVR8, {0x1E, 0x95, 0x0F}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26}, // atdf, avr-gcc 12.2.0
- {"ATA6616C", 219, F_AVR8, {0x1E, 0x93, 0x87}, 0, 0x02000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0
- {"ATA6617C", 220, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0
- {"ATA8210", 221, F_AVR8, {0x1E, 0x95, 0x65}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf, avr-gcc 7.3.0
- {"ATA8215", 222, F_AVR8, {0x1E, 0x95, 0x64}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf
- {"ATA8510", 223, F_AVR8, {0x1E, 0x95, 0x61}, 0x08000, 0x05000, 0x040, 1, 0x5000, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf, avr-gcc 7.3.0
- {"ATA8515", 224, F_AVR8, {0x1E, 0x95, 0x63}, -1, -1, -1, 0, 0, 0, 0x0400, 16, 0x0200, 0x0400, 1, 1, 42}, // atdf
- {"ATA664251", 225, F_AVR8, {0x1E, 0x94, 0x87}, 0, 0x04000, 0x080, 0, 0, 0, 0x0200, 4, 0x0100, 0x0200, 3, 1, 20}, // atdf, avr-gcc 12.2.0
- {"M3000", 226, F_AVR8, {0xff, -1, -1}, 0, 0x10000, -1, -1, -1, -1, -1, -1, 0x1000, 0x1000, -1, -1, 0}, // avr-gcc 12.2.0
- {"LGT8F88P", 227, F_AVR8, {0x1E, 0x93, 0x0F}, 0, 0x02000, 0x040, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // avrdude, from ATmega88
- {"LGT8F168P", 228, F_AVR8, {0x1E, 0x94, 0x0B}, 0, 0x04000, 0x080, 4, 0x0100, 0, 0x0200, 4, 0x0100, 0x0400, 3, 1, 26}, // avrdude, from ATmega168P
- {"LGT8F328P", 229, F_AVR8, {0x1E, 0x95, 0x0F}, 0, 0x08000, 0x080, 4, 0x0200, 0, 0x0400, 4, 0x0100, 0x0800, 3, 1, 26}, // avrdude, from ATmega328P
-
- {"ATxmega8E5", 230, F_XMEGA, {0x1E, 0x93, 0x41}, 0, 0x02800, 0x080, 1, 0x0800, 0, 0x0200, 32, 0x2000, 0x0400, 7, 1, 43}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega16A4", 231, F_XMEGA, {0x1E, 0x94, 0x41}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 94}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega16A4U", 232, F_XMEGA, {0x1E, 0x94, 0x41}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega16C4", 233, F_XMEGA, {0x1E, 0x94, 0x43}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega16D4", 234, F_XMEGA, {0x1E, 0x94, 0x42}, 0, 0x05000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x0800, 6, 1, 91}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega16E5", 235, F_XMEGA, {0x1E, 0x94, 0x45}, 0, 0x05000, 0x080, 1, 0x1000, 0, 0x0200, 32, 0x2000, 0x0800, 7, 1, 43}, // atdf, avr-gcc 7.3.0, avrdude
- {"ATxmega32C3", 236, F_XMEGA, {0x1E, 0x95, 0x49}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0
- {"ATxmega32D3", 237, F_XMEGA, {0x1E, 0x95, 0x4A}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 114}, // atdf, avr-gcc 12.2.0
- {"ATxmega32A4", 238, F_XMEGA, {0x1E, 0x95, 0x41}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 94}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega32A4U", 239, F_XMEGA, {0x1E, 0x95, 0x41}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega32C4", 240, F_XMEGA, {0x1E, 0x95, 0x44}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega32D4", 241, F_XMEGA, {0x1E, 0x95, 0x42}, 0, 0x09000, 0x100, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 6, 1, 91}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega32E5", 242, F_XMEGA, {0x1E, 0x95, 0x4C}, 0, 0x09000, 0x080, 1, 0x1000, 0, 0x0400, 32, 0x2000, 0x1000, 7, 1, 43}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64A1", 243, F_XMEGA, {0x1E, 0x96, 0x4E}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 125}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64A1U", 244, F_XMEGA, {0x1E, 0x96, 0x4E}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64B1", 245, F_XMEGA, {0x1E, 0x96, 0x52}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 81}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64A3", 246, F_XMEGA, {0x1E, 0x96, 0x42}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 122}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64A3U", 247, F_XMEGA, {0x1E, 0x96, 0x42}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64B3", 248, F_XMEGA, {0x1E, 0x96, 0x51}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 54}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64C3", 249, F_XMEGA, {0x1E, 0x96, 0x49}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64D3", 250, F_XMEGA, {0x1E, 0x96, 0x4A}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 114}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64A4", 251, F_XMEGA, {0x1E, 0x96, 0x46}, 0, 0x11000, 0x100, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0}, // avrdude
- {"ATxmega64A4U", 252, F_XMEGA, {0x1E, 0x96, 0x46}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega64D4", 253, F_XMEGA, {0x1E, 0x96, 0x47}, 0, 0x11000, 0x100, 1, 0x1000, 0, 0x0800, 32, 0x2000, 0x1000, 6, 1, 91}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128A1", 254, F_XMEGA, {0x1E, 0x97, 0x4C}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 125}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128A1revD", 255, F_XMEGA, {0x1E, 0x97, 0x41}, 0, 0x22000, 0x200, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0}, // avrdude
- {"ATxmega128A1U", 256, F_XMEGA, {0x1E, 0x97, 0x4C}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128B1", 257, F_XMEGA, {0x1E, 0x97, 0x4D}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 81}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128A3", 258, F_XMEGA, {0x1E, 0x97, 0x42}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 122}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128A3U", 259, F_XMEGA, {0x1E, 0x97, 0x42}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128B3", 260, F_XMEGA, {0x1E, 0x97, 0x4B}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 54}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128C3", 261, F_XMEGA, {0x1E, 0x97, 0x52}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128D3", 262, F_XMEGA, {0x1E, 0x97, 0x48}, 0, 0x22000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 114}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128A4", 263, F_XMEGA, {0x1E, 0x97, 0x46}, 0, 0x22000, 0x200, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0}, // avrdude
- {"ATxmega128A4U", 264, F_XMEGA, {0x1E, 0x97, 0x46}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega128D4", 265, F_XMEGA, {0x1E, 0x97, 0x47}, 0, 0x22000, 0x100, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x2000, 6, 1, 91}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega192A1", 266, F_XMEGA, {0x1E, 0x97, 0x4E}, 0, 0x32000, 0x200, -1, -1, 0, 0x0800, 32, -1, -1, -1, -1, 0}, // avrdude
- {"ATxmega192A3", 267, F_XMEGA, {0x1E, 0x97, 0x44}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 122}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega192A3U", 268, F_XMEGA, {0x1E, 0x97, 0x44}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega192C3", 269, F_XMEGA, {0x1E, 0x97, 0x51}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega192D3", 270, F_XMEGA, {0x1E, 0x97, 0x49}, 0, 0x32000, 0x200, 1, 0x2000, 0, 0x0800, 32, 0x2000, 0x4000, 6, 1, 114}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega256A1", 271, F_XMEGA, {0x1E, 0x98, 0x46}, 0, 0x42000, 0x200, -1, -1, 0, 0x1000, 32, -1, -1, -1, -1, 0}, // avrdude
- {"ATxmega256A3", 272, F_XMEGA, {0x1E, 0x98, 0x42}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 122}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega256A3B", 273, F_XMEGA, {0x1E, 0x98, 0x43}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 122}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega256A3BU", 274, F_XMEGA, {0x1E, 0x98, 0x43}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega256A3U", 275, F_XMEGA, {0x1E, 0x98, 0x42}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega256C3", 276, F_XMEGA, {0x1E, 0x98, 0x46}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega256D3", 277, F_XMEGA, {0x1E, 0x98, 0x44}, 0, 0x42000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x4000, 6, 1, 114}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega384C3", 278, F_XMEGA, {0x1E, 0x98, 0x45}, 0, 0x62000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x8000, 6, 1, 127}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATxmega384D3", 279, F_XMEGA, {0x1E, 0x98, 0x47}, 0, 0x62000, 0x200, 1, 0x2000, 0, 0x1000, 32, 0x2000, 0x8000, 6, 1, 114}, // atdf, avr-gcc 12.2.0, avrdude
-
- {"ATtiny202", 280, F_AVR8X, {0x1E, 0x91, 0x23}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny204", 281, F_AVR8X, {0x1E, 0x91, 0x22}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny212", 282, F_AVR8X, {0x1E, 0x91, 0x21}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny214", 283, F_AVR8X, {0x1E, 0x91, 0x20}, 0, 0x00800, 0x040, 1, 0, 0x01400, 0x0040, 32, 0x3f80, 0x0080, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny402", 284, F_AVR8X, {0x1E, 0x92, 0x27}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny404", 285, F_AVR8X, {0x1E, 0x92, 0x26}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny406", 286, F_AVR8X, {0x1E, 0x92, 0x25}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny412", 287, F_AVR8X, {0x1E, 0x92, 0x23}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny414", 288, F_AVR8X, {0x1E, 0x92, 0x22}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny416", 289, F_AVR8X, {0x1E, 0x92, 0x21}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny416auto", 290, F_AVR8X, {0x1E, 0x92, 0x28}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf
- {"ATtiny417", 291, F_AVR8X, {0x1E, 0x92, 0x20}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3f00, 0x0100, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny424", 292, F_AVR8X, {0x1E, 0x92, 0x2C}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 30}, // atdf, avrdude
- {"ATtiny426", 293, F_AVR8X, {0x1E, 0x92, 0x2B}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 30}, // atdf, avrdude
- {"ATtiny427", 294, F_AVR8X, {0x1E, 0x92, 0x2A}, 0, 0x01000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 30}, // atdf, avrdude
- {"ATtiny804", 295, F_AVR8X, {0x1E, 0x93, 0x25}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny806", 296, F_AVR8X, {0x1E, 0x93, 0x24}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny807", 297, F_AVR8X, {0x1E, 0x93, 0x23}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny814", 298, F_AVR8X, {0x1E, 0x93, 0x22}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny816", 299, F_AVR8X, {0x1E, 0x93, 0x21}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny817", 300, F_AVR8X, {0x1E, 0x93, 0x20}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3e00, 0x0200, 10, 1, 26}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny824", 301, F_AVR8X, {0x1E, 0x93, 0x29}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3c00, 0x0400, 10, 1, 30}, // atdf, avrdude
- {"ATtiny826", 302, F_AVR8X, {0x1E, 0x93, 0x28}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3c00, 0x0400, 10, 1, 30}, // atdf, avrdude
- {"ATtiny827", 303, F_AVR8X, {0x1E, 0x93, 0x27}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0080, 32, 0x3c00, 0x0400, 10, 1, 30}, // atdf, avrdude
- {"ATtiny1604", 304, F_AVR8X, {0x1E, 0x94, 0x25}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1606", 305, F_AVR8X, {0x1E, 0x94, 0x24}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1607", 306, F_AVR8X, {0x1E, 0x94, 0x23}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1614", 307, F_AVR8X, {0x1E, 0x94, 0x22}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1616", 308, F_AVR8X, {0x1E, 0x94, 0x21}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1617", 309, F_AVR8X, {0x1E, 0x94, 0x20}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny1624", 310, F_AVR8X, {0x1E, 0x94, 0x2A}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 30}, // atdf, avrdude
- {"ATtiny1626", 311, F_AVR8X, {0x1E, 0x94, 0x29}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 30}, // atdf, avrdude
- {"ATtiny1627", 312, F_AVR8X, {0x1E, 0x94, 0x28}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 30}, // atdf, avrdude
- {"ATtiny3214", 313, F_AVR8X, {0x1E, 0x95, 0x20}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3800, 0x0800, 10, 1, 31}, // avr-gcc 12.2.0
- {"ATtiny3216", 314, F_AVR8X, {0x1E, 0x95, 0x21}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3800, 0x0800, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny3217", 315, F_AVR8X, {0x1E, 0x95, 0x22}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3800, 0x0800, 10, 1, 31}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATtiny3224", 316, F_AVR8X, {0x1E, 0x95, 0x28}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3400, 0x0c00, 10, 1, 30}, // atdf, avrdude
- {"ATtiny3226", 317, F_AVR8X, {0x1E, 0x95, 0x27}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3400, 0x0c00, 10, 1, 30}, // atdf, avrdude
- {"ATtiny3227", 318, F_AVR8X, {0x1E, 0x95, 0x26}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3400, 0x0c00, 10, 1, 30}, // atdf, avrdude
- {"ATmega808", 319, F_AVR8X, {0x1E, 0x93, 0x26}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 36}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega809", 320, F_AVR8X, {0x1E, 0x93, 0x2A}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3c00, 0x0400, 10, 1, 40}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1608", 321, F_AVR8X, {0x1E, 0x94, 0x27}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 36}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega1609", 322, F_AVR8X, {0x1E, 0x94, 0x26}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0100, 32, 0x3800, 0x0800, 10, 1, 40}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3208", 323, F_AVR8X, {0x1E, 0x95, 0x30}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3000, 0x1000, 10, 1, 36}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega3209", 324, F_AVR8X, {0x1E, 0x95, 0x31}, 0, 0x08000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x3000, 0x1000, 10, 1, 40}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega4808", 325, F_AVR8X, {0x1E, 0x96, 0x50}, 0, 0x0c000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x2800, 0x1800, 10, 1, 36}, // atdf, avr-gcc 12.2.0, avrdude
- {"ATmega4809", 326, F_AVR8X, {0x1E, 0x96, 0x51}, 0, 0x0c000, 0x080, 1, 0, 0x01400, 0x0100, 64, 0x2800, 0x1800, 10, 1, 40}, // atdf, avr-gcc 12.2.0, avrdude
- {"AVR8EA28", 327, F_AVR8X, {0x1E, 0x93, 0x2C}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR8EA32", 328, F_AVR8X, {0x1E, 0x93, 0x2B}, 0, 0x02000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR16DD14", 329, F_AVR8X, {0x1E, 0x94, 0x34}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36}, // atdf, avrdude
- {"AVR16DD20", 330, F_AVR8X, {0x1E, 0x94, 0x33}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36}, // atdf, avrdude
- {"AVR16DD28", 331, F_AVR8X, {0x1E, 0x94, 0x32}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36}, // atdf, avrdude
- {"AVR16EA28", 332, F_AVR8X, {0x1E, 0x94, 0x37}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR16DD32", 333, F_AVR8X, {0x1E, 0x94, 0x31}, 0, 0x04000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7800, 0x0800, 16, 4, 36}, // atdf, avrdude
- {"AVR16EA32", 334, F_AVR8X, {0x1E, 0x94, 0x36}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR16EA48", 335, F_AVR8X, {0x1E, 0x94, 0x35}, 0, 0x04000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR32DD14", 336, F_AVR8X, {0x1E, 0x95, 0x3B}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36}, // atdf, avrdude
- {"AVR32DD20", 337, F_AVR8X, {0x1E, 0x95, 0x3A}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36}, // atdf, avrdude
- {"AVR32DA28", 338, F_AVR8X, {0x1E, 0x95, 0x34}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 41}, // atdf, avrdude
- {"AVR32DB28", 339, F_AVR8X, {0x1E, 0x95, 0x37}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 42}, // atdf, avrdude
- {"AVR32DD28", 340, F_AVR8X, {0x1E, 0x95, 0x39}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36}, // atdf, avrdude
- {"AVR32EA28", 341, F_AVR8X, {0x1E, 0x95, 0x3E}, 0, 0x08000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR32DA32", 342, F_AVR8X, {0x1E, 0x95, 0x33}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 44}, // atdf, avrdude
- {"AVR32DB32", 343, F_AVR8X, {0x1E, 0x95, 0x36}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 44}, // atdf, avrdude
- {"AVR32DD32", 344, F_AVR8X, {0x1E, 0x95, 0x38}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x7000, 0x1000, 16, 4, 36}, // atdf, avrdude
- {"AVR32EA32", 345, F_AVR8X, {0x1E, 0x95, 0x3D}, 0, 0x08000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR32DA48", 346, F_AVR8X, {0x1E, 0x95, 0x32}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 58}, // atdf, avrdude
- {"AVR32DB48", 347, F_AVR8X, {0x1E, 0x95, 0x35}, 0, 0x08000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x7000, 0x1000, 16, 4, 61}, // atdf, avrdude
- {"AVR32EA48", 348, F_AVR8X, {0x1E, 0x95, 0x3C}, 0, 0x08000, 0x040, 1, 0, 0x01400, 0x0200, 8, -1, -1, -1, -1, 0}, // avrdude
- {"AVR64DD14", 349, F_AVR8X, {0x1E, 0x96, 0x1D}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36}, // atdf, avrdude
- {"AVR64DD20", 350, F_AVR8X, {0x1E, 0x96, 0x1C}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36}, // atdf, avrdude
- {"AVR64DA28", 351, F_AVR8X, {0x1E, 0x96, 0x15}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 41}, // atdf, avrdude
- {"AVR64DB28", 352, F_AVR8X, {0x1E, 0x96, 0x19}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 42}, // atdf, avrdude
- {"AVR64DD28", 353, F_AVR8X, {0x1E, 0x96, 0x1B}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36}, // atdf, avrdude
- {"AVR64EA28", 354, F_AVR8X, {0x1E, 0x96, 0x20}, 0, 0x10000, 0x080, 1, 0, 0x01400, 0x0200, 8, 0x6800, 0x1800, 16, 4, 37}, // atdf, avrdude
- {"AVR64DA32", 355, F_AVR8X, {0x1E, 0x96, 0x14}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 44}, // atdf, avrdude
- {"AVR64DB32", 356, F_AVR8X, {0x1E, 0x96, 0x18}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 44}, // atdf, avrdude
- {"AVR64DD32", 357, F_AVR8X, {0x1E, 0x96, 0x1A}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0100, 1, 0x6000, 0x2000, 16, 4, 36}, // atdf, avrdude
- {"AVR64EA32", 358, F_AVR8X, {0x1E, 0x96, 0x1F}, 0, 0x10000, 0x080, 1, 0, 0x01400, 0x0200, 8, 0x6800, 0x1800, 16, 4, 37}, // atdf, avrdude
- {"AVR64DA48", 359, F_AVR8X, {0x1E, 0x96, 0x13}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 58}, // atdf, avrdude
- {"AVR64DB48", 360, F_AVR8X, {0x1E, 0x96, 0x17}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 61}, // atdf, avrdude
- {"AVR64EA48", 361, F_AVR8X, {0x1E, 0x96, 0x1E}, 0, 0x10000, 0x080, 1, 0, 0x01400, 0x0200, 8, 0x6800, 0x1800, 16, 4, 45}, // atdf, avrdude
- {"AVR64DA64", 362, F_AVR8X, {0x1E, 0x96, 0x12}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 64}, // atdf, avrdude
- {"AVR64DB64", 363, F_AVR8X, {0x1E, 0x96, 0x16}, 0, 0x10000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x6000, 0x2000, 16, 4, 65}, // atdf, avrdude
- {"AVR128DA28", 364, F_AVR8X, {0x1E, 0x97, 0x0A}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 41}, // atdf, avrdude
- {"AVR128DB28", 365, F_AVR8X, {0x1E, 0x97, 0x0E}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 42}, // atdf, avrdude
- {"AVR128DA32", 366, F_AVR8X, {0x1E, 0x97, 0x09}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 44}, // atdf, avrdude
- {"AVR128DB32", 367, F_AVR8X, {0x1E, 0x97, 0x0D}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 44}, // atdf, avrdude
- {"AVR128DA48", 368, F_AVR8X, {0x1E, 0x97, 0x08}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 58}, // atdf, avrdude
- {"AVR128DB48", 369, F_AVR8X, {0x1E, 0x97, 0x0C}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 61}, // atdf, avrdude
- {"AVR128DA64", 370, F_AVR8X, {0x1E, 0x97, 0x07}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 64}, // atdf, avrdude
- {"AVR128DB64", 371, F_AVR8X, {0x1E, 0x97, 0x0B}, 0, 0x20000, 0x200, 1, 0, 0x01400, 0x0200, 1, 0x4000, 0x4000, 16, 4, 65}, // atdf, avrdude
-};
-
-const size_t avr_isp_chip_arr_size = COUNT_OF(avr_isp_chip_arr);
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_chip_arr.h b/applications/external/avr_isp_programmer/lib/driver/avr_isp_chip_arr.h
deleted file mode 100644
index 66f16a7b9..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_chip_arr.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#pragma once
-
-#include
-
-#define F_AVR8L 1 // TPI programming, ATtiny(4|5|9|10|20|40|102|104)
-#define F_AVR8 2 // ISP programming with SPI, "classic" AVRs
-#define F_XMEGA 4 // PDI programming, ATxmega family
-#define F_AVR8X 8 // UPDI programming, newer 8-bit MCUs
-
-struct AvrIspChipArr { // Value of -1 typically means unknown
- const char* name; // Name of part
- uint16_t mcuid; // ID of MCU in 0..2039
- uint8_t avrarch; // F_AVR8L, F_AVR8, F_XMEGA or F_AVR8X
- uint8_t sigs[3]; // Signature bytes
- int32_t flashoffset; // Flash offset
- int32_t flashsize; // Flash size
- int16_t pagesize; // Flash page size
- int8_t nboots; // Number of supported boot sectors
- int16_t bootsize; // Size of (smallest) boot sector
- int32_t eepromoffset; // EEPROM offset
- int32_t eepromsize; // EEPROM size
- int32_t eeprompagesize; // EEPROM page size
- int32_t sramstart; // SRAM offset
- int32_t sramsize; // SRAM size
- int8_t nfuses; // Number of fuse bytes
- int8_t nlocks; // Number of lock bytes
- uint8_t ninterrupts; // Number of vectors in interrupt vector table
-};
-
-typedef struct AvrIspChipArr AvrIspChipArr;
-
-extern const AvrIspChipArr avr_isp_chip_arr[];
-extern const size_t avr_isp_chip_arr_size;
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog.c b/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog.c
deleted file mode 100644
index 0f46872dd..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog.c
+++ /dev/null
@@ -1,639 +0,0 @@
-#include "avr_isp_prog.h"
-#include "avr_isp_prog_cmd.h"
-
-#include
-
-#define AVR_ISP_PROG_TX_RX_BUF_SIZE 320
-#define TAG "AvrIspProg"
-
-struct AvrIspProgSignature {
- uint8_t vendor;
- uint8_t part_family;
- uint8_t part_number;
-};
-
-typedef struct AvrIspProgSignature AvrIspProgSignature;
-
-struct AvrIspProgCfgDevice {
- uint8_t devicecode;
- uint8_t revision;
- uint8_t progtype;
- uint8_t parmode;
- uint8_t polling;
- uint8_t selftimed;
- uint8_t lockbytes;
- uint8_t fusebytes;
- uint8_t flashpoll;
- uint16_t eeprompoll;
- uint16_t pagesize;
- uint16_t eepromsize;
- uint32_t flashsize;
-};
-
-typedef struct AvrIspProgCfgDevice AvrIspProgCfgDevice;
-
-struct AvrIspProg {
- AvrIspSpiSw* spi;
- AvrIspProgCfgDevice* cfg;
- FuriStreamBuffer* stream_rx;
- FuriStreamBuffer* stream_tx;
-
- uint16_t error;
- uint16_t addr;
- bool pmode;
- bool exit;
- bool rst_active_high;
- uint8_t buff[AVR_ISP_PROG_TX_RX_BUF_SIZE];
-
- AvrIspProgCallback callback;
- void* context;
-};
-
-static void avr_isp_prog_end_pmode(AvrIspProg* instance);
-
-AvrIspProg* avr_isp_prog_init(void) {
- AvrIspProg* instance = malloc(sizeof(AvrIspProg));
- instance->cfg = malloc(sizeof(AvrIspProgCfgDevice));
- instance->stream_rx =
- furi_stream_buffer_alloc(sizeof(int8_t) * AVR_ISP_PROG_TX_RX_BUF_SIZE, sizeof(int8_t));
- instance->stream_tx =
- furi_stream_buffer_alloc(sizeof(int8_t) * AVR_ISP_PROG_TX_RX_BUF_SIZE, sizeof(int8_t));
- instance->rst_active_high = false;
- instance->exit = false;
- return instance;
-}
-
-void avr_isp_prog_free(AvrIspProg* instance) {
- furi_assert(instance);
- if(instance->spi) avr_isp_prog_end_pmode(instance);
- furi_stream_buffer_free(instance->stream_tx);
- furi_stream_buffer_free(instance->stream_rx);
- free(instance->cfg);
- free(instance);
-}
-
-size_t avr_isp_prog_spaces_rx(AvrIspProg* instance) {
- return furi_stream_buffer_spaces_available(instance->stream_rx);
-}
-
-bool avr_isp_prog_rx(AvrIspProg* instance, uint8_t* data, size_t len) {
- furi_assert(instance);
- furi_assert(data);
- furi_assert(len != 0);
- size_t ret = furi_stream_buffer_send(instance->stream_rx, data, sizeof(uint8_t) * len, 0);
- return ret == sizeof(uint8_t) * len;
-}
-
-size_t avr_isp_prog_tx(AvrIspProg* instance, uint8_t* data, size_t max_len) {
- furi_assert(instance);
- return furi_stream_buffer_receive(instance->stream_tx, data, sizeof(int8_t) * max_len, 0);
-}
-
-void avr_isp_prog_exit(AvrIspProg* instance) {
- furi_assert(instance);
- instance->exit = true;
-}
-
-void avr_isp_prog_set_tx_callback(AvrIspProg* instance, AvrIspProgCallback callback, void* context) {
- furi_assert(instance);
- furi_assert(context);
- instance->callback = callback;
- instance->context = context;
-}
-
-static void avr_isp_prog_tx_ch(AvrIspProg* instance, uint8_t data) {
- furi_assert(instance);
- furi_stream_buffer_send(instance->stream_tx, &data, sizeof(uint8_t), FuriWaitForever);
-}
-
-static uint8_t avr_isp_prog_getch(AvrIspProg* instance) {
- furi_assert(instance);
- uint8_t data[1] = {0};
- while(furi_stream_buffer_receive(instance->stream_rx, &data, sizeof(int8_t), 30) == 0) {
- if(instance->exit) break;
- };
- return data[0];
-}
-
-static void avr_isp_prog_fill(AvrIspProg* instance, size_t len) {
- furi_assert(instance);
- for(size_t x = 0; x < len; x++) {
- instance->buff[x] = avr_isp_prog_getch(instance);
- }
-}
-
-static void avr_isp_prog_reset_target(AvrIspProg* instance, bool reset) {
- furi_assert(instance);
- avr_isp_spi_sw_res_set(instance->spi, (reset == instance->rst_active_high) ? true : false);
-}
-
-static uint8_t avr_isp_prog_spi_transaction(
- AvrIspProg* instance,
- uint8_t cmd,
- uint8_t addr_hi,
- uint8_t addr_lo,
- uint8_t data) {
- furi_assert(instance);
-
- avr_isp_spi_sw_txrx(instance->spi, cmd);
- avr_isp_spi_sw_txrx(instance->spi, addr_hi);
- avr_isp_spi_sw_txrx(instance->spi, addr_lo);
- return avr_isp_spi_sw_txrx(instance->spi, data);
-}
-
-static void avr_isp_prog_empty_reply(AvrIspProg* instance) {
- furi_assert(instance);
- if(avr_isp_prog_getch(instance) == CRC_EOP) {
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
- avr_isp_prog_tx_ch(instance, STK_OK);
- } else {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- }
-}
-
-static void avr_isp_prog_breply(AvrIspProg* instance, uint8_t data) {
- furi_assert(instance);
- if(avr_isp_prog_getch(instance) == CRC_EOP) {
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
- avr_isp_prog_tx_ch(instance, data);
- avr_isp_prog_tx_ch(instance, STK_OK);
- } else {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- }
-}
-
-static void avr_isp_prog_get_version(AvrIspProg* instance, uint8_t data) {
- furi_assert(instance);
- switch(data) {
- case STK_HW_VER:
- avr_isp_prog_breply(instance, AVR_ISP_HWVER);
- break;
- case STK_SW_MAJOR:
- avr_isp_prog_breply(instance, AVR_ISP_SWMAJ);
- break;
- case STK_SW_MINOR:
- avr_isp_prog_breply(instance, AVR_ISP_SWMIN);
- break;
- case AVP_ISP_CONNECT_TYPE:
- avr_isp_prog_breply(instance, AVP_ISP_SERIAL_CONNECT_TYPE);
- break;
- default:
- avr_isp_prog_breply(instance, AVR_ISP_RESP_0);
- }
-}
-
-static void avr_isp_prog_set_cfg(AvrIspProg* instance) {
- furi_assert(instance);
- // call this after reading cfg packet into buff[]
- instance->cfg->devicecode = instance->buff[0];
- instance->cfg->revision = instance->buff[1];
- instance->cfg->progtype = instance->buff[2];
- instance->cfg->parmode = instance->buff[3];
- instance->cfg->polling = instance->buff[4];
- instance->cfg->selftimed = instance->buff[5];
- instance->cfg->lockbytes = instance->buff[6];
- instance->cfg->fusebytes = instance->buff[7];
- instance->cfg->flashpoll = instance->buff[8];
- // ignore (instance->buff[9] == instance->buff[8]) //FLASH polling value. Same as οΏ½flashpollοΏ½
- instance->cfg->eeprompoll = instance->buff[10] << 8 | instance->buff[11];
- instance->cfg->pagesize = instance->buff[12] << 8 | instance->buff[13];
- instance->cfg->eepromsize = instance->buff[14] << 8 | instance->buff[15];
- instance->cfg->flashsize = instance->buff[16] << 24 | instance->buff[17] << 16 |
- instance->buff[18] << 8 | instance->buff[19];
-
- // avr devices have active low reset, at89sx are active high
- instance->rst_active_high = (instance->cfg->devicecode >= 0xe0);
-}
-static bool
- avr_isp_prog_set_pmode(AvrIspProg* instance, uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
- furi_assert(instance);
- uint8_t res = 0;
- avr_isp_spi_sw_txrx(instance->spi, a);
- avr_isp_spi_sw_txrx(instance->spi, b);
- res = avr_isp_spi_sw_txrx(instance->spi, c);
- avr_isp_spi_sw_txrx(instance->spi, d);
- return res == 0x53;
-}
-
-static void avr_isp_prog_end_pmode(AvrIspProg* instance) {
- furi_assert(instance);
- if(instance->pmode) {
- avr_isp_prog_reset_target(instance, false);
- // We're about to take the target out of reset
- // so configure SPI pins as input
-
- if(instance->spi) avr_isp_spi_sw_free(instance->spi);
- instance->spi = NULL;
- }
-
- instance->pmode = false;
-}
-
-static bool avr_isp_prog_start_pmode(AvrIspProg* instance, AvrIspSpiSwSpeed spi_speed) {
- furi_assert(instance);
- // Reset target before driving PIN_SCK or PIN_MOSI
-
- // SPI.begin() will configure SS as output,
- // so SPI master mode is selected.
- // We have defined RESET as pin 10,
- // which for many arduino's is not the SS pin.
- // So we have to configure RESET as output here,
- // (reset_target() first sets the correct level)
- if(instance->spi) avr_isp_spi_sw_free(instance->spi);
- instance->spi = avr_isp_spi_sw_init(spi_speed);
-
- avr_isp_prog_reset_target(instance, true);
- // See avr datasheets, chapter "SERIAL_PRG Programming Algorithm":
-
- // Pulse RESET after PIN_SCK is low:
- avr_isp_spi_sw_sck_set(instance->spi, false);
-
- // discharge PIN_SCK, value arbitrally chosen
- furi_delay_ms(20);
- avr_isp_prog_reset_target(instance, false);
-
- // Pulse must be minimum 2 target CPU speed cycles
- // so 100 usec is ok for CPU speeds above 20KHz
- furi_delay_ms(1);
-
- avr_isp_prog_reset_target(instance, true);
-
- // Send the enable programming command:
- // datasheet: must be > 20 msec
- furi_delay_ms(50);
- if(avr_isp_prog_set_pmode(instance, AVR_ISP_SET_PMODE)) {
- instance->pmode = true;
- return true;
- }
- return false;
-}
-
-static AvrIspProgSignature avr_isp_prog_check_signature(AvrIspProg* instance) {
- furi_assert(instance);
- AvrIspProgSignature signature;
- signature.vendor = avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_VENDOR);
- signature.part_family = avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_PART_FAMILY);
- signature.part_number = avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_PART_NUMBER);
- return signature;
-}
-
-static bool avr_isp_prog_auto_set_spi_speed_start_pmode(AvrIspProg* instance) {
- AvrIspSpiSwSpeed spi_speed[] = {
- AvrIspSpiSwSpeed1Mhz,
- AvrIspSpiSwSpeed400Khz,
- AvrIspSpiSwSpeed250Khz,
- AvrIspSpiSwSpeed125Khz,
- AvrIspSpiSwSpeed60Khz,
- AvrIspSpiSwSpeed40Khz,
- AvrIspSpiSwSpeed20Khz,
- AvrIspSpiSwSpeed10Khz,
- AvrIspSpiSwSpeed5Khz,
- AvrIspSpiSwSpeed1Khz,
- };
- for(uint8_t i = 0; i < COUNT_OF(spi_speed); i++) {
- if(avr_isp_prog_start_pmode(instance, spi_speed[i])) {
- AvrIspProgSignature sig = avr_isp_prog_check_signature(instance);
- AvrIspProgSignature sig_examination = avr_isp_prog_check_signature(instance); //-V656
- uint8_t y = 0;
- while(y < 8) {
- if(memcmp(
- (uint8_t*)&sig, (uint8_t*)&sig_examination, sizeof(AvrIspProgSignature)) !=
- 0)
- break;
- sig_examination = avr_isp_prog_check_signature(instance);
- y++;
- }
- if(y == 8) {
- if(spi_speed[i] > AvrIspSpiSwSpeed1Mhz) {
- if(i < (COUNT_OF(spi_speed) - 1)) {
- avr_isp_prog_end_pmode(instance);
- i++;
- return avr_isp_prog_start_pmode(instance, spi_speed[i]);
- }
- }
- return true;
- }
- }
- }
-
- if(instance->spi) {
- avr_isp_spi_sw_free(instance->spi);
- instance->spi = NULL;
- }
-
- return false;
-}
-
-static void avr_isp_prog_universal(AvrIspProg* instance) {
- furi_assert(instance);
- uint8_t data;
-
- avr_isp_prog_fill(instance, 4);
- data = avr_isp_prog_spi_transaction(
- instance, instance->buff[0], instance->buff[1], instance->buff[2], instance->buff[3]);
- avr_isp_prog_breply(instance, data);
-}
-
-static void avr_isp_prog_commit(AvrIspProg* instance, uint16_t addr, uint8_t data) {
- furi_assert(instance);
- avr_isp_prog_spi_transaction(instance, AVR_ISP_COMMIT(addr));
- /* polling flash */
- if(data == 0xFF) {
- furi_delay_ms(5);
- } else {
- /* polling flash */
- uint32_t starttime = furi_get_tick();
- while((furi_get_tick() - starttime) < 30) {
- if(avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(addr)) != 0xFF) {
- break;
- };
- }
- }
-}
-
-static uint16_t avr_isp_prog_current_page(AvrIspProg* instance) {
- furi_assert(instance);
- uint16_t page = 0;
- switch(instance->cfg->pagesize) {
- case 32:
- page = instance->addr & 0xFFFFFFF0;
- break;
- case 64:
- page = instance->addr & 0xFFFFFFE0;
- break;
- case 128:
- page = instance->addr & 0xFFFFFFC0;
- break;
- case 256:
- page = instance->addr & 0xFFFFFF80;
- break;
-
- default:
- page = instance->addr;
- break;
- }
-
- return page;
-}
-
-static uint8_t avr_isp_prog_write_flash_pages(AvrIspProg* instance, size_t length) {
- furi_assert(instance);
- size_t x = 0;
- uint16_t page = avr_isp_prog_current_page(instance);
- while(x < length) {
- if(page != avr_isp_prog_current_page(instance)) {
- --x;
- avr_isp_prog_commit(instance, page, instance->buff[x++]);
- page = avr_isp_prog_current_page(instance);
- }
- avr_isp_prog_spi_transaction(
- instance, AVR_ISP_WRITE_FLASH_LO(instance->addr, instance->buff[x++]));
-
- avr_isp_prog_spi_transaction(
- instance, AVR_ISP_WRITE_FLASH_HI(instance->addr, instance->buff[x++]));
- instance->addr++;
- }
-
- avr_isp_prog_commit(instance, page, instance->buff[--x]);
- return STK_OK;
-}
-
-static void avr_isp_prog_write_flash(AvrIspProg* instance, size_t length) {
- furi_assert(instance);
- avr_isp_prog_fill(instance, length);
- if(avr_isp_prog_getch(instance) == CRC_EOP) {
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
- avr_isp_prog_tx_ch(instance, avr_isp_prog_write_flash_pages(instance, length));
- } else {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- }
-}
-
-// write (length) bytes, (start) is a byte address
-static uint8_t
- avr_isp_prog_write_eeprom_chunk(AvrIspProg* instance, uint16_t start, uint16_t length) {
- furi_assert(instance);
- // this writes byte-by-byte,
- // page writing may be faster (4 bytes at a time)
- avr_isp_prog_fill(instance, length);
- for(uint16_t x = 0; x < length; x++) {
- uint16_t addr = start + x;
- avr_isp_prog_spi_transaction(instance, AVR_ISP_WRITE_EEPROM(addr, instance->buff[x]));
- furi_delay_ms(10);
- }
- return STK_OK;
-}
-
-static uint8_t avr_isp_prog_write_eeprom(AvrIspProg* instance, size_t length) {
- furi_assert(instance);
- // here is a word address, get the byte address
- uint16_t start = instance->addr * 2;
- uint16_t remaining = length;
- if(length > instance->cfg->eepromsize) {
- instance->error++;
- return STK_FAILED;
- }
- while(remaining > AVR_ISP_EECHUNK) {
- avr_isp_prog_write_eeprom_chunk(instance, start, AVR_ISP_EECHUNK);
- start += AVR_ISP_EECHUNK;
- remaining -= AVR_ISP_EECHUNK;
- }
- avr_isp_prog_write_eeprom_chunk(instance, start, remaining);
- return STK_OK;
-}
-
-static void avr_isp_prog_program_page(AvrIspProg* instance) {
- furi_assert(instance);
- uint8_t result = STK_FAILED;
- uint16_t length = avr_isp_prog_getch(instance) << 8 | avr_isp_prog_getch(instance);
- uint8_t memtype = avr_isp_prog_getch(instance);
- // flash memory @addr, (length) bytes
- if(memtype == STK_SET_FLASH_TYPE) {
- avr_isp_prog_write_flash(instance, length);
- return;
- }
- if(memtype == STK_SET_EEPROM_TYPE) {
- result = avr_isp_prog_write_eeprom(instance, length);
- if(avr_isp_prog_getch(instance) == CRC_EOP) {
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
- avr_isp_prog_tx_ch(instance, result);
-
- } else {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- }
- return;
- }
- avr_isp_prog_tx_ch(instance, STK_FAILED);
- return;
-}
-
-static uint8_t avr_isp_prog_flash_read_page(AvrIspProg* instance, uint16_t length) {
- furi_assert(instance);
- for(uint16_t x = 0; x < length; x += 2) {
- avr_isp_prog_tx_ch(
- instance,
- avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_FLASH_LO(instance->addr)));
- avr_isp_prog_tx_ch(
- instance,
- avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(instance->addr)));
- instance->addr++;
- }
- return STK_OK;
-}
-
-static uint8_t avr_isp_prog_eeprom_read_page(AvrIspProg* instance, uint16_t length) {
- furi_assert(instance);
- // here again we have a word address
- uint16_t start = instance->addr * 2;
- for(uint16_t x = 0; x < length; x++) {
- uint16_t addr = start + x;
- avr_isp_prog_tx_ch(
- instance, avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_EEPROM(addr)));
- }
- return STK_OK;
-}
-
-static void avr_isp_prog_read_page(AvrIspProg* instance) {
- furi_assert(instance);
- uint8_t result = STK_FAILED;
- uint16_t length = avr_isp_prog_getch(instance) << 8 | avr_isp_prog_getch(instance);
- uint8_t memtype = avr_isp_prog_getch(instance);
- if(avr_isp_prog_getch(instance) != CRC_EOP) {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- return;
- }
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
- if(memtype == STK_SET_FLASH_TYPE) result = avr_isp_prog_flash_read_page(instance, length);
- if(memtype == STK_SET_EEPROM_TYPE) result = avr_isp_prog_eeprom_read_page(instance, length);
- avr_isp_prog_tx_ch(instance, result);
-}
-
-static void avr_isp_prog_read_signature(AvrIspProg* instance) {
- furi_assert(instance);
- if(avr_isp_prog_getch(instance) != CRC_EOP) {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- return;
- }
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
-
- avr_isp_prog_tx_ch(instance, avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_VENDOR));
- avr_isp_prog_tx_ch(instance, avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_PART_FAMILY));
- avr_isp_prog_tx_ch(instance, avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_PART_NUMBER));
-
- avr_isp_prog_tx_ch(instance, STK_OK);
-}
-
-void avr_isp_prog_avrisp(AvrIspProg* instance) {
- furi_assert(instance);
- uint8_t ch = avr_isp_prog_getch(instance);
-
- switch(ch) {
- case STK_GET_SYNC:
- FURI_LOG_D(TAG, "cmd STK_GET_SYNC");
- instance->error = 0;
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_GET_SIGN_ON:
- FURI_LOG_D(TAG, "cmd STK_GET_SIGN_ON");
- if(avr_isp_prog_getch(instance) == CRC_EOP) {
- avr_isp_prog_tx_ch(instance, STK_INSYNC);
-
- avr_isp_prog_tx_ch(instance, 'A');
- avr_isp_prog_tx_ch(instance, 'V');
- avr_isp_prog_tx_ch(instance, 'R');
- avr_isp_prog_tx_ch(instance, ' ');
- avr_isp_prog_tx_ch(instance, 'I');
- avr_isp_prog_tx_ch(instance, 'S');
- avr_isp_prog_tx_ch(instance, 'P');
-
- avr_isp_prog_tx_ch(instance, STK_OK);
- } else {
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- }
- break;
- case STK_GET_PARAMETER:
- FURI_LOG_D(TAG, "cmd STK_GET_PARAMETER");
- avr_isp_prog_get_version(instance, avr_isp_prog_getch(instance));
- break;
- case STK_SET_DEVICE:
- FURI_LOG_D(TAG, "cmd STK_SET_DEVICE");
- avr_isp_prog_fill(instance, 20);
- avr_isp_prog_set_cfg(instance);
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_SET_DEVICE_EXT: // ignore for now
- FURI_LOG_D(TAG, "cmd STK_SET_DEVICE_EXT");
- avr_isp_prog_fill(instance, 5);
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_ENTER_PROGMODE:
- FURI_LOG_D(TAG, "cmd STK_ENTER_PROGMODE");
- if(!instance->pmode) avr_isp_prog_auto_set_spi_speed_start_pmode(instance);
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_LOAD_ADDRESS:
- FURI_LOG_D(TAG, "cmd STK_LOAD_ADDRESS");
- instance->addr = avr_isp_prog_getch(instance) | avr_isp_prog_getch(instance) << 8;
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_PROG_FLASH: // ignore for now
- FURI_LOG_D(TAG, "cmd STK_PROG_FLASH");
- avr_isp_prog_getch(instance);
- avr_isp_prog_getch(instance);
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_PROG_DATA: // ignore for now
- FURI_LOG_D(TAG, "cmd STK_PROG_DATA");
- avr_isp_prog_getch(instance);
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_PROG_PAGE:
- FURI_LOG_D(TAG, "cmd STK_PROG_PAGE");
- avr_isp_prog_program_page(instance);
- break;
- case STK_READ_PAGE:
- FURI_LOG_D(TAG, "cmd STK_READ_PAGE");
- avr_isp_prog_read_page(instance);
- break;
- case STK_UNIVERSAL:
- FURI_LOG_D(TAG, "cmd STK_UNIVERSAL");
- avr_isp_prog_universal(instance);
- break;
- case STK_LEAVE_PROGMODE:
- FURI_LOG_D(TAG, "cmd STK_LEAVE_PROGMODE");
- instance->error = 0;
- if(instance->pmode) avr_isp_prog_end_pmode(instance);
- avr_isp_prog_empty_reply(instance);
- break;
- case STK_READ_SIGN:
- FURI_LOG_D(TAG, "cmd STK_READ_SIGN");
- avr_isp_prog_read_signature(instance);
- break;
- // expecting a command, not CRC_EOP
- // this is how we can get back in sync
- case CRC_EOP:
- FURI_LOG_D(TAG, "cmd CRC_EOP");
- instance->error++;
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- break;
- // anything else we will return STK_UNKNOWN
- default:
- FURI_LOG_D(TAG, "cmd STK_ERROR_CMD");
- instance->error++;
- if(avr_isp_prog_getch(instance) == CRC_EOP)
- avr_isp_prog_tx_ch(instance, STK_UNKNOWN);
- else
- avr_isp_prog_tx_ch(instance, STK_NOSYNC);
- }
-
- if(instance->callback) {
- instance->callback(instance->context);
- }
-}
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog.h b/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog.h
deleted file mode 100644
index 2c15ab066..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "avr_isp_spi_sw.h"
-#include
-
-typedef struct AvrIspProg AvrIspProg;
-typedef void (*AvrIspProgCallback)(void* context);
-
-AvrIspProg* avr_isp_prog_init(void);
-void avr_isp_prog_free(AvrIspProg* instance);
-size_t avr_isp_prog_spaces_rx(AvrIspProg* instance) ;
-bool avr_isp_prog_rx(AvrIspProg* instance, uint8_t* data, size_t len);
-size_t avr_isp_prog_tx(AvrIspProg* instance, uint8_t* data, size_t max_len);
-void avr_isp_prog_avrisp(AvrIspProg* instance);
-void avr_isp_prog_exit(AvrIspProg* instance);
-void avr_isp_prog_set_tx_callback(AvrIspProg* instance, AvrIspProgCallback callback, void* context);
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog_cmd.h b/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog_cmd.h
deleted file mode 100644
index f8b07203e..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_prog_cmd.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#pragma once
-
-// http://ww1.microchip.com/downloads/en/appnotes/atmel-0943-in-system-programming_applicationnote_avr910.pdf
-// AVR ISP Definitions
-#define AVR_ISP_HWVER 0X02
-#define AVR_ISP_SWMAJ 0X01
-#define AVR_ISP_SWMIN 0X12
-#define AVP_ISP_SERIAL_CONNECT_TYPE 0X53
-#define AVP_ISP_CONNECT_TYPE 0x93
-#define AVR_ISP_RESP_0 0X00
-
-#define AVR_ISP_SET_PMODE 0xAC, 0x53, 0x00, 0x00
-#define AVR_ISP_READ_VENDOR 0x30, 0x00, 0x00, 0x00
-#define AVR_ISP_READ_PART_FAMILY 0x30, 0x00, 0x01, 0x00
-#define AVR_ISP_READ_PART_NUMBER 0x30, 0x00, 0x02, 0x00
-#define AVR_ISP_ERASE_CHIP \
- 0xAC, 0x80, 0x00, 0x00 //Erase Chip, Wait N ms, Release RESET to end the erase.
-//The only way to end a Chip Erase cycle is by temporarily releasing the Reset line
-
-#define AVR_ISP_EXTENDED_ADDR(data) 0x4D, 0x00, data, 0x00
-#define AVR_ISP_WRITE_FLASH_LO(add, data) 0x40, (add >> 8) & 0xFF, add & 0xFF, data
-#define AVR_ISP_WRITE_FLASH_HI(add, data) 0x48, (add >> 8) & 0xFF, add & 0xFF, data
-#define AVR_ISP_READ_FLASH_LO(add) 0x20, (add >> 8) & 0xFF, add & 0xFF, 0x00
-#define AVR_ISP_READ_FLASH_HI(add) 0x28, (add >> 8) & 0xFF, add & 0xFF, 0x00
-
-#define AVR_ISP_WRITE_EEPROM(add, data) \
- 0xC0, (add >> 8) & 0xFF, add & 0xFF, data //Send cmd, Wait N ms
-#define AVR_ISP_READ_EEPROM(add) 0xA0, (add >> 8) & 0xFF, add & 0xFF, 0xFF
-
-#define AVR_ISP_COMMIT(add) \
- 0x4C, (add >> 8) & 0xFF, add & 0xFF, 0x00 //Send cmd, polling read last addr page
-
-#define AVR_ISP_OSCCAL(add) 0x38, 0x00, add, 0x00
-
-#define AVR_ISP_WRITE_LOCK_BYTE(data) 0xAC, 0xE0, 0x00, data //Send cmd, Wait N ms
-#define AVR_ISP_READ_LOCK_BYTE 0x58, 0x00, 0x00, 0x00
-#define AVR_ISP_WRITE_FUSE_LOW(data) 0xAC, 0xA0, 0x00, data //Send cmd, Wait N ms
-#define AVR_ISP_READ_FUSE_LOW 0x50, 0x00, 0x00, 0x00
-#define AVR_ISP_WRITE_FUSE_HIGH(data) 0xAC, 0xA8, 0x00, data //Send cmd, Wait N ms
-#define AVR_ISP_READ_FUSE_HIGH 0x58, 0x08, 0x00, 0x00
-#define AVR_ISP_WRITE_FUSE_EXTENDED(data) 0xAC, 0xA4, 0x00, data //Send cmd, Wait N ms (~write)
-#define AVR_ISP_READ_FUSE_EXTENDED 0x50, 0x08, 0x00, 0x00
-
-#define AVR_ISP_EECHUNK 0x20
-
-// https://www.microchip.com/content/dam/mchp/documents/OTH/ApplicationNotes/ApplicationNotes/doc2525.pdf
-// STK Definitions
-#define STK_OK 0x10
-#define STK_FAILED 0x11
-#define STK_UNKNOWN 0x12
-#define STK_INSYNC 0x14
-#define STK_NOSYNC 0x15
-#define CRC_EOP 0x20
-
-#define STK_GET_SYNC 0x30
-#define STK_GET_SIGN_ON 0x31
-#define STK_SET_PARAMETER 0x40
-#define STK_GET_PARAMETER 0x41
-#define STK_SET_DEVICE 0x42
-#define STK_SET_DEVICE_EXT 0x45
-#define STK_ENTER_PROGMODE 0x50
-#define STK_LEAVE_PROGMODE 0x51
-#define STK_CHIP_ERASE 0x52
-#define STK_CHECK_AUTOINC 0x53
-#define STK_LOAD_ADDRESS 0x55
-#define STK_UNIVERSAL 0x56
-#define STK_UNIVERSAL_MULTI 0x57
-#define STK_PROG_FLASH 0x60
-#define STK_PROG_DATA 0x61
-#define STK_PROG_FUSE 0x62
-#define STK_PROG_FUSE_EXT 0x65
-#define STK_PROG_LOCK 0x63
-#define STK_PROG_PAGE 0x64
-#define STK_READ_FLASH 0x70
-#define STK_READ_DATA 0x71
-#define STK_READ_FUSE 0x72
-#define STK_READ_LOCK 0x73
-#define STK_READ_PAGE 0x74
-#define STK_READ_SIGN 0x75
-#define STK_READ_OSCCAL 0x76
-#define STK_READ_FUSE_EXT 0x77
-#define STK_READ_OSCCAL_EXT 0x78
-#define STK_HW_VER 0x80
-#define STK_SW_MAJOR 0x81
-#define STK_SW_MINOR 0x82
-#define STK_LEDS 0x83
-#define STK_VTARGET 0x84
-#define STK_VADJUST 0x85
-#define STK_OSC_PSCALE 0x86
-#define STK_OSC_CMATCH 0x87
-#define STK_SCK_DURATION 0x89
-#define STK_BUFSIZEL 0x90
-#define STK_BUFSIZEH 0x91
-#define STK_STK500_TOPCARD_DETECT 0x98
-
-#define STK_SET_EEPROM_TYPE 0X45
-#define STK_SET_FLASH_TYPE 0X46
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_spi_sw.c b/applications/external/avr_isp_programmer/lib/driver/avr_isp_spi_sw.c
deleted file mode 100644
index c6d9d54c8..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_spi_sw.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include "avr_isp_spi_sw.h"
-
-#include
-
-#define AVR_ISP_SPI_SW_MISO &gpio_ext_pa6
-#define AVR_ISP_SPI_SW_MOSI &gpio_ext_pa7
-#define AVR_ISP_SPI_SW_SCK &gpio_ext_pb3
-#define AVR_ISP_RESET &gpio_ext_pb2
-
-struct AvrIspSpiSw {
- AvrIspSpiSwSpeed speed_wait_time;
- const GpioPin* miso;
- const GpioPin* mosi;
- const GpioPin* sck;
- const GpioPin* res;
-};
-
-AvrIspSpiSw* avr_isp_spi_sw_init(AvrIspSpiSwSpeed speed) {
- AvrIspSpiSw* instance = malloc(sizeof(AvrIspSpiSw));
- instance->speed_wait_time = speed;
- instance->miso = AVR_ISP_SPI_SW_MISO;
- instance->mosi = AVR_ISP_SPI_SW_MOSI;
- instance->sck = AVR_ISP_SPI_SW_SCK;
- instance->res = AVR_ISP_RESET;
-
- furi_hal_gpio_init(instance->miso, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(instance->mosi, false);
- furi_hal_gpio_init(instance->mosi, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(instance->sck, false);
- furi_hal_gpio_init(instance->sck, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(instance->res, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
-
- return instance;
-}
-
-void avr_isp_spi_sw_free(AvrIspSpiSw* instance) {
- furi_assert(instance);
- furi_hal_gpio_init(instance->res, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- furi_hal_gpio_init(instance->miso, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- furi_hal_gpio_init(instance->mosi, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- furi_hal_gpio_init(instance->sck, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- free(instance);
-}
-
-uint8_t avr_isp_spi_sw_txrx(AvrIspSpiSw* instance, uint8_t data) {
- furi_assert(instance);
- for(uint8_t i = 0; i < 8; ++i) {
- furi_hal_gpio_write(instance->mosi, (data & 0x80) ? true : false);
-
- furi_hal_gpio_write(instance->sck, true);
- if(instance->speed_wait_time != AvrIspSpiSwSpeed1Mhz)
- furi_delay_us(instance->speed_wait_time - 1);
-
- data = (data << 1) | furi_hal_gpio_read(instance->miso); //-V792
-
- furi_hal_gpio_write(instance->sck, false);
- if(instance->speed_wait_time != AvrIspSpiSwSpeed1Mhz)
- furi_delay_us(instance->speed_wait_time - 1);
- }
- return data;
-}
-
-void avr_isp_spi_sw_res_set(AvrIspSpiSw* instance, bool state) {
- furi_assert(instance);
- furi_hal_gpio_write(instance->res, state);
-}
-
-void avr_isp_spi_sw_sck_set(AvrIspSpiSw* instance, bool state) {
- furi_assert(instance);
- furi_hal_gpio_write(instance->sck, state);
-}
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/lib/driver/avr_isp_spi_sw.h b/applications/external/avr_isp_programmer/lib/driver/avr_isp_spi_sw.h
deleted file mode 100644
index 44de5ff79..000000000
--- a/applications/external/avr_isp_programmer/lib/driver/avr_isp_spi_sw.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include
-
-typedef enum {
- AvrIspSpiSwSpeed1Mhz = 0,
- AvrIspSpiSwSpeed400Khz = 1,
- AvrIspSpiSwSpeed250Khz = 2,
- AvrIspSpiSwSpeed125Khz = 4,
- AvrIspSpiSwSpeed60Khz = 8,
- AvrIspSpiSwSpeed40Khz = 12,
- AvrIspSpiSwSpeed20Khz = 24,
- AvrIspSpiSwSpeed10Khz = 48,
- AvrIspSpiSwSpeed5Khz = 96,
- AvrIspSpiSwSpeed1Khz = 480,
-} AvrIspSpiSwSpeed;
-
-typedef struct AvrIspSpiSw AvrIspSpiSw;
-
-AvrIspSpiSw* avr_isp_spi_sw_init(AvrIspSpiSwSpeed speed);
-void avr_isp_spi_sw_free(AvrIspSpiSw* instance);
-uint8_t avr_isp_spi_sw_txrx(AvrIspSpiSw* instance, uint8_t data);
-void avr_isp_spi_sw_res_set(AvrIspSpiSw* instance, bool state);
-void avr_isp_spi_sw_sck_set(AvrIspSpiSw* instance, bool state);
\ No newline at end of file
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene.c
deleted file mode 100644
index 4af125aee..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-// Generate scene on_enter handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
-void (*const avr_isp_scene_on_enter_handlers[])(void*) = {
-#include "avr_isp_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 avr_isp_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = {
-#include "avr_isp_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 avr_isp_scene_on_exit_handlers[])(void* context) = {
-#include "avr_isp_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Initialize scene handlers configuration structure
-const SceneManagerHandlers avr_isp_scene_handlers = {
- .on_enter_handlers = avr_isp_scene_on_enter_handlers,
- .on_event_handlers = avr_isp_scene_on_event_handlers,
- .on_exit_handlers = avr_isp_scene_on_exit_handlers,
- .scene_num = AvrIspSceneNum,
-};
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene.h b/applications/external/avr_isp_programmer/scenes/avr_isp_scene.h
deleted file mode 100644
index 658ee7432..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include
-
-// Generate scene id and total number
-#define ADD_SCENE(prefix, name, id) AvrIspScene##id,
-typedef enum {
-#include "avr_isp_scene_config.h"
- AvrIspSceneNum,
-} AvrIspScene;
-#undef ADD_SCENE
-
-extern const SceneManagerHandlers avr_isp_scene_handlers;
-
-// Generate scene on_enter handlers declaration
-#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
-#include "avr_isp_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 "avr_isp_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 "avr_isp_scene_config.h"
-#undef ADD_SCENE
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_about.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_about.c
deleted file mode 100644
index e5f530fec..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_about.c
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "../avr_isp_app_i.h"
-#include "../helpers/avr_isp_types.h"
-
-void avr_isp_scene_about_widget_callback(GuiButtonType result, InputType type, void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- if(type == InputTypeShort) {
- view_dispatcher_send_custom_event(app->view_dispatcher, result);
- }
-}
-
-void avr_isp_scene_about_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- FuriString* temp_str = furi_string_alloc();
- furi_string_printf(temp_str, "\e#%s\n", "Information");
-
- furi_string_cat_printf(temp_str, "Version: %s\n", AVR_ISP_VERSION_APP);
- furi_string_cat_printf(temp_str, "Developed by: %s\n", AVR_ISP_DEVELOPED);
- furi_string_cat_printf(temp_str, "Github: %s\n\n", AVR_ISP_GITHUB);
-
- furi_string_cat_printf(temp_str, "\e#%s\n", "Description");
- furi_string_cat_printf(
- temp_str,
- "This application is an AVR in-system programmer based on stk500mk1. It is compatible with AVR-based"
- " microcontrollers including Arduino. You can also use it to repair the chip if you accidentally"
- " corrupt the bootloader.\n\n");
-
- furi_string_cat_printf(temp_str, "\e#%s\n", "What it can do:");
- furi_string_cat_printf(temp_str, "- Create a dump of your chip on an SD card\n");
- furi_string_cat_printf(temp_str, "- Flash your chip firmware from the SD card\n");
- furi_string_cat_printf(temp_str, "- Act as a wired USB ISP using avrdude software\n\n");
-
- furi_string_cat_printf(temp_str, "\e#%s\n", "Supported chip series:");
- furi_string_cat_printf(
- temp_str,
- "Example command for avrdude flashing: avrdude.exe -p m328p -c stk500v1 -P COMxx -U flash:r:"
- "X:\\sketch_sample.hex"
- ":i\n");
- furi_string_cat_printf(
- temp_str,
- "Where: "
- "-p m328p"
- " brand of your chip, "
- "-P COMxx"
- " com port number in the system when "
- "ISP Programmer"
- " is enabled\n\n");
-
- furi_string_cat_printf(temp_str, "\e#%s\n", "Info");
- furi_string_cat_printf(
- temp_str,
- "ATtinyXXXX\nATmegaXXXX\nAT43Uxxx\nAT76C711\nAT86RF401\nAT90xxxxx\nAT94K\n"
- "ATAxxxxx\nATA664251\nM3000\nLGT8F88P\nLGT8F168P\nLGT8F328P\n");
-
- furi_string_cat_printf(
- temp_str, "For a more detailed list of supported chips, see AVRDude help\n");
-
- widget_add_text_box_element(
- app->widget,
- 0,
- 0,
- 128,
- 14,
- AlignCenter,
- AlignBottom,
- "\e#\e! \e!\n",
- false);
- widget_add_text_box_element(
- app->widget,
- 0,
- 2,
- 128,
- 14,
- AlignCenter,
- AlignBottom,
- "\e#\e! ISP Programmer \e!\n",
- false);
- widget_add_text_scroll_element(app->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str));
- furi_string_free(temp_str);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewWidget);
-}
-
-bool avr_isp_scene_about_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- return false;
-}
-
-void avr_isp_scene_about_on_exit(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- // Clear views
- widget_reset(app->widget);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_chip_detect.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_chip_detect.c
deleted file mode 100644
index 79c239390..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_chip_detect.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_chip_detect_callback(AvrIspCustomEvent event, void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void avr_isp_scene_chip_detect_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- switch(app->error) {
- case AvrIspErrorReading:
- case AvrIspErrorWriting:
- case AvrIspErrorWritingFuse:
- avr_isp_chip_detect_set_state(
- app->avr_isp_chip_detect_view, AvrIspChipDetectViewStateErrorOccured);
- break;
- case AvrIspErrorVerification:
- avr_isp_chip_detect_set_state(
- app->avr_isp_chip_detect_view, AvrIspChipDetectViewStateErrorVerification);
- break;
-
- default:
- avr_isp_chip_detect_set_state(
- app->avr_isp_chip_detect_view, AvrIspChipDetectViewStateNoDetect);
- break;
- }
- app->error = AvrIspErrorNoError;
- avr_isp_chip_detect_view_set_callback(
- app->avr_isp_chip_detect_view, avr_isp_scene_chip_detect_callback, app);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewChipDetect);
-}
-
-bool avr_isp_scene_chip_detect_on_event(void* context, SceneManagerEvent event) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- bool consumed = false;
- if(event.type == SceneManagerEventTypeCustom) {
- switch(event.event) {
- case AvrIspCustomEventSceneChipDetectOk:
-
- if(scene_manager_get_scene_state(app->scene_manager, AvrIspSceneChipDetect) ==
- AvrIspViewProgrammer) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneProgrammer);
- } else if(
- scene_manager_get_scene_state(app->scene_manager, AvrIspSceneChipDetect) ==
- AvrIspViewReader) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneInputName);
- } else if(
- scene_manager_get_scene_state(app->scene_manager, AvrIspSceneChipDetect) ==
- AvrIspViewWriter) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneLoad);
- }
-
- consumed = true;
- break;
- default:
- break;
- }
- } else if(event.type == SceneManagerEventTypeTick) {
- }
- return consumed;
-}
-
-void avr_isp_scene_chip_detect_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_config.h b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_config.h
deleted file mode 100644
index 6f22511db..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_config.h
+++ /dev/null
@@ -1,10 +0,0 @@
-ADD_SCENE(avr_isp, start, Start)
-ADD_SCENE(avr_isp, about, About)
-ADD_SCENE(avr_isp, programmer, Programmer)
-ADD_SCENE(avr_isp, reader, Reader)
-ADD_SCENE(avr_isp, input_name, InputName)
-ADD_SCENE(avr_isp, load, Load)
-ADD_SCENE(avr_isp, writer, Writer)
-ADD_SCENE(avr_isp, wiring, Wiring)
-ADD_SCENE(avr_isp, chip_detect, ChipDetect)
-ADD_SCENE(avr_isp, success, Success)
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_input_name.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_input_name.c
deleted file mode 100644
index 3394f4362..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_input_name.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "../avr_isp_app_i.h"
-#include
-
-#define MAX_TEXT_INPUT_LEN 22
-
-void avr_isp_scene_input_name_text_callback(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, AvrIspCustomEventSceneInputName);
-}
-
-void avr_isp_scene_input_name_get_timefilename(FuriString* name) {
- FuriHalRtcDateTime datetime = {0};
- furi_hal_rtc_get_datetime(&datetime);
- furi_string_printf(
- name,
- "AVR_dump-%.4d%.2d%.2d-%.2d%.2d%.2d",
- datetime.year,
- datetime.month,
- datetime.day,
- datetime.hour,
- datetime.minute,
- datetime.second);
-}
-
-void avr_isp_scene_input_name_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- // Setup view
- TextInput* text_input = app->text_input;
- bool dev_name_empty = false;
-
- FuriString* file_name = furi_string_alloc();
-
- avr_isp_scene_input_name_get_timefilename(file_name);
- furi_string_set(app->file_path, STORAGE_APP_DATA_PATH_PREFIX);
- //highlighting the entire filename by default
- dev_name_empty = true;
-
- strncpy(app->file_name_tmp, furi_string_get_cstr(file_name), AVR_ISP_MAX_LEN_NAME);
- text_input_set_header_text(text_input, "Name dump");
- text_input_set_result_callback(
- text_input,
- avr_isp_scene_input_name_text_callback,
- app,
- app->file_name_tmp,
- MAX_TEXT_INPUT_LEN, // buffer size
- dev_name_empty);
-
- ValidatorIsFile* validator_is_file =
- validator_is_file_alloc_init(STORAGE_APP_DATA_PATH_PREFIX, AVR_ISP_APP_EXTENSION, "");
- text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
-
- furi_string_free(file_name);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewTextInput);
-}
-
-bool avr_isp_scene_input_name_on_event(void* context, SceneManagerEvent event) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- if(event.type == SceneManagerEventTypeBack) {
- scene_manager_previous_scene(app->scene_manager);
- return true;
- } else if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == AvrIspCustomEventSceneInputName) {
- if(strcmp(app->file_name_tmp, "") != 0) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneReader);
- } else {
- }
- }
- }
- return false;
-}
-
-void avr_isp_scene_input_name_on_exit(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- // Clear validator
- 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);
- // Clear view
- text_input_reset(app->text_input);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_load.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_load.c
deleted file mode 100644
index e8890e373..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_load.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_load_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- if(avr_isp_load_from_file(app)) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneWriter);
- } else {
- scene_manager_previous_scene(app->scene_manager);
- }
-}
-
-bool avr_isp_scene_load_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- return false;
-}
-
-void avr_isp_scene_load_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_programmer.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_programmer.c
deleted file mode 100644
index 0915e1e8a..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_programmer.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_programmer_callback(AvrIspCustomEvent event, void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void avr_isp_scene_programmer_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- avr_isp_programmer_view_set_callback(
- app->avr_isp_programmer_view, avr_isp_scene_programmer_callback, app);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewProgrammer);
-}
-
-bool avr_isp_scene_programmer_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- return false;
-}
-
-void avr_isp_scene_programmer_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_reader.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_reader.c
deleted file mode 100644
index 8dcb47597..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_reader.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_reader_callback(AvrIspCustomEvent event, void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void avr_isp_scene_reader_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- avr_isp_reader_set_file_path(
- app->avr_isp_reader_view, furi_string_get_cstr(app->file_path), app->file_name_tmp);
- avr_isp_reader_view_set_callback(app->avr_isp_reader_view, avr_isp_scene_reader_callback, app);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewReader);
-}
-
-bool avr_isp_scene_reader_on_event(void* context, SceneManagerEvent event) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- UNUSED(app);
- bool consumed = false;
- if(event.type == SceneManagerEventTypeBack) {
- //do not handle exit on "Back"
- consumed = true;
- } else if(event.type == SceneManagerEventTypeCustom) {
- switch(event.event) {
- case AvrIspCustomEventSceneReadingOk:
- scene_manager_next_scene(app->scene_manager, AvrIspSceneSuccess);
- consumed = true;
- break;
- case AvrIspCustomEventSceneExit:
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- case AvrIspCustomEventSceneErrorVerification:
- app->error = AvrIspErrorVerification;
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- case AvrIspCustomEventSceneErrorReading:
- app->error = AvrIspErrorReading;
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- default:
- break;
- }
- } else if(event.type == SceneManagerEventTypeTick) {
- avr_isp_reader_update_progress(app->avr_isp_reader_view);
- }
- return consumed;
-}
-
-void avr_isp_scene_reader_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_start.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_start.c
deleted file mode 100644
index b00bfefce..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_start.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_start_submenu_callback(void* context, uint32_t index) {
- furi_assert(context);
- AvrIspApp* app = context;
-
- view_dispatcher_send_custom_event(app->view_dispatcher, index);
-}
-
-void avr_isp_scene_start_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- Submenu* submenu = app->submenu;
- submenu_add_item(
- submenu, "Dump AVR", SubmenuIndexAvrIspReader, avr_isp_scene_start_submenu_callback, app);
- submenu_add_item(
- submenu, "Flash AVR", SubmenuIndexAvrIspWriter, avr_isp_scene_start_submenu_callback, app);
- submenu_add_item(
- submenu,
- "ISP Programmer",
- SubmenuIndexAvrIspProgrammer,
- avr_isp_scene_start_submenu_callback,
- app);
- submenu_add_item(
- submenu, "Wiring", SubmenuIndexAvrIsWiring, avr_isp_scene_start_submenu_callback, app);
- submenu_add_item(
- submenu, "About", SubmenuIndexAvrIspAbout, avr_isp_scene_start_submenu_callback, app);
-
- submenu_set_selected_item(
- submenu, scene_manager_get_scene_state(app->scene_manager, AvrIspSceneStart));
-
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewSubmenu);
-}
-
-bool avr_isp_scene_start_on_event(void* context, SceneManagerEvent event) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- bool consumed = false;
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == SubmenuIndexAvrIspAbout) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneAbout);
- consumed = true;
- } else if(event.event == SubmenuIndexAvrIspProgrammer) {
- scene_manager_set_scene_state(
- app->scene_manager, AvrIspSceneChipDetect, AvrIspViewProgrammer);
- scene_manager_next_scene(app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- } else if(event.event == SubmenuIndexAvrIspReader) {
- scene_manager_set_scene_state(
- app->scene_manager, AvrIspSceneChipDetect, AvrIspViewReader);
- scene_manager_next_scene(app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- } else if(event.event == SubmenuIndexAvrIspWriter) {
- scene_manager_set_scene_state(
- app->scene_manager, AvrIspSceneChipDetect, AvrIspViewWriter);
- scene_manager_next_scene(app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- } else if(event.event == SubmenuIndexAvrIsWiring) {
- scene_manager_next_scene(app->scene_manager, AvrIspSceneWiring);
- consumed = true;
- }
- scene_manager_set_scene_state(app->scene_manager, AvrIspSceneStart, event.event);
- }
-
- return consumed;
-}
-
-void avr_isp_scene_start_on_exit(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- submenu_reset(app->submenu);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_success.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_success.c
deleted file mode 100644
index a88ed28aa..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_success.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_success_popup_callback(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, AvrIspCustomEventSceneSuccess);
-}
-
-void avr_isp_scene_success_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- Popup* popup = app->popup;
- popup_set_icon(popup, 32, 5, &I_dolphin_nice_96x59);
- popup_set_header(popup, "Success!", 8, 22, AlignLeft, AlignBottom);
- popup_set_timeout(popup, 1500);
- popup_set_context(popup, app);
- popup_set_callback(popup, avr_isp_scene_success_popup_callback);
- popup_enable_timeout(popup);
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewPopup);
-}
-
-bool avr_isp_scene_success_on_event(void* context, SceneManagerEvent event) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == AvrIspCustomEventSceneSuccess) {
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneStart);
- return true;
- }
- }
- return false;
-}
-
-void avr_isp_scene_success_on_exit(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- Popup* popup = app->popup;
- popup_reset(popup);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_wiring.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_wiring.c
deleted file mode 100644
index 787ed5673..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_wiring.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_wiring_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- widget_add_icon_element(app->widget, 0, 0, &I_avr_wiring);
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewWidget);
-}
-
-bool avr_isp_scene_wiring_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- return false;
-}
-void avr_isp_scene_wiring_on_exit(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- widget_reset(app->widget);
-}
diff --git a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_writer.c b/applications/external/avr_isp_programmer/scenes/avr_isp_scene_writer.c
deleted file mode 100644
index 39c944fd5..000000000
--- a/applications/external/avr_isp_programmer/scenes/avr_isp_scene_writer.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "../avr_isp_app_i.h"
-
-void avr_isp_scene_writer_callback(AvrIspCustomEvent event, void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void avr_isp_scene_writer_on_enter(void* context) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- avr_isp_writer_set_file_path(
- app->avr_isp_writer_view, furi_string_get_cstr(app->file_path), app->file_name_tmp);
- avr_isp_writer_view_set_callback(app->avr_isp_writer_view, avr_isp_scene_writer_callback, app);
- view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewWriter);
-}
-
-bool avr_isp_scene_writer_on_event(void* context, SceneManagerEvent event) {
- furi_assert(context);
-
- AvrIspApp* app = context;
- bool consumed = false;
- if(event.type == SceneManagerEventTypeBack) {
- //do not handle exit on "Back"
- consumed = true;
- } else if(event.type == SceneManagerEventTypeCustom) {
- switch(event.event) {
- case AvrIspCustomEventSceneExitStartMenu:
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneStart);
- consumed = true;
- break;
- case AvrIspCustomEventSceneExit:
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- case AvrIspCustomEventSceneErrorVerification:
- app->error = AvrIspErrorVerification;
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- case AvrIspCustomEventSceneErrorWriting:
- app->error = AvrIspErrorWriting;
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- case AvrIspCustomEventSceneErrorWritingFuse:
- app->error = AvrIspErrorWritingFuse;
- scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, AvrIspSceneChipDetect);
- consumed = true;
- break;
- default:
- break;
- }
- } else if(event.type == SceneManagerEventTypeTick) {
- avr_isp_writer_update_progress(app->avr_isp_writer_view);
- }
- return consumed;
-}
-
-void avr_isp_scene_writer_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_chip_detect.c b/applications/external/avr_isp_programmer/views/avr_isp_view_chip_detect.c
deleted file mode 100644
index fdcf71c36..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_chip_detect.c
+++ /dev/null
@@ -1,213 +0,0 @@
-#include "avr_isp_view_chip_detect.h"
-#include
-#include
-
-#include "../helpers/avr_isp_worker_rw.h"
-
-struct AvrIspChipDetectView {
- View* view;
- AvrIspWorkerRW* avr_isp_worker_rw;
- AvrIspChipDetectViewCallback callback;
- void* context;
-};
-
-typedef struct {
- uint16_t idx;
- const char* name_chip;
- uint32_t flash_size;
- AvrIspChipDetectViewState state;
-} AvrIspChipDetectViewModel;
-
-void avr_isp_chip_detect_view_set_callback(
- AvrIspChipDetectView* instance,
- AvrIspChipDetectViewCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-void avr_isp_chip_detect_set_state(AvrIspChipDetectView* instance, AvrIspChipDetectViewState state) {
- furi_assert(instance);
-
- with_view_model(
- instance->view, AvrIspChipDetectViewModel * model, { model->state = state; }, true);
-}
-
-void avr_isp_chip_detect_view_draw(Canvas* canvas, AvrIspChipDetectViewModel* model) {
- canvas_clear(canvas);
-
- char str_buf[64] = {0};
- canvas_set_font(canvas, FontPrimary);
-
- switch(model->state) {
- case AvrIspChipDetectViewStateDetected:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "AVR chip detected!");
- canvas_draw_icon(canvas, 29, 14, &I_chip_long_70x22);
- canvas_set_font(canvas, FontSecondary);
- snprintf(str_buf, sizeof(str_buf), "%ld Kb", model->flash_size / 1024);
- canvas_draw_str_aligned(canvas, 64, 25, AlignCenter, AlignCenter, str_buf);
- canvas_draw_str_aligned(canvas, 64, 45, AlignCenter, AlignCenter, model->name_chip);
- elements_button_right(canvas, "Next");
- break;
- case AvrIspChipDetectViewStateErrorOccured:
- canvas_draw_str_aligned(
- canvas, 64, 5, AlignCenter, AlignCenter, "Error occured, try again!");
- canvas_draw_icon(canvas, 29, 14, &I_chip_error_70x22);
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str_aligned(
- canvas, 64, 45, AlignCenter, AlignCenter, "Check the wiring and retry");
- break;
- case AvrIspChipDetectViewStateErrorVerification:
- canvas_draw_str_aligned(
- canvas, 64, 5, AlignCenter, AlignCenter, "Data verification failed");
- canvas_draw_icon(canvas, 29, 14, &I_chip_error_70x22);
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str_aligned(
- canvas, 64, 45, AlignCenter, AlignCenter, "Try to restart the process");
- break;
-
- default:
- //AvrIspChipDetectViewStateNoDetect
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "AVR chip not found!");
- canvas_draw_icon(canvas, 29, 12, &I_chif_not_found_83x37);
-
- break;
- }
- canvas_set_font(canvas, FontSecondary);
- elements_button_left(canvas, "Retry");
-}
-
-bool avr_isp_chip_detect_view_input(InputEvent* event, void* context) {
- furi_assert(context);
-
- AvrIspChipDetectView* instance = context;
-
- if(event->type == InputTypeShort) {
- if(event->key == InputKeyBack) {
- return false;
- } else if(event->key == InputKeyRight) {
- with_view_model(
- instance->view,
- AvrIspChipDetectViewModel * model,
- {
- if(model->state == AvrIspChipDetectViewStateDetected) {
- if(instance->callback)
- instance->callback(
- AvrIspCustomEventSceneChipDetectOk, instance->context);
- }
- },
- false);
-
- } else if(event->key == InputKeyLeft) {
- bool detect_chip = false;
- with_view_model(
- instance->view,
- AvrIspChipDetectViewModel * model,
- {
- if(model->state != AvrIspChipDetectViewStateDetecting) {
- model->state = AvrIspChipDetectViewStateDetecting;
- detect_chip = true;
- }
- },
- false);
- if(detect_chip) avr_isp_worker_rw_detect_chip(instance->avr_isp_worker_rw);
- }
- } else {
- return false;
- }
-
- return true;
-}
-
-static void avr_isp_chip_detect_detect_chip_callback(
- void* context,
- const char* name,
- bool detect_chip,
- uint32_t flash_size) {
- furi_assert(context);
-
- AvrIspChipDetectView* instance = context;
- with_view_model(
- instance->view,
- AvrIspChipDetectViewModel * model,
- {
- model->name_chip = name;
- model->flash_size = flash_size;
- if(detect_chip) {
- model->state = AvrIspChipDetectViewStateDetected;
- } else {
- model->state = AvrIspChipDetectViewStateNoDetect;
- }
- },
- true);
-}
-void avr_isp_chip_detect_view_enter(void* context) {
- furi_assert(context);
-
- AvrIspChipDetectView* instance = context;
- bool detect_chip = false;
- with_view_model(
- instance->view,
- AvrIspChipDetectViewModel * model,
- {
- if(model->state == AvrIspChipDetectViewStateNoDetect ||
- model->state == AvrIspChipDetectViewStateDetected) {
- detect_chip = true;
- }
- },
- false);
-
- //Start avr_isp_worker_rw
- instance->avr_isp_worker_rw = avr_isp_worker_rw_alloc(instance->context);
-
- avr_isp_worker_rw_set_callback(
- instance->avr_isp_worker_rw, avr_isp_chip_detect_detect_chip_callback, instance);
-
- if(detect_chip) avr_isp_worker_rw_detect_chip(instance->avr_isp_worker_rw);
-}
-
-void avr_isp_chip_detect_view_exit(void* context) {
- furi_assert(context);
-
- AvrIspChipDetectView* instance = context;
-
- avr_isp_worker_rw_set_callback(instance->avr_isp_worker_rw, NULL, NULL);
- avr_isp_worker_rw_free(instance->avr_isp_worker_rw);
-}
-
-AvrIspChipDetectView* avr_isp_chip_detect_view_alloc() {
- AvrIspChipDetectView* instance = malloc(sizeof(AvrIspChipDetectView));
-
- // View allocation and configuration
- instance->view = view_alloc();
-
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(AvrIspChipDetectViewModel));
- view_set_context(instance->view, instance);
- view_set_draw_callback(instance->view, (ViewDrawCallback)avr_isp_chip_detect_view_draw);
- view_set_input_callback(instance->view, avr_isp_chip_detect_view_input);
- view_set_enter_callback(instance->view, avr_isp_chip_detect_view_enter);
- view_set_exit_callback(instance->view, avr_isp_chip_detect_view_exit);
-
- with_view_model(
- instance->view,
- AvrIspChipDetectViewModel * model,
- { model->state = AvrIspChipDetectViewStateNoDetect; },
- false);
- return instance;
-}
-
-void avr_isp_chip_detect_view_free(AvrIspChipDetectView* instance) {
- furi_assert(instance);
-
- view_free(instance->view);
- free(instance);
-}
-
-View* avr_isp_chip_detect_view_get_view(AvrIspChipDetectView* instance) {
- furi_assert(instance);
-
- return instance->view;
-}
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_chip_detect.h b/applications/external/avr_isp_programmer/views/avr_isp_view_chip_detect.h
deleted file mode 100644
index 37f2ae233..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_chip_detect.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#pragma once
-
-#include
-#include "../helpers/avr_isp_types.h"
-#include "../helpers/avr_isp_event.h"
-
-typedef struct AvrIspChipDetectView AvrIspChipDetectView;
-
-typedef void (*AvrIspChipDetectViewCallback)(AvrIspCustomEvent event, void* context);
-
-typedef enum {
- AvrIspChipDetectViewStateNoDetect,
- AvrIspChipDetectViewStateDetecting,
- AvrIspChipDetectViewStateDetected,
- AvrIspChipDetectViewStateErrorOccured,
- AvrIspChipDetectViewStateErrorVerification,
-} AvrIspChipDetectViewState;
-
-void avr_isp_chip_detect_view_set_callback(
- AvrIspChipDetectView* instance,
- AvrIspChipDetectViewCallback callback,
- void* context);
-
-void avr_isp_chip_detect_set_state(AvrIspChipDetectView* instance, AvrIspChipDetectViewState state);
-
-AvrIspChipDetectView* avr_isp_chip_detect_view_alloc();
-
-void avr_isp_chip_detect_view_free(AvrIspChipDetectView* instance);
-
-View* avr_isp_chip_detect_view_get_view(AvrIspChipDetectView* instance);
-
-void avr_isp_chip_detect_view_exit(void* context);
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_programmer.c b/applications/external/avr_isp_programmer/views/avr_isp_view_programmer.c
deleted file mode 100644
index 34e18770b..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_programmer.c
+++ /dev/null
@@ -1,134 +0,0 @@
-#include "avr_isp_view_programmer.h"
-#include
-
-#include "../helpers/avr_isp_worker.h"
-#include
-
-struct AvrIspProgrammerView {
- View* view;
- AvrIspWorker* worker;
- AvrIspProgrammerViewCallback callback;
- void* context;
-};
-
-typedef struct {
- AvrIspProgrammerViewStatus status;
-} AvrIspProgrammerViewModel;
-
-void avr_isp_programmer_view_set_callback(
- AvrIspProgrammerView* instance,
- AvrIspProgrammerViewCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-void avr_isp_programmer_view_draw(Canvas* canvas, AvrIspProgrammerViewModel* model) {
- canvas_clear(canvas);
-
- if(model->status == AvrIspProgrammerViewStatusUSBConnect) {
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_icon(canvas, 0, 0, &I_isp_active_128x53);
- elements_multiline_text(canvas, 45, 10, "ISP mode active");
- } else {
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_icon(canvas, 51, 6, &I_link_waiting_77x56);
- elements_multiline_text(canvas, 0, 25, "Waiting for\nsoftware\nconnection");
- }
-}
-
-bool avr_isp_programmer_view_input(InputEvent* event, void* context) {
- furi_assert(context);
- UNUSED(context);
-
- if(event->key == InputKeyBack || event->type != InputTypeShort) {
- return false;
- }
-
- return true;
-}
-
-static void avr_isp_programmer_usb_connect_callback(void* context, bool status_connect) {
- furi_assert(context);
- AvrIspProgrammerView* instance = context;
-
- with_view_model(
- instance->view,
- AvrIspProgrammerViewModel * model,
- {
- if(status_connect) {
- model->status = AvrIspProgrammerViewStatusUSBConnect;
- } else {
- model->status = AvrIspProgrammerViewStatusNoUSBConnect;
- }
- },
- true);
-}
-
-void avr_isp_programmer_view_enter(void* context) {
- furi_assert(context);
-
- AvrIspProgrammerView* instance = context;
- with_view_model(
- instance->view,
- AvrIspProgrammerViewModel * model,
- { model->status = AvrIspProgrammerViewStatusNoUSBConnect; },
- true);
-
- //Start worker
- instance->worker = avr_isp_worker_alloc(instance->context);
-
- avr_isp_worker_set_callback(
- instance->worker, avr_isp_programmer_usb_connect_callback, instance);
-
- avr_isp_worker_start(instance->worker);
-}
-
-void avr_isp_programmer_view_exit(void* context) {
- furi_assert(context);
-
- AvrIspProgrammerView* instance = context;
- //Stop worker
- if(avr_isp_worker_is_running(instance->worker)) {
- avr_isp_worker_stop(instance->worker);
- }
- avr_isp_worker_set_callback(instance->worker, NULL, NULL);
- avr_isp_worker_free(instance->worker);
-}
-
-AvrIspProgrammerView* avr_isp_programmer_view_alloc() {
- AvrIspProgrammerView* instance = malloc(sizeof(AvrIspProgrammerView));
-
- // View allocation and configuration
- instance->view = view_alloc();
-
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(AvrIspProgrammerViewModel));
- view_set_context(instance->view, instance);
- view_set_draw_callback(instance->view, (ViewDrawCallback)avr_isp_programmer_view_draw);
- view_set_input_callback(instance->view, avr_isp_programmer_view_input);
- view_set_enter_callback(instance->view, avr_isp_programmer_view_enter);
- view_set_exit_callback(instance->view, avr_isp_programmer_view_exit);
-
- with_view_model(
- instance->view,
- AvrIspProgrammerViewModel * model,
- { model->status = AvrIspProgrammerViewStatusNoUSBConnect; },
- false);
- return instance;
-}
-
-void avr_isp_programmer_view_free(AvrIspProgrammerView* instance) {
- furi_assert(instance);
-
- view_free(instance->view);
- free(instance);
-}
-
-View* avr_isp_programmer_view_get_view(AvrIspProgrammerView* instance) {
- furi_assert(instance);
-
- return instance->view;
-}
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_programmer.h b/applications/external/avr_isp_programmer/views/avr_isp_view_programmer.h
deleted file mode 100644
index 9f005b026..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_programmer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-#include
-#include "../helpers/avr_isp_types.h"
-#include "../helpers/avr_isp_event.h"
-
-typedef struct AvrIspProgrammerView AvrIspProgrammerView;
-
-typedef void (*AvrIspProgrammerViewCallback)(AvrIspCustomEvent event, void* context);
-
-typedef enum {
- AvrIspProgrammerViewStatusNoUSBConnect,
- AvrIspProgrammerViewStatusUSBConnect,
-} AvrIspProgrammerViewStatus;
-
-void avr_isp_programmer_view_set_callback(
- AvrIspProgrammerView* instance,
- AvrIspProgrammerViewCallback callback,
- void* context);
-
-AvrIspProgrammerView* avr_isp_programmer_view_alloc();
-
-void avr_isp_programmer_view_free(AvrIspProgrammerView* instance);
-
-View* avr_isp_programmer_view_get_view(AvrIspProgrammerView* instance);
-
-void avr_isp_programmer_view_exit(void* context);
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_reader.c b/applications/external/avr_isp_programmer/views/avr_isp_view_reader.c
deleted file mode 100644
index 92d15bd7f..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_reader.c
+++ /dev/null
@@ -1,215 +0,0 @@
-#include "avr_isp_view_reader.h"
-#include
-
-#include "../helpers/avr_isp_worker_rw.h"
-
-struct AvrIspReaderView {
- View* view;
- AvrIspWorkerRW* avr_isp_worker_rw;
- const char* file_path;
- const char* file_name;
- AvrIspReaderViewCallback callback;
- void* context;
-};
-
-typedef struct {
- AvrIspReaderViewStatus status;
- float progress_flash;
- float progress_eeprom;
-} AvrIspReaderViewModel;
-
-void avr_isp_reader_update_progress(AvrIspReaderView* instance) {
- with_view_model(
- instance->view,
- AvrIspReaderViewModel * model,
- {
- model->progress_flash =
- avr_isp_worker_rw_get_progress_flash(instance->avr_isp_worker_rw);
- model->progress_eeprom =
- avr_isp_worker_rw_get_progress_eeprom(instance->avr_isp_worker_rw);
- },
- true);
-}
-
-void avr_isp_reader_view_set_callback(
- AvrIspReaderView* instance,
- AvrIspReaderViewCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-void avr_isp_reader_set_file_path(
- AvrIspReaderView* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
-
- instance->file_path = file_path;
- instance->file_name = file_name;
-}
-
-void avr_isp_reader_view_draw(Canvas* canvas, AvrIspReaderViewModel* model) {
- canvas_clear(canvas);
- char str_buf[64] = {0};
-
- canvas_set_font(canvas, FontPrimary);
- switch(model->status) {
- case AvrIspReaderViewStatusIDLE:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Press start to dump");
- canvas_set_font(canvas, FontSecondary);
- elements_button_center(canvas, "Start");
- break;
- case AvrIspReaderViewStatusReading:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Reading dump");
- break;
- case AvrIspReaderViewStatusVerification:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Verifyng dump");
- break;
-
- default:
- break;
- }
-
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str(canvas, 0, 27, "Flash");
- snprintf(str_buf, sizeof(str_buf), "%d%%", (uint8_t)(model->progress_flash * 100));
- elements_progress_bar_with_text(canvas, 44, 17, 84, model->progress_flash, str_buf);
- canvas_draw_str(canvas, 0, 43, "EEPROM");
- snprintf(str_buf, sizeof(str_buf), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- elements_progress_bar_with_text(canvas, 44, 34, 84, model->progress_eeprom, str_buf);
-}
-
-bool avr_isp_reader_view_input(InputEvent* event, void* context) {
- furi_assert(context);
- AvrIspReaderView* instance = context;
-
- bool ret = true;
- if(event->key == InputKeyBack && event->type == InputTypeShort) {
- with_view_model(
- instance->view,
- AvrIspReaderViewModel * model,
- {
- if(model->status == AvrIspReaderViewStatusIDLE) {
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneExit, instance->context);
- ret = false;
- }
- },
- false);
- } else if(event->key == InputKeyOk && event->type == InputTypeShort) {
- with_view_model(
- instance->view,
- AvrIspReaderViewModel * model,
- {
- if(model->status == AvrIspReaderViewStatusIDLE) {
- model->status = AvrIspReaderViewStatusReading;
- avr_isp_worker_rw_read_dump_start(
- instance->avr_isp_worker_rw, instance->file_path, instance->file_name);
- }
- },
- false);
- }
- return ret;
-}
-
-static void avr_isp_reader_callback_status(void* context, AvrIspWorkerRWStatus status) {
- furi_assert(context);
- AvrIspReaderView* instance = context;
-
- with_view_model(
- instance->view,
- AvrIspReaderViewModel * model,
- {
- switch(status) {
- case AvrIspWorkerRWStatusEndReading:
- model->status = AvrIspReaderViewStatusVerification;
- avr_isp_worker_rw_verification_start(
- instance->avr_isp_worker_rw, instance->file_path, instance->file_name);
- model->status = AvrIspReaderViewStatusVerification;
- break;
- case AvrIspWorkerRWStatusEndVerification:
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneReadingOk, instance->context);
- break;
- case AvrIspWorkerRWStatusErrorVerification:
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneErrorVerification, instance->context);
- break;
-
- default:
- //AvrIspWorkerRWStatusErrorReading;
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneErrorReading, instance->context);
- break;
- }
- },
- true);
-}
-
-void avr_isp_reader_view_enter(void* context) {
- furi_assert(context);
- AvrIspReaderView* instance = context;
-
- with_view_model(
- instance->view,
- AvrIspReaderViewModel * model,
- {
- model->status = AvrIspReaderViewStatusIDLE;
- model->progress_flash = 0.0f;
- model->progress_eeprom = 0.0f;
- },
- true);
-
- //Start avr_isp_worker_rw
- instance->avr_isp_worker_rw = avr_isp_worker_rw_alloc(instance->context);
-
- avr_isp_worker_rw_set_callback_status(
- instance->avr_isp_worker_rw, avr_isp_reader_callback_status, instance);
-
- avr_isp_worker_rw_start(instance->avr_isp_worker_rw);
-}
-
-void avr_isp_reader_view_exit(void* context) {
- furi_assert(context);
-
- AvrIspReaderView* instance = context;
- //Stop avr_isp_worker_rw
- if(avr_isp_worker_rw_is_running(instance->avr_isp_worker_rw)) {
- avr_isp_worker_rw_stop(instance->avr_isp_worker_rw);
- }
-
- avr_isp_worker_rw_free(instance->avr_isp_worker_rw);
-}
-
-AvrIspReaderView* avr_isp_reader_view_alloc() {
- AvrIspReaderView* instance = malloc(sizeof(AvrIspReaderView));
-
- // View allocation and configuration
- instance->view = view_alloc();
-
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(AvrIspReaderViewModel));
- view_set_context(instance->view, instance);
- view_set_draw_callback(instance->view, (ViewDrawCallback)avr_isp_reader_view_draw);
- view_set_input_callback(instance->view, avr_isp_reader_view_input);
- view_set_enter_callback(instance->view, avr_isp_reader_view_enter);
- view_set_exit_callback(instance->view, avr_isp_reader_view_exit);
-
- return instance;
-}
-
-void avr_isp_reader_view_free(AvrIspReaderView* instance) {
- furi_assert(instance);
-
- view_free(instance->view);
- free(instance);
-}
-
-View* avr_isp_reader_view_get_view(AvrIspReaderView* instance) {
- furi_assert(instance);
-
- return instance->view;
-}
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_reader.h b/applications/external/avr_isp_programmer/views/avr_isp_view_reader.h
deleted file mode 100644
index 44a439948..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_reader.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-#include
-#include "../helpers/avr_isp_types.h"
-#include "../helpers/avr_isp_event.h"
-
-typedef struct AvrIspReaderView AvrIspReaderView;
-
-typedef void (*AvrIspReaderViewCallback)(AvrIspCustomEvent event, void* context);
-
-typedef enum {
- AvrIspReaderViewStatusIDLE,
- AvrIspReaderViewStatusReading,
- AvrIspReaderViewStatusVerification,
-} AvrIspReaderViewStatus;
-
-void avr_isp_reader_update_progress(AvrIspReaderView* instance);
-
-void avr_isp_reader_set_file_path(
- AvrIspReaderView* instance,
- const char* file_path,
- const char* file_name);
-
-void avr_isp_reader_view_set_callback(
- AvrIspReaderView* instance,
- AvrIspReaderViewCallback callback,
- void* context);
-
-AvrIspReaderView* avr_isp_reader_view_alloc();
-
-void avr_isp_reader_view_free(AvrIspReaderView* instance);
-
-View* avr_isp_reader_view_get_view(AvrIspReaderView* instance);
-
-void avr_isp_reader_view_exit(void* context);
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_writer.c b/applications/external/avr_isp_programmer/views/avr_isp_view_writer.c
deleted file mode 100644
index a06b78535..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_writer.c
+++ /dev/null
@@ -1,268 +0,0 @@
-#include "avr_isp_view_writer.h"
-#include
-
-#include "../helpers/avr_isp_worker_rw.h"
-#include
-
-struct AvrIspWriterView {
- View* view;
- AvrIspWorkerRW* avr_isp_worker_rw;
- const char* file_path;
- const char* file_name;
- AvrIspWriterViewCallback callback;
- void* context;
-};
-
-typedef struct {
- AvrIspWriterViewStatus status;
- float progress_flash;
- float progress_eeprom;
-} AvrIspWriterViewModel;
-
-void avr_isp_writer_update_progress(AvrIspWriterView* instance) {
- with_view_model(
- instance->view,
- AvrIspWriterViewModel * model,
- {
- model->progress_flash =
- avr_isp_worker_rw_get_progress_flash(instance->avr_isp_worker_rw);
- model->progress_eeprom =
- avr_isp_worker_rw_get_progress_eeprom(instance->avr_isp_worker_rw);
- },
- true);
-}
-
-void avr_isp_writer_view_set_callback(
- AvrIspWriterView* instance,
- AvrIspWriterViewCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
-
- instance->callback = callback;
- instance->context = context;
-}
-
-void avr_isp_writer_set_file_path(
- AvrIspWriterView* instance,
- const char* file_path,
- const char* file_name) {
- furi_assert(instance);
-
- instance->file_path = file_path;
- instance->file_name = file_name;
-}
-
-void avr_isp_writer_view_draw(Canvas* canvas, AvrIspWriterViewModel* model) {
- canvas_clear(canvas);
- char str_flash[32] = {0};
- char str_eeprom[32] = {0};
-
- canvas_set_font(canvas, FontPrimary);
-
- switch(model->status) {
- case AvrIspWriterViewStatusIDLE:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Press start to write");
- canvas_set_font(canvas, FontSecondary);
- elements_button_center(canvas, "Start");
- snprintf(str_flash, sizeof(str_flash), "%d%%", (uint8_t)(model->progress_flash * 100));
- snprintf(str_eeprom, sizeof(str_eeprom), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- break;
- case AvrIspWriterViewStatusWriting:
- if(float_is_equal(model->progress_flash, 0.f)) {
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Verifying firmware");
- snprintf(str_flash, sizeof(str_flash), "***");
- snprintf(str_eeprom, sizeof(str_eeprom), "***");
- } else {
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Writing dump");
- snprintf(str_flash, sizeof(str_flash), "%d%%", (uint8_t)(model->progress_flash * 100));
- snprintf(
- str_eeprom, sizeof(str_eeprom), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- }
- break;
- case AvrIspWriterViewStatusVerification:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Verifying dump");
- snprintf(str_flash, sizeof(str_flash), "%d%%", (uint8_t)(model->progress_flash * 100));
- snprintf(str_eeprom, sizeof(str_eeprom), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- break;
- case AvrIspWriterViewStatusWritingFuse:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Writing fuse");
- snprintf(str_flash, sizeof(str_flash), "%d%%", (uint8_t)(model->progress_flash * 100));
- snprintf(str_eeprom, sizeof(str_eeprom), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- break;
- case AvrIspWriterViewStatusWritingFuseOk:
- canvas_draw_str_aligned(canvas, 64, 5, AlignCenter, AlignCenter, "Done!");
- snprintf(str_flash, sizeof(str_flash), "%d%%", (uint8_t)(model->progress_flash * 100));
- snprintf(str_eeprom, sizeof(str_eeprom), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- canvas_set_font(canvas, FontSecondary);
- elements_button_center(canvas, "Reflash");
- elements_button_right(canvas, "Exit");
- break;
-
- default:
- break;
- }
-
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str(canvas, 0, 27, "Flash");
- // snprintf(str_buf, sizeof(str_buf), "%d%%", (uint8_t)(model->progress_flash * 100));
- elements_progress_bar_with_text(canvas, 44, 17, 84, model->progress_flash, str_flash);
- canvas_draw_str(canvas, 0, 43, "EEPROM");
- // snprintf(str_buf, sizeof(str_buf), "%d%%", (uint8_t)(model->progress_eeprom * 100));
- elements_progress_bar_with_text(canvas, 44, 34, 84, model->progress_eeprom, str_eeprom);
-}
-
-bool avr_isp_writer_view_input(InputEvent* event, void* context) {
- furi_assert(context);
- AvrIspWriterView* instance = context;
-
- bool ret = true;
- if(event->key == InputKeyBack && event->type == InputTypeShort) {
- with_view_model(
- instance->view,
- AvrIspWriterViewModel * model,
- {
- if((model->status == AvrIspWriterViewStatusIDLE) ||
- (model->status == AvrIspWriterViewStatusWritingFuseOk)) {
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneExit, instance->context);
- ret = false;
- }
- },
- false);
- } else if(event->key == InputKeyOk && event->type == InputTypeShort) {
- with_view_model(
- instance->view,
- AvrIspWriterViewModel * model,
- {
- if((model->status == AvrIspWriterViewStatusIDLE) ||
- (model->status == AvrIspWriterViewStatusWritingFuseOk)) {
- model->status = AvrIspWriterViewStatusWriting;
-
- avr_isp_worker_rw_write_dump_start(
- instance->avr_isp_worker_rw, instance->file_path, instance->file_name);
- }
- },
- false);
- } else if(event->key == InputKeyRight && event->type == InputTypeShort) {
- with_view_model(
- instance->view,
- AvrIspWriterViewModel * model,
- {
- if((model->status == AvrIspWriterViewStatusIDLE) ||
- (model->status == AvrIspWriterViewStatusWritingFuseOk)) {
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneExitStartMenu, instance->context);
- ret = false;
- }
- },
- false);
- }
- return ret;
-}
-
-static void avr_isp_writer_callback_status(void* context, AvrIspWorkerRWStatus status) {
- furi_assert(context);
-
- AvrIspWriterView* instance = context;
- with_view_model(
- instance->view,
- AvrIspWriterViewModel * model,
- {
- switch(status) {
- case AvrIspWorkerRWStatusEndWriting:
- model->status = AvrIspWriterViewStatusVerification;
- avr_isp_worker_rw_verification_start(
- instance->avr_isp_worker_rw, instance->file_path, instance->file_name);
- model->status = AvrIspWriterViewStatusVerification;
- break;
- case AvrIspWorkerRWStatusErrorVerification:
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneErrorVerification, instance->context);
- break;
- case AvrIspWorkerRWStatusEndVerification:
- avr_isp_worker_rw_write_fuse_start(
- instance->avr_isp_worker_rw, instance->file_path, instance->file_name);
- model->status = AvrIspWriterViewStatusWritingFuse;
- break;
- case AvrIspWorkerRWStatusErrorWritingFuse:
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneErrorWritingFuse, instance->context);
- break;
- case AvrIspWorkerRWStatusEndWritingFuse:
- model->status = AvrIspWriterViewStatusWritingFuseOk;
- break;
-
- default:
- //AvrIspWorkerRWStatusErrorWriting;
- if(instance->callback)
- instance->callback(AvrIspCustomEventSceneErrorWriting, instance->context);
- break;
- }
- },
- true);
-}
-
-void avr_isp_writer_view_enter(void* context) {
- furi_assert(context);
-
- AvrIspWriterView* instance = context;
- with_view_model(
- instance->view,
- AvrIspWriterViewModel * model,
- {
- model->status = AvrIspWriterViewStatusIDLE;
- model->progress_flash = 0.0f;
- model->progress_eeprom = 0.0f;
- },
- true);
-
- //Start avr_isp_worker_rw
- instance->avr_isp_worker_rw = avr_isp_worker_rw_alloc(instance->context);
-
- avr_isp_worker_rw_set_callback_status(
- instance->avr_isp_worker_rw, avr_isp_writer_callback_status, instance);
-
- avr_isp_worker_rw_start(instance->avr_isp_worker_rw);
-}
-
-void avr_isp_writer_view_exit(void* context) {
- furi_assert(context);
- AvrIspWriterView* instance = context;
-
- //Stop avr_isp_worker_rw
- if(avr_isp_worker_rw_is_running(instance->avr_isp_worker_rw)) {
- avr_isp_worker_rw_stop(instance->avr_isp_worker_rw);
- }
-
- avr_isp_worker_rw_free(instance->avr_isp_worker_rw);
-}
-
-AvrIspWriterView* avr_isp_writer_view_alloc() {
- AvrIspWriterView* instance = malloc(sizeof(AvrIspWriterView));
-
- // View allocation and configuration
- instance->view = view_alloc();
-
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(AvrIspWriterViewModel));
- view_set_context(instance->view, instance);
- view_set_draw_callback(instance->view, (ViewDrawCallback)avr_isp_writer_view_draw);
- view_set_input_callback(instance->view, avr_isp_writer_view_input);
- view_set_enter_callback(instance->view, avr_isp_writer_view_enter);
- view_set_exit_callback(instance->view, avr_isp_writer_view_exit);
-
- return instance;
-}
-
-void avr_isp_writer_view_free(AvrIspWriterView* instance) {
- furi_assert(instance);
-
- view_free(instance->view);
- free(instance);
-}
-
-View* avr_isp_writer_view_get_view(AvrIspWriterView* instance) {
- furi_assert(instance);
-
- return instance->view;
-}
diff --git a/applications/external/avr_isp_programmer/views/avr_isp_view_writer.h b/applications/external/avr_isp_programmer/views/avr_isp_view_writer.h
deleted file mode 100644
index 1ff728387..000000000
--- a/applications/external/avr_isp_programmer/views/avr_isp_view_writer.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include
-#include "../helpers/avr_isp_types.h"
-#include "../helpers/avr_isp_event.h"
-
-typedef struct AvrIspWriterView AvrIspWriterView;
-
-typedef void (*AvrIspWriterViewCallback)(AvrIspCustomEvent event, void* context);
-
-typedef enum {
- AvrIspWriterViewStatusIDLE,
- AvrIspWriterViewStatusWriting,
- AvrIspWriterViewStatusVerification,
- AvrIspWriterViewStatusWritingFuse,
- AvrIspWriterViewStatusWritingFuseOk,
-} AvrIspWriterViewStatus;
-
-void avr_isp_writer_update_progress(AvrIspWriterView* instance);
-
-void avr_isp_writer_set_file_path(
- AvrIspWriterView* instance,
- const char* file_path,
- const char* file_name);
-
-void avr_isp_writer_view_set_callback(
- AvrIspWriterView* instance,
- AvrIspWriterViewCallback callback,
- void* context);
-
-AvrIspWriterView* avr_isp_writer_view_alloc();
-
-void avr_isp_writer_view_free(AvrIspWriterView* instance);
-
-View* avr_isp_writer_view_get_view(AvrIspWriterView* instance);
-
-void avr_isp_writer_view_exit(void* context);
diff --git a/applications/external/bad_bt/application.fam b/applications/external/bad_bt/application.fam
deleted file mode 100644
index 981c0c0c0..000000000
--- a/applications/external/bad_bt/application.fam
+++ /dev/null
@@ -1,16 +0,0 @@
-App(
- appid="bad_bt",
- name="Bad BT",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="bad_bt_app",
- requires=[
- "gui",
- "dialogs",
- ],
- stack_size=2 * 1024,
- order=70,
- fap_libs=["assets"],
- fap_category="Bluetooth",
- fap_icon="images/badbt_10px.png",
- fap_icon_assets="images",
-)
diff --git a/applications/external/bad_bt/bad_bt_app.c b/applications/external/bad_bt/bad_bt_app.c
deleted file mode 100644
index 6ac7d4fa4..000000000
--- a/applications/external/bad_bt/bad_bt_app.c
+++ /dev/null
@@ -1,333 +0,0 @@
-#include "bad_bt_app.h"
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#define BAD_BT_SETTINGS_FILE_NAME ".badbt.settings"
-#define BAD_BT_APP_PATH_BOUND_KEYS_FOLDER EXT_PATH("badbt")
-#define BAD_BT_APP_PATH_BOUND_KEYS_FILE BAD_BT_APP_PATH_BOUND_KEYS_FOLDER "/.badbt.keys"
-
-#define BAD_BT_SETTINGS_PATH BAD_BT_APP_BASE_CONFIG_FOLDER "/" BAD_BT_SETTINGS_FILE_NAME
-
-static bool bad_bt_app_custom_event_callback(void* context, uint32_t event) {
- furi_assert(context);
- BadBtApp* app = context;
- return scene_manager_handle_custom_event(app->scene_manager, event);
-}
-
-static bool bad_bt_app_back_event_callback(void* context) {
- furi_assert(context);
- BadBtApp* app = context;
- return scene_manager_handle_back_event(app->scene_manager);
-}
-
-static void bad_bt_app_tick_event_callback(void* context) {
- furi_assert(context);
- BadBtApp* app = context;
- scene_manager_handle_tick_event(app->scene_manager);
-}
-
-static void bad_bt_load_settings(BadBtApp* app) {
- furi_string_reset(app->keyboard_layout);
- strcpy(app->config.bt_name, "");
- memcpy(
- app->config.bt_mac,
- furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileHidKeyboard),
- BAD_BT_MAC_ADDRESS_LEN);
-
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* file = flipper_format_file_alloc(storage);
- if(flipper_format_file_open_existing(file, BAD_BT_SETTINGS_PATH)) {
- FuriString* tmp_str = furi_string_alloc();
- if(!flipper_format_read_string(file, "Keyboard_Layout", app->keyboard_layout)) {
- furi_string_reset(app->keyboard_layout);
- }
- if(!flipper_format_read_bool(file, "BT_Remember", &(app->bt_remember), 1)) {
- app->bt_remember = false;
- }
- if(flipper_format_read_string(file, "Bt_Name", tmp_str) && !furi_string_empty(tmp_str)) {
- strcpy(app->config.bt_name, furi_string_get_cstr(tmp_str));
- } else {
- strcpy(app->config.bt_name, "");
- }
- if(!flipper_format_read_hex(
- file, "Bt_Mac", (uint8_t*)&app->config.bt_mac, BAD_BT_MAC_ADDRESS_LEN)) {
- memcpy(
- app->config.bt_mac,
- furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileHidKeyboard),
- BAD_BT_MAC_ADDRESS_LEN);
- }
- furi_string_free(tmp_str);
- flipper_format_file_close(file);
- }
- flipper_format_free(file);
-
- if(!furi_string_empty(app->keyboard_layout)) {
- FileInfo layout_file_info;
- FS_Error file_check_err = storage_common_stat(
- storage, furi_string_get_cstr(app->keyboard_layout), &layout_file_info);
- if(file_check_err != FSE_OK) {
- furi_string_reset(app->keyboard_layout);
- return;
- }
- if(layout_file_info.size != 256) {
- furi_string_reset(app->keyboard_layout);
- }
- }
-
- furi_record_close(RECORD_STORAGE);
-}
-
-static void bad_bt_save_settings(BadBtApp* app) {
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* file = flipper_format_file_alloc(storage);
- if(flipper_format_file_open_always(file, BAD_BT_SETTINGS_PATH)) {
- flipper_format_write_string(file, "Keyboard_Layout", app->keyboard_layout);
- flipper_format_write_bool(file, "BT_Remember", &(app->bt_remember), 1);
- flipper_format_write_string_cstr(file, "Bt_Name", app->config.bt_name);
- flipper_format_write_hex(
- file, "Bt_Mac", (uint8_t*)&app->config.bt_mac, BAD_BT_MAC_ADDRESS_LEN);
- flipper_format_file_close(file);
- }
- flipper_format_free(file);
- furi_record_close(RECORD_STORAGE);
-}
-
-void bad_bt_reload_worker(BadBtApp* app) {
- bad_bt_script_close(app->bad_bt_script);
- app->bad_bt_script = bad_bt_script_open(app->file_path, app->bt, app);
- bad_bt_script_set_keyboard_layout(app->bad_bt_script, app->keyboard_layout);
-}
-
-void bad_kb_config_refresh_menu(BadBtApp* app) {
- scene_manager_next_scene(app->scene_manager, BadBtSceneConfig);
- scene_manager_previous_scene(app->scene_manager);
-}
-
-int32_t bad_bt_config_switch_mode(BadBtApp* app) {
- bad_bt_reload_worker(app);
- furi_hal_bt_start_advertising();
- bad_kb_config_refresh_menu(app);
- return 0;
-}
-
-void bad_bt_config_switch_remember_mode(BadBtApp* app) {
- if(app->bt_remember) {
- furi_hal_bt_set_profile_pairing_method(
- FuriHalBtProfileHidKeyboard, GapPairingPinCodeVerifyYesNo);
- bt_set_profile_mac_address(app->bt, (uint8_t*)&BAD_BT_BOUND_MAC_ADDRESS);
- bt_enable_peer_key_update(app->bt);
- } else {
- furi_hal_bt_set_profile_pairing_method(FuriHalBtProfileHidKeyboard, GapPairingNone);
- bt_set_profile_mac_address(app->bt, app->config.bt_mac);
- bt_disable_peer_key_update(app->bt);
- }
- bad_bt_reload_worker(app);
-}
-
-int32_t bad_bt_connection_init(BadBtApp* app) {
- // Set original name and mac address in prev config
- strcpy(
- app->prev_config.bt_name, furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard));
-
- memcpy(app->prev_config.bt_mac, furi_hal_version_get_ble_mac(), BAD_BT_MAC_ADDRESS_LEN);
-
- bt_timeout = bt_hid_delays[LevelRssi39_0];
- bt_disconnect(app->bt);
- // Wait 2nd core to update nvm storage
- furi_delay_ms(200);
- bt_keys_storage_set_storage_path(app->bt, BAD_BT_APP_PATH_BOUND_KEYS_FILE);
- if(strcmp(app->config.bt_name, "") != 0) {
- furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, app->config.bt_name);
- }
- if(app->bt_remember) {
- furi_hal_bt_set_profile_mac_addr(
- FuriHalBtProfileHidKeyboard, (uint8_t*)&BAD_BT_BOUND_MAC_ADDRESS);
- furi_hal_bt_set_profile_pairing_method(
- FuriHalBtProfileHidKeyboard, GapPairingPinCodeVerifyYesNo);
- } else {
- if(memcmp(
- app->config.bt_mac, (uint8_t*)&BAD_BT_EMPTY_MAC_ADDRESS, BAD_BT_MAC_ADDRESS_LEN) !=
- 0) {
- furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, app->config.bt_mac);
- }
- furi_hal_bt_set_profile_pairing_method(FuriHalBtProfileHidKeyboard, GapPairingNone);
- }
- bt_set_profile(app->bt, BtProfileHidKeyboard);
- if(strcmp(app->config.bt_name, "") == 0) {
- strcpy(app->config.bt_name, furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard));
- }
- if(memcmp(app->config.bt_mac, (uint8_t*)&BAD_BT_EMPTY_MAC_ADDRESS, BAD_BT_MAC_ADDRESS_LEN) ==
- 0) {
- memcpy(
- app->config.bt_mac,
- furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileHidKeyboard),
- BAD_BT_MAC_ADDRESS_LEN);
- }
-
- furi_hal_bt_start_advertising();
- if(app->bt_remember) {
- bt_enable_peer_key_update(app->bt);
- } else {
- bt_disable_peer_key_update(app->bt);
- }
-
- return 0;
-}
-
-void bad_bt_connection_deinit(BadBtApp* app) {
- bt_disconnect(app->bt);
- // Wait 2nd core to update nvm storage
- furi_delay_ms(200);
- bt_keys_storage_set_default_path(app->bt);
- furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, app->prev_config.bt_name);
- furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, app->prev_config.bt_mac);
- furi_hal_bt_set_profile_pairing_method(
- FuriHalBtProfileHidKeyboard, GapPairingPinCodeVerifyYesNo);
- bt_set_profile(app->bt, BtProfileSerial);
- bt_enable_peer_key_update(app->bt);
-}
-
-BadBtApp* bad_bt_app_alloc(char* arg) {
- BadBtApp* app = malloc(sizeof(BadBtApp));
-
- app->bad_bt_script = NULL;
-
- app->file_path = furi_string_alloc();
- app->keyboard_layout = furi_string_alloc();
- if(arg && strlen(arg)) {
- furi_string_set(app->file_path, arg);
- }
-
- Storage* storage = furi_record_open(RECORD_STORAGE);
- storage_simply_mkdir(storage, BAD_BT_APP_BASE_CONFIG_FOLDER);
- furi_record_close(RECORD_STORAGE);
-
- bad_bt_load_settings(app);
-
- app->gui = furi_record_open(RECORD_GUI);
- app->notifications = furi_record_open(RECORD_NOTIFICATION);
- app->dialogs = furi_record_open(RECORD_DIALOGS);
-
- app->view_dispatcher = view_dispatcher_alloc();
- view_dispatcher_enable_queue(app->view_dispatcher);
-
- app->scene_manager = scene_manager_alloc(&bad_bt_scene_handlers, app);
-
- view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
- view_dispatcher_set_tick_event_callback(
- app->view_dispatcher, bad_bt_app_tick_event_callback, 500);
- view_dispatcher_set_custom_event_callback(
- app->view_dispatcher, bad_bt_app_custom_event_callback);
- view_dispatcher_set_navigation_event_callback(
- app->view_dispatcher, bad_bt_app_back_event_callback);
-
- Bt* bt = furi_record_open(RECORD_BT);
- app->bt = bt;
- app->bt->suppress_pin_screen = true;
-
- // Custom Widget
- app->widget = widget_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, BadBtAppViewError, widget_get_view(app->widget));
-
- app->var_item_list = variable_item_list_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, BadBtAppViewConfig, variable_item_list_get_view(app->var_item_list));
-
- app->bad_bt_view = bad_bt_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, BadBtAppViewWork, bad_bt_get_view(app->bad_bt_view));
-
- app->text_input = text_input_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, BadBtAppViewConfigName, text_input_get_view(app->text_input));
-
- app->byte_input = byte_input_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, BadBtAppViewConfigMac, byte_input_get_view(app->byte_input));
-
- view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
-
- app->conn_init_thread = furi_thread_alloc_ex(
- "BadBtConnInit", 1024, (FuriThreadCallback)bad_bt_connection_init, app);
- furi_thread_start(app->conn_init_thread);
- if(!furi_string_empty(app->file_path)) {
- app->bad_bt_script = bad_bt_script_open(app->file_path, app->bt, app);
- bad_bt_script_set_keyboard_layout(app->bad_bt_script, app->keyboard_layout);
- scene_manager_next_scene(app->scene_manager, BadBtSceneWork);
- } else {
- furi_string_set(app->file_path, BAD_BT_APP_BASE_FOLDER);
- scene_manager_next_scene(app->scene_manager, BadBtSceneFileSelect);
- }
-
- return app;
-}
-
-void bad_bt_app_free(BadBtApp* app) {
- furi_assert(app);
-
- if(app->bad_bt_script) {
- bad_bt_script_close(app->bad_bt_script);
- app->bad_bt_script = NULL;
- }
-
- // Views
- view_dispatcher_remove_view(app->view_dispatcher, BadBtAppViewWork);
- bad_bt_free(app->bad_bt_view);
-
- // Custom Widget
- view_dispatcher_remove_view(app->view_dispatcher, BadBtAppViewError);
- widget_free(app->widget);
-
- // Variable item list
- view_dispatcher_remove_view(app->view_dispatcher, BadBtAppViewConfig);
- variable_item_list_free(app->var_item_list);
-
- // Text Input
- view_dispatcher_remove_view(app->view_dispatcher, BadBtAppViewConfigName);
- text_input_free(app->text_input);
-
- // Byte Input
- view_dispatcher_remove_view(app->view_dispatcher, BadBtAppViewConfigMac);
- byte_input_free(app->byte_input);
-
- // View dispatcher
- view_dispatcher_free(app->view_dispatcher);
- scene_manager_free(app->scene_manager);
-
- // Restore bt config
- app->bt->suppress_pin_screen = false;
- if(app->conn_init_thread) {
- furi_thread_join(app->conn_init_thread);
- furi_thread_free(app->conn_init_thread);
- bad_bt_connection_deinit(app);
- }
-
- // Close records
- furi_record_close(RECORD_GUI);
- furi_record_close(RECORD_NOTIFICATION);
- furi_record_close(RECORD_DIALOGS);
- furi_record_close(RECORD_BT);
-
- bad_bt_save_settings(app);
-
- furi_string_free(app->file_path);
- furi_string_free(app->keyboard_layout);
-
- free(app);
-}
-
-int32_t bad_bt_app(void* p) {
- BadBtApp* bad_bt_app = bad_bt_app_alloc((char*)p);
-
- view_dispatcher_run(bad_bt_app->view_dispatcher);
-
- bad_bt_app_free(bad_bt_app);
- return 0;
-}
diff --git a/applications/external/bad_bt/bad_bt_app.h b/applications/external/bad_bt/bad_bt_app.h
deleted file mode 100644
index 13b0844b0..000000000
--- a/applications/external/bad_bt/bad_bt_app.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-
-#include "scenes/bad_bt_scene.h"
-#include "helpers/ducky_script.h"
-
-#include
-#include
-#include
-#include
-#include
-#include "bad_bt_icons.h"
-
-#define BAD_BT_APP_BASE_FOLDER EXT_PATH("badusb")
-#define BAD_BT_APP_BASE_CONFIG_FOLDER EXT_PATH("badbt")
-#define BAD_BT_APP_PATH_LAYOUT_FOLDER BAD_BT_APP_BASE_FOLDER "/assets/layouts"
-#define BAD_BT_APP_SCRIPT_EXTENSION ".txt"
-#define BAD_BT_APP_LAYOUT_EXTENSION ".kl"
-
-typedef enum BadBtCustomEvent {
- BadBtAppCustomEventTextEditResult,
- BadBtAppCustomEventByteInputDone,
- BadBtCustomEventErrorBack
-} BadBtCustomEvent;
-
-typedef enum {
- BadBtAppViewError,
- BadBtAppViewWork,
- BadBtAppViewConfig,
- BadBtAppViewConfigMac,
- BadBtAppViewConfigName
-} BadBtAppView;
-
-void bad_bt_config_switch_remember_mode(BadBtApp* app);
-
-int32_t bad_bt_connection_init(BadBtApp* app);
-
-void bad_bt_connection_deinit(BadBtApp* app);
-
-void bad_kb_config_refresh_menu(BadBtApp* app);
\ No newline at end of file
diff --git a/applications/external/bad_bt/helpers/ducky_script.c b/applications/external/bad_bt/helpers/ducky_script.c
deleted file mode 100644
index bef965d1e..000000000
--- a/applications/external/bad_bt/helpers/ducky_script.c
+++ /dev/null
@@ -1,792 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "ducky_script.h"
-#include "ducky_script_i.h"
-#include
-#include
-#include "../bad_bt_app.h"
-
-const uint8_t BAD_BT_BOUND_MAC_ADDRESS[BAD_BT_MAC_ADDRESS_LEN] =
- {0x41, 0x4a, 0xef, 0xb6, 0xa9, 0xd4};
-const uint8_t BAD_BT_EMPTY_MAC_ADDRESS[BAD_BT_MAC_ADDRESS_LEN] =
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-#define TAG "BadBT"
-#define WORKER_TAG TAG "Worker"
-
-#define BADBT_ASCII_TO_KEY(script, x) \
- (((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE)
-
-/**
- * Delays for waiting between HID key press and key release
-*/
-const uint8_t bt_hid_delays[LevelRssiNum] = {
- 60, // LevelRssi122_100
- 55, // LevelRssi99_80
- 50, // LevelRssi79_60
- 47, // LevelRssi59_40
- 34, // LevelRssi39_0
-};
-
-uint8_t bt_timeout = 0;
-
-static LevelRssiRange bt_remote_rssi_range(Bt* bt) {
- uint8_t rssi;
-
- if(!bt_remote_rssi(bt, &rssi)) return LevelRssiError;
-
- if(rssi <= 39)
- return LevelRssi39_0;
- else if(rssi <= 59)
- return LevelRssi59_40;
- else if(rssi <= 79)
- return LevelRssi79_60;
- else if(rssi <= 99)
- return LevelRssi99_80;
- else if(rssi <= 122)
- return LevelRssi122_100;
-
- return LevelRssiError;
-}
-
-static inline void update_bt_timeout(Bt* bt) {
- LevelRssiRange r = bt_remote_rssi_range(bt);
- if(r < LevelRssiNum) {
- bt_timeout = bt_hid_delays[r];
- FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout);
- }
-}
-
-typedef enum {
- WorkerEvtStartStop = (1 << 0),
- WorkerEvtPauseResume = (1 << 1),
- WorkerEvtEnd = (1 << 2),
- WorkerEvtConnect = (1 << 3),
- WorkerEvtDisconnect = (1 << 4),
-} WorkerEvtFlags;
-
-static const char ducky_cmd_id[] = {"ID"};
-static const char ducky_cmd_bt_id[] = {"BT_ID"};
-
-static const uint8_t numpad_keys[10] = {
- HID_KEYPAD_0,
- HID_KEYPAD_1,
- HID_KEYPAD_2,
- HID_KEYPAD_3,
- HID_KEYPAD_4,
- HID_KEYPAD_5,
- HID_KEYPAD_6,
- HID_KEYPAD_7,
- HID_KEYPAD_8,
- HID_KEYPAD_9,
-};
-
-uint32_t ducky_get_command_len(const char* line) {
- uint32_t len = strlen(line);
- for(uint32_t i = 0; i < len; i++) {
- if(line[i] == ' ') return i;
- }
- return 0;
-}
-
-bool ducky_is_line_end(const char chr) {
- return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n'));
-}
-
-uint16_t ducky_get_keycode(BadBtScript* bad_bt, const char* param, bool accept_chars) {
- uint16_t keycode = ducky_get_keycode_by_name(param);
- if(keycode != HID_KEYBOARD_NONE) {
- return keycode;
- }
-
- if((accept_chars) && (strlen(param) > 0)) {
- return (BADBT_ASCII_TO_KEY(bad_bt, param[0]) & 0xFF);
- }
- return 0;
-}
-
-bool ducky_get_number(const char* param, uint32_t* val) {
- uint32_t value = 0;
- if(sscanf(param, "%lu", &value) == 1) {
- *val = value;
- return true;
- }
- return false;
-}
-
-void ducky_numlock_on(BadBtScript* bad_bt) {
- UNUSED(bad_bt);
- if((furi_hal_bt_hid_get_led_state() & HID_KB_LED_NUM) == 0) {
- furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK);
- }
-}
-
-bool ducky_numpad_press(BadBtScript* bad_bt, const char num) {
- UNUSED(bad_bt);
- if((num < '0') || (num > '9')) return false;
-
- uint16_t key = numpad_keys[num - '0'];
- furi_hal_bt_hid_kb_press(key);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(key);
-
- return true;
-}
-
-bool ducky_altchar(BadBtScript* bad_bt, const char* charcode) {
- uint8_t i = 0;
- bool state = false;
-
- furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT);
-
- while(!ducky_is_line_end(charcode[i])) {
- state = ducky_numpad_press(bad_bt, charcode[i]);
- if(state == false) break;
- i++;
- }
-
- furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT);
-
- return state;
-}
-
-bool ducky_altstring(BadBtScript* bad_bt, const char* param) {
- uint32_t i = 0;
- bool state = false;
-
- while(param[i] != '\0') {
- if((param[i] < ' ') || (param[i] > '~')) {
- i++;
- continue; // Skip non-printable chars
- }
-
- char temp_str[4];
- snprintf(temp_str, 4, "%u", param[i]);
-
- state = ducky_altchar(bad_bt, temp_str);
- if(state == false) break;
- i++;
- }
- return state;
-}
-
-int32_t ducky_error(BadBtScript* bad_bt, const char* text, ...) {
- va_list args;
- va_start(args, text);
-
- vsnprintf(bad_bt->st.error, sizeof(bad_bt->st.error), text, args);
-
- va_end(args);
- return SCRIPT_STATE_ERROR;
-}
-
-bool ducky_string(BadBtScript* bad_bt, const char* param) {
- uint32_t i = 0;
-
- while(param[i] != '\0') {
- if(param[i] != '\n') {
- uint16_t keycode = BADBT_ASCII_TO_KEY(bad_bt, param[i]);
- if(keycode != HID_KEYBOARD_NONE) {
- furi_hal_bt_hid_kb_press(keycode);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(keycode);
- }
- } else {
- furi_hal_bt_hid_kb_press(HID_KEYBOARD_RETURN);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(HID_KEYBOARD_RETURN);
- }
- i++;
- }
- bad_bt->stringdelay = 0;
- return true;
-}
-
-static bool ducky_string_next(BadBtScript* bad_bt) {
- if(bad_bt->string_print_pos >= furi_string_size(bad_bt->string_print)) {
- return true;
- }
-
- char print_char = furi_string_get_char(bad_bt->string_print, bad_bt->string_print_pos);
-
- if(print_char != '\n') {
- uint16_t keycode = BADBT_ASCII_TO_KEY(bad_bt, print_char);
- if(keycode != HID_KEYBOARD_NONE) {
- furi_hal_bt_hid_kb_press(keycode);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(keycode);
- }
- } else {
- furi_hal_bt_hid_kb_press(HID_KEYBOARD_RETURN);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(HID_KEYBOARD_RETURN);
- }
-
- bad_bt->string_print_pos++;
-
- return false;
-}
-
-static int32_t ducky_parse_line(BadBtScript* bad_bt, FuriString* line) {
- uint32_t line_len = furi_string_size(line);
- const char* line_tmp = furi_string_get_cstr(line);
-
- if(line_len == 0) {
- return SCRIPT_STATE_NEXT_LINE; // Skip empty lines
- }
- FURI_LOG_D(WORKER_TAG, "line:%s", line_tmp);
-
- // Ducky Lang Functions
- int32_t cmd_result = ducky_execute_cmd(bad_bt, line_tmp);
- if(cmd_result != SCRIPT_STATE_CMD_UNKNOWN) {
- return cmd_result;
- }
-
- // Special keys + modifiers
- uint16_t key = ducky_get_keycode(bad_bt, line_tmp, false);
- if(key == HID_KEYBOARD_NONE) {
- return ducky_error(bad_bt, "No keycode defined for %s", line_tmp);
- }
- if((key & 0xFF00) != 0) {
- // It's a modifier key
- uint32_t offset = ducky_get_command_len(line_tmp) + 1;
- // ducky_get_command_len() returns 0 without space, so check for != 1
- if(offset != 1 && line_len > offset) {
- // It's also a key combination
- key |= ducky_get_keycode(bad_bt, line_tmp + offset, true);
- }
- }
- furi_hal_bt_hid_kb_press(key);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(key);
-
- return 0;
-}
-
-static bool ducky_set_bt_id(BadBtScript* bad_bt, const char* line) {
- size_t line_len = strlen(line);
- size_t mac_len = BAD_BT_MAC_ADDRESS_LEN * 3;
- if(line_len < mac_len + 1) return false; // MAC + at least 1 char for name
-
- uint8_t mac[BAD_BT_MAC_ADDRESS_LEN];
- for(size_t i = 0; i < BAD_BT_MAC_ADDRESS_LEN; i++) {
- char a = line[i * 3];
- char b = line[i * 3 + 1];
- if((a < 'A' && a > 'F') || (a < '0' && a > '9') || (b < 'A' && b > 'F') ||
- (b < '0' && b > '9') || !hex_char_to_uint8(a, b, &mac[i])) {
- return false;
- }
- }
- furi_hal_bt_reverse_mac_addr(mac);
-
- furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, line + mac_len);
- bt_set_profile_mac_address(bad_bt->bt, mac);
- return true;
-}
-
-static bool ducky_script_preload(BadBtScript* bad_bt, File* script_file) {
- uint8_t ret = 0;
- uint32_t line_len = 0;
-
- furi_string_reset(bad_bt->line);
-
- do {
- ret = storage_file_read(script_file, bad_bt->file_buf, FILE_BUFFER_LEN);
- for(uint16_t i = 0; i < ret; i++) {
- if(bad_bt->file_buf[i] == '\n' && line_len > 0) {
- bad_bt->st.line_nb++;
- line_len = 0;
- } else {
- if(bad_bt->st.line_nb == 0) { // Save first line
- furi_string_push_back(bad_bt->line, bad_bt->file_buf[i]);
- }
- line_len++;
- }
- }
- if(storage_file_eof(script_file)) {
- if(line_len > 0) {
- bad_bt->st.line_nb++;
- break;
- }
- }
- } while(ret > 0);
-
- const char* line_tmp = furi_string_get_cstr(bad_bt->line);
- if(bad_bt->app->switch_mode_thread) {
- furi_thread_join(bad_bt->app->switch_mode_thread);
- furi_thread_free(bad_bt->app->switch_mode_thread);
- bad_bt->app->switch_mode_thread = NULL;
- }
- // Looking for ID or BT_ID command at first line
- bad_bt->set_usb_id = false;
- bad_bt->set_bt_id = false;
- bad_bt->has_usb_id = strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0;
- // TODO: We setting has_usb_id to its value but ignoring it for now and not using anywhere here, may be used in a future to detect script type
- bad_bt->has_bt_id = strncmp(line_tmp, ducky_cmd_bt_id, strlen(ducky_cmd_bt_id)) == 0;
- if(bad_bt->has_bt_id) {
- if(!bad_bt->app->bt_remember) {
- bad_bt->set_bt_id = ducky_set_bt_id(bad_bt, &line_tmp[strlen(ducky_cmd_bt_id) + 1]);
- }
- }
-
- bad_kb_config_refresh_menu(bad_bt->app);
-
- if(!bad_bt->set_bt_id) {
- const char* bt_name = bad_bt->app->config.bt_name;
- const uint8_t* bt_mac = bad_bt->app->bt_remember ? (uint8_t*)&BAD_BT_BOUND_MAC_ADDRESS :
- bad_bt->app->config.bt_mac;
- bool reset_name = strncmp(
- bt_name,
- furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard),
- BAD_BT_ADV_NAME_MAX_LEN);
- bool reset_mac = memcmp(
- bt_mac,
- furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileHidKeyboard),
- BAD_BT_MAC_ADDRESS_LEN);
- if(reset_name && reset_mac) {
- furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, bt_name);
- } else if(reset_name) {
- bt_set_profile_adv_name(bad_bt->bt, bt_name);
- }
- if(reset_mac) {
- bt_set_profile_mac_address(bad_bt->bt, bt_mac);
- }
- }
-
- storage_file_seek(script_file, 0, true);
- furi_string_reset(bad_bt->line);
-
- return true;
-}
-
-static int32_t ducky_script_execute_next(BadBtScript* bad_bt, File* script_file) {
- int32_t delay_val = 0;
-
- if(bad_bt->repeat_cnt > 0) {
- bad_bt->repeat_cnt--;
- delay_val = ducky_parse_line(bad_bt, bad_bt->line_prev);
- if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line
- return 0;
- } else if(delay_val == SCRIPT_STATE_STRING_START) { // Print string with delays
- return delay_val;
- } else if(delay_val == SCRIPT_STATE_WAIT_FOR_BTN) { // wait for button
- return delay_val;
- } else if(delay_val < 0) { // Script error
- bad_bt->st.error_line = bad_bt->st.line_cur - 1;
- FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_bt->st.line_cur - 1U);
- return SCRIPT_STATE_ERROR;
- } else {
- return (delay_val + bad_bt->defdelay);
- }
- }
-
- furi_string_set(bad_bt->line_prev, bad_bt->line);
- furi_string_reset(bad_bt->line);
-
- while(1) {
- if(bad_bt->buf_len == 0) {
- bad_bt->buf_len = storage_file_read(script_file, bad_bt->file_buf, FILE_BUFFER_LEN);
- if(storage_file_eof(script_file)) {
- if((bad_bt->buf_len < FILE_BUFFER_LEN) && (bad_bt->file_end == false)) {
- bad_bt->file_buf[bad_bt->buf_len] = '\n';
- bad_bt->buf_len++;
- bad_bt->file_end = true;
- }
- }
-
- bad_bt->buf_start = 0;
- if(bad_bt->buf_len == 0) return SCRIPT_STATE_END;
- }
- for(uint8_t i = bad_bt->buf_start; i < (bad_bt->buf_start + bad_bt->buf_len); i++) {
- if(bad_bt->file_buf[i] == '\n' && furi_string_size(bad_bt->line) > 0) {
- bad_bt->st.line_cur++;
- bad_bt->buf_len = bad_bt->buf_len + bad_bt->buf_start - (i + 1);
- bad_bt->buf_start = i + 1;
- furi_string_trim(bad_bt->line);
- delay_val = ducky_parse_line(bad_bt, bad_bt->line);
- if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line
- return 0;
- } else if(delay_val == SCRIPT_STATE_STRING_START) { // Print string with delays
- return delay_val;
- } else if(delay_val == SCRIPT_STATE_WAIT_FOR_BTN) { // wait for button
- return delay_val;
- } else if(delay_val < 0) {
- bad_bt->st.error_line = bad_bt->st.line_cur;
- FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_bt->st.line_cur);
- return SCRIPT_STATE_ERROR;
- } else {
- return (delay_val + bad_bt->defdelay);
- }
- } else {
- furi_string_push_back(bad_bt->line, bad_bt->file_buf[i]);
- }
- }
- bad_bt->buf_len = 0;
- if(bad_bt->file_end) return SCRIPT_STATE_END;
- }
-
- return 0;
-}
-
-static void bad_bt_bt_hid_state_callback(BtStatus status, void* context) {
- furi_assert(context);
- BadBtScript* bad_bt = context;
- bool state = (status == BtStatusConnected);
-
- if(state == true) {
- LevelRssiRange r = bt_remote_rssi_range(bad_bt->bt);
- if(r != LevelRssiError) {
- bt_timeout = bt_hid_delays[r];
- }
- furi_thread_flags_set(furi_thread_get_id(bad_bt->thread), WorkerEvtConnect);
- } else {
- furi_thread_flags_set(furi_thread_get_id(bad_bt->thread), WorkerEvtDisconnect);
- }
-}
-
-static uint32_t bad_bt_flags_get(uint32_t flags_mask, uint32_t timeout) {
- uint32_t flags = furi_thread_flags_get();
- furi_check((flags & FuriFlagError) == 0);
- if(flags == 0) {
- flags = furi_thread_flags_wait(flags_mask, FuriFlagWaitAny, timeout);
- furi_check(((flags & FuriFlagError) == 0) || (flags == (unsigned)FuriFlagErrorTimeout));
- } else {
- uint32_t state = furi_thread_flags_clear(flags);
- furi_check((state & FuriFlagError) == 0);
- }
- return flags;
-}
-
-static int32_t bad_bt_worker(void* context) {
- BadBtScript* bad_bt = context;
-
- BadBtWorkerState worker_state = BadBtStateInit;
- int32_t delay_val = 0;
-
- FURI_LOG_I(WORKER_TAG, "Init");
- File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
- bad_bt->line = furi_string_alloc();
- bad_bt->line_prev = furi_string_alloc();
- bad_bt->string_print = furi_string_alloc();
-
- bt_set_status_changed_callback(bad_bt->bt, bad_bt_bt_hid_state_callback, bad_bt);
-
- while(1) {
- if(worker_state == BadBtStateInit) { // State: initialization
- if(storage_file_open(
- script_file,
- furi_string_get_cstr(bad_bt->file_path),
- FSAM_READ,
- FSOM_OPEN_EXISTING)) {
- if((ducky_script_preload(bad_bt, script_file)) && (bad_bt->st.line_nb > 0)) {
- if(furi_hal_bt_is_connected()) {
- worker_state = BadBtStateIdle; // Ready to run
- } else {
- worker_state = BadBtStateNotConnected; // Not connected
- }
-
- } else {
- worker_state = BadBtStateScriptError; // Script preload error
- }
- } else {
- FURI_LOG_E(WORKER_TAG, "File open error");
- worker_state = BadBtStateFileError; // File open error
- }
- bad_bt->st.state = worker_state;
-
- } else if(worker_state == BadBtStateNotConnected) { // State: Not connected
- uint32_t flags = bad_bt_flags_get(
- WorkerEvtEnd | WorkerEvtConnect | WorkerEvtDisconnect | WorkerEvtStartStop,
- FuriWaitForever);
-
- if(flags & WorkerEvtEnd) {
- break;
- } else if(flags & WorkerEvtConnect) {
- worker_state = BadBtStateIdle; // Ready to run
- } else if(flags & WorkerEvtStartStop) {
- worker_state = BadBtStateWillRun; // Will run when connected
- }
- bad_bt->st.state = worker_state;
-
- } else if(worker_state == BadBtStateIdle) { // State: ready to start
- uint32_t flags = bad_bt_flags_get(
- WorkerEvtEnd | WorkerEvtStartStop | WorkerEvtConnect | WorkerEvtDisconnect,
- FuriWaitForever);
-
- if(flags & WorkerEvtEnd) {
- break;
- } else if(flags & WorkerEvtStartStop) { // Start executing script
- delay_val = 0;
- bad_bt->buf_len = 0;
- bad_bt->st.line_cur = 0;
- bad_bt->defdelay = 0;
- bad_bt->stringdelay = 0;
- bad_bt->repeat_cnt = 0;
- bad_bt->key_hold_nb = 0;
- bad_bt->file_end = false;
- storage_file_seek(script_file, 0, true);
- bad_bt_script_set_keyboard_layout(bad_bt, bad_bt->keyboard_layout);
- worker_state = BadBtStateRunning;
- } else if(flags & WorkerEvtDisconnect) {
- worker_state = BadBtStateNotConnected; // Disconnected
- }
- bad_bt->st.state = worker_state;
-
- } else if(worker_state == BadBtStateWillRun) { // State: start on connection
- uint32_t flags = bad_bt_flags_get(
- WorkerEvtEnd | WorkerEvtConnect | WorkerEvtDisconnect | WorkerEvtStartStop,
- FuriWaitForever);
-
- if(flags & WorkerEvtEnd) {
- break;
- } else if(flags & WorkerEvtConnect) { // Start executing script
- delay_val = 0;
- bad_bt->buf_len = 0;
- bad_bt->st.line_cur = 0;
- bad_bt->defdelay = 0;
- bad_bt->stringdelay = 0;
- bad_bt->repeat_cnt = 0;
- bad_bt->file_end = false;
- storage_file_seek(script_file, 0, true);
- // extra time for PC to recognize Flipper as keyboard
- flags = furi_thread_flags_wait(
- WorkerEvtEnd | WorkerEvtDisconnect | WorkerEvtStartStop,
- FuriFlagWaitAny | FuriFlagNoClear,
- 1500);
- if(flags == (unsigned)FuriFlagErrorTimeout) {
- // If nothing happened - start script execution
- worker_state = BadBtStateRunning;
- } else if(flags & WorkerEvtStartStop) {
- worker_state = BadBtStateIdle;
- furi_thread_flags_clear(WorkerEvtStartStop);
- }
-
- update_bt_timeout(bad_bt->bt);
-
- bad_bt_script_set_keyboard_layout(bad_bt, bad_bt->keyboard_layout);
- } else if(flags & WorkerEvtStartStop) { // Cancel scheduled execution
- worker_state = BadBtStateNotConnected;
- }
- bad_bt->st.state = worker_state;
-
- } else if(worker_state == BadBtStateRunning) { // State: running
- uint16_t delay_cur = (delay_val > 1000) ? (1000) : (delay_val);
- uint32_t flags = furi_thread_flags_wait(
- WorkerEvtEnd | WorkerEvtStartStop | WorkerEvtConnect | WorkerEvtDisconnect,
- FuriFlagWaitAny,
- delay_cur);
-
- delay_val -= delay_cur;
- if(!(flags & FuriFlagError)) {
- if(flags & WorkerEvtEnd) {
- break;
- } else if(flags & WorkerEvtStartStop) {
- worker_state = BadBtStateIdle; // Stop executing script
-
- furi_hal_bt_hid_kb_release_all();
-
- } else if(flags & WorkerEvtDisconnect) {
- worker_state = BadBtStateNotConnected; // Disconnected
-
- furi_hal_bt_hid_kb_release_all();
- }
- bad_bt->st.state = worker_state;
- continue;
- } else if(
- (flags == (unsigned)FuriFlagErrorTimeout) ||
- (flags == (unsigned)FuriFlagErrorResource)) {
- if(delay_val > 0) {
- bad_bt->st.delay_remain--;
- continue;
- }
- bad_bt->st.state = BadBtStateRunning;
- delay_val = ducky_script_execute_next(bad_bt, script_file);
- if(delay_val == SCRIPT_STATE_ERROR) { // Script error
- delay_val = 0;
- worker_state = BadBtStateScriptError;
- bad_bt->st.state = worker_state;
-
- furi_hal_bt_hid_kb_release_all();
-
- } else if(delay_val == SCRIPT_STATE_END) { // End of script
- delay_val = 0;
- worker_state = BadBtStateIdle;
- bad_bt->st.state = BadBtStateDone;
-
- furi_hal_bt_hid_kb_release_all();
-
- continue;
- } else if(delay_val == SCRIPT_STATE_STRING_START) { // Start printing string with delays
- delay_val = bad_bt->defdelay;
- bad_bt->string_print_pos = 0;
- worker_state = BadBtStateStringDelay;
- } else if(delay_val == SCRIPT_STATE_WAIT_FOR_BTN) { // set state to wait for user input
- worker_state = BadBtStateWaitForBtn;
- bad_bt->st.state = BadBtStateWaitForBtn; // Show long delays
- } else if(delay_val > 1000) {
- bad_bt->st.state = BadBtStateDelay; // Show long delays
- bad_bt->st.delay_remain = delay_val / 1000;
- }
- } else {
- furi_check((flags & FuriFlagError) == 0);
- }
- } else if(worker_state == BadBtStateWaitForBtn) { // State: Wait for button Press
- uint16_t delay_cur = (delay_val > 1000) ? (1000) : (delay_val);
- uint32_t flags = furi_thread_flags_wait(
- WorkerEvtEnd | WorkerEvtStartStop | WorkerEvtPauseResume | WorkerEvtConnect |
- WorkerEvtDisconnect,
- FuriFlagWaitAny,
- delay_cur);
- if(!(flags & FuriFlagError)) {
- if(flags & WorkerEvtEnd) {
- break;
- } else if(flags & WorkerEvtStartStop) {
- delay_val = 0;
- worker_state = BadBtStateRunning;
- } else if(flags & WorkerEvtDisconnect) {
- worker_state = BadBtStateNotConnected; // Disconnected
- furi_hal_hid_kb_release_all();
- }
- bad_bt->st.state = worker_state;
- continue;
- }
- } else if(worker_state == BadBtStateStringDelay) { // State: print string with delays
- uint32_t flags = furi_thread_flags_wait(
- WorkerEvtEnd | WorkerEvtStartStop | WorkerEvtPauseResume | WorkerEvtConnect |
- WorkerEvtDisconnect,
- FuriFlagWaitAny,
- bad_bt->stringdelay);
-
- if(!(flags & FuriFlagError)) {
- if(flags & WorkerEvtEnd) {
- break;
- } else if(flags & WorkerEvtStartStop) {
- worker_state = BadBtStateIdle; // Stop executing script
-
- furi_hal_bt_hid_kb_release_all();
-
- } else if(flags & WorkerEvtDisconnect) {
- worker_state = BadBtStateNotConnected; // Disconnected
-
- furi_hal_bt_hid_kb_release_all();
- }
- bad_bt->st.state = worker_state;
- continue;
- } else if(
- (flags == (unsigned)FuriFlagErrorTimeout) ||
- (flags == (unsigned)FuriFlagErrorResource)) {
- bool string_end = ducky_string_next(bad_bt);
- if(string_end) {
- bad_bt->stringdelay = 0;
- worker_state = BadBtStateRunning;
- }
- } else {
- furi_check((flags & FuriFlagError) == 0);
- }
- } else if(
- (worker_state == BadBtStateFileError) ||
- (worker_state == BadBtStateScriptError)) { // State: error
- uint32_t flags =
- bad_bt_flags_get(WorkerEvtEnd, FuriWaitForever); // Waiting for exit command
-
- if(flags & WorkerEvtEnd) {
- break;
- }
- }
-
- update_bt_timeout(bad_bt->bt);
- }
-
- bt_set_status_changed_callback(bad_bt->bt, NULL, NULL);
-
- storage_file_close(script_file);
- storage_file_free(script_file);
- furi_string_free(bad_bt->line);
- furi_string_free(bad_bt->line_prev);
- furi_string_free(bad_bt->string_print);
-
- FURI_LOG_I(WORKER_TAG, "End");
-
- return 0;
-}
-
-static void bad_bt_script_set_default_keyboard_layout(BadBtScript* bad_bt) {
- furi_assert(bad_bt);
- furi_string_set_str(bad_bt->keyboard_layout, "");
- memset(bad_bt->layout, HID_KEYBOARD_NONE, sizeof(bad_bt->layout));
- memcpy(bad_bt->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_bt->layout)));
-}
-
-BadBtScript* bad_bt_script_open(FuriString* file_path, Bt* bt, BadBtApp* app) {
- furi_assert(file_path);
-
- BadBtScript* bad_bt = malloc(sizeof(BadBtScript));
- bad_bt->app = app;
- bad_bt->file_path = furi_string_alloc();
- furi_string_set(bad_bt->file_path, file_path);
- bad_bt->keyboard_layout = furi_string_alloc();
- bad_bt_script_set_default_keyboard_layout(bad_bt);
-
- bad_bt->st.state = BadBtStateInit;
- bad_bt->st.error[0] = '\0';
-
- bad_bt->bt = bt;
-
- bad_bt->thread = furi_thread_alloc_ex("BadBtWorker", 2048, bad_bt_worker, bad_bt);
- furi_thread_start(bad_bt->thread);
- return bad_bt;
-}
-
-void bad_bt_script_close(BadBtScript* bad_bt) {
- furi_assert(bad_bt);
- furi_record_close(RECORD_STORAGE);
- furi_thread_flags_set(furi_thread_get_id(bad_bt->thread), WorkerEvtEnd);
- furi_thread_join(bad_bt->thread);
- furi_thread_free(bad_bt->thread);
- furi_string_free(bad_bt->file_path);
- furi_string_free(bad_bt->keyboard_layout);
- free(bad_bt);
-}
-
-void bad_bt_script_set_keyboard_layout(BadBtScript* bad_bt, FuriString* layout_path) {
- furi_assert(bad_bt);
-
- if((bad_bt->st.state == BadBtStateRunning) || (bad_bt->st.state == BadBtStateDelay)) {
- // do not update keyboard layout while a script is running
- return;
- }
-
- File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
- if(!furi_string_empty(layout_path)) { //-V1051
- furi_string_set(bad_bt->keyboard_layout, layout_path);
- if(storage_file_open(
- layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
- uint16_t layout[128];
- if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) {
- memcpy(bad_bt->layout, layout, sizeof(layout));
- }
- }
- storage_file_close(layout_file);
- } else {
- bad_bt_script_set_default_keyboard_layout(bad_bt);
- }
- storage_file_free(layout_file);
-}
-
-void bad_bt_script_toggle(BadBtScript* bad_bt) {
- furi_assert(bad_bt);
- furi_thread_flags_set(furi_thread_get_id(bad_bt->thread), WorkerEvtStartStop);
-}
-
-BadBtState* bad_bt_script_get_state(BadBtScript* bad_bt) {
- furi_assert(bad_bt);
- return &(bad_bt->st);
-}
\ No newline at end of file
diff --git a/applications/external/bad_bt/helpers/ducky_script.h b/applications/external/bad_bt/helpers/ducky_script.h
deleted file mode 100644
index ea0f91040..000000000
--- a/applications/external/bad_bt/helpers/ducky_script.h
+++ /dev/null
@@ -1,154 +0,0 @@
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include "../views/bad_bt_view.h"
-
-#define FILE_BUFFER_LEN 16
-
-typedef enum {
- LevelRssi122_100,
- LevelRssi99_80,
- LevelRssi79_60,
- LevelRssi59_40,
- LevelRssi39_0,
- LevelRssiNum,
- LevelRssiError = 0xFF,
-} LevelRssiRange;
-
-extern const uint8_t bt_hid_delays[LevelRssiNum];
-
-extern uint8_t bt_timeout;
-
-typedef enum {
- BadBtStateInit,
- BadBtStateNotConnected,
- BadBtStateIdle,
- BadBtStateWillRun,
- BadBtStateRunning,
- BadBtStateDelay,
- BadBtStateStringDelay,
- BadBtStateWaitForBtn,
- BadBtStateDone,
- BadBtStateScriptError,
- BadBtStateFileError,
-} BadBtWorkerState;
-
-struct BadBtState {
- BadBtWorkerState state;
- uint32_t pin;
- uint16_t line_cur;
- uint16_t line_nb;
- uint32_t delay_remain;
- uint16_t error_line;
- char error[64];
-};
-
-typedef struct BadBtApp BadBtApp;
-
-typedef struct {
- FuriHalUsbHidConfig hid_cfg;
- FuriThread* thread;
- BadBtState st;
-
- FuriString* file_path;
- FuriString* keyboard_layout;
- uint8_t file_buf[FILE_BUFFER_LEN + 1];
- uint8_t buf_start;
- uint8_t buf_len;
- bool file_end;
-
- uint32_t defdelay;
- uint32_t stringdelay;
- uint16_t layout[128];
-
- FuriString* line;
- FuriString* line_prev;
- uint32_t repeat_cnt;
- uint8_t key_hold_nb;
-
- bool set_usb_id;
- bool set_bt_id;
- bool has_usb_id;
- bool has_bt_id;
-
- FuriString* string_print;
- size_t string_print_pos;
-
- Bt* bt;
- BadBtApp* app;
-} BadBtScript;
-
-BadBtScript* bad_bt_script_open(FuriString* file_path, Bt* bt, BadBtApp* app);
-
-void bad_bt_script_close(BadBtScript* bad_bt);
-
-void bad_bt_script_set_keyboard_layout(BadBtScript* bad_bt, FuriString* layout_path);
-
-void bad_bt_script_start(BadBtScript* bad_bt);
-
-void bad_bt_script_stop(BadBtScript* bad_bt);
-
-void bad_bt_script_toggle(BadBtScript* bad_bt);
-
-BadBtState* bad_bt_script_get_state(BadBtScript* bad_bt);
-
-#define BAD_BT_ADV_NAME_MAX_LEN FURI_HAL_BT_ADV_NAME_LENGTH
-#define BAD_BT_MAC_ADDRESS_LEN GAP_MAC_ADDR_SIZE
-
-// this is the MAC address used when we do not forget paired device (BOUND STATE)
-extern const uint8_t BAD_BT_BOUND_MAC_ADDRESS[BAD_BT_MAC_ADDRESS_LEN];
-extern const uint8_t BAD_BT_EMPTY_MAC_ADDRESS[BAD_BT_MAC_ADDRESS_LEN];
-
-typedef enum {
- BadBtAppErrorNoFiles,
- BadBtAppErrorCloseRpc,
-} BadBtAppError;
-
-typedef struct {
- char bt_name[BAD_BT_ADV_NAME_MAX_LEN];
- uint8_t bt_mac[BAD_BT_MAC_ADDRESS_LEN];
- GapPairing bt_mode;
-} BadBtConfig;
-
-struct BadBtApp {
- Gui* gui;
- ViewDispatcher* view_dispatcher;
- SceneManager* scene_manager;
- NotificationApp* notifications;
- DialogsApp* dialogs;
- Widget* widget;
- VariableItemList* var_item_list;
- TextInput* text_input;
- ByteInput* byte_input;
-
- BadBtAppError error;
- FuriString* file_path;
- FuriString* keyboard_layout;
- BadBt* bad_bt_view;
- BadBtScript* bad_bt_script;
-
- Bt* bt;
- bool bt_remember;
- BadBtConfig config;
- BadBtConfig prev_config;
- FuriThread* conn_init_thread;
- FuriThread* switch_mode_thread;
-};
-
-int32_t bad_bt_config_switch_mode(BadBtApp* app);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/applications/external/bad_bt/helpers/ducky_script_commands.c b/applications/external/bad_bt/helpers/ducky_script_commands.c
deleted file mode 100644
index eddab96ac..000000000
--- a/applications/external/bad_bt/helpers/ducky_script_commands.c
+++ /dev/null
@@ -1,201 +0,0 @@
-#include
-#include
-#include "ducky_script.h"
-#include "ducky_script_i.h"
-
-typedef int32_t (*DuckyCmdCallback)(BadBtScript* bad_bt, const char* line, int32_t param);
-
-typedef struct {
- char* name;
- DuckyCmdCallback callback;
- int32_t param;
-} DuckyCmd;
-
-static int32_t ducky_fnc_delay(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- uint32_t delay_val = 0;
- bool state = ducky_get_number(line, &delay_val);
- if((state) && (delay_val > 0)) {
- return (int32_t)delay_val;
- }
-
- return ducky_error(bad_bt, "Invalid number %s", line);
-}
-
-static int32_t ducky_fnc_defdelay(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- bool state = ducky_get_number(line, &bad_bt->defdelay);
- if(!state) {
- return ducky_error(bad_bt, "Invalid number %s", line);
- }
- return 0;
-}
-
-static int32_t ducky_fnc_strdelay(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- bool state = ducky_get_number(line, &bad_bt->stringdelay);
- if(!state) {
- return ducky_error(bad_bt, "Invalid number %s", line);
- }
- return 0;
-}
-
-static int32_t ducky_fnc_string(BadBtScript* bad_bt, const char* line, int32_t param) {
- line = &line[ducky_get_command_len(line) + 1];
- furi_string_set_str(bad_bt->string_print, line);
- if(param == 1) {
- furi_string_cat(bad_bt->string_print, "\n");
- }
-
- if(bad_bt->stringdelay == 0) { // stringdelay not set - run command immidiately
- bool state = ducky_string(bad_bt, furi_string_get_cstr(bad_bt->string_print));
- if(!state) {
- return ducky_error(bad_bt, "Invalid string %s", line);
- }
- } else { // stringdelay is set - run command in thread to keep handling external events
- return SCRIPT_STATE_STRING_START;
- }
-
- return 0;
-}
-
-static int32_t ducky_fnc_repeat(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- bool state = ducky_get_number(line, &bad_bt->repeat_cnt);
- if((!state) || (bad_bt->repeat_cnt == 0)) {
- return ducky_error(bad_bt, "Invalid number %s", line);
- }
- return 0;
-}
-
-static int32_t ducky_fnc_sysrq(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- uint16_t key = ducky_get_keycode(bad_bt, line, true);
-
- furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN);
- furi_hal_bt_hid_kb_press(key);
- furi_delay_ms(bt_timeout);
- furi_hal_bt_hid_kb_release(key);
- furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN);
- return 0;
-}
-
-static int32_t ducky_fnc_altchar(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- ducky_numlock_on(bad_bt);
- bool state = ducky_altchar(bad_bt, line);
- if(!state) {
- return ducky_error(bad_bt, "Invalid altchar %s", line);
- }
- return 0;
-}
-
-static int32_t ducky_fnc_altstring(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- ducky_numlock_on(bad_bt);
- bool state = ducky_altstring(bad_bt, line);
- if(!state) {
- return ducky_error(bad_bt, "Invalid altstring %s", line);
- }
- return 0;
-}
-
-static int32_t ducky_fnc_hold(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- uint16_t key = ducky_get_keycode(bad_bt, line, true);
- if(key == HID_KEYBOARD_NONE) {
- return ducky_error(bad_bt, "No keycode defined for %s", line);
- }
- bad_bt->key_hold_nb++;
- if(bad_bt->key_hold_nb > (HID_KB_MAX_KEYS - 1)) {
- return ducky_error(bad_bt, "Too many keys are hold");
- }
- furi_hal_bt_hid_kb_press(key);
-
- return 0;
-}
-
-static int32_t ducky_fnc_release(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
-
- line = &line[ducky_get_command_len(line) + 1];
- uint16_t key = ducky_get_keycode(bad_bt, line, true);
- if(key == HID_KEYBOARD_NONE) {
- return ducky_error(bad_bt, "No keycode defined for %s", line);
- }
- if(bad_bt->key_hold_nb == 0) {
- return ducky_error(bad_bt, "No keys are hold");
- }
- bad_bt->key_hold_nb--;
- furi_hal_bt_hid_kb_release(key);
- return 0;
-}
-
-static int32_t ducky_fnc_waitforbutton(BadBtScript* bad_bt, const char* line, int32_t param) {
- UNUSED(param);
- UNUSED(bad_bt);
- UNUSED(line);
-
- return SCRIPT_STATE_WAIT_FOR_BTN;
-}
-
-static const DuckyCmd ducky_commands[] = {
- {"REM", NULL, -1},
- {"ID", NULL, -1},
- {"BT_ID", NULL, -1},
- {"DELAY", ducky_fnc_delay, -1},
- {"STRING", ducky_fnc_string, 0},
- {"STRINGLN", ducky_fnc_string, 1},
- {"DEFAULT_DELAY", ducky_fnc_defdelay, -1},
- {"DEFAULTDELAY", ducky_fnc_defdelay, -1},
- {"STRINGDELAY", ducky_fnc_strdelay, -1},
- {"STRING_DELAY", ducky_fnc_strdelay, -1},
- {"REPEAT", ducky_fnc_repeat, -1},
- {"SYSRQ", ducky_fnc_sysrq, -1},
- {"ALTCHAR", ducky_fnc_altchar, -1},
- {"ALTSTRING", ducky_fnc_altstring, -1},
- {"ALTCODE", ducky_fnc_altstring, -1},
- {"HOLD", ducky_fnc_hold, -1},
- {"RELEASE", ducky_fnc_release, -1},
- {"WAIT_FOR_BUTTON_PRESS", ducky_fnc_waitforbutton, -1},
-};
-
-#define TAG "BadBT"
-#define WORKER_TAG TAG "Worker"
-
-int32_t ducky_execute_cmd(BadBtScript* bad_bt, const char* line) {
- size_t cmd_word_len = strcspn(line, " ");
- for(size_t i = 0; i < COUNT_OF(ducky_commands); i++) {
- size_t cmd_compare_len = strlen(ducky_commands[i].name);
-
- if(cmd_compare_len != cmd_word_len) {
- continue;
- }
-
- if(strncmp(line, ducky_commands[i].name, cmd_compare_len) == 0) {
- if(ducky_commands[i].callback == NULL) {
- return 0;
- } else {
- return ((ducky_commands[i].callback)(bad_bt, line, ducky_commands[i].param));
- }
- }
- }
-
- return SCRIPT_STATE_CMD_UNKNOWN;
-}
diff --git a/applications/external/bad_bt/helpers/ducky_script_i.h b/applications/external/bad_bt/helpers/ducky_script_i.h
deleted file mode 100644
index 08afa65a4..000000000
--- a/applications/external/bad_bt/helpers/ducky_script_i.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#include
-#include "ducky_script.h"
-
-#define SCRIPT_STATE_ERROR (-1)
-#define SCRIPT_STATE_END (-2)
-#define SCRIPT_STATE_NEXT_LINE (-3)
-#define SCRIPT_STATE_CMD_UNKNOWN (-4)
-#define SCRIPT_STATE_STRING_START (-5)
-#define SCRIPT_STATE_WAIT_FOR_BTN (-6)
-
-uint16_t ducky_get_keycode(BadBtScript* bad_bt, const char* param, bool accept_chars);
-
-uint32_t ducky_get_command_len(const char* line);
-
-bool ducky_is_line_end(const char chr);
-
-uint16_t ducky_get_keycode_by_name(const char* param);
-
-bool ducky_get_number(const char* param, uint32_t* val);
-
-void ducky_numlock_on(BadBtScript* bad_bt);
-
-bool ducky_numpad_press(BadBtScript* bad_bt, const char num);
-
-bool ducky_altchar(BadBtScript* bad_bt, const char* charcode);
-
-bool ducky_altstring(BadBtScript* bad_bt, const char* param);
-
-bool ducky_string(BadBtScript* bad_bt, const char* param);
-
-int32_t ducky_execute_cmd(BadBtScript* bad_bt, const char* line);
-
-int32_t ducky_error(BadBtScript* bad_bt, const char* text, ...);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/applications/external/bad_bt/helpers/ducky_script_keycodes.c b/applications/external/bad_bt/helpers/ducky_script_keycodes.c
deleted file mode 100644
index 55c52810f..000000000
--- a/applications/external/bad_bt/helpers/ducky_script_keycodes.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include
-#include "ducky_script_i.h"
-
-typedef struct {
- char* name;
- uint16_t keycode;
-} DuckyKey;
-
-static const DuckyKey ducky_keys[] = {
- {"CTRL-ALT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_ALT},
- {"CTRL-SHIFT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT},
- {"ALT-SHIFT", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_SHIFT},
- {"ALT-GUI", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_GUI},
- {"GUI-SHIFT", KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT},
- {"GUI-CTRL", KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_CTRL},
-
- {"CTRL", KEY_MOD_LEFT_CTRL},
- {"CONTROL", KEY_MOD_LEFT_CTRL},
- {"SHIFT", KEY_MOD_LEFT_SHIFT},
- {"ALT", KEY_MOD_LEFT_ALT},
- {"GUI", KEY_MOD_LEFT_GUI},
- {"WINDOWS", KEY_MOD_LEFT_GUI},
-
- {"DOWNARROW", HID_KEYBOARD_DOWN_ARROW},
- {"DOWN", HID_KEYBOARD_DOWN_ARROW},
- {"LEFTARROW", HID_KEYBOARD_LEFT_ARROW},
- {"LEFT", HID_KEYBOARD_LEFT_ARROW},
- {"RIGHTARROW", HID_KEYBOARD_RIGHT_ARROW},
- {"RIGHT", HID_KEYBOARD_RIGHT_ARROW},
- {"UPARROW", HID_KEYBOARD_UP_ARROW},
- {"UP", HID_KEYBOARD_UP_ARROW},
-
- {"ENTER", HID_KEYBOARD_RETURN},
- {"BREAK", HID_KEYBOARD_PAUSE},
- {"PAUSE", HID_KEYBOARD_PAUSE},
- {"CAPSLOCK", HID_KEYBOARD_CAPS_LOCK},
- {"DELETE", HID_KEYBOARD_DELETE_FORWARD},
- {"BACKSPACE", HID_KEYBOARD_DELETE},
- {"END", HID_KEYBOARD_END},
- {"ESC", HID_KEYBOARD_ESCAPE},
- {"ESCAPE", HID_KEYBOARD_ESCAPE},
- {"HOME", HID_KEYBOARD_HOME},
- {"INSERT", HID_KEYBOARD_INSERT},
- {"NUMLOCK", HID_KEYPAD_NUMLOCK},
- {"PAGEUP", HID_KEYBOARD_PAGE_UP},
- {"PAGEDOWN", HID_KEYBOARD_PAGE_DOWN},
- {"PRINTSCREEN", HID_KEYBOARD_PRINT_SCREEN},
- {"SCROLLLOCK", HID_KEYBOARD_SCROLL_LOCK},
- {"SPACE", HID_KEYBOARD_SPACEBAR},
- {"TAB", HID_KEYBOARD_TAB},
- {"MENU", HID_KEYBOARD_APPLICATION},
- {"APP", HID_KEYBOARD_APPLICATION},
-
- {"F1", HID_KEYBOARD_F1},
- {"F2", HID_KEYBOARD_F2},
- {"F3", HID_KEYBOARD_F3},
- {"F4", HID_KEYBOARD_F4},
- {"F5", HID_KEYBOARD_F5},
- {"F6", HID_KEYBOARD_F6},
- {"F7", HID_KEYBOARD_F7},
- {"F8", HID_KEYBOARD_F8},
- {"F9", HID_KEYBOARD_F9},
- {"F10", HID_KEYBOARD_F10},
- {"F11", HID_KEYBOARD_F11},
- {"F12", HID_KEYBOARD_F12},
-};
-
-uint16_t ducky_get_keycode_by_name(const char* param) {
- for(size_t i = 0; i < COUNT_OF(ducky_keys); i++) {
- size_t key_cmd_len = strlen(ducky_keys[i].name);
- if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) &&
- (ducky_is_line_end(param[key_cmd_len]))) {
- return ducky_keys[i].keycode;
- }
- }
-
- return HID_KEYBOARD_NONE;
-}
diff --git a/applications/external/bad_bt/images/badbt_10px.png b/applications/external/bad_bt/images/badbt_10px.png
deleted file mode 100644
index 037474aa3..000000000
Binary files a/applications/external/bad_bt/images/badbt_10px.png and /dev/null differ
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene.c b/applications/external/bad_bt/scenes/bad_bt_scene.c
deleted file mode 100644
index c207ae44b..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "bad_bt_scene.h"
-
-// Generate scene on_enter handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
-void (*const bad_bt_scene_on_enter_handlers[])(void*) = {
-#include "bad_bt_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 bad_bt_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = {
-#include "bad_bt_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 bad_bt_scene_on_exit_handlers[])(void* context) = {
-#include "bad_bt_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Initialize scene handlers configuration structure
-const SceneManagerHandlers bad_bt_scene_handlers = {
- .on_enter_handlers = bad_bt_scene_on_enter_handlers,
- .on_event_handlers = bad_bt_scene_on_event_handlers,
- .on_exit_handlers = bad_bt_scene_on_exit_handlers,
- .scene_num = BadBtSceneNum,
-};
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene.h b/applications/external/bad_bt/scenes/bad_bt_scene.h
deleted file mode 100644
index a316034ef..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include
-
-// Generate scene id and total number
-#define ADD_SCENE(prefix, name, id) BadBtScene##id,
-typedef enum {
-#include "bad_bt_scene_config.h"
- BadBtSceneNum,
-} BadBtScene;
-#undef ADD_SCENE
-
-extern const SceneManagerHandlers bad_bt_scene_handlers;
-
-// Generate scene on_enter handlers declaration
-#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
-#include "bad_bt_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 "bad_bt_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 "bad_bt_scene_config.h"
-#undef ADD_SCENE
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_config.c b/applications/external/bad_bt/scenes/bad_bt_scene_config.c
deleted file mode 100644
index 5fc9c0012..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_config.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "../bad_bt_app.h"
-#include "../helpers/ducky_script.h"
-#include "furi_hal_power.h"
-
-enum VarItemListIndex {
- VarItemListIndexKeyboardLayout,
- VarItemListIndexBtRemember,
- VarItemListIndexBtDeviceName,
- VarItemListIndexBtMacAddress,
- VarItemListIndexRandomizeBtMac,
-};
-
-void bad_bt_scene_config_bt_remember_callback(VariableItem* item) {
- BadBtApp* bad_bt = variable_item_get_context(item);
- bad_bt->bt_remember = variable_item_get_current_value_index(item);
- variable_item_set_current_value_text(item, bad_bt->bt_remember ? "ON" : "OFF");
- view_dispatcher_send_custom_event(bad_bt->view_dispatcher, VarItemListIndexBtRemember);
-}
-
-void bad_bt_scene_config_var_item_list_callback(void* context, uint32_t index) {
- BadBtApp* bad_bt = context;
- view_dispatcher_send_custom_event(bad_bt->view_dispatcher, index);
-}
-
-void bad_bt_scene_config_on_enter(void* context) {
- BadBtApp* bad_bt = context;
- VariableItemList* var_item_list = bad_bt->var_item_list;
- VariableItem* item;
-
- item = variable_item_list_add(var_item_list, "Keyboard layout", 0, NULL, bad_bt);
-
- item = variable_item_list_add(
- var_item_list, "BT Remember", 2, bad_bt_scene_config_bt_remember_callback, bad_bt);
- variable_item_set_current_value_index(item, bad_bt->bt_remember);
- variable_item_set_current_value_text(item, bad_bt->bt_remember ? "ON" : "OFF");
-
- item = variable_item_list_add(var_item_list, "BT Device Name", 0, NULL, bad_bt);
- if(bad_bt->bad_bt_script->set_bt_id) {
- variable_item_set_locked(item, true, "Script has\nBT_ID cmd!\nLocked to\nset Name!");
- }
-
- item = variable_item_list_add(var_item_list, "BT MAC Address", 0, NULL, bad_bt);
- if(bad_bt->bt_remember) {
- variable_item_set_locked(item, true, "Remember\nmust be Off!");
- } else if(bad_bt->bad_bt_script->set_bt_id) {
- variable_item_set_locked(item, true, "Script has\nBT_ID cmd!\nLocked to\nset MAC!");
- }
-
- item = variable_item_list_add(var_item_list, "Randomize BT MAC", 0, NULL, bad_bt);
- if(bad_bt->bt_remember) {
- variable_item_set_locked(item, true, "Remember\nmust be Off!");
- } else if(bad_bt->bad_bt_script->set_bt_id) {
- variable_item_set_locked(item, true, "Script has\nBT_ID cmd!\nLocked to\nset MAC!");
- }
-
- variable_item_list_set_enter_callback(
- var_item_list, bad_bt_scene_config_var_item_list_callback, bad_bt);
-
- variable_item_list_set_selected_item(
- var_item_list, scene_manager_get_scene_state(bad_bt->scene_manager, BadBtSceneConfig));
-
- view_dispatcher_switch_to_view(bad_bt->view_dispatcher, BadBtAppViewConfig);
-}
-
-bool bad_bt_scene_config_on_event(void* context, SceneManagerEvent event) {
- BadBtApp* bad_bt = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- scene_manager_set_scene_state(bad_bt->scene_manager, BadBtSceneConfig, event.event);
- consumed = true;
- switch(event.event) {
- case VarItemListIndexKeyboardLayout:
- scene_manager_next_scene(bad_bt->scene_manager, BadBtSceneConfigLayout);
- break;
- case VarItemListIndexBtRemember:
- bad_bt_config_switch_remember_mode(bad_bt);
- scene_manager_previous_scene(bad_bt->scene_manager);
- scene_manager_next_scene(bad_bt->scene_manager, BadBtSceneConfig);
- break;
- case VarItemListIndexBtDeviceName:
- scene_manager_next_scene(bad_bt->scene_manager, BadBtSceneConfigName);
- break;
- case VarItemListIndexBtMacAddress:
- scene_manager_next_scene(bad_bt->scene_manager, BadBtSceneConfigMac);
- break;
- case VarItemListIndexRandomizeBtMac:
- furi_hal_random_fill_buf(bad_bt->config.bt_mac, BAD_BT_MAC_ADDRESS_LEN);
- bt_set_profile_mac_address(bad_bt->bt, bad_bt->config.bt_mac);
- break;
- default:
- break;
- }
- }
-
- return consumed;
-}
-
-void bad_bt_scene_config_on_exit(void* context) {
- BadBtApp* bad_bt = context;
- VariableItemList* var_item_list = bad_bt->var_item_list;
-
- variable_item_list_reset(var_item_list);
-}
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_config.h b/applications/external/bad_bt/scenes/bad_bt_scene_config.h
deleted file mode 100644
index f7914e6dd..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_config.h
+++ /dev/null
@@ -1,7 +0,0 @@
-ADD_SCENE(bad_bt, file_select, FileSelect)
-ADD_SCENE(bad_bt, work, Work)
-ADD_SCENE(bad_bt, error, Error)
-ADD_SCENE(bad_bt, config, Config)
-ADD_SCENE(bad_bt, config_layout, ConfigLayout)
-ADD_SCENE(bad_bt, config_name, ConfigName)
-ADD_SCENE(bad_bt, config_mac, ConfigMac)
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_config_layout.c b/applications/external/bad_bt/scenes/bad_bt_scene_config_layout.c
deleted file mode 100644
index b0ce2d084..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_config_layout.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "../bad_bt_app.h"
-#include "furi_hal_power.h"
-#include
-
-static bool bad_bt_layout_select(BadBtApp* bad_bt) {
- furi_assert(bad_bt);
-
- FuriString* predefined_path;
- predefined_path = furi_string_alloc();
- if(!furi_string_empty(bad_bt->keyboard_layout)) {
- furi_string_set(predefined_path, bad_bt->keyboard_layout);
- } else {
- furi_string_set(predefined_path, BAD_BT_APP_PATH_LAYOUT_FOLDER);
- }
-
- DialogsFileBrowserOptions browser_options;
- dialog_file_browser_set_basic_options(
- &browser_options, BAD_BT_APP_LAYOUT_EXTENSION, &I_keyboard_10px);
- browser_options.base_path = BAD_BT_APP_PATH_LAYOUT_FOLDER;
- browser_options.skip_assets = false;
-
- // Input events and views are managed by file_browser
- bool res = dialog_file_browser_show(
- bad_bt->dialogs, bad_bt->keyboard_layout, predefined_path, &browser_options);
-
- furi_string_free(predefined_path);
- return res;
-}
-
-void bad_bt_scene_config_layout_on_enter(void* context) {
- BadBtApp* bad_bt = context;
-
- if(bad_bt_layout_select(bad_bt)) {
- bad_bt_script_set_keyboard_layout(bad_bt->bad_bt_script, bad_bt->keyboard_layout);
- }
- scene_manager_previous_scene(bad_bt->scene_manager);
-}
-
-bool bad_bt_scene_config_layout_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- return false;
-}
-
-void bad_bt_scene_config_layout_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_config_mac.c b/applications/external/bad_bt/scenes/bad_bt_scene_config_mac.c
deleted file mode 100644
index dcc783f0f..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_config_mac.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "../bad_bt_app.h"
-
-#define TAG "BadBtConfigMac"
-
-void bad_bt_scene_config_mac_byte_input_callback(void* context) {
- BadBtApp* bad_bt = context;
-
- view_dispatcher_send_custom_event(bad_bt->view_dispatcher, BadBtAppCustomEventByteInputDone);
-}
-
-void bad_bt_scene_config_mac_on_enter(void* context) {
- BadBtApp* bad_bt = context;
-
- furi_hal_bt_reverse_mac_addr(bad_bt->config.bt_mac);
-
- // Setup view
- ByteInput* byte_input = bad_bt->byte_input;
- byte_input_set_header_text(byte_input, "Set BT MAC address");
- byte_input_set_result_callback(
- byte_input,
- bad_bt_scene_config_mac_byte_input_callback,
- NULL,
- bad_bt,
- bad_bt->config.bt_mac,
- GAP_MAC_ADDR_SIZE);
- view_dispatcher_switch_to_view(bad_bt->view_dispatcher, BadBtAppViewConfigMac);
-}
-
-bool bad_bt_scene_config_mac_on_event(void* context, SceneManagerEvent event) {
- BadBtApp* bad_bt = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == BadBtAppCustomEventByteInputDone) {
- scene_manager_previous_scene(bad_bt->scene_manager);
- consumed = true;
- }
- }
- return consumed;
-}
-
-void bad_bt_scene_config_mac_on_exit(void* context) {
- BadBtApp* bad_bt = context;
-
- furi_hal_bt_reverse_mac_addr(bad_bt->config.bt_mac);
-
- bt_set_profile_mac_address(bad_bt->bt, bad_bt->config.bt_mac);
-
- // Clear view
- byte_input_set_result_callback(bad_bt->byte_input, NULL, NULL, NULL, NULL, 0);
- byte_input_set_header_text(bad_bt->byte_input, "");
-}
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_config_name.c b/applications/external/bad_bt/scenes/bad_bt_scene_config_name.c
deleted file mode 100644
index 61d198b8c..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_config_name.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "../bad_bt_app.h"
-
-static void bad_bt_scene_config_name_text_input_callback(void* context) {
- BadBtApp* bad_bt = context;
-
- view_dispatcher_send_custom_event(bad_bt->view_dispatcher, BadBtAppCustomEventTextEditResult);
-}
-
-void bad_bt_scene_config_name_on_enter(void* context) {
- BadBtApp* bad_bt = context;
- TextInput* text_input = bad_bt->text_input;
-
- text_input_set_header_text(text_input, "Set BT device name");
-
- text_input_set_result_callback(
- text_input,
- bad_bt_scene_config_name_text_input_callback,
- bad_bt,
- bad_bt->config.bt_name,
- BAD_BT_ADV_NAME_MAX_LEN,
- true);
-
- view_dispatcher_switch_to_view(bad_bt->view_dispatcher, BadBtAppViewConfigName);
-}
-
-bool bad_bt_scene_config_name_on_event(void* context, SceneManagerEvent event) {
- BadBtApp* bad_bt = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- consumed = true;
- if(event.event == BadBtAppCustomEventTextEditResult) {
- bt_set_profile_adv_name(bad_bt->bt, bad_bt->config.bt_name);
- }
- scene_manager_previous_scene(bad_bt->scene_manager);
- }
- return consumed;
-}
-
-void bad_bt_scene_config_name_on_exit(void* context) {
- BadBtApp* bad_bt = context;
- TextInput* text_input = bad_bt->text_input;
-
- text_input_reset(text_input);
-}
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_error.c b/applications/external/bad_bt/scenes/bad_bt_scene_error.c
deleted file mode 100644
index e25703e7d..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_error.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "../bad_bt_app.h"
-
-static void
- bad_bt_scene_error_event_callback(GuiButtonType result, InputType type, void* context) {
- furi_assert(context);
- BadBtApp* app = context;
-
- if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) {
- view_dispatcher_send_custom_event(app->view_dispatcher, BadBtCustomEventErrorBack);
- }
-}
-
-void bad_bt_scene_error_on_enter(void* context) {
- BadBtApp* app = context;
-
- if(app->error == BadBtAppErrorNoFiles) {
- widget_add_icon_element(app->widget, 0, 0, &I_SDQuestion_35x43);
- widget_add_string_multiline_element(
- app->widget,
- 81,
- 4,
- AlignCenter,
- AlignTop,
- FontSecondary,
- "No SD card or\napp data found.\nThis app will not\nwork without\nrequired files.");
- widget_add_button_element(
- app->widget, GuiButtonTypeLeft, "Back", bad_bt_scene_error_event_callback, app);
- } else if(app->error == BadBtAppErrorCloseRpc) {
- widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64);
- widget_add_string_multiline_element(
- app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!");
- widget_add_string_multiline_element(
- app->widget,
- 3,
- 30,
- AlignLeft,
- AlignTop,
- FontSecondary,
- "Disconnect from\nPC or phone to\nuse this function.");
- }
-
- view_dispatcher_switch_to_view(app->view_dispatcher, BadBtAppViewError);
-}
-
-bool bad_bt_scene_error_on_event(void* context, SceneManagerEvent event) {
- BadBtApp* app = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == BadBtCustomEventErrorBack) {
- view_dispatcher_stop(app->view_dispatcher);
- consumed = true;
- }
- }
- return consumed;
-}
-
-void bad_bt_scene_error_on_exit(void* context) {
- BadBtApp* app = context;
- widget_reset(app->widget);
-}
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_file_select.c b/applications/external/bad_bt/scenes/bad_bt_scene_file_select.c
deleted file mode 100644
index b86dc6d71..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_file_select.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "../bad_bt_app.h"
-#include
-#include
-
-static bool bad_bt_file_select(BadBtApp* bad_bt) {
- furi_assert(bad_bt);
-
- DialogsFileBrowserOptions browser_options;
- dialog_file_browser_set_basic_options(
- &browser_options, BAD_BT_APP_SCRIPT_EXTENSION, &I_badbt_10px);
- browser_options.base_path = BAD_BT_APP_BASE_FOLDER;
- browser_options.skip_assets = true;
-
- // Input events and views are managed by file_browser
- bool res = dialog_file_browser_show(
- bad_bt->dialogs, bad_bt->file_path, bad_bt->file_path, &browser_options);
-
- return res;
-}
-
-void bad_bt_scene_file_select_on_enter(void* context) {
- BadBtApp* bad_bt = context;
-
- if(bad_bt->bad_bt_script) {
- bad_bt_script_close(bad_bt->bad_bt_script);
- bad_bt->bad_bt_script = NULL;
- }
-
- if(bad_bt_file_select(bad_bt)) {
- bad_bt->bad_bt_script = bad_bt_script_open(bad_bt->file_path, bad_bt->bt, bad_bt);
- bad_bt_script_set_keyboard_layout(bad_bt->bad_bt_script, bad_bt->keyboard_layout);
-
- scene_manager_next_scene(bad_bt->scene_manager, BadBtSceneWork);
- } else {
- view_dispatcher_stop(bad_bt->view_dispatcher);
- }
-}
-
-bool bad_bt_scene_file_select_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- // BadBtApp* bad_bt = context;
- return false;
-}
-
-void bad_bt_scene_file_select_on_exit(void* context) {
- UNUSED(context);
- // BadBtApp* bad_bt = context;
-}
diff --git a/applications/external/bad_bt/scenes/bad_bt_scene_work.c b/applications/external/bad_bt/scenes/bad_bt_scene_work.c
deleted file mode 100644
index 684bb8b74..000000000
--- a/applications/external/bad_bt/scenes/bad_bt_scene_work.c
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "../helpers/ducky_script.h"
-#include "../bad_bt_app.h"
-#include "../views/bad_bt_view.h"
-#include
-#include "toolbox/path.h"
-
-void bad_bt_scene_work_button_callback(InputKey key, void* context) {
- furi_assert(context);
- BadBtApp* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, key);
-}
-
-bool bad_bt_scene_work_on_event(void* context, SceneManagerEvent event) {
- BadBtApp* app = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == InputKeyLeft) {
- if(bad_bt_is_idle_state(app->bad_bt_view)) {
- scene_manager_next_scene(app->scene_manager, BadBtSceneConfig);
- }
- consumed = true;
- } else if(event.event == InputKeyOk) {
- bad_bt_script_toggle(app->bad_bt_script);
- consumed = true;
- }
- } else if(event.type == SceneManagerEventTypeTick) {
- bad_bt_set_state(app->bad_bt_view, bad_bt_script_get_state(app->bad_bt_script));
- }
- return consumed;
-}
-
-void bad_bt_scene_work_on_enter(void* context) {
- BadBtApp* app = context;
-
- FuriString* file_name;
- file_name = furi_string_alloc();
- path_extract_filename(app->file_path, file_name, true);
- bad_bt_set_file_name(app->bad_bt_view, furi_string_get_cstr(file_name));
- furi_string_free(file_name);
-
- FuriString* layout;
- layout = furi_string_alloc();
- path_extract_filename(app->keyboard_layout, layout, true);
- bad_bt_set_layout(app->bad_bt_view, furi_string_get_cstr(layout));
- furi_string_free(layout);
-
- bad_bt_set_state(app->bad_bt_view, bad_bt_script_get_state(app->bad_bt_script));
-
- bad_bt_set_button_callback(app->bad_bt_view, bad_bt_scene_work_button_callback, app);
- view_dispatcher_switch_to_view(app->view_dispatcher, BadBtAppViewWork);
-}
-
-void bad_bt_scene_work_on_exit(void* context) {
- UNUSED(context);
-}
diff --git a/applications/external/bad_bt/views/bad_bt_view.c b/applications/external/bad_bt/views/bad_bt_view.c
deleted file mode 100644
index 4a9bf589c..000000000
--- a/applications/external/bad_bt/views/bad_bt_view.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include "bad_bt_view.h"
-#include "../helpers/ducky_script.h"
-#include "../bad_bt_app.h"
-#include
-#include
-#include
-
-#define MAX_NAME_LEN 64
-
-typedef struct {
- char file_name[MAX_NAME_LEN];
- char layout[MAX_NAME_LEN];
- BadBtState state;
- uint8_t anim_frame;
-} BadBtModel;
-
-static void bad_bt_draw_callback(Canvas* canvas, void* _model) {
- BadBtModel* model = _model;
-
- FuriString* disp_str;
- disp_str = furi_string_alloc_set("(BT) ");
- furi_string_cat_str(disp_str, model->file_name);
- elements_string_fit_width(canvas, disp_str, 128 - 2);
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str(canvas, 2, 8, furi_string_get_cstr(disp_str));
-
- if(strlen(model->layout) == 0) {
- furi_string_set(disp_str, "(default)");
- } else {
- furi_string_reset(disp_str);
- furi_string_push_back(disp_str, '(');
- for(size_t i = 0; i < strlen(model->layout); i++)
- furi_string_push_back(disp_str, model->layout[i]);
- furi_string_push_back(disp_str, ')');
- }
- if(model->state.pin) {
- furi_string_cat_printf(disp_str, " PIN: %ld", model->state.pin);
- }
- elements_string_fit_width(canvas, disp_str, 128 - 2);
- canvas_draw_str(
- canvas, 2, 8 + canvas_current_font_height(canvas), furi_string_get_cstr(disp_str));
-
- furi_string_reset(disp_str);
-
- if((model->state.state == BadBtStateIdle) || (model->state.state == BadBtStateDone) ||
- (model->state.state == BadBtStateNotConnected)) {
- elements_button_center(canvas, "Run");
- elements_button_left(canvas, "Config");
- } else if((model->state.state == BadBtStateRunning) || (model->state.state == BadBtStateDelay)) {
- elements_button_center(canvas, "Stop");
- } else if(model->state.state == BadBtStateWaitForBtn) {
- elements_button_center(canvas, "Press to continue");
- } else if(model->state.state == BadBtStateWillRun) {
- elements_button_center(canvas, "Cancel");
- }
-
- if(model->state.state == BadBtStateNotConnected) {
- canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect to");
- canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "a device");
- } else if(model->state.state == BadBtStateWillRun) {
- canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run");
- canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "on connect");
- } else if(model->state.state == BadBtStateFileError) {
- canvas_draw_icon(canvas, 4, 26, &I_Error_18x18);
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "File");
- canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "ERROR");
- } else if(model->state.state == BadBtStateScriptError) {
- canvas_draw_icon(canvas, 4, 26, &I_Error_18x18);
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_str_aligned(canvas, 127, 33, AlignRight, AlignBottom, "ERROR:");
- canvas_set_font(canvas, FontSecondary);
- furi_string_printf(disp_str, "line %u", model->state.error_line);
- canvas_draw_str_aligned(
- canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
- furi_string_reset(disp_str);
- furi_string_set_str(disp_str, model->state.error);
- elements_string_fit_width(canvas, disp_str, canvas_width(canvas));
- canvas_draw_str_aligned(
- canvas, 127, 56, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
- furi_string_reset(disp_str);
- } else if(model->state.state == BadBtStateIdle) {
- canvas_draw_icon(canvas, 4, 26, &I_Smile_18x18);
- canvas_set_font(canvas, FontBigNumbers);
- canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "0");
- canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14);
- } else if(model->state.state == BadBtStateRunning) {
- if(model->anim_frame == 0) {
- canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21);
- } else {
- canvas_draw_icon(canvas, 4, 23, &I_EviSmile2_18x21);
- }
- canvas_set_font(canvas, FontBigNumbers);
- furi_string_printf(
- disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
- canvas_draw_str_aligned(
- canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
- furi_string_reset(disp_str);
- canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14);
- } else if(model->state.state == BadBtStateDone) {
- canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21);
- canvas_set_font(canvas, FontBigNumbers);
- canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "100");
- furi_string_reset(disp_str);
- canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14);
- } else if(model->state.state == BadBtStateDelay) {
- if(model->anim_frame == 0) {
- canvas_draw_icon(canvas, 4, 23, &I_EviWaiting1_18x21);
- } else {
- canvas_draw_icon(canvas, 4, 23, &I_EviWaiting2_18x21);
- }
- canvas_set_font(canvas, FontBigNumbers);
- furi_string_printf(
- disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
- canvas_draw_str_aligned(
- canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
- furi_string_reset(disp_str);
- canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14);
- canvas_set_font(canvas, FontSecondary);
- furi_string_printf(disp_str, "delay %lus", model->state.delay_remain);
- canvas_draw_str_aligned(
- canvas, 127, 50, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
- furi_string_reset(disp_str);
- } else {
- canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
- }
-
- furi_string_free(disp_str);
-}
-
-static bool bad_bt_input_callback(InputEvent* event, void* context) {
- furi_assert(context);
- BadBt* bad_bt = context;
- bool consumed = false;
-
- if(event->type == InputTypeShort) {
- if((event->key == InputKeyLeft) || (event->key == InputKeyOk)) {
- consumed = true;
- furi_assert(bad_bt->callback);
- bad_bt->callback(event->key, bad_bt->context);
- }
- }
-
- return consumed;
-}
-
-BadBt* bad_bt_alloc() {
- BadBt* bad_bt = malloc(sizeof(BadBt));
-
- bad_bt->view = view_alloc();
- view_allocate_model(bad_bt->view, ViewModelTypeLocking, sizeof(BadBtModel));
- view_set_context(bad_bt->view, bad_bt);
- view_set_draw_callback(bad_bt->view, bad_bt_draw_callback);
- view_set_input_callback(bad_bt->view, bad_bt_input_callback);
-
- return bad_bt;
-}
-
-void bad_bt_free(BadBt* bad_bt) {
- furi_assert(bad_bt);
- view_free(bad_bt->view);
- free(bad_bt);
-}
-
-View* bad_bt_get_view(BadBt* bad_bt) {
- furi_assert(bad_bt);
- return bad_bt->view;
-}
-
-void bad_bt_set_button_callback(BadBt* bad_bt, BadBtButtonCallback callback, void* context) {
- furi_assert(bad_bt);
- furi_assert(callback);
- with_view_model(
- bad_bt->view,
- BadBtModel * model,
- {
- UNUSED(model);
- bad_bt->callback = callback;
- bad_bt->context = context;
- },
- true);
-}
-
-void bad_bt_set_file_name(BadBt* bad_bt, const char* name) {
- furi_assert(name);
- with_view_model(
- bad_bt->view, BadBtModel * model, { strlcpy(model->file_name, name, MAX_NAME_LEN); }, true);
-}
-
-void bad_bt_set_layout(BadBt* bad_bt, const char* layout) {
- furi_assert(layout);
- with_view_model(
- bad_bt->view, BadBtModel * model, { strlcpy(model->layout, layout, MAX_NAME_LEN); }, true);
-}
-
-void bad_bt_set_state(BadBt* bad_bt, BadBtState* st) {
- furi_assert(st);
- uint32_t pin = 0;
- if(bad_bt->context != NULL) {
- BadBtApp* app = bad_bt->context;
- if(app->bt != NULL) {
- pin = app->bt->pin;
- }
- }
- st->pin = pin;
- with_view_model(
- bad_bt->view,
- BadBtModel * model,
- {
- memcpy(&(model->state), st, sizeof(BadBtState));
- model->anim_frame ^= 1;
- },
- true);
-}
-
-bool bad_bt_is_idle_state(BadBt* bad_bt) {
- bool is_idle = false;
- with_view_model(
- bad_bt->view,
- BadBtModel * model,
- {
- if((model->state.state == BadBtStateIdle) || (model->state.state == BadBtStateDone) ||
- (model->state.state == BadBtStateNotConnected)) {
- is_idle = true;
- }
- },
- false);
- return is_idle;
-}
diff --git a/applications/external/bad_bt/views/bad_bt_view.h b/applications/external/bad_bt/views/bad_bt_view.h
deleted file mode 100644
index 850a71057..000000000
--- a/applications/external/bad_bt/views/bad_bt_view.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include
-
-typedef void (*BadBtButtonCallback)(InputKey key, void* context);
-
-typedef struct {
- View* view;
- BadBtButtonCallback callback;
- void* context;
-} BadBt;
-
-typedef struct BadBtState BadBtState;
-
-BadBt* bad_bt_alloc();
-
-void bad_bt_free(BadBt* bad_bt);
-
-View* bad_bt_get_view(BadBt* bad_bt);
-
-void bad_bt_set_button_callback(BadBt* bad_bt, BadBtButtonCallback callback, void* context);
-
-void bad_bt_set_file_name(BadBt* bad_bt, const char* name);
-
-void bad_bt_set_layout(BadBt* bad_bt, const char* layout);
-
-void bad_bt_set_state(BadBt* bad_bt, BadBtState* st);
-
-bool bad_bt_is_idle_state(BadBt* bad_bt);
diff --git a/applications/external/barcode_gen/LICENSE b/applications/external/barcode_gen/LICENSE
deleted file mode 100644
index 4c02d8221..000000000
--- a/applications/external/barcode_gen/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-
-MIT License
-
-Copyright (c) 2023 Alan Tsui
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/applications/external/barcode_gen/README.md b/applications/external/barcode_gen/README.md
deleted file mode 100644
index ec944cb26..000000000
--- a/applications/external/barcode_gen/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
Barcode Generator
-
-
-A barcode generator for the Flipper Zero that supports **UPC-A**, **EAN-8**, **EAN-13**, **Code-39**, **Codabar**, and **Code-128**[1]
-
-
-Note: Barcode save locations have been moved from `/barcodes` to `/apps_data/barcodes`
-
-## Table of Contents
-- [Table of Contents](#table-of-contents)
-- [Installing](#installing)
-- [Building](#building)
-- [Usage](#usage)
- - [Creating a barcode](#creating-a-barcode)
- - [Editing a barcode](#editing-a-barcode)
- - [Deleting a barcode](#deleting-a-barcode)
- - [Viewing a barcode](#viewing-a-barcode)
-- [Screenshots](#screenshots)
-- [Credits](#credits)
-
-
-## Installing
-1) Download the `.zip` file from the release section
-2) Extract/unzip the `.zip` file onto your computer
-3) Open qFlipper and go to the file manager
-4) Navigate to the `apps` folder
-5) Drag & drop the `.fap` file into the `apps` folder
-6) Navigate back to the root folder of the SD card and create the folder `apps_data`, if not already there
-7) Navigate into `apps_data` and create another folder called `barcode_data`
-8) Navigate into `barcode_data`
-9) Drag & drop the encoding txts (`code39_encodings.txt`, `code128_encodings.txt` & `codabar_encodings.txt`) into the `barcode_data` folder
-
-## Building
-1) Clone the [flipperzero-firmware](https://github.com/flipperdevices/flipperzero-firmware) repository or a firmware of your choice
-2) Clone this repository and put it in the `applications_user` folder
-3) Build this app by using the command `./fbt fap_Barcode_App`
-4) Copy the `.fap` from `build\f7-firmware-D\.extapps\Barcode_App.fap` to `apps\Misc` using the qFlipper app
-5) While still in the qFlipper app, navigate to the root folder of the SD card and create the folder `apps_data`, if not already there
-6) Navigate into `apps_data` and create another folder called `barcode_data`
-7) Navigate into `barcode_data`
-8) Drag & drop the encoding txts (`code39_encodings.txt`, `code128_encodings.txt` & `codabar_encodings.txt`) from the `encoding_tables` folder in this repository into the `barcode_data` folder
-
-## Usage
-
-### Creating a barcode
-1) To create a barcode click on `Create Barcode`
-2) Next select your type using the left and right arrows
-3) Enter your filename and then your barcode data
-4) Click save
-
-**Note**: For Codabar barcodes, you must manually add the start and stop codes to the barcode data
-Start/Stop codes can be A, B, C, or D
-For example, if you wanted to represent `1234` as a barcode you will need to enter something like `A1234A`. (You can replace the letters A with either A, B, C, or D)
-
-![Codabar Data Example](screenshots/Codabar%20Data%20Example.png "Codabar Data Example")
-
-### Editing a barcode
-1) To edit a barcode click on `Edit Barcode`
-2) Next select the barcode file you want to edit
-3) Edit the type, name, or data
-4) Click save
-
-### Deleting a barcode
-1) To delete a barcode click on `Edit Barcode`
-2) Next select the barcode file you want to delete
-3) Scroll all the way to the bottom
-4) Click delete
-
-### Viewing a barcode
-1) To view a barcode click on `Load Barcode`
-2) Next select the barcode file you want to view
-
-## Screenshots
-![Barcode Create Screen](screenshots/Creating%20Barcode.png "Barcode Create Screen")
-
-![Flipper Code-128 Barcode](screenshots/Flipper%20Barcode.png "Flipper Code-128 Barcode")
-
-![Flipper Box EAN-13 Barcode](screenshots/Flipper%20Box%20Barcode.png "Flipper Box EAN-13 Barcode")
-
-## Credits
-
-- [Kingal1337](https://github.com/Kingal1337) - Developer
-- [Z0wl](https://github.com/Z0wl) - Added Code128-C Support
-- [@teeebor](https://github.com/teeebor) - Menu Code Snippet
-
-
-[1] - supports Set B (only the characters from 0-94). Also supports Set C
diff --git a/applications/external/barcode_gen/application.fam b/applications/external/barcode_gen/application.fam
deleted file mode 100644
index 0564b785a..000000000
--- a/applications/external/barcode_gen/application.fam
+++ /dev/null
@@ -1,16 +0,0 @@
-App(
- appid="barcode_app",
- name="Barcode App",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="barcode_main",
- requires=["gui", "storage"],
- stack_size=2 * 1024,
- fap_category="Tools",
- fap_icon="images/barcode_10.png",
- fap_icon_assets="images",
- fap_file_assets="barcode_encoding_files",
- fap_author="@Kingal1337",
- fap_weburl="https://github.com/Kingal1337/flipper-barcode-generator",
- fap_version="1.1",
- fap_description="App allows you to display various barcodes on flipper screen",
-)
diff --git a/applications/external/barcode_gen/barcode_app.c b/applications/external/barcode_gen/barcode_app.c
deleted file mode 100644
index 99e5769d2..000000000
--- a/applications/external/barcode_gen/barcode_app.c
+++ /dev/null
@@ -1,348 +0,0 @@
-#include "barcode_app.h"
-
-#include "barcode_app_icons.h"
-
-/**
- * Opens a file browser dialog and returns the filepath of the selected file
- *
- * @param folder the folder to view when the browser opens
- * @param file_path a string pointer for the file_path when a file is selected,
- * file_path will be the folder path is nothing is selected
- * @returns true if a file is selected
-*/
-static bool select_file(const char* folder, FuriString* file_path) {
- DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
- DialogsFileBrowserOptions browser_options;
- dialog_file_browser_set_basic_options(&browser_options, "", &I_barcode_10);
- browser_options.base_path = DEFAULT_USER_BARCODES;
- furi_string_set(file_path, folder);
-
- bool res = dialog_file_browser_show(dialogs, file_path, file_path, &browser_options);
-
- furi_record_close(RECORD_DIALOGS);
-
- return res;
-}
-
-/**
- * Reads the data from a file and stores them in the FuriStrings raw_type and raw_data
-*/
-ErrorCode read_raw_data(FuriString* file_path, FuriString* raw_type, FuriString* raw_data) {
- //Open Storage
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* ff = flipper_format_file_alloc(storage);
-
- ErrorCode reason = OKCode;
-
- if(!flipper_format_file_open_existing(ff, furi_string_get_cstr(file_path))) {
- FURI_LOG_E(TAG, "Could not open file %s", furi_string_get_cstr(file_path));
- reason = FileOpening;
- } else {
- if(!flipper_format_read_string(ff, "Type", raw_type)) {
- FURI_LOG_E(TAG, "Could not read \"Type\" string");
- reason = InvalidFileData;
- }
- if(!flipper_format_read_string(ff, "Data", raw_data)) {
- FURI_LOG_E(TAG, "Could not read \"Data\" string");
- reason = InvalidFileData;
- }
- }
-
- //Close Storage
- flipper_format_free(ff);
- furi_record_close(RECORD_STORAGE);
-
- return reason;
-}
-
-/**
- * Gets the file name from a file path
- * @param file_path the file path
- * @param file_name the FuriString to store the file name
- * @param remove_extension true if the extension should be removed, otherwise false
-*/
-bool get_file_name_from_path(FuriString* file_path, FuriString* file_name, bool remove_extension) {
- if(file_path == NULL || file_name == NULL) {
- return false;
- }
- uint32_t slash_index = furi_string_search_rchar(file_path, '/', 0);
- if(slash_index == FURI_STRING_FAILURE || slash_index >= (furi_string_size(file_path) - 1)) {
- return false;
- }
-
- furi_string_set(file_name, file_path);
- furi_string_right(file_name, slash_index + 1);
- if(remove_extension) {
- uint32_t ext_index = furi_string_search_rchar(file_name, '.', 0);
- if(ext_index != FURI_STRING_FAILURE && ext_index < (furi_string_size(file_path))) {
- furi_string_left(file_name, ext_index);
- }
- }
-
- return true;
-}
-
-/**
- * Creates the barcode folder
-*/
-void init_folder() {
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FURI_LOG_I(TAG, "Creating barcodes folder");
- if(storage_simply_mkdir(storage, DEFAULT_USER_BARCODES)) {
- FURI_LOG_I(TAG, "Barcodes folder successfully created!");
- } else {
- FURI_LOG_I(TAG, "Barcodes folder already exists.");
- }
- furi_record_close(RECORD_STORAGE);
-}
-
-void select_barcode_item(BarcodeApp* app) {
- FuriString* file_path = furi_string_alloc();
- FuriString* raw_type = furi_string_alloc();
- FuriString* raw_data = furi_string_alloc();
-
- //this determines if the data was read correctly or if the
- bool loaded_success = true;
- ErrorCode reason = OKCode;
-
- bool file_selected = select_file(DEFAULT_USER_BARCODES, file_path);
- if(file_selected) {
- FURI_LOG_I(TAG, "The file selected is %s", furi_string_get_cstr(file_path));
- Barcode* barcode = app->barcode_view;
-
- reason = read_raw_data(file_path, raw_type, raw_data);
- if(reason != OKCode) {
- loaded_success = false;
- FURI_LOG_E(TAG, "Could not read data correctly");
- }
-
- //Free the data from the previous barcode
- barcode_free_model(barcode);
-
- with_view_model(
- barcode->view,
- BarcodeModel * model,
- {
- model->file_path = furi_string_alloc_set(file_path);
-
- model->data = malloc(sizeof(BarcodeData));
- model->data->valid = loaded_success;
-
- if(loaded_success) {
- model->data->raw_data = furi_string_alloc_set(raw_data);
- model->data->correct_data = furi_string_alloc();
-
- model->data->type_obj = get_type(raw_type);
-
- barcode_loader(model->data);
- } else {
- model->data->reason = reason;
- }
- },
- true);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, BarcodeView);
- }
-
- furi_string_free(raw_type);
- furi_string_free(raw_data);
- furi_string_free(file_path);
-}
-
-void edit_barcode_item(BarcodeApp* app) {
- FuriString* file_path = furi_string_alloc();
- FuriString* file_name = furi_string_alloc();
- FuriString* raw_type = furi_string_alloc();
- FuriString* raw_data = furi_string_alloc();
-
- //this determines if the data was read correctly or if the
- ErrorCode reason = OKCode;
-
- bool file_selected = select_file(DEFAULT_USER_BARCODES, file_path);
- if(file_selected) {
- FURI_LOG_I(TAG, "The file selected is %s", furi_string_get_cstr(file_path));
- CreateView* create_view_object = app->create_view;
-
- reason = read_raw_data(file_path, raw_type, raw_data);
- if(reason != OKCode) {
- FURI_LOG_E(TAG, "Could not read data correctly");
- with_view_model(
- app->message_view->view,
- MessageViewModel * model,
- { model->message = get_error_code_message(reason); },
- true);
-
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, MessageErrorView);
-
- } else {
- BarcodeTypeObj* type_obj = get_type(raw_type);
- if(type_obj->type == UNKNOWN) {
- type_obj = barcode_type_objs[0];
- }
- get_file_name_from_path(file_path, file_name, true);
-
- create_view_free_model(create_view_object);
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- model->selected_menu_item = 0;
- model->barcode_type = type_obj;
- model->file_path = furi_string_alloc_set(file_path);
- model->file_name = furi_string_alloc_set(file_name);
- model->barcode_data = furi_string_alloc_set(raw_data);
- model->mode = EditMode;
- },
- true);
- view_dispatcher_switch_to_view(app->view_dispatcher, CreateBarcodeView);
- }
- }
-
- furi_string_free(raw_type);
- furi_string_free(raw_data);
- furi_string_free(file_name);
- furi_string_free(file_path);
-}
-
-void create_barcode_item(BarcodeApp* app) {
- CreateView* create_view_object = app->create_view;
-
- create_view_free_model(create_view_object);
-
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- model->selected_menu_item = 0;
- model->barcode_type = barcode_type_objs[0];
- model->file_path = furi_string_alloc();
- model->file_name = furi_string_alloc();
- model->barcode_data = furi_string_alloc();
- model->mode = NewMode;
- },
- true);
- view_dispatcher_switch_to_view(app->view_dispatcher, CreateBarcodeView);
-}
-
-void submenu_callback(void* context, uint32_t index) {
- furi_assert(context);
-
- BarcodeApp* app = context;
-
- if(index == SelectBarcodeItem) {
- select_barcode_item(app);
- } else if(index == EditBarcodeItem) {
- edit_barcode_item(app);
- } else if(index == CreateBarcodeItem) {
- create_barcode_item(app);
- }
-}
-
-uint32_t create_view_callback(void* context) {
- UNUSED(context);
- return CreateBarcodeView;
-}
-
-uint32_t main_menu_callback(void* context) {
- UNUSED(context);
- return MainMenuView;
-}
-
-uint32_t exit_callback(void* context) {
- UNUSED(context);
- return VIEW_NONE;
-}
-
-void free_app(BarcodeApp* app) {
- FURI_LOG_I(TAG, "Freeing Data");
-
- init_folder();
- free_types();
-
- view_dispatcher_remove_view(app->view_dispatcher, TextInputView);
- text_input_free(app->text_input);
-
- view_dispatcher_remove_view(app->view_dispatcher, MessageErrorView);
- message_view_free(app->message_view);
-
- view_dispatcher_remove_view(app->view_dispatcher, MainMenuView);
- submenu_free(app->main_menu);
-
- view_dispatcher_remove_view(app->view_dispatcher, CreateBarcodeView);
- create_view_free(app->create_view);
-
- view_dispatcher_remove_view(app->view_dispatcher, BarcodeView);
- barcode_free(app->barcode_view);
-
- //free the dispatcher
- view_dispatcher_free(app->view_dispatcher);
-
- furi_message_queue_free(app->event_queue);
-
- furi_record_close(RECORD_GUI);
- app->gui = NULL;
-
- free(app);
-}
-
-int32_t barcode_main(void* p) {
- UNUSED(p);
- BarcodeApp* app = malloc(sizeof(BarcodeApp));
- init_types();
- app->event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
-
- // Register view port in GUI
- app->gui = furi_record_open(RECORD_GUI);
-
- app->view_dispatcher = view_dispatcher_alloc();
- view_dispatcher_enable_queue(app->view_dispatcher);
- view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
-
- app->main_menu = submenu_alloc();
- submenu_add_item(app->main_menu, "Load Barcode", SelectBarcodeItem, submenu_callback, app);
- view_set_previous_callback(submenu_get_view(app->main_menu), exit_callback);
- view_dispatcher_add_view(app->view_dispatcher, MainMenuView, submenu_get_view(app->main_menu));
-
- submenu_add_item(app->main_menu, "Edit Barcode", EditBarcodeItem, submenu_callback, app);
-
- /*****************************
- * Creating Text Input View
- ******************************/
- app->text_input = text_input_alloc();
- view_set_previous_callback(text_input_get_view(app->text_input), create_view_callback);
- view_dispatcher_add_view(
- app->view_dispatcher, TextInputView, text_input_get_view(app->text_input));
-
- /*****************************
- * Creating Message View
- ******************************/
- app->message_view = message_view_allocate(app);
- view_dispatcher_add_view(
- app->view_dispatcher, MessageErrorView, message_get_view(app->message_view));
-
- /*****************************
- * Creating Create View
- ******************************/
- app->create_view = create_view_allocate(app);
- submenu_add_item(app->main_menu, "Create Barcode", CreateBarcodeItem, submenu_callback, app);
- view_set_previous_callback(create_get_view(app->create_view), main_menu_callback);
- view_dispatcher_add_view(
- app->view_dispatcher, CreateBarcodeView, create_get_view(app->create_view));
-
- /*****************************
- * Creating Barcode View
- ******************************/
- app->barcode_view = barcode_view_allocate(app);
- view_set_previous_callback(barcode_get_view(app->barcode_view), main_menu_callback);
- view_dispatcher_add_view(
- app->view_dispatcher, BarcodeView, barcode_get_view(app->barcode_view));
-
- //switch view to submenu and run dispatcher
- view_dispatcher_switch_to_view(app->view_dispatcher, MainMenuView);
- view_dispatcher_run(app->view_dispatcher);
-
- free_app(app);
-
- return 0;
-}
diff --git a/applications/external/barcode_gen/barcode_app.h b/applications/external/barcode_gen/barcode_app.h
deleted file mode 100644
index bddc82235..000000000
--- a/applications/external/barcode_gen/barcode_app.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#pragma once
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "barcode_utils.h"
-
-#define TAG "BARCODE"
-#define VERSION "1.1"
-#define FILE_VERSION "1"
-
-#define TEXT_BUFFER_SIZE 128
-
-#define BARCODE_HEIGHT 50
-#define BARCODE_Y_START 3
-
-//the folder where the codabar encoding table is located
-#define CODABAR_DICT_FILE_PATH APP_ASSETS_PATH("codabar_encodings.txt")
-
-//the folder where the code 39 encoding table is located
-#define CODE39_DICT_FILE_PATH APP_ASSETS_PATH("code39_encodings.txt")
-
-//the folder where the code 128 encoding table is located
-#define CODE128_DICT_FILE_PATH APP_ASSETS_PATH("code128_encodings.txt")
-
-//the folder where the code 128 C encoding table is located
-#define CODE128C_DICT_FILE_PATH APP_ASSETS_PATH("code128c_encodings.txt")
-
-//the folder where the user stores their barcodes
-#define DEFAULT_USER_BARCODES EXT_PATH("apps_data/barcodes")
-
-//The extension barcode files use
-#define BARCODE_EXTENSION ".txt"
-#define BARCODE_EXTENSION_LENGTH 4
-
-#include "views/barcode_view.h"
-#include "views/create_view.h"
-#include "views/message_view.h"
-#include "barcode_validator.h"
-
-typedef struct BarcodeApp BarcodeApp;
-
-struct BarcodeApp {
- Submenu* main_menu;
- ViewDispatcher* view_dispatcher;
- Gui* gui;
-
- FuriMessageQueue* event_queue;
-
- CreateView* create_view;
- Barcode* barcode_view;
-
- MessageView* message_view;
- TextInput* text_input;
-};
-
-enum SubmenuItems {
- SelectBarcodeItem,
- EditBarcodeItem,
-
- CreateBarcodeItem
-};
-
-enum Views {
- TextInputView,
- MessageErrorView,
- MainMenuView,
- CreateBarcodeView,
-
- BarcodeView
-};
-
-void submenu_callback(void* context, uint32_t index);
-
-uint32_t main_menu_callback(void* context);
-
-uint32_t exit_callback(void* context);
-
-int32_t barcode_main(void* p);
diff --git a/applications/external/barcode_gen/barcode_encoding_files/codabar_encodings.txt b/applications/external/barcode_gen/barcode_encoding_files/codabar_encodings.txt
deleted file mode 100644
index 5f0684cbd..000000000
--- a/applications/external/barcode_gen/barcode_encoding_files/codabar_encodings.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# alternates between bars and spaces, always begins with bar
-# 0 for narrow, 1 for wide
-0: 0000011
-1: 0000110
-2: 0001001
-3: 1100000
-4: 0010010
-5: 1000010
-6: 0100001
-7: 0100100
-8: 0110000
-9: 1001000
--: 0001100
-$: 0011000
-:: 1000101
-/: 1010001
-.: 1010100
-+: 0010101
-A: 0011010
-B: 0101001
-C: 0001011
-D: 0001110
\ No newline at end of file
diff --git a/applications/external/barcode_gen/barcode_encoding_files/code128_encodings.txt b/applications/external/barcode_gen/barcode_encoding_files/code128_encodings.txt
deleted file mode 100644
index 394a34520..000000000
--- a/applications/external/barcode_gen/barcode_encoding_files/code128_encodings.txt
+++ /dev/null
@@ -1,202 +0,0 @@
- : 00
-!: 01
-": 02
-#: 03
-$: 04
-%: 05
-&: 06
-': 07
-(: 08
-): 09
-*: 10
-+: 11
-,: 12
--: 13
-.: 14
-/: 15
-0: 16
-1: 17
-2: 18
-3: 19
-4: 20
-5: 21
-6: 22
-7: 23
-8: 24
-9: 25
-:: 26
-;: 27
-<: 28
-=: 29
->: 30
-?: 31
-@: 32
-A: 33
-B: 34
-C: 35
-D: 36
-E: 37
-F: 38
-G: 39
-H: 40
-I: 41
-J: 42
-K: 43
-L: 44
-M: 45
-N: 46
-O: 47
-P: 48
-Q: 49
-R: 50
-S: 51
-T: 52
-U: 53
-V: 54
-W: 55
-X: 56
-Y: 57
-Z: 58
-[: 59
-\: 60
-]: 61
-^: 62
-_: 63
-`: 64
-a: 65
-b: 66
-c: 67
-d: 68
-e: 69
-f: 70
-g: 71
-h: 72
-i: 73
-j: 74
-k: 75
-l: 76
-m: 77
-n: 78
-o: 79
-p: 80
-q: 81
-r: 82
-s: 83
-t: 84
-u: 85
-v: 86
-w: 87
-x: 88
-y: 89
-z: 90
-{: 91
-|: 92
-}: 93
-~: 94
-
-00: 11011001100
-01: 11001101100
-02: 11001100110
-03: 10010011000
-04: 10010001100
-05: 10001001100
-06: 10011001000
-07: 10011000100
-08: 10001100100
-09: 11001001000
-10: 11001000100
-11: 11000100100
-12: 10110011100
-13: 10011011100
-14: 10011001110
-15: 10111001100
-16: 10011101100
-17: 10011100110
-18: 11001110010
-19: 11001011100
-20: 11001001110
-21: 11011100100
-22: 11001110100
-23: 11101101110
-24: 11101001100
-25: 11100101100
-26: 11100100110
-27: 11101100100
-28: 11100110100
-29: 11100110010
-30: 11011011000
-31: 11011000110
-32: 11000110110
-33: 10100011000
-34: 10001011000
-35: 10001000110
-36: 10110001000
-37: 10001101000
-38: 10001100010
-39: 11010001000
-40: 11000101000
-41: 11000100010
-42: 10110111000
-43: 10110001110
-44: 10001101110
-45: 10111011000
-46: 10111000110
-47: 10001110110
-48: 11101110110
-49: 11010001110
-50: 11000101110
-51: 11011101000
-52: 11011100010
-53: 11011101110
-54: 11101011000
-55: 11101000110
-56: 11100010110
-57: 11101101000
-58: 11101100010
-59: 11100011010
-60: 11101111010
-61: 11001000010
-62: 11110001010
-63: 10100110000
-64: 10100001100
-65: 10010110000
-66: 10010000110
-67: 10000101100
-68: 10000100110
-69: 10110010000
-70: 10110000100
-71: 10011010000
-72: 10011000010
-73: 10000110100
-74: 10000110010
-75: 11000010010
-76: 11001010000
-77: 11110111010
-78: 11000010100
-79: 10001111010
-80: 10100111100
-81: 10010111100
-82: 10010011110
-83: 10111100100
-84: 10011110100
-85: 10011110010
-86: 11110100100
-87: 11110010100
-88: 11110010010
-89: 11011011110
-90: 11011110110
-91: 11110110110
-92: 10101111000
-93: 10100011110
-94: 10001011110
-95: 10111101000
-96: 10111100010
-97: 11110101000
-98: 11110100010
-99: 10111011110
-100: 10111101110
-101: 11101011110
-102: 11110101110
-103: 11010000100
-104: 11010010000
-105: 11010011100
\ No newline at end of file
diff --git a/applications/external/barcode_gen/barcode_encoding_files/code128c_encodings.txt b/applications/external/barcode_gen/barcode_encoding_files/code128c_encodings.txt
deleted file mode 100644
index 75cc71135..000000000
--- a/applications/external/barcode_gen/barcode_encoding_files/code128c_encodings.txt
+++ /dev/null
@@ -1,106 +0,0 @@
-00: 11011001100
-01: 11001101100
-02: 11001100110
-03: 10010011000
-04: 10010001100
-05: 10001001100
-06: 10011001000
-07: 10011000100
-08: 10001100100
-09: 11001001000
-10: 11001000100
-11: 11000100100
-12: 10110011100
-13: 10011011100
-14: 10011001110
-15: 10111001100
-16: 10011101100
-17: 10011100110
-18: 11001110010
-19: 11001011100
-20: 11001001110
-21: 11011100100
-22: 11001110100
-23: 11101101110
-24: 11101001100
-25: 11100101100
-26: 11100100110
-27: 11101100100
-28: 11100110100
-29: 11100110010
-30: 11011011000
-31: 11011000110
-32: 11000110110
-33: 10100011000
-34: 10001011000
-35: 10001000110
-36: 10110001000
-37: 10001101000
-38: 10001100010
-39: 11010001000
-40: 11000101000
-41: 11000100010
-42: 10110111000
-43: 10110001110
-44: 10001101110
-45: 10111011000
-46: 10111000110
-47: 10001110110
-48: 11101110110
-49: 11010001110
-50: 11000101110
-51: 11011101000
-52: 11011100010
-53: 11011101110
-54: 11101011000
-55: 11101000110
-56: 11100010110
-57: 11101101000
-58: 11101100010
-59: 11100011010
-60: 11101111010
-61: 11001000010
-62: 11110001010
-63: 10100110000
-64: 10100001100
-65: 10010110000
-66: 10010000110
-67: 10000101100
-68: 10000100110
-69: 10110010000
-70: 10110000100
-71: 10011010000
-72: 10011000010
-73: 10000110100
-74: 10000110010
-75: 11000010010
-76: 11001010000
-77: 11110111010
-78: 11000010100
-79: 10001111010
-80: 10100111100
-81: 10010111100
-82: 10010011110
-83: 10111100100
-84: 10011110100
-85: 10011110010
-86: 11110100100
-87: 11110010100
-88: 11110010010
-89: 11011011110
-90: 11011110110
-91: 11110110110
-92: 10101111000
-93: 10100011110
-94: 10001011110
-95: 10111101000
-96: 10111100010
-97: 11110101000
-98: 11110100010
-99: 10111011110
-100: 10111101110
-101: 11101011110
-102: 11110101110
-103: 11010000100
-104: 11010010000
-105: 11010011100
diff --git a/applications/external/barcode_gen/barcode_encoding_files/code39_encodings.txt b/applications/external/barcode_gen/barcode_encoding_files/code39_encodings.txt
deleted file mode 100644
index a41ad16e9..000000000
--- a/applications/external/barcode_gen/barcode_encoding_files/code39_encodings.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-0: 000110100
-1: 100100001
-2: 001100001
-3: 101100000
-4: 000110001
-5: 100110000
-6: 001110000
-7: 000100101
-8: 100100100
-9: 001100100
-A: 100001001
-B: 001001001
-C: 101001000
-D: 000011001
-E: 100011000
-F: 001011000
-G: 000001101
-H: 100001100
-I: 001001100
-J: 000011100
-K: 100000011
-L: 001000011
-M: 101000010
-N: 000010011
-O: 100010010
-P: 001010010
-Q: 000000111
-R: 100000110
-S: 001000110
-T: 000010110
-U: 110000001
-V: 011000001
-W: 111000000
-X: 010010001
-Y: 110010000
-Z: 011010000
--: 010000101
-.: 110000100
- : 011000100
-*: 010010100
-$: 010101000
-/: 010100010
-+: 010001010
-%: 000101010
\ No newline at end of file
diff --git a/applications/external/barcode_gen/barcode_utils.c b/applications/external/barcode_gen/barcode_utils.c
deleted file mode 100644
index 31274c1fe..000000000
--- a/applications/external/barcode_gen/barcode_utils.c
+++ /dev/null
@@ -1,147 +0,0 @@
-#include "barcode_utils.h"
-
-BarcodeTypeObj* barcode_type_objs[NUMBER_OF_BARCODE_TYPES] = {NULL};
-
-void init_types() {
- BarcodeTypeObj* upc_a = malloc(sizeof(BarcodeTypeObj));
- upc_a->name = "UPC-A";
- upc_a->type = UPCA;
- upc_a->min_digits = 11;
- upc_a->max_digits = 12;
- upc_a->start_pos = 16;
- barcode_type_objs[UPCA] = upc_a;
-
- BarcodeTypeObj* ean_8 = malloc(sizeof(BarcodeTypeObj));
- ean_8->name = "EAN-8";
- ean_8->type = EAN8;
- ean_8->min_digits = 7;
- ean_8->max_digits = 8;
- ean_8->start_pos = 32;
- barcode_type_objs[EAN8] = ean_8;
-
- BarcodeTypeObj* ean_13 = malloc(sizeof(BarcodeTypeObj));
- ean_13->name = "EAN-13";
- ean_13->type = EAN13;
- ean_13->min_digits = 12;
- ean_13->max_digits = 13;
- ean_13->start_pos = 16;
- barcode_type_objs[EAN13] = ean_13;
-
- BarcodeTypeObj* code_39 = malloc(sizeof(BarcodeTypeObj));
- code_39->name = "CODE-39";
- code_39->type = CODE39;
- code_39->min_digits = 1;
- code_39->max_digits = -1;
- code_39->start_pos = 0;
- barcode_type_objs[CODE39] = code_39;
-
- BarcodeTypeObj* code_128 = malloc(sizeof(BarcodeTypeObj));
- code_128->name = "CODE-128";
- code_128->type = CODE128;
- code_128->min_digits = 1;
- code_128->max_digits = -1;
- code_128->start_pos = 0;
- barcode_type_objs[CODE128] = code_128;
-
- BarcodeTypeObj* code_128c = malloc(sizeof(BarcodeTypeObj));
- code_128c->name = "CODE-128C";
- code_128c->type = CODE128C;
- code_128c->min_digits = 2;
- code_128c->max_digits = -1;
- code_128c->start_pos = 0;
- barcode_type_objs[CODE128C] = code_128c;
-
- BarcodeTypeObj* codabar = malloc(sizeof(BarcodeTypeObj));
- codabar->name = "Codabar";
- codabar->type = CODABAR;
- codabar->min_digits = 1;
- codabar->max_digits = -1;
- codabar->start_pos = 0;
- barcode_type_objs[CODABAR] = codabar;
-
- BarcodeTypeObj* unknown = malloc(sizeof(BarcodeTypeObj));
- unknown->name = "Unknown";
- unknown->type = UNKNOWN;
- unknown->min_digits = 0;
- unknown->max_digits = 0;
- unknown->start_pos = 0;
- barcode_type_objs[UNKNOWN] = unknown;
-}
-
-void free_types() {
- for(int i = 0; i < NUMBER_OF_BARCODE_TYPES; i++) {
- free(barcode_type_objs[i]);
- }
-}
-
-BarcodeTypeObj* get_type(FuriString* type_string) {
- if(furi_string_cmp_str(type_string, "UPC-A") == 0) {
- return barcode_type_objs[UPCA];
- }
- if(furi_string_cmp_str(type_string, "EAN-8") == 0) {
- return barcode_type_objs[EAN8];
- }
- if(furi_string_cmp_str(type_string, "EAN-13") == 0) {
- return barcode_type_objs[EAN13];
- }
- if(furi_string_cmp_str(type_string, "CODE-39") == 0) {
- return barcode_type_objs[CODE39];
- }
- if(furi_string_cmp_str(type_string, "CODE-128") == 0) {
- return barcode_type_objs[CODE128];
- }
- if(furi_string_cmp_str(type_string, "CODE-128C") == 0) {
- return barcode_type_objs[CODE128C];
- }
- if(furi_string_cmp_str(type_string, "Codabar") == 0) {
- return barcode_type_objs[CODABAR];
- }
-
- return barcode_type_objs[UNKNOWN];
-}
-
-const char* get_error_code_name(ErrorCode error_code) {
- switch(error_code) {
- case WrongNumberOfDigits:
- return "Wrong Number Of Digits";
- case InvalidCharacters:
- return "Invalid Characters";
- case UnsupportedType:
- return "Unsupported Type";
- case FileOpening:
- return "File Opening Error";
- case InvalidFileData:
- return "Invalid File Data";
- case MissingEncodingTable:
- return "Missing Encoding Table";
- case EncodingTableError:
- return "Encoding Table Error";
- case OKCode:
- return "OK";
- default:
- return "Unknown Code";
- };
-}
-
-const char* get_error_code_message(ErrorCode error_code) {
- switch(error_code) {
- case WrongNumberOfDigits:
- return "Wrong # of characters";
- case InvalidCharacters:
- return "Invalid characters";
- case UnsupportedType:
- return "Unsupported barcode type";
- case FileOpening:
- return "Could not open file";
- case InvalidFileData:
- return "Invalid file data";
- case MissingEncodingTable:
- return "Missing encoding table";
- case EncodingTableError:
- return "Encoding table error";
- case OKCode:
- return "OK";
- default:
- return "Could not read barcode data";
- };
-}
diff --git a/applications/external/barcode_gen/barcode_utils.h b/applications/external/barcode_gen/barcode_utils.h
deleted file mode 100644
index 0a27785cf..000000000
--- a/applications/external/barcode_gen/barcode_utils.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#pragma once
-#include
-#include
-
-#define NUMBER_OF_BARCODE_TYPES 8
-
-typedef enum {
- WrongNumberOfDigits, //There is too many or too few digits in the barcode
- InvalidCharacters, //The barcode contains invalid characters
- UnsupportedType, //the barcode type is not supported
- FileOpening, //A problem occurred when opening the barcode data file
- InvalidFileData, //One of the key in the file doesn't exist or there is a typo
- MissingEncodingTable, //The encoding table txt for the barcode type is missing
- EncodingTableError, //Something is wrong with the encoding table, probably missing data or typo
- OKCode
-} ErrorCode;
-
-typedef enum {
- UPCA,
- EAN8,
- EAN13,
- CODE39,
- CODE128,
- CODE128C,
- CODABAR,
-
- UNKNOWN
-} BarcodeType;
-
-typedef struct {
- char* name; //The name of the barcode type
- BarcodeType type; //The barcode type enum
- int min_digits; //the minimum number of digits
- int max_digits; //the maximum number of digits
- int start_pos; //where to start drawing the barcode, set to -1 to dynamically draw barcode
-} BarcodeTypeObj;
-
-typedef struct {
- BarcodeTypeObj* type_obj;
- int check_digit; //A place to store the check digit
- FuriString* raw_data; //the data directly from the file
- FuriString* correct_data; //the corrected/processed data
- bool valid; //true if the raw data is correctly formatted, such as correct num of digits, valid characters, etc.
- ErrorCode reason; //the reason why this barcode is invalid
-} BarcodeData;
-
-//All available barcode types
-extern BarcodeTypeObj* barcode_type_objs[NUMBER_OF_BARCODE_TYPES];
-
-void init_types();
-void free_types();
-BarcodeTypeObj* get_type(FuriString* type_string);
-const char* get_error_code_name(ErrorCode error_code);
-const char* get_error_code_message(ErrorCode error_code);
diff --git a/applications/external/barcode_gen/barcode_validator.c b/applications/external/barcode_gen/barcode_validator.c
deleted file mode 100644
index cb493f3e9..000000000
--- a/applications/external/barcode_gen/barcode_validator.c
+++ /dev/null
@@ -1,532 +0,0 @@
-#include "barcode_validator.h"
-
-void barcode_loader(BarcodeData* barcode_data) {
- switch(barcode_data->type_obj->type) {
- case UPCA:
- case EAN8:
- case EAN13:
- ean_upc_loader(barcode_data);
- break;
- case CODE39:
- code_39_loader(barcode_data);
- break;
- case CODE128:
- code_128_loader(barcode_data);
- break;
- case CODE128C:
- code_128c_loader(barcode_data);
- break;
- case CODABAR:
- codabar_loader(barcode_data);
- break;
- case UNKNOWN:
- barcode_data->reason = UnsupportedType;
- barcode_data->valid = false;
- default:
- break;
- }
-}
-
-/**
- * Calculates the check digit of a barcode if they have one
- * @param barcode_data the barcode data
- * @returns a check digit or -1 for either an invalid
-*/
-int calculate_check_digit(BarcodeData* barcode_data) {
- int check_digit = -1;
- switch(barcode_data->type_obj->type) {
- case UPCA:
- case EAN8:
- case EAN13:
- check_digit = calculate_ean_upc_check_digit(barcode_data);
- break;
- case CODE39:
- case CODE128:
- case CODE128C:
- case CODABAR:
- case UNKNOWN:
- default:
- break;
- }
-
- return check_digit;
-}
-
-/**
- * Calculates the check digit of barcode types UPC-A, EAN-8, & EAN-13
-*/
-int calculate_ean_upc_check_digit(BarcodeData* barcode_data) {
- int check_digit = 0;
- int odd = 0;
- int even = 0;
-
- int length = barcode_data->type_obj->min_digits;
-
- //Get sum of odd digits
- for(int i = 0; i < length; i += 2) {
- odd += furi_string_get_char(barcode_data->raw_data, i) - '0';
- }
-
- //Get sum of even digits
- for(int i = 1; i < length; i += 2) {
- even += furi_string_get_char(barcode_data->raw_data, i) - '0';
- }
-
- if(barcode_data->type_obj->type == EAN13) {
- check_digit = even * 3 + odd;
- } else {
- check_digit = odd * 3 + even;
- }
-
- check_digit = check_digit % 10;
-
- return (10 - check_digit) % 10;
-}
-
-/**
- * Loads and validates Barcode Types EAN-8, EAN-13, and UPC-A
- * barcode_data and its strings should already be allocated;
-*/
-void ean_upc_loader(BarcodeData* barcode_data) {
- int barcode_length = furi_string_size(barcode_data->raw_data);
-
- int min_digits = barcode_data->type_obj->min_digits;
- int max_digit = barcode_data->type_obj->max_digits;
-
- //check the length of the barcode
- if(barcode_length < min_digits || barcode_length > max_digit) {
- barcode_data->reason = WrongNumberOfDigits;
- barcode_data->valid = false;
- return;
- }
-
- //checks if the barcode contains any characters that aren't a number
- for(int i = 0; i < barcode_length; i++) {
- char character = furi_string_get_char(barcode_data->raw_data, i);
- int digit = character - '0'; //convert the number into an int (also the index)
- if(digit < 0 || digit > 9) {
- barcode_data->reason = InvalidCharacters;
- barcode_data->valid = false;
- return;
- }
- }
-
- int check_digit = calculate_check_digit(barcode_data);
- char check_digit_char = check_digit + '0';
-
- barcode_data->check_digit = check_digit;
-
- //if the barcode length is at max length then we will verify if the check digit is correct
- if(barcode_length == max_digit) {
- //append the raw_data to the correct data string
- furi_string_cat(barcode_data->correct_data, barcode_data->raw_data);
-
- //append the check digit to the correct data string
- furi_string_set_char(barcode_data->correct_data, min_digits, check_digit_char);
- }
- //if the barcode length is at min length, we will calculate the check digit
- if(barcode_length == min_digits) {
- //append the raw_data to the correct data string
- furi_string_cat(barcode_data->correct_data, barcode_data->raw_data);
-
- //append the check digit to the correct data string
- furi_string_push_back(barcode_data->correct_data, check_digit_char);
- }
-}
-
-void code_39_loader(BarcodeData* barcode_data) {
- int barcode_length = furi_string_size(barcode_data->raw_data);
-
- int min_digits = barcode_data->type_obj->min_digits;
-
- //check the length of the barcode, must contain atleast a character,
- //this can have as many characters as it wants, it might not fit on the screen
- if(barcode_length < min_digits) {
- barcode_data->reason = WrongNumberOfDigits;
- barcode_data->valid = false;
- return;
- }
-
- FuriString* barcode_bits = furi_string_alloc();
- FuriString* temp_string = furi_string_alloc();
-
- //add starting and ending *
- if(!furi_string_start_with(barcode_data->raw_data, "*")) {
- furi_string_push_back(temp_string, '*');
- furi_string_cat(temp_string, barcode_data->raw_data);
- furi_string_set(barcode_data->raw_data, temp_string);
- }
-
- if(!furi_string_end_with(barcode_data->raw_data, "*")) {
- furi_string_push_back(barcode_data->raw_data, '*');
- }
-
- furi_string_free(temp_string);
- barcode_length = furi_string_size(barcode_data->raw_data);
-
- //Open Storage
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* ff = flipper_format_file_alloc(storage);
-
- if(!flipper_format_file_open_existing(ff, CODE39_DICT_FILE_PATH)) {
- FURI_LOG_E(TAG, "Could not open file %s", CODE39_DICT_FILE_PATH);
- barcode_data->reason = MissingEncodingTable;
- barcode_data->valid = false;
- } else {
- FuriString* char_bits = furi_string_alloc();
- for(int i = 0; i < barcode_length; i++) {
- char barcode_char = toupper(furi_string_get_char(barcode_data->raw_data, i));
-
- //convert a char into a string so it used in flipper_format_read_string
- char current_character[2];
- snprintf(current_character, 2, "%c", barcode_char);
-
- if(!flipper_format_read_string(ff, current_character, char_bits)) {
- FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
- barcode_data->reason = InvalidCharacters;
- barcode_data->valid = false;
- break;
- } else {
- FURI_LOG_I(
- TAG, "\"%c\" string: %s", barcode_char, furi_string_get_cstr(char_bits));
- furi_string_cat(barcode_bits, char_bits);
- }
- flipper_format_rewind(ff);
- }
- furi_string_free(char_bits);
- }
-
- //Close Storage
- flipper_format_free(ff);
- furi_record_close(RECORD_STORAGE);
-
- furi_string_cat(barcode_data->correct_data, barcode_bits);
- furi_string_free(barcode_bits);
-}
-
-/**
- * Loads a code 128 barcode
- *
- * Only supports character set B
-*/
-void code_128_loader(BarcodeData* barcode_data) {
- int barcode_length = furi_string_size(barcode_data->raw_data);
-
- //the start code for character set B
- int start_code_value = 104;
-
- //The bits for the start code
- const char* start_code_bits = "11010010000";
-
- //The bits for the stop code
- const char* stop_code_bits = "1100011101011";
-
- int min_digits = barcode_data->type_obj->min_digits;
-
- /**
- * A sum of all of the characters values
- * Ex:
- * Barcode Data : ABC
- * A has a value of 33
- * B has a value of 34
- * C has a value of 35
- *
- * the checksum_adder would be (33 * 1) + (34 * 2) + (35 * 3) + 104 = 310
- *
- * Add 104 since we are using set B
- */
- int checksum_adder = start_code_value;
- /**
- * Checksum digits is the number of characters it has read so far
- * In the above example the checksum_digits would be 3
- */
- int checksum_digits = 0;
-
- //the calculated check digit
- int final_check_digit = 0;
-
- //check the length of the barcode, must contain atleast a character,
- //this can have as many characters as it wants, it might not fit on the screen
- if(barcode_length < min_digits) {
- barcode_data->reason = WrongNumberOfDigits;
- barcode_data->valid = false;
- return;
- }
-
- //Open Storage
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* ff = flipper_format_file_alloc(storage);
-
- FuriString* barcode_bits = furi_string_alloc();
-
- //add the start code
- furi_string_cat(barcode_bits, start_code_bits);
-
- if(!flipper_format_file_open_existing(ff, CODE128_DICT_FILE_PATH)) {
- FURI_LOG_E(TAG, "Could not open file %s", CODE128_DICT_FILE_PATH);
- barcode_data->reason = MissingEncodingTable;
- barcode_data->valid = false;
- } else {
- FuriString* value = furi_string_alloc();
- FuriString* char_bits = furi_string_alloc();
- for(int i = 0; i < barcode_length; i++) {
- char barcode_char = furi_string_get_char(barcode_data->raw_data, i);
-
- //convert a char into a string so it used in flipper_format_read_string
- char current_character[2];
- snprintf(current_character, 2, "%c", barcode_char);
-
- //get the value of the character
- if(!flipper_format_read_string(ff, current_character, value)) {
- FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
- barcode_data->reason = InvalidCharacters;
- barcode_data->valid = false;
- break;
- }
- //using the value of the character, get the characters bits
- if(!flipper_format_read_string(ff, furi_string_get_cstr(value), char_bits)) {
- FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
- barcode_data->reason = EncodingTableError;
- barcode_data->valid = false;
- break;
- } else {
- //add the bits to the full barcode
- furi_string_cat(barcode_bits, char_bits);
-
- //calculate the checksum
- checksum_digits += 1;
- checksum_adder += (atoi(furi_string_get_cstr(value)) * checksum_digits);
-
- FURI_LOG_D(
- TAG,
- "\"%c\" string: %s : %s : %d : %d : %d",
- barcode_char,
- furi_string_get_cstr(char_bits),
- furi_string_get_cstr(value),
- checksum_digits,
- (atoi(furi_string_get_cstr(value)) * checksum_digits),
- checksum_adder);
- }
- //bring the file pointer back to the beginning
- flipper_format_rewind(ff);
- }
-
- //calculate the check digit and convert it into a c string for lookup in the encoding table
- final_check_digit = checksum_adder % 103;
- int length = snprintf(NULL, 0, "%d", final_check_digit);
- char* final_check_digit_string = malloc(length + 1);
- snprintf(final_check_digit_string, length + 1, "%d", final_check_digit);
-
- //after the checksum has been calculated, add the bits to the full barcode
- if(!flipper_format_read_string(ff, final_check_digit_string, char_bits)) {
- FURI_LOG_E(TAG, "Could not read \"%s\" string", final_check_digit_string);
- barcode_data->reason = EncodingTableError;
- barcode_data->valid = false;
- } else {
- //add the check digit bits to the full barcode
- furi_string_cat(barcode_bits, char_bits);
-
- FURI_LOG_D(
- TAG,
- "\"%s\" string: %s",
- final_check_digit_string,
- furi_string_get_cstr(char_bits));
- }
-
- free(final_check_digit_string);
- furi_string_free(value);
- furi_string_free(char_bits);
- }
-
- //add the stop code
- furi_string_cat(barcode_bits, stop_code_bits);
-
- //Close Storage
- flipper_format_free(ff);
- furi_record_close(RECORD_STORAGE);
-
- furi_string_cat(barcode_data->correct_data, barcode_bits);
- furi_string_free(barcode_bits);
-}
-
-/**
- * Loads a code 128 C barcode
-*/
-void code_128c_loader(BarcodeData* barcode_data) {
- int barcode_length = furi_string_size(barcode_data->raw_data);
-
- //the start code for character set C
- int start_code_value = 105;
-
- //The bits for the start code
- const char* start_code_bits = "11010011100";
-
- //The bits for the stop code
- const char* stop_code_bits = "1100011101011";
-
- int min_digits = barcode_data->type_obj->min_digits;
-
- int checksum_adder = start_code_value;
- int checksum_digits = 0;
-
- //the calculated check digit
- int final_check_digit = 0;
-
- // check the length of the barcode, must contain atleast 2 character,
- // this can have as many characters as it wants, it might not fit on the screen
- // code 128 C: the length must be even
- if((barcode_length < min_digits) || (barcode_length & 1)) {
- barcode_data->reason = WrongNumberOfDigits;
- barcode_data->valid = false;
- return;
- }
- //Open Storage
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* ff = flipper_format_file_alloc(storage);
-
- FuriString* barcode_bits = furi_string_alloc();
-
- //add the start code
- furi_string_cat(barcode_bits, start_code_bits);
-
- if(!flipper_format_file_open_existing(ff, CODE128C_DICT_FILE_PATH)) {
- FURI_LOG_E(TAG, "c128c Could not open file %s", CODE128C_DICT_FILE_PATH);
- barcode_data->reason = MissingEncodingTable;
- barcode_data->valid = false;
- } else {
- FuriString* value = furi_string_alloc();
- FuriString* char_bits = furi_string_alloc();
- for(int i = 0; i < barcode_length; i += 2) {
- char barcode_char1 = furi_string_get_char(barcode_data->raw_data, i);
- char barcode_char2 = furi_string_get_char(barcode_data->raw_data, i + 1);
- FURI_LOG_I(TAG, "c128c bc1='%c' bc2='%c'", barcode_char1, barcode_char2);
-
- char current_chars[4];
- snprintf(current_chars, 3, "%c%c", barcode_char1, barcode_char2);
- FURI_LOG_I(TAG, "c128c current_chars='%s'", current_chars);
-
- //using the value of the characters, get the characters bits
- if(!flipper_format_read_string(ff, current_chars, char_bits)) {
- FURI_LOG_E(TAG, "c128c Could not read \"%s\" string", current_chars);
- barcode_data->reason = EncodingTableError;
- barcode_data->valid = false;
- break;
- } else {
- //add the bits to the full barcode
- furi_string_cat(barcode_bits, char_bits);
-
- // calculate the checksum
- checksum_digits += 1;
- checksum_adder += (atoi(current_chars) * checksum_digits);
-
- FURI_LOG_I(
- TAG,
- "c128c \"%s\" string: %s : %s : %d : %d : %d",
- current_chars,
- furi_string_get_cstr(char_bits),
- furi_string_get_cstr(value),
- checksum_digits,
- (atoi(furi_string_get_cstr(value)) * checksum_digits),
- checksum_adder);
- }
- //bring the file pointer back to the begining
- flipper_format_rewind(ff);
- }
- //calculate the check digit and convert it into a c string for lookup in the encoding table
- final_check_digit = checksum_adder % 103;
- FURI_LOG_I(TAG, "c128c finale_check_digit=%d", final_check_digit);
-
- int length = snprintf(NULL, 0, "%d", final_check_digit);
- if(final_check_digit < 100) length = 2;
- char* final_check_digit_string = malloc(length + 1);
- snprintf(final_check_digit_string, length + 1, "%02d", final_check_digit);
-
- //after the checksum has been calculated, add the bits to the full barcode
- if(!flipper_format_read_string(ff, final_check_digit_string, char_bits)) {
- FURI_LOG_E(TAG, "c128c cksum Could not read \"%s\" string", final_check_digit_string);
- barcode_data->reason = EncodingTableError;
- barcode_data->valid = false;
- } else {
- //add the check digit bits to the full barcode
- furi_string_cat(barcode_bits, char_bits);
-
- FURI_LOG_I(
- TAG,
- "check digit \"%s\" string: %s",
- final_check_digit_string,
- furi_string_get_cstr(char_bits));
- }
-
- free(final_check_digit_string);
- furi_string_free(value);
- furi_string_free(char_bits);
- }
-
- //add the stop code
- furi_string_cat(barcode_bits, stop_code_bits);
-
- //Close Storage
- flipper_format_free(ff);
- furi_record_close(RECORD_STORAGE);
-
- FURI_LOG_I(TAG, "c128c %s", furi_string_get_cstr(barcode_bits));
- furi_string_cat(barcode_data->correct_data, barcode_bits);
- furi_string_free(barcode_bits);
-}
-
-void codabar_loader(BarcodeData* barcode_data) {
- int barcode_length = furi_string_size(barcode_data->raw_data);
-
- int min_digits = barcode_data->type_obj->min_digits;
-
- //check the length of the barcode, must contain atleast a character,
- //this can have as many characters as it wants, it might not fit on the screen
- if(barcode_length < min_digits) {
- barcode_data->reason = WrongNumberOfDigits;
- barcode_data->valid = false;
- return;
- }
-
- FuriString* barcode_bits = furi_string_alloc();
-
- barcode_length = furi_string_size(barcode_data->raw_data);
-
- //Open Storage
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* ff = flipper_format_file_alloc(storage);
-
- if(!flipper_format_file_open_existing(ff, CODABAR_DICT_FILE_PATH)) {
- FURI_LOG_E(TAG, "Could not open file %s", CODABAR_DICT_FILE_PATH);
- barcode_data->reason = MissingEncodingTable;
- barcode_data->valid = false;
- } else {
- FuriString* char_bits = furi_string_alloc();
- for(int i = 0; i < barcode_length; i++) {
- char barcode_char = toupper(furi_string_get_char(barcode_data->raw_data, i));
-
- //convert a char into a string so it used in flipper_format_read_string
- char current_character[2];
- snprintf(current_character, 2, "%c", barcode_char);
-
- if(!flipper_format_read_string(ff, current_character, char_bits)) {
- FURI_LOG_E(TAG, "Could not read \"%c\" string", barcode_char);
- barcode_data->reason = InvalidCharacters;
- barcode_data->valid = false;
- break;
- } else {
- FURI_LOG_I(
- TAG, "\"%c\" string: %s", barcode_char, furi_string_get_cstr(char_bits));
- furi_string_cat(barcode_bits, char_bits);
- }
- flipper_format_rewind(ff);
- }
- furi_string_free(char_bits);
- }
-
- //Close Storage
- flipper_format_free(ff);
- furi_record_close(RECORD_STORAGE);
-
- furi_string_cat(barcode_data->correct_data, barcode_bits);
- furi_string_free(barcode_bits);
-}
diff --git a/applications/external/barcode_gen/barcode_validator.h b/applications/external/barcode_gen/barcode_validator.h
deleted file mode 100644
index 2138124dd..000000000
--- a/applications/external/barcode_gen/barcode_validator.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include "barcode_app.h"
-
-int calculate_check_digit(BarcodeData* barcode_data);
-int calculate_ean_upc_check_digit(BarcodeData* barcode_data);
-void ean_upc_loader(BarcodeData* barcode_data);
-void upc_a_loader(BarcodeData* barcode_data);
-void ean_8_loader(BarcodeData* barcode_data);
-void ean_13_loader(BarcodeData* barcode_data);
-void code_39_loader(BarcodeData* barcode_data);
-void code_128_loader(BarcodeData* barcode_data);
-void code_128c_loader(BarcodeData* barcode_data);
-void codabar_loader(BarcodeData* barcode_data);
-void barcode_loader(BarcodeData* barcode_data);
diff --git a/applications/external/barcode_gen/encodings.c b/applications/external/barcode_gen/encodings.c
deleted file mode 100644
index 764fde796..000000000
--- a/applications/external/barcode_gen/encodings.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "encodings.h"
-
-const char EAN_13_STRUCTURE_CODES[10][6] = {
- "LLLLLL",
- "LLGLGG",
- "LLGGLG",
- "LLGGGL",
- "LGLLGG",
- "LGGLLG",
- "LGGGLL",
- "LGLGLG",
- "LGLGGL",
- "LGGLGL"};
-
-const char UPC_EAN_L_CODES[10][8] = {
- "0001101", // 0
- "0011001", // 1
- "0010011", // 2
- "0111101", // 3
- "0100011", // 4
- "0110001", // 5
- "0101111", // 6
- "0111011", // 7
- "0110111", // 8
- "0001011" // 9
-};
-
-const char EAN_G_CODES[10][8] = {
- "0100111", // 0
- "0110011", // 1
- "0011011", // 2
- "0100001", // 3
- "0011101", // 4
- "0111001", // 5
- "0000101", // 6
- "0010001", // 7
- "0001001", // 8
- "0010111" // 9
-};
-
-const char UPC_EAN_R_CODES[10][8] = {
- "1110010", // 0
- "1100110", // 1
- "1101100", // 2
- "1000010", // 3
- "1011100", // 4
- "1001110", // 5
- "1010000", // 6
- "1000100", // 7
- "1001000", // 8
- "1110100" // 9
-};
\ No newline at end of file
diff --git a/applications/external/barcode_gen/encodings.h b/applications/external/barcode_gen/encodings.h
deleted file mode 100644
index c5b8d61ff..000000000
--- a/applications/external/barcode_gen/encodings.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-extern const char EAN_13_STRUCTURE_CODES[10][6];
-extern const char UPC_EAN_L_CODES[10][8];
-extern const char EAN_G_CODES[10][8];
-extern const char UPC_EAN_R_CODES[10][8];
\ No newline at end of file
diff --git a/applications/external/barcode_gen/images/barcode_10.png b/applications/external/barcode_gen/images/barcode_10.png
deleted file mode 100644
index 32d4971ad..000000000
Binary files a/applications/external/barcode_gen/images/barcode_10.png and /dev/null differ
diff --git a/applications/external/barcode_gen/screenshots/Codabar Data Example.png b/applications/external/barcode_gen/screenshots/Codabar Data Example.png
deleted file mode 100644
index 907dfd901..000000000
Binary files a/applications/external/barcode_gen/screenshots/Codabar Data Example.png and /dev/null differ
diff --git a/applications/external/barcode_gen/screenshots/Creating Barcode.png b/applications/external/barcode_gen/screenshots/Creating Barcode.png
deleted file mode 100644
index e976b5682..000000000
Binary files a/applications/external/barcode_gen/screenshots/Creating Barcode.png and /dev/null differ
diff --git a/applications/external/barcode_gen/screenshots/Flipper Barcode.png b/applications/external/barcode_gen/screenshots/Flipper Barcode.png
deleted file mode 100644
index a6758c621..000000000
Binary files a/applications/external/barcode_gen/screenshots/Flipper Barcode.png and /dev/null differ
diff --git a/applications/external/barcode_gen/screenshots/Flipper Box Barcode.png b/applications/external/barcode_gen/screenshots/Flipper Box Barcode.png
deleted file mode 100644
index 8dbd7d2a9..000000000
Binary files a/applications/external/barcode_gen/screenshots/Flipper Box Barcode.png and /dev/null differ
diff --git a/applications/external/barcode_gen/views/barcode_view.c b/applications/external/barcode_gen/views/barcode_view.c
deleted file mode 100644
index 55ab52046..000000000
--- a/applications/external/barcode_gen/views/barcode_view.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include "../barcode_app.h"
-#include "barcode_view.h"
-#include "../encodings.h"
-
-/**
- * @brief Draws a single bit from a barcode at a specified location
- * @param canvas
- * @param bit a 1 or a 0 to signify a bit of data
- * @param x the top left x coordinate
- * @param y the top left y coordinate
- * @param width the width of the bit
- * @param height the height of the bit
- */
-static void draw_bit(Canvas* canvas, int bit, int x, int y, int width, int height) {
- if(bit == 1) {
- canvas_set_color(canvas, ColorBlack);
- } else {
- canvas_set_color(canvas, ColorWhite);
- }
- canvas_draw_box(canvas, x, y, width, height);
-}
-
-/**
- *
-*/
-static void draw_error_str(Canvas* canvas, const char* error) {
- canvas_clear(canvas);
- canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
-}
-
-/**
- * @param bits a string of 1's and 0's
- * @returns the x coordinate after the bits have been drawn, useful for drawing the next section of bits
-*/
-static int draw_bits(Canvas* canvas, const char* bits, int x, int y, int width, int height) {
- int bits_length = strlen(bits);
- for(int i = 0; i < bits_length; i++) {
- char c = bits[i];
- int num = c - '0';
-
- draw_bit(canvas, num, x, y, width, height);
-
- x += width;
- }
- return x;
-}
-
-/**
- * Draws an EAN-8 type barcode, does not check if the barcode is valid
- * @param canvas the canvas
- * @param barcode_digits the digits in the barcode, must be 8 characters long
-*/
-static void draw_ean_8(Canvas* canvas, BarcodeData* barcode_data) {
- FuriString* barcode_digits = barcode_data->correct_data;
- BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
- int barcode_length = furi_string_size(barcode_digits);
-
- int x = type_obj->start_pos;
- int y = BARCODE_Y_START;
- int width = 1;
- int height = BARCODE_HEIGHT;
-
- //the guard patterns for the beginning, center, ending
- const char* end_bits = "101";
- const char* center_bits = "01010";
-
- //draw the starting guard pattern
- x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-
- FuriString* code_part = furi_string_alloc();
-
- //loop through each digit, find the encoding, and draw it
- for(int i = 0; i < barcode_length; i++) {
- char current_digit = furi_string_get_char(barcode_digits, i);
-
- //the actual number and the index of the bits
- int index = current_digit - '0';
- //use the L-codes for the first 4 digits and the R-Codes for the last 4 digits
- if(i <= 3) {
- furi_string_set_str(code_part, UPC_EAN_L_CODES[index]);
- } else {
- furi_string_set_str(code_part, UPC_EAN_R_CODES[index]);
- }
-
- //convert the current_digit char into a string so it can be printed
- char current_digit_string[2];
- snprintf(current_digit_string, 2, "%c", current_digit);
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_str(canvas, x + 1, y + height + 8, current_digit_string);
-
- //draw the bits of the barcode
- x = draw_bits(canvas, furi_string_get_cstr(code_part), x, y, width, height);
-
- //if the index has reached 3, that means 4 digits have been drawn and now draw the center guard pattern
- if(i == 3) {
- x = draw_bits(canvas, center_bits, x, y, width, height + 5);
- }
- }
- furi_string_free(code_part);
-
- //draw the ending guard pattern
- x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-}
-
-static void draw_ean_13(Canvas* canvas, BarcodeData* barcode_data) {
- FuriString* barcode_digits = barcode_data->correct_data;
- BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
- int barcode_length = furi_string_size(barcode_digits);
-
- int x = type_obj->start_pos;
- int y = BARCODE_Y_START;
- int width = 1;
- int height = BARCODE_HEIGHT;
-
- //the guard patterns for the beginning, center, ending
- const char* end_bits = "101";
- const char* center_bits = "01010";
-
- //draw the starting guard pattern
- x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-
- FuriString* left_structure = furi_string_alloc();
- FuriString* code_part = furi_string_alloc();
-
- //loop through each digit, find the encoding, and draw it
- for(int i = 0; i < barcode_length; i++) {
- char current_digit = furi_string_get_char(barcode_digits, i);
- int index = current_digit - '0';
-
- if(i == 0) {
- furi_string_set_str(left_structure, EAN_13_STRUCTURE_CODES[index]);
-
- //convert the current_digit char into a string so it can be printed
- char current_digit_string[2];
- snprintf(current_digit_string, 2, "%c", current_digit);
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_str(canvas, x - 10, y + height + 8, current_digit_string);
-
- continue;
- } else {
- //use the L-codes for the first 6 digits and the R-Codes for the last 6 digits
- if(i <= 6) {
- //get the encoding type at the current barcode bit position
- char encoding_type = furi_string_get_char(left_structure, i - 1);
- if(encoding_type == 'L') {
- furi_string_set_str(code_part, UPC_EAN_L_CODES[index]);
- } else {
- furi_string_set_str(code_part, EAN_G_CODES[index]);
- }
- } else {
- furi_string_set_str(code_part, UPC_EAN_R_CODES[index]);
- }
-
- //convert the current_digit char into a string so it can be printed
- char current_digit_string[2];
- snprintf(current_digit_string, 2, "%c", current_digit);
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_str(canvas, x + 1, y + height + 8, current_digit_string);
-
- //draw the bits of the barcode
- x = draw_bits(canvas, furi_string_get_cstr(code_part), x, y, width, height);
-
- //if the index has reached 6, that means 6 digits have been drawn and we now draw the center guard pattern
- if(i == 6) {
- x = draw_bits(canvas, center_bits, x, y, width, height + 5);
- }
- }
- }
-
- furi_string_free(left_structure);
- furi_string_free(code_part);
-
- //draw the ending guard pattern
- x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-}
-
-/**
- * Draw a UPC-A barcode
-*/
-static void draw_upc_a(Canvas* canvas, BarcodeData* barcode_data) {
- FuriString* barcode_digits = barcode_data->correct_data;
- BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
- int barcode_length = furi_string_size(barcode_digits);
-
- int x = type_obj->start_pos;
- int y = BARCODE_Y_START;
- int width = 1;
- int height = BARCODE_HEIGHT;
-
- //the guard patterns for the beginning, center, ending
- char* end_bits = "101";
- char* center_bits = "01010";
-
- //draw the starting guard pattern
- x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-
- FuriString* code_part = furi_string_alloc();
-
- //loop through each digit, find the encoding, and draw it
- for(int i = 0; i < barcode_length; i++) {
- char current_digit = furi_string_get_char(barcode_digits, i);
- int index = current_digit - '0'; //convert the number into an int (also the index)
-
- //use the L-codes for the first 6 digits and the R-Codes for the last 6 digits
- if(i <= 5) {
- furi_string_set_str(code_part, UPC_EAN_L_CODES[index]);
- } else {
- furi_string_set_str(code_part, UPC_EAN_R_CODES[index]);
- }
-
- //convert the current_digit char into a string so it can be printed
- char current_digit_string[2];
- snprintf(current_digit_string, 2, "%c", current_digit);
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_str(canvas, x + 1, y + height + 8, current_digit_string);
-
- //draw the bits of the barcode
- x = draw_bits(canvas, furi_string_get_cstr(code_part), x, y, width, height);
-
- //if the index has reached 6, that means 6 digits have been drawn and we now draw the center guard pattern
- if(i == 5) {
- x = draw_bits(canvas, center_bits, x, y, width, height + 5);
- }
- }
-
- furi_string_free(code_part);
-
- //draw the ending guard pattern
- x = draw_bits(canvas, end_bits, x, y, width, height + 5);
-}
-
-static void draw_code_39(Canvas* canvas, BarcodeData* barcode_data) {
- FuriString* raw_data = barcode_data->raw_data;
- FuriString* barcode_digits = barcode_data->correct_data;
- //BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
- int barcode_length = furi_string_size(barcode_digits);
- int total_pixels = 0;
-
- for(int i = 0; i < barcode_length; i++) {
- //1 for wide, 0 for narrow
- char wide_or_narrow = furi_string_get_char(barcode_digits, i);
- int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
- if(wn_digit == 1) {
- total_pixels += 3;
- } else {
- total_pixels += 1;
- }
- if((i + 1) % 9 == 0) {
- total_pixels += 1;
- }
- }
-
- int x = (128 - total_pixels) / 2;
- int y = BARCODE_Y_START;
- int width = 1;
- int height = BARCODE_HEIGHT;
- bool filled_in = true;
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- // canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
- canvas_draw_str_aligned(
- canvas, 62, y + height + 8, AlignCenter, AlignBottom, furi_string_get_cstr(raw_data));
-
- for(int i = 0; i < barcode_length; i++) {
- //1 for wide, 0 for narrow
- char wide_or_narrow = furi_string_get_char(barcode_digits, i);
- int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
- if(filled_in) {
- if(wn_digit == 1) {
- x = draw_bits(canvas, "111", x, y, width, height);
- } else {
- x = draw_bits(canvas, "1", x, y, width, height);
- }
- filled_in = false;
- } else {
- if(wn_digit == 1) {
- x = draw_bits(canvas, "000", x, y, width, height);
- } else {
- x = draw_bits(canvas, "0", x, y, width, height);
- }
- filled_in = true;
- }
- if((i + 1) % 9 == 0) {
- x = draw_bits(canvas, "0", x, y, width, height);
- filled_in = true;
- }
- }
-}
-
-static void draw_code_128(Canvas* canvas, BarcodeData* barcode_data) {
- FuriString* raw_data = barcode_data->raw_data;
- FuriString* barcode_digits = barcode_data->correct_data;
-
- int barcode_length = furi_string_size(barcode_digits);
-
- int x = (128 - barcode_length) / 2;
- int y = BARCODE_Y_START;
- int width = 1;
- int height = BARCODE_HEIGHT;
-
- x = draw_bits(canvas, furi_string_get_cstr(barcode_digits), x, y, width, height);
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- // canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
- canvas_draw_str_aligned(
- canvas, 62, y + height + 8, AlignCenter, AlignBottom, furi_string_get_cstr(raw_data));
-}
-
-static void draw_codabar(Canvas* canvas, BarcodeData* barcode_data) {
- FuriString* raw_data = barcode_data->raw_data;
- FuriString* barcode_digits = barcode_data->correct_data;
- //BarcodeTypeObj* type_obj = barcode_data->type_obj;
-
- int barcode_length = furi_string_size(barcode_digits);
- int total_pixels = 0;
-
- for(int i = 0; i < barcode_length; i++) {
- //1 for wide, 0 for narrow
- char wide_or_narrow = furi_string_get_char(barcode_digits, i);
- int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
- if(wn_digit == 1) {
- total_pixels += 3;
- } else {
- total_pixels += 1;
- }
- if((i + 1) % 7 == 0) {
- total_pixels += 1;
- }
- }
-
- int x = (128 - total_pixels) / 2;
- int y = BARCODE_Y_START;
- int width = 1;
- int height = BARCODE_HEIGHT;
- bool filled_in = true;
-
- //set the canvas color to black to print the digit
- canvas_set_color(canvas, ColorBlack);
- // canvas_draw_str_aligned(canvas, 62, 30, AlignCenter, AlignCenter, error);
- canvas_draw_str_aligned(
- canvas, 62, y + height + 8, AlignCenter, AlignBottom, furi_string_get_cstr(raw_data));
-
- for(int i = 0; i < barcode_length; i++) {
- //1 for wide, 0 for narrow
- char wide_or_narrow = furi_string_get_char(barcode_digits, i);
- int wn_digit = wide_or_narrow - '0'; //wide(1) or narrow(0) digit
-
- if(filled_in) {
- if(wn_digit == 1) {
- x = draw_bits(canvas, "111", x, y, width, height);
- } else {
- x = draw_bits(canvas, "1", x, y, width, height);
- }
- filled_in = false;
- } else {
- if(wn_digit == 1) {
- x = draw_bits(canvas, "000", x, y, width, height);
- } else {
- x = draw_bits(canvas, "0", x, y, width, height);
- }
- filled_in = true;
- }
- if((i + 1) % 7 == 0) {
- x = draw_bits(canvas, "0", x, y, width, height);
- filled_in = true;
- }
- }
-}
-
-static void barcode_draw_callback(Canvas* canvas, void* ctx) {
- furi_assert(ctx);
- BarcodeModel* barcode_model = ctx;
- BarcodeData* data = barcode_model->data;
- // const char* barcode_digits =;
-
- canvas_clear(canvas);
- if(data->valid) {
- switch(data->type_obj->type) {
- case UPCA:
- draw_upc_a(canvas, data);
- break;
- case EAN8:
- draw_ean_8(canvas, data);
- break;
- case EAN13:
- draw_ean_13(canvas, data);
- break;
- case CODE39:
- draw_code_39(canvas, data);
- break;
- case CODE128:
- case CODE128C:
- draw_code_128(canvas, data);
- break;
- case CODABAR:
- draw_codabar(canvas, data);
- break;
- case UNKNOWN:
- default:
- break;
- }
- } else {
- switch(data->reason) {
- case WrongNumberOfDigits:
- draw_error_str(canvas, "Wrong # of characters");
- break;
- case InvalidCharacters:
- draw_error_str(canvas, "Invalid characters");
- break;
- case UnsupportedType:
- draw_error_str(canvas, "Unsupported barcode type");
- break;
- case FileOpening:
- draw_error_str(canvas, "Could not open file");
- break;
- case InvalidFileData:
- draw_error_str(canvas, "Invalid file data");
- break;
- case MissingEncodingTable:
- draw_error_str(canvas, "Missing encoding table");
- break;
- case EncodingTableError:
- draw_error_str(canvas, "Encoding table error");
- break;
- default:
- draw_error_str(canvas, "Could not read barcode data");
- break;
- }
- }
-}
-
-bool barcode_input_callback(InputEvent* input_event, void* ctx) {
- UNUSED(ctx);
- //furi_assert(ctx);
-
- //Barcode* test_view_object = ctx;
-
- if(input_event->key == InputKeyBack) {
- return false;
- } else {
- return true;
- }
-}
-
-Barcode* barcode_view_allocate(BarcodeApp* barcode_app) {
- furi_assert(barcode_app);
-
- Barcode* barcode = malloc(sizeof(Barcode));
-
- barcode->view = view_alloc();
- barcode->barcode_app = barcode_app;
-
- view_set_context(barcode->view, barcode);
- view_allocate_model(barcode->view, ViewModelTypeLocking, sizeof(BarcodeModel));
- view_set_draw_callback(barcode->view, barcode_draw_callback);
- view_set_input_callback(barcode->view, barcode_input_callback);
-
- return barcode;
-}
-
-void barcode_free_model(Barcode* barcode) {
- with_view_model(
- barcode->view,
- BarcodeModel * model,
- {
- if(model->file_path != NULL) {
- furi_string_free(model->file_path);
- }
- if(model->data != NULL) {
- if(model->data->raw_data != NULL) {
- furi_string_free(model->data->raw_data);
- }
- if(model->data->correct_data != NULL) {
- furi_string_free(model->data->correct_data);
- }
- free(model->data);
- }
- },
- false);
-}
-
-void barcode_free(Barcode* barcode) {
- furi_assert(barcode);
-
- barcode_free_model(barcode);
- view_free(barcode->view);
- free(barcode);
-}
-
-View* barcode_get_view(Barcode* barcode) {
- furi_assert(barcode);
- return barcode->view;
-}
diff --git a/applications/external/barcode_gen/views/barcode_view.h b/applications/external/barcode_gen/views/barcode_view.h
deleted file mode 100644
index 828428c08..000000000
--- a/applications/external/barcode_gen/views/barcode_view.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct BarcodeApp BarcodeApp;
-
-typedef struct {
- View* view;
- BarcodeApp* barcode_app;
-} Barcode;
-
-typedef struct {
- FuriString* file_path;
- BarcodeData* data;
-} BarcodeModel;
-
-Barcode* barcode_view_allocate(BarcodeApp* barcode_app);
-
-void barcode_free_model(Barcode* barcode);
-
-void barcode_free(Barcode* barcode);
-
-View* barcode_get_view(Barcode* barcode);
diff --git a/applications/external/barcode_gen/views/create_view.c b/applications/external/barcode_gen/views/create_view.c
deleted file mode 100644
index e4e489113..000000000
--- a/applications/external/barcode_gen/views/create_view.c
+++ /dev/null
@@ -1,494 +0,0 @@
-#include "../barcode_app.h"
-#include "create_view.h"
-#include
-
-#define LINE_HEIGHT 16
-#define TEXT_PADDING 4
-#define TOTAL_MENU_ITEMS 5
-
-typedef enum {
- TypeMenuItem,
- FileNameMenuItem,
- BarcodeDataMenuItem,
- SaveMenuButton,
- DeleteMenuButton
-} MenuItems;
-
-/**
- * Took this function from blackjack
- * @author @teeebor
-*/
-void draw_menu_item(
- Canvas* const canvas,
- const char* text,
- const char* value,
- int y,
- bool left_caret,
- bool right_caret,
- bool selected) {
- UNUSED(selected);
- if(y < 0 || y >= 64) {
- return;
- }
-
- if(selected) {
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 0, y, 123, LINE_HEIGHT);
- canvas_set_color(canvas, ColorWhite);
- }
-
- canvas_draw_str_aligned(canvas, 4, y + TEXT_PADDING, AlignLeft, AlignTop, text);
- if(left_caret) {
- canvas_draw_str_aligned(canvas, 60, y + TEXT_PADDING, AlignLeft, AlignTop, "<");
- }
-
- canvas_draw_str_aligned(canvas, 90, y + TEXT_PADDING, AlignCenter, AlignTop, value);
- if(right_caret) {
- canvas_draw_str_aligned(canvas, 120, y + TEXT_PADDING, AlignRight, AlignTop, ">");
- }
-
- canvas_set_color(canvas, ColorBlack);
-}
-
-void draw_button(Canvas* const canvas, const char* text, int y, bool selected) {
- if(selected) {
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 0, y, 123, LINE_HEIGHT);
- canvas_set_color(canvas, ColorWhite);
- }
-
- canvas_draw_str_aligned(canvas, 64, y + TEXT_PADDING, AlignCenter, AlignTop, text);
-
- canvas_set_color(canvas, ColorBlack);
-}
-
-static void app_draw_callback(Canvas* canvas, void* ctx) {
- furi_assert(ctx);
-
- CreateViewModel* create_view_model = ctx;
-
- BarcodeTypeObj* type_obj = create_view_model->barcode_type;
- if(create_view_model->barcode_type == NULL) {
- return;
- }
- BarcodeType selected_type = type_obj->type;
-
- int selected_menu_item = create_view_model->selected_menu_item;
-
- int total_menu_items = create_view_model->mode == EditMode ? TOTAL_MENU_ITEMS :
- TOTAL_MENU_ITEMS - 1;
-
- int startY = 0;
-
- //the menu items index that is/would be in view
- //int current_last_menu_item = selected_menu_item + 3;
- if(selected_menu_item > 1) {
- int offset = 2;
- if(selected_menu_item + offset > total_menu_items) {
- offset = 3;
- }
- startY -= (LINE_HEIGHT * (selected_menu_item - offset));
- }
-
- //ensure that the scroll height is atleast 1
- int scrollHeight = ceil(64.0 / total_menu_items);
- int scrollPos = scrollHeight * selected_menu_item;
-
- canvas_set_color(canvas, ColorBlack);
- //draw the scroll bar box
- canvas_draw_box(canvas, 125, scrollPos, 3, scrollHeight);
- //draw the scroll bar track
- canvas_draw_box(canvas, 126, 0, 1, 64);
-
- draw_menu_item(
- canvas,
- "Type",
- type_obj->name,
- TypeMenuItem * LINE_HEIGHT + startY,
- selected_type > 0,
- selected_type < NUMBER_OF_BARCODE_TYPES - 2,
- selected_menu_item == TypeMenuItem);
-
- draw_menu_item(
- canvas,
- "Name",
- furi_string_empty(create_view_model->file_name) ?
- "--" :
- furi_string_get_cstr(create_view_model->file_name),
- FileNameMenuItem * LINE_HEIGHT + startY,
- false,
- false,
- selected_menu_item == FileNameMenuItem);
-
- draw_menu_item(
- canvas,
- "Data",
- furi_string_empty(create_view_model->barcode_data) ?
- "--" :
- furi_string_get_cstr(create_view_model->barcode_data),
- BarcodeDataMenuItem * LINE_HEIGHT + startY,
- false,
- false,
- selected_menu_item == BarcodeDataMenuItem);
-
- draw_button(
- canvas,
- "Save",
- SaveMenuButton * LINE_HEIGHT + startY,
- selected_menu_item == SaveMenuButton);
-
- if(create_view_model->mode == EditMode) {
- draw_button(
- canvas,
- "Delete",
- DeleteMenuButton * LINE_HEIGHT + startY,
- selected_menu_item == DeleteMenuButton);
- }
-}
-
-void text_input_callback(void* ctx) {
- CreateView* create_view_object = ctx;
-
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- if(create_view_object->setter == FileNameSetter) {
- furi_string_set_str(model->file_name, create_view_object->input);
- }
- if(create_view_object->setter == BarcodeDataSetter) {
- furi_string_set_str(model->barcode_data, create_view_object->input);
- }
- },
- true);
-
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, CreateBarcodeView);
-}
-
-static bool app_input_callback(InputEvent* input_event, void* ctx) {
- furi_assert(ctx);
-
- if(input_event->key == InputKeyBack) {
- return false;
- }
-
- CreateView* create_view_object = ctx;
-
- //get the currently selected menu item from the model
- int selected_menu_item = 0;
- BarcodeTypeObj* barcode_type = NULL;
- FuriString* file_name;
- FuriString* barcode_data;
- CreateMode mode;
-
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- selected_menu_item = model->selected_menu_item;
- barcode_type = model->barcode_type;
- file_name = model->file_name;
- barcode_data = model->barcode_data;
- mode = model->mode;
- },
- true);
-
- int total_menu_items = mode == EditMode ? TOTAL_MENU_ITEMS : TOTAL_MENU_ITEMS - 1;
-
- if(input_event->type == InputTypePress) {
- if(input_event->key == InputKeyUp && selected_menu_item > 0) {
- selected_menu_item--;
- } else if(input_event->key == InputKeyDown && selected_menu_item < total_menu_items - 1) {
- selected_menu_item++;
- } else if(input_event->key == InputKeyLeft) {
- if(selected_menu_item == TypeMenuItem && barcode_type != NULL) { //Select Barcode Type
- if(barcode_type->type > 0) {
- barcode_type = barcode_type_objs[barcode_type->type - 1];
- }
- }
- } else if(input_event->key == InputKeyRight) {
- if(selected_menu_item == TypeMenuItem && barcode_type != NULL) { //Select Barcode Type
- if(barcode_type->type < NUMBER_OF_BARCODE_TYPES - 2) {
- barcode_type = barcode_type_objs[barcode_type->type + 1];
- }
- }
- } else if(input_event->key == InputKeyOk) {
- if(selected_menu_item == FileNameMenuItem && barcode_type != NULL) {
- create_view_object->setter = FileNameSetter;
-
- snprintf(
- create_view_object->input,
- sizeof(create_view_object->input),
- "%s",
- furi_string_get_cstr(file_name));
-
- text_input_set_result_callback(
- create_view_object->barcode_app->text_input,
- text_input_callback,
- create_view_object,
- create_view_object->input,
- TEXT_BUFFER_SIZE - BARCODE_EXTENSION_LENGTH, //remove the barcode length
- //clear default text
- false);
- text_input_set_header_text(
- create_view_object->barcode_app->text_input, "File Name");
-
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, TextInputView);
- }
- if(selected_menu_item == BarcodeDataMenuItem && barcode_type != NULL) {
- create_view_object->setter = BarcodeDataSetter;
-
- snprintf(
- create_view_object->input,
- sizeof(create_view_object->input),
- "%s",
- furi_string_get_cstr(barcode_data));
-
- text_input_set_result_callback(
- create_view_object->barcode_app->text_input,
- text_input_callback,
- create_view_object,
- create_view_object->input,
- TEXT_BUFFER_SIZE,
- //clear default text
- false);
- text_input_set_header_text(
- create_view_object->barcode_app->text_input, "Barcode Data");
-
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, TextInputView);
- }
- if(selected_menu_item == SaveMenuButton && barcode_type != NULL) {
- save_barcode(create_view_object);
- }
- if(selected_menu_item == DeleteMenuButton && barcode_type != NULL) {
- if(mode == EditMode) {
- remove_barcode(create_view_object);
- } else if(mode == NewMode) {
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, MainMenuView);
- }
- }
- }
- }
-
- //change the currently selected menu item
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- model->selected_menu_item = selected_menu_item;
- model->barcode_type = barcode_type;
- },
- true);
-
- return true;
-}
-
-CreateView* create_view_allocate(BarcodeApp* barcode_app) {
- furi_assert(barcode_app);
-
- CreateView* create_view_object = malloc(sizeof(CreateView));
-
- create_view_object->view = view_alloc();
- create_view_object->barcode_app = barcode_app;
-
- view_set_context(create_view_object->view, create_view_object);
- view_allocate_model(create_view_object->view, ViewModelTypeLocking, sizeof(CreateViewModel));
- view_set_draw_callback(create_view_object->view, app_draw_callback);
- view_set_input_callback(create_view_object->view, app_input_callback);
-
- return create_view_object;
-}
-
-void create_view_free_model(CreateView* create_view_object) {
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- if(model->file_path != NULL) {
- furi_string_free(model->file_path);
- }
- if(model->file_name != NULL) {
- furi_string_free(model->file_name);
- }
- if(model->barcode_data != NULL) {
- furi_string_free(model->barcode_data);
- }
- },
- true);
-}
-
-void remove_barcode(CreateView* create_view_object) {
- Storage* storage = furi_record_open(RECORD_STORAGE);
-
- bool success = false;
-
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- FURI_LOG_I(TAG, "Attempting to remove file");
- if(model->file_path != NULL) {
- FURI_LOG_I(TAG, "Removing File: %s", furi_string_get_cstr(model->file_path));
- if(storage_simply_remove(storage, furi_string_get_cstr(model->file_path))) {
- FURI_LOG_I(
- TAG,
- "File: \"%s\" was successfully removed",
- furi_string_get_cstr(model->file_path));
- success = true;
- } else {
- FURI_LOG_E(TAG, "Unable to remove file!");
- success = false;
- }
- } else {
- FURI_LOG_E(TAG, "Could not remove barcode file");
- success = false;
- }
- },
- true);
- furi_record_close(RECORD_STORAGE);
-
- with_view_model(
- create_view_object->barcode_app->message_view->view,
- MessageViewModel * model,
- {
- if(success) {
- model->message = "File Deleted";
- } else {
- model->message = "Could not delete file";
- }
- },
- true);
-
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, MessageErrorView);
-}
-
-void save_barcode(CreateView* create_view_object) {
- BarcodeTypeObj* barcode_type = NULL;
- FuriString* file_path; //this may be empty
- FuriString* file_name;
- FuriString* barcode_data;
- CreateMode mode;
-
- with_view_model(
- create_view_object->view,
- CreateViewModel * model,
- {
- file_path = model->file_path;
- file_name = model->file_name;
- barcode_data = model->barcode_data;
- barcode_type = model->barcode_type;
- mode = model->mode;
- },
- true);
-
- if(file_name == NULL || furi_string_empty(file_name)) {
- FURI_LOG_E(TAG, "File Name cannot be empty");
- return;
- }
- if(barcode_data == NULL || furi_string_empty(barcode_data)) {
- FURI_LOG_E(TAG, "Barcode Data cannot be empty");
- return;
- }
- if(barcode_type == NULL) {
- FURI_LOG_E(TAG, "Type not defined");
- return;
- }
-
- bool success = false;
-
- FuriString* full_file_path = furi_string_alloc_set(DEFAULT_USER_BARCODES);
- furi_string_push_back(full_file_path, '/');
- furi_string_cat(full_file_path, file_name);
- furi_string_cat_str(full_file_path, BARCODE_EXTENSION);
-
- Storage* storage = furi_record_open(RECORD_STORAGE);
-
- if(mode == EditMode) {
- if(!furi_string_empty(file_path)) {
- if(!furi_string_equal(file_path, full_file_path)) {
- FS_Error error = storage_common_rename(
- storage,
- furi_string_get_cstr(file_path),
- furi_string_get_cstr(full_file_path));
- if(error != FSE_OK) {
- FURI_LOG_E(TAG, "Rename error: %s", storage_error_get_desc(error));
- } else {
- FURI_LOG_I(TAG, "Rename Success");
- }
- }
- }
- }
-
- FlipperFormat* ff = flipper_format_file_alloc(storage);
-
- FURI_LOG_I(TAG, "Saving Barcode to: %s", furi_string_get_cstr(full_file_path));
-
- bool file_opened_status = false;
- if(mode == NewMode) {
- file_opened_status =
- flipper_format_file_open_new(ff, furi_string_get_cstr(full_file_path));
- } else if(mode == EditMode) {
- file_opened_status =
- flipper_format_file_open_always(ff, furi_string_get_cstr(full_file_path));
- }
-
- if(file_opened_status) {
- // Filetype: Barcode
- // Version: 1
-
- // # Types - UPC-A, EAN-8, EAN-13, CODE-39
- // Type: CODE-39
- // Data: AB
- flipper_format_write_string_cstr(ff, "Filetype", "Barcode");
-
- flipper_format_write_string_cstr(ff, "Version", FILE_VERSION);
-
- flipper_format_write_comment_cstr(
- ff, "Types - UPC-A, EAN-8, EAN-13, CODE-39, CODE-128, Codabar");
-
- flipper_format_write_string_cstr(ff, "Type", barcode_type->name);
-
- flipper_format_write_string_cstr(ff, "Data", furi_string_get_cstr(barcode_data));
-
- success = true;
- } else {
- FURI_LOG_E(TAG, "Save error");
- success = false;
- }
- furi_string_free(full_file_path);
- flipper_format_free(ff);
- furi_record_close(RECORD_STORAGE);
-
- with_view_model(
- create_view_object->barcode_app->message_view->view,
- MessageViewModel * model,
- {
- if(success) {
- model->message = "File Saved!";
- } else {
- model->message = "A saving error has occurred";
- }
- },
- true);
-
- view_dispatcher_switch_to_view(
- create_view_object->barcode_app->view_dispatcher, MessageErrorView);
-}
-
-void create_view_free(CreateView* create_view_object) {
- furi_assert(create_view_object);
-
- create_view_free_model(create_view_object);
- view_free(create_view_object->view);
- free(create_view_object);
-}
-
-View* create_get_view(CreateView* create_view_object) {
- furi_assert(create_view_object);
- return create_view_object->view;
-}
\ No newline at end of file
diff --git a/applications/external/barcode_gen/views/create_view.h b/applications/external/barcode_gen/views/create_view.h
deleted file mode 100644
index 6063786d9..000000000
--- a/applications/external/barcode_gen/views/create_view.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct BarcodeApp BarcodeApp;
-
-typedef enum {
- FileNameSetter,
- BarcodeDataSetter
-} InputSetter; //what value to set for the text input view
-
-typedef enum {
- EditMode,
-
- NewMode
-} CreateMode;
-
-typedef struct {
- View* view;
- BarcodeApp* barcode_app;
-
- InputSetter setter;
- char input[TEXT_BUFFER_SIZE];
-} CreateView;
-
-typedef struct {
- int selected_menu_item;
-
- CreateMode mode;
- BarcodeTypeObj* barcode_type;
- FuriString* file_path; //the current file that is opened
- FuriString* file_name;
- FuriString* barcode_data;
-} CreateViewModel;
-
-CreateView* create_view_allocate(BarcodeApp* barcode_app);
-
-void remove_barcode(CreateView* create_view_object);
-
-void save_barcode(CreateView* create_view_object);
-
-void create_view_free_model(CreateView* create_view_object);
-
-void create_view_free(CreateView* create_view_object);
-
-View* create_get_view(CreateView* create_view_object);
diff --git a/applications/external/barcode_gen/views/message_view.c b/applications/external/barcode_gen/views/message_view.c
deleted file mode 100644
index 3a9aa90b3..000000000
--- a/applications/external/barcode_gen/views/message_view.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "../barcode_app.h"
-#include "message_view.h"
-
-static void app_draw_callback(Canvas* canvas, void* ctx) {
- furi_assert(ctx);
-
- MessageViewModel* message_view_model = ctx;
-
- canvas_clear(canvas);
- if(message_view_model->message != NULL) {
- canvas_draw_str_aligned(
- canvas, 62, 30, AlignCenter, AlignCenter, message_view_model->message);
- }
-
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 100, 52, 28, 12);
- canvas_set_color(canvas, ColorWhite);
- canvas_draw_str_aligned(canvas, 114, 58, AlignCenter, AlignCenter, "OK");
-}
-
-static bool app_input_callback(InputEvent* input_event, void* ctx) {
- furi_assert(ctx);
-
- MessageView* message_view_object = ctx;
-
- if(input_event->key == InputKeyBack) {
- view_dispatcher_switch_to_view(
- message_view_object->barcode_app->view_dispatcher, MainMenuView);
- }
- if(input_event->type == InputTypeShort) {
- if(input_event->key == InputKeyOk) {
- view_dispatcher_switch_to_view(
- message_view_object->barcode_app->view_dispatcher, MainMenuView);
- }
- }
-
- return true;
-}
-
-MessageView* message_view_allocate(BarcodeApp* barcode_app) {
- furi_assert(barcode_app);
-
- MessageView* message_view_object = malloc(sizeof(MessageView));
-
- message_view_object->view = view_alloc();
- message_view_object->barcode_app = barcode_app;
-
- view_set_context(message_view_object->view, message_view_object);
- view_allocate_model(message_view_object->view, ViewModelTypeLocking, sizeof(MessageViewModel));
- view_set_draw_callback(message_view_object->view, app_draw_callback);
- view_set_input_callback(message_view_object->view, app_input_callback);
-
- return message_view_object;
-}
-
-void message_view_free(MessageView* message_view_object) {
- furi_assert(message_view_object);
-
- view_free(message_view_object->view);
- free(message_view_object);
-}
-
-View* message_get_view(MessageView* message_view_object) {
- furi_assert(message_view_object);
- return message_view_object->view;
-}
\ No newline at end of file
diff --git a/applications/external/barcode_gen/views/message_view.h b/applications/external/barcode_gen/views/message_view.h
deleted file mode 100644
index 33acc3d0c..000000000
--- a/applications/external/barcode_gen/views/message_view.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include
-
-typedef struct BarcodeApp BarcodeApp;
-
-typedef struct {
- View* view;
- BarcodeApp* barcode_app;
-} MessageView;
-
-typedef struct {
- const char* message;
-} MessageViewModel;
-
-MessageView* message_view_allocate(BarcodeApp* barcode_app);
-
-void message_view_free_model(MessageView* message_view_object);
-
-void message_view_free(MessageView* message_view_object);
-
-View* message_get_view(MessageView* message_view_object);
diff --git a/applications/external/blackjack/application.fam b/applications/external/blackjack/application.fam
deleted file mode 100644
index 271620d72..000000000
--- a/applications/external/blackjack/application.fam
+++ /dev/null
@@ -1,15 +0,0 @@
-App(
- appid="blackjack",
- name="Blackjack",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="blackjack_app",
- requires=["gui","storage","canvas"],
- stack_size=2 * 1024,
- order=30,
- fap_icon="blackjack_10px.png",
- fap_category="Games",
- fap_icon_assets="assets",
- fap_author="@teeebor",
- fap_version="1.0",
- fap_description="Blackjack Game",
-)
\ No newline at end of file
diff --git a/applications/external/blackjack/assets/blackjack.png b/applications/external/blackjack/assets/blackjack.png
deleted file mode 100644
index bb367f28e..000000000
Binary files a/applications/external/blackjack/assets/blackjack.png and /dev/null differ
diff --git a/applications/external/blackjack/assets/card_graphics.png b/applications/external/blackjack/assets/card_graphics.png
deleted file mode 100644
index 8b00e351f..000000000
Binary files a/applications/external/blackjack/assets/card_graphics.png and /dev/null differ
diff --git a/applications/external/blackjack/assets/endscreen.png b/applications/external/blackjack/assets/endscreen.png
deleted file mode 100644
index 7a3abc927..000000000
Binary files a/applications/external/blackjack/assets/endscreen.png and /dev/null differ
diff --git a/applications/external/blackjack/blackjack.c b/applications/external/blackjack/blackjack.c
deleted file mode 100644
index c4ef8d3a7..000000000
--- a/applications/external/blackjack/blackjack.c
+++ /dev/null
@@ -1,633 +0,0 @@
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include "util.h"
-#include "defines.h"
-#include "common/card.h"
-#include "common/dml.h"
-#include "common/queue.h"
-#include "util.h"
-#include "ui.h"
-
-#include "blackjack_icons.h"
-
-#define DEALER_MAX 17
-
-void start_round(GameState* game_state);
-
-void init(GameState* game_state);
-
-static void draw_ui(Canvas* const canvas, const GameState* game_state) {
- draw_money(canvas, game_state->player_score);
-
- draw_score(canvas, true, hand_count(game_state->player_cards, game_state->player_card_count));
-
- if(!game_state->queue_state.running && game_state->state == GameStatePlay) {
- render_menu(game_state->menu, canvas, 2, 47);
- }
-}
-
-static void render_callback(Canvas* const canvas, void* ctx) {
- furi_assert(ctx);
- const GameState* game_state = ctx;
- furi_mutex_acquire(game_state->mutex, FuriWaitForever);
-
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_frame(canvas, 0, 0, 128, 64);
-
- if(game_state->state == GameStateStart) {
- canvas_draw_icon(canvas, 0, 0, &I_blackjack);
- }
- if(game_state->state == GameStateGameOver) {
- canvas_draw_icon(canvas, 0, 0, &I_endscreen);
- }
-
- if(game_state->state == GameStatePlay || game_state->state == GameStateDealer) {
- if(game_state->state == GameStatePlay)
- draw_player_scene(canvas, game_state);
- else
- draw_dealer_scene(canvas, game_state);
- render_queue(&(game_state->queue_state), game_state, canvas);
- draw_ui(canvas, game_state);
- } else if(game_state->state == GameStateSettings) {
- settings_page(canvas, game_state);
- }
-
- furi_mutex_release(game_state->mutex);
-}
-
-//region card draw
-Card draw_card(GameState* game_state) {
- Card c = game_state->deck.cards[game_state->deck.index];
- game_state->deck.index++;
- return c;
-}
-
-void drawPlayerCard(void* ctx) {
- GameState* game_state = ctx;
- Card c = draw_card(game_state);
- game_state->player_cards[game_state->player_card_count] = c;
- game_state->player_card_count++;
- if(game_state->player_score < game_state->settings.round_price || game_state->doubled) {
- set_menu_state(game_state->menu, 0, false);
- }
-}
-
-void drawDealerCard(void* ctx) {
- GameState* game_state = ctx;
- Card c = draw_card(game_state);
- game_state->dealer_cards[game_state->dealer_card_count] = c;
- game_state->dealer_card_count++;
-}
-//endregion
-
-//region queue callbacks
-void to_lose_state(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- if(game_state->settings.message_duration == 0) return;
- popup_frame(canvas);
- elements_multiline_text_aligned(canvas, 64, 22, AlignCenter, AlignCenter, "You lost");
-}
-
-void to_bust_state(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- if(game_state->settings.message_duration == 0) return;
- popup_frame(canvas);
- elements_multiline_text_aligned(canvas, 64, 22, AlignCenter, AlignCenter, "Busted!");
-}
-
-void to_draw_state(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- if(game_state->settings.message_duration == 0) return;
- popup_frame(canvas);
- elements_multiline_text_aligned(canvas, 64, 22, AlignCenter, AlignCenter, "Draw");
-}
-
-void to_dealer_turn(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- if(game_state->settings.message_duration == 0) return;
- popup_frame(canvas);
- elements_multiline_text_aligned(canvas, 64, 22, AlignCenter, AlignCenter, "Dealers turn");
-}
-
-void to_win_state(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- if(game_state->settings.message_duration == 0) return;
- popup_frame(canvas);
- elements_multiline_text_aligned(canvas, 64, 22, AlignCenter, AlignCenter, "You win");
-}
-
-void to_start(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- if(game_state->settings.message_duration == 0) return;
- popup_frame(canvas);
- elements_multiline_text_aligned(canvas, 64, 22, AlignCenter, AlignCenter, "Round started");
-}
-
-void before_start(void* ctx) {
- GameState* game_state = ctx;
- game_state->dealer_card_count = 0;
- game_state->player_card_count = 0;
-}
-
-void start(void* ctx) {
- GameState* game_state = ctx;
- start_round(game_state);
-}
-
-void draw(void* ctx) {
- GameState* game_state = ctx;
- game_state->player_score += game_state->bet;
- game_state->bet = 0;
- enqueue(
- &(game_state->queue_state),
- game_state,
- start,
- before_start,
- to_start,
- game_state->settings.message_duration);
-}
-
-void game_over(void* ctx) {
- GameState* game_state = ctx;
- game_state->state = GameStateGameOver;
-}
-
-void lose(void* ctx) {
- GameState* game_state = ctx;
- game_state->state = GameStatePlay;
- game_state->bet = 0;
- if(game_state->player_score >= game_state->settings.round_price) {
- enqueue(
- &(game_state->queue_state),
- game_state,
- start,
- before_start,
- to_start,
- game_state->settings.message_duration);
- } else {
- enqueue(&(game_state->queue_state), game_state, game_over, NULL, NULL, 0);
- }
-}
-
-void win(void* ctx) {
- GameState* game_state = ctx;
- game_state->state = GameStatePlay;
- game_state->player_score += game_state->bet * 2;
- game_state->bet = 0;
- enqueue(
- &(game_state->queue_state),
- game_state,
- start,
- before_start,
- to_start,
- game_state->settings.message_duration);
-}
-
-void dealerTurn(void* ctx) {
- GameState* game_state = ctx;
- game_state->state = GameStateDealer;
-}
-
-float animationTime(const GameState* game_state) {
- return (float)(furi_get_tick() - game_state->queue_state.start) /
- (float)(game_state->settings.animation_duration);
-}
-
-void dealer_card_animation(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- float t = animationTime(game_state);
-
- Card animatingCard = game_state->deck.cards[game_state->deck.index];
- if(game_state->dealer_card_count > 1) {
- Vector end = card_pos_at_index(game_state->dealer_card_count);
- draw_card_animation(animatingCard, (Vector){0, 64}, (Vector){0, 32}, end, t, true, canvas);
- } else {
- draw_card_animation(
- animatingCard,
- (Vector){32, -CARD_HEIGHT},
- (Vector){64, 32},
- (Vector){2, 2},
- t,
- false,
- canvas);
- }
-}
-
-void dealer_back_card_animation(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- float t = animationTime(game_state);
-
- Vector currentPos =
- quadratic_2d((Vector){32, -CARD_HEIGHT}, (Vector){64, 32}, (Vector){13, 5}, t);
- draw_card_back_at(currentPos.x, currentPos.y, canvas);
-}
-
-void player_card_animation(const void* ctx, Canvas* const canvas) {
- const GameState* game_state = ctx;
- float t = animationTime(game_state);
-
- Card animatingCard = game_state->deck.cards[game_state->deck.index];
- Vector end = card_pos_at_index(game_state->player_card_count);
-
- draw_card_animation(
- animatingCard, (Vector){32, -CARD_HEIGHT}, (Vector){0, 32}, end, t, true, canvas);
-}
-//endregion
-
-void player_tick(GameState* game_state) {
- uint8_t score = hand_count(game_state->player_cards, game_state->player_card_count);
- if((game_state->doubled && score <= 21) || score == 21) {
- enqueue(
- &(game_state->queue_state),
- game_state,
- dealerTurn,
- NULL,
- to_dealer_turn,
- game_state->settings.message_duration);
- } else if(score > 21) {
- enqueue(
- &(game_state->queue_state),
- game_state,
- lose,
- NULL,
- to_bust_state,
- game_state->settings.message_duration);
- } else {
- if(game_state->selectDirection == DirectionUp ||
- game_state->selectDirection == DirectionDown) {
- move_menu(game_state->menu, game_state->selectDirection == DirectionUp ? -1 : 1);
- }
-
- if(game_state->selectDirection == Select) {
- activate_menu(game_state->menu, game_state);
- }
- }
-}
-
-void dealer_tick(GameState* game_state) {
- uint8_t dealer_score = hand_count(game_state->dealer_cards, game_state->dealer_card_count);
- uint8_t player_score = hand_count(game_state->player_cards, game_state->player_card_count);
-
- if(dealer_score >= DEALER_MAX) {
- if(dealer_score > 21 || dealer_score < player_score) {
- dolphin_deed(DolphinDeedPluginGameWin);
- enqueue(
- &(game_state->queue_state),
- game_state,
- win,
- NULL,
- to_win_state,
- game_state->settings.message_duration);
- } else if(dealer_score > player_score) {
- enqueue(
- &(game_state->queue_state),
- game_state,
- lose,
- NULL,
- to_lose_state,
- game_state->settings.message_duration);
- } else if(dealer_score == player_score) {
- enqueue(
- &(game_state->queue_state),
- game_state,
- draw,
- NULL,
- to_draw_state,
- game_state->settings.message_duration);
- }
- } else {
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawDealerCard,
- NULL,
- dealer_card_animation,
- game_state->settings.animation_duration);
- }
-}
-
-void settings_tick(GameState* game_state) {
- if(game_state->selectDirection == DirectionDown && game_state->selectedMenu < 4) {
- game_state->selectedMenu++;
- }
- if(game_state->selectDirection == DirectionUp && game_state->selectedMenu > 0) {
- game_state->selectedMenu--;
- }
-
- if(game_state->selectDirection == DirectionLeft ||
- game_state->selectDirection == DirectionRight) {
- int nextScore = 0;
- switch(game_state->selectedMenu) {
- case 0:
- nextScore = game_state->settings.starting_money;
- if(game_state->selectDirection == DirectionLeft)
- nextScore -= 10;
- else
- nextScore += 10;
- if(nextScore >= (int)game_state->settings.round_price && nextScore < 400)
- game_state->settings.starting_money = nextScore;
- break;
- case 1:
- nextScore = game_state->settings.round_price;
- if(game_state->selectDirection == DirectionLeft)
- nextScore -= 10;
- else
- nextScore += 10;
- if(nextScore >= 5 && nextScore <= (int)game_state->settings.starting_money)
- game_state->settings.round_price = nextScore;
- break;
- case 2:
- nextScore = game_state->settings.animation_duration;
- if(game_state->selectDirection == DirectionLeft)
- nextScore -= 100;
- else
- nextScore += 100;
- if(nextScore >= 0 && nextScore < 2000)
- game_state->settings.animation_duration = nextScore;
- break;
- case 3:
- nextScore = game_state->settings.message_duration;
- if(game_state->selectDirection == DirectionLeft)
- nextScore -= 100;
- else
- nextScore += 100;
- if(nextScore >= 0 && nextScore < 2000)
- game_state->settings.message_duration = nextScore;
- break;
- case 4:
- game_state->settings.sound_effects = !game_state->settings.sound_effects;
- default:
- break;
- }
- }
-}
-
-void tick(GameState* game_state) {
- game_state->last_tick = furi_get_tick();
- bool queue_ran = run_queue(&(game_state->queue_state), game_state);
-
- switch(game_state->state) {
- case GameStateGameOver:
- case GameStateStart:
- if(game_state->selectDirection == Select)
- init(game_state);
- else if(game_state->selectDirection == DirectionRight) {
- game_state->selectedMenu = 0;
- game_state->state = GameStateSettings;
- }
- break;
- case GameStatePlay:
- if(!game_state->started) {
- game_state->selectedMenu = 0;
- game_state->started = true;
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawDealerCard,
- NULL,
- dealer_back_card_animation,
- game_state->settings.animation_duration);
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawPlayerCard,
- NULL,
- player_card_animation,
- game_state->settings.animation_duration);
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawDealerCard,
- NULL,
- dealer_card_animation,
- game_state->settings.animation_duration);
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawPlayerCard,
- NULL,
- player_card_animation,
- game_state->settings.animation_duration);
- }
- if(!queue_ran) player_tick(game_state);
- break;
- case GameStateDealer:
- if(!queue_ran) dealer_tick(game_state);
- break;
- case GameStateSettings:
- settings_tick(game_state);
- break;
- default:
- break;
- }
-
- game_state->selectDirection = None;
-}
-
-void start_round(GameState* game_state) {
- game_state->menu->current_menu = 1;
- game_state->player_card_count = 0;
- game_state->dealer_card_count = 0;
- set_menu_state(game_state->menu, 0, true);
- game_state->menu->enabled = true;
- game_state->started = false;
- game_state->doubled = false;
- game_state->queue_state.running = true;
- shuffle_deck(&(game_state->deck));
- game_state->doubled = false;
- game_state->bet = game_state->settings.round_price;
- if(game_state->player_score < game_state->settings.round_price) {
- game_state->state = GameStateGameOver;
- } else {
- game_state->player_score -= game_state->settings.round_price;
- }
- game_state->state = GameStatePlay;
-}
-
-void init(GameState* game_state) {
- set_menu_state(game_state->menu, 0, true);
- game_state->menu->enabled = true;
- game_state->menu->current_menu = 1;
- game_state->settings = load_settings();
- game_state->last_tick = 0;
- game_state->processing = true;
- game_state->selectedMenu = 0;
- game_state->player_score = game_state->settings.starting_money;
- generate_deck(&(game_state->deck), 6);
- start_round(game_state);
-}
-
-static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
- furi_assert(event_queue);
- AppEvent event = {.type = EventTypeKey, .input = *input_event};
- furi_message_queue_put(event_queue, &event, FuriWaitForever);
-}
-
-static void update_timer_callback(FuriMessageQueue* event_queue) {
- furi_assert(event_queue);
- AppEvent event = {.type = EventTypeTick};
- furi_message_queue_put(event_queue, &event, 0);
-}
-
-void doubleAction(void* state) {
- GameState* game_state = state;
- if(!game_state->doubled && game_state->player_score >= game_state->settings.round_price) {
- game_state->player_score -= game_state->settings.round_price;
- game_state->bet += game_state->settings.round_price;
- game_state->doubled = true;
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawPlayerCard,
- NULL,
- player_card_animation,
- game_state->settings.animation_duration);
- game_state->player_cards[game_state->player_card_count] =
- game_state->deck.cards[game_state->deck.index];
- uint8_t score = hand_count(game_state->player_cards, game_state->player_card_count + 1);
- if(score > 21) {
- enqueue(
- &(game_state->queue_state),
- game_state,
- lose,
- NULL,
- to_bust_state,
- game_state->settings.message_duration);
- } else {
- enqueue(
- &(game_state->queue_state),
- game_state,
- dealerTurn,
- NULL,
- to_dealer_turn,
- game_state->settings.message_duration);
- }
- set_menu_state(game_state->menu, 0, false);
- }
-}
-
-void hitAction(void* state) {
- GameState* game_state = state;
- enqueue(
- &(game_state->queue_state),
- game_state,
- drawPlayerCard,
- NULL,
- player_card_animation,
- game_state->settings.animation_duration);
-}
-void stayAction(void* state) {
- GameState* game_state = state;
- enqueue(
- &(game_state->queue_state),
- game_state,
- dealerTurn,
- NULL,
- to_dealer_turn,
- game_state->settings.message_duration);
-}
-
-int32_t blackjack_app(void* p) {
- UNUSED(p);
-
- int32_t return_code = 0;
-
- FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(AppEvent));
-
- GameState* game_state = malloc(sizeof(GameState));
- game_state->menu = malloc(sizeof(Menu));
- game_state->menu->menu_width = 40;
- init(game_state);
- add_menu(game_state->menu, "Double", doubleAction);
- add_menu(game_state->menu, "Hit", hitAction);
- add_menu(game_state->menu, "Stay", stayAction);
- set_card_graphics(&I_card_graphics);
-
- game_state->state = GameStateStart;
-
- game_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
- if(!game_state->mutex) {
- FURI_LOG_E(APP_NAME, "cannot create mutex\r\n");
- return_code = 255;
- goto free_and_exit;
- }
-
- ViewPort* view_port = view_port_alloc();
- view_port_draw_callback_set(view_port, render_callback, game_state);
- view_port_input_callback_set(view_port, input_callback, event_queue);
-
- FuriTimer* timer = furi_timer_alloc(update_timer_callback, FuriTimerTypePeriodic, event_queue);
- furi_timer_start(timer, furi_kernel_get_tick_frequency() / 25);
-
- Gui* gui = furi_record_open(RECORD_GUI);
- gui_add_view_port(gui, view_port, GuiLayerFullscreen);
-
- AppEvent event;
-
- // Call dolphin deed on game start
- dolphin_deed(DolphinDeedPluginGameStart);
-
- for(bool processing = true; processing;) {
- FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
- furi_mutex_acquire(game_state->mutex, FuriWaitForever);
- if(event_status == FuriStatusOk) {
- if(event.type == EventTypeKey) {
- if(event.input.type == InputTypePress) {
- switch(event.input.key) {
- case InputKeyUp:
- game_state->selectDirection = DirectionUp;
- break;
- case InputKeyDown:
- game_state->selectDirection = DirectionDown;
- break;
- case InputKeyRight:
- game_state->selectDirection = DirectionRight;
- break;
- case InputKeyLeft:
- game_state->selectDirection = DirectionLeft;
- break;
- case InputKeyBack:
- if(game_state->state == GameStateSettings) {
- game_state->state = GameStateStart;
- save_settings(game_state->settings);
- } else
- processing = false;
- break;
- case InputKeyOk:
- game_state->selectDirection = Select;
- break;
- default:
- break;
- }
- }
- } else if(event.type == EventTypeTick) {
- tick(game_state);
- processing = game_state->processing;
- }
- }
- view_port_update(view_port);
- furi_mutex_release(game_state->mutex);
- }
-
- furi_timer_free(timer);
- view_port_enabled_set(view_port, false);
- gui_remove_view_port(gui, view_port);
- furi_record_close(RECORD_GUI);
- view_port_free(view_port);
- furi_mutex_free(game_state->mutex);
-
-free_and_exit:
- free(game_state->deck.cards);
- free_menu(game_state->menu);
- queue_clear(&(game_state->queue_state));
- free(game_state);
- furi_message_queue_free(event_queue);
-
- return return_code;
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/blackjack_10px.png b/applications/external/blackjack/blackjack_10px.png
deleted file mode 100644
index 7382d6358..000000000
Binary files a/applications/external/blackjack/blackjack_10px.png and /dev/null differ
diff --git a/applications/external/blackjack/common/card.c b/applications/external/blackjack/common/card.c
deleted file mode 100644
index 88228fda4..000000000
--- a/applications/external/blackjack/common/card.c
+++ /dev/null
@@ -1,353 +0,0 @@
-#include "card.h"
-#include "dml.h"
-#include "ui.h"
-
-#define CARD_DRAW_X_START 108
-#define CARD_DRAW_Y_START 38
-#define CARD_DRAW_X_SPACE 10
-#define CARD_DRAW_Y_SPACE 8
-#define CARD_DRAW_X_OFFSET 4
-#define CARD_DRAW_FIRST_ROW_LENGTH 7
-
-uint8_t pips[4][3] = {
- {21, 10, 7}, //spades
- {7, 10, 7}, //hearts
- {0, 10, 7}, //diamonds
- {14, 10, 7}, //clubs
-};
-uint8_t letters[13][3] = {
- {0, 0, 5},
- {5, 0, 5},
- {10, 0, 5},
- {15, 0, 5},
- {20, 0, 5},
- {25, 0, 5},
- {30, 0, 5},
- {0, 5, 5},
- {5, 5, 5},
- {10, 5, 5},
- {15, 5, 5},
- {20, 5, 5},
- {25, 5, 5},
-};
-
-//region Player card positions
-uint8_t playerCardPositions[22][4] = {
- //first row
- {108, 38},
- {98, 38},
- {88, 38},
- {78, 38},
- {68, 38},
- {58, 38},
- {48, 38},
- {38, 38},
- //second row
- {104, 26},
- {94, 26},
- {84, 26},
- {74, 26},
- {64, 26},
- {54, 26},
- {44, 26},
- //third row
- {99, 14},
- {89, 14},
- {79, 14},
- {69, 14},
- {59, 14},
- {49, 14},
-};
-//endregion
-Icon* card_graphics = NULL;
-
-void set_card_graphics(const Icon* graphics) {
- card_graphics = (Icon*)graphics;
-}
-
-void draw_card_at_colored(
- int8_t pos_x,
- int8_t pos_y,
- uint8_t pip,
- uint8_t character,
- bool inverted,
- Canvas* const canvas) {
- DrawMode primary = inverted ? Black : White;
- DrawMode secondary = inverted ? White : Black;
- draw_rounded_box(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, primary);
- draw_rounded_box_frame(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, Black);
-
- uint8_t* drawInfo = pips[pip];
- uint8_t px = drawInfo[0], py = drawInfo[1], s = drawInfo[2];
-
- uint8_t left = pos_x + 2;
- uint8_t right = (pos_x + CARD_WIDTH - s - 2);
- uint8_t top = pos_y + 2;
- uint8_t bottom = (pos_y + CARD_HEIGHT - s - 2);
-
- draw_icon_clip(canvas, card_graphics, right, top, px, py, s, s, secondary);
- draw_icon_clip_flipped(canvas, card_graphics, left, bottom, px, py, s, s, secondary);
-
- drawInfo = letters[character];
- px = drawInfo[0], py = drawInfo[1], s = drawInfo[2];
- left = pos_x + 2;
- right = (pos_x + CARD_WIDTH - s - 2);
- top = pos_y + 2;
- bottom = (pos_y + CARD_HEIGHT - s - 2);
-
- draw_icon_clip(canvas, card_graphics, left, top + 1, px, py, s, s, secondary);
- draw_icon_clip_flipped(canvas, card_graphics, right, bottom - 1, px, py, s, s, secondary);
-}
-
-void draw_card_at(int8_t pos_x, int8_t pos_y, uint8_t pip, uint8_t character, Canvas* const canvas) {
- draw_card_at_colored(pos_x, pos_y, pip, character, false, canvas);
-}
-
-void draw_deck(const Card* cards, uint8_t count, Canvas* const canvas) {
- for(int i = count - 1; i >= 0; i--) {
- draw_card_at(
- playerCardPositions[i][0],
- playerCardPositions[i][1],
- cards[i].pip,
- cards[i].character,
- canvas);
- }
-}
-
-Vector card_pos_at_index(uint8_t index) {
- return (Vector){playerCardPositions[index][0], playerCardPositions[index][1]};
-}
-
-void draw_card_back_at(int8_t pos_x, int8_t pos_y, Canvas* const canvas) {
- draw_rounded_box(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, White);
- draw_rounded_box_frame(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, Black);
-
- draw_icon_clip(canvas, card_graphics, pos_x + 1, pos_y + 1, 35, 0, 15, 21, Black);
-}
-
-void generate_deck(Deck* deck_ptr, uint8_t deck_count) {
- uint16_t counter = 0;
- if(deck_ptr->cards != NULL) {
- free(deck_ptr->cards);
- }
-
- deck_ptr->deck_count = deck_count;
- deck_ptr->card_count = deck_count * 52;
- deck_ptr->cards = malloc(sizeof(Card) * deck_ptr->card_count);
-
- for(uint8_t deck = 0; deck < deck_count; deck++) {
- for(uint8_t pip = 0; pip < 4; pip++) {
- for(uint8_t label = 0; label < 13; label++) {
- deck_ptr->cards[counter] = (Card){pip, label, false, false};
- counter++;
- }
- }
- }
-}
-
-void shuffle_deck(Deck* deck_ptr) {
- srand(DWT->CYCCNT);
- deck_ptr->index = 0;
- int max = deck_ptr->deck_count * 52;
- for(int i = 0; i < max; i++) {
- int r = i + (rand() % (max - i));
- Card tmp = deck_ptr->cards[i];
- deck_ptr->cards[i] = deck_ptr->cards[r];
- deck_ptr->cards[r] = tmp;
- }
-}
-
-uint8_t hand_count(const Card* cards, uint8_t count) {
- uint8_t aceCount = 0;
- uint8_t score = 0;
-
- for(uint8_t i = 0; i < count; i++) {
- if(cards[i].character == 12)
- aceCount++;
- else {
- if(cards[i].character > 8)
- score += 10;
- else
- score += cards[i].character + 2;
- }
- }
-
- for(uint8_t i = 0; i < aceCount; i++) {
- if((score + 11 + (aceCount - 1)) <= 21)
- score += 11;
- else
- score++;
- }
-
- return score;
-}
-
-void draw_card_animation(
- Card animatingCard,
- Vector from,
- Vector control,
- Vector to,
- float t,
- bool extra_margin,
- Canvas* const canvas) {
- float time = t;
- if(extra_margin) {
- time += 0.2;
- }
-
- Vector currentPos = quadratic_2d(from, control, to, time);
- if(t > 1) {
- draw_card_at(
- currentPos.x, currentPos.y, animatingCard.pip, animatingCard.character, canvas);
- } else {
- if(t < 0.5)
- draw_card_back_at(currentPos.x, currentPos.y, canvas);
- else
- draw_card_at(
- currentPos.x, currentPos.y, animatingCard.pip, animatingCard.character, canvas);
- }
-}
-
-void init_hand(Hand* hand_ptr, uint8_t count) {
- hand_ptr->cards = malloc(sizeof(Card) * count);
- hand_ptr->index = 0;
- hand_ptr->max = count;
-}
-
-void free_hand(Hand* hand_ptr) {
- FURI_LOG_D("CARD", "Freeing hand");
- free(hand_ptr->cards);
-}
-
-void add_to_hand(Hand* hand_ptr, Card card) {
- FURI_LOG_D("CARD", "Adding to hand");
- if(hand_ptr->index < hand_ptr->max) {
- hand_ptr->cards[hand_ptr->index] = card;
- hand_ptr->index++;
- }
-}
-
-void draw_card_space(int16_t pos_x, int16_t pos_y, bool highlighted, Canvas* const canvas) {
- if(highlighted) {
- draw_rounded_box_frame(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, Black);
- draw_rounded_box_frame(
- canvas, pos_x + 2, pos_y + 2, CARD_WIDTH - 4, CARD_HEIGHT - 4, White);
- } else {
- draw_rounded_box(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, Black);
- draw_rounded_box_frame(
- canvas, pos_x + 2, pos_y + 2, CARD_WIDTH - 4, CARD_HEIGHT - 4, White);
- }
-}
-
-int first_non_flipped_card(Hand hand) {
- for(int i = 0; i < hand.index; i++) {
- if(!hand.cards[i].flipped) {
- return i;
- }
- }
- return hand.index;
-}
-
-void draw_hand_column(
- Hand hand,
- int16_t pos_x,
- int16_t pos_y,
- int8_t highlight,
- Canvas* const canvas) {
- if(hand.index == 0) {
- draw_card_space(pos_x, pos_y, highlight > 0, canvas);
- if(highlight == 0)
- draw_rounded_box(canvas, pos_x, pos_y, CARD_WIDTH, CARD_HEIGHT, Inverse);
- return;
- }
-
- int loopEnd = hand.index;
- int hStart = max(loopEnd - 4, 0);
- int pos = 0;
- int first = first_non_flipped_card(hand);
- bool wastop = false;
- if(first >= 0 && first <= hStart && highlight != first) {
- if(first > 0) {
- draw_card_back_at(pos_x, pos_y + pos, canvas);
- pos += 4;
- hStart++;
- wastop = true;
- }
- draw_card_at_colored(
- pos_x, pos_y + pos, hand.cards[first].pip, hand.cards[first].character, false, canvas);
- pos += 8;
- hStart++;
- }
- if(hStart > highlight && highlight >= 0) {
- if(!wastop && first > 0) {
- draw_card_back_at(pos_x, pos_y + pos, canvas);
- pos += 4;
- hStart++;
- }
- draw_card_at_colored(
- pos_x,
- pos_y + pos,
- hand.cards[highlight].pip,
- hand.cards[highlight].character,
- true,
- canvas);
- pos += 8;
- hStart++;
- }
- for(int i = hStart; i < loopEnd; i++, pos += 4) {
- if(hand.cards[i].flipped) {
- draw_card_back_at(pos_x, pos_y + pos, canvas);
- if(i == highlight)
- draw_rounded_box(
- canvas, pos_x + 1, pos_y + pos + 1, CARD_WIDTH - 2, CARD_HEIGHT - 2, Inverse);
- } else {
- draw_card_at_colored(
- pos_x,
- pos_y + pos,
- hand.cards[i].pip,
- hand.cards[i].character,
- (i == highlight),
- canvas);
- if(i == highlight || i == first) pos += 4;
- }
- }
-}
-
-Card remove_from_deck(uint16_t index, Deck* deck) {
- FURI_LOG_D("CARD", "Removing from deck");
- Card result = {0, 0, true, false};
- if(deck->card_count > 0) {
- deck->card_count--;
- for(int i = 0, curr_index = 0; i <= deck->card_count; i++) {
- if(i != index) {
- deck->cards[curr_index] = deck->cards[i];
- curr_index++;
- } else {
- result = deck->cards[i];
- }
- }
- if(deck->index >= 0) {
- deck->index--;
- }
- }
- return result;
-}
-
-void extract_hand_region(Hand* hand, Hand* to, uint8_t start_index) {
- FURI_LOG_D("CARD", "Extracting hand region");
- if(start_index >= hand->index) return;
-
- for(uint8_t i = start_index; i < hand->index; i++) {
- add_to_hand(to, hand->cards[i]);
- }
- hand->index = start_index;
-}
-
-void add_hand_region(Hand* to, Hand* from) {
- FURI_LOG_D("CARD", "Adding hand region");
- if((to->index + from->index) <= to->max) {
- for(int i = 0; i < from->index; i++) {
- add_to_hand(to, from->cards[i]);
- }
- }
-}
diff --git a/applications/external/blackjack/common/card.h b/applications/external/blackjack/common/card.h
deleted file mode 100644
index 8e5e23bbf..000000000
--- a/applications/external/blackjack/common/card.h
+++ /dev/null
@@ -1,192 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-#include "dml.h"
-
-#define CARD_HEIGHT 23
-#define CARD_HALF_HEIGHT 11
-#define CARD_WIDTH 17
-#define CARD_HALF_WIDTH 8
-
-//region types
-typedef struct {
- uint8_t pip; //Pip index 0:spades, 1:hearths, 2:diamonds, 3:clubs
- uint8_t character; //Card letter [0-12], 0 means 2, 12 is Ace
- bool disabled;
- bool flipped;
-} Card;
-
-typedef struct {
- uint8_t deck_count; //Number of decks used
- Card* cards; //Cards in the deck
- int card_count;
- int index; //Card index (to know where we at in the deck)
-} Deck;
-
-typedef struct {
- Card* cards; //Cards in the deck
- uint8_t index; //Current index
- uint8_t max; //How many cards we want to store
-} Hand;
-//endregion
-
-void set_card_graphics(const Icon* graphics);
-
-/**
- * Gets card coordinates at the index (range: 0-20).
- *
- * @param index Index to check 0-20
- * @return Position of the card
- */
-Vector card_pos_at_index(uint8_t index);
-
-/**
- * Draws card at a given coordinate (top-left corner)
- *
- * @param pos_x X position
- * @param pos_y Y position
- * @param pip Pip index 0:spades, 1:hearths, 2:diamonds, 3:clubs
- * @param character Letter [0-12] 0 is 2, 12 is A
- * @param canvas Pointer to Flipper's canvas object
- */
-void draw_card_at(int8_t pos_x, int8_t pos_y, uint8_t pip, uint8_t character, Canvas* const canvas);
-
-/**
- * Draws card at a given coordinate (top-left corner)
- *
- * @param pos_x X position
- * @param pos_y Y position
- * @param pip Pip index 0:spades, 1:hearths, 2:diamonds, 3:clubs
- * @param character Letter [0-12] 0 is 2, 12 is A
- * @param inverted Invert colors
- * @param canvas Pointer to Flipper's canvas object
- */
-void draw_card_at_colored(
- int8_t pos_x,
- int8_t pos_y,
- uint8_t pip,
- uint8_t character,
- bool inverted,
- Canvas* const canvas);
-
-/**
- * Draws 'count' cards at the bottom right corner
- *
- * @param cards List of cards
- * @param count Count of cards
- * @param canvas Pointer to Flipper's canvas object
- */
-void draw_deck(const Card* cards, uint8_t count, Canvas* const canvas);
-
-/**
- * Draws card back at a given coordinate (top-left corner)
- *
- * @param pos_x X coordinate
- * @param pos_y Y coordinate
- * @param canvas Pointer to Flipper's canvas object
- */
-void draw_card_back_at(int8_t pos_x, int8_t pos_y, Canvas* const canvas);
-
-/**
- * Generates the deck
- *
- * @param deck_ptr Pointer to the deck
- * @param deck_count Number of decks
- */
-void generate_deck(Deck* deck_ptr, uint8_t deck_count);
-
-/**
- * Shuffles the deck
- *
- * @param deck_ptr Pointer to the deck
- */
-void shuffle_deck(Deck* deck_ptr);
-
-/**
- * Calculates the hand count for blackjack
- *
- * @param cards List of cards
- * @param count Count of cards
- * @return Hand value
- */
-uint8_t hand_count(const Card* cards, uint8_t count);
-
-/**
- * Draws card animation
- *
- * @param animatingCard Card to animate
- * @param from Starting position
- * @param control Quadratic lerp control point
- * @param to End point
- * @param t Current time (0-1)
- * @param extra_margin Use extra margin at the end (arrives 0.2 unit before the end so it can stay there a bit)
- * @param canvas Pointer to Flipper's canvas object
- */
-void draw_card_animation(
- Card animatingCard,
- Vector from,
- Vector control,
- Vector to,
- float t,
- bool extra_margin,
- Canvas* const canvas);
-
-/**
- * Init hand pointer
- * @param hand_ptr Pointer to hand
- * @param count Number of cards we want to store
- */
-void init_hand(Hand* hand_ptr, uint8_t count);
-
-/**
- * Free hand resources
- * @param hand_ptr Pointer to hand
- */
-void free_hand(Hand* hand_ptr);
-
-/**
- * Add card to hand
- * @param hand_ptr Pointer to hand
- * @param card Card to add
- */
-void add_to_hand(Hand* hand_ptr, Card card);
-
-/**
- * Draw card placement position at coordinate
- * @param pos_x X coordinate
- * @param pos_y Y coordinate
- * @param highlighted Apply highlight effect
- * @param canvas Canvas object
- */
-void draw_card_space(int16_t pos_x, int16_t pos_y, bool highlighted, Canvas* const canvas);
-
-/**
- * Draws a column of card, displaying the last [max_cards] cards on the list
- * @param hand Hand object
- * @param pos_x X coordinate to draw
- * @param pos_y Y coordinate to draw
- * @param highlight Index to highlight, negative means no highlight
- * @param canvas Canvas object
- */
-void draw_hand_column(
- Hand hand,
- int16_t pos_x,
- int16_t pos_y,
- int8_t highlight,
- Canvas* const canvas);
-
-/**
- * Removes a card from the deck (Be aware, if you remove the first item, the deck index will be at -1 so you have to handle that)
- * @param index Index to remove
- * @param deck Deck reference
- * @return The removed card
- */
-Card remove_from_deck(uint16_t index, Deck* deck);
-
-int first_non_flipped_card(Hand hand);
-
-void extract_hand_region(Hand* hand, Hand* to, uint8_t start_index);
-
-void add_hand_region(Hand* to, Hand* from);
\ No newline at end of file
diff --git a/applications/external/blackjack/common/dml.c b/applications/external/blackjack/common/dml.c
deleted file mode 100644
index b9a0e395f..000000000
--- a/applications/external/blackjack/common/dml.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "dml.h"
-#include
-
-float lerp(float v0, float v1, float t) {
- if(t > 1) return v1;
- return (1 - t) * v0 + t * v1;
-}
-
-Vector lerp_2d(Vector start, Vector end, float t) {
- return (Vector){
- lerp(start.x, end.x, t),
- lerp(start.y, end.y, t),
- };
-}
-
-Vector quadratic_2d(Vector start, Vector control, Vector end, float t) {
- return lerp_2d(lerp_2d(start, control, t), lerp_2d(control, end, t), t);
-}
-
-Vector vector_add(Vector a, Vector b) {
- return (Vector){a.x + b.x, a.y + b.y};
-}
-
-Vector vector_sub(Vector a, Vector b) {
- return (Vector){a.x - b.x, a.y - b.y};
-}
-
-Vector vector_mul_components(Vector a, Vector b) {
- return (Vector){a.x * b.x, a.y * b.y};
-}
-
-Vector vector_div_components(Vector a, Vector b) {
- return (Vector){a.x / b.x, a.y / b.y};
-}
-
-Vector vector_normalized(Vector a) {
- float length = vector_magnitude(a);
- return (Vector){a.x / length, a.y / length};
-}
-
-float vector_magnitude(Vector a) {
- return sqrt(a.x * a.x + a.y * a.y);
-}
-
-float vector_distance(Vector a, Vector b) {
- return vector_magnitude(vector_sub(a, b));
-}
-
-float vector_dot(Vector a, Vector b) {
- Vector _a = vector_normalized(a);
- Vector _b = vector_normalized(b);
- return _a.x * _b.x + _a.y * _b.y;
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/common/dml.h b/applications/external/blackjack/common/dml.h
deleted file mode 100644
index 0e1a23e23..000000000
--- a/applications/external/blackjack/common/dml.h
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// Doofy's Math library
-//
-
-#pragma once
-
-typedef struct {
- float x;
- float y;
-} Vector;
-
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#define max(a, b) ((a) > (b) ? (a) : (b))
-#define abs(x) ((x) > 0 ? (x) : -(x))
-
-/**
- * Lerp function
- *
- * @param v0 Start value
- * @param v1 End value
- * @param t Time (0-1 range)
- * @return Point between v0-v1 at a given time
- */
-float lerp(float v0, float v1, float t);
-
-/**
- * 2D lerp function
- *
- * @param start Start vector
- * @param end End vector
- * @param t Time (0-1 range)
- * @return 2d Vector between start and end at time
- */
-Vector lerp_2d(Vector start, Vector end, float t);
-
-/**
- * Quadratic lerp function
- *
- * @param start Start vector
- * @param control Control point
- * @param end End vector
- * @param t Time (0-1 range)
- * @return 2d Vector at time
- */
-Vector quadratic_2d(Vector start, Vector control, Vector end, float t);
-
-/**
- * Add vector components together
- *
- * @param a First vector
- * @param b Second vector
- * @return Resulting vector
- */
-Vector vector_add(Vector a, Vector b);
-
-/**
- * Subtract vector components together
- *
- * @param a First vector
- * @param b Second vector
- * @return Resulting vector
- */
-Vector vector_sub(Vector a, Vector b);
-
-/**
- * Multiplying vector components together
- *
- * @param a First vector
- * @param b Second vector
- * @return Resulting vector
- */
-Vector vector_mul_components(Vector a, Vector b);
-
-/**
- * Dividing vector components
- *
- * @param a First vector
- * @param b Second vector
- * @return Resulting vector
- */
-Vector vector_div_components(Vector a, Vector b);
-
-/**
- * Calculating Vector length
- *
- * @param a Direction vector
- * @return Length of the vector
- */
-float vector_magnitude(Vector a);
-
-/**
- * Get a normalized vector (length of 1)
- *
- * @param a Direction vector
- * @return Normalized vector
- */
-Vector vector_normalized(Vector a);
-
-/**
- * Calculate two vector's distance
- *
- * @param a First vector
- * @param b Second vector
- * @return Distance between vectors
- */
-float vector_distance(Vector a, Vector b);
-
-/**
- * Calculate the dot product of the vectors.
- * No need to normalize, it will do it
- *
- * @param a First vector
- * @param b Second vector
- * @return value from -1 to 1
- */
-float vector_dot(Vector a, Vector b);
diff --git a/applications/external/blackjack/common/menu.c b/applications/external/blackjack/common/menu.c
deleted file mode 100644
index ffc3921b7..000000000
--- a/applications/external/blackjack/common/menu.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include "menu.h"
-
-void add_menu(Menu* menu, const char* name, void (*callback)(void*)) {
- MenuItem* items = menu->items;
-
- menu->items = malloc(sizeof(MenuItem) * (menu->menu_count + 1));
- for(uint8_t i = 0; i < menu->menu_count; i++) {
- menu->items[i] = items[i];
- }
- free(items);
-
- menu->items[menu->menu_count] = (MenuItem){name, true, callback};
- menu->menu_count++;
-}
-
-void free_menu(Menu* menu) {
- free(menu->items);
- free(menu);
-}
-
-void set_menu_state(Menu* menu, uint8_t index, bool state) {
- if(menu->menu_count > index) {
- menu->items[index].enabled = state;
- }
- if(!state && menu->current_menu == index) move_menu(menu, 1);
-}
-
-void move_menu(Menu* menu, int8_t direction) {
- if(!menu->enabled) return;
- int max = menu->menu_count;
- for(int8_t i = 0; i < max; i++) {
- FURI_LOG_D(
- "MENU",
- "Iteration %i, current %i, direction %i, state %i",
- i,
- menu->current_menu,
- direction,
- menu->items[menu->current_menu].enabled ? 1 : 0);
- if(direction < 0 && menu->current_menu == 0) {
- menu->current_menu = menu->menu_count - 1;
- } else {
- menu->current_menu = (menu->current_menu + direction) % menu->menu_count;
- }
- FURI_LOG_D(
- "MENU",
- "After process current %i, direction %i, state %i",
- menu->current_menu,
- direction,
- menu->items[menu->current_menu].enabled ? 1 : 0);
- if(menu->items[menu->current_menu].enabled) {
- FURI_LOG_D("MENU", "Next menu %i", menu->current_menu);
- return;
- }
- }
- FURI_LOG_D("MENU", "Not found, setting false");
- menu->enabled = false;
-}
-
-void activate_menu(Menu* menu, void* state) {
- if(!menu->enabled) return;
- menu->items[menu->current_menu].callback(state);
-}
-
-void render_menu(Menu* menu, Canvas* canvas, uint8_t pos_x, uint8_t pos_y) {
- if(!menu->enabled) return;
- canvas_set_color(canvas, ColorWhite);
- canvas_draw_rbox(canvas, pos_x, pos_y, menu->menu_width + 2, 10, 2);
-
- uint8_t w = pos_x + menu->menu_width;
- uint8_t h = pos_y + 10;
- uint8_t p1x = pos_x + 2;
- uint8_t p2x = pos_x + menu->menu_width - 2;
- uint8_t p1y = pos_y + 2;
- uint8_t p2y = pos_y + 8;
-
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_line(canvas, p1x, pos_y, p2x, pos_y);
- canvas_draw_line(canvas, p1x, h, p2x, h);
- canvas_draw_line(canvas, pos_x, p1y, pos_x, p2y);
- canvas_draw_line(canvas, w, p1y, w, p2y);
- canvas_draw_dot(canvas, pos_x + 1, pos_y + 1);
- canvas_draw_dot(canvas, w - 1, pos_y + 1);
- canvas_draw_dot(canvas, w - 1, h - 1);
- canvas_draw_dot(canvas, pos_x + 1, h - 1);
-
- // canvas_draw_rbox(canvas, pos_x, pos_y, menu->menu_width + 2, 10, 2);
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str_aligned(
- canvas,
- pos_x + menu->menu_width / 2,
- pos_y + 6,
- AlignCenter,
- AlignCenter,
- menu->items[menu->current_menu].name);
- //9*5
- int center = pos_x + menu->menu_width / 2;
- for(uint8_t i = 0; i < 4; i++) {
- for(int8_t j = -i; j <= i; j++) {
- canvas_draw_dot(canvas, center + j, pos_y - 4 + i);
- canvas_draw_dot(canvas, center + j, pos_y + 14 - i);
- }
- }
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/common/menu.h b/applications/external/blackjack/common/menu.h
deleted file mode 100644
index 9f2852522..000000000
--- a/applications/external/blackjack/common/menu.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#pragma once
-
-#include
-#include
-
-typedef struct {
- const char* name; //Name of the menu
- bool enabled; //Is the menu item enabled (it will not render, you cannot select it)
-
- void (*callback)(
- void* state); //Callback for when the activate_menu is called while this menu is selected
-} MenuItem;
-
-typedef struct {
- MenuItem* items; //list of menu items
- uint8_t menu_count; //count of menu items (do not change)
- uint8_t current_menu; //currently selected menu item
- uint8_t menu_width; //width of the menu
- bool enabled; //is the menu enabled (it will not render and accept events when disabled)
-} Menu;
-
-/**
- * Cleans up the pointers used by the menu
- *
- * @param menu Pointer of the menu to clean up
- */
-void free_menu(Menu* menu);
-
-/**
- * Add a new menu item
- *
- * @param menu Pointer of the menu
- * @param name Name of the menu item
- * @param callback Callback called on activation
- */
-void add_menu(Menu* menu, const char* name, void (*callback)(void*));
-
-/**
- * Setting menu item to be enabled/disabled
- *
- * @param menu Pointer of the menu
- * @param index Menu index to set
- * @param state Enabled (true), Disabled(false)
- */
-void set_menu_state(Menu* menu, uint8_t index, bool state);
-
-/**
- * Moves selection up or down
- *
- * @param menu Pointer of the menu
- * @param direction Direction to move -1 down, 1 up
- */
-void move_menu(Menu* menu, int8_t direction);
-
-/**
- * Triggers the current menu callback
- *
- * @param menu Pointer of the menu
- * @param state Usually your application state
- */
-void activate_menu(Menu* menu, void* state);
-
-/**
- * Renders the menu at a coordinate (call it in your render function).
- *
- * Keep in mind that Flipper has a 128x64 pixel screen resolution and the coordinate
- * you give is the menu's rectangle top-left corner (arrows not included).
- * The rectangle height is 10 px, the arrows have a 4 pixel height. Space needed is 18px.
- * The width of the menu can be configured in the menu object.
- *
- *
- * @param menu Pointer of the menu
- * @param canvas Flippers Canvas pointer
- * @param pos_x X position to draw
- * @param pos_y Y position to draw
- */
-void render_menu(Menu* menu, Canvas* canvas, uint8_t pos_x, uint8_t pos_y);
\ No newline at end of file
diff --git a/applications/external/blackjack/common/queue.c b/applications/external/blackjack/common/queue.c
deleted file mode 100644
index a80373460..000000000
--- a/applications/external/blackjack/common/queue.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "queue.h"
-
-void render_queue(const QueueState* queue_state, const void* app_state, Canvas* const canvas) {
- if(queue_state->current != NULL && queue_state->current->render != NULL)
- ((QueueItem*)queue_state->current)->render(app_state, canvas);
-}
-
-bool run_queue(QueueState* queue_state, void* app_state) {
- if(queue_state->current != NULL) {
- queue_state->running = true;
- if((furi_get_tick() - queue_state->start) >= queue_state->current->duration)
- dequeue(queue_state, app_state);
-
- return true;
- }
- return false;
-}
-
-void dequeue(QueueState* queue_state, void* app_state) {
- ((QueueItem*)queue_state->current)->callback(app_state);
- QueueItem* f = queue_state->current;
- queue_state->current = f->next;
- free(f);
- if(queue_state->current != NULL) {
- if(queue_state->current->start != NULL) queue_state->current->start(app_state);
- queue_state->start = furi_get_tick();
- } else {
- queue_state->running = false;
- }
-}
-
-void queue_clear(QueueState* queue_state) {
- queue_state->running = false;
- QueueItem* curr = queue_state->current;
- while(curr != NULL) {
- QueueItem* f = curr;
- curr = curr->next;
- free(f);
- }
-}
-
-void enqueue(
- QueueState* queue_state,
- void* app_state,
- void (*done)(void* state),
- void (*start)(void* state),
- void (*render)(const void* state, Canvas* const canvas),
- uint32_t duration) {
- QueueItem* next;
- if(queue_state->current == NULL) {
- queue_state->start = furi_get_tick();
- queue_state->current = malloc(sizeof(QueueItem));
- next = queue_state->current;
- if(next->start != NULL) next->start(app_state);
-
- } else {
- next = queue_state->current;
- while(next->next != NULL) {
- next = (QueueItem*)(next->next);
- }
- next->next = malloc(sizeof(QueueItem));
- next = next->next;
- }
- next->callback = done;
- next->render = render;
- next->start = start;
- next->duration = duration;
- next->next = NULL;
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/common/queue.h b/applications/external/blackjack/common/queue.h
deleted file mode 100644
index dcfe0c091..000000000
--- a/applications/external/blackjack/common/queue.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#pragma once
-
-#include
-#include
-
-typedef struct {
- void (*callback)(void* state); //Callback for when the item is dequeued
- void (*render)(
- const void* state,
- Canvas* const canvas); //Callback for the rendering loop while this item is running
- void (*start)(void* state); //Callback when this item is started running
- void* next; //Pointer to the next item
- uint32_t duration; //duration of the item
-} QueueItem;
-
-typedef struct {
- unsigned int start; //current queue item start time
- QueueItem* current; //current queue item
- bool running; //is the queue running
-} QueueState;
-
-/**
- * Enqueue a new item.
- *
- * @param queue_state The queue state pointer
- * @param app_state Your app state
- * @param done Callback for dequeue event
- * @param start Callback for when the item is activated
- * @param render Callback to render loop if needed
- * @param duration Length of the item
- */
-void enqueue(
- QueueState* queue_state,
- void* app_state,
- void (*done)(void* state),
- void (*start)(void* state),
- void (*render)(const void* state, Canvas* const canvas),
- uint32_t duration);
-/**
- * Clears all queue items
- *
- * @param queue_state The queue state pointer
- */
-void queue_clear(QueueState* queue_state);
-
-/**
- * Dequeues the active queue item. Usually you don't need to call it directly.
- *
- * @param queue_state The queue state pointer
- * @param app_state Your application state
- */
-void dequeue(QueueState* queue_state, void* app_state);
-
-/**
- * Runs the queue logic (place it in your tick function)
- *
- * @param queue_state The queue state pointer
- * @param app_state Your application state
- * @return FALSE when there is nothing to run, TRUE otherwise
- */
-bool run_queue(QueueState* queue_state, void* app_state);
-
-/**
- * Calls the currently active queue items render callback (if there is any)
- *
- * @param queue_state The queue state pointer
- * @param app_state Your application state
- * @param canvas Pointer to Flipper's canvas object
- */
-void render_queue(const QueueState* queue_state, const void* app_state, Canvas* const canvas);
\ No newline at end of file
diff --git a/applications/external/blackjack/common/ui.c b/applications/external/blackjack/common/ui.c
deleted file mode 100644
index 032877a9e..000000000
--- a/applications/external/blackjack/common/ui.c
+++ /dev/null
@@ -1,257 +0,0 @@
-#include "ui.h"
-#include
-#include
-#include
-#include
-#include
-#include
-
-TileMap* tileMap;
-uint8_t tileMapCount = 0;
-
-void ui_cleanup() {
- if(tileMap != NULL) {
- for(uint8_t i = 0; i < tileMapCount; i++) {
- if(tileMap[i].data != NULL) free(tileMap[i].data);
- }
- free(tileMap);
- }
-}
-
-void add_new_tilemap(uint8_t* data, unsigned long iconId) {
- TileMap* old = tileMap;
- tileMapCount++;
- tileMap = malloc(sizeof(TileMap) * tileMapCount);
- if(tileMapCount > 1) {
- for(uint8_t i = 0; i < tileMapCount; i++) tileMap[i] = old[i];
- }
- tileMap[tileMapCount - 1] = (TileMap){data, iconId};
-}
-
-uint8_t* get_tilemap(unsigned long icon_id) {
- for(uint8_t i = 0; i < tileMapCount; i++) {
- if(tileMap[i].iconId == icon_id) return tileMap[i].data;
- }
-
- return NULL;
-}
-
-uint32_t pixel_index(uint8_t x, uint8_t y) {
- return y * SCREEN_WIDTH + x;
-}
-
-bool in_screen(int16_t x, int16_t y) {
- return x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT;
-}
-
-unsigned flipBit(uint8_t x, uint8_t bit) {
- return x ^ (1 << bit);
-}
-
-unsigned setBit(uint8_t x, uint8_t bit) {
- return x | (1 << bit);
-}
-
-unsigned unsetBit(uint8_t x, uint8_t bit) {
- return x & ~(1 << bit);
-}
-
-bool test_pixel(uint8_t* data, uint8_t x, uint8_t y, uint8_t w) {
- uint8_t current_bit = (y % 8);
- uint8_t current_row = ((y - current_bit) / 8);
- uint8_t current_value = data[current_row * w + x];
- return current_value & (1 << current_bit);
-}
-
-uint8_t* get_buffer(Canvas* const canvas) {
- return canvas->fb.tile_buf_ptr;
- // return canvas_get_buffer(canvas);
-}
-uint8_t* make_buffer() {
- return malloc(sizeof(uint8_t) * 8 * 128);
-}
-void clone_buffer(uint8_t* canvas, uint8_t* data) {
- for(int i = 0; i < 1024; i++) {
- data[i] = canvas[i];
- }
-}
-
-bool read_pixel(Canvas* const canvas, int16_t x, int16_t y) {
- if(in_screen(x, y)) {
- return test_pixel(get_buffer(canvas), x, y, SCREEN_WIDTH);
- }
- return false;
-}
-
-void set_pixel(Canvas* const canvas, int16_t x, int16_t y, DrawMode draw_mode) {
- if(in_screen(x, y)) {
- uint8_t current_bit = (y % 8);
- uint8_t current_row = ((y - current_bit) / 8);
- uint32_t i = pixel_index(x, current_row);
- uint8_t* buffer = get_buffer(canvas);
-
- uint8_t current_value = buffer[i];
- if(draw_mode == Inverse) {
- buffer[i] = flipBit(current_value, current_bit);
- } else {
- if(draw_mode == White) {
- buffer[i] = unsetBit(current_value, current_bit);
- } else {
- buffer[i] = setBit(current_value, current_bit);
- }
- }
- }
-}
-
-void draw_line(
- Canvas* const canvas,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2,
- DrawMode draw_mode) {
- for(int16_t x = x2; x >= x1; x--) {
- for(int16_t y = y2; y >= y1; y--) {
- set_pixel(canvas, x, y, draw_mode);
- }
- }
-}
-
-void draw_rounded_box_frame(
- Canvas* const canvas,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode draw_mode) {
- int16_t xMinCorner = x + 1;
- int16_t xMax = x + w - 1;
- int16_t xMaxCorner = x + w - 2;
- int16_t yMinCorner = y + 1;
- int16_t yMax = y + h - 1;
- int16_t yMaxCorner = y + h - 2;
- draw_line(canvas, xMinCorner, y, xMaxCorner, y, draw_mode);
- draw_line(canvas, xMinCorner, yMax, xMaxCorner, yMax, draw_mode);
- draw_line(canvas, x, yMinCorner, x, yMaxCorner, draw_mode);
- draw_line(canvas, xMax, yMinCorner, xMax, yMaxCorner, draw_mode);
-}
-
-void draw_rounded_box(
- Canvas* const canvas,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode draw_mode) {
- for(int16_t o = w - 2; o >= 1; o--) {
- for(int16_t p = h - 2; p >= 1; p--) {
- set_pixel(canvas, x + o, y + p, draw_mode);
- }
- }
- draw_rounded_box_frame(canvas, x, y, w, h, draw_mode);
-}
-
-void invert_shape(Canvas* const canvas, uint8_t* data, int16_t x, int16_t y, uint8_t w, uint8_t h) {
- draw_pixels(canvas, data, x, y, w, h, Inverse);
-}
-
-void draw_pixels(
- Canvas* const canvas,
- uint8_t* data,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode) {
- for(int8_t o = 0; o < w; o++) {
- for(int8_t p = 0; p < h; p++) {
- if(in_screen(o + x, p + y) && data[p * w + o] == 1)
- set_pixel(canvas, o + x, p + y, drawMode);
- }
- }
-}
-
-void draw_rectangle(
- Canvas* const canvas,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode) {
- for(int8_t o = 0; o < w; o++) {
- for(int8_t p = 0; p < h; p++) {
- if(in_screen(o + x, p + y)) {
- set_pixel(canvas, o + x, p + y, drawMode);
- }
- }
- }
-}
-
-void invert_rectangle(Canvas* const canvas, int16_t x, int16_t y, uint8_t w, uint8_t h) {
- draw_rectangle(canvas, x, y, w, h, Inverse);
-}
-
-uint8_t* image_data(Canvas* const canvas, const Icon* icon) {
- uint8_t* data = malloc(sizeof(uint8_t) * 8 * 128);
- uint8_t* screen = canvas->fb.tile_buf_ptr;
- canvas->fb.tile_buf_ptr = data;
- canvas_draw_icon(canvas, 0, 0, icon);
- canvas->fb.tile_buf_ptr = screen;
- return data;
-}
-
-uint8_t* getOrAddIconData(Canvas* const canvas, const Icon* icon) {
- uint8_t* icon_data = get_tilemap((unsigned long)icon);
- if(icon_data == NULL) {
- icon_data = image_data(canvas, icon);
- add_new_tilemap(icon_data, (unsigned long)icon);
- }
- return icon_data;
-}
-
-void draw_icon_clip(
- Canvas* const canvas,
- const Icon* icon,
- int16_t x,
- int16_t y,
- uint8_t left,
- uint8_t top,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode) {
- uint8_t* icon_data = getOrAddIconData(canvas, icon);
-
- for(int i = 0; i < w; i++) {
- for(int j = 0; j < h; j++) {
- bool on = test_pixel(icon_data, left + i, top + j, SCREEN_WIDTH);
- if(drawMode == Filled) {
- set_pixel(canvas, x + i, y + j, on ? Black : White);
- } else if(on)
- set_pixel(canvas, x + i, y + j, drawMode);
- }
- }
-}
-
-void draw_icon_clip_flipped(
- Canvas* const canvas,
- const Icon* icon,
- int16_t x,
- int16_t y,
- uint8_t left,
- uint8_t top,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode) {
- uint8_t* icon_data = getOrAddIconData(canvas, icon);
-
- for(int i = 0; i < w; i++) {
- for(int j = 0; j < h; j++) {
- bool on = test_pixel(icon_data, left + i, top + j, SCREEN_WIDTH);
-
- if(drawMode == Filled) {
- set_pixel(canvas, x + w - i - 1, y + h - j - 1, on ? Black : White);
- } else if(on)
- set_pixel(canvas, x + w - i - 1, y + h - j - 1, drawMode);
- }
- }
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/common/ui.h b/applications/external/blackjack/common/ui.h
deleted file mode 100644
index 13d8da257..000000000
--- a/applications/external/blackjack/common/ui.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#pragma once
-
-#include
-#include
-
-#define SCREEN_WIDTH 128
-#define SCREEN_HEIGHT 64
-
-typedef enum {
- Black,
- White,
- Inverse,
- Filled //Currently only for Icon clip drawing
-} DrawMode;
-
-// size is the screen size
-
-typedef struct {
- uint8_t* data;
- unsigned long iconId;
-} TileMap;
-
-bool test_pixel(uint8_t* data, uint8_t x, uint8_t y, uint8_t w);
-
-uint8_t* image_data(Canvas* const canvas, const Icon* icon);
-
-uint32_t pixel_index(uint8_t x, uint8_t y);
-
-void draw_icon_clip(
- Canvas* const canvas,
- const Icon* icon,
- int16_t x,
- int16_t y,
- uint8_t left,
- uint8_t top,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode);
-
-void draw_icon_clip_flipped(
- Canvas* const canvas,
- const Icon* icon,
- int16_t x,
- int16_t y,
- uint8_t left,
- uint8_t top,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode);
-
-void draw_rounded_box(
- Canvas* const canvas,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode);
-
-void draw_rounded_box_frame(
- Canvas* const canvas,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode);
-
-void draw_rectangle(
- Canvas* const canvas,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode);
-
-void invert_rectangle(Canvas* const canvas, int16_t x, int16_t y, uint8_t w, uint8_t h);
-
-void invert_shape(Canvas* const canvas, uint8_t* data, int16_t x, int16_t y, uint8_t w, uint8_t h);
-
-void draw_pixels(
- Canvas* const canvas,
- uint8_t* data,
- int16_t x,
- int16_t y,
- uint8_t w,
- uint8_t h,
- DrawMode drawMode);
-
-bool read_pixel(Canvas* const canvas, int16_t x, int16_t y);
-
-void set_pixel(Canvas* const canvas, int16_t x, int16_t y, DrawMode draw_mode);
-
-void draw_line(
- Canvas* const canvas,
- int16_t x1,
- int16_t y1,
- int16_t x2,
- int16_t y2,
- DrawMode draw_mode);
-
-bool in_screen(int16_t x, int16_t y);
-
-void ui_cleanup();
-uint8_t* get_buffer(Canvas* const canvas);
-uint8_t* make_buffer();
-void clone_buffer(uint8_t* canvas, uint8_t* data);
\ No newline at end of file
diff --git a/applications/external/blackjack/defines.h b/applications/external/blackjack/defines.h
deleted file mode 100644
index 0a3fdf53e..000000000
--- a/applications/external/blackjack/defines.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include "common/card.h"
-#include "common/queue.h"
-#include "common/menu.h"
-
-#define APP_NAME "Blackjack"
-
-#define CONF_ANIMATION_DURATION "AnimationDuration"
-#define CONF_MESSAGE_DURATION "MessageDuration"
-#define CONF_STARTING_MONEY "StartingMoney"
-#define CONF_ROUND_PRICE "RoundPrice"
-#define CONF_SOUND_EFFECTS "SoundEffects"
-
-typedef enum {
- EventTypeTick,
- EventTypeKey,
-} EventType;
-
-typedef struct {
- uint32_t animation_duration;
- uint32_t message_duration;
- uint32_t starting_money;
- uint32_t round_price;
- bool sound_effects;
-} Settings;
-
-typedef struct {
- EventType type;
- InputEvent input;
-} AppEvent;
-
-typedef enum {
- GameStateGameOver,
- GameStateStart,
- GameStatePlay,
- GameStateSettings,
- GameStateDealer,
-} PlayState;
-
-typedef enum {
- DirectionUp,
- DirectionDown,
- DirectionRight,
- DirectionLeft,
- Select,
- Back,
- None
-} Direction;
-
-typedef struct {
- FuriMutex* mutex;
- Card player_cards[21];
- Card dealer_cards[21];
- uint8_t player_card_count;
- uint8_t dealer_card_count;
-
- Direction selectDirection;
- Settings settings;
-
- uint32_t player_score;
- uint32_t bet;
- uint8_t selectedMenu;
- bool doubled;
- bool started;
- bool processing;
- Deck deck;
- PlayState state;
- QueueState queue_state;
- Menu* menu;
- unsigned int last_tick;
-} GameState;
diff --git a/applications/external/blackjack/ui.c b/applications/external/blackjack/ui.c
deleted file mode 100644
index d4ee82191..000000000
--- a/applications/external/blackjack/ui.c
+++ /dev/null
@@ -1,186 +0,0 @@
-#include
-#include
-
-#include "ui.h"
-
-#define LINE_HEIGHT 16
-#define ITEM_PADDING 4
-
-const char MoneyMul[4] = {'K', 'B', 'T', 'S'};
-
-void draw_player_scene(Canvas* const canvas, const GameState* game_state) {
- int max_card = game_state->player_card_count;
-
- if(max_card > 0) draw_deck((game_state->player_cards), max_card, canvas);
-
- if(game_state->dealer_card_count > 0) draw_card_back_at(13, 5, canvas);
-
- max_card = game_state->dealer_card_count;
- if(max_card > 1) {
- draw_card_at(
- 2, 2, game_state->dealer_cards[1].pip, game_state->dealer_cards[1].character, canvas);
- }
-}
-
-void draw_dealer_scene(Canvas* const canvas, const GameState* game_state) {
- uint8_t max_card = game_state->dealer_card_count;
- draw_deck((game_state->dealer_cards), max_card, canvas);
-}
-
-void popup_frame(Canvas* const canvas) {
- canvas_set_color(canvas, ColorWhite);
- canvas_draw_box(canvas, 32, 15, 66, 13);
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_frame(canvas, 32, 15, 66, 13);
- canvas_set_font(canvas, FontSecondary);
-}
-
-void draw_play_menu(Canvas* const canvas, const GameState* game_state) {
- const char* menus[3] = {"Double", "Hit", "Stay"};
- for(uint8_t m = 0; m < 3; m++) {
- if(m == 0 &&
- (game_state->doubled || game_state->player_score < game_state->settings.round_price))
- continue;
- int y = m * 13 + 25;
- canvas_set_color(canvas, ColorBlack);
-
- if(game_state->selectedMenu == m) {
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 1, y, 31, 12);
- } else {
- canvas_set_color(canvas, ColorWhite);
- canvas_draw_box(canvas, 1, y, 31, 12);
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_frame(canvas, 1, y, 31, 12);
- }
-
- if(game_state->selectedMenu == m)
- canvas_set_color(canvas, ColorWhite);
- else
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_str_aligned(canvas, 16, y + 6, AlignCenter, AlignCenter, menus[m]);
- }
-}
-
-void draw_screen(Canvas* const canvas, const bool* points) {
- for(uint8_t x = 0; x < 128; x++) {
- for(uint8_t y = 0; y < 64; y++) {
- if(points[y * 128 + x]) canvas_draw_dot(canvas, x, y);
- }
- }
-}
-
-void draw_score(Canvas* const canvas, bool top, uint8_t amount) {
- char drawChar[20];
- snprintf(drawChar, sizeof(drawChar), "Player score: %i", amount);
- if(top)
- canvas_draw_str_aligned(canvas, 64, 2, AlignCenter, AlignTop, drawChar);
- else
- canvas_draw_str_aligned(canvas, 64, 62, AlignCenter, AlignBottom, drawChar);
-}
-
-void draw_money(Canvas* const canvas, uint32_t score) {
- canvas_set_font(canvas, FontSecondary);
- char drawChar[11];
- uint32_t currAmount = score;
- if(currAmount < 1000) {
- snprintf(drawChar, sizeof(drawChar), "$%lu", currAmount);
- } else {
- char c = 'K';
- for(uint8_t i = 0; i < 4; i++) {
- currAmount = currAmount / 1000;
- if(currAmount < 1000) {
- c = MoneyMul[i];
- break;
- }
- }
-
- snprintf(drawChar, sizeof(drawChar), "$%lu %c", currAmount, c);
- }
- canvas_draw_str_aligned(canvas, 126, 2, AlignRight, AlignTop, drawChar);
-}
-
-void draw_menu(
- Canvas* const canvas,
- const char* text,
- const char* value,
- int8_t y,
- bool left_caret,
- bool right_caret,
- bool selected) {
- UNUSED(selected);
- if(y < 0 || y >= 64) return;
-
- if(selected) {
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 0, y, 122, LINE_HEIGHT);
- canvas_set_color(canvas, ColorWhite);
- }
-
- canvas_draw_str_aligned(canvas, 4, y + ITEM_PADDING, AlignLeft, AlignTop, text);
- if(left_caret) canvas_draw_str_aligned(canvas, 80, y + ITEM_PADDING, AlignLeft, AlignTop, "<");
- canvas_draw_str_aligned(canvas, 100, y + ITEM_PADDING, AlignCenter, AlignTop, value);
- if(right_caret)
- canvas_draw_str_aligned(canvas, 120, y + ITEM_PADDING, AlignRight, AlignTop, ">");
-
- canvas_set_color(canvas, ColorBlack);
-}
-
-void settings_page(Canvas* const canvas, const GameState* gameState) {
- char drawChar[10];
- int startY = 0;
- if(LINE_HEIGHT * (gameState->selectedMenu + 1) >= 64) {
- startY -= (LINE_HEIGHT * (gameState->selectedMenu + 1)) - 64;
- }
-
- int scrollHeight = round(64 / 6.0) + ITEM_PADDING * 2;
- int scrollPos = 64 / (6.0 / (gameState->selectedMenu + 1)) - ITEM_PADDING * 2;
-
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 123, scrollPos, 4, scrollHeight);
- canvas_draw_box(canvas, 125, 0, 1, 64);
-
- snprintf(drawChar, sizeof(drawChar), "%li", gameState->settings.starting_money);
- draw_menu(
- canvas,
- "Start money",
- drawChar,
- 0 * LINE_HEIGHT + startY,
- gameState->settings.starting_money > gameState->settings.round_price,
- gameState->settings.starting_money < 400,
- gameState->selectedMenu == 0);
- snprintf(drawChar, sizeof(drawChar), "%li", gameState->settings.round_price);
- draw_menu(
- canvas,
- "Round price",
- drawChar,
- 1 * LINE_HEIGHT + startY,
- gameState->settings.round_price > 10,
- gameState->settings.round_price < gameState->settings.starting_money,
- gameState->selectedMenu == 1);
-
- snprintf(drawChar, sizeof(drawChar), "%li", gameState->settings.animation_duration);
- draw_menu(
- canvas,
- "Anim. length",
- drawChar,
- 2 * LINE_HEIGHT + startY,
- gameState->settings.animation_duration > 0,
- gameState->settings.animation_duration < 2000,
- gameState->selectedMenu == 2);
- snprintf(drawChar, sizeof(drawChar), "%li", gameState->settings.message_duration);
- draw_menu(
- canvas,
- "Popup time",
- drawChar,
- 3 * LINE_HEIGHT + startY,
- gameState->settings.message_duration > 0,
- gameState->settings.message_duration < 2000,
- gameState->selectedMenu == 3);
- // draw_menu(canvas, "Sound", gameState->settings.sound_effects ? "Yes" : "No",
- // 5 * LINE_HEIGHT + startY,
- // true,
- // true,
- // gameState->selectedMenu == 5
- // );
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/ui.h b/applications/external/blackjack/ui.h
deleted file mode 100644
index 51b388010..000000000
--- a/applications/external/blackjack/ui.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-#include "defines.h"
-#include
-
-void draw_player_scene(Canvas* const canvas, const GameState* game_state);
-
-void draw_dealer_scene(Canvas* const canvas, const GameState* game_state);
-
-void draw_play_menu(Canvas* const canvas, const GameState* game_state);
-
-void draw_score(Canvas* const canvas, bool top, uint8_t amount);
-
-void draw_money(Canvas* const canvas, uint32_t score);
-void settings_page(Canvas* const canvas, const GameState* gameState);
-
-void popup_frame(Canvas* const canvas);
-void draw_screen(Canvas* const canvas, const bool* points);
diff --git a/applications/external/blackjack/util.c b/applications/external/blackjack/util.c
deleted file mode 100644
index 8e88c2231..000000000
--- a/applications/external/blackjack/util.c
+++ /dev/null
@@ -1,123 +0,0 @@
-#include
-#include "util.h"
-
-const char* CONFIG_FILE_PATH = EXT_PATH(".blackjack.settings");
-
-void save_settings(Settings settings) {
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FlipperFormat* file = flipper_format_file_alloc(storage);
- FURI_LOG_D(APP_NAME, "Saving config");
- if(flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
- FURI_LOG_D(
- APP_NAME, "Saving %s: %ld", CONF_ANIMATION_DURATION, settings.animation_duration);
- flipper_format_update_uint32(
- file, CONF_ANIMATION_DURATION, &(settings.animation_duration), 1);
-
- FURI_LOG_D(APP_NAME, "Saving %s: %ld", CONF_MESSAGE_DURATION, settings.message_duration);
- flipper_format_update_uint32(file, CONF_MESSAGE_DURATION, &(settings.message_duration), 1);
-
- FURI_LOG_D(APP_NAME, "Saving %s: %ld", CONF_STARTING_MONEY, settings.starting_money);
- flipper_format_update_uint32(file, CONF_STARTING_MONEY, &(settings.starting_money), 1);
-
- FURI_LOG_D(APP_NAME, "Saving %s: %ld", CONF_ROUND_PRICE, settings.round_price);
- flipper_format_update_uint32(file, CONF_ROUND_PRICE, &(settings.round_price), 1);
-
- FURI_LOG_D(APP_NAME, "Saving %s: %i", CONF_SOUND_EFFECTS, settings.sound_effects ? 1 : 0);
- flipper_format_update_bool(file, CONF_SOUND_EFFECTS, &(settings.sound_effects), 1);
- FURI_LOG_D(APP_NAME, "Config saved");
- } else {
- FURI_LOG_E(APP_NAME, "Save error");
- }
- flipper_format_file_close(file);
- flipper_format_free(file);
- furi_record_close(RECORD_STORAGE);
-}
-
-void save_settings_file(FlipperFormat* file, Settings* settings) {
- flipper_format_write_header_cstr(file, CONFIG_FILE_HEADER, CONFIG_FILE_VERSION);
- flipper_format_write_comment_cstr(file, "Card animation duration in ms");
- flipper_format_write_uint32(file, CONF_ANIMATION_DURATION, &(settings->animation_duration), 1);
- flipper_format_write_comment_cstr(file, "Popup message duration in ms");
- flipper_format_write_uint32(file, CONF_MESSAGE_DURATION, &(settings->message_duration), 1);
- flipper_format_write_comment_cstr(file, "Player's starting money");
- flipper_format_write_uint32(file, CONF_STARTING_MONEY, &(settings->starting_money), 1);
- flipper_format_write_comment_cstr(file, "Round price");
- flipper_format_write_uint32(file, CONF_ROUND_PRICE, &(settings->round_price), 1);
- flipper_format_write_comment_cstr(file, "Enable sound effects");
- flipper_format_write_bool(file, CONF_SOUND_EFFECTS, &(settings->sound_effects), 1);
-}
-
-Settings load_settings() {
- Settings settings;
-
- FURI_LOG_D(APP_NAME, "Loading default settings");
- settings.animation_duration = 800;
- settings.message_duration = 1500;
- settings.starting_money = 200;
- settings.round_price = 10;
- settings.sound_effects = true;
-
- FURI_LOG_D(APP_NAME, "Opening storage");
- Storage* storage = furi_record_open(RECORD_STORAGE);
- FURI_LOG_D(APP_NAME, "Allocating file");
- FlipperFormat* file = flipper_format_file_alloc(storage);
-
- FURI_LOG_D(APP_NAME, "Allocating string");
- FuriString* string_value;
- string_value = furi_string_alloc();
-
- if(storage_common_stat(storage, CONFIG_FILE_PATH, NULL) != FSE_OK) {
- FURI_LOG_D(APP_NAME, "Config file %s not found, creating new one...", CONFIG_FILE_PATH);
- if(!flipper_format_file_open_new(file, CONFIG_FILE_PATH)) {
- FURI_LOG_E(APP_NAME, "Error creating new file %s", CONFIG_FILE_PATH);
- flipper_format_file_close(file);
- } else {
- save_settings_file(file, &settings);
- }
- } else {
- if(!flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
- FURI_LOG_E(APP_NAME, "Error opening existing file %s", CONFIG_FILE_PATH);
- flipper_format_file_close(file);
- } else {
- uint32_t value;
- bool valueBool;
- FURI_LOG_D(APP_NAME, "Checking version");
- if(!flipper_format_read_header(file, string_value, &value)) {
- FURI_LOG_E(APP_NAME, "Config file mismatch");
- } else {
- FURI_LOG_D(APP_NAME, "Loading %s", CONF_ANIMATION_DURATION);
- if(flipper_format_read_uint32(file, CONF_ANIMATION_DURATION, &value, 1)) {
- settings.animation_duration = value;
- FURI_LOG_D(APP_NAME, "Loaded %s: %ld", CONF_ANIMATION_DURATION, value);
- }
- FURI_LOG_D(APP_NAME, "Loading %s", CONF_MESSAGE_DURATION);
- if(flipper_format_read_uint32(file, CONF_MESSAGE_DURATION, &value, 1)) {
- settings.message_duration = value;
- FURI_LOG_D(APP_NAME, "Loaded %s: %ld", CONF_MESSAGE_DURATION, value);
- }
- FURI_LOG_D(APP_NAME, "Loading %s", CONF_STARTING_MONEY);
- if(flipper_format_read_uint32(file, CONF_STARTING_MONEY, &value, 1)) {
- settings.starting_money = value;
- FURI_LOG_D(APP_NAME, "Loaded %s: %ld", CONF_STARTING_MONEY, value);
- }
- FURI_LOG_D(APP_NAME, "Loading %s", CONF_ROUND_PRICE);
- if(flipper_format_read_uint32(file, CONF_ROUND_PRICE, &value, 1)) {
- settings.round_price = value;
- FURI_LOG_D(APP_NAME, "Loaded %s: %ld", CONF_ROUND_PRICE, value);
- }
- FURI_LOG_D(APP_NAME, "Loading %s", CONF_SOUND_EFFECTS);
- if(flipper_format_read_bool(file, CONF_SOUND_EFFECTS, &valueBool, 1)) {
- settings.sound_effects = valueBool;
- FURI_LOG_D(APP_NAME, "Loaded %s: %i", CONF_ROUND_PRICE, valueBool ? 1 : 0);
- }
- }
- flipper_format_file_close(file);
- }
- }
-
- furi_string_free(string_value);
- // flipper_format_file_close(file);
- flipper_format_free(file);
- furi_record_close(RECORD_STORAGE);
- return settings;
-}
\ No newline at end of file
diff --git a/applications/external/blackjack/util.h b/applications/external/blackjack/util.h
deleted file mode 100644
index 4bcc4d890..000000000
--- a/applications/external/blackjack/util.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-#include "defines.h"
-#define CONFIG_FILE_HEADER "Blackjack config file"
-#define CONFIG_FILE_VERSION 1
-
-void save_settings(Settings settings);
-Settings load_settings();
\ No newline at end of file
diff --git a/applications/external/bomberduck/LICENSE b/applications/external/bomberduck/LICENSE
deleted file mode 100644
index 4624b249c..000000000
--- a/applications/external/bomberduck/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-MIT License
-
-Copyright (c) 2023 Π»Π΅Π½Ρ
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/applications/external/bomberduck/README.md b/applications/external/bomberduck/README.md
deleted file mode 100644
index 2d133145a..000000000
--- a/applications/external/bomberduck/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# flipperzero-bomberduck
-Bomberman clone on flipper zero!
diff --git a/applications/external/bomberduck/application.fam b/applications/external/bomberduck/application.fam
deleted file mode 100644
index 5242d0f8c..000000000
--- a/applications/external/bomberduck/application.fam
+++ /dev/null
@@ -1,17 +0,0 @@
-App(
- appid="bomberduck",
- name="Bomberduck",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="bomberduck_app",
- requires=[
- "gui",
- ],
- stack_size=1 * 1024,
- order=90,
- fap_icon="bomb.png",
- fap_category="Games",
- fap_icon_assets="assets",
- fap_author="@leo-need-more-coffee & @xMasterX",
- fap_version="1.0",
- fap_description="Bomberduck(Bomberman) Game",
-)
diff --git a/applications/external/bomberduck/assets/bomb0.png b/applications/external/bomberduck/assets/bomb0.png
deleted file mode 100644
index 3fdc3a3c1..000000000
Binary files a/applications/external/bomberduck/assets/bomb0.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/bomb1.png b/applications/external/bomberduck/assets/bomb1.png
deleted file mode 100644
index 11d05b9b7..000000000
Binary files a/applications/external/bomberduck/assets/bomb1.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/bomb2.png b/applications/external/bomberduck/assets/bomb2.png
deleted file mode 100644
index 38ce7c732..000000000
Binary files a/applications/external/bomberduck/assets/bomb2.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/box.png b/applications/external/bomberduck/assets/box.png
deleted file mode 100644
index bbd352b6f..000000000
Binary files a/applications/external/bomberduck/assets/box.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/end.png b/applications/external/bomberduck/assets/end.png
deleted file mode 100644
index d634933b7..000000000
Binary files a/applications/external/bomberduck/assets/end.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/enemy1.png b/applications/external/bomberduck/assets/enemy1.png
deleted file mode 100644
index 7ee7cb27f..000000000
Binary files a/applications/external/bomberduck/assets/enemy1.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/enemyleft.png b/applications/external/bomberduck/assets/enemyleft.png
deleted file mode 100644
index bb85dfbb2..000000000
Binary files a/applications/external/bomberduck/assets/enemyleft.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/enemyright.png b/applications/external/bomberduck/assets/enemyright.png
deleted file mode 100644
index 45e6a861a..000000000
Binary files a/applications/external/bomberduck/assets/enemyright.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/explore.png b/applications/external/bomberduck/assets/explore.png
deleted file mode 100644
index 5eb50b669..000000000
Binary files a/applications/external/bomberduck/assets/explore.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/playerleft.png b/applications/external/bomberduck/assets/playerleft.png
deleted file mode 100644
index 86997a985..000000000
Binary files a/applications/external/bomberduck/assets/playerleft.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/playerright.png b/applications/external/bomberduck/assets/playerright.png
deleted file mode 100644
index 1a6283d9c..000000000
Binary files a/applications/external/bomberduck/assets/playerright.png and /dev/null differ
diff --git a/applications/external/bomberduck/assets/unbreakbox.png b/applications/external/bomberduck/assets/unbreakbox.png
deleted file mode 100644
index 5e65912d5..000000000
Binary files a/applications/external/bomberduck/assets/unbreakbox.png and /dev/null differ
diff --git a/applications/external/bomberduck/bomb.png b/applications/external/bomberduck/bomb.png
deleted file mode 100644
index 44b9bfdea..000000000
Binary files a/applications/external/bomberduck/bomb.png and /dev/null differ
diff --git a/applications/external/bomberduck/bomberduck.c b/applications/external/bomberduck/bomberduck.c
deleted file mode 100644
index 3e9d52f56..000000000
--- a/applications/external/bomberduck/bomberduck.c
+++ /dev/null
@@ -1,647 +0,0 @@
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include "bomberduck_icons.h"
-#include
-
-int max(int a, int b) {
- return (a > b) ? a : b;
-}
-
-int min(int a, int b) {
- return (a < b) ? a : b;
-}
-
-#define WorldSizeX 12
-#define WorldSizeY 6
-#define BombRange 1
-
-typedef struct {
- FuriMutex* mutex;
-} BomberState;
-
-typedef struct {
- int row;
- int col;
-} Cell;
-
-typedef struct {
- Cell cells[WorldSizeY * WorldSizeX];
- int front;
- int rear;
-} Queue;
-
-void enqueue(Queue* q, Cell c) {
- q->cells[q->rear] = c;
- q->rear++;
-}
-
-Cell dequeue(Queue* q) {
- Cell c = q->cells[q->front];
- q->front++;
-
- return c;
-}
-
-bool is_empty(Queue* q) {
- return q->front == q->rear;
-}
-
-typedef struct {
- int x;
- int y;
- int planted;
-} Bomb;
-
-typedef struct {
- int x;
- int y;
- bool side;
-} Player;
-
-typedef struct {
- int x;
- int y;
- int last;
- bool side;
- int level;
-} Enemy;
-
-typedef struct {
- int matrix[WorldSizeY][WorldSizeX];
- Player* player;
- bool running;
- int level;
-
- Enemy enemies[10];
- int enemies_count;
-
- Bomb bombs[100];
- int bombs_count;
-
- int endx;
- int endy;
-} World;
-
-Player player = {0, 0, 1};
-World world = {{{0}}, &player, 1, 0, {}, 0, {}, 0, 0, 0};
-bool vibration = false;
-
-void init() {
- player.x = 1;
- player.y = 1;
-
- world.endx = 4 + rand() % 8;
- world.endy = rand() % 6;
- for(int i = 0; i < WorldSizeY; i++) {
- for(int j = 0; j < WorldSizeX; j++) {
- world.matrix[i][j] = rand() % 3;
- }
- }
- world.running = 1;
- world.bombs_count = 0;
- vibration = false;
- for(int j = max(0, player.y - BombRange); j < min(WorldSizeY, player.y + BombRange + 1); j++) {
- world.matrix[j][player.x] = 0;
- }
-
- for(int j = max(0, player.x - BombRange); j < min(WorldSizeX, player.x + BombRange + 1); j++) {
- world.matrix[player.y][j] = 0;
- }
-
- world.enemies_count = 0;
- for(int j = 0; j < rand() % 4 + world.level / 5; j++) {
- Enemy enemy;
- enemy.x = 4 + rand() % 7;
- enemy.y = rand() % 6;
- enemy.last = 0;
- enemy.side = 1;
- enemy.level = 0;
-
- world.enemies[j] = enemy;
- world.enemies_count++;
-
- for(int m = max(0, world.enemies[j].y - BombRange);
- m < min(WorldSizeY, world.enemies[j].y + BombRange + 1);
- m++) {
- world.matrix[m][world.enemies[j].x] = 0;
- }
-
- for(int m = max(0, world.enemies[j].x - BombRange);
- m < min(WorldSizeX, world.enemies[j].x + BombRange + 1);
- m++) {
- world.matrix[world.enemies[j].y][m] = 0;
- }
- }
- world.matrix[world.endy][world.endx] = 1;
-}
-
-const NotificationSequence end = {
- &message_vibro_on,
-
- &message_note_ds4,
- &message_delay_10,
- &message_sound_off,
- &message_delay_10,
-
- &message_note_ds4,
- &message_delay_10,
- &message_sound_off,
- &message_delay_10,
-
- &message_note_ds4,
- &message_delay_10,
- &message_sound_off,
- &message_delay_10,
-
- &message_vibro_off,
- NULL,
-};
-
-static const NotificationSequence bomb2 = {
- &message_vibro_on,
- &message_delay_25,
- &message_vibro_off,
- NULL,
-};
-
-static const NotificationSequence bomb_explore = {
- &message_vibro_on,
- &message_delay_50,
- &message_vibro_off,
- NULL,
-};
-
-static const NotificationSequence vibr1 = {
- &message_vibro_on,
- &message_delay_10,
- &message_vibro_off,
- &message_delay_10,
- &message_vibro_on,
- &message_delay_10,
- &message_vibro_off,
- &message_delay_10,
-
- NULL,
-};
-
-void intToStr(int num, char* str) {
- int i = 0, sign = 0;
-
- if(num < 0) {
- num = -num;
- sign = 1;
- }
-
- do {
- str[i++] = num % 10 + '0';
- num /= 10;
- } while(num > 0);
-
- if(sign) {
- str[i++] = '-';
- }
-
- str[i] = '\0';
-
- // Reverse the string
- int j, len = i;
- char temp;
- for(j = 0; j < len / 2; j++) {
- temp = str[j];
- str[j] = str[len - j - 1];
- str[len - j - 1] = temp;
- }
-}
-
-bool BFS() {
- // Initialize visited array and queue
- int visited[WorldSizeY][WorldSizeX] = {0};
- Queue q = {.front = 0, .rear = 0};
- // Mark the starting cell as visited and enqueue it
- visited[world.player->y][world.player->x] = 1;
- Cell startCell = {.row = world.player->y, .col = world.player->x};
- enqueue(&q, startCell);
- // Traverse the field
- while(!is_empty(&q)) {
- // Dequeue a cell from the queue
- Cell currentCell = dequeue(&q);
- // Check if the current cell is the destination cell
- if(currentCell.row == world.endy && currentCell.col == world.endx) {
- return true;
- }
- // Check the neighboring cells
- for(int rowOffset = -1; rowOffset <= 1; rowOffset++) {
- for(int colOffset = -1; colOffset <= 1; colOffset++) {
- // Skip diagonals and the current cell
- if(rowOffset == 0 && colOffset == 0) {
- continue;
- }
- if(rowOffset != 0 && colOffset != 0) {
- continue;
- }
- // Calculate the row and column of the neighboring cell
- int neighborRow = currentCell.row + rowOffset;
- int neighborCol = currentCell.col + colOffset;
- // Skip out-of-bounds cells and already visited cells
- if(neighborRow < 0 || neighborRow >= WorldSizeY || neighborCol < 0 ||
- neighborCol >= WorldSizeX) {
- continue;
- }
- if(visited[neighborRow][neighborCol]) {
- continue;
- }
- // Mark the neighboring cell as visited and enqueue it
- if(world.matrix[neighborRow][neighborCol] != 2) {
- visited[neighborRow][neighborCol] = 1;
- Cell neighborCell = {.row = neighborRow, .col = neighborCol};
- enqueue(&q, neighborCell);
- }
- }
- }
- }
- return false;
-}
-
-static void draw_callback(Canvas* canvas, void* ctx) {
- furi_assert(ctx);
- const BomberState* bomber_state = ctx;
-
- furi_mutex_acquire(bomber_state->mutex, FuriWaitForever);
- if(!BFS()) {
- init();
- }
- canvas_clear(canvas);
-
- canvas_draw_icon(canvas, world.endx * 10 + 4, world.endy * 10 + 2, &I_end);
-
- if(world.running) {
- for(size_t i = 0; i < WorldSizeY; i++) {
- for(size_t j = 0; j < WorldSizeX; j++) {
- switch(world.matrix[i][j]) {
- case 0:
- break;
- case 1:
- canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_box);
- break;
- case 2:
- canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_unbreakbox);
- break;
- case 3:
- canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_bomb0);
- break;
- case 4:
- canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_bomb1);
- break;
- case 5:
- canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_bomb2);
- break;
- case 6:
- canvas_draw_icon(canvas, j * 10 + 4, i * 10 + 2, &I_explore);
- world.matrix[i][j] = 0;
- break;
- }
- }
- }
-
- if(world.player->side) {
- canvas_draw_icon(
- canvas, world.player->x * 10 + 4, world.player->y * 10 + 2, &I_playerright);
- } else {
- canvas_draw_icon(
- canvas, world.player->x * 10 + 4, world.player->y * 10 + 2, &I_playerleft);
- }
-
- for(int i = 0; i < world.enemies_count; i++) {
- if(world.enemies[i].level > 0) {
- canvas_draw_icon(
- canvas, world.enemies[i].x * 10 + 4, world.enemies[i].y * 10 + 2, &I_enemy1);
- } else {
- if(world.enemies[i].side) {
- canvas_draw_icon(
- canvas,
- world.enemies[i].x * 10 + 4,
- world.enemies[i].y * 10 + 2,
- &I_enemyright);
- } else {
- canvas_draw_icon(
- canvas,
- world.enemies[i].x * 10 + 4,
- world.enemies[i].y * 10 + 2,
- &I_enemyleft);
- }
- }
- }
- } else {
- canvas_set_font(canvas, FontPrimary);
- if(world.player->x == world.endx && world.player->y == world.endy) {
- if(world.level == 20) {
- canvas_draw_str(canvas, 30, 35, "You win!");
- } else {
- canvas_draw_str(canvas, 30, 35, "Next level!");
- char str[20];
- intToStr(world.level, str);
- canvas_draw_str(canvas, 90, 35, str);
- }
-
- } else {
- canvas_draw_str(canvas, 30, 35, "You died :(");
- }
- }
-
- furi_mutex_release(bomber_state->mutex);
-}
-
-static void input_callback(InputEvent* input_event, void* ctx) {
- // ΠΡΠΎΠ²Π΅ΡΡΠ΅ΠΌ, ΡΡΠΎ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡ Π½Π΅ Π½ΡΠ»Π΅Π²ΠΎΠΉ
- furi_assert(ctx);
- FuriMessageQueue* event_queue = ctx;
-
- furi_message_queue_put(event_queue, input_event, FuriWaitForever);
-}
-
-int32_t bomberduck_app(void* p) {
- UNUSED(p);
-
- // Π’Π΅ΠΊΡΡΠ΅Π΅ ΡΠΎΠ±ΡΡΠΈΠ΅ ΡΠΈΠΏΠ° InputEvent
- InputEvent event;
- // ΠΡΠ΅ΡΠ΅Π΄Ρ ΡΠΎΠ±ΡΡΠΈΠΉ Π½Π° 8 ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΡΠ°Π·ΠΌΠ΅ΡΠ° InputEvent
- FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
-
- BomberState* bomber_state = malloc(sizeof(BomberState));
-
- bomber_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal); // Alloc Mutex
- if(!bomber_state->mutex) {
- FURI_LOG_E("BomberDuck", "cannot create mutex\r\n");
- furi_message_queue_free(event_queue);
- free(bomber_state);
- return 255;
- }
-
- dolphin_deed(DolphinDeedPluginGameStart);
- // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ Π½ΠΎΠ²ΡΠΉ view port
- ViewPort* view_port = view_port_alloc();
- // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ callback ΠΎΡΡΠΈΡΠΎΠ²ΠΊΠΈ, Π±Π΅Π· ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ°
- view_port_draw_callback_set(view_port, draw_callback, bomber_state);
- // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ callback Π½Π°ΠΆΠ°ΡΠΈΠΉ Π½Π° ΠΊΠ»Π°Π²ΠΈΡΠΈ, Π² ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ° ΠΏΠ΅ΡΠ΅Π΄Π°Π΅ΠΌ
- // Π½Π°ΡΡ ΠΎΡΠ΅ΡΠ΅Π΄Ρ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠΉ, ΡΡΠΎΠ± Π·Π°ΠΏΠΈΡ
ΠΈΠ²Π°ΡΡ Π² Π½Π΅Ρ ΡΡΠΈ ΡΠΎΠ±ΡΡΠΈΡ
- view_port_input_callback_set(view_port, input_callback, event_queue);
-
- // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ GUI ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ
- Gui* gui = furi_record_open(RECORD_GUI);
- // ΠΠΎΠ΄ΠΊΠ»ΡΡΠ°Π΅ΠΌ view port ΠΊ GUI Π² ΠΏΠΎΠ»Π½ΠΎΡΠΊΡΠ°Π½Π½ΠΎΠΌ ΡΠ΅ΠΆΠΈΠΌΠ΅
- gui_add_view_port(gui, view_port, GuiLayerFullscreen);
- NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
- notification_message_block(notification, &sequence_display_backlight_enforce_on);
-
- init();
-
- // ΠΠ΅ΡΠΊΠΎΠ½Π΅ΡΠ½ΡΠΉ ΡΠΈΠΊΠ» ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΠΈ ΠΎΡΠ΅ΡΠ΅Π΄ΠΈ ΡΠΎΠ±ΡΡΠΈΠΉ
- while(1) {
- if(furi_message_queue_get(event_queue, &event, 100) == FuriStatusOk) {
- furi_mutex_acquire(bomber_state->mutex, FuriWaitForever);
- // ΠΡΠ»ΠΈ Π½Π°ΠΆΠ°ΡΠ° ΠΊΠ½ΠΎΠΏΠΊΠ° "Π½Π°Π·Π°Π΄", ΡΠΎ Π²ΡΡ
ΠΎΠ΄ΠΈΠΌ ΠΈΠ· ΡΠΈΠΊΠ»Π°, Π° ΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎ ΠΈ ΠΈΠ· ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ
-
- if(event.type == InputTypePress) {
- if(event.key == InputKeyOk) {
- if(world.running) {
- if(world.matrix[world.player->y][world.player->x] == 0 &&
- world.bombs_count < 2) {
- notification_message(notification, &bomb2);
- world.matrix[world.player->y][world.player->x] = 3;
- Bomb bomb = {world.player->x, world.player->y, furi_get_tick()};
- world.bombs[world.bombs_count] = bomb;
- world.bombs_count++;
- }
- } else {
- init();
- }
- }
- if(world.running) {
- if(event.key == InputKeyUp) {
- if(world.player->y > 0 &&
- world.matrix[world.player->y - 1][world.player->x] == 0)
- world.player->y--;
- }
- if(event.key == InputKeyDown) {
- if(world.player->y < WorldSizeY - 1 &&
- world.matrix[world.player->y + 1][world.player->x] == 0)
- world.player->y++;
- }
- if(event.key == InputKeyLeft) {
- world.player->side = 0;
- if(world.player->x > 0 &&
- world.matrix[world.player->y][world.player->x - 1] == 0)
- world.player->x--;
- }
- if(event.key == InputKeyRight) {
- world.player->side = 1;
- if(world.player->x < WorldSizeX - 1 &&
- world.matrix[world.player->y][world.player->x + 1] == 0)
- world.player->x++;
- }
- }
- } else if(event.type == InputTypeLong) {
- if(event.key == InputKeyBack) {
- break;
- }
- }
- }
- if(world.running) {
- if(world.player->x == world.endx && world.player->y == world.endy) {
- notification_message(notification, &end);
- world.running = 0;
- world.level += 1;
- if(world.level % 5 == 0) {
- dolphin_deed(DolphinDeedPluginGameWin);
- }
- }
- for(int i = 0; i < world.bombs_count; i++) {
- if(furi_get_tick() - world.bombs[i].planted >
- (unsigned long)max((3000 - world.level * 150), 1000)) {
- vibration = false;
- world.matrix[world.bombs[i].y][world.bombs[i].x] = 6;
- notification_message(notification, &bomb_explore);
-
- for(int j = max(0, world.bombs[i].y - BombRange);
- j < min(WorldSizeY, world.bombs[i].y + BombRange + 1);
- j++) {
- if(world.matrix[j][world.bombs[i].x] != 2) {
- world.matrix[j][world.bombs[i].x] = 6;
- if(j == world.player->y && world.bombs[i].x == world.player->x) {
- notification_message(notification, &end);
- world.running = 0;
- }
- for(int e = 0; e < world.enemies_count; e++) {
- if(j == world.enemies[e].y &&
- world.bombs[i].x == world.enemies[e].x) {
- if(world.enemies[e].level > 0) {
- world.enemies[e].level--;
- } else {
- for(int l = e; l < world.enemies_count - 1; l++) {
- world.enemies[l] = world.enemies[l + 1];
- }
- world.enemies_count--;
- }
- }
- }
- }
- }
-
- for(int j = max(0, world.bombs[i].x - BombRange);
- j < min(WorldSizeX, world.bombs[i].x + BombRange + 1);
- j++) {
- if(world.matrix[world.bombs[i].y][j] != 2) {
- world.matrix[world.bombs[i].y][j] = 6;
- if(world.bombs[i].y == world.player->y && j == world.player->x) {
- notification_message(notification, &end);
- world.running = 0;
- }
- for(int e = 0; e < world.enemies_count; e++) {
- if(world.bombs[i].y == world.enemies[e].y &&
- j == world.enemies[e].x) {
- if(world.enemies[e].level > 0) {
- world.enemies[e].level--;
- } else {
- for(int l = e; l < world.enemies_count - 1; l++) {
- world.enemies[l] = world.enemies[l + 1];
- }
- world.enemies_count--;
- }
- }
- }
- }
- }
-
- for(int j = i; j < world.bombs_count - 1; j++) {
- world.bombs[j] = world.bombs[j + 1];
- }
- world.bombs_count--;
- } else if(
- furi_get_tick() - world.bombs[i].planted >
- (unsigned long)max((3000 - world.level * 150) * 2 / 3, 666) &&
- world.matrix[world.bombs[i].y][world.bombs[i].x] != 5) {
- world.matrix[world.bombs[i].y][world.bombs[i].x] = 5;
- vibration = true;
-
- } else if(
- furi_get_tick() - world.bombs[i].planted >
- (unsigned long)max((3000 - world.level * 150) / 3, 333) &&
- world.matrix[world.bombs[i].y][world.bombs[i].x] != 4) {
- world.matrix[world.bombs[i].y][world.bombs[i].x] = 4;
- }
- }
- for(int e = 0; e < world.enemies_count; e++) {
- if(world.player->y == world.enemies[e].y &&
- world.player->x == world.enemies[e].x) {
- notification_message(notification, &end);
- world.running = 0;
- }
- }
-
- for(int e = 0; e < world.enemies_count; e++) {
- if(world.enemies[e].level > 0) {
- if(furi_get_tick() - world.enemies[e].last >
- (unsigned long)max((2000 - world.level * 100), 1000)) {
- world.enemies[e].last = furi_get_tick();
- int move = rand() % 4;
- switch(move) {
- case 0:
- if(world.enemies[e].y > 0 &&
- world.matrix[world.enemies[e].y - 1][world.enemies[e].x] != 2)
- world.enemies[e].y--;
- break;
- case 1:
- if(world.enemies[e].y < WorldSizeY - 1 &&
- world.matrix[world.enemies[e].y + 1][world.enemies[e].x] != 2)
- world.enemies[e].y++;
- break;
- case 2:
- world.enemies[e].side = 0;
- if(world.enemies[e].x > 0 &&
- world.matrix[world.enemies[e].y][world.enemies[e].x - 1] != 2)
- world.enemies[e].x--;
- break;
- case 3:
- world.enemies[e].side = 1;
- if(world.enemies[e].x < WorldSizeX - 1 &&
- world.matrix[world.enemies[e].y][world.enemies[e].x + 1] != 2)
- world.enemies[e].x++;
- default:
- break;
- }
- }
- } else {
- if(furi_get_tick() - world.enemies[e].last >
- (unsigned long)max((1000 - world.level * 50), 500)) {
- world.enemies[e].last = furi_get_tick();
- int move = rand() % 4;
- switch(move) {
- case 0:
- if(world.enemies[e].y > 0 &&
- world.matrix[world.enemies[e].y - 1][world.enemies[e].x] == 0)
- world.enemies[e].y--;
- break;
- case 1:
- if(world.enemies[e].y < WorldSizeY - 1 &&
- world.matrix[world.enemies[e].y + 1][world.enemies[e].x] == 0)
- world.enemies[e].y++;
- break;
- case 2:
- world.enemies[e].side = 0;
- if(world.enemies[e].x > 0 &&
- world.matrix[world.enemies[e].y][world.enemies[e].x - 1] == 0)
- world.enemies[e].x--;
- break;
- case 3:
- world.enemies[e].side = 1;
- if(world.enemies[e].x < WorldSizeX - 1 &&
- world.matrix[world.enemies[e].y][world.enemies[e].x + 1] == 0)
- world.enemies[e].x++;
- default:
- break;
- }
- }
- }
- }
- for(int e = 0; e < world.enemies_count; e++) {
- for(int h = e + 1; h < world.enemies_count; h++) {
- if(world.enemies[e].y == world.enemies[h].y &&
- world.enemies[e].x == world.enemies[h].x) {
- world.enemies[h].level++;
- for(int l = e; l < world.enemies_count - 1; l++) {
- world.enemies[l] = world.enemies[l + 1];
- }
- world.enemies_count--;
- }
- }
- }
- if(vibration) {
- notification_message(notification, &vibr1);
- }
- }
-
- view_port_update(view_port);
- furi_mutex_release(bomber_state->mutex);
- }
-
- // Return to normal backlight settings
- notification_message_block(notification, &sequence_display_backlight_enforce_auto);
- furi_record_close(RECORD_NOTIFICATION);
- // Π‘ΠΏΠ΅ΡΠΈΠ°Π»ΡΠ½Π°Ρ ΠΎΡΠΈΡΡΠΊΠ° ΠΏΠ°ΠΌΡΡΠΈ, Π·Π°Π½ΠΈΠΌΠ°Π΅ΠΌΠΎΠΉ ΠΎΡΠ΅ΡΠ΅Π΄ΡΡ
- furi_message_queue_free(event_queue);
-
- // Π§ΠΈΡΡΠΈΠΌ ΡΠΎΠ·Π΄Π°Π½Π½ΡΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΡ, ΡΠ²ΡΠ·Π°Π½Π½ΡΠ΅ Ρ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠΎΠΌ
- gui_remove_view_port(gui, view_port);
- view_port_free(view_port);
-
- furi_mutex_free(bomber_state->mutex);
- furi_record_close(RECORD_GUI);
- free(bomber_state);
-
- return 0;
-}
diff --git a/applications/external/camera_suite/application.fam b/applications/external/camera_suite/application.fam
deleted file mode 100644
index 63687833e..000000000
--- a/applications/external/camera_suite/application.fam
+++ /dev/null
@@ -1,16 +0,0 @@
-App(
- appid="camera_suite",
- apptype=FlipperAppType.EXTERNAL,
- cdefines=["APP_CAMERA_SUITE"],
- entry_point="camera_suite_app",
- fap_author="@CodyTolene @Z4urce @leedave",
- fap_category="GPIO",
- fap_description="A camera suite application for the Flipper Zero ESP32-CAM module.",
- fap_icon="icons/camera_suite.png",
- fap_libs=["assets"],
- fap_weburl="https://github.com/CodyTolene/Flipper-Zero-Cam",
- name="[ESP32] Camera Suite",
- order=1,
- requires=["gui", "storage"],
- stack_size=8 * 1024,
-)
diff --git a/applications/external/camera_suite/camera_suite.c b/applications/external/camera_suite/camera_suite.c
deleted file mode 100644
index cbe7e3d62..000000000
--- a/applications/external/camera_suite/camera_suite.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include "camera_suite.h"
-#include
-
-bool camera_suite_custom_event_callback(void* context, uint32_t event) {
- furi_assert(context);
- CameraSuite* app = context;
- return scene_manager_handle_custom_event(app->scene_manager, event);
-}
-
-void camera_suite_tick_event_callback(void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- scene_manager_handle_tick_event(app->scene_manager);
-}
-
-// Leave app if back button pressed.
-bool camera_suite_navigation_event_callback(void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- return scene_manager_handle_back_event(app->scene_manager);
-}
-
-CameraSuite* camera_suite_app_alloc() {
- CameraSuite* app = malloc(sizeof(CameraSuite));
- app->gui = furi_record_open(RECORD_GUI);
- app->notification = furi_record_open(RECORD_NOTIFICATION);
-
- // Turn backlight on.
- notification_message(app->notification, &sequence_display_backlight_on);
-
- // Scene additions
- app->view_dispatcher = view_dispatcher_alloc();
- view_dispatcher_enable_queue(app->view_dispatcher);
-
- app->scene_manager = scene_manager_alloc(&camera_suite_scene_handlers, app);
- view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
- view_dispatcher_set_navigation_event_callback(
- app->view_dispatcher, camera_suite_navigation_event_callback);
- view_dispatcher_set_tick_event_callback(
- app->view_dispatcher, camera_suite_tick_event_callback, 100);
- view_dispatcher_set_custom_event_callback(
- app->view_dispatcher, camera_suite_custom_event_callback);
- app->submenu = submenu_alloc();
-
- // Set defaults, in case no config loaded
- app->orientation = 0; // Orientation is "portrait", zero degrees by default.
- app->haptic = 1; // Haptic is on by default
- app->speaker = 1; // Speaker is on by default
- app->led = 1; // LED is on by default
-
- // Load configs
- camera_suite_read_settings(app);
-
- view_dispatcher_add_view(
- app->view_dispatcher, CameraSuiteViewIdMenu, submenu_get_view(app->submenu));
-
- app->camera_suite_view_start = camera_suite_view_start_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- CameraSuiteViewIdStartscreen,
- camera_suite_view_start_get_view(app->camera_suite_view_start));
-
- app->camera_suite_view_camera = camera_suite_view_camera_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- CameraSuiteViewIdCamera,
- camera_suite_view_camera_get_view(app->camera_suite_view_camera));
-
- app->camera_suite_view_guide = camera_suite_view_guide_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- CameraSuiteViewIdGuide,
- camera_suite_view_guide_get_view(app->camera_suite_view_guide));
-
- app->button_menu = button_menu_alloc();
-
- app->variable_item_list = variable_item_list_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- CameraSuiteViewIdSettings,
- variable_item_list_get_view(app->variable_item_list));
-
- //End Scene Additions
-
- return app;
-}
-
-void camera_suite_app_free(CameraSuite* app) {
- furi_assert(app);
-
- // Scene manager
- scene_manager_free(app->scene_manager);
-
- // View Dispatcher
- view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdStartscreen);
- view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdMenu);
- view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdCamera);
- view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdGuide);
- view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdSettings);
- submenu_free(app->submenu);
-
- view_dispatcher_free(app->view_dispatcher);
- furi_record_close(RECORD_GUI);
-
- // Free remaining resources
- camera_suite_view_start_free(app->camera_suite_view_start);
- camera_suite_view_camera_free(app->camera_suite_view_camera);
- camera_suite_view_guide_free(app->camera_suite_view_guide);
- button_menu_free(app->button_menu);
- variable_item_list_free(app->variable_item_list);
-
- app->gui = NULL;
- app->notification = NULL;
-
- //Remove whatever is left
- free(app);
-}
-
-/** Main entry point for initialization. */
-int32_t camera_suite_app(void* p) {
- UNUSED(p);
- CameraSuite* app = camera_suite_app_alloc();
- view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
- // Init with start scene.
- scene_manager_next_scene(app->scene_manager, CameraSuiteSceneStart);
- furi_hal_power_suppress_charge_enter();
- view_dispatcher_run(app->view_dispatcher);
- camera_suite_save_settings(app);
- furi_hal_power_suppress_charge_exit();
- camera_suite_app_free(app);
- return 0;
-}
diff --git a/applications/external/camera_suite/camera_suite.h b/applications/external/camera_suite/camera_suite.h
deleted file mode 100644
index a8b9825be..000000000
--- a/applications/external/camera_suite/camera_suite.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#pragma once
-
-#include "helpers/camera_suite_storage.h"
-#include "scenes/camera_suite_scene.h"
-#include "views/camera_suite_view_guide.h"
-#include "views/camera_suite_view_start.h"
-#include "views/camera_suite_view_camera.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define TAG "Camera Suite"
-
-typedef struct {
- Gui* gui;
- NotificationApp* notification;
- ViewDispatcher* view_dispatcher;
- Submenu* submenu;
- SceneManager* scene_manager;
- VariableItemList* variable_item_list;
- CameraSuiteViewStart* camera_suite_view_start;
- CameraSuiteViewCamera* camera_suite_view_camera;
- CameraSuiteViewGuide* camera_suite_view_guide;
- uint32_t orientation;
- uint32_t haptic;
- uint32_t speaker;
- uint32_t led;
- ButtonMenu* button_menu;
-} CameraSuite;
-
-typedef enum {
- CameraSuiteViewIdStartscreen,
- CameraSuiteViewIdMenu,
- CameraSuiteViewIdCamera,
- CameraSuiteViewIdGuide,
- CameraSuiteViewIdSettings,
-} CameraSuiteViewId;
-
-typedef enum {
- CameraSuiteOrientation0,
- CameraSuiteOrientation90,
- CameraSuiteOrientation180,
- CameraSuiteOrientation270,
-} CameraSuiteOrientationState;
-
-typedef enum {
- CameraSuiteHapticOff,
- CameraSuiteHapticOn,
-} CameraSuiteHapticState;
-
-typedef enum {
- CameraSuiteSpeakerOff,
- CameraSuiteSpeakerOn,
-} CameraSuiteSpeakerState;
-
-typedef enum {
- CameraSuiteLedOff,
- CameraSuiteLedOn,
-} CameraSuiteLedState;
diff --git a/applications/external/camera_suite/docs/CHANGELOG.md b/applications/external/camera_suite/docs/CHANGELOG.md
deleted file mode 100644
index 40f20dfc4..000000000
--- a/applications/external/camera_suite/docs/CHANGELOG.md
+++ /dev/null
@@ -1,20 +0,0 @@
-## v1.1
-
-- Support and picture stabilization for all camera orientations (0Β°, 90Β°, 180Β°, 270Β°).
-- Rename "Scene 1" to "Camera". No UX changes, strictly internal.
-- Clean up unused "Scene 2". This was inaccessible to users previously and unused.
-- Add new dithering variations (needs new module firmware, see https://github.com/CodyTolene/Flipper-Zero-Camera-Suite#firmware-installation):
- - Add `Jarvis Judice` Ninke Dithering option
- - Add `Stucki` dithering option.
- - Add ability to toggle dithering options from default `Floyd-Steinberg` and back.
-- Resolves issue https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/issues/7
-- Resolves issue https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/pull/17
-
-## v1.0
-
-- Builds upon Z4urce's software found here (updated 6 months ago): https://github.com/Z4urce/flipperzero-camera
-- Utilizes the superb C boilerplate examples laid out by leedave (updated last month): https://github.com/leedave/flipper-zero-fap-boilerplate
-- Repurpose and build upon the "[ESP32] Camera" software into the new "[ESP32] Camera Suite" application with new purpose:
- - Adding more scene for a guide.
- - Adding more scene for saveable settings.
- - Add ability to rotate the camera orientation.
diff --git a/applications/external/camera_suite/docs/README.md b/applications/external/camera_suite/docs/README.md
deleted file mode 100644
index 1f436a067..000000000
--- a/applications/external/camera_suite/docs/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-## Flipper Zero - Camera Suite
-
-Software to run an ESP32-CAM module on your Flipper Zero device.
-
-## Software Guide
-
-### Flipper Zero button mappings:
-
-πΌ = Contrast Up
-
-π½ = Contrast Down
-
-βοΈ = Toggle invert.
-
-βΆοΈ = Toggle dithering on/off.
-
-βͺ = Cycle FloydβSteinberg/Jarvis-Judice-Ninke/Stucki dithering types.
-
-β©οΈ = Go back.
-
-### Camera Suite settings:
-
-**Orientation** = Rotate the camera image 90 degrees counter-clockwise starting at zero by default (0, 90, 180, 270). This is useful if you have your camera module mounted in a different orientation than the default.
-
-**Haptic FX** = Toggle haptic feedback on/off.
-
-**Sound FX** = Toggle sound effects on/off.
-
-**LED FX** = Toggle LED effects on/off.
-
-## Links
-
-Full setup, wiring guide, etc. in the main project README here: https://github.com/CodyTolene/Flipper-Zero-Camera-Suite
-
-A firmware is needed for the ESP32-CAM module, see here for more information: https://github.com/CodyTolene/Flipper-Zero-Camera-Suite#firmware-installation
diff --git a/applications/external/camera_suite/helpers/camera_suite_custom_event.h b/applications/external/camera_suite/helpers/camera_suite_custom_event.h
deleted file mode 100644
index 4d472d577..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_custom_event.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#pragma once
-
-typedef enum {
- // Scene events: Start menu
- CameraSuiteCustomEventStartUp,
- CameraSuiteCustomEventStartDown,
- CameraSuiteCustomEventStartLeft,
- CameraSuiteCustomEventStartRight,
- CameraSuiteCustomEventStartOk,
- CameraSuiteCustomEventStartBack,
- // Scene events: Camera
- CameraSuiteCustomEventSceneCameraUp,
- CameraSuiteCustomEventSceneCameraDown,
- CameraSuiteCustomEventSceneCameraLeft,
- CameraSuiteCustomEventSceneCameraRight,
- CameraSuiteCustomEventSceneCameraOk,
- CameraSuiteCustomEventSceneCameraBack,
- // Scene events: Guide
- CameraSuiteCustomEventSceneGuideUp,
- CameraSuiteCustomEventSceneGuideDown,
- CameraSuiteCustomEventSceneGuideLeft,
- CameraSuiteCustomEventSceneGuideRight,
- CameraSuiteCustomEventSceneGuideOk,
- CameraSuiteCustomEventSceneGuideBack,
-} CameraSuiteCustomEvent;
-
-enum CameraSuiteCustomEventType {
- // Reserve first 100 events for button types and indexes, starting from 0.
- CameraSuiteCustomEventMenuVoid,
- CameraSuiteCustomEventMenuSelected,
-};
-
-#pragma pack(push, 1)
-
-typedef union {
- uint32_t packed_value;
- struct {
- uint16_t type;
- int16_t value;
- } content;
-} CameraSuiteCustomEventMenu;
-
-#pragma pack(pop)
-
-static inline uint32_t camera_suite_custom_menu_event_pack(uint16_t type, int16_t value) {
- CameraSuiteCustomEventMenu event = {.content = {.type = type, .value = value}};
- return event.packed_value;
-}
-
-static inline void
- camera_suite_custom_menu_event_unpack(uint32_t packed_value, uint16_t* type, int16_t* value) {
- CameraSuiteCustomEventMenu event = {.packed_value = packed_value};
- if(type) *type = event.content.type;
- if(value) *value = event.content.value;
-}
-
-static inline uint16_t camera_suite_custom_menu_event_get_type(uint32_t packed_value) {
- uint16_t type;
- camera_suite_custom_menu_event_unpack(packed_value, &type, NULL);
- return type;
-}
-
-static inline int16_t camera_suite_custom_menu_event_get_value(uint32_t packed_value) {
- int16_t value;
- camera_suite_custom_menu_event_unpack(packed_value, NULL, &value);
- return value;
-}
diff --git a/applications/external/camera_suite/helpers/camera_suite_haptic.c b/applications/external/camera_suite/helpers/camera_suite_haptic.c
deleted file mode 100644
index 237a96004..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_haptic.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "camera_suite_haptic.h"
-#include "../camera_suite.h"
-
-void camera_suite_play_happy_bump(void* context) {
- CameraSuite* app = context;
- if(app->haptic != 1) {
- return;
- }
- notification_message(app->notification, &sequence_set_vibro_on);
- furi_thread_flags_wait(0, FuriFlagWaitAny, 20);
- notification_message(app->notification, &sequence_reset_vibro);
-}
-
-void camera_suite_play_bad_bump(void* context) {
- CameraSuite* app = context;
- if(app->haptic != 1) {
- return;
- }
- notification_message(app->notification, &sequence_set_vibro_on);
- furi_thread_flags_wait(0, FuriFlagWaitAny, 100);
- notification_message(app->notification, &sequence_reset_vibro);
-}
-
-void camera_suite_play_long_bump(void* context) {
- CameraSuite* app = context;
- if(app->haptic != 1) {
- return;
- }
- for(int i = 0; i < 4; i++) {
- notification_message(app->notification, &sequence_set_vibro_on);
- furi_thread_flags_wait(0, FuriFlagWaitAny, 50);
- notification_message(app->notification, &sequence_reset_vibro);
- furi_thread_flags_wait(0, FuriFlagWaitAny, 100);
- }
-}
diff --git a/applications/external/camera_suite/helpers/camera_suite_haptic.h b/applications/external/camera_suite/helpers/camera_suite_haptic.h
deleted file mode 100644
index 9b7651f97..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_haptic.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include
-
-void camera_suite_play_happy_bump(void* context);
-
-void camera_suite_play_bad_bump(void* context);
-
-void camera_suite_play_long_bump(void* context);
diff --git a/applications/external/camera_suite/helpers/camera_suite_led.c b/applications/external/camera_suite/helpers/camera_suite_led.c
deleted file mode 100644
index c4f1a85d7..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_led.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "camera_suite_led.h"
-#include "../camera_suite.h"
-
-void camera_suite_led_set_rgb(void* context, int red, int green, int blue) {
- CameraSuite* app = context;
- if(app->led != 1) {
- return;
- }
- NotificationMessage notification_led_message_1;
- notification_led_message_1.type = NotificationMessageTypeLedRed;
- NotificationMessage notification_led_message_2;
- notification_led_message_2.type = NotificationMessageTypeLedGreen;
- NotificationMessage notification_led_message_3;
- notification_led_message_3.type = NotificationMessageTypeLedBlue;
-
- notification_led_message_1.data.led.value = red;
- notification_led_message_2.data.led.value = green;
- notification_led_message_3.data.led.value = blue;
- const NotificationSequence notification_sequence = {
- ¬ification_led_message_1,
- ¬ification_led_message_2,
- ¬ification_led_message_3,
- &message_do_not_reset,
- NULL,
- };
- notification_message(app->notification, ¬ification_sequence);
- //Delay, prevent removal from RAM before LED value set.
- furi_thread_flags_wait(0, FuriFlagWaitAny, 10);
-}
-
-void camera_suite_led_reset(void* context) {
- CameraSuite* app = context;
- notification_message(app->notification, &sequence_reset_red);
- notification_message(app->notification, &sequence_reset_green);
- notification_message(app->notification, &sequence_reset_blue);
- //Delay, prevent removal from RAM before LED value set.
- furi_thread_flags_wait(0, FuriFlagWaitAny, 300);
-}
diff --git a/applications/external/camera_suite/helpers/camera_suite_led.h b/applications/external/camera_suite/helpers/camera_suite_led.h
deleted file mode 100644
index 074947da1..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_led.h
+++ /dev/null
@@ -1,3 +0,0 @@
-void camera_suite_led_set_rgb(void* context, int red, int green, int blue);
-
-void camera_suite_led_reset(void* context);
diff --git a/applications/external/camera_suite/helpers/camera_suite_speaker.c b/applications/external/camera_suite/helpers/camera_suite_speaker.c
deleted file mode 100644
index c2a5a7dd0..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_speaker.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "camera_suite_speaker.h"
-#include "../camera_suite.h"
-
-#define NOTE_INPUT 587.33f
-
-void camera_suite_play_input_sound(void* context) {
- CameraSuite* app = context;
- if(app->speaker != 1) {
- return;
- }
- float volume = 1.0f;
- if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
- furi_hal_speaker_start(NOTE_INPUT, volume);
- }
-}
-
-void camera_suite_stop_all_sound(void* context) {
- CameraSuite* app = context;
- if(app->speaker != 1) {
- return;
- }
- if(furi_hal_speaker_is_mine()) {
- furi_hal_speaker_stop();
- furi_hal_speaker_release();
- }
-}
diff --git a/applications/external/camera_suite/helpers/camera_suite_speaker.h b/applications/external/camera_suite/helpers/camera_suite_speaker.h
deleted file mode 100644
index 2119bbec5..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_speaker.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#define NOTE_INPUT 587.33f
-
-void camera_suite_play_input_sound(void* context);
-
-void camera_suite_stop_all_sound(void* context);
diff --git a/applications/external/camera_suite/helpers/camera_suite_storage.c b/applications/external/camera_suite/helpers/camera_suite_storage.c
deleted file mode 100644
index 38a5f0813..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_storage.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "camera_suite_storage.h"
-
-static Storage* camera_suite_open_storage() {
- return furi_record_open(RECORD_STORAGE);
-}
-
-static void camera_suite_close_storage() {
- furi_record_close(RECORD_STORAGE);
-}
-
-static void camera_suite_close_config_file(FlipperFormat* file) {
- if(file == NULL) return;
- flipper_format_file_close(file);
- flipper_format_free(file);
-}
-
-void camera_suite_save_settings(void* context) {
- CameraSuite* app = context;
-
- FURI_LOG_D(TAG, "Saving Settings");
- Storage* storage = camera_suite_open_storage();
- FlipperFormat* fff_file = flipper_format_file_alloc(storage);
-
- // Overwrite wont work, so delete first
- if(storage_file_exists(storage, BOILERPLATE_SETTINGS_SAVE_PATH)) {
- storage_simply_remove(storage, BOILERPLATE_SETTINGS_SAVE_PATH);
- }
-
- // Open File, create if not exists
- if(!storage_common_stat(storage, BOILERPLATE_SETTINGS_SAVE_PATH, NULL) == FSE_OK) {
- FURI_LOG_D(
- TAG, "Config file %s is not found. Will create new.", BOILERPLATE_SETTINGS_SAVE_PATH);
- if(storage_common_stat(storage, CONFIG_FILE_DIRECTORY_PATH, NULL) == FSE_NOT_EXIST) {
- FURI_LOG_D(
- TAG, "Directory %s doesn't exist. Will create new.", CONFIG_FILE_DIRECTORY_PATH);
- if(!storage_simply_mkdir(storage, CONFIG_FILE_DIRECTORY_PATH)) {
- FURI_LOG_E(TAG, "Error creating directory %s", CONFIG_FILE_DIRECTORY_PATH);
- }
- }
- }
-
- if(!flipper_format_file_open_new(fff_file, BOILERPLATE_SETTINGS_SAVE_PATH)) {
- //totp_close_config_file(fff_file);
- FURI_LOG_E(TAG, "Error creating new file %s", BOILERPLATE_SETTINGS_SAVE_PATH);
- camera_suite_close_storage();
- return;
- }
-
- // Store Settings
- flipper_format_write_header_cstr(
- fff_file, BOILERPLATE_SETTINGS_HEADER, BOILERPLATE_SETTINGS_FILE_VERSION);
- flipper_format_write_uint32(
- fff_file, BOILERPLATE_SETTINGS_KEY_ORIENTATION, &app->orientation, 1);
- flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
- flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
- flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_LED, &app->led, 1);
-
- if(!flipper_format_rewind(fff_file)) {
- camera_suite_close_config_file(fff_file);
- FURI_LOG_E(TAG, "Rewind error");
- camera_suite_close_storage();
- return;
- }
-
- camera_suite_close_config_file(fff_file);
- camera_suite_close_storage();
-}
-
-void camera_suite_read_settings(void* context) {
- CameraSuite* app = context;
- Storage* storage = camera_suite_open_storage();
- FlipperFormat* fff_file = flipper_format_file_alloc(storage);
-
- if(storage_common_stat(storage, BOILERPLATE_SETTINGS_SAVE_PATH, NULL) != FSE_OK) {
- camera_suite_close_config_file(fff_file);
- camera_suite_close_storage();
- return;
- }
- uint32_t file_version;
- FuriString* temp_str = furi_string_alloc();
-
- if(!flipper_format_file_open_existing(fff_file, BOILERPLATE_SETTINGS_SAVE_PATH)) {
- FURI_LOG_E(TAG, "Cannot open file %s", BOILERPLATE_SETTINGS_SAVE_PATH);
- camera_suite_close_config_file(fff_file);
- camera_suite_close_storage();
- return;
- }
-
- if(!flipper_format_read_header(fff_file, temp_str, &file_version)) {
- FURI_LOG_E(TAG, "Missing Header Data");
- camera_suite_close_config_file(fff_file);
- camera_suite_close_storage();
- return;
- }
-
- if(file_version < BOILERPLATE_SETTINGS_FILE_VERSION) {
- FURI_LOG_I(TAG, "old config version, will be removed.");
- camera_suite_close_config_file(fff_file);
- camera_suite_close_storage();
- return;
- }
-
- flipper_format_read_uint32(
- fff_file, BOILERPLATE_SETTINGS_KEY_ORIENTATION, &app->orientation, 1);
- flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
- flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
- flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_LED, &app->led, 1);
-
- flipper_format_rewind(fff_file);
-
- camera_suite_close_config_file(fff_file);
- camera_suite_close_storage();
-}
\ No newline at end of file
diff --git a/applications/external/camera_suite/helpers/camera_suite_storage.h b/applications/external/camera_suite/helpers/camera_suite_storage.h
deleted file mode 100644
index 37e82d722..000000000
--- a/applications/external/camera_suite/helpers/camera_suite_storage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include
-#include
-#include
-#include
-#include "../camera_suite.h"
-
-#define BOILERPLATE_SETTINGS_FILE_VERSION 1
-#define CONFIG_FILE_DIRECTORY_PATH EXT_PATH("apps_data/camera_suite")
-#define BOILERPLATE_SETTINGS_SAVE_PATH CONFIG_FILE_DIRECTORY_PATH "/camera_suite.conf"
-#define BOILERPLATE_SETTINGS_SAVE_PATH_TMP BOILERPLATE_SETTINGS_SAVE_PATH ".tmp"
-#define BOILERPLATE_SETTINGS_HEADER "Camera Suite Config File"
-#define BOILERPLATE_SETTINGS_KEY_ORIENTATION "Orientation"
-#define BOILERPLATE_SETTINGS_KEY_HAPTIC "Haptic"
-#define BOILERPLATE_SETTINGS_KEY_LED "Led"
-#define BOILERPLATE_SETTINGS_KEY_SPEAKER "Speaker"
-#define BOILERPLATE_SETTINGS_KEY_SAVE_SETTINGS "SaveSettings"
-
-void camera_suite_save_settings(void* context);
-
-void camera_suite_read_settings(void* context);
diff --git a/applications/external/camera_suite/icons/camera_suite.png b/applications/external/camera_suite/icons/camera_suite.png
deleted file mode 100644
index cee545bb9..000000000
Binary files a/applications/external/camera_suite/icons/camera_suite.png and /dev/null differ
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene.c b/applications/external/camera_suite/scenes/camera_suite_scene.c
deleted file mode 100644
index c503fab5d..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "camera_suite_scene.h"
-
-// Generate scene on_enter handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
-void (*const camera_suite_on_enter_handlers[])(void*) = {
-#include "camera_suite_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 camera_suite_on_event_handlers[])(void* context, SceneManagerEvent event) = {
-#include "camera_suite_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 camera_suite_on_exit_handlers[])(void* context) = {
-#include "camera_suite_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Initialize scene handlers configuration structure
-const SceneManagerHandlers camera_suite_scene_handlers = {
- .on_enter_handlers = camera_suite_on_enter_handlers,
- .on_event_handlers = camera_suite_on_event_handlers,
- .on_exit_handlers = camera_suite_on_exit_handlers,
- .scene_num = CameraSuiteSceneNum,
-};
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene.h b/applications/external/camera_suite/scenes/camera_suite_scene.h
deleted file mode 100644
index 2d88b126d..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include
-
-// Generate scene id and total number
-#define ADD_SCENE(prefix, name, id) CameraSuiteScene##id,
-typedef enum {
-#include "camera_suite_scene_config.h"
- CameraSuiteSceneNum,
-} CameraSuiteScene;
-#undef ADD_SCENE
-
-extern const SceneManagerHandlers camera_suite_scene_handlers;
-
-// Generate scene on_enter handlers declaration
-#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
-#include "camera_suite_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 "camera_suite_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 "camera_suite_scene_config.h"
-#undef ADD_SCENE
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene_camera.c b/applications/external/camera_suite/scenes/camera_suite_scene_camera.c
deleted file mode 100644
index 809d9a5c1..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene_camera.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "../camera_suite.h"
-#include "../helpers/camera_suite_custom_event.h"
-#include "../views/camera_suite_view_camera.h"
-
-void camera_suite_view_camera_callback(CameraSuiteCustomEvent event, void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void camera_suite_scene_camera_on_enter(void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- camera_suite_view_camera_set_callback(
- app->camera_suite_view_camera, camera_suite_view_camera_callback, app);
- view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdCamera);
-}
-
-bool camera_suite_scene_camera_on_event(void* context, SceneManagerEvent event) {
- CameraSuite* app = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- switch(event.event) {
- case CameraSuiteCustomEventSceneCameraLeft:
- case CameraSuiteCustomEventSceneCameraRight:
- case CameraSuiteCustomEventSceneCameraUp:
- case CameraSuiteCustomEventSceneCameraDown:
- case CameraSuiteCustomEventSceneCameraOk:
- // Do nothing.
- break;
- case CameraSuiteCustomEventSceneCameraBack:
- notification_message(app->notification, &sequence_reset_red);
- notification_message(app->notification, &sequence_reset_green);
- notification_message(app->notification, &sequence_reset_blue);
- if(!scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, CameraSuiteSceneMenu)) {
- scene_manager_stop(app->scene_manager);
- view_dispatcher_stop(app->view_dispatcher);
- }
- consumed = true;
- break;
- }
- }
-
- return consumed;
-}
-
-void camera_suite_scene_camera_on_exit(void* context) {
- CameraSuite* app = context;
- UNUSED(app);
-}
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene_config.h b/applications/external/camera_suite/scenes/camera_suite_scene_config.h
deleted file mode 100644
index 2cb9245ef..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene_config.h
+++ /dev/null
@@ -1,5 +0,0 @@
-ADD_SCENE(camera_suite, start, Start)
-ADD_SCENE(camera_suite, menu, Menu)
-ADD_SCENE(camera_suite, camera, Camera)
-ADD_SCENE(camera_suite, guide, Guide)
-ADD_SCENE(camera_suite, settings, Settings)
\ No newline at end of file
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene_guide.c b/applications/external/camera_suite/scenes/camera_suite_scene_guide.c
deleted file mode 100644
index 6599058ef..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene_guide.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "../camera_suite.h"
-#include "../helpers/camera_suite_custom_event.h"
-#include "../views/camera_suite_view_guide.h"
-
-void camera_suite_view_guide_callback(CameraSuiteCustomEvent event, void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void camera_suite_scene_guide_on_enter(void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- camera_suite_view_guide_set_callback(
- app->camera_suite_view_guide, camera_suite_view_guide_callback, app);
- view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdGuide);
-}
-
-bool camera_suite_scene_guide_on_event(void* context, SceneManagerEvent event) {
- CameraSuite* app = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- switch(event.event) {
- case CameraSuiteCustomEventSceneGuideLeft:
- case CameraSuiteCustomEventSceneGuideRight:
- case CameraSuiteCustomEventSceneGuideUp:
- case CameraSuiteCustomEventSceneGuideDown:
- // Do nothing.
- break;
- case CameraSuiteCustomEventSceneGuideBack:
- notification_message(app->notification, &sequence_reset_red);
- notification_message(app->notification, &sequence_reset_green);
- notification_message(app->notification, &sequence_reset_blue);
- if(!scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, CameraSuiteSceneMenu)) {
- scene_manager_stop(app->scene_manager);
- view_dispatcher_stop(app->view_dispatcher);
- }
- consumed = true;
- break;
- }
- }
-
- return consumed;
-}
-
-void camera_suite_scene_guide_on_exit(void* context) {
- CameraSuite* app = context;
- UNUSED(app);
-}
\ No newline at end of file
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene_menu.c b/applications/external/camera_suite/scenes/camera_suite_scene_menu.c
deleted file mode 100644
index ae37e11b6..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene_menu.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "../camera_suite.h"
-
-enum SubmenuIndex {
- /** Camera. */
- SubmenuIndexSceneCamera = 10,
- /** Guide/how-to. */
- SubmenuIndexGuide,
- /** Settings menu. */
- SubmenuIndexSettings,
-};
-
-void camera_suite_scene_menu_submenu_callback(void* context, uint32_t index) {
- CameraSuite* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, index);
-}
-
-void camera_suite_scene_menu_on_enter(void* context) {
- CameraSuite* app = context;
-
- submenu_add_item(
- app->submenu,
- "Open Camera",
- SubmenuIndexSceneCamera,
- camera_suite_scene_menu_submenu_callback,
- app);
- submenu_add_item(
- app->submenu, "Guide", SubmenuIndexGuide, camera_suite_scene_menu_submenu_callback, app);
- submenu_add_item(
- app->submenu,
- "Settings",
- SubmenuIndexSettings,
- camera_suite_scene_menu_submenu_callback,
- app);
-
- submenu_set_selected_item(
- app->submenu, scene_manager_get_scene_state(app->scene_manager, CameraSuiteSceneMenu));
-
- view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdMenu);
-}
-
-bool camera_suite_scene_menu_on_event(void* context, SceneManagerEvent event) {
- CameraSuite* app = context;
- UNUSED(app);
- if(event.type == SceneManagerEventTypeBack) {
- // Exit application.
- scene_manager_stop(app->scene_manager);
- view_dispatcher_stop(app->view_dispatcher);
- return true;
- } else if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == SubmenuIndexSceneCamera) {
- scene_manager_set_scene_state(
- app->scene_manager, CameraSuiteSceneMenu, SubmenuIndexSceneCamera);
- scene_manager_next_scene(app->scene_manager, CameraSuiteSceneCamera);
- return true;
- } else if(event.event == SubmenuIndexGuide) {
- scene_manager_set_scene_state(
- app->scene_manager, CameraSuiteSceneMenu, SubmenuIndexGuide);
- scene_manager_next_scene(app->scene_manager, CameraSuiteSceneGuide);
- return true;
- } else if(event.event == SubmenuIndexSettings) {
- scene_manager_set_scene_state(
- app->scene_manager, CameraSuiteSceneMenu, SubmenuIndexSettings);
- scene_manager_next_scene(app->scene_manager, CameraSuiteSceneSettings);
- return true;
- }
- }
- return false;
-}
-
-void camera_suite_scene_menu_on_exit(void* context) {
- CameraSuite* app = context;
- submenu_reset(app->submenu);
-}
\ No newline at end of file
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene_settings.c b/applications/external/camera_suite/scenes/camera_suite_scene_settings.c
deleted file mode 100644
index a06b45fe9..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene_settings.c
+++ /dev/null
@@ -1,137 +0,0 @@
-#include "../camera_suite.h"
-#include
-
-// Camera orientation, in degrees.
-const char* const orientation_text[4] = {
- "0",
- "90",
- "180",
- "270",
-};
-
-const uint32_t orientation_value[4] = {
- CameraSuiteOrientation0,
- CameraSuiteOrientation90,
- CameraSuiteOrientation180,
- CameraSuiteOrientation270,
-};
-
-const char* const haptic_text[2] = {
- "OFF",
- "ON",
-};
-
-const uint32_t haptic_value[2] = {
- CameraSuiteHapticOff,
- CameraSuiteHapticOn,
-};
-
-const char* const speaker_text[2] = {
- "OFF",
- "ON",
-};
-
-const uint32_t speaker_value[2] = {
- CameraSuiteSpeakerOff,
- CameraSuiteSpeakerOn,
-};
-
-const char* const led_text[2] = {
- "OFF",
- "ON",
-};
-
-const uint32_t led_value[2] = {
- CameraSuiteLedOff,
- CameraSuiteLedOn,
-};
-
-static void camera_suite_scene_settings_set_camera_orientation(VariableItem* item) {
- CameraSuite* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
-
- variable_item_set_current_value_text(item, orientation_text[index]);
- app->orientation = orientation_value[index];
-}
-
-static void camera_suite_scene_settings_set_haptic(VariableItem* item) {
- CameraSuite* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
-
- variable_item_set_current_value_text(item, haptic_text[index]);
- app->haptic = haptic_value[index];
-}
-
-static void camera_suite_scene_settings_set_speaker(VariableItem* item) {
- CameraSuite* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
- variable_item_set_current_value_text(item, speaker_text[index]);
- app->speaker = speaker_value[index];
-}
-
-static void camera_suite_scene_settings_set_led(VariableItem* item) {
- CameraSuite* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
- variable_item_set_current_value_text(item, led_text[index]);
- app->led = led_value[index];
-}
-
-void camera_suite_scene_settings_submenu_callback(void* context, uint32_t index) {
- CameraSuite* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, index);
-}
-
-void camera_suite_scene_settings_on_enter(void* context) {
- CameraSuite* app = context;
- VariableItem* item;
- uint8_t value_index;
-
- // Camera Orientation
- item = variable_item_list_add(
- app->variable_item_list,
- "Orientation:",
- 4,
- camera_suite_scene_settings_set_camera_orientation,
- app);
- value_index = value_index_uint32(app->orientation, orientation_value, 4);
- variable_item_set_current_value_index(item, value_index);
- variable_item_set_current_value_text(item, orientation_text[value_index]);
-
- // Haptic FX ON/OFF
- item = variable_item_list_add(
- app->variable_item_list, "Haptic FX:", 2, camera_suite_scene_settings_set_haptic, app);
- value_index = value_index_uint32(app->haptic, haptic_value, 2);
- variable_item_set_current_value_index(item, value_index);
- variable_item_set_current_value_text(item, haptic_text[value_index]);
-
- // Sound FX ON/OFF
- item = variable_item_list_add(
- app->variable_item_list, "Sound FX:", 2, camera_suite_scene_settings_set_speaker, app);
- value_index = value_index_uint32(app->speaker, speaker_value, 2);
- variable_item_set_current_value_index(item, value_index);
- variable_item_set_current_value_text(item, speaker_text[value_index]);
-
- // LED FX ON/OFF
- item = variable_item_list_add(
- app->variable_item_list, "LED FX:", 2, camera_suite_scene_settings_set_led, app);
- value_index = value_index_uint32(app->led, led_value, 2);
- variable_item_set_current_value_index(item, value_index);
- variable_item_set_current_value_text(item, led_text[value_index]);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdSettings);
-}
-
-bool camera_suite_scene_settings_on_event(void* context, SceneManagerEvent event) {
- CameraSuite* app = context;
- UNUSED(app);
- bool consumed = false;
- if(event.type == SceneManagerEventTypeCustom) {
- }
- return consumed;
-}
-
-void camera_suite_scene_settings_on_exit(void* context) {
- CameraSuite* app = context;
- variable_item_list_set_selected_item(app->variable_item_list, 0);
- variable_item_list_reset(app->variable_item_list);
-}
\ No newline at end of file
diff --git a/applications/external/camera_suite/scenes/camera_suite_scene_start.c b/applications/external/camera_suite/scenes/camera_suite_scene_start.c
deleted file mode 100644
index 0dda05ede..000000000
--- a/applications/external/camera_suite/scenes/camera_suite_scene_start.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "../camera_suite.h"
-#include "../helpers/camera_suite_custom_event.h"
-#include "../views/camera_suite_view_start.h"
-
-void camera_suite_scene_start_callback(CameraSuiteCustomEvent event, void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- view_dispatcher_send_custom_event(app->view_dispatcher, event);
-}
-
-void camera_suite_scene_start_on_enter(void* context) {
- furi_assert(context);
- CameraSuite* app = context;
- camera_suite_view_start_set_callback(
- app->camera_suite_view_start, camera_suite_scene_start_callback, app);
- view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdStartscreen);
-}
-
-bool camera_suite_scene_start_on_event(void* context, SceneManagerEvent event) {
- CameraSuite* app = context;
- bool consumed = false;
-
- if(event.type == SceneManagerEventTypeCustom) {
- switch(event.event) {
- case CameraSuiteCustomEventStartLeft:
- case CameraSuiteCustomEventStartRight:
- case CameraSuiteCustomEventStartUp:
- case CameraSuiteCustomEventStartDown:
- // Do nothing.
- break;
- case CameraSuiteCustomEventStartOk:
- scene_manager_next_scene(app->scene_manager, CameraSuiteSceneMenu);
- consumed = true;
- break;
- case CameraSuiteCustomEventStartBack:
- notification_message(app->notification, &sequence_reset_red);
- notification_message(app->notification, &sequence_reset_green);
- notification_message(app->notification, &sequence_reset_blue);
- if(!scene_manager_search_and_switch_to_previous_scene(
- app->scene_manager, CameraSuiteSceneStart)) {
- scene_manager_stop(app->scene_manager);
- view_dispatcher_stop(app->view_dispatcher);
- }
- consumed = true;
- break;
- }
- }
-
- return consumed;
-}
-
-void camera_suite_scene_start_on_exit(void* context) {
- CameraSuite* app = context;
- UNUSED(app);
-}
\ No newline at end of file
diff --git a/applications/external/camera_suite/screenshots/camera_preview.png b/applications/external/camera_suite/screenshots/camera_preview.png
deleted file mode 100644
index 5f66ec42c..000000000
Binary files a/applications/external/camera_suite/screenshots/camera_preview.png and /dev/null differ
diff --git a/applications/external/camera_suite/screenshots/guide.png b/applications/external/camera_suite/screenshots/guide.png
deleted file mode 100644
index 87ed51218..000000000
Binary files a/applications/external/camera_suite/screenshots/guide.png and /dev/null differ
diff --git a/applications/external/camera_suite/screenshots/main_menu.png b/applications/external/camera_suite/screenshots/main_menu.png
deleted file mode 100644
index 3ae802cc2..000000000
Binary files a/applications/external/camera_suite/screenshots/main_menu.png and /dev/null differ
diff --git a/applications/external/camera_suite/screenshots/settings.png b/applications/external/camera_suite/screenshots/settings.png
deleted file mode 100644
index 32de46d72..000000000
Binary files a/applications/external/camera_suite/screenshots/settings.png and /dev/null differ
diff --git a/applications/external/camera_suite/screenshots/start_screen.png b/applications/external/camera_suite/screenshots/start_screen.png
deleted file mode 100644
index 6fe690c58..000000000
Binary files a/applications/external/camera_suite/screenshots/start_screen.png and /dev/null differ
diff --git a/applications/external/camera_suite/views/camera_suite_view_camera.c b/applications/external/camera_suite/views/camera_suite_view_camera.c
deleted file mode 100644
index 5d710044b..000000000
--- a/applications/external/camera_suite/views/camera_suite_view_camera.c
+++ /dev/null
@@ -1,374 +0,0 @@
-#include "../camera_suite.h"
-#include
-#include
-#include
-#include
-#include
-#include "../helpers/camera_suite_haptic.h"
-#include "../helpers/camera_suite_speaker.h"
-#include "../helpers/camera_suite_led.h"
-
-static CameraSuiteViewCamera* current_instance = NULL;
-
-struct CameraSuiteViewCamera {
- CameraSuiteViewCameraCallback callback;
- FuriStreamBuffer* rx_stream;
- FuriThread* worker_thread;
- View* view;
- void* context;
-};
-
-void camera_suite_view_camera_set_callback(
- CameraSuiteViewCamera* instance,
- CameraSuiteViewCameraCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
- instance->callback = callback;
- instance->context = context;
-}
-
-// Function to draw pixels on the canvas based on camera orientation
-static void draw_pixel_by_orientation(Canvas* canvas, uint8_t x, uint8_t y, uint8_t orientation) {
- switch(orientation) {
- case 0: // Camera rotated 0 degrees (right side up, default)
- canvas_draw_dot(canvas, x, y);
- break;
- case 1: // Camera rotated 90 degrees
- canvas_draw_dot(canvas, y, FRAME_WIDTH - 1 - x);
- break;
- case 2: // Camera rotated 180 degrees (upside down)
- canvas_draw_dot(canvas, FRAME_WIDTH - 1 - x, FRAME_HEIGHT - 1 - y);
- break;
- case 3: // Camera rotated 270 degrees
- canvas_draw_dot(canvas, FRAME_HEIGHT - 1 - y, x);
- break;
- default:
- break;
- }
-}
-
-static void camera_suite_view_camera_draw(Canvas* canvas, void* _model) {
- UartDumpModel* model = _model;
-
- // Clear the screen.
- canvas_set_color(canvas, ColorBlack);
-
- // Draw the frame.
- canvas_draw_frame(canvas, 0, 0, FRAME_WIDTH, FRAME_HEIGHT);
-
- CameraSuite* app = current_instance->context;
-
- for(size_t p = 0; p < FRAME_BUFFER_LENGTH; ++p) {
- uint8_t x = p % ROW_BUFFER_LENGTH; // 0 .. 15
- uint8_t y = p / ROW_BUFFER_LENGTH; // 0 .. 63
-
- for(uint8_t i = 0; i < 8; ++i) {
- if((model->pixels[p] & (1 << (7 - i))) != 0) {
- draw_pixel_by_orientation(canvas, (x * 8) + i, y, app->orientation);
- }
- }
- }
-
- // Draw the guide if the camera is not initialized.
- if(!model->initialized) {
- canvas_draw_icon(canvas, 74, 16, &I_DolphinCommon_56x48);
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str(canvas, 8, 12, "Connect the ESP32-CAM");
- canvas_draw_str(canvas, 20, 24, "VCC - 3V3");
- canvas_draw_str(canvas, 20, 34, "GND - GND");
- canvas_draw_str(canvas, 20, 44, "U0R - TX");
- canvas_draw_str(canvas, 20, 54, "U0T - RX");
- }
-}
-
-static void camera_suite_view_camera_model_init(UartDumpModel* const model) {
- for(size_t i = 0; i < FRAME_BUFFER_LENGTH; i++) {
- model->pixels[i] = 0;
- }
-}
-
-static bool camera_suite_view_camera_input(InputEvent* event, void* context) {
- furi_assert(context);
- CameraSuiteViewCamera* instance = context;
- if(event->type == InputTypeRelease) {
- switch(event->key) {
- default: // Stop all sounds, reset the LED.
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- camera_suite_play_bad_bump(instance->context);
- camera_suite_stop_all_sound(instance->context);
- camera_suite_led_set_rgb(instance->context, 0, 0, 0);
- },
- true);
- break;
- }
- // Send `data` to the ESP32-CAM
- } else if(event->type == InputTypePress) {
- uint8_t data[1];
- switch(event->key) {
- case InputKeyBack:
- // Stop the camera stream.
- data[0] = 's';
- // Go back to the main menu.
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- instance->callback(CameraSuiteCustomEventSceneCameraBack, instance->context);
- },
- true);
- break;
- case InputKeyLeft:
- // Camera: Invert.
- data[0] = '<';
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- camera_suite_play_happy_bump(instance->context);
- camera_suite_play_input_sound(instance->context);
- camera_suite_led_set_rgb(instance->context, 0, 0, 255);
- instance->callback(CameraSuiteCustomEventSceneCameraLeft, instance->context);
- },
- true);
- break;
- case InputKeyRight:
- // Camera: Enable/disable dithering.
- data[0] = '>';
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- camera_suite_play_happy_bump(instance->context);
- camera_suite_play_input_sound(instance->context);
- camera_suite_led_set_rgb(instance->context, 0, 0, 255);
- instance->callback(CameraSuiteCustomEventSceneCameraRight, instance->context);
- },
- true);
- break;
- case InputKeyUp:
- // Camera: Increase contrast.
- data[0] = 'C';
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- camera_suite_play_happy_bump(instance->context);
- camera_suite_play_input_sound(instance->context);
- camera_suite_led_set_rgb(instance->context, 0, 0, 255);
- instance->callback(CameraSuiteCustomEventSceneCameraUp, instance->context);
- },
- true);
- break;
- case InputKeyDown:
- // Camera: Reduce contrast.
- data[0] = 'c';
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- camera_suite_play_happy_bump(instance->context);
- camera_suite_play_input_sound(instance->context);
- camera_suite_led_set_rgb(instance->context, 0, 0, 255);
- instance->callback(CameraSuiteCustomEventSceneCameraDown, instance->context);
- },
- true);
- break;
- case InputKeyOk:
- // Switch dithering types.
- data[0] = 'D';
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- UNUSED(model);
- camera_suite_play_happy_bump(instance->context);
- camera_suite_play_input_sound(instance->context);
- camera_suite_led_set_rgb(instance->context, 0, 0, 255);
- instance->callback(CameraSuiteCustomEventSceneCameraOk, instance->context);
- },
- true);
- break;
- case InputKeyMAX:
- break;
- }
- // Send `data` to the ESP32-CAM
- furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
- }
- return true;
-}
-
-static void camera_suite_view_camera_exit(void* context) {
- furi_assert(context);
-}
-
-static void camera_suite_view_camera_enter(void* context) {
- // Check `context` for null. If it is null, abort program, else continue.
- furi_assert(context);
-
- // Cast `context` to `CameraSuiteViewCamera*` and store it in `instance`.
- CameraSuiteViewCamera* instance = (CameraSuiteViewCamera*)context;
-
- // Assign the current instance to the global variable
- current_instance = instance;
-
- uint8_t data[1];
- data[0] = 'S'; // Uppercase `S` to start the camera
- // Send `data` to the ESP32-CAM
- furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
-
- with_view_model(
- instance->view,
- UartDumpModel * model,
- { camera_suite_view_camera_model_init(model); },
- true);
-}
-
-static void camera_on_irq_cb(UartIrqEvent uartIrqEvent, uint8_t data, void* context) {
- // Check `context` for null. If it is null, abort program, else continue.
- furi_assert(context);
-
- // Cast `context` to `CameraSuiteViewCamera*` and store it in `instance`.
- CameraSuiteViewCamera* instance = context;
-
- // If `uartIrqEvent` is `UartIrqEventRXNE`, send the data to the
- // `rx_stream` and set the `WorkerEventRx` flag.
- if(uartIrqEvent == UartIrqEventRXNE) {
- furi_stream_buffer_send(instance->rx_stream, &data, 1, 0);
- furi_thread_flags_set(furi_thread_get_id(instance->worker_thread), WorkerEventRx);
- }
-}
-
-static void process_ringbuffer(UartDumpModel* model, uint8_t byte) {
- // First char has to be 'Y' in the buffer.
- if(model->ringbuffer_index == 0 && byte != 'Y') {
- return;
- }
-
- // Second char has to be ':' in the buffer or reset.
- if(model->ringbuffer_index == 1 && byte != ':') {
- model->ringbuffer_index = 0;
- process_ringbuffer(model, byte);
- return;
- }
-
- // Assign current byte to the ringbuffer.
- model->row_ringbuffer[model->ringbuffer_index] = byte;
- // Increment the ringbuffer index.
- ++model->ringbuffer_index;
-
- // Let's wait 'till the buffer fills.
- if(model->ringbuffer_index < RING_BUFFER_LENGTH) {
- return;
- }
-
- // Flush the ringbuffer to the framebuffer.
- model->ringbuffer_index = 0; // Reset the ringbuffer
- model->initialized = true; // Established the connection successfully.
- size_t row_start_index =
- model->row_ringbuffer[2] * ROW_BUFFER_LENGTH; // Third char will determine the row number
-
- if(row_start_index > LAST_ROW_INDEX) { // Failsafe
- row_start_index = 0;
- }
-
- for(size_t i = 0; i < ROW_BUFFER_LENGTH; ++i) {
- model->pixels[row_start_index + i] =
- model->row_ringbuffer[i + 3]; // Writing the remaining 16 bytes into the frame buffer
- }
-}
-
-static int32_t camera_worker(void* context) {
- furi_assert(context);
- CameraSuiteViewCamera* instance = context;
-
- while(1) {
- uint32_t events =
- furi_thread_flags_wait(WORKER_EVENTS_MASK, FuriFlagWaitAny, FuriWaitForever);
- furi_check((events & FuriFlagError) == 0);
-
- if(events & WorkerEventStop) {
- break;
- } else if(events & WorkerEventRx) {
- size_t length = 0;
- do {
- size_t intended_data_size = 64;
- uint8_t data[intended_data_size];
- length =
- furi_stream_buffer_receive(instance->rx_stream, data, intended_data_size, 0);
-
- if(length > 0) {
- with_view_model(
- instance->view,
- UartDumpModel * model,
- {
- for(size_t i = 0; i < length; i++) {
- process_ringbuffer(model, data[i]);
- }
- },
- false);
- }
- } while(length > 0);
-
- with_view_model(
- instance->view, UartDumpModel * model, { UNUSED(model); }, true);
- }
- }
-
- return 0;
-}
-
-CameraSuiteViewCamera* camera_suite_view_camera_alloc() {
- CameraSuiteViewCamera* instance = malloc(sizeof(CameraSuiteViewCamera));
-
- instance->view = view_alloc();
-
- instance->rx_stream = furi_stream_buffer_alloc(2048, 1);
-
- // Set up views
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(UartDumpModel));
- view_set_context(instance->view, instance); // furi_assert crashes in events without this
- view_set_draw_callback(instance->view, (ViewDrawCallback)camera_suite_view_camera_draw);
- view_set_input_callback(instance->view, camera_suite_view_camera_input);
- view_set_enter_callback(instance->view, camera_suite_view_camera_enter);
- view_set_exit_callback(instance->view, camera_suite_view_camera_exit);
-
- with_view_model(
- instance->view,
- UartDumpModel * model,
- { camera_suite_view_camera_model_init(model); },
- true);
-
- instance->worker_thread = furi_thread_alloc_ex("UsbUartWorker", 2048, camera_worker, instance);
- furi_thread_start(instance->worker_thread);
-
- // Enable uart listener
- furi_hal_console_disable();
- furi_hal_uart_set_br(FuriHalUartIdUSART1, 230400);
- furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, camera_on_irq_cb, instance);
-
- return instance;
-}
-
-void camera_suite_view_camera_free(CameraSuiteViewCamera* instance) {
- furi_assert(instance);
-
- with_view_model(
- instance->view, UartDumpModel * model, { UNUSED(model); }, true);
- view_free(instance->view);
- free(instance);
-}
-
-View* camera_suite_view_camera_get_view(CameraSuiteViewCamera* instance) {
- furi_assert(instance);
- return instance->view;
-}
\ No newline at end of file
diff --git a/applications/external/camera_suite/views/camera_suite_view_camera.h b/applications/external/camera_suite/views/camera_suite_view_camera.h
deleted file mode 100644
index 5ccbac71a..000000000
--- a/applications/external/camera_suite/views/camera_suite_view_camera.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "../helpers/camera_suite_custom_event.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#pragma once
-
-#define FRAME_WIDTH 128
-#define FRAME_HEIGHT 64
-#define FRAME_BIT_DEPTH 1
-#define FRAME_BUFFER_LENGTH 1024
-#define ROW_BUFFER_LENGTH 16
-#define RING_BUFFER_LENGTH 19
-#define LAST_ROW_INDEX 1008
-
-extern const Icon I_DolphinCommon_56x48;
-
-typedef struct UartDumpModel UartDumpModel;
-
-struct UartDumpModel {
- bool initialized;
- int rotation_angle;
- uint8_t pixels[FRAME_BUFFER_LENGTH];
- uint8_t ringbuffer_index;
- uint8_t row_ringbuffer[RING_BUFFER_LENGTH];
-};
-
-typedef struct CameraSuiteViewCamera CameraSuiteViewCamera;
-
-typedef void (*CameraSuiteViewCameraCallback)(CameraSuiteCustomEvent event, void* context);
-
-void camera_suite_view_camera_set_callback(
- CameraSuiteViewCamera* camera_suite_view_camera,
- CameraSuiteViewCameraCallback callback,
- void* context);
-
-CameraSuiteViewCamera* camera_suite_view_camera_alloc();
-
-void camera_suite_view_camera_free(CameraSuiteViewCamera* camera_suite_static);
-
-View* camera_suite_view_camera_get_view(CameraSuiteViewCamera* camera_suite_static);
-
-typedef enum {
- // Reserved for StreamBuffer internal event
- WorkerEventReserved = (1 << 0),
- WorkerEventStop = (1 << 1),
- WorkerEventRx = (1 << 2),
-} WorkerEventFlags;
-
-#define WORKER_EVENTS_MASK (WorkerEventStop | WorkerEventRx)
diff --git a/applications/external/camera_suite/views/camera_suite_view_guide.c b/applications/external/camera_suite/views/camera_suite_view_guide.c
deleted file mode 100644
index 479f8d4d1..000000000
--- a/applications/external/camera_suite/views/camera_suite_view_guide.c
+++ /dev/null
@@ -1,120 +0,0 @@
-#include "../camera_suite.h"
-#include
-#include
-#include
-#include
-#include
-
-struct CameraSuiteViewGuide {
- View* view;
- CameraSuiteViewGuideCallback callback;
- void* context;
-};
-
-typedef struct {
- int some_value;
-} CameraSuiteViewGuideModel;
-
-void camera_suite_view_guide_set_callback(
- CameraSuiteViewGuide* instance,
- CameraSuiteViewGuideCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
- instance->callback = callback;
- instance->context = context;
-}
-
-void camera_suite_view_guide_draw(Canvas* canvas, CameraSuiteViewGuideModel* model) {
- UNUSED(model);
- canvas_clear(canvas);
- canvas_set_color(canvas, ColorBlack);
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, "Guide");
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str_aligned(canvas, 0, 12, AlignLeft, AlignTop, "Left = Toggle Invert");
- canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignTop, "Right = Toggle Dithering");
- canvas_draw_str_aligned(canvas, 0, 32, AlignLeft, AlignTop, "Up = Contrast Up");
- canvas_draw_str_aligned(canvas, 0, 42, AlignLeft, AlignTop, "Down = Contrast Down");
- // TODO: Possibly update to take picture instead.
- canvas_draw_str_aligned(canvas, 0, 52, AlignLeft, AlignTop, "Center = Toggle Dither Type");
-}
-
-static void camera_suite_view_guide_model_init(CameraSuiteViewGuideModel* const model) {
- model->some_value = 1;
-}
-
-bool camera_suite_view_guide_input(InputEvent* event, void* context) {
- furi_assert(context);
- CameraSuiteViewGuide* instance = context;
- if(event->type == InputTypeRelease) {
- switch(event->key) {
- case InputKeyBack:
- with_view_model(
- instance->view,
- CameraSuiteViewGuideModel * model,
- {
- UNUSED(model);
- instance->callback(CameraSuiteCustomEventSceneGuideBack, instance->context);
- },
- true);
- break;
- case InputKeyLeft:
- case InputKeyRight:
- case InputKeyUp:
- case InputKeyDown:
- case InputKeyOk:
- case InputKeyMAX:
- // Do nothing.
- break;
- }
- }
- return true;
-}
-
-void camera_suite_view_guide_exit(void* context) {
- furi_assert(context);
-}
-
-void camera_suite_view_guide_enter(void* context) {
- furi_assert(context);
- CameraSuiteViewGuide* instance = (CameraSuiteViewGuide*)context;
- with_view_model(
- instance->view,
- CameraSuiteViewGuideModel * model,
- { camera_suite_view_guide_model_init(model); },
- true);
-}
-
-CameraSuiteViewGuide* camera_suite_view_guide_alloc() {
- CameraSuiteViewGuide* instance = malloc(sizeof(CameraSuiteViewGuide));
- instance->view = view_alloc();
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(CameraSuiteViewGuideModel));
- view_set_context(instance->view, instance); // furi_assert crashes in events without this
- view_set_draw_callback(instance->view, (ViewDrawCallback)camera_suite_view_guide_draw);
- view_set_input_callback(instance->view, camera_suite_view_guide_input);
- view_set_enter_callback(instance->view, camera_suite_view_guide_enter);
- view_set_exit_callback(instance->view, camera_suite_view_guide_exit);
-
- with_view_model(
- instance->view,
- CameraSuiteViewGuideModel * model,
- { camera_suite_view_guide_model_init(model); },
- true);
-
- return instance;
-}
-
-void camera_suite_view_guide_free(CameraSuiteViewGuide* instance) {
- furi_assert(instance);
-
- with_view_model(
- instance->view, CameraSuiteViewGuideModel * model, { UNUSED(model); }, true);
- view_free(instance->view);
- free(instance);
-}
-
-View* camera_suite_view_guide_get_view(CameraSuiteViewGuide* instance) {
- furi_assert(instance);
- return instance->view;
-}
diff --git a/applications/external/camera_suite/views/camera_suite_view_guide.h b/applications/external/camera_suite/views/camera_suite_view_guide.h
deleted file mode 100644
index cd78d4b01..000000000
--- a/applications/external/camera_suite/views/camera_suite_view_guide.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-#include
-#include "../helpers/camera_suite_custom_event.h"
-
-typedef struct CameraSuiteViewGuide CameraSuiteViewGuide;
-
-typedef void (*CameraSuiteViewGuideCallback)(CameraSuiteCustomEvent event, void* context);
-
-void camera_suite_view_guide_set_callback(
- CameraSuiteViewGuide* camera_suite_view_guide,
- CameraSuiteViewGuideCallback callback,
- void* context);
-
-View* camera_suite_view_guide_get_view(CameraSuiteViewGuide* camera_suite_static);
-
-CameraSuiteViewGuide* camera_suite_view_guide_alloc();
-
-void camera_suite_view_guide_free(CameraSuiteViewGuide* camera_suite_static);
\ No newline at end of file
diff --git a/applications/external/camera_suite/views/camera_suite_view_start.c b/applications/external/camera_suite/views/camera_suite_view_start.c
deleted file mode 100644
index a84ee50c2..000000000
--- a/applications/external/camera_suite/views/camera_suite_view_start.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include "../camera_suite.h"
-#include
-#include
-#include
-#include
-
-struct CameraSuiteViewStart {
- View* view;
- CameraSuiteViewStartCallback callback;
- void* context;
-};
-
-typedef struct {
- int some_value;
-} CameraSuiteViewStartModel;
-
-void camera_suite_view_start_set_callback(
- CameraSuiteViewStart* instance,
- CameraSuiteViewStartCallback callback,
- void* context) {
- furi_assert(instance);
- furi_assert(callback);
- instance->callback = callback;
- instance->context = context;
-}
-
-void camera_suite_view_start_draw(Canvas* canvas, CameraSuiteViewStartModel* model) {
- UNUSED(model);
- canvas_clear(canvas);
- canvas_set_color(canvas, ColorBlack);
- canvas_set_font(canvas, FontPrimary);
- canvas_draw_str_aligned(canvas, 64, 10, AlignCenter, AlignTop, "Camera Suite");
- canvas_set_font(canvas, FontSecondary);
- canvas_draw_str_aligned(canvas, 64, 22, AlignCenter, AlignTop, "Flipper Zero");
- canvas_draw_str_aligned(canvas, 64, 32, AlignCenter, AlignTop, "ESP32 CAM");
- elements_button_center(canvas, "Start");
-}
-
-static void camera_suite_view_start_model_init(CameraSuiteViewStartModel* const model) {
- model->some_value = 1;
-}
-
-bool camera_suite_view_start_input(InputEvent* event, void* context) {
- furi_assert(context);
- CameraSuiteViewStart* instance = context;
- if(event->type == InputTypeRelease) {
- switch(event->key) {
- case InputKeyBack:
- // Exit application.
- with_view_model(
- instance->view,
- CameraSuiteViewStartModel * model,
- {
- UNUSED(model);
- instance->callback(CameraSuiteCustomEventStartBack, instance->context);
- },
- true);
- break;
- case InputKeyOk:
- // Start the application.
- with_view_model(
- instance->view,
- CameraSuiteViewStartModel * model,
- {
- UNUSED(model);
- instance->callback(CameraSuiteCustomEventStartOk, instance->context);
- },
- true);
- break;
- case InputKeyMAX:
- case InputKeyLeft:
- case InputKeyRight:
- case InputKeyUp:
- case InputKeyDown:
- // Do nothing.
- break;
- }
- }
- return true;
-}
-
-void camera_suite_view_start_exit(void* context) {
- furi_assert(context);
-}
-
-void camera_suite_view_start_enter(void* context) {
- furi_assert(context);
- CameraSuiteViewStart* instance = (CameraSuiteViewStart*)context;
- with_view_model(
- instance->view,
- CameraSuiteViewStartModel * model,
- { camera_suite_view_start_model_init(model); },
- true);
-}
-
-CameraSuiteViewStart* camera_suite_view_start_alloc() {
- CameraSuiteViewStart* instance = malloc(sizeof(CameraSuiteViewStart));
- instance->view = view_alloc();
- view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(CameraSuiteViewStartModel));
- // furi_assert crashes in events without this
- view_set_context(instance->view, instance);
- view_set_draw_callback(instance->view, (ViewDrawCallback)camera_suite_view_start_draw);
- view_set_input_callback(instance->view, camera_suite_view_start_input);
-
- with_view_model(
- instance->view,
- CameraSuiteViewStartModel * model,
- { camera_suite_view_start_model_init(model); },
- true);
-
- return instance;
-}
-
-void camera_suite_view_start_free(CameraSuiteViewStart* instance) {
- furi_assert(instance);
-
- with_view_model(
- instance->view, CameraSuiteViewStartModel * model, { UNUSED(model); }, true);
- view_free(instance->view);
- free(instance);
-}
-
-View* camera_suite_view_start_get_view(CameraSuiteViewStart* instance) {
- furi_assert(instance);
- return instance->view;
-}
diff --git a/applications/external/camera_suite/views/camera_suite_view_start.h b/applications/external/camera_suite/views/camera_suite_view_start.h
deleted file mode 100644
index e991cce92..000000000
--- a/applications/external/camera_suite/views/camera_suite_view_start.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-#include
-#include "../helpers/camera_suite_custom_event.h"
-
-typedef struct CameraSuiteViewStart CameraSuiteViewStart;
-
-typedef void (*CameraSuiteViewStartCallback)(CameraSuiteCustomEvent event, void* context);
-
-void camera_suite_view_start_set_callback(
- CameraSuiteViewStart* camera_suite_view_start,
- CameraSuiteViewStartCallback callback,
- void* context);
-
-View* camera_suite_view_start_get_view(CameraSuiteViewStart* camera_suite_static);
-
-CameraSuiteViewStart* camera_suite_view_start_alloc();
-
-void camera_suite_view_start_free(CameraSuiteViewStart* camera_suite_static);
\ No newline at end of file
diff --git a/applications/external/dap_link/README.md b/applications/external/dap_link/README.md
deleted file mode 100644
index aead0a60a..000000000
--- a/applications/external/dap_link/README.md
+++ /dev/null
@@ -1,105 +0,0 @@
-# Flipper Zero as CMSIS DAP/DAP Link
-Flipper Zero as a [Free-DAP](https://github.com/ataradov/free-dap) based SWD\JTAG debugger. Free-DAP is a free and open source firmware implementation of the [CMSIS-DAP](https://www.keil.com/pack/doc/CMSIS_Dev/DAP/html/index.html) debugger.
-
-## Protocols
-SWD, JTAG , CMSIS-DAP v1 (18 KiB/s), CMSIS-DAP v2 (46 KiB/s), VCP (USB-UART).
-
-WinUSB for driverless installation for Windows 8 and above.
-
-## Usage
-
-### VSCode + Cortex-Debug
- Set `"device": "cmsis-dap"`
-
-
- BluePill configuration example
-
- ```json
-{
- "name": "Attach (DAP)",
- "cwd": "${workspaceFolder}",
- "executable": "./build/firmware.elf",
- "request": "attach",
- "type": "cortex-debug",
- "servertype": "openocd",
- "device": "cmsis-dap",
- "configFiles": [
- "interface/cmsis-dap.cfg",
- "target/stm32f1x.cfg",
- ],
-},
- ```
-
-
-
- Flipper Zero configuration example
-
- ```json
-{
- "name": "Attach (DAP)",
- "cwd": "${workspaceFolder}",
- "executable": "./build/latest/firmware.elf",
- "request": "attach",
- "type": "cortex-debug",
- "servertype": "openocd",
- "device": "cmsis-dap",
- "svdFile": "./debug/STM32WB55_CM4.svd",
- "rtos": "FreeRTOS",
- "configFiles": [
- "interface/cmsis-dap.cfg",
- "./debug/stm32wbx.cfg",
- ],
- "postAttachCommands": [
- "source debug/flipperapps.py",
- ],
-},
- ```
-
-
-### OpenOCD
-Use `interface/cmsis-dap.cfg`. You will need OpenOCD v0.11.0.
-
-Additional commands:
-* `cmsis_dap_backend hid` for CMSIS-DAP v1 protocol.
-* `cmsis_dap_backend usb_bulk` for CMSIS-DAP v2 protocol.
-* `cmsis_dap_serial DAP_Oyevoxo` use DAP-Link running on Flipper named `Oyevoxo`.
-* `cmsis-dap cmd 81` - reboot connected DAP-Link.
-
-
- Flash BluePill
-
- ```
-openocd -f interface/cmsis-dap.cfg -f target/stm32f1x.cfg -c init -c "program build/firmware.bin reset exit 0x8000000"
- ```
-
-
-
- Flash Flipper Zero using DAP v2 protocol
-
- ```
-openocd -f interface/cmsis-dap.cfg -c "cmsis_dap_backend usb_bulk" -f debug/stm32wbx.cfg -c init -c "program build/latest/firmware.bin reset exit 0x8000000"
- ```
-
-
-
- Reboot connected DAP-Link on Flipper named Oyevoxo
-
- ```
-openocd -f interface/cmsis-dap.cfg -c "cmsis_dap_serial DAP_Oyevoxo" -c "transport select swd" -c "adapter speed 4000000" -c init -c "cmsis-dap cmd 81" -c "exit"
- ```
-
-
-### PlatformIO
-Use `debug_tool = cmsis-dap` and `upload_protocol = cmsis-dap`. [Documentation](https://docs.platformio.org/en/latest/plus/debug-tools/cmsis-dap.html#debugging-tool-cmsis-dap). Remember that Windows 8 and above do not require drivers.
-
-
- BluePill platformio.ini example
-
- ```
-[env:bluepill_f103c8]
-platform = ststm32
-board = bluepill_f103c8
-debug_tool = cmsis-dap
-upload_protocol = cmsis-dap
- ```
-
diff --git a/applications/external/dap_link/application.fam b/applications/external/dap_link/application.fam
deleted file mode 100644
index 017143803..000000000
--- a/applications/external/dap_link/application.fam
+++ /dev/null
@@ -1,24 +0,0 @@
-App(
- appid="dap_link",
- name="DAP Link",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="dap_link_app",
- requires=[
- "gui",
- "dialogs",
- ],
- stack_size=4 * 1024,
- order=20,
- fap_icon="dap_link.png",
- fap_category="GPIO",
- fap_private_libs=[
- Lib(
- name="free-dap",
- cincludes=["."],
- sources=[
- "dap.c",
- ],
- ),
- ],
- fap_icon_assets="icons",
-)
diff --git a/applications/external/dap_link/dap_config.h b/applications/external/dap_link/dap_config.h
deleted file mode 100644
index 88b90bd34..000000000
--- a/applications/external/dap_link/dap_config.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// SPDX-License-Identifier: BSD-3-Clause
-// Copyright (c) 2022, Alex Taradov . All rights reserved.
-
-#ifndef _DAP_CONFIG_H_
-#define _DAP_CONFIG_H_
-
-/*- Includes ----------------------------------------------------------------*/
-#include
-
-/*- Definitions -------------------------------------------------------------*/
-#define DAP_CONFIG_ENABLE_JTAG
-
-#define DAP_CONFIG_DEFAULT_PORT DAP_PORT_SWD
-#define DAP_CONFIG_DEFAULT_CLOCK 4200000 // Hz
-
-#define DAP_CONFIG_PACKET_SIZE 64
-#define DAP_CONFIG_PACKET_COUNT 1
-
-#define DAP_CONFIG_JTAG_DEV_COUNT 8
-
-// DAP_CONFIG_PRODUCT_STR must contain "CMSIS-DAP" to be compatible with the standard
-#define DAP_CONFIG_VENDOR_STR "Flipper Zero"
-#define DAP_CONFIG_PRODUCT_STR "Generic CMSIS-DAP Adapter"
-#define DAP_CONFIG_SER_NUM_STR usb_serial_number
-#define DAP_CONFIG_CMSIS_DAP_VER_STR "2.0.0"
-
-#define DAP_CONFIG_RESET_TARGET_FN dap_app_target_reset
-#define DAP_CONFIG_VENDOR_FN dap_app_vendor_cmd
-
-// Attribute to use for performance-critical functions
-#define DAP_CONFIG_PERFORMANCE_ATTR
-
-// A value at which dap_clock_test() produces 1 kHz output on the SWCLK pin
-// #define DAP_CONFIG_DELAY_CONSTANT 19000
-#define DAP_CONFIG_DELAY_CONSTANT 6290
-
-// A threshold for switching to fast clock (no added delays)
-// This is the frequency produced by dap_clock_test(1) on the SWCLK pin
-#define DAP_CONFIG_FAST_CLOCK 2400000 // Hz
-
-/*- Prototypes --------------------------------------------------------------*/
-extern char usb_serial_number[16];
-
-/*- Implementations ---------------------------------------------------------*/
-extern GpioPin flipper_dap_swclk_pin;
-extern GpioPin flipper_dap_swdio_pin;
-extern GpioPin flipper_dap_reset_pin;
-extern GpioPin flipper_dap_tdo_pin;
-extern GpioPin flipper_dap_tdi_pin;
-
-extern void dap_app_vendor_cmd(uint8_t cmd);
-extern void dap_app_target_reset();
-extern void dap_app_disconnect();
-extern void dap_app_connect_swd();
-extern void dap_app_connect_jtag();
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SWCLK_TCK_write(int value) {
- furi_hal_gpio_write(&flipper_dap_swclk_pin, value);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SWDIO_TMS_write(int value) {
- furi_hal_gpio_write(&flipper_dap_swdio_pin, value);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_TDI_write(int value) {
-#ifdef DAP_CONFIG_ENABLE_JTAG
- furi_hal_gpio_write(&flipper_dap_tdi_pin, value);
-#else
- (void)value;
-#endif
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_TDO_write(int value) {
-#ifdef DAP_CONFIG_ENABLE_JTAG
- furi_hal_gpio_write(&flipper_dap_tdo_pin, value);
-#else
- (void)value;
-#endif
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_nTRST_write(int value) {
- (void)value;
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_nRESET_write(int value) {
- furi_hal_gpio_write(&flipper_dap_reset_pin, value);
-}
-
-//-----------------------------------------------------------------------------
-static inline int DAP_CONFIG_SWCLK_TCK_read(void) {
- return furi_hal_gpio_read(&flipper_dap_swclk_pin);
-}
-
-//-----------------------------------------------------------------------------
-static inline int DAP_CONFIG_SWDIO_TMS_read(void) {
- return furi_hal_gpio_read(&flipper_dap_swdio_pin);
-}
-
-//-----------------------------------------------------------------------------
-static inline int DAP_CONFIG_TDO_read(void) {
-#ifdef DAP_CONFIG_ENABLE_JTAG
- return furi_hal_gpio_read(&flipper_dap_tdo_pin);
-#else
- return 0;
-#endif
-}
-
-//-----------------------------------------------------------------------------
-static inline int DAP_CONFIG_TDI_read(void) {
-#ifdef DAP_CONFIG_ENABLE_JTAG
- return furi_hal_gpio_read(&flipper_dap_tdi_pin);
-#else
- return 0;
-#endif
-}
-
-//-----------------------------------------------------------------------------
-static inline int DAP_CONFIG_nTRST_read(void) {
- return 0;
-}
-
-//-----------------------------------------------------------------------------
-static inline int DAP_CONFIG_nRESET_read(void) {
- return furi_hal_gpio_read(&flipper_dap_reset_pin);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SWCLK_TCK_set(void) {
- LL_GPIO_SetOutputPin(flipper_dap_swclk_pin.port, flipper_dap_swclk_pin.pin);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SWCLK_TCK_clr(void) {
- LL_GPIO_ResetOutputPin(flipper_dap_swclk_pin.port, flipper_dap_swclk_pin.pin);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SWDIO_TMS_in(void) {
- LL_GPIO_SetPinMode(flipper_dap_swdio_pin.port, flipper_dap_swdio_pin.pin, LL_GPIO_MODE_INPUT);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SWDIO_TMS_out(void) {
- LL_GPIO_SetPinMode(flipper_dap_swdio_pin.port, flipper_dap_swdio_pin.pin, LL_GPIO_MODE_OUTPUT);
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_SETUP(void) {
- furi_hal_gpio_init(&flipper_dap_swdio_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_swclk_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_reset_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
-#ifdef DAP_CONFIG_ENABLE_JTAG
- furi_hal_gpio_init(&flipper_dap_tdo_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_tdi_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
-#endif
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_DISCONNECT(void) {
- furi_hal_gpio_init(&flipper_dap_swdio_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_swclk_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_reset_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
-#ifdef DAP_CONFIG_ENABLE_JTAG
- furi_hal_gpio_init(&flipper_dap_tdo_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_tdi_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
-#endif
- dap_app_disconnect();
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_CONNECT_SWD(void) {
- furi_hal_gpio_init(
- &flipper_dap_swdio_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_swdio_pin, true);
-
- furi_hal_gpio_init(
- &flipper_dap_swclk_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_swclk_pin, true);
-
- furi_hal_gpio_init(
- &flipper_dap_reset_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_reset_pin, true);
-
-#ifdef DAP_CONFIG_ENABLE_JTAG
- furi_hal_gpio_init(&flipper_dap_tdo_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_init(&flipper_dap_tdi_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
-#endif
- dap_app_connect_swd();
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_CONNECT_JTAG(void) {
- furi_hal_gpio_init(
- &flipper_dap_swdio_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_swdio_pin, true);
-
- furi_hal_gpio_init(
- &flipper_dap_swclk_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_swclk_pin, true);
-
- furi_hal_gpio_init(
- &flipper_dap_reset_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_reset_pin, true);
-
-#ifdef DAP_CONFIG_ENABLE_JTAG
- furi_hal_gpio_init(&flipper_dap_tdo_pin, GpioModeInput, GpioPullNo, GpioSpeedVeryHigh);
-
- furi_hal_gpio_init(
- &flipper_dap_tdi_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
- furi_hal_gpio_write(&flipper_dap_tdi_pin, true);
-#endif
- dap_app_connect_jtag();
-}
-
-//-----------------------------------------------------------------------------
-static inline void DAP_CONFIG_LED(int index, int state) {
- (void)index;
- (void)state;
-}
-
-//-----------------------------------------------------------------------------
-__attribute__((always_inline)) static inline void DAP_CONFIG_DELAY(uint32_t cycles) {
- asm volatile("1: subs %[cycles], %[cycles], #1 \n"
- " bne 1b \n"
- : [cycles] "+l"(cycles));
-}
-
-#endif // _DAP_CONFIG_H_
diff --git a/applications/external/dap_link/dap_link.c b/applications/external/dap_link/dap_link.c
deleted file mode 100644
index eafb435e7..000000000
--- a/applications/external/dap_link/dap_link.c
+++ /dev/null
@@ -1,527 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "dap_link.h"
-#include "dap_config.h"
-#include "gui/dap_gui.h"
-#include "usb/dap_v2_usb.h"
-#include
-#include "dap_link_icons.h"
-
-/***************************************************************************/
-/****************************** DAP COMMON *********************************/
-/***************************************************************************/
-
-struct DapApp {
- FuriThread* dap_thread;
- FuriThread* cdc_thread;
- FuriThread* gui_thread;
-
- DapState state;
- DapConfig config;
-};
-
-void dap_app_get_state(DapApp* app, DapState* state) {
- *state = app->state;
-}
-
-#define DAP_PROCESS_THREAD_TICK 500
-
-typedef enum {
- DapThreadEventStop = (1 << 0),
-} DapThreadEvent;
-
-void dap_thread_send_stop(FuriThread* thread) {
- furi_thread_flags_set(furi_thread_get_id(thread), DapThreadEventStop);
-}
-
-GpioPin flipper_dap_swclk_pin;
-GpioPin flipper_dap_swdio_pin;
-GpioPin flipper_dap_reset_pin;
-GpioPin flipper_dap_tdo_pin;
-GpioPin flipper_dap_tdi_pin;
-
-/***************************************************************************/
-/****************************** DAP PROCESS ********************************/
-/***************************************************************************/
-
-typedef struct {
- uint8_t data[DAP_CONFIG_PACKET_SIZE];
- uint8_t size;
-} DapPacket;
-
-typedef enum {
- DAPThreadEventStop = DapThreadEventStop,
- DAPThreadEventRxV1 = (1 << 1),
- DAPThreadEventRxV2 = (1 << 2),
- DAPThreadEventUSBConnect = (1 << 3),
- DAPThreadEventUSBDisconnect = (1 << 4),
- DAPThreadEventApplyConfig = (1 << 5),
- DAPThreadEventAll = DAPThreadEventStop | DAPThreadEventRxV1 | DAPThreadEventRxV2 |
- DAPThreadEventUSBConnect | DAPThreadEventUSBDisconnect |
- DAPThreadEventApplyConfig,
-} DAPThreadEvent;
-
-#define USB_SERIAL_NUMBER_LEN 16
-char usb_serial_number[USB_SERIAL_NUMBER_LEN] = {0};
-
-const char* dap_app_get_serial(DapApp* app) {
- UNUSED(app);
- return usb_serial_number;
-}
-
-static void dap_app_rx1_callback(void* context) {
- furi_assert(context);
- FuriThreadId thread_id = (FuriThreadId)context;
- furi_thread_flags_set(thread_id, DAPThreadEventRxV1);
-}
-
-static void dap_app_rx2_callback(void* context) {
- furi_assert(context);
- FuriThreadId thread_id = (FuriThreadId)context;
- furi_thread_flags_set(thread_id, DAPThreadEventRxV2);
-}
-
-static void dap_app_usb_state_callback(bool state, void* context) {
- furi_assert(context);
- FuriThreadId thread_id = (FuriThreadId)context;
- if(state) {
- furi_thread_flags_set(thread_id, DAPThreadEventUSBConnect);
- } else {
- furi_thread_flags_set(thread_id, DAPThreadEventUSBDisconnect);
- }
-}
-
-static void dap_app_process_v1() {
- DapPacket tx_packet;
- DapPacket rx_packet;
- memset(&tx_packet, 0, sizeof(DapPacket));
- rx_packet.size = dap_v1_usb_rx(rx_packet.data, DAP_CONFIG_PACKET_SIZE);
- dap_process_request(rx_packet.data, rx_packet.size, tx_packet.data, DAP_CONFIG_PACKET_SIZE);
- dap_v1_usb_tx(tx_packet.data, DAP_CONFIG_PACKET_SIZE);
-}
-
-static void dap_app_process_v2() {
- DapPacket tx_packet;
- DapPacket rx_packet;
- memset(&tx_packet, 0, sizeof(DapPacket));
- rx_packet.size = dap_v2_usb_rx(rx_packet.data, DAP_CONFIG_PACKET_SIZE);
- size_t len = dap_process_request(
- rx_packet.data, rx_packet.size, tx_packet.data, DAP_CONFIG_PACKET_SIZE);
- dap_v2_usb_tx(tx_packet.data, len);
-}
-
-void dap_app_vendor_cmd(uint8_t cmd) {
- // openocd -c "cmsis-dap cmd 81"
- if(cmd == 0x01) {
- furi_hal_power_reset();
- }
-}
-
-void dap_app_target_reset() {
- FURI_LOG_I("DAP", "Target reset");
-}
-
-static void dap_init_gpio(DapSwdPins swd_pins) {
- switch(swd_pins) {
- case DapSwdPinsPA7PA6:
- flipper_dap_swclk_pin = gpio_ext_pa7;
- flipper_dap_swdio_pin = gpio_ext_pa6;
- break;
- case DapSwdPinsPA14PA13:
- flipper_dap_swclk_pin = (GpioPin){.port = GPIOA, .pin = LL_GPIO_PIN_14};
- flipper_dap_swdio_pin = (GpioPin){.port = GPIOA, .pin = LL_GPIO_PIN_13};
- break;
- }
-
- flipper_dap_reset_pin = gpio_ext_pa4;
- flipper_dap_tdo_pin = gpio_ext_pb3;
- flipper_dap_tdi_pin = gpio_ext_pb2;
-}
-
-static void dap_deinit_gpio(DapSwdPins swd_pins) {
- // setup gpio pins to default state
- furi_hal_gpio_init(&flipper_dap_reset_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- furi_hal_gpio_init(&flipper_dap_tdo_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- furi_hal_gpio_init(&flipper_dap_tdi_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
-
- if(DapSwdPinsPA14PA13 == swd_pins) {
- // PA14 and PA13 are used by SWD
- furi_hal_gpio_init_ex(
- &flipper_dap_swclk_pin,
- GpioModeAltFunctionPushPull,
- GpioPullDown,
- GpioSpeedLow,
- GpioAltFn0JTCK_SWCLK);
- furi_hal_gpio_init_ex(
- &flipper_dap_swdio_pin,
- GpioModeAltFunctionPushPull,
- GpioPullUp,
- GpioSpeedVeryHigh,
- GpioAltFn0JTMS_SWDIO);
- } else {
- furi_hal_gpio_init(&flipper_dap_swclk_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- furi_hal_gpio_init(&flipper_dap_swdio_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
- }
-}
-
-static int32_t dap_process(void* p) {
- DapApp* app = p;
- DapState* dap_state = &(app->state);
-
- // allocate resources
- FuriHalUsbInterface* usb_config_prev;
- app->config.swd_pins = DapSwdPinsPA7PA6;
- DapSwdPins swd_pins_prev = app->config.swd_pins;
-
- // init pins
- dap_init_gpio(swd_pins_prev);
-
- // init dap
- dap_init();
-
- // get name
- const char* name = furi_hal_version_get_name_ptr();
- if(!name) {
- name = "Flipper";
- }
- snprintf(usb_serial_number, USB_SERIAL_NUMBER_LEN, "DAP_%s", name);
-
- // init usb
- usb_config_prev = furi_hal_usb_get_config();
- dap_common_usb_alloc_name(usb_serial_number);
- dap_common_usb_set_context(furi_thread_get_id(furi_thread_get_current()));
- dap_v1_usb_set_rx_callback(dap_app_rx1_callback);
- dap_v2_usb_set_rx_callback(dap_app_rx2_callback);
- dap_common_usb_set_state_callback(dap_app_usb_state_callback);
- furi_hal_usb_set_config(&dap_v2_usb_hid, NULL);
-
- // work
- uint32_t events;
- while(1) {
- events = furi_thread_flags_wait(DAPThreadEventAll, FuriFlagWaitAny, FuriWaitForever);
-
- if(!(events & FuriFlagError)) {
- if(events & DAPThreadEventRxV1) {
- dap_app_process_v1();
- dap_state->dap_counter++;
- dap_state->dap_version = DapVersionV1;
- }
-
- if(events & DAPThreadEventRxV2) {
- dap_app_process_v2();
- dap_state->dap_counter++;
- dap_state->dap_version = DapVersionV2;
- }
-
- if(events & DAPThreadEventUSBConnect) {
- dap_state->usb_connected = true;
- }
-
- if(events & DAPThreadEventUSBDisconnect) {
- dap_state->usb_connected = false;
- dap_state->dap_version = DapVersionUnknown;
- }
-
- if(events & DAPThreadEventApplyConfig) {
- if(swd_pins_prev != app->config.swd_pins) {
- dap_deinit_gpio(swd_pins_prev);
- swd_pins_prev = app->config.swd_pins;
- dap_init_gpio(swd_pins_prev);
- }
- }
-
- if(events & DAPThreadEventStop) {
- break;
- }
- }
- }
-
- // deinit usb
- furi_hal_usb_set_config(usb_config_prev, NULL);
- dap_common_usb_free_name();
- dap_deinit_gpio(swd_pins_prev);
- return 0;
-}
-
-/***************************************************************************/
-/****************************** CDC PROCESS ********************************/
-/***************************************************************************/
-
-typedef enum {
- CDCThreadEventStop = DapThreadEventStop,
- CDCThreadEventUARTRx = (1 << 1),
- CDCThreadEventCDCRx = (1 << 2),
- CDCThreadEventCDCConfig = (1 << 3),
- CDCThreadEventApplyConfig = (1 << 4),
- CDCThreadEventAll = CDCThreadEventStop | CDCThreadEventUARTRx | CDCThreadEventCDCRx |
- CDCThreadEventCDCConfig | CDCThreadEventApplyConfig,
-} CDCThreadEvent;
-
-typedef struct {
- FuriStreamBuffer* rx_stream;
- FuriThreadId thread_id;
- FuriHalUartId uart_id;
- struct usb_cdc_line_coding line_coding;
-} CDCProcess;
-
-static void cdc_uart_irq_cb(UartIrqEvent ev, uint8_t data, void* ctx) {
- CDCProcess* app = ctx;
-
- if(ev == UartIrqEventRXNE) {
- furi_stream_buffer_send(app->rx_stream, &data, 1, 0);
- furi_thread_flags_set(app->thread_id, CDCThreadEventUARTRx);
- }
-}
-
-static void cdc_usb_rx_callback(void* context) {
- CDCProcess* app = context;
- furi_thread_flags_set(app->thread_id, CDCThreadEventCDCRx);
-}
-
-static void cdc_usb_control_line_callback(uint8_t state, void* context) {
- UNUSED(context);
- UNUSED(state);
-}
-
-static void cdc_usb_config_callback(struct usb_cdc_line_coding* config, void* context) {
- CDCProcess* app = context;
- app->line_coding = *config;
- furi_thread_flags_set(app->thread_id, CDCThreadEventCDCConfig);
-}
-
-static FuriHalUartId cdc_init_uart(
- DapUartType type,
- DapUartTXRX swap,
- uint32_t baudrate,
- void (*cb)(UartIrqEvent ev, uint8_t data, void* ctx),
- void* ctx) {
- FuriHalUartId uart_id = FuriHalUartIdUSART1;
- if(baudrate == 0) baudrate = 115200;
-
- switch(type) {
- case DapUartTypeUSART1:
- uart_id = FuriHalUartIdUSART1;
- furi_hal_console_disable();
- furi_hal_uart_deinit(uart_id);
- if(swap == DapUartTXRXSwap) {
- LL_USART_SetTXRXSwap(USART1, LL_USART_TXRX_SWAPPED);
- } else {
- LL_USART_SetTXRXSwap(USART1, LL_USART_TXRX_STANDARD);
- }
- furi_hal_uart_init(uart_id, baudrate);
- furi_hal_uart_set_irq_cb(uart_id, cb, ctx);
- break;
- case DapUartTypeLPUART1:
- uart_id = FuriHalUartIdLPUART1;
- furi_hal_uart_deinit(uart_id);
- if(swap == DapUartTXRXSwap) {
- LL_LPUART_SetTXRXSwap(LPUART1, LL_LPUART_TXRX_SWAPPED);
- } else {
- LL_LPUART_SetTXRXSwap(LPUART1, LL_LPUART_TXRX_STANDARD);
- }
- furi_hal_uart_init(uart_id, baudrate);
- furi_hal_uart_set_irq_cb(uart_id, cb, ctx);
- break;
- }
-
- return uart_id;
-}
-
-static void cdc_deinit_uart(DapUartType type) {
- switch(type) {
- case DapUartTypeUSART1:
- furi_hal_uart_deinit(FuriHalUartIdUSART1);
- LL_USART_SetTXRXSwap(USART1, LL_USART_TXRX_STANDARD);
- furi_hal_console_init();
- break;
- case DapUartTypeLPUART1:
- furi_hal_uart_deinit(FuriHalUartIdLPUART1);
- LL_LPUART_SetTXRXSwap(LPUART1, LL_LPUART_TXRX_STANDARD);
- break;
- }
-}
-
-static int32_t cdc_process(void* p) {
- DapApp* dap_app = p;
- DapState* dap_state = &(dap_app->state);
-
- dap_app->config.uart_pins = DapUartTypeLPUART1;
- dap_app->config.uart_swap = DapUartTXRXNormal;
-
- DapUartType uart_pins_prev = dap_app->config.uart_pins;
- DapUartTXRX uart_swap_prev = dap_app->config.uart_swap;
-
- CDCProcess* app = malloc(sizeof(CDCProcess));
- app->thread_id = furi_thread_get_id(furi_thread_get_current());
- app->rx_stream = furi_stream_buffer_alloc(512, 1);
-
- const uint8_t rx_buffer_size = 64;
- uint8_t* rx_buffer = malloc(rx_buffer_size);
-
- app->uart_id = cdc_init_uart(
- uart_pins_prev, uart_swap_prev, dap_state->cdc_baudrate, cdc_uart_irq_cb, app);
-
- dap_cdc_usb_set_context(app);
- dap_cdc_usb_set_rx_callback(cdc_usb_rx_callback);
- dap_cdc_usb_set_control_line_callback(cdc_usb_control_line_callback);
- dap_cdc_usb_set_config_callback(cdc_usb_config_callback);
-
- uint32_t events;
- while(1) {
- events = furi_thread_flags_wait(CDCThreadEventAll, FuriFlagWaitAny, FuriWaitForever);
-
- if(!(events & FuriFlagError)) {
- if(events & CDCThreadEventCDCConfig) {
- if(dap_state->cdc_baudrate != app->line_coding.dwDTERate) {
- dap_state->cdc_baudrate = app->line_coding.dwDTERate;
- if(dap_state->cdc_baudrate > 0) {
- furi_hal_uart_set_br(app->uart_id, dap_state->cdc_baudrate);
- }
- }
- }
-
- if(events & CDCThreadEventUARTRx) {
- size_t len =
- furi_stream_buffer_receive(app->rx_stream, rx_buffer, rx_buffer_size, 0);
-
- if(len > 0) {
- dap_cdc_usb_tx(rx_buffer, len);
- }
- dap_state->cdc_rx_counter += len;
- }
-
- if(events & CDCThreadEventCDCRx) {
- size_t len = dap_cdc_usb_rx(rx_buffer, rx_buffer_size);
- if(len > 0) {
- furi_hal_uart_tx(app->uart_id, rx_buffer, len);
- }
- dap_state->cdc_tx_counter += len;
- }
-
- if(events & CDCThreadEventApplyConfig) {
- if(uart_pins_prev != dap_app->config.uart_pins ||
- uart_swap_prev != dap_app->config.uart_swap) {
- cdc_deinit_uart(uart_pins_prev);
- uart_pins_prev = dap_app->config.uart_pins;
- uart_swap_prev = dap_app->config.uart_swap;
- app->uart_id = cdc_init_uart(
- uart_pins_prev,
- uart_swap_prev,
- dap_state->cdc_baudrate,
- cdc_uart_irq_cb,
- app);
- }
- }
-
- if(events & CDCThreadEventStop) {
- break;
- }
- }
- }
-
- cdc_deinit_uart(uart_pins_prev);
- free(rx_buffer);
- furi_stream_buffer_free(app->rx_stream);
- free(app);
-
- return 0;
-}
-
-/***************************************************************************/
-/******************************* MAIN APP **********************************/
-/***************************************************************************/
-
-static DapApp* dap_app_alloc() {
- DapApp* dap_app = malloc(sizeof(DapApp));
- dap_app->dap_thread = furi_thread_alloc_ex("DAP Process", 1024, dap_process, dap_app);
- dap_app->cdc_thread = furi_thread_alloc_ex("DAP CDC", 1024, cdc_process, dap_app);
- dap_app->gui_thread = furi_thread_alloc_ex("DAP GUI", 1024, dap_gui_thread, dap_app);
- return dap_app;
-}
-
-static void dap_app_free(DapApp* dap_app) {
- furi_assert(dap_app);
- furi_thread_free(dap_app->dap_thread);
- furi_thread_free(dap_app->cdc_thread);
- furi_thread_free(dap_app->gui_thread);
- free(dap_app);
-}
-
-static DapApp* app_handle = NULL;
-
-void dap_app_disconnect() {
- app_handle->state.dap_mode = DapModeDisconnected;
-}
-
-void dap_app_connect_swd() {
- app_handle->state.dap_mode = DapModeSWD;
-}
-
-void dap_app_connect_jtag() {
- app_handle->state.dap_mode = DapModeJTAG;
-}
-
-void dap_app_set_config(DapApp* app, DapConfig* config) {
- app->config = *config;
- furi_thread_flags_set(furi_thread_get_id(app->dap_thread), DAPThreadEventApplyConfig);
- furi_thread_flags_set(furi_thread_get_id(app->cdc_thread), CDCThreadEventApplyConfig);
-}
-
-DapConfig* dap_app_get_config(DapApp* app) {
- return &app->config;
-}
-
-int32_t dap_link_app(void* p) {
- UNUSED(p);
-
- if(furi_hal_usb_is_locked()) {
- DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
- DialogMessage* message = dialog_message_alloc();
- dialog_message_set_header(message, "Connection\nis active!", 3, 2, AlignLeft, AlignTop);
- dialog_message_set_text(
- message,
- "Disconnect from\nPC or phone to\nuse this function.",
- 3,
- 30,
- AlignLeft,
- AlignTop);
- dialog_message_set_icon(message, &I_ActiveConnection_50x64, 78, 0);
- dialog_message_show(dialogs, message);
- dialog_message_free(message);
- furi_record_close(RECORD_DIALOGS);
- return -1;
- }
-
- // alloc app
- DapApp* app = dap_app_alloc();
- app_handle = app;
-
- furi_thread_start(app->dap_thread);
- furi_thread_start(app->cdc_thread);
- furi_thread_start(app->gui_thread);
-
- // wait until gui thread is finished
- furi_thread_join(app->gui_thread);
-
- // send stop event to threads
- dap_thread_send_stop(app->dap_thread);
- dap_thread_send_stop(app->cdc_thread);
-
- // wait for threads to stop
- furi_thread_join(app->dap_thread);
- furi_thread_join(app->cdc_thread);
-
- // free app
- dap_app_free(app);
-
- return 0;
-}
\ No newline at end of file
diff --git a/applications/external/dap_link/dap_link.h b/applications/external/dap_link/dap_link.h
deleted file mode 100644
index d51726c45..000000000
--- a/applications/external/dap_link/dap_link.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-#include
-
-typedef enum {
- DapModeDisconnected,
- DapModeSWD,
- DapModeJTAG,
-} DapMode;
-
-typedef enum {
- DapVersionUnknown,
- DapVersionV1,
- DapVersionV2,
-} DapVersion;
-
-typedef struct {
- bool usb_connected;
- DapMode dap_mode;
- DapVersion dap_version;
- uint32_t dap_counter;
- uint32_t cdc_baudrate;
- uint32_t cdc_tx_counter;
- uint32_t cdc_rx_counter;
-} DapState;
-
-typedef enum {
- DapSwdPinsPA7PA6, // Pins 2, 3
- DapSwdPinsPA14PA13, // Pins 10, 12
-} DapSwdPins;
-
-typedef enum {
- DapUartTypeUSART1, // Pins 13, 14
- DapUartTypeLPUART1, // Pins 15, 16
-} DapUartType;
-
-typedef enum {
- DapUartTXRXNormal,
- DapUartTXRXSwap,
-} DapUartTXRX;
-
-typedef struct {
- DapSwdPins swd_pins;
- DapUartType uart_pins;
- DapUartTXRX uart_swap;
-} DapConfig;
-
-typedef struct DapApp DapApp;
-
-void dap_app_get_state(DapApp* app, DapState* state);
-
-const char* dap_app_get_serial(DapApp* app);
-
-void dap_app_set_config(DapApp* app, DapConfig* config);
-
-DapConfig* dap_app_get_config(DapApp* app);
\ No newline at end of file
diff --git a/applications/external/dap_link/dap_link.png b/applications/external/dap_link/dap_link.png
deleted file mode 100644
index 2278ce2b6..000000000
Binary files a/applications/external/dap_link/dap_link.png and /dev/null differ
diff --git a/applications/external/dap_link/gui/dap_gui.c b/applications/external/dap_link/gui/dap_gui.c
deleted file mode 100644
index 4dd986153..000000000
--- a/applications/external/dap_link/gui/dap_gui.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "dap_gui.h"
-#include "dap_gui_i.h"
-
-#define DAP_GUI_TICK 250
-
-static bool dap_gui_custom_event_callback(void* context, uint32_t event) {
- furi_assert(context);
- DapGuiApp* app = context;
- return scene_manager_handle_custom_event(app->scene_manager, event);
-}
-
-static bool dap_gui_back_event_callback(void* context) {
- furi_assert(context);
- DapGuiApp* app = context;
- return scene_manager_handle_back_event(app->scene_manager);
-}
-
-static void dap_gui_tick_event_callback(void* context) {
- furi_assert(context);
- DapGuiApp* app = context;
- scene_manager_handle_tick_event(app->scene_manager);
-}
-
-DapGuiApp* dap_gui_alloc() {
- DapGuiApp* app = malloc(sizeof(DapGuiApp));
- app->gui = furi_record_open(RECORD_GUI);
- app->view_dispatcher = view_dispatcher_alloc();
- app->scene_manager = scene_manager_alloc(&dap_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, dap_gui_custom_event_callback);
- view_dispatcher_set_navigation_event_callback(
- app->view_dispatcher, dap_gui_back_event_callback);
- view_dispatcher_set_tick_event_callback(
- app->view_dispatcher, dap_gui_tick_event_callback, DAP_GUI_TICK);
-
- view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
-
- app->notifications = furi_record_open(RECORD_NOTIFICATION);
-
- app->var_item_list = variable_item_list_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher,
- DapGuiAppViewVarItemList,
- variable_item_list_get_view(app->var_item_list));
-
- app->main_view = dap_main_view_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, DapGuiAppViewMainView, dap_main_view_get_view(app->main_view));
-
- app->widget = widget_alloc();
- view_dispatcher_add_view(
- app->view_dispatcher, DapGuiAppViewWidget, widget_get_view(app->widget));
-
- scene_manager_next_scene(app->scene_manager, DapSceneMain);
-
- return app;
-}
-
-void dap_gui_free(DapGuiApp* app) {
- view_dispatcher_remove_view(app->view_dispatcher, DapGuiAppViewVarItemList);
- variable_item_list_free(app->var_item_list);
-
- view_dispatcher_remove_view(app->view_dispatcher, DapGuiAppViewMainView);
- dap_main_view_free(app->main_view);
-
- view_dispatcher_remove_view(app->view_dispatcher, DapGuiAppViewWidget);
- widget_free(app->widget);
-
- // View dispatcher
- view_dispatcher_free(app->view_dispatcher);
- scene_manager_free(app->scene_manager);
-
- // Close records
- furi_record_close(RECORD_GUI);
- furi_record_close(RECORD_NOTIFICATION);
-
- free(app);
-}
-
-int32_t dap_gui_thread(void* arg) {
- DapGuiApp* app = dap_gui_alloc();
- app->dap_app = arg;
-
- notification_message_block(app->notifications, &sequence_display_backlight_enforce_on);
- view_dispatcher_run(app->view_dispatcher);
- notification_message_block(app->notifications, &sequence_display_backlight_enforce_auto);
-
- dap_gui_free(app);
- return 0;
-}
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/dap_gui.h b/applications/external/dap_link/gui/dap_gui.h
deleted file mode 100644
index 3d8e6bdf9..000000000
--- a/applications/external/dap_link/gui/dap_gui.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#pragma once
-#include
-
-int32_t dap_gui_thread(void* arg);
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/dap_gui_custom_event.h b/applications/external/dap_link/gui/dap_gui_custom_event.h
deleted file mode 100644
index 8b127c9d4..000000000
--- a/applications/external/dap_link/gui/dap_gui_custom_event.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-typedef enum {
- DapAppCustomEventConfig,
- DapAppCustomEventHelp,
- DapAppCustomEventAbout,
-} DapAppCustomEvent;
diff --git a/applications/external/dap_link/gui/dap_gui_i.h b/applications/external/dap_link/gui/dap_gui_i.h
deleted file mode 100644
index 59411e78c..000000000
--- a/applications/external/dap_link/gui/dap_gui_i.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "dap_gui.h"
-#include "../dap_link.h"
-#include "scenes/config/dap_scene.h"
-#include "dap_gui_custom_event.h"
-#include "views/dap_main_view.h"
-
-typedef struct {
- DapApp* dap_app;
-
- Gui* gui;
- NotificationApp* notifications;
- ViewDispatcher* view_dispatcher;
- SceneManager* scene_manager;
-
- VariableItemList* var_item_list;
- DapMainView* main_view;
- Widget* widget;
-} DapGuiApp;
-
-typedef enum {
- DapGuiAppViewVarItemList,
- DapGuiAppViewMainView,
- DapGuiAppViewWidget,
-} DapGuiAppView;
diff --git a/applications/external/dap_link/gui/scenes/config/dap_scene.c b/applications/external/dap_link/gui/scenes/config/dap_scene.c
deleted file mode 100644
index 37e235540..000000000
--- a/applications/external/dap_link/gui/scenes/config/dap_scene.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "dap_scene.h"
-
-// Generate scene on_enter handlers array
-#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
-void (*const dap_scene_on_enter_handlers[])(void*) = {
-#include "dap_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 dap_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = {
-#include "dap_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 dap_scene_on_exit_handlers[])(void* context) = {
-#include "dap_scene_config.h"
-};
-#undef ADD_SCENE
-
-// Initialize scene handlers configuration structure
-const SceneManagerHandlers dap_scene_handlers = {
- .on_enter_handlers = dap_scene_on_enter_handlers,
- .on_event_handlers = dap_scene_on_event_handlers,
- .on_exit_handlers = dap_scene_on_exit_handlers,
- .scene_num = DapSceneNum,
-};
diff --git a/applications/external/dap_link/gui/scenes/config/dap_scene.h b/applications/external/dap_link/gui/scenes/config/dap_scene.h
deleted file mode 100644
index 6fb38da4a..000000000
--- a/applications/external/dap_link/gui/scenes/config/dap_scene.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include
-
-// Generate scene id and total number
-#define ADD_SCENE(prefix, name, id) DapScene##id,
-typedef enum {
-#include "dap_scene_config.h"
- DapSceneNum,
-} DapScene;
-#undef ADD_SCENE
-
-extern const SceneManagerHandlers dap_scene_handlers;
-
-// Generate scene on_enter handlers declaration
-#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
-#include "dap_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 "dap_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 "dap_scene_config.h"
-#undef ADD_SCENE
diff --git a/applications/external/dap_link/gui/scenes/config/dap_scene_config.h b/applications/external/dap_link/gui/scenes/config/dap_scene_config.h
deleted file mode 100644
index 8957aca06..000000000
--- a/applications/external/dap_link/gui/scenes/config/dap_scene_config.h
+++ /dev/null
@@ -1,4 +0,0 @@
-ADD_SCENE(dap, main, Main)
-ADD_SCENE(dap, config, Config)
-ADD_SCENE(dap, help, Help)
-ADD_SCENE(dap, about, About)
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/scenes/dap_scene_about.c b/applications/external/dap_link/gui/scenes/dap_scene_about.c
deleted file mode 100644
index 0974e60a7..000000000
--- a/applications/external/dap_link/gui/scenes/dap_scene_about.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "../dap_gui_i.h"
-
-#define DAP_VERSION_APP "0.1.0"
-#define DAP_DEVELOPED "Dr_Zlo"
-#define DAP_GITHUB "https://github.com/flipperdevices/flipperzero-firmware"
-
-void dap_scene_about_on_enter(void* context) {
- DapGuiApp* app = 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", DAP_VERSION_APP);
- furi_string_cat_printf(temp_str, "Developed by: %s\n", DAP_DEVELOPED);
- furi_string_cat_printf(temp_str, "Github: %s\n\n", DAP_GITHUB);
-
- furi_string_cat_printf(temp_str, "\e#%s\n", "Description");
- furi_string_cat_printf(
- temp_str, "CMSIS-DAP debugger\nbased on Free-DAP\nThanks to Alex Taradov\n\n");
-
- furi_string_cat_printf(
- temp_str,
- "Supported protocols:\n"
- "SWD, JTAG, UART\n"
- "DAP v1 (cmsis_backend hid), DAP v2 (cmsis_backend usb_bulk), VCP\n");
-
- widget_add_text_box_element(
- app->widget,
- 0,
- 0,
- 128,
- 14,
- AlignCenter,
- AlignBottom,
- "\e#\e! \e!\n",
- false);
- widget_add_text_box_element(
- app->widget,
- 0,
- 2,
- 128,
- 14,
- AlignCenter,
- AlignBottom,
- "\e#\e! DAP Link \e!\n",
- false);
- widget_add_text_scroll_element(app->widget, 0, 16, 128, 50, furi_string_get_cstr(temp_str));
- furi_string_free(temp_str);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, DapGuiAppViewWidget);
-}
-
-bool dap_scene_about_on_event(void* context, SceneManagerEvent event) {
- DapGuiApp* app = context;
- bool consumed = false;
- UNUSED(app);
- UNUSED(event);
-
- return consumed;
-}
-
-void dap_scene_about_on_exit(void* context) {
- DapGuiApp* app = context;
-
- // Clear views
- widget_reset(app->widget);
-}
diff --git a/applications/external/dap_link/gui/scenes/dap_scene_config.c b/applications/external/dap_link/gui/scenes/dap_scene_config.c
deleted file mode 100644
index 48d5fedcd..000000000
--- a/applications/external/dap_link/gui/scenes/dap_scene_config.c
+++ /dev/null
@@ -1,107 +0,0 @@
-#include "../dap_gui_i.h"
-
-static const char* swd_pins[] = {[DapSwdPinsPA7PA6] = "2,3", [DapSwdPinsPA14PA13] = "10,12"};
-static const char* uart_pins[] = {[DapUartTypeUSART1] = "13,14", [DapUartTypeLPUART1] = "15,16"};
-static const char* uart_swap[] = {[DapUartTXRXNormal] = "No", [DapUartTXRXSwap] = "Yes"};
-
-static void swd_pins_cb(VariableItem* item) {
- DapGuiApp* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
-
- variable_item_set_current_value_text(item, swd_pins[index]);
-
- DapConfig* config = dap_app_get_config(app->dap_app);
- config->swd_pins = index;
- dap_app_set_config(app->dap_app, config);
-}
-
-static void uart_pins_cb(VariableItem* item) {
- DapGuiApp* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
-
- variable_item_set_current_value_text(item, uart_pins[index]);
-
- DapConfig* config = dap_app_get_config(app->dap_app);
- config->uart_pins = index;
- dap_app_set_config(app->dap_app, config);
-}
-
-static void uart_swap_cb(VariableItem* item) {
- DapGuiApp* app = variable_item_get_context(item);
- uint8_t index = variable_item_get_current_value_index(item);
-
- variable_item_set_current_value_text(item, uart_swap[index]);
-
- DapConfig* config = dap_app_get_config(app->dap_app);
- config->uart_swap = index;
- dap_app_set_config(app->dap_app, config);
-}
-
-static void ok_cb(void* context, uint32_t index) {
- DapGuiApp* app = context;
- switch(index) {
- case 3:
- view_dispatcher_send_custom_event(app->view_dispatcher, DapAppCustomEventHelp);
- break;
- case 4:
- view_dispatcher_send_custom_event(app->view_dispatcher, DapAppCustomEventAbout);
- break;
- default:
- break;
- }
-}
-
-void dap_scene_config_on_enter(void* context) {
- DapGuiApp* app = context;
- VariableItemList* var_item_list = app->var_item_list;
- VariableItem* item;
- DapConfig* config = dap_app_get_config(app->dap_app);
-
- item = variable_item_list_add(
- var_item_list, "SWC SWD Pins", COUNT_OF(swd_pins), swd_pins_cb, app);
- variable_item_set_current_value_index(item, config->swd_pins);
- variable_item_set_current_value_text(item, swd_pins[config->swd_pins]);
-
- item =
- variable_item_list_add(var_item_list, "UART Pins", COUNT_OF(uart_pins), uart_pins_cb, app);
- variable_item_set_current_value_index(item, config->uart_pins);
- variable_item_set_current_value_text(item, uart_pins[config->uart_pins]);
-
- item = variable_item_list_add(
- var_item_list, "Swap TX RX", COUNT_OF(uart_swap), uart_swap_cb, app);
- variable_item_set_current_value_index(item, config->uart_swap);
- variable_item_set_current_value_text(item, uart_swap[config->uart_swap]);
-
- variable_item_list_add(var_item_list, "Help and Pinout", 0, NULL, NULL);
- variable_item_list_add(var_item_list, "About", 0, NULL, NULL);
-
- variable_item_list_set_selected_item(
- var_item_list, scene_manager_get_scene_state(app->scene_manager, DapSceneConfig));
-
- variable_item_list_set_enter_callback(var_item_list, ok_cb, app);
-
- view_dispatcher_switch_to_view(app->view_dispatcher, DapGuiAppViewVarItemList);
-}
-
-bool dap_scene_config_on_event(void* context, SceneManagerEvent event) {
- DapGuiApp* app = context;
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == DapAppCustomEventHelp) {
- scene_manager_next_scene(app->scene_manager, DapSceneHelp);
- return true;
- } else if(event.event == DapAppCustomEventAbout) {
- scene_manager_next_scene(app->scene_manager, DapSceneAbout);
- return true;
- }
- }
- return false;
-}
-
-void dap_scene_config_on_exit(void* context) {
- DapGuiApp* app = context;
- scene_manager_set_scene_state(
- app->scene_manager,
- DapSceneConfig,
- variable_item_list_get_selected_item_index(app->var_item_list));
- variable_item_list_reset(app->var_item_list);
-}
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/scenes/dap_scene_help.c b/applications/external/dap_link/gui/scenes/dap_scene_help.c
deleted file mode 100644
index d8d70e7ff..000000000
--- a/applications/external/dap_link/gui/scenes/dap_scene_help.c
+++ /dev/null
@@ -1,102 +0,0 @@
-#include "../dap_gui_i.h"
-
-void dap_scene_help_on_enter(void* context) {
- DapGuiApp* app = context;
- DapConfig* config = dap_app_get_config(app->dap_app);
- FuriString* string = furi_string_alloc();
-
- furi_string_cat(string, "CMSIS DAP/DAP Link v2\r\n");
- furi_string_cat_printf(string, "Serial: %s\r\n", dap_app_get_serial(app->dap_app));
- furi_string_cat(
- string,
- "Pinout:\r\n"
- "\e#SWD:\r\n");
-
- switch(config->swd_pins) {
- case DapSwdPinsPA7PA6:
- furi_string_cat(
- string,
- " SWC: 2 [A7]\r\n"
- " SWD: 3 [A6]\r\n");
- break;
- case DapSwdPinsPA14PA13:
- furi_string_cat(
- string,
- " SWC: 10 [SWC]\r\n"
- " SWD: 12 [SIO]\r\n");
- break;
- default:
- break;
- }
-
- furi_string_cat(string, "\e#JTAG:\r\n");
- switch(config->swd_pins) {
- case DapSwdPinsPA7PA6:
- furi_string_cat(
- string,
- " TCK: 2 [A7]\r\n"
- " TMS: 3 [A6]\r\n"
- " RST: 4 [A4]\r\n"
- " TDO: 5 [B3]\r\n"
- " TDI: 6 [B2]\r\n");
- break;
- case DapSwdPinsPA14PA13:
- furi_string_cat(
- string,
- " RST: 4 [A4]\r\n"
- " TDO: 5 [B3]\r\n"
- " TDI: 6 [B2]\r\n"
- " TCK: 10 [SWC]\r\n"
- " TMS: 12 [SIO]\r\n");
- break;
- default:
- break;
- }
-
- furi_string_cat(string, "\e#UART:\r\n");
- switch(config->uart_pins) {
- case DapUartTypeUSART1:
- if(config->uart_swap == DapUartTXRXNormal) {
- furi_string_cat(
- string,
- " TX: 13 [TX]\r\n"
- " RX: 14 [RX]\r\n");
- } else {
- furi_string_cat(
- string,
- " RX: 13 [TX]\r\n"
- " TX: 14 [RX]\r\n");
- }
- break;
- case DapUartTypeLPUART1:
- if(config->uart_swap == DapUartTXRXNormal) {
- furi_string_cat(
- string,
- " TX: 15 [C1]\r\n"
- " RX: 16 [C0]\r\n");
- } else {
- furi_string_cat(
- string,
- " RX: 15 [C1]\r\n"
- " TX: 16 [C0]\r\n");
- }
- break;
- default:
- break;
- }
-
- widget_add_text_scroll_element(app->widget, 0, 0, 128, 64, furi_string_get_cstr(string));
- furi_string_free(string);
- view_dispatcher_switch_to_view(app->view_dispatcher, DapGuiAppViewWidget);
-}
-
-bool dap_scene_help_on_event(void* context, SceneManagerEvent event) {
- UNUSED(context);
- UNUSED(event);
- return false;
-}
-
-void dap_scene_help_on_exit(void* context) {
- DapGuiApp* app = context;
- widget_reset(app->widget);
-}
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/scenes/dap_scene_main.c b/applications/external/dap_link/gui/scenes/dap_scene_main.c
deleted file mode 100644
index 8c19bd6a5..000000000
--- a/applications/external/dap_link/gui/scenes/dap_scene_main.c
+++ /dev/null
@@ -1,154 +0,0 @@
-#include "../dap_gui_i.h"
-#include "../../dap_link.h"
-
-typedef struct {
- DapState dap_state;
- bool dap_active;
- bool tx_active;
- bool rx_active;
-} DapSceneMainState;
-
-static bool process_dap_state(DapGuiApp* app) {
- DapSceneMainState* state =
- (DapSceneMainState*)scene_manager_get_scene_state(app->scene_manager, DapSceneMain);
- if(state == NULL) return true;
-
- DapState* prev_state = &state->dap_state;
- DapState next_state;
- dap_app_get_state(app->dap_app, &next_state);
- bool need_to_update = false;
-
- if(prev_state->dap_mode != next_state.dap_mode) {
- switch(next_state.dap_mode) {
- case DapModeDisconnected:
- dap_main_view_set_mode(app->main_view, DapMainViewModeDisconnected);
- notification_message(app->notifications, &sequence_blink_stop);
- break;
- case DapModeSWD:
- dap_main_view_set_mode(app->main_view, DapMainViewModeSWD);
- notification_message(app->notifications, &sequence_blink_start_blue);
- break;
- case DapModeJTAG:
- dap_main_view_set_mode(app->main_view, DapMainViewModeJTAG);
- notification_message(app->notifications, &sequence_blink_start_magenta);
- break;
- }
- need_to_update = true;
- }
-
- if(prev_state->dap_version != next_state.dap_version) {
- switch(next_state.dap_version) {
- case DapVersionUnknown:
- dap_main_view_set_version(app->main_view, DapMainViewVersionUnknown);
- break;
- case DapVersionV1:
- dap_main_view_set_version(app->main_view, DapMainViewVersionV1);
- break;
- case DapVersionV2:
- dap_main_view_set_version(app->main_view, DapMainViewVersionV2);
- break;
- }
- need_to_update = true;
- }
-
- if(prev_state->usb_connected != next_state.usb_connected) {
- dap_main_view_set_usb_connected(app->main_view, next_state.usb_connected);
- need_to_update = true;
- }
-
- if(prev_state->dap_counter != next_state.dap_counter) {
- if(!state->dap_active) {
- state->dap_active = true;
- dap_main_view_set_dap(app->main_view, state->dap_active);
- need_to_update = true;
- }
- } else {
- if(state->dap_active) {
- state->dap_active = false;
- dap_main_view_set_dap(app->main_view, state->dap_active);
- need_to_update = true;
- }
- }
-
- if(prev_state->cdc_baudrate != next_state.cdc_baudrate) {
- dap_main_view_set_baudrate(app->main_view, next_state.cdc_baudrate);
- need_to_update = true;
- }
-
- if(prev_state->cdc_tx_counter != next_state.cdc_tx_counter) {
- if(!state->tx_active) {
- state->tx_active = true;
- dap_main_view_set_tx(app->main_view, state->tx_active);
- need_to_update = true;
- notification_message(app->notifications, &sequence_blink_start_red);
- }
- } else {
- if(state->tx_active) {
- state->tx_active = false;
- dap_main_view_set_tx(app->main_view, state->tx_active);
- need_to_update = true;
- notification_message(app->notifications, &sequence_blink_stop);
- }
- }
-
- if(prev_state->cdc_rx_counter != next_state.cdc_rx_counter) {
- if(!state->rx_active) {
- state->rx_active = true;
- dap_main_view_set_rx(app->main_view, state->rx_active);
- need_to_update = true;
- notification_message(app->notifications, &sequence_blink_start_green);
- }
- } else {
- if(state->rx_active) {
- state->rx_active = false;
- dap_main_view_set_rx(app->main_view, state->rx_active);
- need_to_update = true;
- notification_message(app->notifications, &sequence_blink_stop);
- }
- }
-
- if(need_to_update) {
- dap_main_view_update(app->main_view);
- }
-
- *prev_state = next_state;
- return true;
-}
-
-static void dap_scene_main_on_left(void* context) {
- DapGuiApp* app = (DapGuiApp*)context;
- view_dispatcher_send_custom_event(app->view_dispatcher, DapAppCustomEventConfig);
-}
-
-void dap_scene_main_on_enter(void* context) {
- DapGuiApp* app = context;
- DapSceneMainState* state = malloc(sizeof(DapSceneMainState));
- dap_main_view_set_left_callback(app->main_view, dap_scene_main_on_left, app);
- view_dispatcher_switch_to_view(app->view_dispatcher, DapGuiAppViewMainView);
- scene_manager_set_scene_state(app->scene_manager, DapSceneMain, (uint32_t)state);
-}
-
-bool dap_scene_main_on_event(void* context, SceneManagerEvent event) {
- DapGuiApp* app = context;
-
- if(event.type == SceneManagerEventTypeCustom) {
- if(event.event == DapAppCustomEventConfig) {
- scene_manager_next_scene(app->scene_manager, DapSceneConfig);
- return true;
- }
- } else if(event.type == SceneManagerEventTypeTick) {
- return process_dap_state(app);
- }
-
- return false;
-}
-
-void dap_scene_main_on_exit(void* context) {
- DapGuiApp* app = context;
- DapSceneMainState* state =
- (DapSceneMainState*)scene_manager_get_scene_state(app->scene_manager, DapSceneMain);
- scene_manager_set_scene_state(app->scene_manager, DapSceneMain, (uint32_t)NULL);
- FURI_SW_MEMBARRIER();
- free(state);
- notification_message(app->notifications, &sequence_blink_stop);
-}
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/views/dap_main_view.c b/applications/external/dap_link/gui/views/dap_main_view.c
deleted file mode 100644
index f54c5e3d5..000000000
--- a/applications/external/dap_link/gui/views/dap_main_view.c
+++ /dev/null
@@ -1,189 +0,0 @@
-#include "dap_main_view.h"
-#include "dap_link_icons.h"
-#include
-
-// extern const Icon I_ArrowDownEmpty_12x18;
-// extern const Icon I_ArrowDownFilled_12x18;
-// extern const Icon I_ArrowUpEmpty_12x18;
-// extern const Icon I_ArrowUpFilled_12x18;
-
-struct DapMainView {
- View* view;
- DapMainViewButtonCallback cb_left;
- void* cb_context;
-};
-
-typedef struct {
- DapMainViewMode mode;
- DapMainViewVersion version;
- bool usb_connected;
- uint32_t baudrate;
- bool dap_active;
- bool tx_active;
- bool rx_active;
-} DapMainViewModel;
-
-static void dap_main_view_draw_callback(Canvas* canvas, void* _model) {
- DapMainViewModel* model = _model;
- UNUSED(model);
- canvas_clear(canvas);
- elements_button_left(canvas, "Config");
-
- canvas_set_color(canvas, ColorBlack);
- canvas_draw_box(canvas, 0, 0, 127, 11);
- canvas_set_color(canvas, ColorWhite);
-
- const char* header_string;
- if(model->usb_connected) {
- if(model->version == DapMainViewVersionV1) {
- header_string = "DAP Link V1 Connected";
- } else if(model->version == DapMainViewVersionV2) {
- header_string = "DAP Link V2 Connected";
- } else {
- header_string = "DAP Link Connected";
- }
- } else {
- header_string = "DAP Link";
- }
-
- canvas_draw_str_aligned(canvas, 64, 9, AlignCenter, AlignBottom, header_string);
-
- canvas_set_color(canvas, ColorBlack);
- if(model->dap_active) {
- canvas_draw_icon(canvas, 14, 16, &I_ArrowUpFilled_12x18);
- canvas_draw_icon_ex(canvas, 28, 16, &I_ArrowUpFilled_12x18, IconRotation180);
- } else {
- canvas_draw_icon(canvas, 14, 16, &I_ArrowUpEmpty_12x18);
- canvas_draw_icon_ex(canvas, 28, 16, &I_ArrowUpEmpty_12x18, IconRotation180);
- }
-
- switch(model->mode) {
- case DapMainViewModeDisconnected:
- canvas_draw_str_aligned(canvas, 26, 38, AlignCenter, AlignTop, "----");
- break;
- case DapMainViewModeSWD:
- canvas_draw_str_aligned(canvas, 26, 38, AlignCenter, AlignTop, "SWD");
- break;
- case DapMainViewModeJTAG:
- canvas_draw_str_aligned(canvas, 26, 38, AlignCenter, AlignTop, "JTAG");
- break;
- }
-
- if(model->tx_active) {
- canvas_draw_icon(canvas, 87, 16, &I_ArrowUpFilled_12x18);
- } else {
- canvas_draw_icon(canvas, 87, 16, &I_ArrowUpEmpty_12x18);
- }
-
- if(model->rx_active) {
- canvas_draw_icon_ex(canvas, 101, 16, &I_ArrowUpFilled_12x18, IconRotation180);
- } else {
- canvas_draw_icon_ex(canvas, 101, 16, &I_ArrowUpEmpty_12x18, IconRotation180);
- }
-
- canvas_draw_str_aligned(canvas, 100, 38, AlignCenter, AlignTop, "UART");
-
- canvas_draw_line(canvas, 44, 52, 123, 52);
- if(model->baudrate == 0) {
- canvas_draw_str(canvas, 45, 62, "Baud: ????");
- } else {
- char baudrate_str[18];
- snprintf(baudrate_str, 18, "Baud: %lu", model->baudrate);
- canvas_draw_str(canvas, 45, 62, baudrate_str);
- }
-}
-
-static bool dap_main_view_input_callback(InputEvent* event, void* context) {
- furi_assert(context);
- DapMainView* dap_main_view = context;
- bool consumed = false;
-
- if(event->type == InputTypeShort) {
- if(event->key == InputKeyLeft) {
- if(dap_main_view->cb_left) {
- dap_main_view->cb_left(dap_main_view->cb_context);
- }
- consumed = true;
- }
- }
-
- return consumed;
-}
-
-DapMainView* dap_main_view_alloc() {
- DapMainView* dap_main_view = malloc(sizeof(DapMainView));
-
- dap_main_view->view = view_alloc();
- view_allocate_model(dap_main_view->view, ViewModelTypeLocking, sizeof(DapMainViewModel));
- view_set_context(dap_main_view->view, dap_main_view);
- view_set_draw_callback(dap_main_view->view, dap_main_view_draw_callback);
- view_set_input_callback(dap_main_view->view, dap_main_view_input_callback);
- return dap_main_view;
-}
-
-void dap_main_view_free(DapMainView* dap_main_view) {
- view_free(dap_main_view->view);
- free(dap_main_view);
-}
-
-View* dap_main_view_get_view(DapMainView* dap_main_view) {
- return dap_main_view->view;
-}
-
-void dap_main_view_set_left_callback(
- DapMainView* dap_main_view,
- DapMainViewButtonCallback callback,
- void* context) {
- with_view_model(
- dap_main_view->view,
- DapMainViewModel * model,
- {
- UNUSED(model);
- dap_main_view->cb_left = callback;
- dap_main_view->cb_context = context;
- },
- true);
-}
-
-void dap_main_view_set_mode(DapMainView* dap_main_view, DapMainViewMode mode) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { model->mode = mode; }, false);
-}
-
-void dap_main_view_set_dap(DapMainView* dap_main_view, bool active) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { model->dap_active = active; }, false);
-}
-
-void dap_main_view_set_tx(DapMainView* dap_main_view, bool active) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { model->tx_active = active; }, false);
-}
-
-void dap_main_view_set_rx(DapMainView* dap_main_view, bool active) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { model->rx_active = active; }, false);
-}
-
-void dap_main_view_set_baudrate(DapMainView* dap_main_view, uint32_t baudrate) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { model->baudrate = baudrate; }, false);
-}
-
-void dap_main_view_update(DapMainView* dap_main_view) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { UNUSED(model); }, true);
-}
-
-void dap_main_view_set_version(DapMainView* dap_main_view, DapMainViewVersion version) {
- with_view_model(
- dap_main_view->view, DapMainViewModel * model, { model->version = version; }, false);
-}
-
-void dap_main_view_set_usb_connected(DapMainView* dap_main_view, bool connected) {
- with_view_model(
- dap_main_view->view,
- DapMainViewModel * model,
- { model->usb_connected = connected; },
- false);
-}
\ No newline at end of file
diff --git a/applications/external/dap_link/gui/views/dap_main_view.h b/applications/external/dap_link/gui/views/dap_main_view.h
deleted file mode 100644
index 1fd900452..000000000
--- a/applications/external/dap_link/gui/views/dap_main_view.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-#include
-
-typedef struct DapMainView DapMainView;
-
-typedef void (*DapMainViewButtonCallback)(void* context);
-
-typedef enum {
- DapMainViewVersionUnknown,
- DapMainViewVersionV1,
- DapMainViewVersionV2,
-} DapMainViewVersion;
-
-typedef enum {
- DapMainViewModeDisconnected,
- DapMainViewModeSWD,
- DapMainViewModeJTAG,
-} DapMainViewMode;
-
-DapMainView* dap_main_view_alloc();
-
-void dap_main_view_free(DapMainView* dap_main_view);
-
-View* dap_main_view_get_view(DapMainView* dap_main_view);
-
-void dap_main_view_set_left_callback(
- DapMainView* dap_main_view,
- DapMainViewButtonCallback callback,
- void* context);
-
-void dap_main_view_set_mode(DapMainView* dap_main_view, DapMainViewMode mode);
-
-void dap_main_view_set_version(DapMainView* dap_main_view, DapMainViewVersion version);
-
-void dap_main_view_set_dap(DapMainView* dap_main_view, bool active);
-
-void dap_main_view_set_tx(DapMainView* dap_main_view, bool active);
-
-void dap_main_view_set_rx(DapMainView* dap_main_view, bool active);
-
-void dap_main_view_set_usb_connected(DapMainView* dap_main_view, bool connected);
-
-void dap_main_view_set_baudrate(DapMainView* dap_main_view, uint32_t baudrate);
-
-void dap_main_view_update(DapMainView* dap_main_view);
\ No newline at end of file
diff --git a/applications/external/dap_link/icons/ActiveConnection_50x64.png b/applications/external/dap_link/icons/ActiveConnection_50x64.png
deleted file mode 100644
index 1d7686ddd..000000000
Binary files a/applications/external/dap_link/icons/ActiveConnection_50x64.png and /dev/null differ
diff --git a/applications/external/dap_link/icons/ArrowUpEmpty_12x18.png b/applications/external/dap_link/icons/ArrowUpEmpty_12x18.png
deleted file mode 100644
index c9365a67d..000000000
Binary files a/applications/external/dap_link/icons/ArrowUpEmpty_12x18.png and /dev/null differ
diff --git a/applications/external/dap_link/icons/ArrowUpFilled_12x18.png b/applications/external/dap_link/icons/ArrowUpFilled_12x18.png
deleted file mode 100644
index dc481517e..000000000
Binary files a/applications/external/dap_link/icons/ArrowUpFilled_12x18.png and /dev/null differ
diff --git a/applications/external/dap_link/lib/free-dap b/applications/external/dap_link/lib/free-dap
deleted file mode 160000
index e7752beb5..000000000
--- a/applications/external/dap_link/lib/free-dap
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e7752beb5e8a69119af67b70b9179cb3c90f3ac5
diff --git a/applications/external/dap_link/usb/dap_v2_usb.c b/applications/external/dap_link/usb/dap_v2_usb.c
deleted file mode 100644
index cba786648..000000000
--- a/applications/external/dap_link/usb/dap_v2_usb.c
+++ /dev/null
@@ -1,977 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "dap_v2_usb.h"
-
-// #define DAP_USB_LOG
-
-#define HID_EP_IN 0x80
-#define HID_EP_OUT 0x00
-
-#define DAP_HID_EP_SEND 1
-#define DAP_HID_EP_RECV 2
-#define DAP_HID_EP_BULK_RECV 3
-#define DAP_HID_EP_BULK_SEND 4
-#define DAP_CDC_EP_COMM 5
-#define DAP_CDC_EP_SEND 6
-#define DAP_CDC_EP_RECV 7
-
-#define DAP_HID_EP_IN (HID_EP_IN | DAP_HID_EP_SEND)
-#define DAP_HID_EP_OUT (HID_EP_OUT | DAP_HID_EP_RECV)
-#define DAP_HID_EP_BULK_IN (HID_EP_IN | DAP_HID_EP_BULK_SEND)
-#define DAP_HID_EP_BULK_OUT (HID_EP_OUT | DAP_HID_EP_BULK_RECV)
-
-#define DAP_HID_EP_SIZE 64
-#define DAP_CDC_COMM_EP_SIZE 8
-#define DAP_CDC_EP_SIZE 64
-
-#define DAP_BULK_INTERVAL 0
-#define DAP_HID_INTERVAL 1
-#define DAP_CDC_INTERVAL 0
-#define DAP_CDC_COMM_INTERVAL 1
-
-#define DAP_HID_VID 0x0483
-#define DAP_HID_PID 0x5740
-
-#define DAP_USB_EP0_SIZE 8
-
-#define EP_CFG_DECONFIGURE 0
-#define EP_CFG_CONFIGURE 1
-
-enum {
- USB_INTF_HID,
- USB_INTF_BULK,
- USB_INTF_CDC_COMM,
- USB_INTF_CDC_DATA,
- USB_INTF_COUNT,
-};
-
-enum {
- USB_STR_ZERO,
- USB_STR_MANUFACTURER,
- USB_STR_PRODUCT,
- USB_STR_SERIAL_NUMBER,
- USB_STR_CMSIS_DAP_V1,
- USB_STR_CMSIS_DAP_V2,
- USB_STR_COM_PORT,
- USB_STR_COUNT,
-};
-
-// static const char* usb_str[] = {
-// [USB_STR_MANUFACTURER] = "Flipper Devices Inc.",
-// [USB_STR_PRODUCT] = "Combined VCP and CMSIS-DAP Adapter",
-// [USB_STR_COM_PORT] = "Virtual COM-Port",
-// [USB_STR_CMSIS_DAP_V1] = "CMSIS-DAP v1 Adapter",
-// [USB_STR_CMSIS_DAP_V2] = "CMSIS-DAP v2 Adapter",
-// [USB_STR_SERIAL_NUMBER] = "01234567890ABCDEF",
-// };
-
-static const struct usb_string_descriptor dev_manuf_descr =
- USB_STRING_DESC("Flipper Devices Inc.");
-
-static const struct usb_string_descriptor dev_prod_descr =
- USB_STRING_DESC("Combined VCP and CMSIS-DAP Adapter");
-
-static struct usb_string_descriptor* dev_serial_descr = NULL;
-
-static const struct usb_string_descriptor dev_dap_v1_descr =
- USB_STRING_DESC("CMSIS-DAP v1 Adapter");
-
-static const struct usb_string_descriptor dev_dap_v2_descr =
- USB_STRING_DESC("CMSIS-DAP v2 Adapter");
-
-static const struct usb_string_descriptor dev_com_descr = USB_STRING_DESC("Virtual COM-Port");
-
-struct HidConfigDescriptor {
- struct usb_config_descriptor configuration;
-
- // CMSIS-DAP v1
- struct usb_interface_descriptor hid_interface;
- struct usb_hid_descriptor hid;
- struct usb_endpoint_descriptor hid_ep_in;
- struct usb_endpoint_descriptor hid_ep_out;
-
- // CMSIS-DAP v2
- struct usb_interface_descriptor bulk_interface;
- struct usb_endpoint_descriptor bulk_ep_out;
- struct usb_endpoint_descriptor bulk_ep_in;
-
- // CDC
- struct usb_iad_descriptor iad;
- struct usb_interface_descriptor interface_comm;
- struct usb_cdc_header_desc cdc_header;
- struct usb_cdc_call_mgmt_desc cdc_acm;
- struct usb_cdc_acm_desc cdc_call_mgmt;
- struct usb_cdc_union_desc cdc_union;
- struct usb_endpoint_descriptor ep_comm;
- struct usb_interface_descriptor interface_data;
- struct usb_endpoint_descriptor ep_in;
- struct usb_endpoint_descriptor ep_out;
-
-} __attribute__((packed));
-
-static const struct usb_device_descriptor hid_device_desc = {
- .bLength = sizeof(struct usb_device_descriptor),
- .bDescriptorType = USB_DTYPE_DEVICE,
- .bcdUSB = VERSION_BCD(2, 1, 0),
- .bDeviceClass = USB_CLASS_MISC,
- .bDeviceSubClass = USB_SUBCLASS_IAD,
- .bDeviceProtocol = USB_PROTO_IAD,
- .bMaxPacketSize0 = DAP_USB_EP0_SIZE,
- .idVendor = DAP_HID_VID,
- .idProduct = DAP_HID_PID,
- .bcdDevice = VERSION_BCD(1, 0, 0),
- .iManufacturer = USB_STR_MANUFACTURER,
- .iProduct = USB_STR_PRODUCT,
- .iSerialNumber = USB_STR_SERIAL_NUMBER,
- .bNumConfigurations = 1,
-};
-
-static const uint8_t hid_report_desc[] = {
- 0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
- 0x09, 0x00, // Usage (Undefined)
- 0xa1, 0x01, // Collection (Application)
- 0x15, 0x00, // Logical Minimum (0)
- 0x26, 0xff, 0x00, // Logical Maximum (255)
- 0x75, 0x08, // Report Size (8)
- 0x95, 0x40, // Report Count (64)
- 0x09, 0x00, // Usage (Undefined)
- 0x81, 0x82, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
- 0x75, 0x08, // Report Size (8)
- 0x95, 0x40, // Report Count (64)
- 0x09, 0x00, // Usage (Undefined)
- 0x91, 0x82, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Volatile)
- 0xc0, // End Collection
-};
-
-static const struct HidConfigDescriptor hid_cfg_desc = {
- .configuration =
- {
- .bLength = sizeof(struct usb_config_descriptor),
- .bDescriptorType = USB_DTYPE_CONFIGURATION,
- .wTotalLength = sizeof(struct HidConfigDescriptor),
- .bNumInterfaces = USB_INTF_COUNT,
- .bConfigurationValue = 1,
- .iConfiguration = NO_DESCRIPTOR,
- .bmAttributes = USB_CFG_ATTR_RESERVED,
- .bMaxPower = USB_CFG_POWER_MA(500),
- },
-
- // CMSIS-DAP v1
- .hid_interface =
- {
- .bLength = sizeof(struct usb_interface_descriptor),
- .bDescriptorType = USB_DTYPE_INTERFACE,
- .bInterfaceNumber = USB_INTF_HID,
- .bAlternateSetting = 0,
- .bNumEndpoints = 2,
- .bInterfaceClass = USB_CLASS_HID,
- .bInterfaceSubClass = USB_HID_SUBCLASS_NONBOOT,
- .bInterfaceProtocol = USB_HID_PROTO_NONBOOT,
- .iInterface = USB_STR_CMSIS_DAP_V1,
- },
-
- .hid =
- {
- .bLength = sizeof(struct usb_hid_descriptor),
- .bDescriptorType = USB_DTYPE_HID,
- .bcdHID = VERSION_BCD(1, 1, 1),
- .bCountryCode = USB_HID_COUNTRY_NONE,
- .bNumDescriptors = 1,
- .bDescriptorType0 = USB_DTYPE_HID_REPORT,
- .wDescriptorLength0 = sizeof(hid_report_desc),
- },
-
- .hid_ep_in =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = DAP_HID_EP_IN,
- .bmAttributes = USB_EPTYPE_INTERRUPT,
- .wMaxPacketSize = DAP_HID_EP_SIZE,
- .bInterval = DAP_HID_INTERVAL,
- },
-
- .hid_ep_out =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = DAP_HID_EP_OUT,
- .bmAttributes = USB_EPTYPE_INTERRUPT,
- .wMaxPacketSize = DAP_HID_EP_SIZE,
- .bInterval = DAP_HID_INTERVAL,
- },
-
- // CMSIS-DAP v2
- .bulk_interface =
- {
- .bLength = sizeof(struct usb_interface_descriptor),
- .bDescriptorType = USB_DTYPE_INTERFACE,
- .bInterfaceNumber = USB_INTF_BULK,
- .bAlternateSetting = 0,
- .bNumEndpoints = 2,
- .bInterfaceClass = USB_CLASS_VENDOR,
- .bInterfaceSubClass = 0,
- .bInterfaceProtocol = 0,
- .iInterface = USB_STR_CMSIS_DAP_V2,
- },
-
- .bulk_ep_out =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = DAP_HID_EP_BULK_OUT,
- .bmAttributes = USB_EPTYPE_BULK,
- .wMaxPacketSize = DAP_HID_EP_SIZE,
- .bInterval = DAP_BULK_INTERVAL,
- },
-
- .bulk_ep_in =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = DAP_HID_EP_BULK_IN,
- .bmAttributes = USB_EPTYPE_BULK,
- .wMaxPacketSize = DAP_HID_EP_SIZE,
- .bInterval = DAP_BULK_INTERVAL,
- },
-
- // CDC
- .iad =
- {
- .bLength = sizeof(struct usb_iad_descriptor),
- .bDescriptorType = USB_DTYPE_INTERFASEASSOC,
- .bFirstInterface = USB_INTF_CDC_COMM,
- .bInterfaceCount = 2,
- .bFunctionClass = USB_CLASS_CDC,
- .bFunctionSubClass = USB_CDC_SUBCLASS_ACM,
- .bFunctionProtocol = USB_PROTO_NONE,
- .iFunction = USB_STR_COM_PORT,
- },
- .interface_comm =
- {
- .bLength = sizeof(struct usb_interface_descriptor),
- .bDescriptorType = USB_DTYPE_INTERFACE,
- .bInterfaceNumber = USB_INTF_CDC_COMM,
- .bAlternateSetting = 0,
- .bNumEndpoints = 1,
- .bInterfaceClass = USB_CLASS_CDC,
- .bInterfaceSubClass = USB_CDC_SUBCLASS_ACM,
- .bInterfaceProtocol = USB_PROTO_NONE,
- .iInterface = 0,
- },
-
- .cdc_header =
- {
- .bFunctionLength = sizeof(struct usb_cdc_header_desc),
- .bDescriptorType = USB_DTYPE_CS_INTERFACE,
- .bDescriptorSubType = USB_DTYPE_CDC_HEADER,
- .bcdCDC = VERSION_BCD(1, 1, 0),
- },
-
- .cdc_acm =
- {
- .bFunctionLength = sizeof(struct usb_cdc_call_mgmt_desc),
- .bDescriptorType = USB_DTYPE_CS_INTERFACE,
- .bDescriptorSubType = USB_DTYPE_CDC_CALL_MANAGEMENT,
- // .bmCapabilities = USB_CDC_CAP_LINE | USB_CDC_CAP_BRK,
- .bmCapabilities = 0,
- },
-
- .cdc_call_mgmt =
- {
- .bFunctionLength = sizeof(struct usb_cdc_acm_desc),
- .bDescriptorType = USB_DTYPE_CS_INTERFACE,
- .bDescriptorSubType = USB_DTYPE_CDC_ACM,
- .bmCapabilities = USB_CDC_CALL_MGMT_CAP_DATA_INTF,
- // .bDataInterface = USB_INTF_CDC_DATA,
- },
-
- .cdc_union =
- {
- .bFunctionLength = sizeof(struct usb_cdc_union_desc),
- .bDescriptorType = USB_DTYPE_CS_INTERFACE,
- .bDescriptorSubType = USB_DTYPE_CDC_UNION,
- .bMasterInterface0 = USB_INTF_CDC_COMM,
- .bSlaveInterface0 = USB_INTF_CDC_DATA,
- },
-
- .ep_comm =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = HID_EP_IN | DAP_CDC_EP_COMM,
- .bmAttributes = USB_EPTYPE_INTERRUPT,
- .wMaxPacketSize = DAP_CDC_COMM_EP_SIZE,
- .bInterval = DAP_CDC_COMM_INTERVAL,
- },
-
- .interface_data =
- {
- .bLength = sizeof(struct usb_interface_descriptor),
- .bDescriptorType = USB_DTYPE_INTERFACE,
- .bInterfaceNumber = USB_INTF_CDC_DATA,
- .bAlternateSetting = 0,
- .bNumEndpoints = 2,
- .bInterfaceClass = USB_CLASS_CDC_DATA,
- .bInterfaceSubClass = USB_SUBCLASS_NONE,
- .bInterfaceProtocol = USB_PROTO_NONE,
- .iInterface = NO_DESCRIPTOR,
- },
-
- .ep_in =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = HID_EP_IN | DAP_CDC_EP_SEND,
- .bmAttributes = USB_EPTYPE_BULK,
- .wMaxPacketSize = DAP_CDC_EP_SIZE,
- .bInterval = DAP_CDC_INTERVAL,
- },
-
- .ep_out =
- {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DTYPE_ENDPOINT,
- .bEndpointAddress = HID_EP_OUT | DAP_CDC_EP_RECV,
- .bmAttributes = USB_EPTYPE_BULK,
- .wMaxPacketSize = DAP_CDC_EP_SIZE,
- .bInterval = DAP_CDC_INTERVAL,
- },
-};
-
-// WinUSB
-#include "usb_winusb.h"
-
-typedef struct USB_PACK {
- usb_binary_object_store_descriptor_t bos;
- usb_winusb_capability_descriptor_t winusb;
-} usb_bos_hierarchy_t;
-
-typedef struct USB_PACK {
- usb_winusb_subset_header_function_t header;
- usb_winusb_feature_compatble_id_t comp_id;
- usb_winusb_feature_reg_property_guids_t property;
-} usb_msos_descriptor_subset_t;
-
-typedef struct USB_PACK {
- usb_winusb_set_header_descriptor_t header;
- usb_msos_descriptor_subset_t subset;
-} usb_msos_descriptor_set_t;
-
-#define USB_DTYPE_BINARY_OBJECT_STORE 15
-#define USB_DTYPE_DEVICE_CAPABILITY_DESCRIPTOR 16
-#define USB_DC_TYPE_PLATFORM 5
-
-const usb_bos_hierarchy_t usb_bos_hierarchy = {
- .bos =
- {
- .bLength = sizeof(usb_binary_object_store_descriptor_t),
- .bDescriptorType = USB_DTYPE_BINARY_OBJECT_STORE,
- .wTotalLength = sizeof(usb_bos_hierarchy_t),
- .bNumDeviceCaps = 1,
- },
- .winusb =
- {
- .bLength = sizeof(usb_winusb_capability_descriptor_t),
- .bDescriptorType = USB_DTYPE_DEVICE_CAPABILITY_DESCRIPTOR,
- .bDevCapabilityType = USB_DC_TYPE_PLATFORM,
- .bReserved = 0,
- .PlatformCapabilityUUID = USB_WINUSB_PLATFORM_CAPABILITY_ID,
- .dwWindowsVersion = USB_WINUSB_WINDOWS_VERSION,
- .wMSOSDescriptorSetTotalLength = sizeof(usb_msos_descriptor_set_t),
- .bMS_VendorCode = USB_WINUSB_VENDOR_CODE,
- .bAltEnumCode = 0,
- },
-};
-
-const usb_msos_descriptor_set_t usb_msos_descriptor_set = {
- .header =
- {
- .wLength = sizeof(usb_winusb_set_header_descriptor_t),
- .wDescriptorType = USB_WINUSB_SET_HEADER_DESCRIPTOR,
- .dwWindowsVersion = USB_WINUSB_WINDOWS_VERSION,
- .wDescriptorSetTotalLength = sizeof(usb_msos_descriptor_set_t),
- },
-
- .subset =
- {
- .header =
- {
- .wLength = sizeof(usb_winusb_subset_header_function_t),
- .wDescriptorType = USB_WINUSB_SUBSET_HEADER_FUNCTION,
- .bFirstInterface = USB_INTF_BULK,
- .bReserved = 0,
- .wSubsetLength = sizeof(usb_msos_descriptor_subset_t),
- },
-
- .comp_id =
- {
- .wLength = sizeof(usb_winusb_feature_compatble_id_t),
- .wDescriptorType = USB_WINUSB_FEATURE_COMPATBLE_ID,
- .CompatibleID = "WINUSB\0\0",
- .SubCompatibleID = {0},
- },
-
- .property =
- {
- .wLength = sizeof(usb_winusb_feature_reg_property_guids_t),
- .wDescriptorType = USB_WINUSB_FEATURE_REG_PROPERTY,
- .wPropertyDataType = USB_WINUSB_PROPERTY_DATA_TYPE_MULTI_SZ,
- .wPropertyNameLength =
- sizeof(usb_msos_descriptor_set.subset.property.PropertyName),
- .PropertyName = {'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, 'I', 0,
- 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0,
- 'e', 0, 'G', 0, 'U', 0, 'I', 0, 'D', 0, 's', 0, 0, 0},
- .wPropertyDataLength =
- sizeof(usb_msos_descriptor_set.subset.property.PropertyData),
- .PropertyData = {'{', 0, 'C', 0, 'D', 0, 'B', 0, '3', 0, 'B', 0, '5', 0,
- 'A', 0, 'D', 0, '-', 0, '2', 0, '9', 0, '3', 0, 'B', 0,
- '-', 0, '4', 0, '6', 0, '6', 0, '3', 0, '-', 0, 'A', 0,
- 'A', 0, '3', 0, '6', 0, '-', 0, '1', 0, 'A', 0, 'A', 0,
- 'E', 0, '4', 0, '6', 0, '4', 0, '6', 0, '3', 0, '7', 0,
- '7', 0, '6', 0, '}', 0, 0, 0, 0, 0},
- },
- },
-};
-
-typedef struct {
- FuriSemaphore* semaphore_v1;
- FuriSemaphore* semaphore_v2;
- FuriSemaphore* semaphore_cdc;
- bool connected;
- usbd_device* usb_dev;
- DapStateCallback state_callback;
- DapRxCallback rx_callback_v1;
- DapRxCallback rx_callback_v2;
- DapRxCallback rx_callback_cdc;
- DapCDCControlLineCallback control_line_callback_cdc;
- DapCDCConfigCallback config_callback_cdc;
- void* context;
- void* context_cdc;
-} DAPState;
-
-static DAPState dap_state = {
- .semaphore_v1 = NULL,
- .semaphore_v2 = NULL,
- .semaphore_cdc = NULL,
- .connected = false,
- .usb_dev = NULL,
- .state_callback = NULL,
- .rx_callback_v1 = NULL,
- .rx_callback_v2 = NULL,
- .rx_callback_cdc = NULL,
- .control_line_callback_cdc = NULL,
- .config_callback_cdc = NULL,
- .context = NULL,
- .context_cdc = NULL,
-};
-
-static struct usb_cdc_line_coding cdc_config = {0};
-static uint8_t cdc_ctrl_line_state = 0;
-
-#ifdef DAP_USB_LOG
-void furi_console_log_printf(const char* format, ...) _ATTRIBUTE((__format__(__printf__, 1, 2)));
-
-void furi_console_log_printf(const char* format, ...) {
- char buffer[256];
- va_list args;
- va_start(args, format);
- vsnprintf(buffer, sizeof(buffer), format, args);
- va_end(args);
- furi_hal_console_puts(buffer);
- furi_hal_console_puts("\r\n");
- UNUSED(format);
-}
-#else
-#define furi_console_log_printf(...)
-#endif
-
-int32_t dap_v1_usb_tx(uint8_t* buffer, uint8_t size) {
- if((dap_state.semaphore_v1 == NULL) || (dap_state.connected == false)) return 0;
-
- furi_check(furi_semaphore_acquire(dap_state.semaphore_v1, FuriWaitForever) == FuriStatusOk);
-
- if(dap_state.connected) {
- int32_t len = usbd_ep_write(dap_state.usb_dev, DAP_HID_EP_IN, buffer, size);
- furi_console_log_printf("v1 tx %ld", len);
- return len;
- } else {
- return 0;
- }
-}
-
-int32_t dap_v2_usb_tx(uint8_t* buffer, uint8_t size) {
- if((dap_state.semaphore_v2 == NULL) || (dap_state.connected == false)) return 0;
-
- furi_check(furi_semaphore_acquire(dap_state.semaphore_v2, FuriWaitForever) == FuriStatusOk);
-
- if(dap_state.connected) {
- int32_t len = usbd_ep_write(dap_state.usb_dev, DAP_HID_EP_BULK_IN, buffer, size);
- furi_console_log_printf("v2 tx %ld", len);
- return len;
- } else {
- return 0;
- }
-}
-
-int32_t dap_cdc_usb_tx(uint8_t* buffer, uint8_t size) {
- if((dap_state.semaphore_cdc == NULL) || (dap_state.connected == false)) return 0;
-
- furi_check(furi_semaphore_acquire(dap_state.semaphore_cdc, FuriWaitForever) == FuriStatusOk);
-
- if(dap_state.connected) {
- int32_t len = usbd_ep_write(dap_state.usb_dev, HID_EP_IN | DAP_CDC_EP_SEND, buffer, size);
- furi_console_log_printf("cdc tx %ld", len);
- return len;
- } else {
- return 0;
- }
-}
-
-void dap_v1_usb_set_rx_callback(DapRxCallback callback) {
- dap_state.rx_callback_v1 = callback;
-}
-
-void dap_v2_usb_set_rx_callback(DapRxCallback callback) {
- dap_state.rx_callback_v2 = callback;
-}
-
-void dap_cdc_usb_set_rx_callback(DapRxCallback callback) {
- dap_state.rx_callback_cdc = callback;
-}
-
-void dap_cdc_usb_set_control_line_callback(DapCDCControlLineCallback callback) {
- dap_state.control_line_callback_cdc = callback;
-}
-
-void dap_cdc_usb_set_config_callback(DapCDCConfigCallback callback) {
- dap_state.config_callback_cdc = callback;
-}
-
-void dap_cdc_usb_set_context(void* context) {
- dap_state.context_cdc = context;
-}
-
-void dap_common_usb_set_context(void* context) {
- dap_state.context = context;
-}
-
-void dap_common_usb_set_state_callback(DapStateCallback callback) {
- dap_state.state_callback = callback;
-}
-
-static void* dap_usb_alloc_string_descr(const char* str) {
- furi_assert(str);
-
- size_t len = strlen(str);
- size_t wlen = (len + 1) * sizeof(uint16_t);
- struct usb_string_descriptor* dev_str_desc = malloc(wlen);
- dev_str_desc->bLength = wlen;
- dev_str_desc->bDescriptorType = USB_DTYPE_STRING;
- for(size_t i = 0; i < len; i++) {
- dev_str_desc->wString[i] = str[i];
- }
-
- return dev_str_desc;
-}
-
-void dap_common_usb_alloc_name(const char* name) {
- dev_serial_descr = dap_usb_alloc_string_descr(name);
-}
-
-void dap_common_usb_free_name() {
- free(dev_serial_descr);
-}
-
-static void hid_init(usbd_device* dev, FuriHalUsbInterface* intf, void* ctx);
-static void hid_deinit(usbd_device* dev);
-static void hid_on_wakeup(usbd_device* dev);
-static void hid_on_suspend(usbd_device* dev);
-
-static usbd_respond hid_ep_config(usbd_device* dev, uint8_t cfg);
-static usbd_respond hid_control(usbd_device* dev, usbd_ctlreq* req, usbd_rqc_callback* callback);
-
-FuriHalUsbInterface dap_v2_usb_hid = {
- .init = hid_init,
- .deinit = hid_deinit,
- .wakeup = hid_on_wakeup,
- .suspend = hid_on_suspend,
- .dev_descr = (struct usb_device_descriptor*)&hid_device_desc,
- .cfg_descr = (void*)&hid_cfg_desc,
-};
-
-static void hid_init(usbd_device* dev, FuriHalUsbInterface* intf, void* ctx) {
- UNUSED(intf);
- UNUSED(ctx);
-
- dap_v2_usb_hid.str_manuf_descr = (void*)&dev_manuf_descr;
- dap_v2_usb_hid.str_prod_descr = (void*)&dev_prod_descr;
- dap_v2_usb_hid.str_serial_descr = (void*)dev_serial_descr;
-
- dap_state.usb_dev = dev;
- if(dap_state.semaphore_v1 == NULL) dap_state.semaphore_v1 = furi_semaphore_alloc(1, 1);
- if(dap_state.semaphore_v2 == NULL) dap_state.semaphore_v2 = furi_semaphore_alloc(1, 1);
- if(dap_state.semaphore_cdc == NULL) dap_state.semaphore_cdc = furi_semaphore_alloc(1, 1);
-
- usbd_reg_config(dev, hid_ep_config);
- usbd_reg_control(dev, hid_control);
-
- usbd_connect(dev, true);
-}
-
-static void hid_deinit(usbd_device* dev) {
- dap_state.usb_dev = NULL;
-
- furi_semaphore_free(dap_state.semaphore_v1);
- furi_semaphore_free(dap_state.semaphore_v2);
- furi_semaphore_free(dap_state.semaphore_cdc);
- dap_state.semaphore_v1 = NULL;
- dap_state.semaphore_v2 = NULL;
- dap_state.semaphore_cdc = NULL;
-
- usbd_reg_config(dev, NULL);
- usbd_reg_control(dev, NULL);
-}
-
-static void hid_on_wakeup(usbd_device* dev) {
- UNUSED(dev);
- if(!dap_state.connected) {
- dap_state.connected = true;
- if(dap_state.state_callback != NULL) {
- dap_state.state_callback(dap_state.connected, dap_state.context);
- }
- }
-}
-
-static void hid_on_suspend(usbd_device* dev) {
- UNUSED(dev);
- if(dap_state.connected) {
- dap_state.connected = false;
- if(dap_state.state_callback != NULL) {
- dap_state.state_callback(dap_state.connected, dap_state.context);
- }
- }
-}
-
-size_t dap_v1_usb_rx(uint8_t* buffer, size_t size) {
- size_t len = 0;
-
- if(dap_state.connected) {
- len = usbd_ep_read(dap_state.usb_dev, DAP_HID_EP_OUT, buffer, size);
- }
-
- return len;
-}
-
-size_t dap_v2_usb_rx(uint8_t* buffer, size_t size) {
- size_t len = 0;
-
- if(dap_state.connected) {
- len = usbd_ep_read(dap_state.usb_dev, DAP_HID_EP_BULK_OUT, buffer, size);
- }
-
- return len;
-}
-
-size_t dap_cdc_usb_rx(uint8_t* buffer, size_t size) {
- size_t len = 0;
-
- if(dap_state.connected) {
- len = usbd_ep_read(dap_state.usb_dev, HID_EP_OUT | DAP_CDC_EP_RECV, buffer, size);
- }
-
- return len;
-}
-
-static void hid_txrx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
- UNUSED(dev);
- UNUSED(ep);
-
- switch(event) {
- case usbd_evt_eptx:
- furi_semaphore_release(dap_state.semaphore_v1);
- furi_console_log_printf("hid tx complete");
- break;
- case usbd_evt_eprx:
- if(dap_state.rx_callback_v1 != NULL) {
- dap_state.rx_callback_v1(dap_state.context);
- }
- break;
- default:
- furi_console_log_printf("hid %d, %d", event, ep);
- break;
- }
-}
-
-static void hid_txrx_ep_bulk_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
- UNUSED(dev);
- UNUSED(ep);
-
- switch(event) {
- case usbd_evt_eptx:
- furi_semaphore_release(dap_state.semaphore_v2);
- furi_console_log_printf("bulk tx complete");
- break;
- case usbd_evt_eprx:
- if(dap_state.rx_callback_v2 != NULL) {
- dap_state.rx_callback_v2(dap_state.context);
- }
- break;
- default:
- furi_console_log_printf("bulk %d, %d", event, ep);
- break;
- }
-}
-
-static void cdc_txrx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
- UNUSED(dev);
- UNUSED(ep);
-
- switch(event) {
- case usbd_evt_eptx:
- furi_semaphore_release(dap_state.semaphore_cdc);
- furi_console_log_printf("cdc tx complete");
- break;
- case usbd_evt_eprx:
- if(dap_state.rx_callback_cdc != NULL) {
- dap_state.rx_callback_cdc(dap_state.context_cdc);
- }
- break;
- default:
- furi_console_log_printf("cdc %d, %d", event, ep);
- break;
- }
-}
-
-static usbd_respond hid_ep_config(usbd_device* dev, uint8_t cfg) {
- switch(cfg) {
- case EP_CFG_DECONFIGURE:
- usbd_ep_deconfig(dev, DAP_HID_EP_OUT);
- usbd_ep_deconfig(dev, DAP_HID_EP_IN);
- usbd_ep_deconfig(dev, DAP_HID_EP_BULK_IN);
- usbd_ep_deconfig(dev, DAP_HID_EP_BULK_OUT);
- usbd_ep_deconfig(dev, HID_EP_IN | DAP_CDC_EP_COMM);
- usbd_ep_deconfig(dev, HID_EP_IN | DAP_CDC_EP_SEND);
- usbd_ep_deconfig(dev, HID_EP_OUT | DAP_CDC_EP_RECV);
- usbd_reg_endpoint(dev, DAP_HID_EP_OUT, NULL);
- usbd_reg_endpoint(dev, DAP_HID_EP_IN, NULL);
- usbd_reg_endpoint(dev, DAP_HID_EP_BULK_IN, NULL);
- usbd_reg_endpoint(dev, DAP_HID_EP_BULK_OUT, NULL);
- usbd_reg_endpoint(dev, HID_EP_IN | DAP_CDC_EP_SEND, 0);
- usbd_reg_endpoint(dev, HID_EP_OUT | DAP_CDC_EP_RECV, 0);
- return usbd_ack;
- case EP_CFG_CONFIGURE:
- usbd_ep_config(dev, DAP_HID_EP_IN, USB_EPTYPE_INTERRUPT, DAP_HID_EP_SIZE);
- usbd_ep_config(dev, DAP_HID_EP_OUT, USB_EPTYPE_INTERRUPT, DAP_HID_EP_SIZE);
- usbd_ep_config(dev, DAP_HID_EP_BULK_OUT, USB_EPTYPE_BULK, DAP_HID_EP_SIZE);
- usbd_ep_config(dev, DAP_HID_EP_BULK_IN, USB_EPTYPE_BULK, DAP_HID_EP_SIZE);
- usbd_ep_config(dev, HID_EP_OUT | DAP_CDC_EP_RECV, USB_EPTYPE_BULK, DAP_CDC_EP_SIZE);
- usbd_ep_config(dev, HID_EP_IN | DAP_CDC_EP_SEND, USB_EPTYPE_BULK, DAP_CDC_EP_SIZE);
- usbd_ep_config(dev, HID_EP_IN | DAP_CDC_EP_COMM, USB_EPTYPE_INTERRUPT, DAP_CDC_EP_SIZE);
- usbd_reg_endpoint(dev, DAP_HID_EP_IN, hid_txrx_ep_callback);
- usbd_reg_endpoint(dev, DAP_HID_EP_OUT, hid_txrx_ep_callback);
- usbd_reg_endpoint(dev, DAP_HID_EP_BULK_OUT, hid_txrx_ep_bulk_callback);
- usbd_reg_endpoint(dev, DAP_HID_EP_BULK_IN, hid_txrx_ep_bulk_callback);
- usbd_reg_endpoint(dev, HID_EP_OUT | DAP_CDC_EP_RECV, cdc_txrx_ep_callback);
- usbd_reg_endpoint(dev, HID_EP_IN | DAP_CDC_EP_SEND, cdc_txrx_ep_callback);
- // usbd_ep_write(dev, DAP_HID_EP_IN, NULL, 0);
- // usbd_ep_write(dev, DAP_HID_EP_BULK_IN, NULL, 0);
- // usbd_ep_write(dev, HID_EP_IN | DAP_CDC_EP_SEND, NULL, 0);
- return usbd_ack;
- default:
- return usbd_fail;
- }
-}
-
-#ifdef DAP_USB_LOG
-static void dump_request_type(uint8_t type) {
- switch(type & USB_REQ_DIRECTION) {
- case USB_REQ_HOSTTODEV:
- furi_hal_console_puts("host to dev, ");
- break;
- case USB_REQ_DEVTOHOST:
- furi_hal_console_puts("dev to host, ");
- break;
- }
-
- switch(type & USB_REQ_TYPE) {
- case USB_REQ_STANDARD:
- furi_hal_console_puts("standard, ");
- break;
- case USB_REQ_CLASS:
- furi_hal_console_puts("class, ");
- break;
- case USB_REQ_VENDOR:
- furi_hal_console_puts("vendor, ");
- break;
- }
-
- switch(type & USB_REQ_RECIPIENT) {
- case USB_REQ_DEVICE:
- furi_hal_console_puts("device");
- break;
- case USB_REQ_INTERFACE:
- furi_hal_console_puts("interface");
- break;
- case USB_REQ_ENDPOINT:
- furi_hal_console_puts("endpoint");
- break;
- case USB_REQ_OTHER:
- furi_hal_console_puts("other");
- break;
- }
-
- furi_hal_console_puts("\r\n");
-}
-#else
-#define dump_request_type(...)
-#endif
-
-static usbd_respond hid_control(usbd_device* dev, usbd_ctlreq* req, usbd_rqc_callback* callback) {
- UNUSED(callback);
-
- dump_request_type(req->bmRequestType);
- furi_console_log_printf(
- "control: RT %02x, R %02x, V %04x, I %04x, L %04x",
- req->bmRequestType,
- req->bRequest,
- req->wValue,
- req->wIndex,
- req->wLength);
-
- if(((USB_REQ_RECIPIENT | USB_REQ_TYPE | USB_REQ_DIRECTION) & req->bmRequestType) ==
- (USB_REQ_STANDARD | USB_REQ_VENDOR | USB_REQ_DEVTOHOST)) {
- // vendor request, device to host
- furi_console_log_printf("vendor request");
- if(USB_WINUSB_VENDOR_CODE == req->bRequest) {
- // WINUSB request
- if(USB_WINUSB_DESCRIPTOR_INDEX == req->wIndex) {
- furi_console_log_printf("WINUSB descriptor");
- uint16_t length = req->wLength;
- if(length > sizeof(usb_msos_descriptor_set_t)) {
- length = sizeof(usb_msos_descriptor_set_t);
- }
-
- dev->status.data_ptr = (uint8_t*)&usb_msos_descriptor_set;
- dev->status.data_count = length;
- return usbd_ack;
- }
- }
- }
-
- if(((USB_REQ_RECIPIENT | USB_REQ_TYPE) & req->bmRequestType) ==
- (USB_REQ_STANDARD | USB_REQ_DEVICE)) {
- // device request
- if(req->bRequest == USB_STD_GET_DESCRIPTOR) {
- const uint8_t dtype = req->wValue >> 8;
- const uint8_t dnumber = req->wValue & 0xFF;
- // get string descriptor
- if(USB_DTYPE_STRING == dtype) {
- if(dnumber == USB_STR_CMSIS_DAP_V1) {
- furi_console_log_printf("str CMSIS-DAP v1");
- dev->status.data_ptr = (uint8_t*)&dev_dap_v1_descr;
- dev->status.data_count = dev_dap_v1_descr.bLength;
- return usbd_ack;
- } else if(dnumber == USB_STR_CMSIS_DAP_V2) {
- furi_console_log_printf("str CMSIS-DAP v2");
- dev->status.data_ptr = (uint8_t*)&dev_dap_v2_descr;
- dev->status.data_count = dev_dap_v2_descr.bLength;
- return usbd_ack;
- } else if(dnumber == USB_STR_COM_PORT) {
- furi_console_log_printf("str COM port");
- dev->status.data_ptr = (uint8_t*)&dev_com_descr;
- dev->status.data_count = dev_com_descr.bLength;
- return usbd_ack;
- }
- } else if(USB_DTYPE_BINARY_OBJECT_STORE == dtype) {
- furi_console_log_printf("BOS descriptor");
- uint16_t length = req->wLength;
- if(length > sizeof(usb_bos_hierarchy_t)) {
- length = sizeof(usb_bos_hierarchy_t);
- }
- dev->status.data_ptr = (uint8_t*)&usb_bos_hierarchy;
- dev->status.data_count = length;
- return usbd_ack;
- }
- }
- }
-
- if(((USB_REQ_RECIPIENT | USB_REQ_TYPE) & req->bmRequestType) ==
- (USB_REQ_INTERFACE | USB_REQ_CLASS) &&
- req->wIndex == 0) {
- // class request
- switch(req->bRequest) {
- // get hid descriptor
- case USB_HID_GETREPORT:
- furi_console_log_printf("get report");
- return usbd_fail;
- // set hid idle
- case USB_HID_SETIDLE:
- furi_console_log_printf("set idle");
- return usbd_ack;
- default:
- break;
- }
- }
-
- if(((USB_REQ_RECIPIENT | USB_REQ_TYPE) & req->bmRequestType) ==
- (USB_REQ_INTERFACE | USB_REQ_CLASS) &&
- req->wIndex == 2) {
- // class request
- switch(req->bRequest) {
- // control line state
- case USB_CDC_SET_CONTROL_LINE_STATE:
- furi_console_log_printf("set control line state");
- cdc_ctrl_line_state = req->wValue;
- if(dap_state.control_line_callback_cdc != NULL) {
- dap_state.control_line_callback_cdc(cdc_ctrl_line_state, dap_state.context_cdc);
- }
- return usbd_ack;
- // set cdc line coding
- case USB_CDC_SET_LINE_CODING:
- furi_console_log_printf("set line coding");
- memcpy(&cdc_config, req->data, sizeof(cdc_config));
- if(dap_state.config_callback_cdc != NULL) {
- dap_state.config_callback_cdc(&cdc_config, dap_state.context_cdc);
- }
- return usbd_ack;
- // get cdc line coding
- case USB_CDC_GET_LINE_CODING:
- furi_console_log_printf("get line coding");
- dev->status.data_ptr = &cdc_config;
- dev->status.data_count = sizeof(cdc_config);
- return usbd_ack;
- default:
- break;
- }
- }
-
- if(((USB_REQ_RECIPIENT | USB_REQ_TYPE) & req->bmRequestType) ==
- (USB_REQ_INTERFACE | USB_REQ_STANDARD) &&
- req->wIndex == 0 && req->bRequest == USB_STD_GET_DESCRIPTOR) {
- // standard request
- switch(req->wValue >> 8) {
- // get hid descriptor
- case USB_DTYPE_HID:
- furi_console_log_printf("get hid descriptor");
- dev->status.data_ptr = (uint8_t*)&(hid_cfg_desc.hid);
- dev->status.data_count = sizeof(hid_cfg_desc.hid);
- return usbd_ack;
- // get hid report descriptor
- case USB_DTYPE_HID_REPORT:
- furi_console_log_printf("get hid report descriptor");
- dev->status.data_ptr = (uint8_t*)hid_report_desc;
- dev->status.data_count = sizeof(hid_report_desc);
- return usbd_ack;
- default:
- break;
- }
- }
-
- return usbd_fail;
-}
diff --git a/applications/external/dap_link/usb/dap_v2_usb.h b/applications/external/dap_link/usb/dap_v2_usb.h
deleted file mode 100644
index 3f1534ffd..000000000
--- a/applications/external/dap_link/usb/dap_v2_usb.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma once
-#include
-#include
-
-extern FuriHalUsbInterface dap_v2_usb_hid;
-
-// receive callback type
-typedef void (*DapRxCallback)(void* context);
-
-typedef void (*DapStateCallback)(bool state, void* context);
-
-/************************************ V1 ***************************************/
-
-int32_t dap_v1_usb_tx(uint8_t* buffer, uint8_t size);
-
-size_t dap_v1_usb_rx(uint8_t* buffer, size_t size);
-
-void dap_v1_usb_set_rx_callback(DapRxCallback callback);
-
-/************************************ V2 ***************************************/
-
-int32_t dap_v2_usb_tx(uint8_t* buffer, uint8_t size);
-
-size_t dap_v2_usb_rx(uint8_t* buffer, size_t size);
-
-void dap_v2_usb_set_rx_callback(DapRxCallback callback);
-
-/************************************ CDC **************************************/
-
-typedef void (*DapCDCControlLineCallback)(uint8_t state, void* context);
-typedef void (*DapCDCConfigCallback)(struct usb_cdc_line_coding* config, void* context);
-
-int32_t dap_cdc_usb_tx(uint8_t* buffer, uint8_t size);
-
-size_t dap_cdc_usb_rx(uint8_t* buffer, size_t size);
-
-void dap_cdc_usb_set_rx_callback(DapRxCallback callback);
-
-void dap_cdc_usb_set_control_line_callback(DapCDCControlLineCallback callback);
-
-void dap_cdc_usb_set_config_callback(DapCDCConfigCallback callback);
-
-void dap_cdc_usb_set_context(void* context);
-
-/*********************************** Common ************************************/
-
-void dap_common_usb_set_context(void* context);
-
-void dap_common_usb_set_state_callback(DapStateCallback callback);
-
-void dap_common_usb_alloc_name(const char* name);
-
-void dap_common_usb_free_name();
diff --git a/applications/external/dap_link/usb/usb_winusb.h b/applications/external/dap_link/usb/usb_winusb.h
deleted file mode 100644
index 9c3a172dc..000000000
--- a/applications/external/dap_link/usb/usb_winusb.h
+++ /dev/null
@@ -1,143 +0,0 @@
-#pragma once
-#include
-
-/*- Definitions -------------------------------------------------------------*/
-
-#define USB_PACK __attribute__((packed))
-
-#define USB_WINUSB_VENDOR_CODE 0x20
-
-#define USB_WINUSB_WINDOWS_VERSION 0x06030000 // Windows 8.1
-
-#define USB_WINUSB_PLATFORM_CAPABILITY_ID \
- { \
- 0xdf, 0x60, 0xdd, 0xd8, 0x89, 0x45, 0xc7, 0x4c, 0x9c, 0xd2, 0x65, 0x9d, 0x9e, 0x64, 0x8a, \
- 0x9f \
- }
-
-enum // WinUSB Microsoft OS 2.0 descriptor request codes
-{
- USB_WINUSB_DESCRIPTOR_INDEX = 0x07,
- USB_WINUSB_SET_ALT_ENUMERATION = 0x08,
-};
-
-enum // wDescriptorType
-{
- USB_WINUSB_SET_HEADER_DESCRIPTOR = 0x00,
- USB_WINUSB_SUBSET_HEADER_CONFIGURATION = 0x01,
- USB_WINUSB_SUBSET_HEADER_FUNCTION = 0x02,
- USB_WINUSB_FEATURE_COMPATBLE_ID = 0x03,
- USB_WINUSB_FEATURE_REG_PROPERTY = 0x04,
- USB_WINUSB_FEATURE_MIN_RESUME_TIME = 0x05,
- USB_WINUSB_FEATURE_MODEL_ID = 0x06,
- USB_WINUSB_FEATURE_CCGP_DEVICE = 0x07,
- USB_WINUSB_FEATURE_VENDOR_REVISION = 0x08,
-};
-
-enum // wPropertyDataType
-{
- USB_WINUSB_PROPERTY_DATA_TYPE_SZ = 1,
- USB_WINUSB_PROPERTY_DATA_TYPE_EXPAND_SZ = 2,
- USB_WINUSB_PROPERTY_DATA_TYPE_BINARY = 3,
- USB_WINUSB_PROPERTY_DATA_TYPE_DWORD_LITTLE_ENDIAN = 4,
- USB_WINUSB_PROPERTY_DATA_TYPE_DWORD_BIG_ENDIAN = 5,
- USB_WINUSB_PROPERTY_DATA_TYPE_LINK = 6,
- USB_WINUSB_PROPERTY_DATA_TYPE_MULTI_SZ = 7,
-};
-
-/*- Types BOS -------------------------------------------------------------------*/
-
-typedef struct USB_PACK {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint16_t wTotalLength;
- uint8_t bNumDeviceCaps;
-} usb_binary_object_store_descriptor_t;
-
-/*- Types WinUSB -------------------------------------------------------------------*/
-
-typedef struct USB_PACK {
- uint8_t bLength;
- uint8_t bDescriptorType;
- uint8_t bDevCapabilityType;
- uint8_t bReserved;
- uint8_t PlatformCapabilityUUID[16];
- uint32_t dwWindowsVersion;
- uint16_t wMSOSDescriptorSetTotalLength;
- uint8_t bMS_VendorCode;
- uint8_t bAltEnumCode;
-} usb_winusb_capability_descriptor_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint32_t dwWindowsVersion;
- uint16_t wDescriptorSetTotalLength;
-} usb_winusb_set_header_descriptor_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint8_t bConfigurationValue;
- uint8_t bReserved;
- uint16_t wTotalLength;
-} usb_winusb_subset_header_configuration_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint8_t bFirstInterface;
- uint8_t bReserved;
- uint16_t wSubsetLength;
-} usb_winusb_subset_header_function_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint8_t CompatibleID[8];
- uint8_t SubCompatibleID[8];
-} usb_winusb_feature_compatble_id_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint16_t wPropertyDataType;
- //uint16_t wPropertyNameLength;
- //uint8_t PropertyName[...];
- //uint16_t wPropertyDataLength
- //uint8_t PropertyData[...];
-} usb_winusb_feature_reg_property_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint16_t wPropertyDataType;
- uint16_t wPropertyNameLength;
- uint8_t PropertyName[42];
- uint16_t wPropertyDataLength;
- uint8_t PropertyData[80];
-} usb_winusb_feature_reg_property_guids_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint8_t bResumeRecoveryTime;
- uint8_t bResumeSignalingTime;
-} usb_winusb_feature_min_resume_time_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint8_t ModelID[16];
-} usb_winusb_feature_model_id_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
-} usb_winusb_feature_ccgp_device_t;
-
-typedef struct USB_PACK {
- uint16_t wLength;
- uint16_t wDescriptorType;
- uint16_t VendorRevision;
-} usb_winusb_feature_vendor_revision_t;
\ No newline at end of file
diff --git a/applications/external/doom/.gitignore b/applications/external/doom/.gitignore
deleted file mode 100644
index e2a15a10a..000000000
--- a/applications/external/doom/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-dist/*
-.vscode
-.clang-format
-.editorconfig
\ No newline at end of file
diff --git a/applications/external/doom/README.md b/applications/external/doom/README.md
deleted file mode 100644
index 501f644d1..000000000
--- a/applications/external/doom/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Doom Flipper Zero edition
-## Will it run Doom?
-As tradition goes, Doom is being ported to almost every possible embedded electronic device. Therefore I did an attempt to come up with something close to Doom and still compatible on the Flipper Zero's hardware. This is not the actual Doom game but a port made from yet another Doom port to the Arduino Nano - https://github.com/daveruiz/doom-nano/. This port is basically a raycasting engine, using Doom sprites.
-This version is very basic and might be improved over time.
-
-## Credits
-@xMasterX - Porting to latest firmware using new plugins system, fixing many issues, adding sound
-@Svaarich - New logo screen and cool icon
-@hedger - uFBT fixes and some bugfixes
-@p4nic4ttack - First raw implementation based on doom-nano
\ No newline at end of file
diff --git a/applications/external/doom/application.fam b/applications/external/doom/application.fam
deleted file mode 100644
index 5ff6878ee..000000000
--- a/applications/external/doom/application.fam
+++ /dev/null
@@ -1,18 +0,0 @@
-App(
- appid="doom",
- name="DOOM",
- apptype=FlipperAppType.EXTERNAL,
- entry_point="doom_app",
- requires=[
- "gui",
- "music_player",
- ],
- stack_size=4 * 1024,
- order=75,
- fap_icon="doom_10px.png",
- fap_category="Games",
- fap_icon_assets="assets",
- fap_author="@xMasterX & @Svarich & @hedger (original code by @p4nic4ttack)",
- fap_version="1.0",
- fap_description="Will it run Doom?",
-)
diff --git a/applications/external/doom/assets.c b/applications/external/doom/assets.c
deleted file mode 100644
index 864588581..000000000
--- a/applications/external/doom/assets.c
+++ /dev/null
@@ -1,331 +0,0 @@
-#include "assets.h"
-
-const uint8_t space[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t zero[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
-const uint8_t one[] = {0x00, 0x20, 0x20, 0x20, 0x20, 0x70};
-const uint8_t two[] = {0x00, 0x60, 0x90, 0x20, 0x40, 0xf0};
-const uint8_t three[] = {0x00, 0x60, 0x90, 0x20, 0x90, 0x60};
-const uint8_t four[] = {0x00, 0x90, 0x90, 0xf0, 0x10, 0x10};
-const uint8_t five[] = {0x00, 0xf0, 0x80, 0xe0, 0x10, 0xe0};
-const uint8_t six[] = {0x00, 0x60, 0x80, 0xe0, 0x90, 0x60};
-const uint8_t seven[] = {0x00, 0xf0, 0x10, 0x10, 0x10, 0x10};
-const uint8_t eight[] = {0x00, 0x60, 0x90, 0x60, 0x90, 0x60};
-const uint8_t nine[] = {0x00, 0x60, 0x90, 0x70, 0x10, 0x60};
-const uint8_t A[] = {0x00, 0x60, 0x90, 0xf0, 0x90, 0x90};
-const uint8_t B[] = {0x00, 0xe0, 0x90, 0xe0, 0x90, 0xe0};
-const uint8_t C[] = {0x00, 0x60, 0x90, 0x80, 0x90, 0x60};
-const uint8_t D[] = {0x00, 0xe0, 0x90, 0x90, 0x90, 0xe0};
-const uint8_t E[] = {0x00, 0xf0, 0x80, 0xe0, 0x80, 0xf0};
-const uint8_t F[] = {0x00, 0xf0, 0x80, 0xe0, 0x80, 0x80};
-const uint8_t G[] = {0x00, 0x60, 0x80, 0x80, 0x90, 0x60};
-const uint8_t H[] = {0x00, 0x90, 0x90, 0xf0, 0x90, 0x90};
-const uint8_t I[] = {0x00, 0x20, 0x20, 0x20, 0x20, 0x20};
-const uint8_t J[] = {0x00, 0x10, 0x10, 0x10, 0x90, 0x60};
-const uint8_t K[] = {0x00, 0x90, 0xa0, 0xc0, 0xa0, 0x90};
-const uint8_t L[] = {0x00, 0x80, 0x80, 0x80, 0x80, 0xf0};
-const uint8_t M[] = {0x00, 0x90, 0xf0, 0x90, 0x90, 0x90};
-const uint8_t N[] = {0x00, 0x90, 0xd0, 0xb0, 0x90, 0x90};
-const uint8_t O[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
-const uint8_t P[] = {0x00, 0xe0, 0x90, 0xe0, 0x80, 0x80};
-const uint8_t Q[] = {0x00, 0x60, 0x90, 0x90, 0xb0, 0x70};
-const uint8_t R[] = {0x00, 0xe0, 0x90, 0xe0, 0x90, 0x90};
-const uint8_t S[] = {0x00, 0x60, 0x80, 0x60, 0x10, 0xe0};
-const uint8_t T[] = {0x00, 0xe0, 0x40, 0x40, 0x40, 0x40};
-const uint8_t U[] = {0x00, 0x90, 0x90, 0x90, 0x90, 0x60};
-const uint8_t V[] = {0x00, 0x90, 0x90, 0x90, 0x60, 0x60};
-const uint8_t W[] = {0x00, 0x90, 0x90, 0x90, 0xf0, 0x90};
-const uint8_t X[] = {0x00, 0x90, 0x90, 0x60, 0x90, 0x90};
-const uint8_t Y[] = {0x00, 0x90, 0x90, 0x60, 0x60, 0x60};
-const uint8_t Z[] = {0x00, 0xf0, 0x10, 0x60, 0x80, 0xf0};
-const uint8_t dot[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x40};
-const uint8_t comma[] = {0x00, 0x00, 0x00, 0x00, 0x20, 0x40};
-const uint8_t dash[] = {0x00, 0x00, 0x00, 0x60, 0x00, 0x00};
-const uint8_t underscore[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0xf0};
-const uint8_t bracket_open[] = {0x00, 0x20, 0x40, 0x40, 0x40, 0x20};
-const uint8_t bracket_close[] = {0x00, 0x40, 0x20, 0x20, 0x20, 0x40};
-const uint8_t cross_left[] = {0x10, 0x10, 0x70, 0x70, 0x10, 0x10};
-const uint8_t cross_right[] = {0x80, 0x80, 0xe0, 0xe0, 0x80, 0x80};
-const uint8_t pacman_left[] = {0x00, 0x30, 0x50, 0x70, 0x70, 0x00};
-const uint8_t pacman_right[] = {0x00, 0xc0, 0x60, 0xe0, 0xe0, 0xe0};
-const uint8_t box[] = {0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0x00};
-const uint8_t* char_arr[48] = {
- space,
- zero,
- one,
- two,
- three,
- four,
- five,
- six,
- seven,
- eight,
- nine,
- A,
- B,
- C,
- D,
- E,
- F,
- G,
- H,
- I,
- J,
- K,
- L,
- M,
- N,
- O,
- P,
- Q,
- R,
- S,
- T,
- U,
- V,
- W,
- X,
- Y,
- Z,
- dot,
- comma,
- dash,
- underscore,
- bracket_open,
- bracket_close,
- cross_left,
- cross_right,
- pacman_left,
- pacman_right,
- box};
-const uint8_t gradient[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x00, 0x00, 0x22, 0x22,
- 0x00, 0x00, 0x8a, 0x8a, 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0xaa, 0xaa,
- 0x10, 0x10, 0xaa, 0xaa, 0x00, 0x00, 0xaa, 0xaa, 0x01, 0x01, 0xaa, 0xaa,
- 0x44, 0x44, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x44, 0x44, 0xaa, 0xaa,
- 0x15, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xbb, 0xbb,
- 0x55, 0x55, 0xaa, 0xea, 0x55, 0x55, 0xbb, 0xbb, 0x55, 0x55, 0xff, 0xff,
- 0x55, 0x55, 0xfb, 0xfb, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xbb, 0xbf,
- 0x57, 0x57, 0xff, 0xff, 0xdd, 0xdd, 0xff, 0xff, 0x77, 0x75, 0xff, 0xff,
- 0xdd, 0xdd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-//const uint8_t gun[] = {0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x27, 0xff, 0xff, 0xfe, 0x3b, 0xff, 0xff, 0xfd, 0xfb, 0xff, 0xff, 0xfd, 0xfd, 0xff, 0xff, 0xfd, 0x15, 0xff, 0xff, 0xfb, 0x2e, 0xff, 0xff, 0xf6, 0x77, 0x7f, 0xff, 0xe6, 0xff, 0xff, 0xff, 0xf2, 0x3d, 0x7f, 0xff, 0xd6, 0x7e, 0x3f, 0xff, 0xf4, 0x5d, 0xdf, 0xff, 0xce, 0xbf, 0xbf, 0xff, 0xdc, 0xff, 0x3f, 0xff, 0xec, 0xff, 0xbf, 0xff, 0x8d, 0xfd, 0xff, 0xff, 0xb6, 0xff, 0xbf, 0xfe, 0x1f, 0x57, 0xdf, 0xf8, 0x0e, 0xff, 0xcf, 0xf4, 0x46, 0x1f, 0x17, 0xf8, 0xa3, 0xfc, 0x03, 0xf8, 0x10, 0x00, 0x11, 0xf8, 0x8a, 0x80, 0x2d, 0xe4, 0x44, 0x00, 0x4d, 0xee, 0xa8, 0x82, 0x9b, 0xcd, 0x50, 0x00, 0x17, 0xec, 0xa0, 0x8a, 0x2f, 0xcc, 0x00, 0x04, 0x67, 0xe8, 0x28, 0x1a, 0xff, 0xe4, 0x70, 0x4d, 0xcf, 0xfc, 0x82, 0xa7, 0xef, 0x90, 0x40, 0x13, 0xdf};
-// const uint8_t gun_mask[] = {0xff, 0xff, 0x8f, 0xff, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xfc, 0x01, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xf0, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x0f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f};
-const uint8_t gun[] = {0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x01, 0xc4, 0x00,
- 0x00, 0x02, 0x04, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0xea, 0x00,
- 0x00, 0x04, 0xd1, 0x00, 0x00, 0x09, 0x88, 0x80, 0x00, 0x19, 0x00, 0x00,
- 0x00, 0x0d, 0xc2, 0x80, 0x00, 0x29, 0x81, 0xc0, 0x00, 0x0b, 0xa2, 0x20,
- 0x00, 0x31, 0x40, 0x40, 0x00, 0x23, 0x00, 0xc0, 0x00, 0x13, 0x00, 0x40,
- 0x00, 0x72, 0x02, 0x00, 0x00, 0x49, 0x00, 0x40, 0x01, 0xe0, 0xa8, 0x20,
- 0x07, 0xf1, 0x00, 0x30, 0x0b, 0xb9, 0xe0, 0xe8, 0x07, 0x5c, 0x03, 0xfc,
- 0x07, 0xef, 0xff, 0xee, 0x07, 0x75, 0x7f, 0xd2, 0x1b, 0xbb, 0xff, 0xb2,
- 0x11, 0x57, 0x7d, 0x64, 0x32, 0xaf, 0xff, 0xe8, 0x13, 0x5f, 0x75, 0xd0,
- 0x33, 0xff, 0xfb, 0x98, 0x17, 0xd7, 0xe5, 0x00, 0x1b, 0x8f, 0xb2, 0x30,
- 0x03, 0x7d, 0x58, 0x10, 0x6f, 0xbf, 0xec, 0x20};
-const uint8_t gun_mask[] = {0x00, 0x00, 0x70, 0x00, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x03, 0xfe, 0x00,
- 0x00, 0x07, 0xfe, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x07, 0xff, 0x00,
- 0x00, 0x0f, 0xff, 0x80, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0x80,
- 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xf0,
- 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xe0,
- 0x00, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0xf0,
- 0x0f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xfe,
- 0x1f, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff,
- 0x3f, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xf8,
- 0x7f, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xf8,
- 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf0};
-
-const uint8_t
- imp_inv[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00,
- 0x02, 0x80, 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x01, 0x0f, 0xb3, 0x00, 0x00, 0xd0, 0x4e, 0x00, 0x00, 0x79, 0x8c,
- 0x00, 0x00, 0x1c, 0x19, 0x00, 0x01, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0x02, 0x08, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x8e,
- 0x30, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x20, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x03, 0xe0,
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0xa1, 0x80, 0x01, 0x80, 0x13, 0x00,
- 0x00, 0xf3, 0x8a, 0x00, 0x00, 0x09, 0x94, 0x00, 0x00, 0x88, 0x38, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x23, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x80,
- 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0xe2, 0x80, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x04, 0x30, 0x00, 0x00, 0x02, 0x20, 0x00,
- 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
- 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00,
- 0x00, 0x1f, 0x00, 0x00, 0x02, 0x2a, 0x80, 0x00, 0x01, 0x05, 0x00, 0x00, 0x01,
- 0xae, 0x20, 0x00, 0x01, 0x24, 0x40, 0x00, 0x02, 0xac, 0x80, 0x00, 0x02, 0x86,
- 0x00, 0x00, 0x03, 0x20, 0x20, 0x00, 0x04, 0x30, 0x40, 0x00, 0x0c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x1a, 0x00, 0x00, 0x00,
- 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x98,
- 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00,
- 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0xd6, 0x80, 0x00,
- 0x02, 0xbf, 0x80, 0x00, 0x06, 0x61, 0xa0, 0x00, 0x0c, 0xe8, 0x80, 0x00, 0x0c,
- 0x10, 0x00, 0x00, 0x1a, 0x22, 0x00, 0x00, 0x12, 0x40, 0x00, 0x00, 0x06, 0x0c,
- 0x00, 0x00, 0x04, 0x0d, 0x00, 0x00, 0x3a, 0x03, 0x00, 0x00, 0x10, 0x02, 0x00,
- 0x00, 0x60, 0x0a, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x24, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x01,
- 0x18, 0x00, 0x00, 0x01, 0x41, 0x40, 0x02, 0x33, 0xb6, 0x80, 0x01, 0x9c, 0x04,
- 0x00, 0x08, 0xfa, 0x02, 0x08, 0x05, 0x00, 0x01, 0x0c, 0x27, 0x83, 0xa2, 0x2a,
- 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00}; //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x0f, 0xb3, 0x00, 0x00, 0xd0, 0x4e, 0x00, 0x00, 0x79, 0x8c, 0x00, 0x00, 0x1c, 0x19, 0x00, 0x01, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x08, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x01, 0x8e, 0x30, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t imp_mask_inv[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x03, 0xc0, 0x00,
- 0x00, 0x07, 0xe0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x01, 0x07, 0xf1, 0x80,
- 0x00, 0xdf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x01, 0xff, 0xff, 0x80,
- 0x00, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0x80, 0x03, 0xcf, 0xf1, 0xc0, 0x01, 0xc7, 0xf1, 0xc0,
- 0x01, 0x87, 0xf1, 0xc0, 0x03, 0x0f, 0xf9, 0x80, 0x03, 0x0f, 0xfb, 0x80, 0x01, 0x8f, 0xff, 0x80,
- 0x03, 0x9f, 0x79, 0x00, 0x00, 0x1f, 0x7c, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x0f, 0x78, 0x00,
- 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x30, 0x00,
- 0x00, 0x03, 0x78, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x07, 0xe0, 0x00,
- 0x00, 0x07, 0xc0, 0x00, 0x01, 0x07, 0xe1, 0x00, 0x00, 0x8f, 0xfa, 0x00, 0x00, 0xff, 0xfe, 0x00,
- 0x00, 0x3f, 0xfe, 0x00, 0x01, 0x7f, 0xff, 0x80, 0x00, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0x80,
- 0x03, 0xcf, 0xfb, 0xc0, 0x03, 0x87, 0xf1, 0xc0, 0x03, 0xcf, 0xf3, 0xc0, 0x01, 0xcf, 0xf1, 0x80,
- 0x00, 0xcf, 0xf1, 0x00, 0x00, 0x0f, 0xfb, 0x80, 0x00, 0x1e, 0x78, 0x00, 0x00, 0x0e, 0x78, 0x00,
- 0x00, 0x1e, 0x78, 0x00, 0x00, 0x0f, 0x70, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x07, 0x70, 0x00,
- 0x00, 0x07, 0x70, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x03, 0x20, 0x00,
- 0x00, 0x07, 0x30, 0x00, 0x00, 0x05, 0x70, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00,
- 0x00, 0x00, 0x1f, 0x00, 0x00, 0x03, 0x3f, 0x80, 0x00, 0x01, 0x3f, 0x00, 0x00, 0x01, 0xff, 0x30,
- 0x00, 0x03, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xc0, 0x00, 0x03, 0xff, 0x80, 0x00, 0x07, 0xff, 0xe0,
- 0x00, 0x07, 0xff, 0xc0, 0x00, 0x05, 0xff, 0xe0, 0x00, 0x00, 0xfc, 0xe0, 0x00, 0x01, 0xfc, 0xe0,
- 0x00, 0x01, 0xfc, 0x70, 0x00, 0x03, 0xfc, 0x38, 0x00, 0x03, 0xfe, 0x70, 0x00, 0x07, 0xfc, 0x00,
- 0x00, 0x07, 0x9e, 0x00, 0x00, 0x0f, 0xbc, 0x00, 0x00, 0x0f, 0x3e, 0x00, 0x00, 0x07, 0x9c, 0x00,
- 0x00, 0x03, 0x9c, 0x00, 0x00, 0x03, 0xb8, 0x00, 0x00, 0x03, 0x98, 0x00, 0x00, 0x01, 0x98, 0x00,
- 0x00, 0x02, 0x1c, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1f, 0x00,
- 0x00, 0x00, 0x1f, 0x40, 0x00, 0x00, 0x3e, 0x80, 0x00, 0x01, 0xff, 0x80, 0x00, 0x03, 0xff, 0x80,
- 0x00, 0x07, 0xff, 0xe0, 0x00, 0x0e, 0xff, 0xc0, 0x00, 0x0c, 0xff, 0x80, 0x00, 0x1f, 0xfe, 0x00,
- 0x00, 0x13, 0xfc, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x3f, 0x9f, 0x00,
- 0x00, 0x3e, 0x0f, 0x00, 0x00, 0x7c, 0x0f, 0x00, 0x00, 0x78, 0x0f, 0x00, 0x00, 0x78, 0x07, 0x80,
- 0x00, 0x78, 0x07, 0x40, 0x00, 0x38, 0x07, 0x80, 0x00, 0x30, 0x07, 0x00, 0x00, 0x30, 0x01, 0x00,
- 0x01, 0xf0, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1c, 0x00,
- 0x00, 0x01, 0x3e, 0x00, 0x00, 0x03, 0xff, 0x00, 0x00, 0x0f, 0xff, 0xe0, 0x01, 0x3f, 0xff, 0xc0,
- 0x01, 0xff, 0xff, 0xc0, 0x19, 0xff, 0xff, 0xe8, 0x7f, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xfe,
- 0x1f, 0xc2, 0x07, 0xe0, 0x1f, 0x00, 0x01, 0xe0, 0x0e, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
-}; //{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x01, 0x07, 0xf1, 0x80, 0x00, 0xdf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x01, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0x80, 0x03, 0xcf, 0xf1, 0xc0, 0x01, 0xc7, 0xf1, 0xc0, 0x01, 0x87, 0xf1, 0xc0, 0x03, 0x0f, 0xf9, 0x80, 0x03, 0x0f, 0xfb, 0x80, 0x01, 0x8f, 0xff, 0x80, 0x03, 0x9f, 0x79, 0x00, 0x00, 0x1f, 0x7c, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x0f, 0x78, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x38, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x03, 0x78, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t fireball[] = {0x00, 0x00, 0x01, 0x40, 0x0a, 0xb0, 0x0e, 0xd0, 0x00, 0x68, 0x53,
- 0xb4, 0x0f, 0x48, 0x27, 0x78, 0x17, 0xa8, 0x27, 0xf0, 0x21, 0xd6,
- 0x02, 0xf8, 0x20, 0x48, 0x06, 0x20, 0x01, 0x00, 0x00, 0x00};
-const uint8_t fireball_mask[] = {0x1f, 0x40, 0x0f, 0xf0, 0x3f, 0xf8, 0x1f, 0xfc, 0x7f, 0xfd, 0x7f,
- 0xfc, 0x7f, 0xfd, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
- 0xff, 0xfe, 0x3f, 0xfe, 0x17, 0xf8, 0x07, 0xf4, 0x01, 0xe0};
-const uint8_t item[] = {0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0x77, 0xee, 0x3f,
- 0xfc, 0x5f, 0xfa, 0x2f, 0xf6, 0x53, 0xcc, 0x3e, 0x7e, 0x5e, 0x7c,
- 0x38, 0x1e, 0x58, 0x1c, 0x3e, 0x7e, 0x5e, 0x7e, 0x2e, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc,
- 0x17, 0xfc, 0x22, 0x6c, 0x36, 0x44, 0x3f, 0xfc, 0x1f, 0xfc, 0x2b,
- 0xfc, 0x05, 0x54, 0x02, 0xa8, 0x00, 0x00, 0x00, 0x00};
-const uint8_t item_mask[] = {0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
- 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe,
- 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc,
- 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f,
- 0xfc, 0x07, 0xfc, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00};
-
-//const uint8_t door[] = {0xff, 0xff, 0xff, 0xff,0xb2, 0xbd, 0xcd, 0x5b,0x9a, 0xf4, 0x6d, 0x71,0xff, 0xff, 0xff, 0xff,0x00, 0x00, 0x00, 0x00,0xbf, 0xff, 0xff, 0xfd,0x3f, 0x00, 0xfe, 0xfc,0x3e, 0x00, 0xc6, 0xfc,0xbc, 0xaa, 0xfe, 0xbd,0x39, 0x54, 0xc6, 0xbc,0x32, 0x8e, 0xfe, 0xac,0xb5, 0xfe, 0xc6, 0xad,0x3f, 0xe0, 0xfe, 0xac,0x31, 0xe0, 0xc6, 0xac,0xb3, 0xf4, 0xfe, 0xad,0x3f, 0xe8, 0xc6, 0xac,0x3c, 0xf4, 0xd6, 0xac,0xb8, 0xff, 0xfe, 0xad,0x34, 0xc7, 0xfe, 0xfc,0x38, 0xd6, 0x0e, 0x0c,0xb0, 0xd6, 0x4e, 0x0d,0x3f, 0xd6, 0xaf, 0x5c,0x30, 0x47, 0xff, 0xac,0xb7, 0x57, 0xff, 0xfd,0x3f, 0xc6, 0x0e, 0x0c,0x35, 0x56, 0x40, 0x4c,0xb5, 0x46, 0xaa, 0xad,0x35, 0x56, 0x55, 0x4c,0xff, 0xff, 0xff, 0xff,0xb0, 0x1f, 0xf8, 0x0d,0xd9, 0x30, 0x0c, 0x9b,0xff, 0xe0, 0x07, 0xff};
-const uint8_t door[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0xe1, 0x8c, 0x00, 0x04,
- 0x00, 0x7c, 0x03, 0x18, 0x60, 0x08, 0x00, 0x3e, 0x0f, 0xf7, 0xdf, 0x00, 0x1f, 0x00, 0xfe, 0x0f,
- 0xbe, 0xf8, 0x3e, 0x00, 0x3f, 0x1f, 0xff, 0xdf, 0x00, 0x1f, 0x81, 0xff, 0x0f, 0xff, 0xf8, 0x7e,
- 0x00, 0x3f, 0x8f, 0xff, 0xdf, 0x00, 0xff, 0xf9, 0xff, 0x1f, 0xff, 0xf8, 0xff, 0x80, 0x3f, 0xc7,
- 0xff, 0xcc, 0x07, 0xff, 0xfc, 0xff, 0x1f, 0xff, 0xe3, 0xff, 0x80, 0x3f, 0xc7, 0xff, 0xc0, 0x07,
- 0xff, 0xfc, 0x7f, 0x0f, 0xfe, 0x03, 0xff, 0xc0, 0x3f, 0xc3, 0xf7, 0xc0, 0x07, 0xdf, 0xf8, 0x3e,
- 0x0f, 0xbe, 0x01, 0xff, 0x80, 0x1f, 0x80, 0xe3, 0x80, 0x07, 0x8f, 0xf8, 0x1e, 0x07, 0x1c, 0x01,
- 0xff, 0x80, 0x3f, 0xc1, 0xff, 0xc0, 0x0f, 0xff, 0xfc, 0x3f, 0x0f, 0xbe, 0x03, 0xff, 0xc0, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0x80, 0x00,
- 0x7f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xe0, 0x00, 0x1f, 0xf0, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff,
- 0xc0, 0x00, 0x00, 0xe0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x01,
- 0xe0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x01, 0xf0, 0x00, 0x0f,
- 0xf0, 0xff, 0x00, 0x03, 0xff, 0xff, 0xff, 0xe0, 0x7f, 0x81, 0xf0, 0x00, 0x0f, 0xf0, 0xff, 0x00,
- 0x07, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xf0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x0f, 0xff, 0xff,
- 0xff, 0xe1, 0xff, 0xe1, 0xf0, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xe0, 0xff,
- 0xc1, 0xf3, 0x00, 0x0f, 0xf0, 0xff, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xe0, 0xff, 0x81, 0xff, 0xc0,
- 0x0f, 0xf0, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0x01, 0xff, 0xc0, 0x0f, 0xf0, 0xff,
- 0x00, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xe0, 0x0f, 0xf0, 0xff, 0x01, 0xff, 0xff,
- 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xe0, 0x0f, 0xf0, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xe1,
- 0xff, 0xe1, 0xff, 0xe0, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xc1, 0xff,
- 0xf0, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x8f, 0xe0, 0xff, 0x81, 0xff, 0xff, 0x0f, 0xf0,
- 0xff, 0x1f, 0xff, 0xff, 0xfe, 0x07, 0xe0, 0x7f, 0x81, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff,
- 0xff, 0xfc, 0x07, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0x8f, 0xfc, 0x03,
- 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0x07, 0xfc, 0x07, 0xe0, 0xff, 0xc1,
- 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xfe, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f,
- 0xf0, 0xff, 0x0f, 0x9c, 0x00, 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07,
- 0xfc, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07, 0xfc, 0x00, 0x7f,
- 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xfc, 0x00, 0x7f, 0xff, 0xe0, 0xff,
- 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xfc, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff,
- 0x8f, 0xf0, 0xff, 0x1f, 0xfe, 0x00, 0x7f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff,
- 0x1f, 0xfc, 0x00, 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xfc, 0x00,
- 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xf0, 0x00, 0x1f, 0xff, 0xe0,
- 0x7f, 0x81, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xf0, 0x00, 0x1f, 0xff, 0xe0, 0xff, 0x81, 0xff,
- 0xff, 0x8f, 0xf0, 0xff, 0x07, 0xe0, 0x00, 0x3f, 0xff, 0xe0, 0xff, 0xc1, 0xff, 0xff, 0x8f, 0xf0,
- 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0x1f,
- 0x80, 0x3f, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0x3f, 0xc0, 0x1f, 0xff,
- 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0x7f, 0xc0, 0x0f, 0xff, 0xe1, 0xff, 0xe1,
- 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x00, 0xff, 0xc0, 0x07, 0xff, 0xe1, 0xff, 0xe1, 0xff, 0xff, 0x8f,
- 0xf0, 0xff, 0x01, 0xff, 0xc0, 0x03, 0x8f, 0xc0, 0xc1, 0x81, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x03,
- 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07, 0xff, 0xc0, 0xff,
- 0x80, 0x00, 0x00, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc1, 0xff, 0x80, 0x00, 0x00,
- 0x01, 0xf3, 0x8e, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc0, 0x00, 0x00, 0x01, 0xff, 0x9c,
- 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc0, 0xff, 0xfc, 0x01, 0xff, 0xfe, 0x0f, 0xf0, 0xff,
- 0x0f, 0xff, 0xc3, 0xff, 0xc1, 0xff, 0xfe, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xc3,
- 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff,
- 0xff, 0x01, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff,
- 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff, 0xff, 0x8f, 0xf0,
- 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xff,
- 0xc3, 0xff, 0xc3, 0xff, 0xff, 0x00, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xc3,
- 0xff, 0xff, 0x00, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xe3, 0xff, 0xc3, 0xff, 0xff, 0x00,
- 0x3f, 0xfe, 0x0f, 0xf0, 0xff, 0x07, 0xff, 0xf3, 0xff, 0xc1, 0xef, 0xfe, 0x00, 0x3f, 0xfe, 0x0f,
- 0xf0, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x82, 0x00, 0x00, 0x1f, 0xff, 0x0f, 0xf0, 0xff, 0x1f,
- 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff,
- 0xc0, 0x00, 0x00, 0x00, 0x07, 0xff, 0x0f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00,
- 0x00, 0x03, 0x8e, 0x0f, 0xf0, 0xff, 0x1f, 0xc1, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x88,
- 0x0f, 0xf0, 0xff, 0x0f, 0x80, 0xff, 0xff, 0xc1, 0xff, 0xfc, 0x00, 0xff, 0xfe, 0x0f, 0xf0, 0xff,
- 0x06, 0x00, 0x73, 0xff, 0xc3, 0xff, 0xfe, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0x03,
- 0xff, 0xc3, 0xff, 0xff, 0x83, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x07, 0x0c, 0x73, 0xff, 0xc3, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x0f, 0xfe, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0,
- 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff,
- 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0x8f, 0xf0, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f,
- 0xf0, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xf0, 0xfe, 0x1f,
- 0xfe, 0xfb, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xfc, 0x0f, 0x9e, 0x73, 0xff,
- 0x81, 0xf9, 0xf7, 0xe7, 0x9c, 0xff, 0x03, 0xf0, 0xfc, 0x07, 0xfe, 0xfb, 0xc0, 0x00, 0xf0, 0x00,
- 0x6f, 0xbe, 0xfe, 0x03, 0xf0, 0x3c, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xfe,
- 0x03, 0xc0, 0x1c, 0x0f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0x03, 0x80, 0x1e,
- 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x07, 0x80, 0x3f, 0x0f, 0xff, 0xff,
- 0xe0, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0x0f, 0xc0, 0x1f, 0x8f, 0xff, 0xff, 0xe7, 0xff, 0xff,
- 0xfe, 0x7f, 0xff, 0xff, 0x1f, 0x80, 0x1f, 0xc7, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xfe, 0x3f, 0x80, 0x07, 0xc3, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfc, 0x3e, 0x00,
- 0x07, 0xc1, 0xfe, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xcf, 0xf7, 0xf8, 0x3e, 0x00, 0x01, 0x00, 0xfc,
- 0x7e, 0x7f, 0xff, 0xff, 0xff, 0xe7, 0xe3, 0xf0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff,
- 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xe0,
- 0x00, 0x00, 0x00, 0x00};
\ No newline at end of file
diff --git a/applications/external/doom/assets.h b/applications/external/doom/assets.h
deleted file mode 100644
index 546d7607d..000000000
--- a/applications/external/doom/assets.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#pragma once
-#include
-
-#ifndef _sprites_h
-#define _sprites_h
-
-#define bmp_font_width 24 // in bytes
-#define bmp_font_height 6
-#define bmp_font_width_pxs 192
-#define bmp_font_height_pxs 48
-#define CHAR_MAP " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.,-_(){}[]#"
-#define CHAR_WIDTH 4
-#define CHAR_HEIGHT 6
-
-#define BMP_GUN_WIDTH 32
-#define BMP_GUN_HEIGHT 32
-
-#define BMP_FIRE_WIDTH 24
-#define BMP_FIRE_HEIGHT 20
-
-#define BMP_IMP_WIDTH 32
-#define BMP_IMP_HEIGHT 32
-#define BMP_IMP_COUNT 5
-
-#define BMP_FIREBALL_WIDTH 16
-#define BMP_FIREBALL_HEIGHT 16
-
-#define BMP_DOOR_WIDTH 100
-#define BMP_DOOR_HEIGHT 100
-
-#define BMP_ITEMS_WIDTH 16
-#define BMP_ITEMS_HEIGHT 16
-#define BMP_ITEMS_COUNT 2
-
-#define BMP_LOGO_WIDTH 128
-#define BMP_LOGO_HEIGHT 64
-
-#define GRADIENT_WIDTH 2
-#define GRADIENT_HEIGHT 8
-#define GRADIENT_COUNT 8
-#define GRADIENT_WHITE 7
-#define GRADIENT_BLACK 0
-
-// Fonts
-extern const uint8_t zero[];
-extern const uint8_t one[];
-extern const uint8_t two[];
-extern const uint8_t three[];
-extern const uint8_t four[];
-extern const uint8_t five[];
-extern const uint8_t six[];
-extern const uint8_t seven[];
-extern const uint8_t eight[];
-extern const uint8_t nine[];
-extern const uint8_t A[];
-extern const uint8_t B[];
-extern const uint8_t C[];
-extern const uint8_t D[];
-extern const uint8_t E[];
-extern const uint8_t F[];
-extern const uint8_t G[];
-extern const uint8_t H[];
-extern const uint8_t I[];
-extern const uint8_t J[];
-extern const uint8_t K[];
-extern const uint8_t L[];
-extern const uint8_t M[];
-extern const uint8_t N[];
-extern const uint8_t O[];
-extern const uint8_t P[];
-extern const uint8_t Q[];
-extern const uint8_t R[];
-extern const uint8_t S[];
-extern const uint8_t T[];
-extern const uint8_t U[];
-extern const uint8_t V[];
-extern const uint8_t W[];
-extern const uint8_t X[];
-extern const uint8_t Y[];
-extern const uint8_t Z[];
-extern const uint8_t dot[];
-extern const uint8_t comma[];
-extern const uint8_t dash[];
-extern const uint8_t underscore[];
-extern const uint8_t bracket_open[];
-extern const uint8_t bracket_close[];
-extern const uint8_t cross_left[];
-extern const uint8_t cross_right[];
-extern const uint8_t pacman_left[];
-extern const uint8_t pacman_right[];
-extern const uint8_t box[];
-extern const uint8_t* char_arr[48];
-extern const uint8_t gradient[];
-//extern const uint8_t gun[]
-//extern const uint8_t gun_mask[]
-extern const uint8_t gun[];
-extern const uint8_t gun_mask[];
-
-extern const uint8_t imp_inv[];
-extern const uint8_t imp_mask_inv[];
-extern const uint8_t fireball[];
-extern const uint8_t fireball_mask[];
-extern const uint8_t item[];
-extern const uint8_t item_mask[];
-
-extern const uint8_t door[];
-
-#endif
diff --git a/applications/external/doom/assets/door2.png b/applications/external/doom/assets/door2.png
deleted file mode 100644
index b4b4f0399..000000000
Binary files a/applications/external/doom/assets/door2.png and /dev/null differ
diff --git a/applications/external/doom/assets/door_inv.png b/applications/external/doom/assets/door_inv.png
deleted file mode 100644
index 3185f524c..000000000
Binary files a/applications/external/doom/assets/door_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/fire_inv.png b/applications/external/doom/assets/fire_inv.png
deleted file mode 100644
index 46af8691b..000000000
Binary files a/applications/external/doom/assets/fire_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/fireball_inv.png b/applications/external/doom/assets/fireball_inv.png
deleted file mode 100644
index b046288f8..000000000
Binary files a/applications/external/doom/assets/fireball_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/fireball_mask_inv.png b/applications/external/doom/assets/fireball_mask_inv.png
deleted file mode 100644
index 548c654b7..000000000
Binary files a/applications/external/doom/assets/fireball_mask_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/gradient_inv.png b/applications/external/doom/assets/gradient_inv.png
deleted file mode 100644
index 78eec8c20..000000000
Binary files a/applications/external/doom/assets/gradient_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/gun_inv.png b/applications/external/doom/assets/gun_inv.png
deleted file mode 100644
index e2ec05295..000000000
Binary files a/applications/external/doom/assets/gun_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/gun_mask_inv.png b/applications/external/doom/assets/gun_mask_inv.png
deleted file mode 100644
index 2d761a70a..000000000
Binary files a/applications/external/doom/assets/gun_mask_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/imp_inv.png b/applications/external/doom/assets/imp_inv.png
deleted file mode 100644
index 4b480f1c5..000000000
Binary files a/applications/external/doom/assets/imp_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/imp_mask_inv.png b/applications/external/doom/assets/imp_mask_inv.png
deleted file mode 100644
index 70e991270..000000000
Binary files a/applications/external/doom/assets/imp_mask_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/item_inv.png b/applications/external/doom/assets/item_inv.png
deleted file mode 100644
index 1d32dbcd8..000000000
Binary files a/applications/external/doom/assets/item_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/item_mask_inv.png b/applications/external/doom/assets/item_mask_inv.png
deleted file mode 100644
index a0bde9c76..000000000
Binary files a/applications/external/doom/assets/item_mask_inv.png and /dev/null differ
diff --git a/applications/external/doom/assets/logo_inv.png b/applications/external/doom/assets/logo_inv.png
deleted file mode 100644
index c75bd3028..000000000
Binary files a/applications/external/doom/assets/logo_inv.png and /dev/null differ
diff --git a/applications/external/doom/constants.h b/applications/external/doom/constants.h
deleted file mode 100644
index 4e0f10118..000000000
--- a/applications/external/doom/constants.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef _constants_h
-#define _constants_h
-#define PB_CONSTEXPR constexpr
-
-#define PI 3.14159265358979323846
-
-// Key pinout
-#define USE_INPUT_PULLUP
-#define K_LEFT 6
-#define K_RIGHT 7
-#define K_UP 8
-#define K_DOWN 3
-#define K_FIRE 10
-
-// SNES Controller
-// uncomment following line to enable snes controller support
-// #define SNES_CONTROLLER
-const uint8_t DATA_CLOCK = 11;
-const uint8_t DATA_LATCH = 12;
-const uint8_t DATA_SERIAL = 13;
-
-// Sound
-const uint8_t SOUND_PIN = 9; // do not change, belongs to used timer
-
-// GFX settings
-#define OPTIMIZE_SSD1306 // Optimizations for SSD1366 displays
-
-#define FRAME_TIME 66.666666 // Desired time per frame in ms (66.666666 is ~15 fps)
-#define RES_DIVIDER 2
-
-/* Higher values will result in lower horizontal resolution when rasterize and lower process and memory usage
- Lower will require more process and memory, but looks nicer
- */
-#define Z_RES_DIVIDER 2 // Zbuffer resolution divider. We sacrifice resolution to save memory
-#define DISTANCE_MULTIPLIER 20
-
-/* Distances are stored as uint8_t, multiplying the distance we can obtain more precision taking care
- of keep numbers inside the type range. Max is 256 / MAX_RENDER_DEPTH
- */
-
-#define MAX_RENDER_DEPTH 12
-#define MAX_SPRITE_DEPTH 8
-
-#define ZBUFFER_SIZE SCREEN_WIDTH / Z_RES_DIVIDER
-
-// Level
-#define LEVEL_WIDTH_BASE 6
-#define LEVEL_WIDTH (1 << LEVEL_WIDTH_BASE)
-#define LEVEL_HEIGHT 57
-#define LEVEL_SIZE LEVEL_WIDTH / 2 * LEVEL_HEIGHT
-
-// scenes
-#define INTRO 0
-#define GAME_PLAY 1
-
-// Game
-#define GUN_TARGET_POS 18
-#define GUN_SHOT_POS GUN_TARGET_POS + 4
-
-#define ROT_SPEED .12
-#define MOV_SPEED .2
-#define MOV_SPEED_INV 5 // 1 / MOV_SPEED
-
-#define JOGGING_SPEED .005
-#define ENEMY_SPEED .02
-#define FIREBALL_SPEED .2
-#define FIREBALL_ANGLES 45 // Num of angles per PI
-
-#define MAX_ENTITIES 10 // Max num of active entities
-#define MAX_STATIC_ENTITIES 28 // Max num of entities in sleep mode
-
-#define MAX_ENTITY_DISTANCE 200 // * DISTANCE_MULTIPLIER
-#define MAX_ENEMY_VIEW 80 // * DISTANCE_MULTIPLIER
-#define ITEM_COLLIDER_DIST 6 // * DISTANCE_MULTIPLIER
-#define ENEMY_COLLIDER_DIST 4 // * DISTANCE_MULTIPLIER
-#define FIREBALL_COLLIDER_DIST 2 // * DISTANCE_MULTIPLIER
-#define ENEMY_MELEE_DIST 6 // * DISTANCE_MULTIPLIER
-#define WALL_COLLIDER_DIST .2
-
-#define ENEMY_MELEE_DAMAGE 8
-#define ENEMY_FIREBALL_DAMAGE 20
-#define GUN_MAX_DAMAGE 20
-
-// display
-const uint8_t SCREEN_WIDTH = 128;
-const uint8_t SCREEN_HEIGHT = 64;
-const uint8_t HALF_WIDTH = SCREEN_WIDTH / 2;
-const uint8_t RENDER_HEIGHT = 56; // raycaster working height (the rest is for the hud)
-const uint8_t HALF_HEIGHT = SCREEN_HEIGHT / 2;
-
-#endif
diff --git a/applications/external/doom/display.h b/applications/external/doom/display.h
deleted file mode 100644
index 89f821867..000000000
--- a/applications/external/doom/display.h
+++ /dev/null
@@ -1,280 +0,0 @@
-#include
-#include
-#include "constants.h"
-#include
-#include "assets.h"
-
-#define CHECK_BIT(var, pos) ((var) & (1 << (pos)))
-
-static const uint8_t bit_mask[8] = {128, 64, 32, 16, 8, 4, 2, 1};
-
-#define pgm_read_byte(addr) (*(const unsigned char*)(addr))
-#define read_bit(b, n) b& pgm_read_byte(bit_mask + n) ? 1 : 0
-//#define read_bit(byte, index) (((unsigned)(byte) >> (index)) & 1)
-
-void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canvas* const canvas);
-void drawPixel(int8_t x, int8_t y, bool color, bool raycasterViewport, Canvas* const canvas);
-void drawSprite(
- int8_t x,
- int8_t y,
- const uint8_t* bitmap,
- const uint8_t* bitmap_mask,
- int16_t w,
- int16_t h,
- uint8_t sprite,
- double distance,
- Canvas* const canvas);
-void drawBitmap(
- int16_t x,
- int16_t y,
- const Icon* i,
- int16_t w,
- int16_t h,
- uint16_t color,
- Canvas* const canvas);
-void drawTextSpace(int8_t x, int8_t y, char* txt, uint8_t space, Canvas* const canvas);
-void drawChar(int8_t x, int8_t y, char ch, Canvas* const canvas);
-void clearRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas);
-void drawGun(
- int16_t x,
- int16_t y,
- const uint8_t* bitmap,
- int16_t w,
- int16_t h,
- uint16_t color,
- Canvas* const canvas);
-void drawRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas);
-void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas);
-void fadeScreen(uint8_t intensity, bool color, Canvas* const canvas);
-bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i);
-double getActualFps();
-void fps();
-uint8_t reverse_bits(uint8_t num);
-
-// FPS control
-double delta = 1;
-uint32_t lastFrameTime = 0;
-uint8_t zbuffer[128]; /// 128 = screen width & REMOVE WHEN DISPLAY.H IMPLEMENTED
-
-void drawGun(
- int16_t x,
- int16_t y,
- const uint8_t* bitmap,
- int16_t w,
- int16_t h,
- uint16_t color,
- Canvas* const canvas) {
- int16_t byteWidth = (w + 7) / 8;
- uint8_t byte = 0;
- for(int16_t j = 0; j < h; j++, y++) {
- for(int16_t i = 0; i < w; i++) {
- if(i & 7)
- byte <<= 1;
- else
- byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]);
- if(byte & 0x80) drawPixel(x + i, y, color, false, canvas);
- }
- }
-}
-
-void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canvas* const canvas) {
- UNUSED(intensity);
- uint8_t dots = end_y - start_y;
- for(int i = 0; i < dots; i++) {
- canvas_draw_dot(canvas, x, start_y + i);
- }
-}
-
-void drawBitmap(
- int16_t x,
- int16_t y,
- const Icon* i,
- int16_t w,
- int16_t h,
- uint16_t color,
- Canvas* const canvas) {
- UNUSED(w);
- UNUSED(h);
- if(!color) {
- canvas_invert_color(canvas);
- }
- canvas_draw_icon(canvas, x, y, i);
- if(!color) {
- canvas_invert_color(canvas);
- }
-}
-
-void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas) {
- char buf[4];
- snprintf(buf, 4, "%d", num);
- drawTextSpace(x, y, buf, 1, canvas);
-}
-
-void drawTextSpace(int8_t x, int8_t y, char* txt, uint8_t space, Canvas* const canvas) {
- uint8_t pos = x;
- uint8_t i = 0;
- char ch;
- while((ch = txt[i]) != '\0') {
- drawChar(pos, y, ch, canvas);
- i++;
- pos += CHAR_WIDTH + space;
-
- // shortcut on end of screen
- if(pos > SCREEN_WIDTH) return;
- }
-}
-
-// Custom drawBitmap method with scale support, mask, zindex and pattern filling
-void drawSprite(
- int8_t x,
- int8_t y,
- const uint8_t* bitmap,
- const uint8_t* bitmap_mask,
- int16_t w,
- int16_t h,
- uint8_t sprite,
- double distance,
- Canvas* const canvas) {
- uint8_t tw = (double)w / distance;
- uint8_t th = (double)h / distance;
- uint8_t byte_width = w / 8;
- uint8_t pixel_size = fmax(1, (double)1.0 / (double)distance);
- uint16_t sprite_offset = byte_width * h * sprite;
-
- bool pixel;
- bool maskPixel;
-
- // Don't draw the whole sprite if the anchor is hidden by z buffer
- // Not checked per pixel for performance reasons
- if(zbuffer[(int)(fmin(fmax(x, 0), ZBUFFER_SIZE - 1) / Z_RES_DIVIDER)] <
- distance * DISTANCE_MULTIPLIER) {
- return;
- }
-
- for(uint8_t ty = 0; ty < th; ty += pixel_size) {
- // Don't draw out of screen
- if(y + ty < 0 || y + ty >= RENDER_HEIGHT) {
- continue;
- }
-
- uint8_t sy = ty * distance; // The y from the sprite
-
- for(uint8_t tx = 0; tx < tw; tx += pixel_size) {
- uint8_t sx = tx * distance; // The x from the sprite
- uint16_t byte_offset = sprite_offset + sy * byte_width + sx / 8;
-
- // Don't draw out of screen
- if(x + tx < 0 || x + tx >= SCREEN_WIDTH) {
- continue;
- }
-
- maskPixel = read_bit(pgm_read_byte(bitmap_mask + byte_offset), sx % 8);
-
- if(maskPixel) {
- pixel = read_bit(pgm_read_byte(bitmap + byte_offset), sx % 8);
- for(uint8_t ox = 0; ox < pixel_size; ox++) {
- for(uint8_t oy = 0; oy < pixel_size; oy++) {
- if(bitmap == imp_inv)
- drawPixel(x + tx + ox, y + ty + oy, 1, true, canvas);
- else
- drawPixel(x + tx + ox, y + ty + oy, pixel, true, canvas);
- }
- }
- }
- }
- }
-}
-
-void drawPixel(int8_t x, int8_t y, bool color, bool raycasterViewport, Canvas* const canvas) {
- if(x < 0 || x >= SCREEN_WIDTH || y < 0 ||
- y >= (raycasterViewport ? RENDER_HEIGHT : SCREEN_HEIGHT)) {
- return;
- }
- if(color)
- canvas_draw_dot(canvas, x, y);
- else {
- canvas_invert_color(canvas);
- canvas_draw_dot(canvas, x, y);
- canvas_invert_color(canvas);
- }
-}
-
-void drawChar(int8_t x, int8_t y, char ch, Canvas* const canvas) {
- uint8_t lsb;
- uint8_t c = 0;
- while(CHAR_MAP[c] != ch && CHAR_MAP[c] != '\0') c++;
- for(uint8_t i = 0; i < 6; i++) {
- //lsb = (char_arr[c][i] >> 4);
- lsb = reverse_bits(char_arr[c][i]);
- for(uint8_t n = 0; n < 4; n++) {
- if(CHECK_BIT(lsb, n)) {
- drawPixel(x + n, y + i, true, false, canvas);
- }
- }
- }
-}
-
-void clearRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas) {
- canvas_invert_color(canvas);
-
- for(int i = 0; i < w; i++) {
- for(int j = 0; j < h; j++) {
- canvas_draw_dot(canvas, x + i, y + j);
- }
- }
-
- canvas_invert_color(canvas);
-}
-
-void drawRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, Canvas* const canvas) {
- for(int i = 0; i < w; i++) {
- for(int j = 0; j < h; j++) {
- canvas_draw_dot(canvas, x + i, y + j);
- }
- }
-}
-
-bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i) {
- if(i == 0) return 0;
- if(i >= GRADIENT_COUNT - 1) return 1;
-
- uint8_t index =
- fmax(0, fmin(GRADIENT_COUNT - 1, i)) * GRADIENT_WIDTH * GRADIENT_HEIGHT // gradient index
- + y * GRADIENT_WIDTH % (GRADIENT_WIDTH * GRADIENT_HEIGHT) // y byte offset
- + x / GRADIENT_HEIGHT % GRADIENT_WIDTH; // x byte offset
- //uint8_t *gradient_data = NULL;
- //furi_hal_compress_icon_decode(icon_get_data(&I_gradient_inv), &gradient_data);
- // return the bit based on x
- return read_bit(pgm_read_byte(gradient + index), x % 8);
-}
-
-void fadeScreen(uint8_t intensity, bool color, Canvas* const canvas) {
- for(uint8_t x = 0; x < SCREEN_WIDTH; x++) {
- for(uint8_t y = 0; y < SCREEN_HEIGHT; y++) {
- if(getGradientPixel(x, y, intensity)) drawPixel(x, y, color, false, canvas);
- }
- }
-}
-
-// Adds a delay to limit play to specified fps
-// Calculates also delta to keep movement consistent in lower framerates
-void fps() {
- while(furi_get_tick() - lastFrameTime < FRAME_TIME)
- ;
- delta = (double)(furi_get_tick() - lastFrameTime) / (double)FRAME_TIME;
- lastFrameTime = furi_get_tick();
-}
-
-double getActualFps() {
- return 1000 / ((double)FRAME_TIME * (double)delta);
-}
-
-uint8_t reverse_bits(uint8_t num) {
- unsigned int NO_OF_BITS = sizeof(num) * 8;
- uint8_t reverse_num = 0;
- uint8_t i;
- for(i = 0; i < NO_OF_BITS; i++) {
- if((num & (1 << i))) reverse_num |= 1 << ((NO_OF_BITS - 1) - i);
- }
- return reverse_num;
-}
\ No newline at end of file
diff --git a/applications/external/doom/doom.c b/applications/external/doom/doom.c
deleted file mode 100644
index c2d9a6bf0..000000000
--- a/applications/external/doom/doom.c
+++ /dev/null
@@ -1,1104 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include "sound.h"
-#include "display.h"
-#include "assets.h"
-#include "constants.h"
-#include "entities.h"
-#include "types.h"
-#include "level.h"
-#include