diff --git a/app.c b/app.c index 7df8efec439..d84b8b2c0ee 100644 --- a/app.c +++ b/app.c @@ -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; } } @@ -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; } } diff --git a/app.h b/app.h index 38e90416e63..c017dc3a552 100644 --- a/app.h +++ b/app.h @@ -43,6 +43,7 @@ typedef enum { ViewInfo, ViewFrequencySettings, ViewModulationSettings, + ViewDirectSampling, ViewLast, /* Just a sentinel to wrap around. */ } ProtoViewCurrentView; @@ -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); diff --git a/view_direct_sampling.c b/view_direct_sampling.c new file mode 100644 index 00000000000..6e7f5b911d4 --- /dev/null +++ b/view_direct_sampling.c @@ -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 + +/* 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); +}