@@ -1064,7 +1064,7 @@ static void start_tx_transaction(void)
10641064
10651065 memcpy (pdu -> data , current_payload -> data , current_payload -> length );
10661066
1067- if (IS_ENABLED ( CONFIG_ESB_FAST_SWITCHING ) ) {
1067+ if (fast_switching ) {
10681068 nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
10691069 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
10701070 } else {
@@ -1093,7 +1093,7 @@ static void start_tx_transaction(void)
10931093 * selective auto ack is turned off
10941094 */
10951095 if (ack ) {
1096- if (IS_ENABLED ( CONFIG_ESB_FAST_SWITCHING ) ) {
1096+ if (fast_switching ) {
10971097 nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
10981098 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
10991099 } else {
@@ -1163,7 +1163,7 @@ static void start_tx_transaction(void)
11631163 if (is_tx_idle ) {
11641164 nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_START );
11651165 } else {
1166- esb_ppi_for_txrx_set (false, ack , fast_switching && ack );
1166+ esb_ppi_for_txrx_set (false, ack );
11671167 esb_fem_for_tx_set (ack );
11681168
11691169 radio_start ();
@@ -1200,7 +1200,7 @@ static void on_radio_end_tx_noack(void)
12001200static void on_radio_disabled_tx_noack (void )
12011201{
12021202 esb_fem_pa_reset ();
1203- esb_ppi_for_txrx_clear (false, false, false );
1203+ esb_ppi_for_txrx_clear (false, false);
12041204
12051205 interrupt_flags |= INT_TX_SUCCESS_MSK ;
12061206 tx_fifo_remove_last ();
@@ -1216,7 +1216,7 @@ static void on_radio_disabled_tx_noack(void)
12161216
12171217static void on_radio_disabled_tx (void )
12181218{
1219- esb_ppi_for_txrx_clear (false, true, fast_switching );
1219+ esb_ppi_for_txrx_clear (false, true);
12201220 /* The timer was triggered on radio disabled event so we can clear PPI connections here. */
12211221 esb_ppi_for_fem_clear ();
12221222 esb_fem_for_rx_ack ();
@@ -1255,6 +1255,9 @@ static void on_radio_disabled_tx(void)
12551255 }
12561256
12571257 nrf_radio_packetptr_set (NRF_RADIO , rx_payload_buffer );
1258+ if (fast_switching ) {
1259+ nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_RXEN );
1260+ }
12581261 on_radio_disabled = on_radio_disabled_tx_wait_for_ack ;
12591262 esb_state = ESB_STATE_PTX_RX_ACK ;
12601263}
@@ -1317,7 +1320,7 @@ static void on_radio_disabled_tx_wait_for_ack(void)
13171320 * be entered again as soon as the system timer reaches
13181321 * CC[1].
13191322 */
1320- if (IS_ENABLED ( CONFIG_ESB_FAST_SWITCHING ) ) {
1323+ if (fast_switching ) {
13211324 nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
13221325 } else {
13231326 nrf_radio_shorts_set (NRF_RADIO ,
@@ -1354,7 +1357,7 @@ static void on_radio_disabled_tx_wait_for_ack(void)
13541357 esb_ppi_for_retransmission_clear ();
13551358
13561359 /* Start radio here. */
1357- esb_ppi_for_txrx_set (false, true, fast_switching );
1360+ esb_ppi_for_txrx_set (false, true);
13581361 esb_fem_for_tx_set (true);
13591362
13601363 radio_start ();
@@ -1366,7 +1369,7 @@ static void on_radio_disabled_tx_wait_for_ack(void)
13661369static void clear_events_restart_rx (void )
13671370{
13681371 esb_fem_lna_reset ();
1369- esb_ppi_for_txrx_clear (true, false, fast_switching );
1372+ esb_ppi_for_txrx_clear (true, false);
13701373
13711374 nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
13721375
@@ -1385,7 +1388,7 @@ static void clear_events_restart_rx(void)
13851388
13861389 nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common | NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
13871390
1388- esb_ppi_for_txrx_set (true, false, fast_switching );
1391+ esb_ppi_for_txrx_set (true, false);
13891392 esb_fem_for_rx_set ();
13901393
13911394 radio_start ();
@@ -1473,13 +1476,6 @@ static void on_radio_disabled_rx(void)
14731476 if ((esb_cfg .selective_auto_ack == false) || rx_pdu -> type .dpl_pdu .no_ack ) {
14741477 esb_fem_for_tx_ack ();
14751478
1476- if (IS_ENABLED (CONFIG_ESB_FAST_SWITCHING )) {
1477- nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
1478- } else {
1479- nrf_radio_shorts_set (NRF_RADIO ,
1480- (radio_shorts_common | NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
1481- }
1482-
14831479 switch (esb_cfg .protocol ) {
14841480 case ESB_PROTOCOL_ESB_DPL :
14851481 on_radio_disabled_rx_dpl (retransmit_payload , pipe_info );
@@ -1501,6 +1497,14 @@ static void on_radio_disabled_rx(void)
15011497 nrf_radio_txaddress_set (NRF_RADIO , nrf_radio_rxmatch_get (NRF_RADIO ));
15021498 nrf_radio_packetptr_set (NRF_RADIO , tx_pdu );
15031499
1500+ if (fast_switching ) {
1501+ nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
1502+ nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_TXEN );
1503+ } else {
1504+ nrf_radio_shorts_set (NRF_RADIO ,
1505+ (radio_shorts_common | NRF_RADIO_SHORT_DISABLED_RXEN_MASK ));
1506+ }
1507+
15041508 on_radio_disabled = on_radio_disabled_rx_ack ;
15051509 } else {
15061510 clear_events_restart_rx ();
@@ -1522,17 +1526,16 @@ static void on_radio_disabled_rx_ack(void)
15221526{
15231527 esb_fem_for_ack_rx ();
15241528
1525- if (IS_ENABLED (CONFIG_ESB_FAST_SWITCHING )) {
1529+ update_rf_payload_format (esb_cfg .payload_length );
1530+
1531+ nrf_radio_packetptr_set (NRF_RADIO , rx_payload_buffer );
1532+ if (fast_switching ) {
15261533 nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
15271534 nrf_radio_task_trigger (NRF_RADIO , NRF_RADIO_TASK_RXEN );
15281535 } else {
15291536 nrf_radio_shorts_set (NRF_RADIO , (radio_shorts_common |
15301537 NRF_RADIO_SHORT_DISABLED_TXEN_MASK ));
15311538 }
1532-
1533- update_rf_payload_format (esb_cfg .payload_length );
1534-
1535- nrf_radio_packetptr_set (NRF_RADIO , rx_payload_buffer );
15361539 on_radio_disabled = on_radio_disabled_rx ;
15371540
15381541 esb_state = ESB_STATE_PRX ;
@@ -1703,7 +1706,7 @@ int esb_init(const struct esb_config *config)
17031706
17041707 memcpy (& esb_cfg , config , sizeof (esb_cfg ));
17051708
1706- if (IS_ENABLED ( CONFIG_ESB_FAST_SWITCHING ) ) {
1709+ if (fast_switching ) {
17071710 if (!esb_cfg .use_fast_ramp_up ) {
17081711 return - EINVAL ;
17091712 }
@@ -2038,7 +2041,7 @@ int esb_start_rx(void)
20382041
20392042 on_radio_disabled = on_radio_disabled_rx ;
20402043
2041- if (IS_ENABLED ( CONFIG_ESB_FAST_SWITCHING ) ) {
2044+ if (fast_switching ) {
20422045 nrf_radio_shorts_set (NRF_RADIO , radio_shorts_common );
20432046 nrf_radio_int_enable (NRF_RADIO , ESB_RADIO_INT_END_MASK );
20442047 } else {
@@ -2062,7 +2065,7 @@ int esb_start_rx(void)
20622065 nrf_radio_event_clear (NRF_RADIO , NRF_RADIO_EVENT_PAYLOAD );
20632066 nrf_radio_event_clear (NRF_RADIO , NRF_RADIO_EVENT_DISABLED );
20642067
2065- esb_ppi_for_txrx_set (true, false, fast_switching );
2068+ esb_ppi_for_txrx_set (true, false);
20662069 esb_fem_for_rx_set ();
20672070
20682071 radio_start ();
@@ -2076,7 +2079,7 @@ int esb_stop_rx(void)
20762079 return - EINVAL ;
20772080 }
20782081
2079- esb_ppi_for_txrx_clear (true, false, fast_switching );
2082+ esb_ppi_for_txrx_clear (true, false);
20802083 esb_fem_reset ();
20812084
20822085 nrf_radio_shorts_disable (NRF_RADIO , 0xFFFFFFFF );
0 commit comments