Make iso7816_tx_is_idle() more readable
let's use #defines and existing inline function where appropriate
This commit is contained in:
parent
c8f3e6653f
commit
1f67f0f691
|
@ -94,14 +94,17 @@ static inline void iso7816_tx_program_puts(PIO pio, uint sm, const uint8_t *s, s
|
||||||
|
|
||||||
static inline bool iso7816_tx_is_idle(PIO pio, uint sm)
|
static inline bool iso7816_tx_is_idle(PIO pio, uint sm)
|
||||||
{
|
{
|
||||||
|
uint32_t flag = (1 << (PIO_FDEBUG_TXSTALL_LSB + sm));
|
||||||
|
|
||||||
/* how do we know once the PIO unit has completed tx of a character?
|
/* how do we know once the PIO unit has completed tx of a character?
|
||||||
- state machine TX fifo must be empty (FSTAT:TXEMPTY), AND
|
- state machine TX fifo must be empty (FSTAT:TXEMPTY), AND
|
||||||
- FDEBUG:TXSTALL bit must be set
|
- FDEBUG:TXSTALL bit must be set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* clear the sticky STALL flag */
|
/* clear the sticky STALL flag */
|
||||||
pio->fdebug |= (sm << 24);
|
pio->fdebug |= flag;
|
||||||
if (pio->fstat & (sm << 24) && pio->fdebug & (sm << 24))
|
|
||||||
|
if (pio_sm_is_tx_fifo_empty(pio, sm) && pio->fdebug & flag)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue