Skip to content

Commit 5b1839e

Browse files
committed
Release v4.3.1
1 parent ffca226 commit 5b1839e

File tree

40 files changed

+512
-544
lines changed

40 files changed

+512
-544
lines changed

CHANGELOG.md

Lines changed: 169 additions & 149 deletions
Large diffs are not rendered by default.

lbm_applications/1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_rtc.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,6 @@ uint32_t hal_rtc_get_time_s( void )
216216
return rtc_get_calendar_time( &milliseconds );
217217
}
218218

219-
uint32_t hal_rtc_get_time_100us( void )
220-
{
221-
uint32_t seconds = 0;
222-
uint16_t milliseconds_div_10 = 0;
223-
224-
seconds = rtc_get_calendar_time( &milliseconds_div_10 );
225-
226-
return seconds * 10000 + milliseconds_div_10;
227-
}
228219
uint32_t hal_rtc_get_time_ms( void )
229220
{
230221
uint32_t seconds = 0;

lbm_applications/1_thread_x_on_stm32_u5/smtc_hal_u5/smtc_hal_rtc.h

Lines changed: 69 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -35,91 +35,81 @@
3535
#define __RTC_UTILITIES_H__
3636

3737
#ifdef __cplusplus
38-
extern "C" {
38+
extern "C"
39+
{
3940
#endif
4041

41-
/*
42-
* -----------------------------------------------------------------------------
43-
* --- DEPENDENCIES ------------------------------------------------------------
44-
*/
45-
46-
#include <stdint.h> // C99 types
47-
#include <stdbool.h> // bool type
48-
/*
49-
* -----------------------------------------------------------------------------
50-
* --- PUBLIC MACROS -----------------------------------------------------------
51-
*/
52-
53-
/*
54-
* -----------------------------------------------------------------------------
55-
* --- PUBLIC CONSTANTS --------------------------------------------------------
56-
*/
57-
58-
/*
59-
* -----------------------------------------------------------------------------
60-
* --- PUBLIC TYPES ------------------------------------------------------------
61-
*/
62-
63-
/*
64-
* -----------------------------------------------------------------------------
65-
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
66-
*/
67-
68-
/*!
69-
* Initializes the MCU RTC peripheral
70-
*/
71-
void hal_rtc_init( void );
72-
73-
/*!
74-
* Returns the current RTC time in seconds
75-
*
76-
* \remark Used for scheduling autonomous retransmissions (i.e: NbTrans),
77-
* transmitting MAC answers, basically any delay without accurate time
78-
* constraints. It is also used to measure the time spent inside the
79-
* LoRaWAN process for the integrated failsafe.
80-
*
81-
* retval rtc_time_s Current RTC time in seconds
82-
*/
83-
uint32_t hal_rtc_get_time_s( void );
84-
85-
/*!
86-
* Returns the current RTC time in milliseconds
87-
*
88-
* \remark Used to timestamp radio events (i.e: end of TX), will also be used
89-
* for ClassB
90-
*
91-
* retval rtc_time_ms Current RTC time in milliseconds wraps every 49 days
92-
*/
93-
uint32_t hal_rtc_get_time_ms( void );
94-
95-
96-
/*!
97-
* Returns the current RTC time in 0.1milliseconds
98-
*
99-
* \remark will also be used for d2d
100-
*
101-
*
102-
* retval rtc_time_ms Current RTC time in milliseconds wraps every 4.9 days
103-
*/
104-
uint32_t hal_rtc_get_time_100us( void );
105-
106-
/*!
107-
* Sets the rtc wakeup timer for milliseconds parameter. The RTC will generate
108-
* an IRQ to wakeup the MCU.
109-
*
110-
* \param[IN] milliseconds Number of seconds before wakeup
111-
*/
112-
void hal_rtc_wakeup_timer_set_ms( const int32_t milliseconds );
113-
114-
/*!
115-
* Stop the rtc wakeup timer
116-
*/
117-
void hal_rtc_wakeup_timer_stop( void );
42+
/*
43+
* -----------------------------------------------------------------------------
44+
* --- DEPENDENCIES ------------------------------------------------------------
45+
*/
46+
47+
#include <stdint.h> // C99 types
48+
#include <stdbool.h> // bool type
49+
/*
50+
* -----------------------------------------------------------------------------
51+
* --- PUBLIC MACROS -----------------------------------------------------------
52+
*/
53+
54+
/*
55+
* -----------------------------------------------------------------------------
56+
* --- PUBLIC CONSTANTS --------------------------------------------------------
57+
*/
58+
59+
/*
60+
* -----------------------------------------------------------------------------
61+
* --- PUBLIC TYPES ------------------------------------------------------------
62+
*/
63+
64+
/*
65+
* -----------------------------------------------------------------------------
66+
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
67+
*/
68+
69+
/*!
70+
* Initializes the MCU RTC peripheral
71+
*/
72+
void hal_rtc_init(void);
73+
74+
/*!
75+
* Returns the current RTC time in seconds
76+
*
77+
* \remark Used for scheduling autonomous retransmissions (i.e: NbTrans),
78+
* transmitting MAC answers, basically any delay without accurate time
79+
* constraints. It is also used to measure the time spent inside the
80+
* LoRaWAN process for the integrated failsafe.
81+
*
82+
* retval rtc_time_s Current RTC time in seconds
83+
*/
84+
uint32_t hal_rtc_get_time_s(void);
85+
86+
/*!
87+
* Returns the current RTC time in milliseconds
88+
*
89+
* \remark Used to timestamp radio events (i.e: end of TX), will also be used
90+
* for ClassB
91+
*
92+
* retval rtc_time_ms Current RTC time in milliseconds wraps every 49 days
93+
*/
94+
uint32_t hal_rtc_get_time_ms(void);
95+
96+
/*!
97+
* Sets the rtc wakeup timer for milliseconds parameter. The RTC will generate
98+
* an IRQ to wakeup the MCU.
99+
*
100+
* \param[IN] milliseconds Number of seconds before wakeup
101+
*/
102+
void hal_rtc_wakeup_timer_set_ms(const int32_t milliseconds);
103+
104+
/*!
105+
* Stop the rtc wakeup timer
106+
*/
107+
void hal_rtc_wakeup_timer_stop(void);
118108

119109
#ifdef __cplusplus
120110
}
121111
#endif
122112

123-
#endif // __RTC_UTILITIES_H__
113+
#endif // __RTC_UTILITIES_H__
124114

125115
/* --- EOF ------------------------------------------------------------------ */

lbm_applications/1_thread_x_on_stm32_u5/smtc_modem_hal/smtc_modem_hal.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ uint32_t smtc_modem_hal_get_time_in_ms(void)
134134
return hal_rtc_get_time_ms();
135135
}
136136

137-
uint32_t smtc_modem_hal_get_time_in_100us(void)
138-
{
139-
return hal_rtc_get_time_100us();
140-
}
141137
void smtc_modem_hal_user_lbm_irq(void)
142138
{
143139
threadx_user_lbm_irq();

lbm_applications/2_porting_nrf_52840/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Reference Implementation 2: Porting on Nordic NRF25840 Board
1+
# Implementation reference 2: Porting on Nordic NRF52840 Board
22

33
This folder contains implementations of LoRa Basics Modem on some MCU boards and some application examples.
44

lbm_applications/2_porting_nrf_52840/radio_hal/sx126x_hal.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,10 @@ sx126x_hal_status_t sx126x_hal_write( const void* context, const uint8_t* comman
104104

105105
// Put NSS low to start spi transaction
106106
hal_gpio_set_value( RADIO_NSS, 0 );
107-
for( uint16_t i = 0; i < command_length; i++ )
108-
{
109-
hal_spi_in_out( RADIO_SPI_ID, command[i] );
110-
}
111-
for( uint16_t i = 0; i < data_length; i++ )
112-
{
113-
hal_spi_in_out( RADIO_SPI_ID, data[i] );
114-
}
107+
108+
hal_spi_in_out( RADIO_SPI_ID, command, command_length, NULL, 0 );
109+
hal_spi_in_out( RADIO_SPI_ID, data, data_length, NULL, 0 );
110+
115111
// Put NSS high as the spi transaction is finished
116112
hal_gpio_set_value( RADIO_NSS, 1 );
117113

@@ -135,13 +131,11 @@ sx126x_hal_status_t sx126x_hal_read( const void* context, const uint8_t* command
135131

136132
// Put NSS low to start spi transaction
137133
hal_gpio_set_value( RADIO_NSS, 0 );
138-
for( uint16_t i = 0; i < command_length; i++ )
139-
{
140-
hal_spi_in_out( RADIO_SPI_ID, command[i] );
141-
}
142-
for( uint16_t i = 0; i < data_length; i++ )
134+
hal_spi_in_out( RADIO_SPI_ID, command, command_length, NULL, 0 );
135+
136+
if( data_length > 0 )
143137
{
144-
data[i] = hal_spi_in_out( RADIO_SPI_ID, 0 );
138+
hal_spi_in_out( RADIO_SPI_ID, 0, 0, data, data_length );
145139
}
146140
// Put NSS high as the spi transaction is finished
147141
hal_gpio_set_value( RADIO_NSS, 1 );

lbm_applications/2_porting_nrf_52840/radio_hal/sx128x_hal.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,10 @@ sx128x_hal_status_t sx128x_hal_write( const void* context, const uint8_t* comman
103103

104104
// Put NSS low to start spi transaction
105105
hal_gpio_set_value( RADIO_NSS, 0 );
106-
for( uint16_t i = 0; i < command_length; i++ )
107-
{
108-
hal_spi_in_out( RADIO_SPI_ID, command[i] );
109-
}
110-
for( uint16_t i = 0; i < data_length; i++ )
111-
{
112-
hal_spi_in_out( RADIO_SPI_ID, data[i] );
113-
}
106+
107+
hal_spi_in_out( RADIO_SPI_ID, command, command_length, NULL, 0 );
108+
hal_spi_in_out( RADIO_SPI_ID, data, data_length, NULL, 0 );
109+
114110
// Put NSS high as the spi transaction is finished
115111
hal_gpio_set_value( RADIO_NSS, 1 );
116112

@@ -134,14 +130,13 @@ sx128x_hal_status_t sx128x_hal_read( const void* context, const uint8_t* command
134130

135131
// Put NSS low to start spi transaction
136132
hal_gpio_set_value( RADIO_NSS, 0 );
137-
for( uint16_t i = 0; i < command_length; i++ )
138-
{
139-
hal_spi_in_out( RADIO_SPI_ID, command[i] );
140-
}
141-
for( uint16_t i = 0; i < data_length; i++ )
133+
hal_spi_in_out( RADIO_SPI_ID, command, command_length, NULL, 0 );
134+
135+
if( data_length > 0 )
142136
{
143-
data[i] = hal_spi_in_out( RADIO_SPI_ID, 0 );
137+
hal_spi_in_out( RADIO_SPI_ID, 0, 0, data, data_length );
144138
}
139+
145140
// Put NSS high as the spi transaction is finished
146141
hal_gpio_set_value( RADIO_NSS, 1 );
147142

lbm_applications/2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_rtc.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,17 @@ void hal_rtc_init( void )
9999
uint32_t hal_rtc_get_time_s( void )
100100
{
101101
uint32_t tmp_rtc = nrf_drv_rtc_counter_get( &rtc1 );
102-
uint64_t tmp = ( ( uint64_t )( tmp_rtc ) + ( uint64_t )( ( 1 << 24 ) * rtc_wrap_counter ) ) /
102+
uint64_t tmp = ( ( uint64_t ) ( tmp_rtc ) + ( uint64_t ) ( ( 1ULL << 24 ) * ( uint64_t ) rtc_wrap_counter ) ) /
103103
NRFX_RTC_DEFAULT_CONFIG_FREQUENCY;
104104
return ( uint32_t ) tmp;
105105
}
106106

107107
uint32_t hal_rtc_get_time_ms( void )
108108
{
109109
uint32_t tmp_rtc = nrf_drv_rtc_counter_get( &rtc1 );
110-
uint64_t tmp = ( ( ( uint64_t )( tmp_rtc ) + ( uint64_t )( ( 1 << 24 ) * rtc_wrap_counter ) ) * 1000 ) /
111-
NRFX_RTC_DEFAULT_CONFIG_FREQUENCY;
112-
return ( uint32_t ) tmp;
113-
}
114-
115-
uint32_t hal_rtc_get_time_100us( void )
116-
{
117-
uint32_t tmp_rtc = nrf_drv_rtc_counter_get( &rtc1 );
118-
uint64_t tmp = ( ( ( uint64_t )( tmp_rtc ) + ( uint64_t )( ( 1 << 24 ) * rtc_wrap_counter ) ) * 10000 ) /
119-
NRFX_RTC_DEFAULT_CONFIG_FREQUENCY;
110+
uint64_t tmp =
111+
( ( ( uint64_t ) ( tmp_rtc ) + ( uint64_t ) ( ( 1ULL << 24 ) * ( uint64_t ) rtc_wrap_counter ) ) * 1000 ) /
112+
NRFX_RTC_DEFAULT_CONFIG_FREQUENCY;
120113
return ( uint32_t ) tmp;
121114
}
122115

lbm_applications/2_porting_nrf_52840/smtc_hal_nrf52840/smtc_hal_rtc.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,6 @@ uint32_t hal_rtc_get_time_s( void );
101101
*/
102102
uint32_t hal_rtc_get_time_ms( void );
103103

104-
/*!
105-
* Returns the current RTC time in 0.1milliseconds
106-
*
107-
* \remark will also be used for d2d
108-
*
109-
*
110-
* retval rtc_time_ms Current RTC time in milliseconds wraps every 4.9 days
111-
*/
112-
uint32_t hal_rtc_get_time_100us( void );
113-
114104
/*!
115105
* Starts the provided timer objet for the given time
116106
*

lbm_applications/2_porting_nrf_52840/smtc_modem_hal/smtc_modem_hal.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ uint32_t smtc_modem_hal_get_time_in_ms( void )
138138
return hal_rtc_get_time_ms( );
139139
}
140140

141-
uint32_t smtc_modem_hal_get_time_in_100us( void )
142-
{
143-
return hal_rtc_get_time_100us( );
144-
}
145-
146141
/* ------------ Timer management ------------*/
147142

148143
void smtc_modem_hal_start_timer( const uint32_t milliseconds, void ( *callback )( void* context ), void* context )

0 commit comments

Comments
 (0)