diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 6f531fe9f7..b38565bf1b 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -85,8 +85,8 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura * CH_FREQUENCY is the number of system ticks in a second */ -static VirtualTimer periodicSlowTimer; -static VirtualTimer periodicFastTimer; +static virtual_timer_t periodicSlowTimer; +static virtual_timer_t periodicFastTimer; static LoggingWithStorage logger("Engine Controller"); diff --git a/firmware/controllers/error_handling.cpp b/firmware/controllers/error_handling.cpp index dc8fe30f08..b04f7f254d 100644 --- a/firmware/controllers/error_handling.cpp +++ b/firmware/controllers/error_handling.cpp @@ -117,8 +117,8 @@ extern virtual_timers_list_t vtlist; extern bool main_loop_started; int getVtSizeEstimate(void) { - VirtualTimer *first = vtlist.vt_next; - VirtualTimer *cur = first->vt_next; + virtual_timer_t *first = vtlist.vt_next; + virtual_timer_t *cur = first->vt_next; int c = 0; while (c++ < 20 && cur != first) { cur = cur->vt_next; diff --git a/firmware/controllers/injector_central.cpp b/firmware/controllers/injector_central.cpp index c061baddad..9c385b1417 100644 --- a/firmware/controllers/injector_central.cpp +++ b/firmware/controllers/injector_central.cpp @@ -79,9 +79,9 @@ static void setInjectorEnabled(int id, int value) { static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, float onTimeMs, float offTimeMs, int count) { - int delaySt = (int) (delayMs * CH_FREQUENCY / 1000); - int onTimeSt = (int) (onTimeMs * CH_FREQUENCY / 1000); - int offTimeSt = (int) (offTimeMs * CH_FREQUENCY / 1000); + int delaySt = MS2ST(delayMs); + int onTimeSt = MS2ST(onTimeMs); + int offTimeSt = MS2ST(offTimeMs); if (delaySt < 0) { scheduleMsg(&logger, "Invalid delay %f", delayMs); return; diff --git a/firmware/global.h b/firmware/global.h index dd350e8120..58d55f50bd 100644 --- a/firmware/global.h +++ b/firmware/global.h @@ -60,6 +60,10 @@ typedef Thread thread_t; typedef EventListener event_listener_t; typedef EventSource event_source_t; typedef VTList virtual_timers_list_t; +typedef VirtualTimer virtual_timer_t; + +#define HAL_SUCCESS CH_SUCCESS +#define HAL_FAILED CH_FAILED #define THD_WORKING_AREA WORKING_AREA #define THD_FUNCTION(tname, arg) void tname(void *arg) diff --git a/firmware/hw_layer/flash.c b/firmware/hw_layer/flash.c index 76993de734..18b75deea7 100644 --- a/firmware/hw_layer/flash.c +++ b/firmware/hw_layer/flash.c @@ -53,7 +53,7 @@ flashsector_t flashSectorAt(flashaddr_t address) { static bool flashUnlock(void) { /* Check if unlock is really needed */ if (!(FLASH->CR & FLASH_CR_LOCK)) - return CH_SUCCESS; + return HAL_SUCCESS; /* Write magic unlock sequence */ FLASH->KEYR = 0x45670123; @@ -61,8 +61,8 @@ static bool flashUnlock(void) { /* Check if unlock was successful */ if (FLASH->CR & FLASH_CR_LOCK) - return CH_FAILED; - return CH_SUCCESS; + return HAL_FAILED; + return HAL_SUCCESS; } /** diff --git a/firmware/hw_layer/flash.h b/firmware/hw_layer/flash.h index 19ce09f5db..07adaafc3c 100644 --- a/firmware/hw_layer/flash.h +++ b/firmware/hw_layer/flash.h @@ -14,7 +14,7 @@ /* Error codes */ /** @brief Flash operation successful */ -#define FLASH_RETURN_SUCCESS CH_SUCCESS +#define FLASH_RETURN_SUCCESS HAL_SUCCESS /** @brief Flash operation error because of denied access, corrupted memory.*/ #define FLASH_RETURN_NO_PERMISSION -1