flash?
This commit is contained in:
+11
-3
@@ -27,9 +27,10 @@ use embassy_sync::signal::Signal;
|
||||
use embassy_time::{with_timeout, Duration, Timer};
|
||||
use futures::future::{select, Either};
|
||||
use futures::pin_mut;
|
||||
use nrf_softdevice::{raw, Softdevice};
|
||||
use nrf_softdevice::{raw, Flash, Softdevice};
|
||||
use nrf_softdevice::ble::advertisement_builder::{Flag, LegacyAdvertisementBuilder, LegacyAdvertisementPayload, ServiceList, ServiceUuid16};
|
||||
use nrf_softdevice::ble::{peripheral, gatt_server, Connection};
|
||||
use embedded_storage_async::nor_flash::ReadNorFlash;
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Format)]
|
||||
enum SysAction {
|
||||
@@ -152,6 +153,13 @@ async fn main(spawner: Spawner) {
|
||||
channel_config.reference = Reference::INTERNAL;
|
||||
let saadc = Saadc::new(p.SAADC, AdcIrqs, saadc::Config::default(), [channel_config]);
|
||||
saadc.calibrate().await;
|
||||
let flash = Flash::take(sd);
|
||||
pin_mut!(flash);
|
||||
let mut data = [0u8; 16];
|
||||
if let Err(e) = flash.as_mut().read(0x000F9800 - 4096, &mut data).await {
|
||||
error!("Error reading from flash: {}", e);
|
||||
}
|
||||
info!("Data in flash: {:?}", data);
|
||||
|
||||
let pwm_text = SimplePwm::new_3ch(p.PWM0, p.P1_00, p.P1_04, p.P1_06, &Default::default());
|
||||
let pwm_heart = SimplePwm::new_3ch(p.PWM2, p.P0_17, p.P0_20, p.P0_22, &Default::default());
|
||||
@@ -486,11 +494,11 @@ async fn light_task(mut pwm: SimplePwm<'static>) {
|
||||
match action {
|
||||
SysAction::PresentenceOn if intensity < 100 => {
|
||||
intensity.add_assign(1);
|
||||
info!("Increase intensity to {}", intensity);
|
||||
// info!("Increase intensity to {}", intensity);
|
||||
},
|
||||
SysAction::PresentenceOff if intensity > 0 => {
|
||||
intensity.sub_assign(1);
|
||||
info!("Decrease intensity to {}", intensity);
|
||||
// info!("Decrease intensity to {}", intensity);
|
||||
},
|
||||
_ => {
|
||||
// ignore
|
||||
|
||||
Reference in New Issue
Block a user