diff options
| author | Tyler <[email protected]> | 2023-09-29 20:02:24 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-29 20:02:24 -0600 |
| commit | 2f9b59c5cf21f1e2761a9ccefdfd86f0edea829c (patch) | |
| tree | 8964744b4fb753cf98f6f413464106c4d2a72976 /examples/rp | |
| parent | ce91fb2bfc846570ef543a09396c428d70675245 (diff) | |
| parent | 95b3d9eb3b3657de3d7bc9c04f8fb83eae901640 (diff) | |
Merge branch 'main' into issue-1974-add-sai-driver
Diffstat (limited to 'examples/rp')
| -rw-r--r-- | examples/rp/Cargo.toml | 13 | ||||
| -rw-r--r-- | examples/rp/src/bin/i2c_slave.rs | 118 | ||||
| -rw-r--r-- | examples/rp/src/bin/lora_lorawan.rs | 17 | ||||
| -rw-r--r-- | examples/rp/src/bin/lora_p2p_receive.rs | 12 | ||||
| -rw-r--r-- | examples/rp/src/bin/lora_p2p_send.rs | 12 | ||||
| -rw-r--r-- | examples/rp/src/bin/lora_p2p_send_multicore.rs | 11 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_uart.rs | 10 | ||||
| -rw-r--r-- | examples/rp/src/bin/pio_ws2812.rs | 7 |
8 files changed, 142 insertions, 58 deletions
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index 3efc804ac..2677e0402 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -7,9 +7,9 @@ license = "MIT OR Apache-2.0" | |||
| 7 | 7 | ||
| 8 | [dependencies] | 8 | [dependencies] |
| 9 | embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal", features = ["defmt"] } | 9 | embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal", features = ["defmt"] } |
| 10 | embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } | 10 | embassy-sync = { version = "0.3.0", path = "../../embassy-sync", features = ["defmt"] } |
| 11 | embassy-executor = { version = "0.3.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } | 11 | embassy-executor = { version = "0.3.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } |
| 12 | embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["nightly", "unstable-traits", "defmt", "defmt-timestamp-uptime"] } | 12 | embassy-time = { version = "0.1.3", path = "../../embassy-time", features = ["nightly", "unstable-traits", "defmt", "defmt-timestamp-uptime"] } |
| 13 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } | 13 | embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac", "time-driver", "critical-section-impl"] } |
| 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } | 14 | embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } |
| 15 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] } | 15 | embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] } |
| @@ -17,9 +17,9 @@ embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", fea | |||
| 17 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 17 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 18 | embassy-usb-logger = { version = "0.1.0", path = "../../embassy-usb-logger" } | 18 | embassy-usb-logger = { version = "0.1.0", path = "../../embassy-usb-logger" } |
| 19 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["time", "defmt"] } | 19 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["time", "defmt"] } |
| 20 | lora-phy = { version = "1" } | 20 | lora-phy = { version = "2" } |
| 21 | lorawan-device = { version = "0.10.0", default-features = false, features = ["async", "external-lora-phy"] } | 21 | lorawan-device = { version = "0.11.0", default-features = false, features = ["async", "external-lora-phy"] } |
| 22 | lorawan = { version = "0.7.3", default-features = false, features = ["default-crypto"] } | 22 | lorawan = { version = "0.7.4", default-features = false, features = ["default-crypto"] } |
| 23 | cyw43 = { path = "../../cyw43", features = ["defmt", "firmware-logs"] } | 23 | cyw43 = { path = "../../cyw43", features = ["defmt", "firmware-logs"] } |
| 24 | cyw43-pio = { path = "../../cyw43-pio", features = ["defmt", "overclock"] } | 24 | cyw43-pio = { path = "../../cyw43-pio", features = ["defmt", "overclock"] } |
| 25 | 25 | ||
| @@ -55,6 +55,3 @@ rand = { version = "0.8.5", default-features = false } | |||
| 55 | 55 | ||
| 56 | [profile.release] | 56 | [profile.release] |
| 57 | debug = 2 | 57 | debug = 2 |
| 58 | |||
| 59 | [patch.crates-io] | ||
| 60 | lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "1323eccc1c470d4259f95f4f315d1be830d572a3"} \ No newline at end of file | ||
diff --git a/examples/rp/src/bin/i2c_slave.rs b/examples/rp/src/bin/i2c_slave.rs new file mode 100644 index 000000000..7de300fb8 --- /dev/null +++ b/examples/rp/src/bin/i2c_slave.rs | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | //! This example shows how to use the 2040 as an i2c slave. | ||
| 2 | #![no_std] | ||
| 3 | #![no_main] | ||
| 4 | #![feature(type_alias_impl_trait)] | ||
| 5 | |||
| 6 | use defmt::*; | ||
| 7 | use embassy_executor::Spawner; | ||
| 8 | use embassy_rp::peripherals::{I2C0, I2C1}; | ||
| 9 | use embassy_rp::{bind_interrupts, i2c, i2c_slave}; | ||
| 10 | use embassy_time::{Duration, Timer}; | ||
| 11 | use embedded_hal_async::i2c::I2c; | ||
| 12 | use {defmt_rtt as _, panic_probe as _}; | ||
| 13 | |||
| 14 | bind_interrupts!(struct Irqs { | ||
| 15 | I2C0_IRQ => i2c::InterruptHandler<I2C0>; | ||
| 16 | I2C1_IRQ => i2c::InterruptHandler<I2C1>; | ||
| 17 | }); | ||
| 18 | |||
| 19 | const DEV_ADDR: u8 = 0x42; | ||
| 20 | |||
| 21 | #[embassy_executor::task] | ||
| 22 | async fn device_task(mut dev: i2c_slave::I2cSlave<'static, I2C1>) -> ! { | ||
| 23 | info!("Device start"); | ||
| 24 | |||
| 25 | let mut state = 0; | ||
| 26 | |||
| 27 | loop { | ||
| 28 | let mut buf = [0u8; 128]; | ||
| 29 | match dev.listen(&mut buf).await { | ||
| 30 | Ok(i2c_slave::Command::GeneralCall(len)) => info!("Device recieved general call write: {}", buf[..len]), | ||
| 31 | Ok(i2c_slave::Command::Read) => loop { | ||
| 32 | match dev.respond_to_read(&[state]).await { | ||
| 33 | Ok(x) => match x { | ||
| 34 | i2c_slave::ReadStatus::Done => break, | ||
| 35 | i2c_slave::ReadStatus::NeedMoreBytes => (), | ||
| 36 | i2c_slave::ReadStatus::LeftoverBytes(x) => { | ||
| 37 | info!("tried to write {} extra bytes", x); | ||
| 38 | break; | ||
| 39 | } | ||
| 40 | }, | ||
| 41 | Err(e) => error!("error while responding {}", e), | ||
| 42 | } | ||
| 43 | }, | ||
| 44 | Ok(i2c_slave::Command::Write(len)) => info!("Device recieved write: {}", buf[..len]), | ||
| 45 | Ok(i2c_slave::Command::WriteRead(len)) => { | ||
| 46 | info!("device recieved write read: {:x}", buf[..len]); | ||
| 47 | match buf[0] { | ||
| 48 | // Set the state | ||
| 49 | 0xC2 => { | ||
| 50 | state = buf[1]; | ||
| 51 | match dev.respond_and_fill(&[state], 0x00).await { | ||
| 52 | Ok(read_status) => info!("response read status {}", read_status), | ||
| 53 | Err(e) => error!("error while responding {}", e), | ||
| 54 | } | ||
| 55 | } | ||
| 56 | // Reset State | ||
| 57 | 0xC8 => { | ||
| 58 | state = 0; | ||
| 59 | match dev.respond_and_fill(&[state], 0x00).await { | ||
| 60 | Ok(read_status) => info!("response read status {}", read_status), | ||
| 61 | Err(e) => error!("error while responding {}", e), | ||
| 62 | } | ||
| 63 | } | ||
| 64 | x => error!("Invalid Write Read {:x}", x), | ||
| 65 | } | ||
| 66 | } | ||
| 67 | Err(e) => error!("{}", e), | ||
| 68 | } | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | #[embassy_executor::task] | ||
| 73 | async fn controller_task(mut con: i2c::I2c<'static, I2C0, i2c::Async>) { | ||
| 74 | info!("Controller start"); | ||
| 75 | |||
| 76 | loop { | ||
| 77 | let mut resp_buff = [0u8; 2]; | ||
| 78 | for i in 0..10 { | ||
| 79 | match con.write_read(DEV_ADDR, &[0xC2, i], &mut resp_buff).await { | ||
| 80 | Ok(_) => info!("write_read response: {}", resp_buff), | ||
| 81 | Err(e) => error!("Error writing {}", e), | ||
| 82 | } | ||
| 83 | |||
| 84 | Timer::after(Duration::from_millis(100)).await; | ||
| 85 | } | ||
| 86 | match con.read(DEV_ADDR, &mut resp_buff).await { | ||
| 87 | Ok(_) => info!("read response: {}", resp_buff), | ||
| 88 | Err(e) => error!("Error writing {}", e), | ||
| 89 | } | ||
| 90 | match con.write_read(DEV_ADDR, &[0xC8], &mut resp_buff).await { | ||
| 91 | Ok(_) => info!("write_read response: {}", resp_buff), | ||
| 92 | Err(e) => error!("Error writing {}", e), | ||
| 93 | } | ||
| 94 | Timer::after(Duration::from_millis(100)).await; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | #[embassy_executor::main] | ||
| 99 | async fn main(spawner: Spawner) { | ||
| 100 | let p = embassy_rp::init(Default::default()); | ||
| 101 | info!("Hello World!"); | ||
| 102 | |||
| 103 | let d_sda = p.PIN_3; | ||
| 104 | let d_scl = p.PIN_2; | ||
| 105 | let mut config = i2c_slave::Config::default(); | ||
| 106 | config.addr = DEV_ADDR as u16; | ||
| 107 | let device = i2c_slave::I2cSlave::new(p.I2C1, d_sda, d_scl, Irqs, config); | ||
| 108 | |||
| 109 | unwrap!(spawner.spawn(device_task(device))); | ||
| 110 | |||
| 111 | let c_sda = p.PIN_1; | ||
| 112 | let c_scl = p.PIN_0; | ||
| 113 | let mut config = i2c::Config::default(); | ||
| 114 | config.frequency = 5_000; | ||
| 115 | let controller = i2c::I2c::new_async(p.I2C0, c_sda, c_scl, Irqs, config); | ||
| 116 | |||
| 117 | unwrap!(spawner.spawn(controller_task(controller))); | ||
| 118 | } | ||
diff --git a/examples/rp/src/bin/lora_lorawan.rs b/examples/rp/src/bin/lora_lorawan.rs index d631fafa1..e7e81863e 100644 --- a/examples/rp/src/bin/lora_lorawan.rs +++ b/examples/rp/src/bin/lora_lorawan.rs | |||
| @@ -19,6 +19,7 @@ use lora_phy::LoRa; | |||
| 19 | use lorawan::default_crypto::DefaultFactory as Crypto; | 19 | use lorawan::default_crypto::DefaultFactory as Crypto; |
| 20 | use lorawan_device::async_device::lora_radio::LoRaRadio; | 20 | use lorawan_device::async_device::lora_radio::LoRaRadio; |
| 21 | use lorawan_device::async_device::{region, Device, JoinMode}; | 21 | use lorawan_device::async_device::{region, Device, JoinMode}; |
| 22 | use lorawan_device::{AppEui, AppKey, DevEui}; | ||
| 22 | use {defmt_rtt as _, panic_probe as _}; | 23 | use {defmt_rtt as _, panic_probe as _}; |
| 23 | 24 | ||
| 24 | const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region | 25 | const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region |
| @@ -39,16 +40,8 @@ async fn main(_spawner: Spawner) { | |||
| 39 | 40 | ||
| 40 | let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap(); | 41 | let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap(); |
| 41 | 42 | ||
| 42 | let mut delay = Delay; | ||
| 43 | |||
| 44 | let lora = { | 43 | let lora = { |
| 45 | match LoRa::new( | 44 | match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), true, Delay).await { |
| 46 | SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), | ||
| 47 | true, | ||
| 48 | &mut delay, | ||
| 49 | ) | ||
| 50 | .await | ||
| 51 | { | ||
| 52 | Ok(l) => l, | 45 | Ok(l) => l, |
| 53 | Err(err) => { | 46 | Err(err) => { |
| 54 | info!("Radio error = {}", err); | 47 | info!("Radio error = {}", err); |
| @@ -66,9 +59,9 @@ async fn main(_spawner: Spawner) { | |||
| 66 | // TODO: Adjust the EUI and Keys according to your network credentials | 59 | // TODO: Adjust the EUI and Keys according to your network credentials |
| 67 | match device | 60 | match device |
| 68 | .join(&JoinMode::OTAA { | 61 | .join(&JoinMode::OTAA { |
| 69 | deveui: [0, 0, 0, 0, 0, 0, 0, 0], | 62 | deveui: DevEui::from([0, 0, 0, 0, 0, 0, 0, 0]), |
| 70 | appeui: [0, 0, 0, 0, 0, 0, 0, 0], | 63 | appeui: AppEui::from([0, 0, 0, 0, 0, 0, 0, 0]), |
| 71 | appkey: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], | 64 | appkey: AppKey::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), |
| 72 | }) | 65 | }) |
| 73 | .await | 66 | .await |
| 74 | { | 67 | { |
diff --git a/examples/rp/src/bin/lora_p2p_receive.rs b/examples/rp/src/bin/lora_p2p_receive.rs index 396d669de..5891826fd 100644 --- a/examples/rp/src/bin/lora_p2p_receive.rs +++ b/examples/rp/src/bin/lora_p2p_receive.rs | |||
| @@ -35,16 +35,8 @@ async fn main(_spawner: Spawner) { | |||
| 35 | 35 | ||
| 36 | let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap(); | 36 | let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap(); |
| 37 | 37 | ||
| 38 | let mut delay = Delay; | ||
| 39 | |||
| 40 | let mut lora = { | 38 | let mut lora = { |
| 41 | match LoRa::new( | 39 | match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), false, Delay).await { |
| 42 | SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), | ||
| 43 | false, | ||
| 44 | &mut delay, | ||
| 45 | ) | ||
| 46 | .await | ||
| 47 | { | ||
| 48 | Ok(l) => l, | 40 | Ok(l) => l, |
| 49 | Err(err) => { | 41 | Err(err) => { |
| 50 | info!("Radio error = {}", err); | 42 | info!("Radio error = {}", err); |
| @@ -83,7 +75,7 @@ async fn main(_spawner: Spawner) { | |||
| 83 | }; | 75 | }; |
| 84 | 76 | ||
| 85 | match lora | 77 | match lora |
| 86 | .prepare_for_rx(&mdltn_params, &rx_pkt_params, None, true, false, 0, 0x00ffffffu32) | 78 | .prepare_for_rx(&mdltn_params, &rx_pkt_params, None, None, false) |
| 87 | .await | 79 | .await |
| 88 | { | 80 | { |
| 89 | Ok(()) => {} | 81 | Ok(()) => {} |
diff --git a/examples/rp/src/bin/lora_p2p_send.rs b/examples/rp/src/bin/lora_p2p_send.rs index a0f70fa5c..94bdb4e92 100644 --- a/examples/rp/src/bin/lora_p2p_send.rs +++ b/examples/rp/src/bin/lora_p2p_send.rs | |||
| @@ -35,16 +35,8 @@ async fn main(_spawner: Spawner) { | |||
| 35 | 35 | ||
| 36 | let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap(); | 36 | let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap(); |
| 37 | 37 | ||
| 38 | let mut delay = Delay; | ||
| 39 | |||
| 40 | let mut lora = { | 38 | let mut lora = { |
| 41 | match LoRa::new( | 39 | match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), false, Delay).await { |
| 42 | SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), | ||
| 43 | false, | ||
| 44 | &mut delay, | ||
| 45 | ) | ||
| 46 | .await | ||
| 47 | { | ||
| 48 | Ok(l) => l, | 40 | Ok(l) => l, |
| 49 | Err(err) => { | 41 | Err(err) => { |
| 50 | info!("Radio error = {}", err); | 42 | info!("Radio error = {}", err); |
| @@ -97,7 +89,7 @@ async fn main(_spawner: Spawner) { | |||
| 97 | } | 89 | } |
| 98 | }; | 90 | }; |
| 99 | 91 | ||
| 100 | match lora.sleep(&mut delay).await { | 92 | match lora.sleep(false).await { |
| 101 | Ok(()) => info!("Sleep successful"), | 93 | Ok(()) => info!("Sleep successful"), |
| 102 | Err(err) => info!("Sleep unsuccessful = {}", err), | 94 | Err(err) => info!("Sleep unsuccessful = {}", err), |
| 103 | } | 95 | } |
diff --git a/examples/rp/src/bin/lora_p2p_send_multicore.rs b/examples/rp/src/bin/lora_p2p_send_multicore.rs index b54cc92f6..e31aa62a2 100644 --- a/examples/rp/src/bin/lora_p2p_send_multicore.rs +++ b/examples/rp/src/bin/lora_p2p_send_multicore.rs | |||
| @@ -69,16 +69,9 @@ async fn core1_task( | |||
| 69 | iv: GenericSx126xInterfaceVariant<Output<'static, AnyPin>, Input<'static, AnyPin>>, | 69 | iv: GenericSx126xInterfaceVariant<Output<'static, AnyPin>, Input<'static, AnyPin>>, |
| 70 | ) { | 70 | ) { |
| 71 | info!("Hello from core 1"); | 71 | info!("Hello from core 1"); |
| 72 | let mut delay = Delay; | ||
| 73 | 72 | ||
| 74 | let mut lora = { | 73 | let mut lora = { |
| 75 | match LoRa::new( | 74 | match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), false, Delay).await { |
| 76 | SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), | ||
| 77 | false, | ||
| 78 | &mut delay, | ||
| 79 | ) | ||
| 80 | .await | ||
| 81 | { | ||
| 82 | Ok(l) => l, | 75 | Ok(l) => l, |
| 83 | Err(err) => { | 76 | Err(err) => { |
| 84 | info!("Radio error = {}", err); | 77 | info!("Radio error = {}", err); |
| @@ -132,7 +125,7 @@ async fn core1_task( | |||
| 132 | } | 125 | } |
| 133 | }; | 126 | }; |
| 134 | 127 | ||
| 135 | match lora.sleep(&mut delay).await { | 128 | match lora.sleep(false).await { |
| 136 | Ok(()) => info!("Sleep successful"), | 129 | Ok(()) => info!("Sleep successful"), |
| 137 | Err(err) => info!("Sleep unsuccessful = {}", err), | 130 | Err(err) => info!("Sleep unsuccessful = {}", err), |
| 138 | } | 131 | } |
diff --git a/examples/rp/src/bin/pio_uart.rs b/examples/rp/src/bin/pio_uart.rs index 707c99b78..aa9e52cbd 100644 --- a/examples/rp/src/bin/pio_uart.rs +++ b/examples/rp/src/bin/pio_uart.rs | |||
| @@ -91,13 +91,11 @@ async fn main(_spawner: Spawner) { | |||
| 91 | let (mut uart_tx, mut uart_rx) = uart.split(); | 91 | let (mut uart_tx, mut uart_rx) = uart.split(); |
| 92 | 92 | ||
| 93 | // Pipe setup | 93 | // Pipe setup |
| 94 | let usb_pipe: Pipe<NoopRawMutex, 20> = Pipe::new(); | 94 | let mut usb_pipe: Pipe<NoopRawMutex, 20> = Pipe::new(); |
| 95 | let mut usb_pipe_writer = usb_pipe.writer(); | 95 | let (mut usb_pipe_reader, mut usb_pipe_writer) = usb_pipe.split(); |
| 96 | let mut usb_pipe_reader = usb_pipe.reader(); | ||
| 97 | 96 | ||
| 98 | let uart_pipe: Pipe<NoopRawMutex, 20> = Pipe::new(); | 97 | let mut uart_pipe: Pipe<NoopRawMutex, 20> = Pipe::new(); |
| 99 | let mut uart_pipe_writer = uart_pipe.writer(); | 98 | let (mut uart_pipe_reader, mut uart_pipe_writer) = uart_pipe.split(); |
| 100 | let mut uart_pipe_reader = uart_pipe.reader(); | ||
| 101 | 99 | ||
| 102 | let (mut usb_tx, mut usb_rx) = class.split(); | 100 | let (mut usb_tx, mut usb_rx) = class.split(); |
| 103 | 101 | ||
diff --git a/examples/rp/src/bin/pio_ws2812.rs b/examples/rp/src/bin/pio_ws2812.rs index bc87016ec..5c0c60246 100644 --- a/examples/rp/src/bin/pio_ws2812.rs +++ b/examples/rp/src/bin/pio_ws2812.rs | |||
| @@ -138,8 +138,9 @@ async fn main(_spawner: Spawner) { | |||
| 138 | const NUM_LEDS: usize = 1; | 138 | const NUM_LEDS: usize = 1; |
| 139 | let mut data = [RGB8::default(); NUM_LEDS]; | 139 | let mut data = [RGB8::default(); NUM_LEDS]; |
| 140 | 140 | ||
| 141 | // For the thing plus, use pin 8 | 141 | // Common neopixel pins: |
| 142 | // For the feather, use pin 16 | 142 | // Thing plus: 8 |
| 143 | // Adafruit Feather: 16; Adafruit Feather+RFM95: 4 | ||
| 143 | let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16); | 144 | let mut ws2812 = Ws2812::new(&mut common, sm0, p.DMA_CH0, p.PIN_16); |
| 144 | 145 | ||
| 145 | // Loop forever making RGB values and pushing them out to the WS2812. | 146 | // Loop forever making RGB values and pushing them out to the WS2812. |
| @@ -152,7 +153,7 @@ async fn main(_spawner: Spawner) { | |||
| 152 | } | 153 | } |
| 153 | ws2812.write(&data).await; | 154 | ws2812.write(&data).await; |
| 154 | 155 | ||
| 155 | Timer::after(Duration::from_micros(5)).await; | 156 | Timer::after(Duration::from_millis(10)).await; |
| 156 | } | 157 | } |
| 157 | } | 158 | } |
| 158 | } | 159 | } |
