802.15.4 STM S2LP driver update

Sync with master v1.0.4
pull/12950/head
Arto Kinnunen 2020-05-11 12:24:21 +03:00
parent cb94e609e1
commit e37631d68a
3 changed files with 22 additions and 5 deletions

View File

@ -5,10 +5,13 @@
"help": "Provide default NanostackRfpy. [true/false]",
"value": false
},
"target_overrides": {
"MTB_STM_S2LP": {
"s2lp.provide-default": true
}
"target_overrides": {
"MTB_STM_S2LP": {
"s2lp.provide-default": true
},
"MTB_STM_S2LP_CT": {
"s2lp.provide-default": true
}
}
}
}

View File

@ -207,6 +207,7 @@ static uint8_t s2lp_short_address[2];
static uint8_t s2lp_MAC[8];
static rf_mode_e rf_mode = RF_MODE_NORMAL;
static bool rf_update_config = false;
static bool rf_update_cca_threshold = false;
static uint16_t cur_packet_len = 0xffff;
static uint32_t receiver_ready_timestamp;
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
rf_receive(rf_rx_channel);
}
break;
case PHY_EXTENSION_SET_CHANNEL_CCA_THRESHOLD:
if ((rssi_threshold != (int8_t)*data_ptr) && (rf_state != RF_RX_STARTED)) {
rssi_threshold = (int8_t)*data_ptr;
rf_update_cca_threshold = true;
rf_receive(rf_rx_channel);
}
break;
default:
break;
}
@ -1047,6 +1055,12 @@ static void rf_receive(uint8_t rx_channel)
rf_update_config = false;
rf_set_channel_configuration_registers();
}
if (rf_update_cca_threshold == true) {
rf_update_cca_threshold = false;
uint8_t rssi_th;
rf_conf_calculate_rssi_threshold_registers(rssi_threshold, &rssi_th);
rf_write_register(RSSI_TH, rssi_th);
}
if (rx_channel != rf_rx_channel) {
rf_write_register(CHNUM, rx_channel * rf_channel_multiplier);
rf_rx_channel = rf_new_channel = rx_channel;

View File

@ -28,7 +28,7 @@
// Uncomment to use testing gpios attached to TX/RX processes
// #define TEST_GPIOS_ENABLED
#if defined(TARGET_MTB_STM_S2LP)
#if defined(TARGET_MTB_STM_S2LP) || defined(TARGET_MTB_STM_S2LP_CT)
#if !defined(S2LP_SPI_SDI)
#define S2LP_SPI_SDI PA_7
#endif