Skip to content

Commit

Permalink
add 2 new apps
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Sep 9, 2024
1 parent 1105a26 commit fff4842
Show file tree
Hide file tree
Showing 360 changed files with 80,579 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ The Flipper and its community wouldn't be as rich as it is without your contribu
| ICM42688 Air Mouse | ![GPIO Badge] | [by nminaylov](https://github.com/flipperdevices/flipperzero-good-faps/pull/83/files) | read more details in [original repo](https://github.com/flipperdevices/flipperzero-good-faps/pull/83/files) | ![None Badge] |
| WS2812B LED Tester | ![GPIO Badge] | [by jamisonderek](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/gpio/ws2812b_tester) | read more details in [original repo](https://github.com/jamisonderek/flipper-zero-tutorials/tree/main/gpio/ws2812b_tester) | ![None Badge] |
| W5500 Ethernet Tester | ![GPIO Badge] | [by karasevia](https://github.com/karasevia/finik_eth) | [with fixes by arag0re](https://github.com/arag0re/fz-eth-troubleshooter/tree/hexUiFix) read more details in original repo | ![None Badge] |
| Simultaneous UHF RFID | ![GPIO Badge] | [by haffnerriley](https://github.com/haffnerriley/Simultaneous-UHF-RFID-FlipperZero) | read more details in original repo | [![Author Badge]](https://lab.flipper.net/apps/simultaneous_rfid_reader) |
| IR Remote | ![IR Badge] | [by Hong5489](https://github.com/Hong5489/ir_remote) | improvements [by friebel](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/535) - Hold Option, RAW support [by d4ve10](https://github.com/d4ve10/ir_remote/tree/infrared_hold_option) | ![None Badge] |
| IR Intervalometer | ![IR Badge] | [by Nitepone](https://github.com/Nitepone/flipper-intervalometer) | | [![UFW Badge]](https://lab.flipper.net/apps/sony_intervalometer) |
| IR Xbox Controller | ![IR Badge] | [by gebeto](https://github.com/gebeto/flipper-xbox-controller) | | [![Author Badge]](https://lab.flipper.net/apps/xbox_controller) |
Expand Down Expand Up @@ -263,6 +264,7 @@ The Flipper and its community wouldn't be as rich as it is without your contribu
| DCF77 Clock Sppof | ![Tools Badge] | [by molodos](https://github.com/molodos/dcf77-clock-spoof) | fork of [dcf77-clock-sync](https://github.com/mdaskalov/dcf77-clock-sync) | ![None Badge] |
| Quac! Remote | ![Tools Badge] | [by rdefeo](https://github.com/rdefeo/quac) | Various fixes by @Willy-JL | [![Author Badge]](https://lab.flipper.net/apps/quac) |
| Key Copier | ![Tools Badge] | [by zinongli](https://github.com/zinongli/KeyCopier) | | ![None Badge] |
| uPython | ![Tools Badge] | [by ofabel](https://github.com/ofabel/mp-flipper) | read more details in original repo | [![Author Badge]](https://lab.flipper.net/apps/upython) |
| USB HID Autofire | ![USB Badge] | [by pbek](https://github.com/pbek/usb_hid_autofire) | | ![None Badge] |
| USB Consumer Control | ![USB Badge] | [by WithSecureLabs](https://github.com/WithSecureLabs/usb-consumer-control/tree/main) | | ![None Badge] |
| HID File Transfer | ![USB Badge] | [by Kavakuo](https://github.com/Kavakuo/HID-File-Transfer) | Get client app in [original repo](https://github.com/Kavakuo/HID-File-Transfer) | ![None Badge] |
Expand Down
10 changes: 10 additions & 0 deletions non_catalog_apps/mp_flipper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/dist/
/venv/
/flipperzero/__init__.py
.vscode
.clang-format
.clangd
.editorconfig
.env
.ufbt
__pycache__
130 changes: 130 additions & 0 deletions non_catalog_apps/mp_flipper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.3.0]

### Added

* Simple ADC support for the `flipperzero` module:
* Read raw value.
* Read voltage.
* Simple PWM support for the `flipperzero` module:
* Start a signal.
* Stop a signal.
* Check the status.
* Infrared support for the `flipperzero` module:
* Receive a signal.
* Transmit a signal.
* Check the status.
* Reset used GPIO pins upon script termination.
* Improved GPIO related functions to prevent user errors.
* Published [Python package on PyPI](https://pypi.org/project/flipperzero/) for code completion support.

### Changed

* The GPIO init function `flipperzero.gpio_init_pin` returns a boolean value.

## [1.2.0] - 2024-09-05

### Added

* Constants for all musical notes from C0 up to B8.
* Constants for minimum and maximum speaker volumes.
* Simple GPIO support for the `flipperzero` module:
* Initialize a pin.
* Read from a pin.
* Write to a pin.
* Handle interrupts.

### Fixed

* Message box alignment parameters `h` and `v` are now correctly evaluated.

## [1.1.0] - 2024-08-28

### Added

* Display splash screen upon application start.
* API documentation on [GitHub pages](https://ofabel.github.io/mp-flipper/).

## [1.0.0] - 2024-08-22

### Added

* First stable release on the [application catalog](https://github.com/flipperdevices/flipper-application-catalog).

### Changed

* Application ID is now `upython`

## [0.5.0-beta.1] - 2024-08-04

### Added

* Message dialog support.
* Update to the latest 0.104.0 firmware.

### Removed

* Disabled various Python builtins to shrink binary size.

## [0.4.0-beta.1] - 2024-04-14

### Added

* [Library](https://github.com/ofabel/mp-flipper/tree/lib) to include in the [firmware repository](https://github.com/ofabel/flipperzero-firmware).
* All generated files from the build prozess are now [part of the repository](https://github.com/ofabel/mp-flipper/tree/lib-release).
* Enabled split heap support for MicroPython:
* The runtime can allocate and free heap memory.
* Allows to start the Python process with small heap.
* Enabled scheduler support (required for interrupt handling).
* Enabled support for module `__init__` functions.
* Stabilized `flipperzero` module API:
* Canvas support has now a proper implementation.
* Interrupts from buttons are supported.

## [0.3.0-alpha.1] - 2024-04-04

### Added

* Floating point support
* Extend `flipperzero` module with support for:
* Speaker, set volume and frequency
* Canvas, very wacky implementation

## [0.2.0-alpha.1] - 2024-04-03

### Added

* Support for external imports
* Python `time` module support
* Python `random` module support
* Basic `flipperzero` module with support for:
* Vibration
* LED
* Backlight
* Some test Python scripts

## [0.1.0-alpha.1] - 2024-04-01

### Added

* Basic build setup
* Minimal working example

[Unreleased]: https://github.com/ofabel/mp-flipper/compare/v1.3.0...HEAD
[1.3.0]: https://github.com/ofabel/mp-flipper/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/ofabel/mp-flipper/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/ofabel/mp-flipper/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/ofabel/mp-flipper/compare/v0.5.0-beta.1...v1.0.0
[0.5.0-beta.1]: https://github.com/ofabel/mp-flipper/compare/v0.4.0-beta.1...v0.5.0-beta.1
[0.4.0-beta.1]: https://github.com/ofabel/mp-flipper/compare/v0.3.0-alpha.1...v0.4.0-beta.1
[0.3.0-alpha.1]: https://github.com/ofabel/mp-flipper/compare/v0.2.0-alpha.1...v0.3.0-alpha.1
[0.2.0-alpha.1]: https://github.com/ofabel/mp-flipper/compare/v0.1.0-alpha.1...v0.2.0-alpha.1
[0.1.0-alpha.1]: https://github.com/ofabel/mp-flipper/releases/tag/v0.1.0-alpha.1
22 changes: 22 additions & 0 deletions non_catalog_apps/mp_flipper/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License
===========

Copyright (c) 2024 Oliver Fabel

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.
33 changes: 33 additions & 0 deletions non_catalog_apps/mp_flipper/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.PHONY: update
update:
git submodule update --remote lib/micropython && git add lib/micropython

.PHONY: build-fap
build-fap: update
ufbt build

.PHONY: launch
launch: build-fap
ufbt launch

.PHONY: clean
clean:
ufbt -c

.PHONY: build-pages
build-pages:
rm -rf ./dist/pages ./flipperzero/__init__.py
cat ./flipperzero/_*.py > ./flipperzero/__init__.py
source venv/bin/activate && sphinx-build docs/pages dist/pages

.PHONY: publish-pages
publish-pages: build-pages
./publish.sh pages

.PHONY: build-python
build-python:
source venv/bin/activate && hatch build

.PHONY: publish-python
publish-python: build-python
source venv/bin/activate && hatch publish dist/python/*
64 changes: 64 additions & 0 deletions non_catalog_apps/mp_flipper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
![License](https://img.shields.io/github/license/ofabel/mp-flipper)
![Version](https://img.shields.io/github/v/tag/ofabel/mp-flipper)
![](https://img.shields.io/github/issues/ofabel/mp-flipper)

# MicroPython Flipper Zero

The application is now available on the official [Flipper Lab](https://lab.flipper.net/apps/upython).
For more information on how to programm your Flipper with Python, check out the [documentation](https://ofabel.github.io/mp-flipper/) on GitHub pages.

This branch contains the [FAP](https://developer.flipper.net/flipperzero/doxygen/apps_on_sd_card.html) version of the [MicroPython](https://micropython.org/) support for the famous [Flipper Zero](https://flipperzero.one/) gadget.
The results of the preceding research phase is still available in the [poc](https://github.com/ofabel/mp-flipper/tree/poc) branch.
The [lib](https://github.com/ofabel/mp-flipper/tree/lib) branch of this repository contains just the MicroPython library.
The progress of further research on what can be achieved when moving functionality to the firmware can be found in the [fork of the original firmware](https://github.com/ofabel/flipperzero-firmware/tree/ofa/micropython).

## Usage

Just place your Python files somewhere on the SD card (e.g. by using the [qFlipper](https://flipperzero.one/downloads) app).

The application just starts with an open file browser:

![](./assets/file-browser.png)

Here you can select any Python file to compile and execute from the SD card:

![](./assets/tic-tac-toe.png)

## Disclaimer

This FAP version requires about 80 kB from SRAM to start (needed for the Python runtime and compiler).
Due to memory fragmentation it's possible, that the application crashes when you start it.
If this happens, just try again (the crash doesn't harm your device).

Sadly, REPL support is only available in fhe [firmware fork](https://github.com/ofabel/flipperzero-firmware/tree/ofa/micropython) version.

## Setup and Build

This section is only relevant, if you want to build the FAP on your own.

### Requirements

* [Git](https://git-scm.com/)
* [Make](https://www.gnu.org/software/make/)
* [uFBT](https://pypi.org/project/ufbt/) available in your `PATH` (or you have to adjust the [Makefile](./Makefile))
* [Flipper Zero](https://flipperzero.one/)

### Setup

```bash
git clone --recurse-submodules [email protected]:ofabel/mp-flipper.git
```

### Build

Just open a terminal and run the Makefile targets:

```bash
make build
```

You can also build an launch the application on the attached Flipper Zero device in one command:

```bash
make launch
```
60 changes: 60 additions & 0 deletions non_catalog_apps/mp_flipper/application.fam
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
App(
appid="upython",
name="uPython",
apptype=FlipperAppType.EXTERNAL,
entry_point="upython",
stack_size=4 * 1024,
fap_category="Tools",
fap_version="1.3",
fap_description="Compile and execute MicroPython scripts",
fap_icon="icon.png",
fap_icon_assets="images",
fap_author="Oliver Fabel",
fap_file_assets="examples",
fap_weburl="https://github.com/ofabel/mp-flipper",
sources=[
"*.c*",
"!./lib/micropython",
"!./lib/micropython-port",
"!./docs/pages",
"!./flipperzero",
"!./venv",
"!./dist",
],
fap_private_libs=[
Lib(
name="micropython",
cflags=[
"-Wno-error",
"-w",
#
# required for floating point support
#
"-mcpu=cortex-m4",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
"-mthumb",
"-fsingle-precision-constant",
"-fno-math-errno",
],
cincludes=["."]
),
Lib(
name="micropython-port",
cflags=[
"-Wno-error",
"-w",
#
# required for floating point support
#
"-mcpu=cortex-m4",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
"-mthumb",
"-fsingle-precision-constant",
"-fno-math-errno",
],
cincludes=["."]
),
]
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added non_catalog_apps/mp_flipper/assets/qflipper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions non_catalog_apps/mp_flipper/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## 1.3

* Added simple ADC support: read value and voltage.
* Added simple PWM support: start, stop, check status.
* Added infrared support: receive and transmit a signal, check status.
* Added success indicator to GPIO init function.
* Reset used GPIO pins upon script termination.
* Improved GPIO related functions to prevent user errors.
* Published Python package on PyPI for code completion support.

## 1.2

* Added simple GPIO support: initialize, read, write, interrupts.
* Added constants for musical note frequencies from C0 up to B8.
* Some minor fixes in the dialog functions.

## 1.1

* Display splash screen upon application start.
* API documentation available on GitHub pages.

## 1.0

* Initial stable release.
15 changes: 15 additions & 0 deletions non_catalog_apps/mp_flipper/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# MicroPython

MicroPython is a version of the popular Python programming language, especially tailored for the hardware requirements of small microcontrollers, like the Flipper Zero.
Instead of supporting the full standard library, only a subset is implemented, carefully selected with the requirements of a microcontroller environment in mind.
But this should not limit your creativity and ability to create great applications at all.

## API

Visit the repository website on GitHub or scan the QR code on the welcome screen.

## Disclaimer

Running MicroPython is a heavy task for the Flipper.
This does sometimes lead to an _Out of Memory_ error.
**This doesn't harm your Flipper.**
Binary file added non_catalog_apps/mp_flipper/docs/file-browser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fff4842

Please sign in to comment.