Rename api-hal to furi-hal (#629)
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
});
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user