/* * timer.hpp * * Created on: 10 ���. 2023 �. * Author: sychev */ #ifndef FREE_RTOS_TIMER_TIMER_HPP_ #define FREE_RTOS_TIMER_TIMER_HPP_ #include #include #include namespace free_rtos { class Timer { public: struct Settings { uint32_t input_clk_Hz; /// �������� ������� � �� uint32_t base_address; /// ������� ����� uint32_t clock_src_mux_addr; /// ����� ����� uint32_t int_num; /// ����� ���������� uint32_t int_priority; /// ��������� ���������� uint32_t period_us; /// ������ ������� � ��� }; /** * ������������� ������� */ bool Init(Settings& sett); /** * �������� ������������ �������. �����������. */ uint32_t Wait(); void Start(); void Stop(); uint32_t GetTickCounter() { return tick_counter_; } private: friend void timer_isr_callback(void * arg); private: uint32_t base_addr_; /// ������� ����� ��������� ������� uint32_t int_num_; /// ����� ���������� HwiP_Object hwi_obj_; /// ���������� ������������ �� ������� Semaphore sem_; uint32_t tick_counter_{0x00000000}; }; } #endif /* FREE_RTOS_TIMER_TIMER_HPP_ */