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:
Nikolay Minaylov
2022-03-30 18:23:40 +03:00
committed by GitHub
parent 648d8aaa54
commit 2f3ea9494e
93 changed files with 921 additions and 1270 deletions
+8 -8
View File
@@ -55,19 +55,19 @@ void WIEGAND::begin() {
_wiegandType = 0;
_bitCount = 0;
hal_gpio_init_simple(pinD0, GpioModeInterruptFall); // Set D0 pin as input
hal_gpio_init_simple(pinD1, GpioModeInterruptFall); // Set D1 pin as input
furi_hal_gpio_init_simple(pinD0, GpioModeInterruptFall); // Set D0 pin as input
furi_hal_gpio_init_simple(pinD1, GpioModeInterruptFall); // Set D1 pin as input
hal_gpio_add_int_callback(pinD0, input_isr_d0, this);
hal_gpio_add_int_callback(pinD1, input_isr_d1, this);
furi_hal_gpio_add_int_callback(pinD0, input_isr_d0, this);
furi_hal_gpio_add_int_callback(pinD1, input_isr_d1, this);
}
void WIEGAND::end() {
hal_gpio_remove_int_callback(pinD0);
hal_gpio_remove_int_callback(pinD1);
furi_hal_gpio_remove_int_callback(pinD0);
furi_hal_gpio_remove_int_callback(pinD1);
hal_gpio_init_simple(pinD0, GpioModeAnalog);
hal_gpio_init_simple(pinD1, GpioModeAnalog);
furi_hal_gpio_init_simple(pinD0, GpioModeAnalog);
furi_hal_gpio_init_simple(pinD1, GpioModeAnalog);
}
void WIEGAND::ReadD0() {
@@ -155,7 +155,7 @@ void desktop_scene_pin_input_on_exit(void* context) {
desktop->scene_manager, DesktopScenePinInput);
xTimerStop(state->timer, portMAX_DELAY);
while(xTimerIsTimerActive(state->timer)) {
delay(1);
furi_hal_delay_ms(1);
}
xTimerDelete(state->timer, portMAX_DELAY);
free(state);
@@ -214,7 +214,7 @@ void desktop_view_pin_input_free(DesktopViewPinInput* pin_input) {
xTimerStop(pin_input->timer, portMAX_DELAY);
while(xTimerIsTimerActive(pin_input->timer)) {
delay(1);
furi_hal_delay_ms(1);
}
xTimerDelete(pin_input->timer, portMAX_DELAY);
+3 -3
View File
@@ -20,8 +20,8 @@ static const GpioItem gpio_item[GPIO_ITEM_COUNT] = {
void gpio_item_configure_pin(uint8_t index, GpioMode mode) {
furi_assert(index < GPIO_ITEM_COUNT);
hal_gpio_write(gpio_item[index].pin, false);
hal_gpio_init(gpio_item[index].pin, mode, GpioPullNo, GpioSpeedVeryHigh);
furi_hal_gpio_write(gpio_item[index].pin, false);
furi_hal_gpio_init(gpio_item[index].pin, mode, GpioPullNo, GpioSpeedVeryHigh);
}
void gpio_item_configure_all_pins(GpioMode mode) {
@@ -32,7 +32,7 @@ void gpio_item_configure_all_pins(GpioMode mode) {
void gpio_item_set_pin(uint8_t index, bool level) {
furi_assert(index < GPIO_ITEM_COUNT);
hal_gpio_write(gpio_item[index].pin, level);
furi_hal_gpio_write(gpio_item[index].pin, level);
}
void gpio_item_set_all_pins(bool level) {
+12 -10
View File
@@ -134,8 +134,8 @@ static void usb_uart_update_ctrl_lines(UsbUartBridge* usb_uart) {
furi_assert((usb_uart->cfg.flow_pins - 1) < (sizeof(flow_pins) / sizeof(flow_pins[0])));
uint8_t state = furi_hal_cdc_get_ctrl_line_state(usb_uart->cfg.vcp_ch);
hal_gpio_write(flow_pins[usb_uart->cfg.flow_pins - 1][0], !(state & USB_CDC_BIT_RTS));
hal_gpio_write(flow_pins[usb_uart->cfg.flow_pins - 1][1], !(state & USB_CDC_BIT_DTR));
furi_hal_gpio_write(flow_pins[usb_uart->cfg.flow_pins - 1][0], !(state & USB_CDC_BIT_RTS));
furi_hal_gpio_write(flow_pins[usb_uart->cfg.flow_pins - 1][1], !(state & USB_CDC_BIT_DTR));
}
}
@@ -161,8 +161,10 @@ static int32_t usb_uart_worker(void* context) {
usb_uart_set_baudrate(usb_uart, usb_uart->cfg.baudrate);
if(usb_uart->cfg.flow_pins != 0) {
furi_assert((usb_uart->cfg.flow_pins - 1) < (sizeof(flow_pins) / sizeof(flow_pins[0])));
hal_gpio_init_simple(flow_pins[usb_uart->cfg.flow_pins - 1][0], GpioModeOutputPushPull);
hal_gpio_init_simple(flow_pins[usb_uart->cfg.flow_pins - 1][1], GpioModeOutputPushPull);
furi_hal_gpio_init_simple(
flow_pins[usb_uart->cfg.flow_pins - 1][0], GpioModeOutputPushPull);
furi_hal_gpio_init_simple(
flow_pins[usb_uart->cfg.flow_pins - 1][1], GpioModeOutputPushPull);
usb_uart_update_ctrl_lines(usb_uart);
}
@@ -219,18 +221,18 @@ static int32_t usb_uart_worker(void* context) {
}
if(usb_uart->cfg.flow_pins != usb_uart->cfg_new.flow_pins) {
if(usb_uart->cfg.flow_pins != 0) {
hal_gpio_init_simple(
furi_hal_gpio_init_simple(
flow_pins[usb_uart->cfg.flow_pins - 1][0], GpioModeAnalog);
hal_gpio_init_simple(
furi_hal_gpio_init_simple(
flow_pins[usb_uart->cfg.flow_pins - 1][1], GpioModeAnalog);
}
if(usb_uart->cfg_new.flow_pins != 0) {
furi_assert(
(usb_uart->cfg_new.flow_pins - 1) <
(sizeof(flow_pins) / sizeof(flow_pins[0])));
hal_gpio_init_simple(
furi_hal_gpio_init_simple(
flow_pins[usb_uart->cfg_new.flow_pins - 1][0], GpioModeOutputPushPull);
hal_gpio_init_simple(
furi_hal_gpio_init_simple(
flow_pins[usb_uart->cfg_new.flow_pins - 1][1], GpioModeOutputPushPull);
}
usb_uart->cfg.flow_pins = usb_uart->cfg_new.flow_pins;
@@ -251,8 +253,8 @@ static int32_t usb_uart_worker(void* context) {
furi_hal_usb_unlock();
furi_hal_usb_set_config(usb_mode_prev, NULL);
if(usb_uart->cfg.flow_pins != 0) {
hal_gpio_init_simple(flow_pins[usb_uart->cfg.flow_pins - 1][0], GpioModeAnalog);
hal_gpio_init_simple(flow_pins[usb_uart->cfg.flow_pins - 1][1], GpioModeAnalog);
furi_hal_gpio_init_simple(flow_pins[usb_uart->cfg.flow_pins - 1][0], GpioModeAnalog);
furi_hal_gpio_init_simple(flow_pins[usb_uart->cfg.flow_pins - 1][1], GpioModeAnalog);
}
osThreadFlagsSet(furi_thread_get_thread_id(usb_uart->tx_thread), WorkerEvtTxStop);
+2 -2
View File
@@ -223,7 +223,7 @@ void ibutton_cli_emulate(Cli* cli, string_t args) {
ibutton_worker_emulate_start(worker, key);
while(!cli_cmd_interrupt_received(cli)) {
delay(100);
furi_hal_delay_ms(100);
};
ibutton_worker_stop(worker);
} while(false);
@@ -284,7 +284,7 @@ void onewire_cli_search(Cli* cli) {
}
printf("\r\n");
}
delay(100);
furi_hal_delay_ms(100);
}
furi_hal_power_disable_otg();
+1 -1
View File
@@ -66,7 +66,7 @@ static void infrared_cli_start_ir_rx(Cli* cli, string_t args) {
printf("Receiving INFRARED...\r\nPress Ctrl+C to abort\r\n");
while(!cli_cmd_interrupt_received(cli)) {
delay(50);
furi_hal_delay_ms(50);
}
infrared_worker_rx_stop(worker);
+2 -2
View File
@@ -1,6 +1,6 @@
#include "input_i.h"
#define GPIO_Read(input_pin) (hal_gpio_read(input_pin.pin->pin) ^ input_pin.pin->inverted)
#define GPIO_Read(input_pin) (furi_hal_gpio_read(input_pin.pin->gpio) ^ (input_pin.pin->inverted))
static Input* input = NULL;
@@ -79,7 +79,7 @@ int32_t input_srv() {
input->pin_states = malloc(input_pins_count * sizeof(InputPinState));
for(size_t i = 0; i < input_pins_count; i++) {
hal_gpio_add_int_callback(input_pins[i].pin, input_isr, NULL);
furi_hal_gpio_add_int_callback(input_pins[i].gpio, input_isr, NULL);
input->pin_states[i].pin = &input_pins[i];
input->pin_states[i].state = GPIO_Read(input->pin_states[i]);
input->pin_states[i].debounce = INPUT_DEBOUNCE_TICKS_HALF;
@@ -3,13 +3,13 @@
#include <furi_hal.h>
void DecoderGpioOut::process_front(bool polarity, uint32_t time) {
hal_gpio_write(&gpio_ext_pa7, polarity);
furi_hal_gpio_write(&gpio_ext_pa7, polarity);
}
DecoderGpioOut::DecoderGpioOut() {
hal_gpio_init_simple(&gpio_ext_pa7, GpioModeOutputPushPull);
furi_hal_gpio_init_simple(&gpio_ext_pa7, GpioModeOutputPushPull);
}
DecoderGpioOut::~DecoderGpioOut() {
hal_gpio_init_simple(&gpio_ext_pa7, GpioModeAnalog);
furi_hal_gpio_init_simple(&gpio_ext_pa7, GpioModeAnalog);
}
+6 -6
View File
@@ -48,15 +48,15 @@ void RfidWriter::stop() {
void RfidWriter::write_gap(uint32_t gap_time) {
furi_hal_rfid_tim_read_stop();
delay_us(gap_time * 8);
furi_hal_delay_us(gap_time * 8);
furi_hal_rfid_tim_read_start();
}
void RfidWriter::write_bit(bool value) {
if(value) {
delay_us(T55xxTiming::data_1 * 8);
furi_hal_delay_us(T55xxTiming::data_1 * 8);
} else {
delay_us(T55xxTiming::data_0 * 8);
furi_hal_delay_us(T55xxTiming::data_0 * 8);
}
write_gap(T55xxTiming::write_gap);
}
@@ -68,7 +68,7 @@ void RfidWriter::write_byte(uint8_t value) {
}
void RfidWriter::write_block(uint8_t page, uint8_t block, bool lock_bit, uint32_t data) {
delay_us(T55xxTiming::wait_time * 8);
furi_hal_delay_us(T55xxTiming::wait_time * 8);
// start gap
write_gap(T55xxTiming::start_gap);
@@ -101,9 +101,9 @@ void RfidWriter::write_block(uint8_t page, uint8_t block, bool lock_bit, uint32_
write_bit((block >> 1) & 1);
write_bit((block >> 0) & 1);
delay_us(T55xxTiming::program * 8);
furi_hal_delay_us(T55xxTiming::program * 8);
delay_us(T55xxTiming::wait_time * 8);
furi_hal_delay_us(T55xxTiming::wait_time * 8);
write_reset();
}
+2 -2
View File
@@ -88,7 +88,7 @@ void lfrfid_cli_read(Cli* cli, string_t args) {
printf("\r\n");
break;
}
delay(100);
furi_hal_delay_ms(100);
}
printf("Reading stopped\r\n");
@@ -136,7 +136,7 @@ void lfrfid_cli_emulate(Cli* cli, string_t args) {
printf("Emulating RFID...\r\nPress Ctrl+C to abort\r\n");
while(!cli_cmd_interrupt_received(cli)) {
delay(100);
furi_hal_delay_ms(100);
}
printf("Emulation stopped\r\n");
emulator.stop();
@@ -2,12 +2,12 @@
#include <furi_hal.h>
static void comparator_trigger_callback(bool level, void* comp_ctx) {
hal_gpio_write(&gpio_ext_pa7, !level);
furi_hal_gpio_write(&gpio_ext_pa7, !level);
}
void LfRfidDebugAppSceneTune::on_enter(LfRfidDebugApp* app, bool need_restore) {
app->view_controller.switch_to<LfRfidViewTuneVM>();
hal_gpio_init_simple(&gpio_ext_pa7, GpioModeOutputPushPull);
furi_hal_gpio_init_simple(&gpio_ext_pa7, GpioModeOutputPushPull);
furi_hal_rfid_comp_set_callback(comparator_trigger_callback, this);
furi_hal_rfid_comp_start();
@@ -34,7 +34,7 @@ void LfRfidDebugAppSceneTune::on_exit(LfRfidDebugApp* app) {
furi_hal_rfid_comp_stop();
furi_hal_rfid_comp_set_callback(NULL, NULL);
hal_gpio_init_simple(&gpio_ext_pa7, GpioModeAnalog);
furi_hal_gpio_init_simple(&gpio_ext_pa7, GpioModeAnalog);
furi_hal_rfid_tim_read_stop();
furi_hal_rfid_tim_reset();
furi_hal_rfid_pins_reset();
+1 -1
View File
@@ -245,7 +245,7 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
* started and after task completed. In process of leakage monitoring
* both values should be taken into account.
*/
delay(20);
furi_hal_delay_ms(20);
int heap_diff = instance->free_heap_size - memmgr_get_free_heap();
FURI_LOG_I(
TAG,
+1 -1
View File
@@ -334,7 +334,7 @@ void process_note(
if(note_record->note != N) {
furi_hal_speaker_start(note_record->note, volume);
}
delay(note_delay);
furi_hal_delay_ms(note_delay);
furi_hal_speaker_stop();
}
+3 -3
View File
@@ -248,7 +248,7 @@ void notification_process_notification_message(
if(led_active) {
if(notification_is_any_led_layer_internal_and_not_empty(app)) {
notification_apply_notification_leds(app, led_off_values);
delay(minimal_delay);
furi_hal_delay_ms(minimal_delay);
}
led_active = false;
@@ -259,7 +259,7 @@ void notification_process_notification_message(
reset_mask |= reset_blue_mask;
}
delay(notification_message->data.delay.length);
furi_hal_delay_ms(notification_message->data.delay.length);
break;
case NotificationMessageTypeDoNotReset:
reset_notifications = false;
@@ -293,7 +293,7 @@ void notification_process_notification_message(
if(need_minimal_delay) {
notification_apply_notification_leds(app, led_off_values);
delay(minimal_delay);
furi_hal_delay_ms(minimal_delay);
}
}
+1 -1
View File
@@ -334,7 +334,7 @@ int32_t storage_test_app(void* p) {
do_test_end(api, "/ext");
while(true) {
delay(1000);
furi_hal_delay_ms(1000);
}
return 0;
+1 -1
View File
@@ -82,7 +82,7 @@ static bool sd_mount_card(StorageData* storage, bool notify) {
}
if(!result) {
delay(1000);
furi_hal_delay_ms(1000);
FURI_LOG_E(
TAG, "init cycle %d, error: %s", counter, storage_data_status_text(storage));
counter--;
+3 -2
View File
@@ -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);
}
+5 -5
View File
@@ -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:
+3 -3
View File
@@ -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);
+4 -4
View File
@@ -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(
+3 -3
View File
@@ -78,7 +78,7 @@ void furi_concurent_app(void* p) {
uint8_t b = value->b;
a++;
b++;
delay(2);
furi_hal_delay_ms(2);
value->a = a;
value->b = b;
release_mutex(mutex, value);
@@ -114,12 +114,12 @@ void test_furi_concurrent_access() {
a++;
b++;
value->a = a;
delay(10); // this is only for test, do not add delay between take/give in prod!
furi_hal_delay_ms(10); // this is only for test, do not add delay between take/give in prod!
value->b = b;
release_mutex(&mutex, value);
}
delay(50);
furi_hal_delay_ms(50);
mu_assert_pointers_eq(second_app->handler, NULL);
+10 -10
View File
@@ -86,7 +86,7 @@ static void test_rpc_setup(void) {
rpc = furi_record_open("rpc");
for(int i = 0; !(rpc_session[0].session) && (i < 10000); ++i) {
rpc_session[0].session = rpc_session_open(rpc);
delay(1);
furi_hal_delay_ms(1);
}
furi_check(rpc_session[0].session);
@@ -106,7 +106,7 @@ static void test_rpc_setup_second_session(void) {
for(int i = 0; !(rpc_session[1].session) && (i < 10000); ++i) {
rpc_session[1].session = rpc_session_open(rpc);
delay(1);
furi_hal_delay_ms(1);
}
furi_check(rpc_session[1].session);
@@ -1518,28 +1518,28 @@ MU_TEST(test_app_start_and_lock_status) {
test_app_get_status_lock_run(false, ++command_id);
test_app_start_run("Delay Test", "0", PB_CommandStatus_OK, ++command_id);
delay(100);
furi_hal_delay_ms(100);
test_app_get_status_lock_run(false, ++command_id);
test_app_start_run("Delay Test", "200", PB_CommandStatus_OK, ++command_id);
test_app_get_status_lock_run(true, ++command_id);
delay(100);
furi_hal_delay_ms(100);
test_app_get_status_lock_run(true, ++command_id);
test_app_start_run("Delay Test", "0", PB_CommandStatus_ERROR_APP_SYSTEM_LOCKED, ++command_id);
delay(200);
furi_hal_delay_ms(200);
test_app_get_status_lock_run(false, ++command_id);
test_app_start_run("Delay Test", "500", PB_CommandStatus_OK, ++command_id);
delay(100);
furi_hal_delay_ms(100);
test_app_get_status_lock_run(true, ++command_id);
test_app_start_run("Infrared", "0", PB_CommandStatus_ERROR_APP_SYSTEM_LOCKED, ++command_id);
delay(100);
furi_hal_delay_ms(100);
test_app_get_status_lock_run(true, ++command_id);
test_app_start_run(
"2_girls_1_app", "0", PB_CommandStatus_ERROR_INVALID_PARAMETERS, ++command_id);
delay(100);
furi_hal_delay_ms(100);
test_app_get_status_lock_run(true, ++command_id);
delay(500);
furi_hal_delay_ms(500);
test_app_get_status_lock_run(false, ++command_id);
}
@@ -1786,7 +1786,7 @@ int32_t delay_test_app(void* p) {
int timeout = atoi((const char*)p);
if(timeout > 0) {
delay(timeout);
furi_hal_delay_ms(timeout);
}
return 0;
+1 -1
View File
@@ -63,7 +63,7 @@ void unit_tests_cli(Cli* cli, string_t args, void* context) {
FURI_LOG_I(TAG, "Consumed: %0.2fs", (float)cycle_counter / (SystemCoreClock));
if(test_result == 0) {
delay(200); /* wait for tested services and apps to deallocate */
furi_hal_delay_ms(200); /* wait for tested services and apps to deallocate */
uint32_t heap_after = memmgr_get_free_heap();
notification_message(notification, &sequence_success);
if(heap_after != heap_before) {