Furi: core refactoring and CMSIS removal part 2 (#1410)
* Furi: rename and move core * Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest * Furi: CMSIS_OS drop and refactoring. * Furi: refactoring, remove cmsis legacy * Furi: fix incorrect assert on queue deallocation, cleanup timer * Furi: improve delay api, get rid of floats * hal: dropped furi_hal_crc * Furi: move DWT based delay to cortex HAL * Furi: update core documentation Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
@@ -46,14 +46,14 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == U2fCustomEventConnect) {
|
||||
osTimerStop(app->timer);
|
||||
furi_timer_stop(app->timer);
|
||||
u2f_view_set_state(app->u2f_view, U2fMsgIdle);
|
||||
} else if(event.event == U2fCustomEventDisconnect) {
|
||||
osTimerStop(app->timer);
|
||||
furi_timer_stop(app->timer);
|
||||
app->event_cur = U2fCustomEventNone;
|
||||
u2f_view_set_state(app->u2f_view, U2fMsgNotConnected);
|
||||
} else if((event.event == U2fCustomEventRegister) || (event.event == U2fCustomEventAuth)) {
|
||||
osTimerStart(app->timer, U2F_REQUEST_TIMEOUT);
|
||||
furi_timer_start(app->timer, U2F_REQUEST_TIMEOUT);
|
||||
if(app->event_cur == U2fCustomEventNone) {
|
||||
app->event_cur = event.event;
|
||||
if(event.event == U2fCustomEventRegister)
|
||||
@@ -69,7 +69,7 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
} else if(event.event == U2fCustomEventAuthSuccess) {
|
||||
notification_message_block(app->notifications, &sequence_set_green_255);
|
||||
DOLPHIN_DEED(DolphinDeedU2fAuthorized);
|
||||
osTimerStart(app->timer, U2F_SUCCESS_TIMEOUT);
|
||||
furi_timer_start(app->timer, U2F_SUCCESS_TIMEOUT);
|
||||
app->event_cur = U2fCustomEventNone;
|
||||
u2f_view_set_state(app->u2f_view, U2fMsgSuccess);
|
||||
} else if(event.event == U2fCustomEventTimeout) {
|
||||
@@ -82,7 +82,7 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
} else if(event.event == U2fCustomEventDataError) {
|
||||
notification_message(app->notifications, &sequence_set_red_255);
|
||||
osTimerStop(app->timer);
|
||||
furi_timer_stop(app->timer);
|
||||
u2f_view_set_state(app->u2f_view, U2fMsgError);
|
||||
}
|
||||
consumed = true;
|
||||
@@ -94,7 +94,7 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
void u2f_scene_main_on_enter(void* context) {
|
||||
U2fApp* app = context;
|
||||
|
||||
app->timer = osTimerNew(u2f_scene_main_timer_callback, osTimerOnce, app, NULL);
|
||||
app->timer = furi_timer_alloc(u2f_scene_main_timer_callback, FuriTimerTypeOnce, app);
|
||||
|
||||
app->u2f_instance = u2f_alloc();
|
||||
app->u2f_ready = u2f_init(app->u2f_instance);
|
||||
@@ -113,8 +113,8 @@ void u2f_scene_main_on_enter(void* context) {
|
||||
void u2f_scene_main_on_exit(void* context) {
|
||||
U2fApp* app = context;
|
||||
notification_message_block(app->notifications, &sequence_reset_rgb);
|
||||
osTimerStop(app->timer);
|
||||
osTimerDelete(app->timer);
|
||||
furi_timer_stop(app->timer);
|
||||
furi_timer_free(app->timer);
|
||||
if(app->u2f_ready == true) {
|
||||
u2f_hid_stop(app->u2f_hid);
|
||||
u2f_free(app->u2f_instance);
|
||||
|
@@ -51,7 +51,7 @@ struct U2fApp {
|
||||
SceneManager* scene_manager;
|
||||
NotificationApp* notifications;
|
||||
Widget* widget;
|
||||
osTimerId_t timer;
|
||||
FuriTimer* timer;
|
||||
U2fHid* u2f_hid;
|
||||
U2fView* u2f_view;
|
||||
U2fData* u2f_instance;
|
||||
|
@@ -57,7 +57,7 @@ struct U2fHid_packet {
|
||||
|
||||
struct U2fHid {
|
||||
FuriThread* thread;
|
||||
osTimerId_t lock_timer;
|
||||
FuriTimer* lock_timer;
|
||||
struct U2fHid_packet packet;
|
||||
uint8_t seq_id_last;
|
||||
uint16_t req_buf_ptr;
|
||||
@@ -157,7 +157,7 @@ static bool u2f_hid_parse_request(U2fHid* u2f_hid) {
|
||||
} else { // Lock on
|
||||
u2f_hid->lock = true;
|
||||
u2f_hid->lock_cid = u2f_hid->packet.cid;
|
||||
osTimerStart(u2f_hid->lock_timer, lock_timeout * 1000);
|
||||
furi_timer_start(u2f_hid->lock_timer, lock_timeout * 1000);
|
||||
}
|
||||
|
||||
} else if(u2f_hid->packet.cmd == U2F_HID_INIT) { // INIT - channel initialization request
|
||||
@@ -193,16 +193,17 @@ static int32_t u2f_hid_worker(void* context) {
|
||||
FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config();
|
||||
furi_check(furi_hal_usb_set_config(&usb_hid_u2f, NULL) == true);
|
||||
|
||||
u2f_hid->lock_timer = osTimerNew(u2f_hid_lock_timeout_callback, osTimerOnce, u2f_hid, NULL);
|
||||
u2f_hid->lock_timer =
|
||||
furi_timer_alloc(u2f_hid_lock_timeout_callback, FuriTimerTypeOnce, u2f_hid);
|
||||
|
||||
furi_hal_hid_u2f_set_callback(u2f_hid_event_callback, u2f_hid);
|
||||
|
||||
while(1) {
|
||||
uint32_t flags = furi_thread_flags_wait(
|
||||
WorkerEvtStop | WorkerEvtConnect | WorkerEvtDisconnect | WorkerEvtRequest,
|
||||
osFlagsWaitAny,
|
||||
osWaitForever);
|
||||
furi_check((flags & osFlagsError) == 0);
|
||||
FuriFlagWaitAny,
|
||||
FuriWaitForever);
|
||||
furi_check((flags & FuriFlagError) == 0);
|
||||
if(flags & WorkerEvtStop) break;
|
||||
if(flags & WorkerEvtConnect) {
|
||||
u2f_set_state(u2f_hid->u2f_instance, 1);
|
||||
@@ -266,8 +267,8 @@ static int32_t u2f_hid_worker(void* context) {
|
||||
u2f_hid->lock_cid = 0;
|
||||
}
|
||||
}
|
||||
osTimerStop(u2f_hid->lock_timer);
|
||||
osTimerDelete(u2f_hid->lock_timer);
|
||||
furi_timer_stop(u2f_hid->lock_timer);
|
||||
furi_timer_free(u2f_hid->lock_timer);
|
||||
|
||||
furi_hal_hid_u2f_set_callback(NULL, NULL);
|
||||
furi_hal_usb_set_config(usb_mode_prev, NULL);
|
||||
|
Reference in New Issue
Block a user