Skip to content

Commit e37631d

Browse files
author
Arto Kinnunen
committed
802.15.4 STM S2LP driver update
Sync with master v1.0.4
1 parent cb94e60 commit e37631d

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

components/802.15.4_RF/stm-s2lp-rf-driver/mbed_lib.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
"help": "Provide default NanostackRfpy. [true/false]",
66
"value": false
77
},
8-
"target_overrides": {
9-
"MTB_STM_S2LP": {
10-
"s2lp.provide-default": true
11-
}
8+
"target_overrides": {
9+
"MTB_STM_S2LP": {
10+
"s2lp.provide-default": true
11+
},
12+
"MTB_STM_S2LP_CT": {
13+
"s2lp.provide-default": true
14+
}
1215
}
1316
}
1417
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ static uint8_t s2lp_short_address[2];
207207
static uint8_t s2lp_MAC[8];
208208
static rf_mode_e rf_mode = RF_MODE_NORMAL;
209209
static bool rf_update_config = false;
210+
static bool rf_update_cca_threshold = false;
210211
static uint16_t cur_packet_len = 0xffff;
211212
static uint32_t receiver_ready_timestamp;
212213
static int16_t rssi_threshold = RSSI_THRESHOLD;
@@ -704,6 +705,13 @@ static int8_t rf_extension(phy_extension_type_e extension_type, uint8_t *data_pt
704705
rf_receive(rf_rx_channel);
705706
}
706707
break;
708+
case PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD:
709+
if ((rssi_threshold != (int8_t)*data_ptr) && (rf_state != RF_RX_STARTED)) {
710+
rssi_threshold = (int8_t)*data_ptr;
711+
rf_update_cca_threshold = true;
712+
rf_receive(rf_rx_channel);
713+
}
714+
break;
707715
default:
708716
break;
709717
}
@@ -1047,6 +1055,12 @@ static void rf_receive(uint8_t rx_channel)
10471055
rf_update_config = false;
10481056
rf_set_channel_configuration_registers();
10491057
}
1058+
if (rf_update_cca_threshold == true) {
1059+
rf_update_cca_threshold = false;
1060+
uint8_t rssi_th;
1061+
rf_conf_calculate_rssi_threshold_registers(rssi_threshold, &rssi_th);
1062+
rf_write_register(RSSI_TH, rssi_th);
1063+
}
10501064
if (rx_channel != rf_rx_channel) {
10511065
rf_write_register(CHNUM, rx_channel * rf_channel_multiplier);
10521066
rf_rx_channel = rf_new_channel = rx_channel;

components/802.15.4_RF/stm-s2lp-rf-driver/stm-s2lp-rf-driver/NanostackRfPhys2lp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// Uncomment to use testing gpios attached to TX/RX processes
2929
// #define TEST_GPIOS_ENABLED
3030

31-
#if defined(TARGET_MTB_STM_S2LP)
31+
#if defined(TARGET_MTB_STM_S2LP) || defined(TARGET_MTB_STM_S2LP_CT)
3232
#if !defined(S2LP_SPI_SDI)
3333
#define S2LP_SPI_SDI PA_7
3434
#endif

0 commit comments

Comments
 (0)