semf
stm32timer.h
Go to the documentation of this file.
1
10#ifndef SEMF_HARDWAREABSTRACTION_STM32_STM32TIMER_H_
11#define SEMF_HARDWAREABSTRACTION_STM32_STM32TIMER_H_
12
16
17#if defined(STM32) && defined(HAL_TIM_MODULE_ENABLED)
18namespace semf
19{
26class Stm32Timer : public app::Timer, public LinkedQueue<Stm32Timer>::Node
27{
28public:
30 enum class ErrorCode : uint8_t
31 {
32 Start_HalError = 0,
33 Start_HalBusy,
34 Start_HalTimeout,
35 Stop_HalError,
36 Stop_HalBusy,
37 Stop_HalTimeout,
38 };
39
44 explicit Stm32Timer(TIM_HandleTypeDef& hwHandle);
45 explicit Stm32Timer(const Stm32Timer& other) = delete;
46 virtual ~Stm32Timer() = default;
47
54 void start() override;
61 void stop() override;
62 void reset() override;
72 static void systemIsr(TIM_HandleTypeDef& hwHandle);
77 void isr(TIM_HandleTypeDef& hwHandle);
78
79private:
81 static LinkedQueue<Stm32Timer> m_queue;
83 TIM_HandleTypeDef* m_hwHandle;
85 static constexpr Error::ClassID kSemfClassId = Error::ClassID::Stm32Timer;
86};
87} /* namespace semf */
88#endif
89#endif /* SEMF_HARDWAREABSTRACTION_STM32_STM32TIMER_H_ */
ClassID
Semf class IDs.
Definition: error.h:28
LinkedQueue is an managed single linked queue implementation.
Definition: linkedqueue.h:38
Timer implementation for STM32 as peripheral timer.
Definition: stm32timer.h:27
Stm32Timer(TIM_HandleTypeDef &hwHandle)
Constructor.
Definition: stm32timer.cpp:24
Stm32Timer(const Stm32Timer &other)=delete
void isr(TIM_HandleTypeDef &hwHandle)
Interrupt service routine for adc conversion finished.
Definition: stm32timer.cpp:95
static void systemIsr(TIM_HandleTypeDef &hwHandle)
System-wide interrupt service routine for adc conversion finished.
Definition: stm32timer.cpp:89
void start() override
Definition: stm32timer.cpp:30
virtual ~Stm32Timer()=default
void reset() override
Definition: stm32timer.cpp:78
static LinkedQueue< Stm32Timer > * queue()
Get the list with all timers.
Definition: stm32timer.cpp:83
void stop() override
Definition: stm32timer.cpp:54
Class for using timer hardware.
Definition: timer.h:24