Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_pulse_counter

Driver for generic pulse counter. More...

Enumerations

enum  bc_pulse_counter_edge_t {
  BC_PULSE_COUNTER_EDGE_RISE = BC_EXTI_EDGE_RISING,
  BC_PULSE_COUNTER_EDGE_FALL = BC_EXTI_EDGE_FALLING,
  BC_PULSE_COUNTER_EDGE_RISE_FALL = BC_EXTI_EDGE_RISING_AND_FALLING
}
 Pulse counter active edges. More...
 
enum  bc_pulse_counter_event_t {
  BC_PULSE_COUNTER_EVENT_UPDATE,
  BC_PULSE_COUNTER_EVENT_OVERFLOW
}
 Pulse counter event. More...
 

Functions

void bc_pulse_counter_init (bc_module_sensor_channel_t channel, bc_pulse_counter_edge_t edge)
 Initialize pulse counter. More...
 
void bc_pulse_counter_set_event_handler (bc_module_sensor_channel_t channel, void(*event_handler)(bc_module_sensor_channel_t, bc_pulse_counter_event_t, void *), void *event_param)
 Set callback function. More...
 
void bc_pulse_counter_set_update_interval (bc_module_sensor_channel_t channel, bc_tick_t interval)
 Set update interval. More...
 
void bc_pulse_counter_set (bc_module_sensor_channel_t channel, unsigned int count)
 Set count. More...
 
unsigned int bc_pulse_counter_get (bc_module_sensor_channel_t channel)
 Get count. More...
 
void bc_pulse_counter_reset (bc_module_sensor_channel_t channel)
 Set count to zero. More...
 

Detailed Description

Driver for generic pulse counter.

Enumeration Type Documentation

Pulse counter active edges.

Enumerator
BC_PULSE_COUNTER_EDGE_RISE 

Rise edge is active.

BC_PULSE_COUNTER_EDGE_FALL 

Fall edge is active.

BC_PULSE_COUNTER_EDGE_RISE_FALL 

Rise and fall edges are active.

Definition at line 15 of file bc_pulse_counter.h.

Pulse counter event.

Enumerator
BC_PULSE_COUNTER_EVENT_UPDATE 

Update event.

BC_PULSE_COUNTER_EVENT_OVERFLOW 

Overflow.

Definition at line 30 of file bc_pulse_counter.h.

Function Documentation

unsigned int bc_pulse_counter_get ( bc_module_sensor_channel_t  channel)

Get count.

Parameters
[in]channelSensor Module channel pulse counter is connected to
Returns
Counter count

Definition at line 69 of file bc_pulse_counter.c.

void bc_pulse_counter_init ( bc_module_sensor_channel_t  channel,
bc_pulse_counter_edge_t  edge 
)

Initialize pulse counter.

Parameters
[in]channelSensor Module channel pulse counter is connected to
[in]edgeActive edge

Definition at line 22 of file bc_pulse_counter.c.

Here is the call graph for this function:

void bc_pulse_counter_reset ( bc_module_sensor_channel_t  channel)

Set count to zero.

Parameters
[in]channelSensor Module channel pulse counter is connected to

Definition at line 74 of file bc_pulse_counter.c.

void bc_pulse_counter_set ( bc_module_sensor_channel_t  channel,
unsigned int  count 
)

Set count.

Parameters
[in]channelSensor Module channel pulse counter is connected to
[in]countCount to be set

Definition at line 64 of file bc_pulse_counter.c.

void bc_pulse_counter_set_event_handler ( bc_module_sensor_channel_t  channel,
void(*)(bc_module_sensor_channel_t, bc_pulse_counter_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]channelSensor Module channel pulse counter is connected to
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 44 of file bc_pulse_counter.c.

void bc_pulse_counter_set_update_interval ( bc_module_sensor_channel_t  channel,
bc_tick_t  interval 
)

Set update interval.

Parameters
[in]channelSensor Module channel pulse counter is connected to
[in]intervalUpdate interval

Definition at line 50 of file bc_pulse_counter.c.

Here is the call graph for this function: