Simpler, though not necessary better.
authorNathael Pajani <nathael.pajani@ed3l.fr>
Fri, 18 Sep 2015 12:30:25 +0000 (14:30 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Tue, 8 Nov 2022 16:03:04 +0000 (17:03 +0100)
extdrv/cc1101.c

index 36d269a..8a54365 100644 (file)
@@ -159,12 +159,11 @@ void cc1101_enter_rx_mode(void)
 static uint8_t cc1101_enter_tx_mode(void)
 {
        uint8_t status = (cc1101_read_status() & CC1101_STATE_MASK);
-       if (status != CC1101_STATE_TX) {
-               if ((status != CC1101_STATE_FSTON) && (status != CC1101_STATE_RX)) {
+       if (status > CC1101_STATE_FSTON) {
                        cc1101_send_cmd(CC1101_CMD(state_idle));
-               }
-               cc1101_send_cmd(CC1101_CMD(state_tx));
        }
+       cc1101_send_cmd(CC1101_CMD(state_tx));
+
        /* Wait until chip is in Tx state */
        do {
                status = (cc1101_read_status() & CC1101_STATE_MASK);