summaryrefslogtreecommitdiff
path: root/nrf-softdevice/src/softdevice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'nrf-softdevice/src/softdevice.rs')
-rw-r--r--nrf-softdevice/src/softdevice.rs47
1 files changed, 15 insertions, 32 deletions
diff --git a/nrf-softdevice/src/softdevice.rs b/nrf-softdevice/src/softdevice.rs
index 282ba04..84248e8 100644
--- a/nrf-softdevice/src/softdevice.rs
+++ b/nrf-softdevice/src/softdevice.rs
@@ -1,11 +1,10 @@
use core::marker::PhantomData;
use core::ptr;
use core::sync::atomic::{AtomicBool, Ordering};
+
use embassy::util::Forever;
-use crate::raw;
-use crate::RawError;
-use crate::{pac, SocEvent};
+use crate::{pac, raw, RawError, SocEvent};
unsafe extern "C" fn fault_handler(id: u32, pc: u32, info: u32) {
match (id, info) {
@@ -148,9 +147,7 @@ impl Softdevice {
&raw::ble_cfg_t {
conn_cfg: raw::ble_conn_cfg_t {
conn_cfg_tag: APP_CONN_CFG_TAG,
- params: raw::ble_conn_cfg_t__bindgen_ty_1 {
- gattc_conn_cfg: val,
- },
+ params: raw::ble_conn_cfg_t__bindgen_ty_1 { gattc_conn_cfg: val },
},
},
);
@@ -162,9 +159,7 @@ impl Softdevice {
&raw::ble_cfg_t {
conn_cfg: raw::ble_conn_cfg_t {
conn_cfg_tag: APP_CONN_CFG_TAG,
- params: raw::ble_conn_cfg_t__bindgen_ty_1 {
- gatts_conn_cfg: val,
- },
+ params: raw::ble_conn_cfg_t__bindgen_ty_1 { gatts_conn_cfg: val },
},
},
);
@@ -177,9 +172,7 @@ impl Softdevice {
&raw::ble_cfg_t {
conn_cfg: raw::ble_conn_cfg_t {
conn_cfg_tag: APP_CONN_CFG_TAG,
- params: raw::ble_conn_cfg_t__bindgen_ty_1 {
- l2cap_conn_cfg: val,
- },
+ params: raw::ble_conn_cfg_t__bindgen_ty_1 { l2cap_conn_cfg: val },
},
},
);
@@ -198,9 +191,7 @@ impl Softdevice {
cfg_set(
raw::BLE_GAP_CFGS_BLE_GAP_CFG_ROLE_COUNT,
&raw::ble_cfg_t {
- gap_cfg: raw::ble_gap_cfg_t {
- role_count_cfg: val,
- },
+ gap_cfg: raw::ble_gap_cfg_t { role_count_cfg: val },
},
);
}
@@ -209,9 +200,7 @@ impl Softdevice {
cfg_set(
raw::BLE_GAP_CFGS_BLE_GAP_CFG_DEVICE_NAME,
&raw::ble_cfg_t {
- gap_cfg: raw::ble_gap_cfg_t {
- device_name_cfg: val,
- },
+ gap_cfg: raw::ble_gap_cfg_t { device_name_cfg: val },
},
);
}
@@ -220,9 +209,7 @@ impl Softdevice {
cfg_set(
raw::BLE_GAP_CFGS_BLE_GAP_CFG_PPCP_INCL_CONFIG,
&raw::ble_cfg_t {
- gap_cfg: raw::ble_gap_cfg_t {
- ppcp_include_cfg: val,
- },
+ gap_cfg: raw::ble_gap_cfg_t { ppcp_include_cfg: val },
},
);
}
@@ -231,9 +218,7 @@ impl Softdevice {
cfg_set(
raw::BLE_GAP_CFGS_BLE_GAP_CFG_CAR_INCL_CONFIG,
&raw::ble_cfg_t {
- gap_cfg: raw::ble_gap_cfg_t {
- car_include_cfg: val,
- },
+ gap_cfg: raw::ble_gap_cfg_t { car_include_cfg: val },
},
);
}
@@ -241,9 +226,7 @@ impl Softdevice {
cfg_set(
raw::BLE_GATTS_CFGS_BLE_GATTS_CFG_SERVICE_CHANGED,
&raw::ble_cfg_t {
- gatts_cfg: raw::ble_gatts_cfg_t {
- service_changed: val,
- },
+ gatts_cfg: raw::ble_gatts_cfg_t { service_changed: val },
},
);
}
@@ -258,17 +241,17 @@ impl Softdevice {
let mut wanted_app_ram_base = app_ram_base;
let ret = unsafe { raw::sd_ble_enable(&mut wanted_app_ram_base as _) };
- info!(
- "softdevice RAM: {:?} bytes",
- wanted_app_ram_base - 0x20000000
- );
+ info!("softdevice RAM: {:?} bytes", wanted_app_ram_base - 0x20000000);
match RawError::convert(ret) {
Ok(()) => {}
Err(RawError::NoMem) => {
if wanted_app_ram_base <= app_ram_base {
panic!("selected configuration has too high RAM requirements.")
} else {
- panic!("too little RAM for softdevice. Change your app's RAM start address to {:x}", wanted_app_ram_base);
+ panic!(
+ "too little RAM for softdevice. Change your app's RAM start address to {:x}",
+ wanted_app_ram_base
+ );
}
}
Err(err) => panic!("sd_ble_enable err {:?}", err),