Skip to content

Commit

Permalink
Squashed 'applications/external/' changes from e86c037534..08ea67fc84
Browse files Browse the repository at this point in the history
08ea67fc84 FBT doesn't like shared plugin names?
ad684b5833 Merge gps_nmea from https://github.com/ezod/flipperzero-gps
0b67924db8 Merge magspoof from https://github.com/zacharyweiss/magspoof_flipper
db9661ae05 Picopass: Fix plugin loading
91483ab Upd app.fam, fix cross-FW icon compatibility
fa924248fe Format
7ba6bade84 Add picopass/plugin from https://gitlab.com/bettse/flipper-wiegand-plugin
893da4171b Picopass: Plugin as subtree
f2542d903f Merge picopass from https://github.com/flipperdevices/flipperzero-good-faps
879465b5a3 Merge magspoof from https://github.com/zacharyweiss/magspoof_flipper
ab15432 Refactor track autoselect
51179f0 Force-allow UART MSR setting
beada60 Merge branch 'main' of https://github.com/zacharyweiss/magspoof_flipper
f0cbf0d Remove unused DialogEx
3945d00 Update issue templates
6415944 Bump ver
6f05f69 Merge pull request #10 from zacharyweiss/settings
ec38afd Invalid pin config logic & dialog
d3dc37b Use settings pins in emulation
ae5ca16 Prelim state save/load, refactoring
0acc57d Pin settings menu
3ad981c Fix filename not displayed
011a9b9 Direct file load testing, minor UART refactor
facc698 Update README.md
472d08b Refactor name
27908ff2c9 picopass: Add wiegand parsing plugin (#205)
12808bd FW-specific macros, debug-locked items, reorder config
bc8b69e Update module compatibility list.
d14c2a7 Merge pull request #26 from haisenteck/patch-1
76d832f Fix missing brace.
38f6f63 Fix undeclared identifier.
6bc5c3d Apply all suggestions from code review.
f66db0e Update gps_uart.h
b98c1c5 Update gps_uart.c
20898f1 Update gps.c
967c911 Update README.md

git-subtree-dir: applications/external
git-subtree-split: 08ea67fc84e79ee39a2e0af08a174c50249bab6d
  • Loading branch information
RogueMaster committed Apr 30, 2024
1 parent c1e6f51 commit a855bdc
Show file tree
Hide file tree
Showing 36 changed files with 1,012 additions and 204 deletions.
54 changes: 38 additions & 16 deletions gps_nmea/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
# GPS for Flipper Zero

A simple Flipper Zero application for NMEA 0183 serial GPS modules, such as the
- Adafruit Ultimate GPS Breakout.
[![FAP Build](https://github.com/ezod/flipperzero-gps/actions/workflows/build.yml/badge.svg)](https://github.com/ezod/flipperzero-gps/actions/workflows/build.yml)

Heavy lifting (NMEA parsing) provided by minmea.
A simple Flipper Zero application for NMEA 0183 serial GPS modules.

![ui](ui.png)

Heavy lifting (NMEA parsing) provided by [minmea].

## Installation

1. Navigate to the [FAP Build](https://github.com/ezod/flipperzero-gps/actions/workflows/build.yml)
GitHub action workflow, and select the most recent run.
2. The FAP is built for both the `dev` and `release` channels of the official
firmware. Download the artifact corresponding to your firmware version.
3. Extract `gps_nmea.fap` from the ZIP file to `apps/GPIO` on your Flipper
Zero SD card.

## Usage

This is a single-screen app, and a few interactions are provided via the
hardware buttons:

- Long press the up button to change the **baud rate**. The default baud rate
is 9600, but 19200, 38400, 57600, and 115200 baud are also supported.
is 9600, but 4800, 19200, 38400, 57600, and 115200 baud are also supported.
- Long press the right button to change **speed units** from knots to
kilometers per hour.
- Press the OK button to set the **backlight** to always on mode. Press it
Expand All @@ -23,14 +35,15 @@ hardware buttons:
Connect the GPS module to power and the USART using GPIO pins 9 (3.3V), 11
(GND), 13 (TX), and 14 (RX), as appropriate.

![wiring](wiring.png)

See the tutorial video - https://www.youtube.com/watch?v=5vSGFzEBp-k from
Lab401 by RocketGod - https://github.com/RocketGod-git for a visual guide to
See the [tutorial video](https://www.youtube.com/watch?v=5vSGFzEBp-k) from
Lab401 by [RocketGod](https://github.com/RocketGod-git) for a visual guide to
the hardware setup.

## Confirmed Compatible Modules
### Confirmed Compatible Modules

* Adafruit Ultimate GPS Breakout
* [Adafruit Ultimate GPS Breakout]
* ATGM336H
* Beitian BN-180
* Beitian BN-220
Expand All @@ -42,17 +55,26 @@ the hardware setup.
* Beitian BE-280
* Beitian BN-280ZF
* Beitian BN-357ZF
* Fastrax UP500
* [mRo GPS u-Blox Neo-M8N]
* Royaltek RBT-2100LP
* u-blox NEO-6M
* u-blox NEO-7M
* Uputronics u-blox MAX-M8C Pico
* [u-Blox NEO-6M]
* [u-Blox NEO-7M]
* [Uputronics u-blox MAX-M8C Pico]

If you have verified this application working with a module not listed here,
please submit a PR adding it to the list.

## Links
## Building

This application can be compiled using [uFBT]. Run `ufbt` in the root directory
of the repository.

Original repo link - https://github.com/ezod/flipperzero-gps
Adafruit Ultimate GPS Breakout: https://www.adafruit.com/product/746
minmea: https://github.com/kosma/minmea
u-blox NEO-6M: https://www.u-blox.com/en/product/neo-6-series
[Adafruit Ultimate GPS Breakout]: https://www.adafruit.com/product/746
[minmea]: https://github.com/kosma/minmea
[mRo GPS u-Blox Neo-M8N]: https://store.mrobotics.io/product-p/m10034-solo.htm
[qFlipper]: https://flipperzero.one/update
[u-Blox NEO-6M]: https://www.u-blox.com/en/product/neo-6-series
[u-Blox NEO-7M]: https://www.u-blox.com/en/product/neo-7-series
[uFBT]: https://github.com/flipperdevices/flipperzero-ufbt
[Uputronics u-blox MAX-M8C Pico]: https://store.uputronics.com/index.php?route=product/product&product_id=72
11 changes: 5 additions & 6 deletions gps_nmea/gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "constants.h"

#include <furi.h>
#include <furi_hal_power.h>
#include <gui/gui.h>
#include <string.h>
#include <expansion/expansion.h>
Expand Down Expand Up @@ -38,7 +39,7 @@ static void render_callback(Canvas* const canvas, void* context) {
32,
AlignCenter,
AlignBottom,
gps_uart->backlight_enabled ? "Backlight enabled" : "Backlight disabled");
gps_uart->backlight_on ? "Backlight enabled" : "Backlight disabled");
break;
case CHANGE_DEEPSLEEP:
canvas_set_font(canvas, FontPrimary);
Expand Down Expand Up @@ -182,16 +183,16 @@ int32_t gps_app(void* p) {
processing = false;
break;
case InputKeyOk:
if(!gps_uart->backlight_enabled) {
if(!gps_uart->backlight_on) {
notification_message_block(
gps_uart->notifications, &sequence_display_backlight_enforce_on);
gps_uart->backlight_enabled = true;
gps_uart->backlight_on = true;
} else {
notification_message_block(
gps_uart->notifications, &sequence_display_backlight_enforce_auto);
notification_message(
gps_uart->notifications, &sequence_display_backlight_off);
gps_uart->backlight_enabled = false;
gps_uart->backlight_on = false;
}

gps_uart->view_state = CHANGE_BACKLIGHT;
Expand All @@ -217,7 +218,6 @@ int32_t gps_app(void* p) {

gps_uart_init_thread(gps_uart);
gps_uart->view_state = CHANGE_BAUDRATE;

furi_mutex_release(gps_uart->mutex);
view_port_update(view_port);
furi_delay_ms(1000);
Expand Down Expand Up @@ -259,7 +259,6 @@ int32_t gps_app(void* p) {
}
}
}

if(gps_uart->view_state == NORMAL) {
furi_mutex_release(gps_uart->mutex);
view_port_update(view_port);
Expand Down
11 changes: 7 additions & 4 deletions gps_nmea/gps_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ typedef enum {
#define WORKER_ALL_RX_EVENTS (WorkerEvtStop | WorkerEvtRxDone)

static void
gps_uart_on_irq_cb(FuriHalSerialHandle* handle, FuriHalSerialRxEvent event, void* context) {
gps_uart_on_irq_cb(FuriHalSerialHandle* handle, FuriHalSerialRxEvent ev, void* context) {
GpsUart* gps_uart = (GpsUart*)context;

if(event == FuriHalSerialRxEventData) {
if(ev == FuriHalSerialRxEventData) {
uint8_t data = furi_hal_serial_async_rx(handle);
furi_stream_buffer_send(gps_uart->rx_stream, &data, 1, 0);
furi_thread_flags_set(furi_thread_get_id(gps_uart->thread), WorkerEvtRxDone);
}
}

static void gps_uart_serial_init(GpsUart* gps_uart) {
furi_assert(!gps_uart->serial_handle);

gps_uart->serial_handle = furi_hal_serial_control_acquire(UART_CH);
furi_check(gps_uart->serial_handle);
furi_hal_serial_init(gps_uart->serial_handle, gps_uart->baudrate);
Expand All @@ -32,10 +34,11 @@ static void gps_uart_serial_init(GpsUart* gps_uart) {
}

static void gps_uart_serial_deinit(GpsUart* gps_uart) {
UNUSED(gps_uart);
furi_assert(gps_uart->serial_handle);
furi_hal_serial_async_rx_stop(gps_uart->serial_handle);
furi_hal_serial_deinit(gps_uart->serial_handle);
furi_hal_serial_control_release(gps_uart->serial_handle);
gps_uart->serial_handle = NULL;
}

static void gps_uart_parse_nmea(GpsUart* gps_uart, char* line) {
Expand Down Expand Up @@ -209,8 +212,8 @@ GpsUart* gps_uart_enable() {
gps_uart->notifications = furi_record_open(RECORD_NOTIFICATION);

gps_uart->baudrate = gps_baudrates[current_gps_baudrate];
gps_uart->backlight_on = false;
gps_uart->speed_units = KNOTS;
gps_uart->backlight_enabled = false;
gps_uart->deep_sleep_enabled = false;
gps_uart->view_state = NORMAL;

Expand Down
8 changes: 4 additions & 4 deletions gps_nmea/gps_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

#include <momentum/momentum.h>

#define UART_CH (momentum_settings.uart_nmea_channel)

#define RX_BUF_SIZE 1024
#define UART_CH (momentum_settings.uart_nmea_channel)

static const int gps_baudrates[6] = {4800, 9600, 19200, 38400, 57600, 115200};
static int current_gps_baudrate = 1;
Expand Down Expand Up @@ -42,15 +41,16 @@ typedef struct {
FuriThread* thread;
FuriStreamBuffer* rx_stream;
uint8_t rx_buf[RX_BUF_SIZE];
FuriHalSerialHandle* serial_handle;

NotificationApp* notifications;
uint32_t baudrate;
bool backlight_enabled;
bool backlight_on;
bool deep_sleep_enabled;
SpeedUnit speed_units;
ViewState view_state;

FuriHalSerialHandle* serial_handle;

GpsStatus status;
} GpsUart;

Expand Down
30 changes: 30 additions & 0 deletions magspoof/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Select '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Versions & Hardware**
- Firmware: [e.g. mntm-001, unlshd-072 , official 0.100.3]
- MagSpoof: [e.g. Version 0.05, or commit {HASH}]
- GPIO Module: [e.g. Rabbit-Labs Multi Pass]
- Magstripe Reader: [e.g. MSR-90]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions magspoof/.github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 1 addition & 1 deletion magspoof/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# magspoof_flipper
WIP of MagSpoof for the Flipper Zero. Basic TX of saved files confirmed working against an MSR90 with an external H-bridge module mirroring Samy Kamkar's design. Sample files with test data are included in `assets` for anyone wishing to experiment.
WIP of MagSpoof for the Flipper Zero. Basic TX of saved files confirmed working against an MSR90 with an external H-bridge module mirroring Samy Kamkar's design. Sample files are included in `resources`.

RFID coil output weaker; able to be picked up/detected by more compact mag readers such as Square, but yet to have success with it being decoded/parsed properly. Additional investigation was made into alternate internal TX options (CC1101, ST25R3916, piezo); tentatively, RFID coil + speaker (`LF + P` config setting) results in the strongest internal TX tested to date but still weaker than a dedicated external module or an actual card swipe (and sounds like a dial-up modem from hell). For information on the state of internal TX &/or misc TODOs, known bugs, etc, confer `NOTES.md`.

Expand Down
4 changes: 2 additions & 2 deletions magspoof/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ App(
fap_category="GPIO",
fap_icon_assets="icons",
fap_icon_assets_symbol="mag",
fap_version=(0, 5), # major, minor
fap_description="WIP MagSpoof port using the RFID subsystem",
fap_version=(0, 7), # major, minor
fap_description="Enables wireless transmission of magstripe data",
fap_author="Zachary Weiss",
fap_weburl="https://github.com/zacharyweiss/magspoof_flipper",
)
Loading

0 comments on commit a855bdc

Please sign in to comment.