Skip to content

Commit

Permalink
Squashed 'gpio_reader_b/' changes from 6134c07..c245ee9
Browse files Browse the repository at this point in the history
c245ee9 move and cli bridge
REVERT: 6134c07 Merge pull request #3 from garsaud/patch-1
REVERT: cfd72e9 Rotate ArrowUp icons instead of using now-defunct ArrowDown
REVERT: 614f794 Add install instructions
REVERT: 9491eb0 Add image to readme
REVERT: 740fe23 Add the whole app
REVERT: 15a4a33 Update README.md
REVERT: c1cc62a Initial commit

git-subtree-dir: gpio_reader_b
git-subtree-split: c245ee9
  • Loading branch information
Willy-JL committed Nov 12, 2023
1 parent 6134c07 commit b0eb5f6
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 27 deletions.
8 changes: 4 additions & 4 deletions application.fam
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
App(
appid="gpioreader",
name="GPIO Reader",
appid="gpioreader2",
name="[GPIO] Input Reader 2",
apptype=FlipperAppType.EXTERNAL,
entry_point="gpio_app",
cdefines=["APP_GPIOREADER"],
requires=["gui"],
stack_size=1 * 1024,
order=50,
fap_libs=["assets"],
fap_category="GPIO",
fap_icon="icon.png",
fap_icon_assets="icons",
)
2 changes: 1 addition & 1 deletion gpio_app_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "views/gpio_test.h"
#include "views/gpio_reader.h"
#include "views/gpio_usb_uart.h"
#include <assets_icons.h>
#include <gpioreader2_icons.h>

struct GpioApp {
Gui* gui;
Expand Down
2 changes: 1 addition & 1 deletion gpio_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void gpio_item_configure_pin(uint8_t index, GpioMode mode, GpioPull pull) {

void gpio_item_configure_all_pins(GpioMode mode) {
GpioPull pull = GpioPullNo;
if(mode == GpioModeInput){
if(mode == GpioModeInput) {
pull = GpioPullDown;
}
for(uint8_t i = 0; i < GPIO_ITEM_COUNT; i++) {
Expand Down
Binary file added icon.png
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 icons/ActiveConnection_50x64.png
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 icons/ArrowUpEmpty_14x15.png
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 icons/ArrowUpFilled_14x15.png
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 img/1.png
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 img/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions scenes/gpio_scene_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void gpio_scene_start_on_enter(void* context) {
variable_item_list_add(var_item_list, "USB-UART Bridge", 0, NULL, NULL);

variable_item_list_add(var_item_list, "GPIO Manual Control", 0, NULL, NULL);

variable_item_list_add(var_item_list, "GPIO Manual Read", 0, NULL, NULL);

item = variable_item_list_add(
Expand Down Expand Up @@ -97,7 +97,7 @@ bool gpio_scene_start_on_event(void* context, SceneManagerEvent event) {
} else if(event.event == GpioStartEventUsbUart) {
scene_manager_set_scene_state(app->scene_manager, GpioSceneStart, GpioItemUsbUart);
if(!furi_hal_usb_is_locked()) {
DOLPHIN_DEED(DolphinDeedGpioUartBridge);
dolphin_deed(DolphinDeedGpioUartBridge);
scene_manager_next_scene(app->scene_manager, GpioSceneUsbUart);
} else {
scene_manager_next_scene(app->scene_manager, GpioSceneUsbUartCloseRpc);
Expand Down
32 changes: 14 additions & 18 deletions views/gpio_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,25 @@ static void gpio_reader_draw_callback(Canvas* canvas, void* _model) {
canvas_set_font(canvas, FontSecondary);
elements_multiline_text_aligned(
canvas, 64, 16, AlignCenter, AlignTop, "A7 A6 A4 B3 B2 C3 C1 C0");
elements_multiline_text_aligned(
canvas, 64, 40, AlignCenter, AlignTop, "Pull Up");
elements_multiline_text_aligned(canvas, 64, 40, AlignCenter, AlignTop, "Pull Up");
int charOffset = 10;
for(uint8_t i = 0; i < GPIO_ITEM_COUNT; i++) {
bool high = gpio_item_get_pin(i);
if(high) {
elements_multiline_text_aligned(
canvas, charOffset, 25, AlignCenter, AlignTop, "1");
elements_multiline_text_aligned(canvas, charOffset, 25, AlignCenter, AlignTop, "1");
} else {
elements_multiline_text_aligned(
canvas, charOffset, 25, AlignCenter, AlignTop, "0");
elements_multiline_text_aligned(canvas, charOffset, 25, AlignCenter, AlignTop, "0");
}

if(model->pullUp[i]) {
elements_multiline_text_aligned(
canvas, charOffset, 50, AlignCenter, AlignTop, "1");
elements_multiline_text_aligned(canvas, charOffset, 50, AlignCenter, AlignTop, "1");
} else {
elements_multiline_text_aligned(
canvas, charOffset, 50, AlignCenter, AlignTop, "0");
elements_multiline_text_aligned(canvas, charOffset, 50, AlignCenter, AlignTop, "0");
}
if(i == model->pin_idx) {
elements_multiline_text_aligned(
canvas, charOffset, 53, AlignCenter, AlignTop, "_");
elements_multiline_text_aligned(canvas, charOffset, 53, AlignCenter, AlignTop, "_");
}


charOffset += 16;
}
//~ free(charOffset);
Expand Down Expand Up @@ -93,7 +86,7 @@ static bool gpio_reader_process_right(GpioReader* gpio_reader) {
gpio_reader->view,
GpioReaderModel * model,
{
if(model->pin_idx < GPIO_ITEM_COUNT-1) {
if(model->pin_idx < GPIO_ITEM_COUNT - 1) {
model->pin_idx++;
}
},
Expand All @@ -109,11 +102,11 @@ static bool gpio_reader_process_ok(GpioReader* gpio_reader, InputEvent* event) {
GpioReaderModel * model,
{
if(event->type == InputTypePress) {
if(model->pullUp[model->pin_idx]){
if(model->pullUp[model->pin_idx]) {
gpio_item_configure_pin(model->pin_idx, GpioModeInput, GpioPullDown);
model->pullUp[model->pin_idx] = 0;
consumed = true;
}else{
} else {
gpio_item_configure_pin(model->pin_idx, GpioModeInput, GpioPullUp);
model->pullUp[model->pin_idx] = 1;
consumed = true;
Expand Down Expand Up @@ -149,7 +142,10 @@ View* gpio_reader_get_view(GpioReader* gpio_reader) {
return gpio_reader->view;
}

void gpio_reader_set_ok_callback(GpioReader* gpio_reader, GpioReaderOkCallback callback, void* context) {
void gpio_reader_set_ok_callback(
GpioReader* gpio_reader,
GpioReaderOkCallback callback,
void* context) {
furi_assert(gpio_reader);
furi_assert(callback);
with_view_model(
Expand Down
5 changes: 4 additions & 1 deletion views/gpio_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ void gpio_reader_free(GpioReader* gpio_reader);

View* gpio_reader_get_view(GpioReader* gpio_reader);

void gpio_reader_set_ok_callback(GpioReader* gpio_reader, GpioReaderOkCallback callback, void* context);
void gpio_reader_set_ok_callback(
GpioReader* gpio_reader,
GpioReaderOkCallback callback,
void* context);

0 comments on commit b0eb5f6

Please sign in to comment.