drivers/at86rf2xx: remove at86rf2xx_reset_state_machine

This function was only used once in the initialization procedure.
Inlining the actual state change reduces overhead and lines to
maintain.

If ever needed, undo this commit.
This commit is contained in:
Thomas Eichinger 2017-07-07 09:11:28 -07:00 committed by Hyungsin
parent 6889cd934a
commit 093eb7a985
4 changed files with 11 additions and 34 deletions

View File

@ -56,7 +56,9 @@ void at86rf2xx_reset(at86rf2xx_t *dev)
at86rf2xx_hardware_reset(dev);
/* Reset state machine to ensure a known state */
at86rf2xx_reset_state_machine(dev);
if (dev->state == AT86RF2XX_STATE_P_ON) {
at86rf2xx_set_state(dev, AT86RF2XX_STATE_FORCE_TRX_OFF);
}
/* reset options and sequence number */
dev->netdev.seq = 0;

View File

@ -440,9 +440,9 @@ static inline void _set_state(at86rf2xx_t *dev, uint8_t state, uint8_t cmd)
if (state != AT86RF2XX_STATE_RX_AACK_ON) {
while (at86rf2xx_get_status(dev) != state) {}
}
/* Although RX_AACK_ON state doesn't get read back,
* at least make sure if state transition is in progress or not
*/
/* Although RX_AACK_ON state doesn't get read back,
* at least make sure if state transition is in progress or not
*/
else {
while (at86rf2xx_get_status(dev) == AT86RF2XX_STATE_IN_PROGRESS) {}
}
@ -498,17 +498,3 @@ uint8_t at86rf2xx_set_state(at86rf2xx_t *dev, uint8_t state)
return old_state;
}
void at86rf2xx_reset_state_machine(at86rf2xx_t *dev)
{
uint8_t old_state;
at86rf2xx_assert_awake(dev);
/* Wait for any state transitions to complete before forcing TRX_OFF */
do {
old_state = at86rf2xx_get_status(dev);
} while (old_state == AT86RF2XX_STATE_IN_PROGRESS);
at86rf2xx_set_state(dev, AT86RF2XX_STATE_FORCE_TRX_OFF);
}

View File

@ -127,9 +127,9 @@ void at86rf2xx_assert_awake(at86rf2xx_t *dev)
gpio_clear(dev->params.sleep_pin);
xtimer_usleep(AT86RF2XX_WAKEUP_DELAY);
/* update state: on some platforms, the timer behind xtimer
* may be inaccurate or the radio itself may take longer
* to wake up due to extra capacitance on the oscillator.
/* update state: on some platforms, the timer behind xtimer
* may be inaccurate or the radio itself may take longer
* to wake up due to extra capacitance on the oscillator.
* Spin until we are actually awake
*/
do {
@ -147,8 +147,8 @@ void at86rf2xx_hardware_reset(at86rf2xx_t *dev)
gpio_set(dev->params.reset_pin);
xtimer_usleep(AT86RF2XX_RESET_DELAY);
/* update state: if the radio state was P_ON (initialization phase),
* it remains P_ON. Otherwise, it should go to TRX_OFF
/* update state: if the radio state was P_ON (initialization phase),
* it remains P_ON. Otherwise, it should go to TRX_OFF
*/
do {
dev->state = at86rf2xx_reg_read(dev, AT86RF2XX_REG__TRX_STATUS) &

View File

@ -391,17 +391,6 @@ void at86rf2xx_set_option(at86rf2xx_t *dev, uint16_t option, bool state);
*/
uint8_t at86rf2xx_set_state(at86rf2xx_t *dev, uint8_t state);
/**
* @brief Reset the internal state machine to TRX_OFF mode.
*
* This will force a transition to TRX_OFF regardless of whether the transceiver
* is currently busy sending or receiving. This function is used to get back to
* a known state during driver initialization.
*
* @param[in] dev device to operate on
*/
void at86rf2xx_reset_state_machine(at86rf2xx_t *dev);
/**
* @brief Convenience function for simply sending data
*