Skip to content

Commit 7b57ac6

Browse files
authored
Merge pull request #13559 from artokin/nanostack_release_v12_5_0_mbedos_5_15
[mbed-os-5.15] Nanostack release v12.5.0
2 parents 4c3155a + cbfbca5 commit 7b57ac6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2916
-466
lines changed

components/802.15.4_RF/atmel-rf-driver/atmel-rf-driver/NanostackRfPhyAtmel.h

Lines changed: 77 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,60 +20,107 @@
2020
#include "at24mac.h"
2121
#include "PinNames.h"
2222

23-
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_I2C && defined(MBED_CONF_RTOS_PRESENT)
23+
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_I2C && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT)
2424

2525
#include "NanostackRfPhy.h"
2626

2727
// Uncomment to use testing gpios attached to TX/RX processes
2828
// #define TEST_GPIOS_ENABLED
2929

3030
// Arduino pin defaults for convenience
31-
#if !defined(ATMEL_SPI_MOSI)
32-
#define ATMEL_SPI_MOSI D11
31+
#if defined(MBED_CONF_ATMEL_RF_SPI_MOSI)
32+
#define ATMEL_SPI_MOSI MBED_CONF_ATMEL_RF_SPI_MOSI
33+
#else
34+
#define ATMEL_SPI_MOSI D11
3335
#endif
34-
#if !defined(ATMEL_SPI_MISO)
35-
#define ATMEL_SPI_MISO D12
36+
37+
#if defined(MBED_CONF_ATMEL_RF_SPI_MISO)
38+
#define ATMEL_SPI_MISO MBED_CONF_ATMEL_RF_SPI_MISO
39+
#else
40+
#define ATMEL_SPI_MISO D12
3641
#endif
37-
#if !defined(ATMEL_SPI_SCLK)
38-
#define ATMEL_SPI_SCLK D13
42+
43+
#if defined(MBED_CONF_ATMEL_RF_SPI_SCLK)
44+
#define ATMEL_SPI_SCLK MBED_CONF_ATMEL_RF_SPI_SCLK
45+
#else
46+
#define ATMEL_SPI_SCLK D13
3947
#endif
40-
#if !defined(ATMEL_SPI_CS)
41-
#define ATMEL_SPI_CS D10
48+
49+
#if defined(MBED_CONF_ATMEL_RF_SPI_CS)
50+
#define ATMEL_SPI_CS MBED_CONF_ATMEL_RF_SPI_CS
51+
#else
52+
#define ATMEL_SPI_CS D10
4253
#endif
43-
#if !defined(ATMEL_SPI_RST)
44-
#define ATMEL_SPI_RST D5
54+
55+
#if defined(MBED_CONF_ATMEL_RF_SPI_RST)
56+
#define ATMEL_SPI_RST MBED_CONF_ATMEL_RF_SPI_RST
57+
#else
58+
#define ATMEL_SPI_RST D5
4559
#endif
46-
#if !defined(ATMEL_SPI_SLP)
47-
#define ATMEL_SPI_SLP D7
60+
61+
#if defined(MBED_CONF_ATMEL_RF_SPI_SLP)
62+
#define ATMEL_SPI_SLP MBED_CONF_ATMEL_RF_SPI_SLP
63+
#else
64+
#define ATMEL_SPI_SLP D7
4865
#endif
49-
#if !defined(ATMEL_SPI_IRQ)
50-
#define ATMEL_SPI_IRQ D9
66+
67+
#if defined(MBED_CONF_ATMEL_RF_SPI_IRQ)
68+
#define ATMEL_SPI_IRQ MBED_CONF_ATMEL_RF_SPI_IRQ
69+
#else
70+
#define ATMEL_SPI_IRQ D9
5171
#endif
52-
#if !defined(ATMEL_I2C_SDA)
53-
#define ATMEL_I2C_SDA D14
72+
73+
#if defined(MBED_CONF_ATMEL_RF_I2C_SDA)
74+
#define ATMEL_I2C_SDA MBED_CONF_ATMEL_RF_I2C_SDA
75+
#else
76+
#define ATMEL_I2C_SDA D14
5477
#endif
55-
#if !defined(ATMEL_I2C_SCL)
56-
#define ATMEL_I2C_SCL D15
78+
79+
#if defined(MBED_CONF_ATMEL_RF_I2C_SCL)
80+
#define ATMEL_I2C_SCL MBED_CONF_ATMEL_RF_I2C_SCL
81+
#else
82+
#define ATMEL_I2C_SCL D15
5783
#endif
58-
#if !defined(TEST_PIN_TX)
59-
#define TEST_PIN_TX D6
84+
85+
#if defined(MBED_CONF_ATMEL_RF_TEST_PIN_TX)
86+
#define TEST_PIN_TX MBED_CONF_ATMEL_RF_TEST_PIN_TX
87+
#else
88+
#define TEST_PIN_TX D6
6089
#endif
61-
#if !defined(TEST_PIN_RX)
62-
#define TEST_PIN_RX D3
90+
91+
#if defined(MBED_CONF_ATMEL_RF_TEST_PIN_RX)
92+
#define TEST_PIN_RX MBED_CONF_ATMEL_RF_TEST_PIN_RX
93+
#else
94+
#define TEST_PIN_RX D3
6395
#endif
64-
#if !defined(TEST_PIN_CSMA)
65-
#define TEST_PIN_CSMA D4
96+
97+
#if defined(MBED_CONF_ATMEL_RF_TEST_PIN_CSMA)
98+
#define TEST_PIN_CSMA MBED_CONF_ATMEL_RF_TEST_PIN_CSMA
99+
#else
100+
#define TEST_PIN_CSMA D4
66101
#endif
67-
#if !defined(TEST_PIN_SPARE_1)
102+
103+
#if defined(MBED_CONF_ATMEL_RF_TEST_PIN_SPARE_1)
104+
#define TEST_PIN_SPARE_1 MBED_CONF_ATMEL_RF_TEST_PIN_SPARE_1
105+
#else
68106
#define TEST_PIN_SPARE_1 D2
69107
#endif
70-
#if !defined(TEST_PIN_SPARE_2)
108+
109+
#if defined(MBED_CONF_ATMEL_RF_TEST_PIN_SPARE_2)
110+
#define TEST_PIN_SPARE_2 MBED_CONF_ATMEL_RF_TEST_PIN_SPARE_2
111+
#else
71112
#define TEST_PIN_SPARE_2 D8
72113
#endif
73-
#if !defined(SE2435L_CSD)
74-
#define SE2435L_CSD D2
114+
115+
#if defined(MBED_CONF_ATMEL_RF_SE2435L_CSD)
116+
#define SE2435L_CSD MBED_CONF_ATMEL_RF_SE2435L_CSD
117+
#else
118+
#define SE2435L_CSD D2
75119
#endif
76-
#if !defined(SE2435L_ANT_SEL)
120+
121+
#if defined(MBED_CONF_ATMEL_RF_SE2435L_ANT_SEL)
122+
#define SE2435L_ANT_SEL MBED_CONF_ATMEL_RF_SE2435L_ANT_SEL
123+
#else
77124
#define SE2435L_ANT_SEL D8
78125
#endif
79126

