PCNT initialization structure.

Public Attributes#

Mode to operate in.

Selects whether the main counter responds to up-count events, down-count events or both.

Selects whether the auxiliary counter responds to up-count events, down-count events or both.

bool

Polarity of incoming edge.

bool

Counting direction, only applicable for OVS_SINGLE and EXT_CLK_SINGLE modes.

bool

Set to true to enable S1 to determine the direction of counting in OVS_SINGLE or EXT_CLK_SINGLE modes.

bool

Enable/disable PCNT counting during debug halt.

bool

Set to true to enable hysteresis.

bool

Set to true if a PRS channel is used as input to S0IN in PCNTx_INPUT register.

bool

Set to true if a PRS channel is used as input to S1IN in PCNTx_INPUT register.

bool

Enable digital pulse width filter, only available in OVS_SINGLE and OVS_QUAD modes.

bool

When set, removes flutter from Quad decoder inputs S0IN and S1IN.

uint8_t

Used only in OVS_SINGLE and OVS_QUAD modes.

Public Attribute Documentation#

mode#

sl_hal_pcnt_mode_t sl_hal_pcnt_init_t::mode

Mode to operate in.


main_count_event#

sl_hal_pcnt_count_event_t sl_hal_pcnt_init_t::main_count_event

Selects whether the main counter responds to up-count events, down-count events or both.


aux_count_event#

sl_hal_pcnt_count_event_t sl_hal_pcnt_init_t::aux_count_event

Selects whether the auxiliary counter responds to up-count events, down-count events or both.


negative_edge#

bool sl_hal_pcnt_init_t::negative_edge

Polarity of incoming edge.


In EXT_CLK_SINGLE mode: if false, positive edges are counted, otherwise negative edges.
In EXT_CLK_QUAD mode: if true, counting direction is inverted.


count_down#

bool sl_hal_pcnt_init_t::count_down

Counting direction, only applicable for OVS_SINGLE and EXT_CLK_SINGLE modes.

If true, counting up, otherwise counting down.


s1_count_direction#

bool sl_hal_pcnt_init_t::s1_count_direction

Set to true to enable S1 to determine the direction of counting in OVS_SINGLE or EXT_CLK_SINGLE modes.


When S1 is high, the count direction is given by count_down, and when S1 is low, the count direction is the opposite.


debug_halt#

bool sl_hal_pcnt_init_t::debug_halt

Enable/disable PCNT counting during debug halt.

Only in OVS_SINGLE and OVS_QUAD modes.


hysteresis_enable#

bool sl_hal_pcnt_init_t::hysteresis_enable

Set to true to enable hysteresis.

When enabled, PCNT will always overflow and underflow to TOP/2.


s0_prs_enable#

bool sl_hal_pcnt_init_t::s0_prs_enable

Set to true if a PRS channel is used as input to S0IN in PCNTx_INPUT register.


s1_prs_enable#

bool sl_hal_pcnt_init_t::s1_prs_enable

Set to true if a PRS channel is used as input to S1IN in PCNTx_INPUT register.


filter_enable#

bool sl_hal_pcnt_init_t::filter_enable

Enable digital pulse width filter, only available in OVS_SINGLE and OVS_QUAD modes.


flutter_remove#

bool sl_hal_pcnt_init_t::flutter_remove

When set, removes flutter from Quad decoder inputs S0IN and S1IN.

Available only in OVS_SINGLE and OVS_QUAD modes.


filter_lenght#

uint8_t sl_hal_pcnt_init_t::filter_lenght

Used only in OVS_SINGLE and OVS_QUAD modes.

To use this, enable filter by setting filter_enable to true.
Filter length = (filter_lenght + 5) LFACLK cycles.