lisp3r / playing-with-flipper-zero

notes on writing applications for flipper zero

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coding for Flipper Zero 🐬

A bunch of notes on writing applications for Flipper Zero.

How to build an app

  1. Install the dev firmware version on your Flipper with qFlipper or from the source code. To be honest, I don't know if this is needed or not, but it saves me from the "API mismatch" error.

  2. Clone and build the Flipper Zero firmware:

    $ mkdir -p ~/flipperZero/official/
    $ cd ~/flipperZero/official/
    $ git clone --recursive https://github.com/flipperdevices/flipperzero-firmware.git ./
    $ ./fbt
    
  3. Move your app's code into ~/flipperZero/official/applications_user folder:

    $ ~/flipperZero/official/flipperzero-firmware  tree applications_user
    applications_user
    β”œβ”€β”€ simple_app_1
    β”‚   β”œβ”€β”€ application.fam
    β”‚   β”œβ”€β”€ simple_app_1.c
    β”‚   └── CS.png
    β”œβ”€β”€ ...
    ...
  4. Build your app:

    $ cd ~/flipperZero/official/
    
    # build
    $ ./fbt fap_<appid>
    
    # or build and install and launch
    $ ./fbt launch_app APPSRC=<appid>

Debug

  • FURI_LOG_D(TAG, MSG) - debug
  • FURI_LOG_T(TAG, MSG) - trace
  • FURI_LOG_I(TAG, MSG) - info
  • FURI_LOG_E(TAG, MSG) - error
  • FURI_LOG_W(TAG, MSG) - warning

Example: FURI_LOG_I("SNAKE", "Score is %d", score)

To get the debug output you need to open Flipper Zero Command Line Interface:

$ screen /dev/serial/by-id/usb-Flipper_Devices_Inc._Flipper_Unfp0ur_flip_Unfp0ur-if00
...
>: log
Press CTRL+C to stop...

# To end the session, use ctl+a then ctl+d to detach.

$ screen -list
$ screen -X -S <sess name> quit  # lol don't blame me

Code

Path to the Apps Assets folder will be /ext/apps_assets/hello_world

Simple app

#include <furi.h>

// Define log tag
#define TAG "app_name_or_smth"

...

// Application entry point
int32_t hello_world(void* p) {
    // Mark argument as unused
    UNUSED(p);

    ...
    return 0;
}

Studying

Resourses

About

notes on writing applications for flipper zero


Languages

Language:C 100.0%