Configure and control the FlexSense Pulse Counter.
More...
|
typedef void(* | FLEX_PCNTWakeupHandler) (void) |
| Wakeup Handler Function Pointer Declaration.
|
|
Configure and control the FlexSense Pulse Counter.
◆ FLEX_PulseCounterOption
Pulse Counter Options, bit-wise, can be ORed.
Enumerator |
---|
FLEX_PCNT_DEFAULT_OPTIONS | default option, counts on rising edge
|
FLEX_PCNT_EDGE_FALLING | count on falling edge, default rising edge
|
FLEX_PCNT_DEBOUNCE_DISABLE | disable hardware debouncing, default enabled for about 160us
|
__attribute__ | Flag has been deprecated the FlexSenses pulse counter internal pull-up/down state is handled internally.
|
◆ FLEX_PulseCounterInit()
int FLEX_PulseCounterInit |
( |
const uint32_t | Limit, |
|
|
const uint32_t | Options ) |
Initialise the pulse counter and configure the event generation logic. An event is generated when pulse count hits a multiple of Limit
. Limit can be set to a value from 0 to 256, or a multiple of 256.
- Note
- Set
Limit
to 0 to disable event generation.
- Parameters
-
[in] | Limit | maximum value to count to before overflow occurs and reset counter to 0. |
[in] | Options | configuration options selected from FLEX_PulseCounterOption . |
- Returns
- FLEX_SUCCESS (0) if succeeded and < 0 if failed.
◆ FLEX_PulseCounterGet()
uint64_t FLEX_PulseCounterGet |
( |
void | | ) |
|
Get the total count of the pulse counter.
- Returns
- the total count.
◆ FLEX_PulseCounterHandlerModify()
Add or remove a wakeup handler that will be called when the pulse counter is triggered.
- Parameters
-
[in] | Handler | function pointer to the Pulse Count wakeup handler. |
[in] | Action | Add/Remove the input Pulse Count wakeup handler. |
- Returns
- FLEX_SUCCESS (0) if succeeded and < 0 if failed.
- Return values
-
-FLEX_ERROR_EALREADY | handler already exists, remove first |
-FLEX_ERROR_EINVAL | attempt to remove non-existent handler |