Skip to content

Commit fb5a847

Browse files
lurchkilograham
authored andcommitted
Also check enum params and doxygenise pio_mov_status_type
1 parent 3fb6a48 commit fb5a847

File tree

1 file changed

+6
-2
lines changed
  • src/rp2_common/hardware_pio/include/hardware

1 file changed

+6
-2
lines changed

src/rp2_common/hardware_pio/include/hardware/pio.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ enum pio_fifo_join {
5858
PIO_FIFO_JOIN_RX = 2,
5959
};
6060

61+
/** \brief MOV status types
62+
* \ingroup hardware_pio
63+
*/
6164
enum pio_mov_status_type {
6265
STATUS_TX_LESSTHAN = 0,
6366
STATUS_RX_LESSTHAN = 1
@@ -308,7 +311,7 @@ static inline void sm_config_set_out_shift(pio_sm_config *c, bool shift_right, b
308311
* \param join Specifies the join type. \see enum pio_fifo_join
309312
*/
310313
static inline void sm_config_set_fifo_join(pio_sm_config *c, enum pio_fifo_join join) {
311-
valid_params_if(PIO, join >= 0 && join <= 2);
314+
valid_params_if(PIO, join >= PIO_FIFO_JOIN_NONE && join <= PIO_FIFO_JOIN_RX);
312315
c->shiftctrl = (c->shiftctrl & (uint)~(PIO_SM0_SHIFTCTRL_FJOIN_TX_BITS | PIO_SM0_SHIFTCTRL_FJOIN_RX_BITS)) |
313316
(((uint)join) << PIO_SM0_SHIFTCTRL_FJOIN_TX_LSB);
314317
}
@@ -334,10 +337,11 @@ static inline void sm_config_set_out_special(pio_sm_config *c, bool sticky, bool
334337
* \ingroup sm_config
335338
*
336339
* \param c Pointer to the configuration structure to modify
337-
* \param status_sel the status operation selector
340+
* \param status_sel the status operation selector. \see enum pio_mov_status_type
338341
* \param status_n parameter for the mov status operation (currently a bit count)
339342
*/
340343
static inline void sm_config_set_mov_status(pio_sm_config *c, enum pio_mov_status_type status_sel, uint status_n) {
344+
valid_params_if(PIO, join >= STATUS_TX_LESSTHAN && join <= STATUS_RX_LESSTHAN);
341345
c->execctrl = (c->execctrl
342346
& ~(PIO_SM0_EXECCTRL_STATUS_SEL_BITS | PIO_SM0_EXECCTRL_STATUS_N_BITS))
343347
| ((((uint)status_sel) << PIO_SM0_EXECCTRL_STATUS_SEL_LSB) & PIO_SM0_EXECCTRL_STATUS_SEL_BITS)

0 commit comments

Comments
 (0)