HAL to LL migration: GPIO, HSEM, AES (#1069)
* gpio, hsem, crypto: switch from HAL to LL/registers * Moved GPIO initialization to furi_hal * More HAL removed * All HAL modules disabled * HAL is finally removed * hal_gpio -> furi_hal_gpio, main.h removed * Bootloader build fix * RTOS config moved to freertos-glue * delay -> furi_hal_delay Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -42,11 +42,12 @@ static void subghz_chat_worker_update_rx_event_chat(void* context) {
|
||||
furi_assert(context);
|
||||
SubGhzChatWorker* instance = context;
|
||||
SubGhzChatEvent event;
|
||||
if((millis() - instance->last_time_rx_data) > SUBGHZ_CHAT_WORKER_TIMEOUT_BETWEEN_MESSAGES) {
|
||||
if((furi_hal_get_tick() - instance->last_time_rx_data) >
|
||||
SUBGHZ_CHAT_WORKER_TIMEOUT_BETWEEN_MESSAGES) {
|
||||
event.event = SubGhzChatEventNewMessage;
|
||||
osMessageQueuePut(instance->event_queue, &event, 0, osWaitForever);
|
||||
}
|
||||
instance->last_time_rx_data = millis();
|
||||
instance->last_time_rx_data = furi_hal_get_tick();
|
||||
event.event = SubGhzChatEventRXData;
|
||||
osMessageQueuePut(instance->event_queue, &event, 0, osWaitForever);
|
||||
}
|
||||
|
@@ -40,8 +40,8 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) {
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
|
||||
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);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
|
||||
furi_hal_power_suppress_charge_enter();
|
||||
|
||||
@@ -254,7 +254,7 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
|
||||
frequency = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
|
||||
furi_hal_power_suppress_charge_enter();
|
||||
|
||||
@@ -495,7 +495,7 @@ static void subghz_cli_command_chat(Cli* cli, string_t args) {
|
||||
subghz_chat,
|
||||
(uint8_t*)string_get_cstr(input),
|
||||
strlen(string_get_cstr(input)))) {
|
||||
delay(10);
|
||||
furi_hal_delay_ms(10);
|
||||
}
|
||||
|
||||
string_printf(input, "%s", string_get_cstr(name));
|
||||
@@ -547,7 +547,7 @@ static void subghz_cli_command_chat(Cli* cli, string_t args) {
|
||||
subghz_chat,
|
||||
(uint8_t*)string_get_cstr(sysmsg),
|
||||
strlen(string_get_cstr(sysmsg)));
|
||||
delay(10);
|
||||
furi_hal_delay_ms(10);
|
||||
exit = true;
|
||||
break;
|
||||
default:
|
||||
|
@@ -140,13 +140,13 @@ bool subghz_history_add_to_history(
|
||||
SubGhzProtocolDecoderBase* decoder_base = context;
|
||||
if((instance->code_last_hash_data ==
|
||||
subghz_protocol_decoder_base_get_hash_data(decoder_base)) &&
|
||||
((millis() - instance->last_update_timestamp) < 500)) {
|
||||
instance->last_update_timestamp = millis();
|
||||
((furi_hal_get_tick() - instance->last_update_timestamp) < 500)) {
|
||||
instance->last_update_timestamp = furi_hal_get_tick();
|
||||
return false;
|
||||
}
|
||||
|
||||
instance->code_last_hash_data = subghz_protocol_decoder_base_get_hash_data(decoder_base);
|
||||
instance->last_update_timestamp = millis();
|
||||
instance->last_update_timestamp = furi_hal_get_tick();
|
||||
|
||||
string_t text;
|
||||
string_init(text);
|
||||
|
@@ -62,7 +62,7 @@ void subghz_begin(SubGhz* subghz, FuriHalSubGhzPreset preset) {
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_idle();
|
||||
furi_hal_subghz_load_preset(preset);
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
subghz->txrx->txrx_state = SubGhzTxRxStateIDLE;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ uint32_t subghz_rx(SubGhz* subghz, uint32_t frequency) {
|
||||
|
||||
furi_hal_subghz_idle();
|
||||
uint32_t value = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_subghz_flush_rx();
|
||||
furi_hal_subghz_rx();
|
||||
|
||||
@@ -95,8 +95,8 @@ static bool subghz_tx(SubGhz* subghz, uint32_t frequency) {
|
||||
furi_assert(subghz->txrx->txrx_state != SubGhzTxRxStateSleep);
|
||||
furi_hal_subghz_idle();
|
||||
furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
bool ret = furi_hal_subghz_tx();
|
||||
subghz->txrx->txrx_state = SubGhzTxRxStateTx;
|
||||
return ret;
|
||||
|
@@ -113,13 +113,14 @@ bool subghz_test_carrier_input(InputEvent* event, void* context) {
|
||||
furi_hal_subghz_set_path(model->path);
|
||||
|
||||
if(model->status == SubGhzTestCarrierModelStatusRx) {
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_subghz_rx();
|
||||
} else {
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
furi_hal_gpio_init(
|
||||
&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
if(!furi_hal_subghz_tx()) {
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
subghz_test_carrier->callback(
|
||||
SubGhzTestCarrierEventOnlyRx, subghz_test_carrier->context);
|
||||
}
|
||||
@@ -138,7 +139,7 @@ void subghz_test_carrier_enter(void* context) {
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
|
||||
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
|
||||
with_view_model(
|
||||
subghz_test_carrier->view, (SubGhzTestCarrierModel * model) {
|
||||
|
@@ -140,7 +140,7 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
|
||||
if(model->status == SubGhzTestPacketModelStatusRx) {
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
} else if(model->status == SubGhzTestPacketModelStatusTx) {
|
||||
subghz_encoder_princeton_for_testing_stop(instance->encoder, millis());
|
||||
subghz_encoder_princeton_for_testing_stop(instance->encoder, furi_hal_get_tick());
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ void subghz_test_packet_exit(void* context) {
|
||||
if(model->status == SubGhzTestPacketModelStatusRx) {
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
} else if(model->status == SubGhzTestPacketModelStatusTx) {
|
||||
subghz_encoder_princeton_for_testing_stop(instance->encoder, millis());
|
||||
subghz_encoder_princeton_for_testing_stop(instance->encoder, furi_hal_get_tick());
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
}
|
||||
return true;
|
||||
|
@@ -118,7 +118,8 @@ bool subghz_test_static_input(InputEvent* event, void* context) {
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
if(instance->satus_tx == SubGhzTestStaticStatusTX) {
|
||||
FURI_LOG_I(TAG, "TX Stop");
|
||||
subghz_encoder_princeton_for_testing_stop(instance->encoder, millis());
|
||||
subghz_encoder_princeton_for_testing_stop(
|
||||
instance->encoder, furi_hal_get_tick());
|
||||
subghz_encoder_princeton_for_testing_print_log(instance->encoder);
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
notification_message(notification, &sequence_reset_red);
|
||||
@@ -141,8 +142,8 @@ void subghz_test_static_enter(void* context) {
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
|
||||
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&gpio_cc1101_g0, false);
|
||||
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
furi_hal_gpio_write(&gpio_cc1101_g0, false);
|
||||
instance->satus_tx = SubGhzTestStaticStatusIDLE;
|
||||
|
||||
with_view_model(
|
||||
|
Reference in New Issue
Block a user