Get interrupts set up somehow
This commit is contained in:
parent
5ef267736b
commit
992ae640a6
22
src/main.rs
22
src/main.rs
|
@ -12,14 +12,22 @@ use embassy_embedded_hal::SetConfig;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_rp::peripherals::{PIN_10, PIN_11, PIN_12, PIN_16, SPI1};
|
use embassy_rp::peripherals::{PIN_10, PIN_11, PIN_12, PIN_16, SPI1};
|
||||||
use embassy_rp::spi::Spi;
|
use embassy_rp::spi::Spi;
|
||||||
|
use embassy_rp::{bind_interrupts, interrupt};
|
||||||
use embassy_rp::{gpio, spi};
|
use embassy_rp::{gpio, spi};
|
||||||
use embassy_time::{Duration, Timer};
|
|
||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
use embedded_sdmmc::sdcard::{DummyCsPin, SdCard};
|
use embedded_sdmmc::sdcard::{DummyCsPin, SdCard};
|
||||||
use embedded_sdmmc::{Block, BlockDevice, BlockIdx, VolumeIdx};
|
use embedded_sdmmc::{Block, BlockDevice, BlockIdx, VolumeIdx};
|
||||||
use gpio::{Level, Output};
|
use gpio::{Level, Output};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
use embassy_rp::i2c::{self, Config};
|
||||||
|
use embassy_time::{Duration, Timer};
|
||||||
|
use embedded_hal_async::i2c::I2c;
|
||||||
|
|
||||||
|
bind_interrupts!(struct Irqs {
|
||||||
|
I2C1_IRQ => i2c::InterruptHandler<embassy_rp::peripherals::I2C1>;
|
||||||
|
});
|
||||||
|
|
||||||
struct DummyTimesource();
|
struct DummyTimesource();
|
||||||
|
|
||||||
impl embedded_sdmmc::TimeSource for DummyTimesource {
|
impl embedded_sdmmc::TimeSource for DummyTimesource {
|
||||||
|
@ -40,9 +48,15 @@ async fn main(spawner: Spawner) {
|
||||||
embassy_rp::pac::SIO.spinlock(31).write_value(1);
|
embassy_rp::pac::SIO.spinlock(31).write_value(1);
|
||||||
let p = embassy_rp::init(Default::default());
|
let p = embassy_rp::init(Default::default());
|
||||||
|
|
||||||
spawner
|
// spawner
|
||||||
.spawn(write_to_sd(p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, p.PIN_16))
|
// .spawn(write_to_sd(p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, p.PIN_16))
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
|
|
||||||
|
let sda = p.PIN_14;
|
||||||
|
let scl = p.PIN_15;
|
||||||
|
|
||||||
|
info!("set up i2c ");
|
||||||
|
let mut i2c = embassy_rp::i2c::I2c::new_async(p.I2C1, scl, sda, Irqs, Config::default());
|
||||||
|
|
||||||
debug!("TASK ENDED: Main")
|
debug!("TASK ENDED: Main")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue