summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2021-02-26 01:08:04 +0100
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2021-02-26 01:10:17 +0100
commita1a0d87a14c047c8b2838ec2f8c62a5ca8875406 (patch)
treebba95bfbd3ba8e5c8651d0df0d238eb2d1dc88f2 /examples
parent6cf4ada4e51f37b774f3b9000f2c75fd08cf46c3 (diff)
downloadnrf-softdevice-a1a0d87a14c047c8b2838ec2f8c62a5ca8875406.zip
Fix warnings. Closes #39
Diffstat (limited to 'examples')
-rw-r--r--examples/src/bin/ble_bas_central.rs6
-rw-r--r--examples/src/bin/ble_bas_peripheral.rs12
-rw-r--r--examples/src/bin/ble_l2cap_central.rs7
-rw-r--r--examples/src/bin/ble_l2cap_peripheral.rs10
-rw-r--r--examples/src/bin/ble_peripheral_onoff.rs4
-rw-r--r--examples/src/bin/ble_scan.rs6
-rw-r--r--examples/src/bin/flash.rs4
-rw-r--r--examples/src/bin/interrupts.rs6
-rw-r--r--examples/src/bin/rtic.rs6
-rw-r--r--examples/src/example_common.rs1
10 files changed, 29 insertions, 33 deletions
diff --git a/examples/src/bin/ble_bas_central.rs b/examples/src/bin/ble_bas_central.rs
index d601cb8..9ee9a0b 100644
--- a/examples/src/bin/ble_bas_central.rs
+++ b/examples/src/bin/ble_bas_central.rs
@@ -10,11 +10,11 @@ use example_common::*;
use core::mem;
use cortex_m_rt::entry;
use defmt::info;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::{task, Executor};
use embassy::util::Forever;
-use nrf_softdevice::ble::{central, gatt_client, Address, AddressType, Connection, Uuid};
+use nrf_softdevice::ble::{central, gatt_client, Address, AddressType};
use nrf_softdevice::raw;
use nrf_softdevice::Softdevice;
@@ -95,7 +95,7 @@ fn main() -> ! {
..Default::default()
};
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &config);
let executor = EXECUTOR.put(Executor::new());
diff --git a/examples/src/bin/ble_bas_peripheral.rs b/examples/src/bin/ble_bas_peripheral.rs
index 89c4621..462dfc9 100644
--- a/examples/src/bin/ble_bas_peripheral.rs
+++ b/examples/src/bin/ble_bas_peripheral.rs
@@ -10,10 +10,10 @@ use example_common::*;
use core::mem;
use cortex_m_rt::entry;
use defmt::info;
-use defmt::{panic, *};
+use defmt::*;
-use nrf_softdevice::ble::{gatt_server, peripheral, Connection};
-use nrf_softdevice::{raw, RawError, Softdevice};
+use nrf_softdevice::ble::{gatt_server, peripheral};
+use nrf_softdevice::{raw, Softdevice};
use embassy::executor::{task, Executor};
use embassy::util::Forever;
@@ -33,7 +33,7 @@ struct BatteryService {
}
#[task]
-async fn bluetooth_task(sd: &'static Softdevice, config: peripheral::Config) {
+async fn bluetooth_task(sd: &'static Softdevice) {
let server: BatteryService = unwrap!(gatt_server::register(sd));
#[rustfmt::skip]
let adv_data = &[
@@ -125,12 +125,12 @@ fn main() -> ! {
..Default::default()
};
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &config);
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
unwrap!(spawner.spawn(softdevice_task(sd)));
- unwrap!(spawner.spawn(bluetooth_task(sd, peripheral::Config::default())));
+ unwrap!(spawner.spawn(bluetooth_task(sd)));
});
}
diff --git a/examples/src/bin/ble_l2cap_central.rs b/examples/src/bin/ble_l2cap_central.rs
index 9ac6a86..ff30164 100644
--- a/examples/src/bin/ble_l2cap_central.rs
+++ b/examples/src/bin/ble_l2cap_central.rs
@@ -13,13 +13,12 @@ use core::ptr::NonNull;
use core::slice;
use cortex_m_rt::entry;
use defmt::info;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::{task, Executor};
use embassy::util::Forever;
-use heapless::consts::*;
use nrf_softdevice::ble::l2cap::Packet as _;
-use nrf_softdevice::ble::{central, l2cap, Address, Connection, TxPower, Uuid};
+use nrf_softdevice::ble::{central, l2cap, Address, TxPower};
use nrf_softdevice::raw;
use nrf_softdevice::Softdevice;
@@ -171,7 +170,7 @@ fn main() -> ! {
..Default::default()
};
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &config);
let executor = EXECUTOR.put(Executor::new());
diff --git a/examples/src/bin/ble_l2cap_peripheral.rs b/examples/src/bin/ble_l2cap_peripheral.rs
index 3418cc7..871cb01 100644
--- a/examples/src/bin/ble_l2cap_peripheral.rs
+++ b/examples/src/bin/ble_l2cap_peripheral.rs
@@ -11,11 +11,11 @@ use example_common::*;
use core::mem;
use core::ptr::NonNull;
use cortex_m_rt::entry;
-use defmt::{panic, *};
+use defmt::*;
use nrf_softdevice::ble;
-use nrf_softdevice::ble::{l2cap, peripheral, Connection};
-use nrf_softdevice::{raw, RawError, Softdevice};
+use nrf_softdevice::ble::{l2cap, peripheral};
+use nrf_softdevice::{raw, Softdevice};
use embassy::executor::{task, Executor};
use embassy::util::Forever;
@@ -64,8 +64,6 @@ async fn bluetooth_task(sd: &'static Softdevice) {
let pkt = unwrap!(ch.rx().await);
info!("rx: {:x}", pkt.0);
}
-
- futures::future::pending::<()>().await;
}
}
@@ -147,7 +145,7 @@ fn main() -> ! {
..Default::default()
};
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &config);
let executor = EXECUTOR.put(Executor::new());
diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs
index 83686f4..d516991 100644
--- a/examples/src/bin/ble_peripheral_onoff.rs
+++ b/examples/src/bin/ble_peripheral_onoff.rs
@@ -18,8 +18,8 @@ use embassy_nrf::interrupt;
use futures::pin_mut;
use nrf52840_hal::gpio;
-use nrf_softdevice::ble::{gatt_server, peripheral, Connection};
-use nrf_softdevice::{pac, raw, RawError, Softdevice};
+use nrf_softdevice::ble::{gatt_server, peripheral};
+use nrf_softdevice::{pac, raw, Softdevice};
static EXECUTOR: Forever<Executor> = Forever::new();
diff --git a/examples/src/bin/ble_scan.rs b/examples/src/bin/ble_scan.rs
index 74e2d62..d49574d 100644
--- a/examples/src/bin/ble_scan.rs
+++ b/examples/src/bin/ble_scan.rs
@@ -10,11 +10,11 @@ use example_common::*;
use core::mem;
use core::slice;
use cortex_m_rt::entry;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::{task, Executor};
use embassy::util::Forever;
-use nrf_softdevice::ble::{central, TxPower};
+use nrf_softdevice::ble::central;
use nrf_softdevice::raw;
use nrf_softdevice::Softdevice;
@@ -106,7 +106,7 @@ fn main() -> ! {
..Default::default()
};
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &config);
let executor = EXECUTOR.put(Executor::new());
diff --git a/examples/src/bin/flash.rs b/examples/src/bin/flash.rs
index 1d765c7..84a71ab 100644
--- a/examples/src/bin/flash.rs
+++ b/examples/src/bin/flash.rs
@@ -8,7 +8,7 @@ mod example_common;
use example_common::*;
use cortex_m_rt::entry;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::{task, Executor};
use embassy::flash::Flash as _;
use embassy::util::Forever;
@@ -39,7 +39,7 @@ async fn flash_task(sd: &'static Softdevice) {
fn main() -> ! {
info!("Hello World!");
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &Default::default());
let executor = EXECUTOR.put(Executor::new());
diff --git a/examples/src/bin/interrupts.rs b/examples/src/bin/interrupts.rs
index 55c896c..baeb3e8 100644
--- a/examples/src/bin/interrupts.rs
+++ b/examples/src/bin/interrupts.rs
@@ -8,7 +8,7 @@ mod example_common;
use example_common::*;
use cortex_m_rt::entry;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::{task, Executor};
use embassy::util::Forever;
@@ -23,7 +23,7 @@ async fn softdevice_task(sd: &'static Softdevice) {
}
#[task]
-async fn interrupt_task(sd: &'static Softdevice) {
+async fn interrupt_task(_sd: &'static Softdevice) {
let enabled = interrupt::is_enabled(interrupt::SWI0_EGU0);
info!("enabled: {:?}", enabled);
@@ -89,7 +89,7 @@ fn SWI1_EGU1() {
fn main() -> ! {
info!("Hello World!");
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
let sd = Softdevice::enable(sdp, &Default::default());
let executor = EXECUTOR.put(Executor::new());
diff --git a/examples/src/bin/rtic.rs b/examples/src/bin/rtic.rs
index 7fd34b5..cf7be99 100644
--- a/examples/src/bin/rtic.rs
+++ b/examples/src/bin/rtic.rs
@@ -19,7 +19,7 @@ mod example_common;
use example_common::*;
use core::mem;
-use defmt::{panic, *};
+use defmt::*;
use embassy::executor::{task, Executor};
use embassy::util::Forever;
use nrf52840_hal::pac::TIMER1;
@@ -56,7 +56,7 @@ async fn bluetooth_task(sd: &'static Softdevice) {
adv_data,
scan_data,
};
- let conn = unwrap!(peripheral::advertise(sd, adv, &config).await);
+ let _conn = unwrap!(peripheral::advertise(sd, adv, &config).await);
info!("advertising done!");
}
@@ -116,7 +116,7 @@ const APP: () = {
..Default::default()
};
- let (sdp, p) = take_peripherals();
+ let (sdp, _p) = take_peripherals();
// Softdevice enable must not be done in RTIC init
// because RTIC runs init with interrupts disabled, and the
diff --git a/examples/src/example_common.rs b/examples/src/example_common.rs
index adbe86f..c73099d 100644
--- a/examples/src/example_common.rs
+++ b/examples/src/example_common.rs
@@ -18,7 +18,6 @@ static ALLOCATOR: CortexMHeap = CortexMHeap::empty();
#[alloc_error_handler]
fn alloc_error(_layout: Layout) -> ! {
panic!("Alloc error");
- loop {}
}
const HEAP_SIZE: usize = 32 * 1024; // in bytes