components/802.15.4_RF/atmel-rf-driver/mbed_lib.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,70 @@
11
{
22
"name": "atmel-rf",
33
"config": {
4+
"SPI_MOSI": {
5+
"help": "SPI_MOSI pin configured for SPI connection.",
6+
"value": null
7+
},
8+
"SPI_MISO": {
9+
"help": "SPI_MISO pin configured for SPI connection.",
10+
"value": null
11+
},
12+
"SPI_SCLK": {
13+
"help": "SPI_SCLK pin configured for SPI connection.",
14+
"value": null
15+
},
16+
"SPI_CS": {
17+
"help": "SPI_CS pin configured for SPI connection.",
18+
"value": null
19+
},
20+
"SPI_RST": {
21+
"help": "SPI_RST pin configured for SPI connection.",
22+
"value": null
23+
},
24+
"SPI_SLP": {
25+
"help": "SPI_SLP pin configured for SPI connection.",
26+
"value": null
27+
},
28+
"SPI_IRQ": {
29+
"help": "SPI_IRQ pin configured for SPI connection.",
30+
"value": null
31+
},
32+
"I2C_SDA": {
33+
"help": "I2C_SDA pin configured for I2C connection.",
34+
"value": null
35+
},
36+
"I2C_SCL": {
37+
"help": "I2C_SCL pin configured for I2C connection.",
38+
"value": null
39+
},
40+
"TEST_PIN_TX": {
41+
"help": "TEST_PIN_TX pin configured for TX.",
42+
"value": null
43+
},
44+
"TEST_PIN_RX": {
45+
"help": "TEST_PIN_RX pin configured for RX.",
46+
"value": null
47+
},
48+
"TEST_PIN_CSMA": {
49+
"help": "TEST_PIN_CSMA pin configured for CSMA.",
50+
"value": null
51+
},
52+
"TEST_PIN_SPARE_1": {
53+
"help": "TEST_PIN_SPARE_1.",
54+
"value": null
55+
},
56+
"TEST_PIN_SPARE_2": {
57+
"help": "TEST_PIN_SPARE_2.",
58+
"value": null
59+
},
60+
"SE2435L_CSD": {
61+
"help": "SE2435L_CSD pin configuration.",
62+
"value": null
63+
},
64+
"SE2435L_ANT_SEL": {
65+
"help": "SE2435L_ANT_SEL pin confuguration.",
66+
"value": null
67+
},
468
"full-spi-speed": {
569
"help": "Maximum SPI clock speed (Hz), as long as sufficient inter-byte spacing",
670
"value": 7500000

components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAT86RF215.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <string.h>
1818

19-
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT)
19+
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_I2C && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT)
2020

2121
#include "ns_types.h"
2222
#include "platform/arm_hal_interrupt.h"

components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@
3434
#include "inttypes.h"
3535
#include "Timeout.h"
3636
#include "platform/mbed_error.h"
37+
#include "platform/mbed_version.h"
38+
39+
#if (MBED_VERSION > MBED_ENCODE_VERSION(6, 0, 0))
40+
/* Mbed OS 6.0 introduces support for chrono time management */
41+
using namespace std::chrono;
42+
#define ATMEL_RF_TIME_50US 50us
43+
#define ATMEL_RF_TIME_2MS 2ms
44+
#define ATMEL_RF_TIME_10MS 10ms
45+
#define ATMEL_RF_ATTACH(timer_ref, signal_ref, timeout_ref) timer_ref.attach(signal_ref, timeout_ref)
46+
#else
47+
#define ATMEL_RF_TIME_50US 50
48+
#define ATMEL_RF_TIME_2MS 2
49+
#define ATMEL_RF_TIME_10MS 10
50+
#define ATMEL_RF_ATTACH(timer_ref, signal_ref, timeout_ref) timer_ref.attach_us(signal_ref, timeout_ref)
51+
#endif
3752

3853
#define TRACE_GROUP "AtRF"
3954

@@ -345,7 +360,6 @@ static rf_trx_part_e rf_radio_type_read(void)
345360
return ret_val;
346361
}
347362

