Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4853

SDK • Re: State Machine Configuration

$
0
0
There are some remarks in the online pdf files about SHIFTCTRL_IN_SHIFTDIR

In the SDK source code, you find a similar named parameter as a DEFINE constant (PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_LSB, PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_BITS ), used to tweak a parameter 'shift_right' into some registers.
IMHO there is no need to use the DEFINE yourself.

From the SDK source code pio.h:

Code:

/*! \brief Setup 'in' shifting parameters in a state machine configuration *  \ingroup sm_config * * \param c Pointer to the configuration structure to modify * \param shift_right true to shift ISR to right, false to shift ISR to left * \param autopush whether autopush is enabled * \param push_threshold threshold in bits to shift in before auto/conditional re-pushing of the ISR */static inline void sm_config_set_in_shift(pio_sm_config *c, bool shift_right, bool autopush, uint push_threshold) {    valid_params_if(PIO, push_threshold <= 32);    c->shiftctrl = (c->shiftctrl &                    ~(PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_BITS |                      PIO_SM0_SHIFTCTRL_AUTOPUSH_BITS |                      PIO_SM0_SHIFTCTRL_PUSH_THRESH_BITS)) |                   (bool_to_bit(shift_right) << PIO_SM0_SHIFTCTRL_IN_SHIFTDIR_LSB) |                   (bool_to_bit(autopush) << PIO_SM0_SHIFTCTRL_AUTOPUSH_LSB) |                   ((push_threshold & 0x1fu) << PIO_SM0_SHIFTCTRL_PUSH_THRESH_LSB);}

Statistics: Posted by ghp — Sat Apr 27, 2024 9:28 am



Viewing all articles
Browse latest Browse all 4853

Trending Articles