mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #10725 from jia200x/pr/cc2420_inline_flush
drivers/cc2420: move flush sequence to inline function
This commit is contained in:
commit
19073742b2
@ -158,6 +158,15 @@ void cc2420_tx_exec(cc2420_t *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void _flush_rx_fifo(cc2420_t *dev)
|
||||||
|
{
|
||||||
|
/* as stated in the CC2420 datasheet (section 14.3), the SFLUSHRX command
|
||||||
|
* strobe should be issued twice to ensure that the SFD pin goes back to its
|
||||||
|
* idle state */
|
||||||
|
cc2420_strobe(dev, CC2420_STROBE_FLUSHRX);
|
||||||
|
cc2420_strobe(dev, CC2420_STROBE_FLUSHRX);
|
||||||
|
}
|
||||||
|
|
||||||
int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info)
|
int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info)
|
||||||
{
|
{
|
||||||
(void)info;
|
(void)info;
|
||||||
@ -202,8 +211,7 @@ int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* finally flush the FIFO */
|
/* finally flush the FIFO */
|
||||||
cc2420_strobe(dev, CC2420_STROBE_FLUSHRX);
|
_flush_rx_fifo(dev);
|
||||||
cc2420_strobe(dev, CC2420_STROBE_FLUSHRX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)len;
|
return (int)len;
|
||||||
|
Loading…
Reference in New Issue
Block a user