/FlipperZero_plugin_howto

A simple plugin for the FlipperZero written as a tutorial example [ie. excessive documentation & error handling]

Primary LanguageCMIT LicenseMIT

FlipperZero_plugin_howto

A simple plugin for the FlipperZero written as a tutorial example [ie. excessive documentation & error handling]

FAP Support Has Arrived! :) [Sept 2022]

Since the move to FAP, your "plugins" are now known as "applications"

  • "Plugins" are
    • Compiled in to the kernel
    • Flashed as part of the firmware in the main SoC
    • Require the developer to edit/maintain /applications/meta/applications.fam
  • "Applications" are
    • Compiled as separate programs
    • Live on the SDCard
    • Do NOT require code edits outside their own directory

The upshot is easier development, and (essentailly) unlimited features on your Flipper!

If you have not yet installed the FlipperZero devkit

On an x86[1] computer, at a Linux[2] command prompt, type:

mkdir -p ~/flipperZero/official/
cd ~/flipperZero/official/
git clone --recursive  https://github.com/flipperdevices/flipperzero-firmware.git  ./
( cd assets/protobuf/ && git fetch )
./fbt

...and wait while it downloads all the required tools and performs the first build of the code.

[1] The FlipperZero Toolchain is ONLY available for x86 PCs. EG. You will NOT be able to do this on a RaspberyyPi.
[2] You CAN write FAPs under Windows. Perahps a friendly windows user would like to write a tutorial on this?

Install the cutting-edge firmware on your Flipper

./fbt flash_usb_full

Note:

  • flash_usb is used to install JUST the firmware
  • flash_usb_full also installs the "resources" (images and such)

Be aware that since the introdcution of FAP [Sept 2022], Applications are Resources (in the same way that Images are Resources).

After the devkit is installed

Assuming your devkit is in: ~/flipperZero/official/
...checkout this demo with:

cd ~/flipperZero/official//applications_user
mkdir bc_demo
cd bc_demo
git clone https://github.com/csBlueChip/FlipperZero_plugin_howto.git ./

After bc_demo is downloaded

Compile with:

cd ~/flipperZero/official/
./fbt fap_bc_demo

...And/Or (Compile and) Upload with:

cd ~/flipperZero/official/
./fbt launch APPSRC=bc_demo

...Flashing will fail if the FlipperZero is in the applications menu, or running an application!

About the bc_demo code & documentation

  • Review the README.txt file for an overview of the code, and how to get started.
  • Take a look in bc_demo.c for, frankly, an abusive amount of commenting; and overkill error-handling.

The code is all M.I.T. Licensed ...take it ...use it ...butcher it ...polish it ...whatever.
...If you do anything cool with it, I'd love to see your creation :)

Footnotes

The change from Plugin -> Application

If you wish to review this repository at the last point before the FAP update, use this link

If you wish to review the (trivial) change[s] required to convert from the old "plugin" system to the new "FAP"/"Application" system, see this link ...the addition of an icon and a sub-folder are optional.

The change from ValueMutex -> FuriMutex

In March 2023 the mutex API was "broken"/superceded. Due to changes in the Speaker API (which happened (essentially) at the same time) (and the fact that I didn't really think things through properly) the update to this repository wasn't 'clean'. If you'd like to see a 'clean' update to an app that uses mutex'es, check out the patch to my WiiEC FAP