semf
|
InputCapture
implementation for STM32.
More...
#include <stm32inputcapture.h>
Public Types | |
enum class | ErrorCode : uint8_t { Start_Error = 0 , Start_Busy , Start_Timeout , Stop_Error , Stop_Busy , Stop_Timeout , SetTrigger_Busy , SetTrigger_TriggerInvalid } |
Public Types inherited from semf::InputCapture | |
enum | Trigger : uint8_t { RisingEdge = 0 , FallingEdge , RisingAndFallingEdge } |
Public Member Functions | |
Stm32InputCapture (TIM_HandleTypeDef &hwHandle, uint32_t channel, unsigned int ticksPerSecond) | |
Constructor. More... | |
Stm32InputCapture (const Stm32InputCapture &other)=delete | |
virtual | ~Stm32InputCapture ()=default |
unsigned int | ticksPerSecond () const override |
Returns the the number of ticks per second (Hardware timer frequency). More... | |
void | setMaxTicks (unsigned int maxTicks) override |
Set the maximum number of ticks at which the tick counter will overflow. More... | |
unsigned int | maxTicks () const override |
Get the maximum number of ticks from the timer. More... | |
void | start () override |
void | stop () override |
unsigned int | ticks () override |
Get the latest number of ticks (at the last change of the input). More... | |
void | setTrigger (Trigger trigger) override |
void | isr (TIM_HandleTypeDef &hwHandle) |
Interrupt service routine for input capture. More... | |
Public Member Functions inherited from semf::InputCapture | |
virtual | ~InputCapture ()=default |
virtual unsigned int | ticksPerSecond () const =0 |
Returns the the number of ticks per second (Hardware timer frequency). More... | |
virtual void | setMaxTicks (unsigned int maxTicks)=0 |
Set the maximum number of ticks at which the tick counter will overflow. More... | |
virtual unsigned int | maxTicks () const =0 |
Get the maximum number of ticks from the timer. More... | |
virtual void | start ()=0 |
virtual void | stop ()=0 |
virtual unsigned int | ticks ()=0 |
Get the latest number of ticks (at the last change of the input). More... | |
virtual void | setTrigger (Trigger trigger)=0 |
Sets the trigger source. More... | |
Public Member Functions inherited from semf::LinkedQueue< T >::Node | |
virtual | ~Node ()=default |
T * | next () const |
Returns a pointer to the next element in a queue. More... | |
void | setNext (T *next) |
Sets a pointer to the next element in a list. More... | |
bool | isInQueue (LinkedQueue &queue) |
Returns if a node is part of this LinkedQueue . More... | |
Static Public Member Functions | |
static void | systemIsr (TIM_HandleTypeDef &hwHandle) |
System-wide interrupt service routine for input capture. More... | |
Additional Inherited Members | |
Public Attributes inherited from semf::InputCapture | |
Signal | dataAvailable |
Signal< Error > | error |
InputCapture
implementation for STM32.
Definition at line 24 of file stm32inputcapture.h.
|
strong |
Error IDs for this class. Error ID identify a unique error() / onError call (excluding transferring).
Enumerator | |
---|---|
Start_Error | |
Start_Busy | |
Start_Timeout | |
Stop_Error | |
Stop_Busy | |
Stop_Timeout | |
SetTrigger_Busy | |
SetTrigger_TriggerInvalid |
Definition at line 28 of file stm32inputcapture.h.
semf::Stm32InputCapture::Stm32InputCapture | ( | TIM_HandleTypeDef & | hwHandle, |
uint32_t | channel, | ||
unsigned int | ticksPerSecond | ||
) |
Constructor.
hwHandle | Hardware handler. |
channel | Channel selection define from STM timer HAL description. Use TIM_CHANNEL_1, TIM_CHANNEL_2, TIM_CHANNEL_3 or TIM_CHANNEL_4. |
ticksPerSecond | The number of ticks per second (hardware timer frequency). |
Definition at line 21 of file stm32inputcapture.cpp.
|
explicitdelete |
|
virtualdefault |
void semf::Stm32InputCapture::isr | ( | TIM_HandleTypeDef & | hwHandle | ) |
Interrupt service routine for input capture.
hwHandle | Hardware handler. |
Definition at line 132 of file stm32inputcapture.cpp.
|
overridevirtual |
Get the maximum number of ticks from the timer.
Implements semf::InputCapture.
Definition at line 152 of file stm32inputcapture.cpp.
|
overridevirtual |
Set the maximum number of ticks at which the tick counter will overflow.
maxTicks | Number of ticks at which the tick counter will overflow. |
Implements semf::InputCapture.
Definition at line 146 of file stm32inputcapture.cpp.
|
overridevirtual |
Starts capturing the input signals.
SetTrigger_Busy | If m_hwHandle is locked. |
SetTrigger_TriggerInvalid | If trigger contains an invalid value. |
Implements semf::InputCapture.
Definition at line 86 of file stm32inputcapture.cpp.
|
overridevirtual |
Starts capturing the input signals.
Start_Error | If HAL_TIM_IC_Start_IT returns HAL_ERROR . |
Start_Busy | If HAL_TIM_IC_Start_IT returns HAL_BUSY . |
Start_Timeout | If HAL_TIM_IC_Start_IT returns HAL_TIMEOUT . |
Implements semf::InputCapture.
Definition at line 29 of file stm32inputcapture.cpp.
|
overridevirtual |
Stops capturing the input signals.
Stop_Error | If HAL_TIM_IC_Stop_IT returns HAL_ERROR . |
Stop_Busy | If HAL_TIM_IC_Stop_IT returns HAL_BUSY . |
Stop_Timeout | If HAL_TIM_IC_Stop_IT returns HAL_TIMEOUT . |
Implements semf::InputCapture.
Definition at line 54 of file stm32inputcapture.cpp.
|
static |
System-wide interrupt service routine for input capture.
hwHandle | Hardware handler. |
Definition at line 126 of file stm32inputcapture.cpp.
|
overridevirtual |
Get the latest number of ticks (at the last change of the input).
Implements semf::InputCapture.
Definition at line 79 of file stm32inputcapture.cpp.
|
overridevirtual |
Returns the the number of ticks per second (Hardware timer frequency).
Implements semf::InputCapture.
Definition at line 141 of file stm32inputcapture.cpp.