Firmware SDK
|
Driver for generic pulse counter. More...
Enumerations | |
enum | twr_pulse_counter_edge_t { TWR_PULSE_COUNTER_EDGE_RISE = TWR_EXTI_EDGE_RISING , TWR_PULSE_COUNTER_EDGE_FALL = TWR_EXTI_EDGE_FALLING , TWR_PULSE_COUNTER_EDGE_RISE_FALL = TWR_EXTI_EDGE_RISING_AND_FALLING } |
Pulse counter active edges. More... | |
enum | twr_pulse_counter_event_t { TWR_PULSE_COUNTER_EVENT_UPDATE , TWR_PULSE_COUNTER_EVENT_OVERFLOW } |
Pulse counter event. More... | |
Functions | |
void | twr_pulse_counter_init (twr_module_sensor_channel_t channel, twr_pulse_counter_edge_t edge) |
Initialize pulse counter. More... | |
void | twr_pulse_counter_set_event_handler (twr_module_sensor_channel_t channel, void(*event_handler)(twr_module_sensor_channel_t, twr_pulse_counter_event_t, void *), void *event_param) |
Set callback function. More... | |
void | twr_pulse_counter_set_update_interval (twr_module_sensor_channel_t channel, twr_tick_t interval) |
Set update interval. More... | |
void | twr_pulse_counter_set (twr_module_sensor_channel_t channel, unsigned int count) |
Set count. More... | |
unsigned int | twr_pulse_counter_get (twr_module_sensor_channel_t channel) |
Get count. More... | |
void | twr_pulse_counter_reset (twr_module_sensor_channel_t channel) |
Set count to zero. More... | |
Driver for generic pulse counter.
Pulse counter active edges.
Enumerator | |
---|---|
TWR_PULSE_COUNTER_EDGE_RISE | Rise edge is active. |
TWR_PULSE_COUNTER_EDGE_FALL | Fall edge is active. |
TWR_PULSE_COUNTER_EDGE_RISE_FALL | Rise and fall edges are active. |
Definition at line 15 of file twr_pulse_counter.h.
Pulse counter event.
Enumerator | |
---|---|
TWR_PULSE_COUNTER_EVENT_UPDATE | Update event. |
TWR_PULSE_COUNTER_EVENT_OVERFLOW | Overflow. |
Definition at line 30 of file twr_pulse_counter.h.
unsigned int twr_pulse_counter_get | ( | twr_module_sensor_channel_t | channel | ) |
Get count.
[in] | channel | Sensor Module channel pulse counter is connected to |
Definition at line 71 of file twr_pulse_counter.c.
void twr_pulse_counter_init | ( | twr_module_sensor_channel_t | channel, |
twr_pulse_counter_edge_t | edge | ||
) |
Initialize pulse counter.
[in] | channel | Sensor Module channel pulse counter is connected to |
[in] | edge | Active edge |
Definition at line 23 of file twr_pulse_counter.c.
void twr_pulse_counter_reset | ( | twr_module_sensor_channel_t | channel | ) |
Set count to zero.
[in] | channel | Sensor Module channel pulse counter is connected to |
Definition at line 76 of file twr_pulse_counter.c.
void twr_pulse_counter_set | ( | twr_module_sensor_channel_t | channel, |
unsigned int | count | ||
) |
Set count.
[in] | channel | Sensor Module channel pulse counter is connected to |
[in] | count | Count to be set |
Definition at line 66 of file twr_pulse_counter.c.
void twr_pulse_counter_set_event_handler | ( | twr_module_sensor_channel_t | channel, |
void(*)(twr_module_sensor_channel_t, twr_pulse_counter_event_t, void *) | event_handler, | ||
void * | event_param | ||
) |
Set callback function.
[in] | channel | Sensor Module channel pulse counter is connected to |
[in] | event_handler | Function address |
[in] | event_param | Optional event parameter (can be NULL) |
Definition at line 46 of file twr_pulse_counter.c.
void twr_pulse_counter_set_update_interval | ( | twr_module_sensor_channel_t | channel, |
twr_tick_t | interval | ||
) |
Set update interval.
[in] | channel | Sensor Module channel pulse counter is connected to |
[in] | interval | Update interval |
Definition at line 52 of file twr_pulse_counter.c.