SystemDelay_CMSIS_RTOS/Src/SystemDelayCmsisRtos.c

26 lines
575 B
C

//
// Created by xemon on 29.08.22.
//
#include <cmsis_os.h>
#include "SystemDelayInterface.h"
#include "systickcounter.h"
const uint32_t SystemWaitForever = osWaitForever;
void SystemYield() {
osThreadYield();
}
void SystemDelayMs(uint32_t ms) {
osDelay(SystemMsToTicks(ms));
}
uint64_t SystemMsToTicks(uint64_t ms) {
return (ms * osKernelGetTickFreq()) / 1000;
}
uint64_t SystemGetMs() {
// return (osKernelGetTickCount() * osKernelGetTickFreq()) / 1000;
// return (__sys_tick_counter * osKernelGetTickFreq()) / 1000;
return __sys_tick_counter;
}