Skip to content

Commit

Permalink
put back blinky
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jul 26, 2023
1 parent c1e7061 commit b5ab5d7
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 112 deletions.
44 changes: 17 additions & 27 deletions platforms/allwinner-d1/boards/src/bin/lichee-rv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate alloc;
use core::time::Duration;
use mnemos_d1_core::{
dmac::Dmac,
drivers::{spim::kernel_spim1, twi, uart::kernel_uart},
drivers::{spim::kernel_spim1, twi, uart::kernel_uart, gpio},
plic::Plic,
timer::Timers,
Ram, D1,
Expand All @@ -33,36 +33,26 @@ fn main() -> ! {
let dmac = Dmac::new(p.DMAC, &mut p.CCU);
let plic = Plic::new(p.PLIC);

p.GPIO.pc_cfg0.modify(|_r, w| {
w.pc1_select().output();
w
});
p.GPIO.pc_dat.modify(|_r, w| {
w.pc_dat().variant(0b0000_0010);
w
});

let d1 = D1::initialize(timers, uart, spim, dmac, plic, i2c0, p.GPIO);

d1.initialize_sharp_display();

// // Initialize LED loop
// d1.kernel
// .initialize(async move {
// loop {
// p.GPIO.pc_dat.modify(|_r, w| {
// w.pc_dat().variant(0b0000_0010);
// w
// });
// d1.kernel.sleep(Duration::from_millis(250)).await;
// p.GPIO.pc_dat.modify(|_r, w| {
// w.pc_dat().variant(0b0000_0000);
// w
// });
// d1.kernel.sleep(Duration::from_millis(250)).await;
// }
// })
// .unwrap();
// Initialize LED loop
d1.kernel
.initialize(async move {
let mut pin = {
let mut gpio = gpio::GpioClient::from_registry(d1.kernel).await;
gpio.claim_output(gpio::PinC::C1).await.expect("can't claim C1 as output!")
};
loop {
pin.set(true);
d1.kernel.sleep(Duration::from_millis(250)).await;
pin.set(false);
d1.kernel.sleep(Duration::from_millis(250)).await;
}
})
.unwrap();


d1.run()
}
45 changes: 17 additions & 28 deletions platforms/allwinner-d1/boards/src/bin/mq-pro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::time::Duration;
use mnemos_beepy::i2c_puppet::{HsvColor, I2cPuppetClient, I2cPuppetServer};
use mnemos_d1_core::{
dmac::Dmac,
drivers::{spim::kernel_spim1, twi, uart::kernel_uart},
drivers::{spim::kernel_spim1, twi, uart::kernel_uart, gpio},
plic::Plic,
timer::Timers,
Ram, D1,
Expand All @@ -33,35 +33,24 @@ fn main() -> ! {
let timers = Timers::new(p.TIMER);
let dmac = Dmac::new(p.DMAC, &mut p.CCU);
let plic = Plic::new(p.PLIC);

p.GPIO.pd_cfg2.modify(|_r, w| {
w.pd18_select().output();
w
});
p.GPIO.pd_dat.modify(|_r, w| {
w.pd_dat().variant(1 << 18);
w
});


let d1 = D1::initialize(timers, uart, spim, dmac, plic, i2c0, p.GPIO);

// // Initialize LED loop
// d1.kernel
// .initialize(async move {
// loop {
// p.GPIO.pd_dat.modify(|_r, w| {
// w.pd_dat().variant(1 << 18);
// w
// });
// d1.kernel.sleep(Duration::from_millis(250)).await;
// p.GPIO.pd_dat.modify(|_r, w| {
// w.pd_dat().variant(0);
// w
// });
// d1.kernel.sleep(Duration::from_millis(250)).await;
// }
// })
// .unwrap();
// Initialize LED loop
d1.kernel
.initialize(async move {
let mut pin = {
let mut gpio = gpio::GpioClient::from_registry(d1.kernel).await;
gpio.claim_output(gpio::PinD::D18).await.expect("can't claim D18 as output!")
};
loop {
pin.set(true);
d1.kernel.sleep(Duration::from_millis(250)).await;
pin.set(false);
d1.kernel.sleep(Duration::from_millis(250)).await;
}
})
.unwrap();

d1.initialize_sharp_display();

Expand Down
Loading

0 comments on commit b5ab5d7

Please sign in to comment.