Myriota UltraLite SDK 2.4.0
Loading...
Searching...
No Matches

Pulse Counter for counting pulses on an input while the Module is in sleep mode. More...

Enumerations

enum  PulseCounterOption { PCNT_DEFAULT_OPTIONS = 0 , PCNT_EDGE_FALLING = 1 << 0 , PCNT_DEBOUNCE_DISABLE = 1 << 1 , PCNT_PULL_UP = 1 << 2 }
 Pulse counter bit-wise options. More...
 

Functions

MYRIOTA_HARDWARE_API int PulseCounterInit (uint32_t Limit, uint32_t Options)
 Initialise the pulse counter and configure the event generation logic.
 
MYRIOTA_HARDWARE_API uint64_t PulseCounterGet (void)
 Get the total count of the pulse counter.
 
MYRIOTA_HARDWARE_API void PulseCounterDeinit (void)
 Deinitialise the pulse counter.
 

Detailed Description

Pulse Counter for counting pulses on an input while the Module is in sleep mode.

Enumeration Type Documentation

◆ PulseCounterOption

Pulse counter bit-wise options.

Enumerator
PCNT_DEFAULT_OPTIONS 

Count on rising edge.

PCNT_EDGE_FALLING 

Count on falling edge.

PCNT_DEBOUNCE_DISABLE 

Disable hardware debouncing, default enabled for about 160us.

PCNT_PULL_UP 

Enable pull-up, default pull-down.

Function Documentation

◆ PulseCounterInit()

MYRIOTA_HARDWARE_API int PulseCounterInit ( uint32_t  Limit,
uint32_t  Options 
)

Initialise the pulse counter and configure the event generation logic.

Event is generated when pulse count hits multiple of Limit.

Parameters
LimitThe pulse count limit for event generation. Can be set to 0 to 256, or multiple of 256. Set Limit to 0 to disable event generation.
OptionsUsed to configure the pulse counter. See PulseCounterOption for available options.
Returns
0 if succeeded, -1 if failed.

◆ PulseCounterGet()

MYRIOTA_HARDWARE_API uint64_t PulseCounterGet ( void  )

Get the total count of the pulse counter.

Returns
The total count accumulated since PulseCounterInit() was called.