348-
349363
/*
350364
* \brief Function starts the ACK wait timeout.
351365
*
@@ -356,9 +370,9 @@ static rf_trx_part_e rf_radio_type_read(void)
356370
static void rf_if_ack_wait_timer_start(uint16_t slots)
357371
{
358372
#ifdef MBED_CONF_RTOS_PRESENT
359-
rf->ack_timer.attach_us(rf_if_ack_timer_signal, slots * 50);
373+
ATMEL_RF_ATTACH(rf->ack_timer, rf_if_ack_timer_signal, slots * ATMEL_RF_TIME_50US);
360374
#else
361-
rf->ack_timer.attach_us(rf_ack_wait_timer_interrupt, slots * 50);
375+
ATMEL_RF_ATTACH(rf->ack_timer, rf_ack_wait_timer_interrupt, slots * ATMEL_RF_TIME_50US);
362376
#endif
363377
}
364378

@@ -372,9 +386,9 @@ static void rf_if_ack_wait_timer_start(uint16_t slots)
372386
static void rf_if_calibration_timer_start(uint32_t slots)
373387
{
374388
#ifdef MBED_CONF_RTOS_PRESENT
375-
rf->cal_timer.attach_us(rf_if_cal_timer_signal, slots * 50);
389+
ATMEL_RF_ATTACH(rf->cal_timer, rf_if_cal_timer_signal, slots * ATMEL_RF_TIME_50US);
376390
#else
377-
rf->cal_timer.attach_us(rf_calibration_timer_interrupt, slots * 50);
391+
ATMEL_RF_ATTACH(rf->cal_timer, rf_calibration_timer_interrupt, slots * ATMEL_RF_TIME_50US);
378392
#endif
379393
}
380394

@@ -388,9 +402,9 @@ static void rf_if_calibration_timer_start(uint32_t slots)
388402
static void rf_if_cca_timer_start(uint32_t slots)
389403
{
390404
#ifdef MBED_CONF_RTOS_PRESENT
391-
rf->cca_timer.attach_us(rf_if_cca_timer_signal, slots * 50);
405+
ATMEL_RF_ATTACH(rf->cca_timer, rf_if_cca_timer_signal, slots * ATMEL_RF_TIME_50US);
392406
#else
393-
rf->cca_timer.attach_us(rf_cca_timer_interrupt, slots * 50);
407+
ATMEL_RF_ATTACH(rf->cca_timer, rf_cca_timer_interrupt, slots * ATMEL_RF_TIME_50US);
394408
#endif
395409
}
396410

@@ -519,14 +533,14 @@ static void rf_if_reset_radio(void)
519533
#endif
520534
rf->IRQ.rise(nullptr);
521535
rf->RST = 1;
522-
ThisThread::sleep_for(2);
536+
ThisThread::sleep_for(ATMEL_RF_TIME_2MS);
523537
rf->RST = 0;
524-
ThisThread::sleep_for(10);
538+
ThisThread::sleep_for(ATMEL_RF_TIME_10MS);
525539
CS_RELEASE();
526540
rf->SLP_TR = 0;
527-
ThisThread::sleep_for(10);
541+
ThisThread::sleep_for(ATMEL_RF_TIME_10MS);
528542
rf->RST = 1;
529-
ThisThread::sleep_for(10);
543+
ThisThread::sleep_for(ATMEL_RF_TIME_10MS);
530544

531545
rf->IRQ.rise(&rf_if_interrupt_handler);
532546
}

components/802.15.4_RF/atmel-rf-driver/source/rfbits.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef RFBITS_H_
1818
#define RFBITS_H_
1919

20+
#if DEVICE_SPI
21+
2022
#include "DigitalIn.h"
2123
#include "DigitalOut.h"
2224
#include "InterruptIn.h"
@@ -78,4 +80,5 @@ class Se2435Pins {
7880
DigitalOut ANT_SEL;
7981
};
8082

83+
#endif /* DEVICE_SPI */
8184
#endif /* RFBITS_H_ */

