Skip to content

Commit

Permalink
Direct sampling mode, reading GDO0 directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Jan 9, 2023
1 parent 4e36d03 commit 6ba3702
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static void render_callback(Canvas *const canvas, void *ctx) {
case ViewFrequencySettings:
case ViewModulationSettings:
render_view_settings(canvas,app); break;
case ViewDirectSampling: render_view_direct_sampling(canvas,app); break;
case ViewLast: furi_crash(TAG " ViewLast selected"); break;
}
}
Expand Down Expand Up @@ -228,6 +229,9 @@ int32_t protoview_app_entry(void* p) {
case ViewModulationSettings:
process_input_settings(app,input);
break;
case ViewDirectSampling:
process_input_direct_sampling(app,input);
break;
case ViewLast: furi_crash(TAG " ViewLast selected"); break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions app.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ typedef enum {
ViewInfo,
ViewFrequencySettings,
ViewModulationSettings,
ViewDirectSampling,
ViewLast, /* Just a sentinel to wrap around. */
} ProtoViewCurrentView;

Expand Down Expand Up @@ -149,6 +150,8 @@ void render_view_settings(Canvas *const canvas, ProtoViewApp *app);
void process_input_settings(ProtoViewApp *app, InputEvent input);
void render_view_info(Canvas *const canvas, ProtoViewApp *app);
void process_input_info(ProtoViewApp *app, InputEvent input);
void render_view_direct_sampling(Canvas *const canvas, ProtoViewApp *app);
void process_input_direct_sampling(ProtoViewApp *app, InputEvent input);

/* ui.c */
void canvas_draw_str_with_border(Canvas* canvas, uint8_t x, uint8_t y, const char* str, Color text_color, Color border_color);
27 changes: 27 additions & 0 deletions view_direct_sampling.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Copyright (C) 2022-2023 Salvatore Sanfilippo -- All Rights Reserved
* See the LICENSE file for information about the license. */

#include "app.h"

#include <cc1101.h>

/* Read directly from the G0 CC1101 pin, and draw a black or white
* dot depending on the level. */
void render_view_direct_sampling(Canvas *const canvas, ProtoViewApp *app) {
UNUSED(app);
for (int y = 0; y < 64; y++) {
for (int x = 0; x < 128; x++) {
bool level = furi_hal_gpio_read(&gpio_cc1101_g0);
if (level) canvas_draw_dot(canvas,x,y);
}
}
canvas_set_font(canvas, FontSecondary);
canvas_draw_str_with_border(canvas,40,60,"Direct sampling",
ColorWhite,ColorBlack);
}

/* Handle input */
void process_input_direct_sampling(ProtoViewApp *app, InputEvent input) {
UNUSED(app);
UNUSED(input);
}

0 comments on commit 6ba3702

Please sign in to comment.