/* * clock.cpp * * Created on: 13 мар. 2023 г. * Author: sychev */ #include "free_rtos/clock/clock.hpp" bool free_rtos::Clock::init(uint32_t period_ms, Callback cbk, void * arg) { ClockP_Params clockParams; ClockP_Params_init(&clockParams); prd_ms_ = period_ms; clockParams.timeout = ClockP_usecToTicks(prd_ms_ * 1000); clockParams.period = clockParams.timeout; clockParams.callback = cbk; clockParams.args = arg; int32_t status = ClockP_construct(&obj_, &clockParams); return (SystemP_SUCCESS == status); } void free_rtos::Clock::start() { ClockP_start(&obj_); } void free_rtos::Clock::stop() { ClockP_stop(&obj_); } free_rtos::Clock::~Clock() { ClockP_destruct (&obj_); }