Skip to content

Commit

Permalink
update demo for FAP system
Browse files Browse the repository at this point in the history
  • Loading branch information
Kali committed Sep 18, 2022
1 parent 21f2620 commit 91e06b5
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 40 deletions.
Binary file added CS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# FlipperZero_plugin_howto
# FlipperZero_plugin_howto .. aka .. FlipperZero_FAP_howto
A simple plugin for the FlipperZero written as a tutorial example [ie. excessive documentation & error handling]

If you wish to review this repository at the last point before the FAP update, use (this link)[https://github.com/csBlueChip/FlipperZero_plugin_howto/tree/21f2620035728cd04e1951c3f6a30de1cfe8a280]

# FAP Support Has Arrived! :)
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
```
mkdir -p ~/flipperZero/official/
Expand All @@ -10,11 +25,19 @@ git clone --recursive https://github.com/flipperdevices/flipperzero-firmware.gi
```
...and wait while it downloads all the required tools and performs the first build of the code.

# Install the cutting-edge firmware on your Flipper
`./fbt flash_usb_full`

`flash_usb` is used to install JUST the firmware<br/>
`flash_usb_full` also installs the "resources" (images and such)<br/>

Be aware that since the introdcution of FAP, Applications are Resources.

# After the devkit is installed
Assuming your devkit is in: `~/flipperZero/official/`<br/>
...checkout this demo with:
```
cd ~/flipperZero/official//applications
cd ~/flipperZero/official//applications_user
mkdir bc_demo
cd bc_demo
git clone https://github.com/csBlueChip/FlipperZero_plugin_howto.git ./
Expand All @@ -24,26 +47,18 @@ git clone https://github.com/csBlueChip/FlipperZero_plugin_howto.git ./
Compile with:
```
cd ~/flipperZero/official/
./fbt
./fbt firmware_bc_demo
```
...And/Or (Compile and) Flash with:
...And/Or (Compile and) Upload with:
```
cd ~/flipperZero/official/
./fbt flash_usb
./fbt launch_app APPSRC=applications/bc_demo/
```
...Flashing will fail if the FlipperZero is running an app/plugin!
...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. <br/>
...If you do anything cool with it, I'd love to see your creation :)

# Compiling the demo
You will need to add bc_demo to the system menu by editing `~/flipperZero/official//applications/meta/application.fam` in accordance with the intructions in `README.txt (Plugins) #2`<br>
...then simply use the same compile & flash command we used previously:
```
cd ~/flipperZero/official/
./fbt flash_usb
```
55 changes: 30 additions & 25 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Resources
Meta-list of cool stuff. Includes forks with country restrictions removed
https://github.com/djsime1/awesome-flipperzero
Fliiper FAP notes
https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/AppsOnSDCard.md

Local docs
You really should at least take a peek at the docs in this folder!
Expand All @@ -30,57 +32,54 @@ git clone --recursive https://github.com/flipperdevices/flipperzero-firmware.gi
# Do NOT interrupt this process! (it can't recover if a partial zip has been downloaded)
./fbt


,----------.
( Flashing )
`----------'

# qv. documentation/fbt.md
./fbt flash_usb
./fbt flash_usb_full


,---------.
( Plugins )
`---------'
,--------------.
( Applications )
`--------------'

This readme should exist in a directory called 'bc_demo'

1. Move the bc_demo directory to applications/ [**]
1. Move the bc_demo directory to applications_user/ [**]

Eg.
/path/to/FlipperZero/
+-- official/
: +-- applications/ <-- plugins etc.
: | +-- bc_demo/ <-- bc_demo has been added [**]
: | | +-- README <-- this file
: | | +-- application.fam <-- plugin ID file for OS
: | | +-- bc_demo.c <-- excessively documented plugin code
: +-- applications/ <-- system applications
: |
: +-- applications_user/ <-- user applications
: | +-- bc_demo/ <-- bc_demo has been added [**]
: | | +-- README <-- this file
: | | +-- CS.png <-- plugin menu icon (10x10 pixels)
: | | +-- application.fam <-- plugin ID file for OS
: | | +-- bc_demo.stripped <--
: | | +-- bc_demo.c <-- excessively documented plugin code
: | |
: | +-- gui/ <-- The GUI library
: | +-- gui/ <-- The GUI library
: | |
: | +-- meta/ <-- System menu config file
: | : +-- application.fam <-- ...
: | +-- meta/ <-- System menu config file
: | : +-- application.fam <-- ...
: |
: +-- documentation/ <-- Really, RTFMs, or at least skim them! Not kidding!
: +-- documentation/ <-- Really, RTFMs, or at least skim them! Not kidding!
: | +-- KeyCombo.md
: | +-- OTA.md
: | +-- fbt.md
: | :
: |
: +-- furi/ <-- Flipper API
: +-- furi/ <-- Flipper API
: : +-- core/
: :

2. Add the plugin to the menu system
2. Rebuild the application

# Get plugin's "appid"
grep appid ${FZTHIS}/applications/bc_demo/application.fam

# Add it to the menu somewhere
# ...if you can't work out how, probably best give up now :/
edit ${FZTHIS}/applications/meta/application.fam

3. Rebuild the firmware ...Sadly touching the meta/ folder triggers a rebuild of ALL appliations
./fbt
./fbt firmware_bc_demo


,---------.
Expand All @@ -91,6 +90,9 @@ The demo code is *EXTENSIVELY* documented

--> application.fam
# This holds the details required by the toolchain to compile it in (as a plugin)
# And OPTIONALLY
# The Application Category (top level directory)
# The name of the menu icon (a 10x10 Black-on-White PNG)

--> err.h
# Keep error numbers and strings tied together in a friendly way
Expand Down Expand Up @@ -206,3 +208,6 @@ The demo code is *EXTENSIVELY* documented
+ cbDraw() [7b]
<- O/S <- bc_demo
# (Re-)Draw the whole canvas

--> bc_demo.stripped
# Stripped (but not comment-free) version of bc_demo.c
4 changes: 3 additions & 1 deletion application.fam
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
App(
appid="bc_demo",
name="Bluechip Demo",
apptype=FlipperAppType.PLUGIN,
apptype=FlipperAppType.EXTERNAL,
entry_point="bc_demo",
cdefines=["APP_BC_DEMO"],
requires=[
"gui",
],
stack_size=2 * 1024,
order=20,
fap_icon="CS.png",
fap_category="Cyborg Systems",
)

0 comments on commit 91e06b5

Please sign in to comment.