Skip to content

Commit

Permalink
changes from PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lzrd committed Nov 19, 2024
1 parent f1fea79 commit fd5a742
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
14 changes: 5 additions & 9 deletions build/lpc55pins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,16 @@ pub fn codegen(pins: Vec<PinConfig>) -> Result<()> {
let out_dir = build_util::out_dir();
let dest_path = out_dir.join("pin_config.rs");
let mut file = std::fs::File::create(&dest_path)?;
let mut buf = BufWriter::new(Vec::new());

let mut used_slots = 0u8;
let mut buf = BufWriter::new(Vec::new());

if pins.iter().any(|p| p.name.is_some()) {
writeln!(&mut file, "use drv_lpc55_gpio_api::Pin;")?;
writeln!(&mut buf, "use drv_lpc55_gpio_api::Pin;")?;
}
writeln!(
&mut file,
"fn setup_pins(task : userlib::TaskId) -> Result<(), ()> {{"
"fn setup_pins(task : TaskId) -> Result<(), ()> {{"
)?;
writeln!(&mut file, "use drv_lpc55_gpio_api::*;")?;
writeln!(&mut file, "let iocon = Pins::from(task);")?;
Expand Down Expand Up @@ -281,12 +282,7 @@ pub fn codegen(pins: Vec<PinConfig>) -> Result<()> {

writeln!(&mut file, "Ok(())")?;
writeln!(&mut file, "}}")?;

write!(
&mut file,
"{}",
String::from_utf8(buf.into_inner()?).unwrap()
)?;
write!(file, "{}", String::from_utf8(buf.into_inner()?).unwrap())?;
call_rustfmt::rustfmt(&dest_path)?;

Ok(())
Expand Down
6 changes: 2 additions & 4 deletions drv/lpc55-gpio/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,8 @@ impl idl::InOrderPinsImpl for ServerImpl<'_> {
let syscon = Syscon::from(SYSCON.get_task_id());
syscon.enable_clock(Peripheral::Mux);
syscon.leave_reset(Peripheral::Mux);
unsafe {
self.inputmux.pintsel[pint_slot as usize]
.write(|w| w.bits(pin as u32));
}
self.inputmux.pintsel[pint_slot as usize]
.write(|w| unsafe { w.intpin().bits(pin as u8) });
syscon.disable_clock(Peripheral::Mux);

// NOTE: We're only supporting edge-triggered interrupts right now.
Expand Down

0 comments on commit fd5a742

Please sign in to comment.