diff options
Diffstat (limited to 'applications/subghz')
-rw-r--r-- | applications/subghz/subghz_cli.c | 64 | ||||
-rw-r--r-- | applications/subghz/subghz_i.h | 2 | ||||
-rw-r--r-- | applications/subghz/views/subghz_capture.c | 28 | ||||
-rw-r--r-- | applications/subghz/views/subghz_static.c | 18 | ||||
-rw-r--r-- | applications/subghz/views/subghz_test_basic.c | 38 | ||||
-rw-r--r-- | applications/subghz/views/subghz_test_packet.c | 50 |
6 files changed, 100 insertions, 100 deletions
diff --git a/applications/subghz/subghz_cli.c b/applications/subghz/subghz_cli.c index a6f4f5f3..d6197869 100644 --- a/applications/subghz/subghz_cli.c +++ b/applications/subghz/subghz_cli.c @@ -1,7 +1,7 @@ #include "subghz_cli.h" #include <furi.h> -#include <api-hal.h> +#include <furi-hal.h> #include <stream_buffer.h> #include <lib/subghz/protocols/subghz_protocol.h> @@ -31,7 +31,7 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) { cli_print_usage("subghz_tx_carrier", "<Frequency in HZ>", string_get_cstr(args)); return; } - if(!api_hal_subghz_is_frequency_valid(frequency)) { + if(!furi_hal_subghz_is_frequency_valid(frequency)) { printf( "Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n", frequency); @@ -39,14 +39,14 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) { } } - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); - frequency = api_hal_subghz_set_frequency_and_path(frequency); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); + frequency = furi_hal_subghz_set_frequency_and_path(frequency); hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); hal_gpio_write(&gpio_cc1101_g0, true); - api_hal_subghz_tx(); + furi_hal_subghz_tx(); printf("Transmitting at frequency %lu Hz\r\n", frequency); printf("Press CTRL+C to stop\r\n"); @@ -54,8 +54,8 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) { osDelay(250); } - api_hal_subghz_set_path(ApiHalSubGhzPathIsolate); - api_hal_subghz_sleep(); + furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate); + furi_hal_subghz_sleep(); } void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) { @@ -68,7 +68,7 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) { cli_print_usage("subghz_tx_carrier", "<Frequency in HZ>", string_get_cstr(args)); return; } - if(!api_hal_subghz_is_frequency_valid(frequency)) { + if(!furi_hal_subghz_is_frequency_valid(frequency)) { printf( "Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n", frequency); @@ -76,22 +76,22 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) { } } - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); - frequency = api_hal_subghz_set_frequency_and_path(frequency); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); + frequency = furi_hal_subghz_set_frequency_and_path(frequency); printf("Receiving at frequency %lu Hz\r\n", frequency); printf("Press CTRL+C to stop\r\n"); - api_hal_subghz_rx(); + furi_hal_subghz_rx(); while(!cli_cmd_interrupt_received(cli)) { osDelay(250); - printf("RSSI: %03.1fdbm\r", api_hal_subghz_get_rssi()); + printf("RSSI: %03.1fdbm\r", furi_hal_subghz_get_rssi()); fflush(stdout); } - api_hal_subghz_set_path(ApiHalSubGhzPathIsolate); - api_hal_subghz_sleep(); + furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate); + furi_hal_subghz_sleep(); } #define SUBGHZ_PT_SHORT 376 @@ -118,7 +118,7 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { string_get_cstr(args)); return; } - if(!api_hal_subghz_is_frequency_valid(frequency)) { + if(!furi_hal_subghz_is_frequency_valid(frequency)) { printf( "Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n", frequency); @@ -151,16 +151,16 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { key, repeat); - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); - frequency = api_hal_subghz_set_frequency_and_path(frequency); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); + frequency = furi_hal_subghz_set_frequency_and_path(frequency); - api_hal_subghz_start_async_tx(subghz_test_data, subghz_test_data_size, repeat); - api_hal_subghz_wait_async_tx(); - api_hal_subghz_stop_async_tx(); + furi_hal_subghz_start_async_tx(subghz_test_data, subghz_test_data_size, repeat); + furi_hal_subghz_wait_async_tx(); + furi_hal_subghz_stop_async_tx(); free(subghz_test_data); - api_hal_subghz_sleep(); + furi_hal_subghz_sleep(); } typedef struct { @@ -200,7 +200,7 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) { cli_print_usage("subghz_rx", "<Frequency in HZ>", string_get_cstr(args)); return; } - if(!api_hal_subghz_is_frequency_valid(frequency)) { + if(!furi_hal_subghz_is_frequency_valid(frequency)) { printf( "Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n", frequency); @@ -219,14 +219,14 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) { subghz_protocol_enable_dump_text(protocol, subghz_cli_command_rx_text_callback, instance); // Configure radio - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); - frequency = api_hal_subghz_set_frequency_and_path(frequency); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); + frequency = furi_hal_subghz_set_frequency_and_path(frequency); hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); // Prepare and start RX - api_hal_subghz_set_async_rx_callback(subghz_cli_command_rx_callback, instance); - api_hal_subghz_start_async_rx(); + furi_hal_subghz_set_async_rx_callback(subghz_cli_command_rx_callback, instance); + furi_hal_subghz_start_async_rx(); // Wait for packets to arrive printf("Listening at %lu. Press CTRL+C to stop\r\n", frequency); @@ -247,8 +247,8 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) { } // Shutdown radio - api_hal_subghz_stop_async_rx(); - api_hal_subghz_sleep(); + furi_hal_subghz_stop_async_rx(); + furi_hal_subghz_sleep(); printf("\r\nPackets recieved %u\r\n", instance->packet_count); diff --git a/applications/subghz/subghz_i.h b/applications/subghz/subghz_i.h index ccf41b71..b2da67b6 100644 --- a/applications/subghz/subghz_i.h +++ b/applications/subghz/subghz_i.h @@ -7,7 +7,7 @@ #include "views/subghz_static.h" #include <furi.h> -#include <api-hal.h> +#include <furi-hal.h> #include <gui/gui.h> #include <gui/view_dispatcher.h> #include <gui/modules/submenu.h> diff --git a/applications/subghz/views/subghz_capture.c b/applications/subghz/views/subghz_capture.c index 4df825b9..c8927e95 100644 --- a/applications/subghz/views/subghz_capture.c +++ b/applications/subghz/views/subghz_capture.c @@ -3,7 +3,7 @@ #include <math.h> #include <furi.h> -#include <api-hal.h> +#include <furi-hal.h> #include <input/input.h> #include <gui/elements.h> #include <notification/notification-messages.h> @@ -85,10 +85,10 @@ bool subghz_capture_input(InputEvent* event, void* context) { } if(reconfigure) { - api_hal_subghz_idle(); + furi_hal_subghz_idle(); model->real_frequency = - api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); - api_hal_subghz_rx(); + furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); + furi_hal_subghz_rx(); } return reconfigure; @@ -141,28 +141,28 @@ void subghz_capture_enter(void* context) { furi_assert(context); SubghzCapture* subghz_capture = context; - api_hal_subghz_reset(); - api_hal_subghz_idle(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); + furi_hal_subghz_reset(); + furi_hal_subghz_idle(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); with_view_model( subghz_capture->view, (SubghzCaptureModel * model) { model->frequency = subghz_frequencies_433_92; model->real_frequency = - api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); + furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); model->scene = 1; return true; }); hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); - api_hal_subghz_set_async_rx_callback(subghz_worker_rx_callback, subghz_capture->worker); - api_hal_subghz_start_async_rx(); + furi_hal_subghz_set_async_rx_callback(subghz_worker_rx_callback, subghz_capture->worker); + furi_hal_subghz_start_async_rx(); subghz_worker_start(subghz_capture->worker); - api_hal_subghz_flush_rx(); - api_hal_subghz_rx(); + furi_hal_subghz_flush_rx(); + furi_hal_subghz_rx(); } void subghz_capture_exit(void* context) { @@ -171,8 +171,8 @@ void subghz_capture_exit(void* context) { subghz_worker_stop(subghz_capture->worker); - api_hal_subghz_stop_async_rx(); - api_hal_subghz_sleep(); + furi_hal_subghz_stop_async_rx(); + furi_hal_subghz_sleep(); } uint32_t subghz_capture_back(void* context) { diff --git a/applications/subghz/views/subghz_static.c b/applications/subghz/views/subghz_static.c index ad86d458..0dd91e60 100644 --- a/applications/subghz/views/subghz_static.c +++ b/applications/subghz/views/subghz_static.c @@ -3,7 +3,7 @@ #include <math.h> #include <furi.h> -#include <api-hal.h> +#include <furi-hal.h> #include <input/input.h> #include <notification/notification-messages.h> @@ -80,10 +80,10 @@ bool subghz_static_input(InputEvent* event, void* context) { } if(reconfigure) { - api_hal_subghz_idle(); + furi_hal_subghz_idle(); model->real_frequency = - api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); - api_hal_subghz_tx(); + furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); + furi_hal_subghz_tx(); } if(event->key == InputKeyOk) { @@ -128,8 +128,8 @@ void subghz_static_enter(void* context) { furi_assert(context); SubghzStatic* subghz_static = context; - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); hal_gpio_write(&gpio_cc1101_g0, false); @@ -138,12 +138,12 @@ void subghz_static_enter(void* context) { subghz_static->view, (SubghzStaticModel * model) { model->frequency = subghz_frequencies_433_92; model->real_frequency = - api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); + furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]); model->button = 0; return true; }); - api_hal_subghz_tx(); + furi_hal_subghz_tx(); } void subghz_static_exit(void* context) { @@ -151,7 +151,7 @@ void subghz_static_exit(void* context) { // SubghzStatic* subghz_static = context; // Reinitialize IC to default state - api_hal_subghz_sleep(); + furi_hal_subghz_sleep(); } uint32_t subghz_static_back(void* context) { diff --git a/applications/subghz/views/subghz_test_basic.c b/applications/subghz/views/subghz_test_basic.c index b3107d54..1c954ad6 100644 --- a/applications/subghz/views/subghz_test_basic.c +++ b/applications/subghz/views/subghz_test_basic.c @@ -3,7 +3,7 @@ #include <math.h> #include <furi.h> -#include <api-hal.h> +#include <furi-hal.h> #include <input/input.h> struct SubghzTestBasic { @@ -19,7 +19,7 @@ typedef enum { typedef struct { uint8_t frequency; uint32_t real_frequency; - ApiHalSubGhzPath path; + FuriHalSubGhzPath path; float rssi; SubghzTestBasicModelStatus status; } SubghzTestBasicModel; @@ -43,13 +43,13 @@ void subghz_test_basic_draw(Canvas* canvas, SubghzTestBasicModel* model) { canvas_draw_str(canvas, 0, 20, buffer); // Path char* path_name = "Unknown"; - if(model->path == ApiHalSubGhzPathIsolate) { + if(model->path == FuriHalSubGhzPathIsolate) { path_name = "isolate"; - } else if(model->path == ApiHalSubGhzPath433) { + } else if(model->path == FuriHalSubGhzPath433) { path_name = "433MHz"; - } else if(model->path == ApiHalSubGhzPath315) { + } else if(model->path == FuriHalSubGhzPath315) { path_name = "315MHz"; - } else if(model->path == ApiHalSubGhzPath868) { + } else if(model->path == FuriHalSubGhzPath868) { path_name = "868MHz"; } snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name); @@ -78,7 +78,7 @@ bool subghz_test_basic_input(InputEvent* event, void* context) { with_view_model( subghz_test_basic->view, (SubghzTestBasicModel * model) { osTimerStop(subghz_test_basic->timer); - api_hal_subghz_idle(); + furi_hal_subghz_idle(); if(event->type == InputTypeShort) { if(event->key == InputKeyLeft) { @@ -88,7 +88,7 @@ bool subghz_test_basic_input(InputEvent* event, void* context) { } else if(event->key == InputKeyDown) { if(model->path > 0) model->path--; } else if(event->key == InputKeyUp) { - if(model->path < ApiHalSubGhzPath868) model->path++; + if(model->path < FuriHalSubGhzPath868) model->path++; } else if(event->key == InputKeyOk) { if(model->status == SubghzTestBasicModelStatusTx) { model->status = SubghzTestBasicModelStatusRx; @@ -98,18 +98,18 @@ bool subghz_test_basic_input(InputEvent* event, void* context) { } model->real_frequency = - api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); - api_hal_subghz_set_path(model->path); + furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); + furi_hal_subghz_set_path(model->path); } if(model->status == SubghzTestBasicModelStatusRx) { hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); - api_hal_subghz_rx(); + furi_hal_subghz_rx(); osTimerStart(subghz_test_basic->timer, 1024 / 4); } else { hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); hal_gpio_write(&gpio_cc1101_g0, true); - api_hal_subghz_tx(); + furi_hal_subghz_tx(); } return true; @@ -122,8 +122,8 @@ void subghz_test_basic_enter(void* context) { furi_assert(context); SubghzTestBasic* subghz_test_basic = context; - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); @@ -131,14 +131,14 @@ void subghz_test_basic_enter(void* context) { subghz_test_basic->view, (SubghzTestBasicModel * model) { model->frequency = subghz_frequencies_433_92; // 433 model->real_frequency = - api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); - model->path = ApiHalSubGhzPathIsolate; // isolate + furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); + model->path = FuriHalSubGhzPathIsolate; // isolate model->rssi = 0.0f; model->status = SubghzTestBasicModelStatusRx; return true; }); - api_hal_subghz_rx(); + furi_hal_subghz_rx(); osTimerStart(subghz_test_basic->timer, 1024 / 4); } @@ -150,7 +150,7 @@ void subghz_test_basic_exit(void* context) { osTimerStop(subghz_test_basic->timer); // Reinitialize IC to default state - api_hal_subghz_sleep(); + furi_hal_subghz_sleep(); } void subghz_test_basic_rssi_timer_callback(void* context) { @@ -159,7 +159,7 @@ void subghz_test_basic_rssi_timer_callback(void* context) { with_view_model( subghz_test_basic->view, (SubghzTestBasicModel * model) { - model->rssi = api_hal_subghz_get_rssi(); + model->rssi = furi_hal_subghz_get_rssi(); return true; }); } diff --git a/applications/subghz/views/subghz_test_packet.c b/applications/subghz/views/subghz_test_packet.c index 188cbea0..530585e5 100644 --- a/applications/subghz/views/subghz_test_packet.c +++ b/applications/subghz/views/subghz_test_packet.c @@ -3,7 +3,7 @@ #include <math.h> #include <furi.h> -#include <api-hal.h> +#include <furi-hal.h> #include <input/input.h> #include <toolbox/level_duration.h> #include <lib/subghz/protocols/subghz_protocol_princeton.h> @@ -32,7 +32,7 @@ typedef enum { typedef struct { uint8_t frequency; uint32_t real_frequency; - ApiHalSubGhzPath path; + FuriHalSubGhzPath path; float rssi; size_t packets; SubghzTestPacketModelStatus status; @@ -59,11 +59,11 @@ static void subghz_test_packet_rssi_timer_callback(void* context) { with_view_model( instance->view, (SubghzTestPacketModel * model) { if(model->status == SubghzTestPacketModelStatusRx) { - model->rssi = api_hal_subghz_get_rssi(); + model->rssi = furi_hal_subghz_get_rssi(); model->packets = instance->packet_rx; } else { model->packets = - SUBGHZ_TEST_PACKET_COUNT - api_hal_subghz_get_async_tx_repeat_left(); + SUBGHZ_TEST_PACKET_COUNT - furi_hal_subghz_get_async_tx_repeat_left(); } return true; }); @@ -88,13 +88,13 @@ static void subghz_test_packet_draw(Canvas* canvas, SubghzTestPacketModel* model canvas_draw_str(canvas, 0, 20, buffer); // Path char* path_name = "Unknown"; - if(model->path == ApiHalSubGhzPathIsolate) { + if(model->path == FuriHalSubGhzPathIsolate) { path_name = "isolate"; - } else if(model->path == ApiHalSubGhzPath433) { + } else if(model->path == FuriHalSubGhzPath433) { path_name = "433MHz"; - } else if(model->path == ApiHalSubGhzPath315) { + } else if(model->path == FuriHalSubGhzPath315) { path_name = "315MHz"; - } else if(model->path == ApiHalSubGhzPath868) { + } else if(model->path == FuriHalSubGhzPath868) { path_name = "868MHz"; } snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name); @@ -127,9 +127,9 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) { with_view_model( instance->view, (SubghzTestPacketModel * model) { if(model->status == SubghzTestPacketModelStatusRx) { - api_hal_subghz_stop_async_rx(); + furi_hal_subghz_stop_async_rx(); } else { - api_hal_subghz_stop_async_tx(); + furi_hal_subghz_stop_async_tx(); } if(event->type == InputTypeShort) { @@ -140,7 +140,7 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) { } else if(event->key == InputKeyDown) { if(model->path > 0) model->path--; } else if(event->key == InputKeyUp) { - if(model->path < ApiHalSubGhzPath868) model->path++; + if(model->path < FuriHalSubGhzPath868) model->path++; } else if(event->key == InputKeyOk) { if(model->status == SubghzTestPacketModelStatusTx) { model->status = SubghzTestPacketModelStatusRx; @@ -150,14 +150,14 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) { } model->real_frequency = - api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); - api_hal_subghz_set_path(model->path); + furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); + furi_hal_subghz_set_path(model->path); } if(model->status == SubghzTestPacketModelStatusRx) { - api_hal_subghz_start_async_rx(); + furi_hal_subghz_start_async_rx(); } else { - api_hal_subghz_start_async_tx( + furi_hal_subghz_start_async_tx( instance->tx_buffer, instance->tx_buffer_size, SUBGHZ_TEST_PACKET_COUNT); } @@ -192,22 +192,22 @@ void subghz_test_packet_enter(void* context) { instance->tx_buffer[pos++] = SUBGHZ_PT_SHORT; instance->tx_buffer[pos++] = SUBGHZ_PT_SHORT + SUBGHZ_PT_GUARD; - api_hal_subghz_reset(); - api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync); - api_hal_subghz_set_async_rx_callback(subghz_test_packet_rx_callback, instance); + furi_hal_subghz_reset(); + furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync); + furi_hal_subghz_set_async_rx_callback(subghz_test_packet_rx_callback, instance); with_view_model( instance->view, (SubghzTestPacketModel * model) { model->frequency = subghz_frequencies_433_92; model->real_frequency = - api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); - model->path = ApiHalSubGhzPathIsolate; // isolate + furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]); + model->path = FuriHalSubGhzPathIsolate; // isolate model->rssi = 0.0f; model->status = SubghzTestPacketModelStatusRx; return true; }); - api_hal_subghz_start_async_rx(); + furi_hal_subghz_start_async_rx(); osTimerStart(instance->timer, 1024 / 4); } @@ -222,14 +222,14 @@ void subghz_test_packet_exit(void* context) { with_view_model( instance->view, (SubghzTestPacketModel * model) { if(model->status == SubghzTestPacketModelStatusRx) { - api_hal_subghz_stop_async_rx(); + furi_hal_subghz_stop_async_rx(); } else { - api_hal_subghz_stop_async_tx(); + furi_hal_subghz_stop_async_tx(); } return true; }); - api_hal_subghz_set_async_rx_callback(NULL, NULL); - api_hal_subghz_sleep(); + furi_hal_subghz_set_async_rx_callback(NULL, NULL); + furi_hal_subghz_sleep(); } uint32_t subghz_test_packet_back(void* context) { |