@@ -214,19 +214,16 @@ void LoRaMac::OnRadioTxDone( void )
214
214
// Setup timers
215
215
if ( _params.is_rx_window_enabled == true )
216
216
{
217
- _lora_time.TimerSetValue ( &_params.timers .rx_window1_timer , _params.rx_window1_delay );
218
- _lora_time.TimerStart ( &_params.timers .rx_window1_timer );
217
+ _lora_time.TimerStart ( _params.timers .rx_window1_timer , _params.rx_window1_delay );
219
218
if ( _params.dev_class != CLASS_C )
220
219
{
221
- _lora_time.TimerSetValue ( &_params.timers .rx_window2_timer , _params.rx_window2_delay );
222
- _lora_time.TimerStart ( &_params.timers .rx_window2_timer );
220
+ _lora_time.TimerStart ( _params.timers .rx_window2_timer , _params.rx_window2_delay );
223
221
}
224
222
if ( ( _params.dev_class == CLASS_C ) || ( _params.is_node_ack_requested == true ) )
225
223
{
226
224
getPhy.Attribute = PHY_ACK_TIMEOUT;
227
225
phyParam = lora_phy->get_phy_params (&getPhy);
228
- _lora_time.TimerSetValue ( &_params.timers .ack_timeout_timer , _params.rx_window2_delay + phyParam.Value );
229
- _lora_time.TimerStart ( &_params.timers .ack_timeout_timer );
226
+ _lora_time.TimerStart ( _params.timers .ack_timeout_timer , _params.rx_window2_delay + phyParam.Value );
230
227
}
231
228
}
232
229
else
@@ -281,8 +278,7 @@ void LoRaMac::PrepareRxDoneAbort( void )
281
278
_params.flags .bits .mac_done = 1 ;
282
279
283
280
// Trig OnMacCheckTimerEvent call as soon as possible
284
- _lora_time.TimerSetValue ( &_params.timers .mac_state_check_timer , 1 );
285
- _lora_time.TimerStart ( &_params.timers .mac_state_check_timer );
281
+ _lora_time.TimerStart ( _params.timers .mac_state_check_timer , 1 );
286
282
}
287
283
288
284
void LoRaMac::OnRadioRxDone ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
@@ -331,7 +327,7 @@ void LoRaMac::OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8
331
327
332
328
lora_phy->put_radio_to_sleep ();
333
329
334
- _lora_time.TimerStop ( & _params.timers .rx_window2_timer );
330
+ _lora_time.TimerStop ( _params.timers .rx_window2_timer );
335
331
336
332
macHdr.value = payload[pktHeaderLen++];
337
333
@@ -679,7 +675,7 @@ void LoRaMac::OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8
679
675
680
676
// Stop the AckTimeout timer as no more retransmissions
681
677
// are needed.
682
- _lora_time.TimerStop ( & _params.timers .ack_timeout_timer );
678
+ _lora_time.TimerStop ( _params.timers .ack_timeout_timer );
683
679
}
684
680
else
685
681
{
@@ -689,7 +685,7 @@ void LoRaMac::OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8
689
685
{
690
686
// Stop the AckTimeout timer as no more retransmissions
691
687
// are needed.
692
- _lora_time.TimerStop ( & _params.timers .ack_timeout_timer );
688
+ _lora_time.TimerStop ( _params.timers .ack_timeout_timer );
693
689
}
694
690
}
695
691
}
@@ -727,8 +723,7 @@ void LoRaMac::OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8
727
723
_params.flags .bits .mac_done = 1 ;
728
724
729
725
// Trig OnMacCheckTimerEvent call as soon as possible
730
- _lora_time.TimerSetValue ( &_params.timers .mac_state_check_timer , 1 );
731
- _lora_time.TimerStart ( &_params.timers .mac_state_check_timer );
726
+ _lora_time.TimerStart ( _params.timers .mac_state_check_timer , 1 );
732
727
}
733
728
734
729
void LoRaMac::OnRadioTxTimeout ( void )
@@ -771,7 +766,7 @@ void LoRaMac::OnRadioRxError( void )
771
766
772
767
if ( _lora_time.TimerGetElapsedTime ( _params.timers .aggregated_last_tx_time ) >= _params.rx_window2_delay )
773
768
{
774
- _lora_time.TimerStop ( & _params.timers .rx_window2_timer );
769
+ _lora_time.TimerStop ( _params.timers .rx_window2_timer );
775
770
_params.flags .bits .mac_done = 1 ;
776
771
}
777
772
}
@@ -809,7 +804,7 @@ void LoRaMac::OnRadioRxTimeout( void )
809
804
810
805
if ( _lora_time.TimerGetElapsedTime ( _params.timers .aggregated_last_tx_time ) >= _params.rx_window2_delay )
811
806
{
812
- _lora_time.TimerStop ( & _params.timers .rx_window2_timer );
807
+ _lora_time.TimerStop ( _params.timers .rx_window2_timer );
813
808
_params.flags .bits .mac_done = 1 ;
814
809
}
815
810
}
@@ -838,7 +833,7 @@ void LoRaMac::OnMacStateCheckTimerEvent( void )
838
833
PhyParam_t phyParam;
839
834
bool txTimeout = false ;
840
835
841
- _lora_time.TimerStop ( & _params.timers .mac_state_check_timer );
836
+ _lora_time.TimerStop ( _params.timers .mac_state_check_timer );
842
837
843
838
if ( _params.flags .bits .mac_done == 1 )
844
839
{
@@ -1024,9 +1019,7 @@ void LoRaMac::OnMacStateCheckTimerEvent( void )
1024
1019
else
1025
1020
{
1026
1021
// Operation not finished restart timer
1027
- _lora_time.TimerSetValue ( &_params.timers .mac_state_check_timer ,
1028
- MAC_STATE_CHECK_TIMEOUT );
1029
- _lora_time.TimerStart ( &_params.timers .mac_state_check_timer );
1022
+ _lora_time.TimerStart ( _params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1030
1023
}
1031
1024
1032
1025
// Handle MCPS indication
@@ -1058,7 +1051,7 @@ void LoRaMac::OnTxDelayedTimerEvent( void )
1058
1051
loramac_frame_ctrl_t fCtrl ;
1059
1052
AlternateDrParams_t altDr;
1060
1053
1061
- _lora_time.TimerStop ( & _params.timers .tx_delayed_timer );
1054
+ _lora_time.TimerStop ( _params.timers .tx_delayed_timer );
1062
1055
_params.mac_state &= ~LORAMAC_TX_DELAYED;
1063
1056
1064
1057
if ( ( _params.flags .bits .mlme_req == 1 ) && ( mlme.get_confirmation ().req_type == MLME_JOIN ) )
@@ -1085,7 +1078,7 @@ void LoRaMac::OnTxDelayedTimerEvent( void )
1085
1078
1086
1079
void LoRaMac::OnRxWindow1TimerEvent ( void )
1087
1080
{
1088
- _lora_time.TimerStop ( & _params.timers .rx_window1_timer );
1081
+ _lora_time.TimerStop ( _params.timers .rx_window1_timer );
1089
1082
_params.rx_slot = RX_SLOT_WIN_1;
1090
1083
1091
1084
_params.rx_window1_config .channel = _params.channel ;
@@ -1106,7 +1099,7 @@ void LoRaMac::OnRxWindow1TimerEvent( void )
1106
1099
1107
1100
void LoRaMac::OnRxWindow2TimerEvent ( void )
1108
1101
{
1109
- _lora_time.TimerStop ( & _params.timers .rx_window2_timer );
1102
+ _lora_time.TimerStop ( _params.timers .rx_window2_timer );
1110
1103
1111
1104
_params.rx_window2_config .channel = _params.channel ;
1112
1105
_params.rx_window2_config .frequency = _params.sys_params .rx2_channel .frequency ;
@@ -1133,7 +1126,7 @@ void LoRaMac::OnRxWindow2TimerEvent( void )
1133
1126
1134
1127
void LoRaMac::OnAckTimeoutTimerEvent ( void )
1135
1128
{
1136
- _lora_time.TimerStop ( & _params.timers .ack_timeout_timer );
1129
+ _lora_time.TimerStop ( _params.timers .ack_timeout_timer );
1137
1130
1138
1131
if ( _params.is_node_ack_requested == true )
1139
1132
{
@@ -1305,8 +1298,7 @@ lorawan_status_t LoRaMac::ScheduleTx( void )
1305
1298
_params.mac_state |= LORAMAC_TX_DELAYED;
1306
1299
tr_debug (" Next Transmission in %lu ms" , dutyCycleTimeOff);
1307
1300
1308
- _lora_time.TimerSetValue ( &_params.timers .tx_delayed_timer , dutyCycleTimeOff );
1309
- _lora_time.TimerStart ( &_params.timers .tx_delayed_timer );
1301
+ _lora_time.TimerStart ( _params.timers .tx_delayed_timer , dutyCycleTimeOff );
1310
1302
1311
1303
return LORAWAN_STATUS_OK;
1312
1304
}
@@ -1654,8 +1646,7 @@ lorawan_status_t LoRaMac::SendFrameOnChannel( uint8_t channel )
1654
1646
mlme.get_confirmation ().tx_toa = _params.timers .tx_toa ;
1655
1647
1656
1648
// Starts the MAC layer status check timer
1657
- _lora_time.TimerSetValue ( &_params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1658
- _lora_time.TimerStart ( &_params.timers .mac_state_check_timer );
1649
+ _lora_time.TimerStart ( _params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1659
1650
1660
1651
if ( _params.is_nwk_joined == false )
1661
1652
{
@@ -1684,8 +1675,7 @@ lorawan_status_t LoRaMac::SetTxContinuousWave( uint16_t timeout )
1684
1675
lora_phy->set_tx_cont_mode (&continuousWave);
1685
1676
1686
1677
// Starts the MAC layer status check timer
1687
- _lora_time.TimerSetValue ( &_params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1688
- _lora_time.TimerStart ( &_params.timers .mac_state_check_timer );
1678
+ _lora_time.TimerStart ( _params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1689
1679
1690
1680
_params.mac_state |= LORAMAC_TX_RUNNING;
1691
1681
@@ -1697,8 +1687,7 @@ lorawan_status_t LoRaMac::SetTxContinuousWave1( uint16_t timeout, uint32_t frequ
1697
1687
lora_phy->setup_tx_cont_wave_mode (frequency, power, timeout);
1698
1688
1699
1689
// Starts the MAC layer status check timer
1700
- _lora_time.TimerSetValue ( &_params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1701
- _lora_time.TimerStart ( &_params.timers .mac_state_check_timer );
1690
+ _lora_time.TimerStart ( _params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT );
1702
1691
1703
1692
_params.mac_state |= LORAMAC_TX_RUNNING;
1704
1693
@@ -1828,17 +1817,15 @@ lorawan_status_t LoRaMac::LoRaMacInitialization(loramac_primitives_t *primitives
1828
1817
lora_phy->put_radio_to_sleep ();
1829
1818
1830
1819
// Initialize timers
1831
- _lora_time.TimerInit (& _params.timers .mac_state_check_timer ,
1820
+ _lora_time.TimerInit (_params.timers .mac_state_check_timer ,
1832
1821
mbed::callback (this , &LoRaMac::handle_mac_state_check_timer_event));
1833
- _lora_time.TimerSetValue (&_params.timers .mac_state_check_timer , MAC_STATE_CHECK_TIMEOUT);
1834
-
1835
- _lora_time.TimerInit (&_params.timers .tx_delayed_timer ,
1822
+ _lora_time.TimerInit (_params.timers .tx_delayed_timer ,
1836
1823
mbed::callback (this , &LoRaMac::handle_delayed_tx_timer_event));
1837
- _lora_time.TimerInit (& _params.timers .rx_window1_timer ,
1824
+ _lora_time.TimerInit (_params.timers .rx_window1_timer ,
1838
1825
mbed::callback (this , &LoRaMac::handle_rx1_timer_event));
1839
- _lora_time.TimerInit (& _params.timers .rx_window2_timer ,
1826
+ _lora_time.TimerInit (_params.timers .rx_window2_timer ,
1840
1827
mbed::callback (this , &LoRaMac::handle_rx2_timer_event));
1841
- _lora_time.TimerInit (& _params.timers .ack_timeout_timer ,
1828
+ _lora_time.TimerInit (_params.timers .ack_timeout_timer ,
1842
1829
mbed::callback (this , &LoRaMac::handle_ack_timeout));
1843
1830
1844
1831
// Store the current initialization time
@@ -2071,16 +2058,13 @@ radio_events_t *LoRaMac::GetPhyEventHandlers()
2071
2058
2072
2059
lorawan_status_t LoRaMac::LoRaMacSetTxTimer ( uint32_t TxDutyCycleTime )
2073
2060
{
2074
- _lora_time.TimerSetValue (&tx_next_packet_timer, TxDutyCycleTime);
2075
- _lora_time.TimerStart (&tx_next_packet_timer);
2076
-
2061
+ _lora_time.TimerStart (tx_next_packet_timer, TxDutyCycleTime);
2077
2062
return LORAWAN_STATUS_OK;
2078
2063
}
2079
2064
2080
2065
lorawan_status_t LoRaMac::LoRaMacStopTxTimer ( )
2081
2066
{
2082
- _lora_time.TimerStop (&tx_next_packet_timer);
2083
-
2067
+ _lora_time.TimerStop (tx_next_packet_timer);
2084
2068
return LORAWAN_STATUS_OK;
2085
2069
}
2086
2070
0 commit comments