components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
#include <string.h>
1717
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT)
18+
1819
#include "platform/arm_hal_interrupt.h"
1920
#include "nanostack/platform/arm_hal_phy.h"
2021
#include "ns_types.h"
@@ -30,6 +31,17 @@
3031
#include "Thread.h"
3132
#include "mbed_wait_api.h"
3233
#include "platform/mbed_error.h"
34+
#include "platform/mbed_version.h"
35+
36+
#if (MBED_VERSION > MBED_ENCODE_VERSION(6, 0, 0))
37+
/* Mbed OS 6.0 introduces support for chrono time management */
38+
using namespace std::chrono;
39+
#define S2LP_USE_CHRONO
40+
#define S2LP_TIME_50US 50us
41+
#define S2LP_TIME_10MS 10ms
42+
#else
43+
#define S2LP_TIME_10MS 10
44+
#endif
3345

3446
using namespace mbed;
3547
using namespace rtos;
@@ -276,7 +288,11 @@ static void rf_calculate_symbol_rate(uint32_t baudrate, phy_modulation_e modulat
276288

277289
static uint32_t rf_get_timestamp(void)
278290
{
291+
#ifdef S2LP_USE_CHRONO
292+
return (uint32_t)rf->tx_timer.elapsed_time().count();
293+
#else
279294
return (uint32_t)rf->tx_timer.read_us();
295+
#endif
280296
}
281297

282298
static void rf_update_tx_active_time(void)
@@ -866,7 +882,11 @@ static void rf_cca_timer_stop(void)
866882

867883
static void rf_cca_timer_start(uint32_t slots)
868884
{
885+
#ifdef S2LP_USE_CHRONO
886+
rf->cca_timer.attach(rf_cca_timer_signal, microseconds(slots));
887+
#else
869888
rf->cca_timer.attach_us(rf_cca_timer_signal, slots);
889+
#endif
870890
TEST_CSMA_STARTED
871891
}
872892

@@ -903,7 +923,11 @@ static void rf_backup_timer_stop(void)
903923

904924
static void rf_backup_timer_start(uint32_t slots)
905925
{
926+
#ifdef S2LP_USE_CHRONO
927+
rf->backup_timer.attach(rf_backup_timer_signal, microseconds(slots));
928+
#else
906929
rf->backup_timer.attach_us(rf_backup_timer_signal, slots);
930+
#endif
907931
}
908932

909933
static int8_t rf_start_cca(uint8_t *data_ptr, uint16_t data_length, uint8_t tx_handle, data_protocol_e data_protocol)
@@ -1177,10 +1201,10 @@ static void rf_reset(void)
11771201
{
11781202
// Shutdown
11791203
rf->SDN = 1;
1180-
ThisThread::sleep_for(10);
1204+
ThisThread::sleep_for(S2LP_TIME_10MS);
11811205
// Wake up
11821206
rf->SDN = 0;
1183-
ThisThread::sleep_for(10);
1207+
ThisThread::sleep_for(S2LP_TIME_10MS);
11841208
}
11851209

11861210
static void rf_init(void)

0 commit comments

Comments
 (0)