Skip to content

superKoder/flipperzero_plusplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

FlipperZero++ (flipperzero_plusplus)

Object-Oriented C++ wrapper around FlipperZero's C library.

Write FlipperZero apps in modern object-oriented code, without any overhead!

Advantages

  • Objects with methods: Write popup.SetIcon({x, y}, icon) istead of popup_set_icon(&popup, x, y, icon) (but you can do both).
  • Easy memory management: Constructors and destructors do the allocation and deallocation for you.
  • Forget raw pointers: Pass by reference, rather than pointer.
  • Zero overhead: Compiles down to the exact same machine code. There is no price to pay.
  • Just works: Continue to use ufbt and its VSCode integrations, no need for another toolchain.
  • C still works too: The original C header is #included by the C++ version. So you have access to both.
  • Bug-for-bug: No added logic, so no new bugs. And all upstream updates are still updates.
  • Permissinve license: Go ahead! Use it, change it, improve it! (Please contribute your improvements?)

What is it not?

  • Complete. It is very early progress. I am going in the order of the popular, existing tutorials of the C version.
  • Well-documented. The original C library is very poorly documented, and this C++ wrapper does not (try) to fix that in any way.

How to use?

These files are in addition to the original f7_sdk that you would get when you use ufbt.

  1. Start you project with (like you normally would)
ufbt create APPID=your_unique_app_id
  1. Add FlipperZero++ as a submodule. For example:
mkdir deps
git submodule add [email protected]:superKoder/flipperzero_plusplus.git deps/flipperzero++
  1. Make a src/fz++/ symlink to the deps/flipperzero++ dependency:
ln -s deps/flipperzero++ src/fz++
  1. Include them as:
#include "fz++/gui/popup.h"
#include "fz++/gui/menu.h"
...

They will include their C counterparts themselves. So you will have access to both C and C++ versions of everything (and yes, those can interoperate!).

For the C++ versions, don't forget to use their namespaces! (e.g. gui::Menu is the C++ version, the original Menu is the C version)

Enjoy!

About

A zero-cost C++ wrapper for FlipperZero's C library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published