Add preliminary keypad support
This commit is contained in:
parent
15f850623c
commit
03f560b2c1
16
src/main.rs
16
src/main.rs
@ -141,13 +141,25 @@ fn main() -> ! {
|
|||||||
);
|
);
|
||||||
|
|
||||||
sx1509.init().unwrap();
|
sx1509.init().unwrap();
|
||||||
sx1509.set_pin_dir(15, sx1509::PinDirection::InputPullUp, true);
|
sx1509.set_pin_dir(0, sx1509::PinDirection::Output, false);
|
||||||
|
sx1509.set_pin_dir(1, sx1509::PinDirection::InputPullUp, false);
|
||||||
|
sx1509.set_pin_dir(2, sx1509::PinDirection::Output, false);
|
||||||
|
sx1509.set_pin_dir(3, sx1509::PinDirection::InputPullUp, false);
|
||||||
|
sx1509.set_pin_dir(4, sx1509::PinDirection::Output, false);
|
||||||
|
sx1509.set_pin_dir(5, sx1509::PinDirection::InputPullUp, false);
|
||||||
|
sx1509.set_pin_dir(6, sx1509::PinDirection::InputPullUp, false);
|
||||||
|
|
||||||
let delay = Delay::new();
|
let delay = Delay::new();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
delay.delay_millis(500);
|
delay.delay_millis(500);
|
||||||
log::info!("Pin: {:?}", sx1509.read_pin(15));
|
sx1509.write_pin(0, true);
|
||||||
|
log::info!("Pin 1: {:?}", sx1509.read_pin(1));
|
||||||
|
log::info!("Pin 3: {:?}", sx1509.read_pin(3));
|
||||||
|
log::info!("Pin 5: {:?}", sx1509.read_pin(5));
|
||||||
|
log::info!("Pin 6: {:?}", sx1509.read_pin(6));
|
||||||
|
|
||||||
|
sx1509.write_pin(0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// let mut at_commands = ATCommands::new(sim_rst, sim_pwr_key, uart);
|
// let mut at_commands = ATCommands::new(sim_rst, sim_pwr_key, uart);
|
||||||
|
|||||||
@ -159,4 +159,14 @@ impl<'d> Sx1509<'d> {
|
|||||||
pub fn led_driver_init(&mut self, pin: u8) {
|
pub fn led_driver_init(&mut self, pin: u8) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn keypad(
|
||||||
|
&mut self,
|
||||||
|
rows: u8,
|
||||||
|
columns: u8,
|
||||||
|
sleep_time: u16,
|
||||||
|
scan_time: u16,
|
||||||
|
debounce_time: u8,
|
||||||
|
) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user