mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add is_plugged_in() convenience function for LLIO
This commit is contained in:
parent
27592f71a1
commit
a979cac843
1 changed files with 5 additions and 0 deletions
|
|
@ -46,6 +46,11 @@ impl Llio {
|
|||
).map(|_| ())
|
||||
}
|
||||
|
||||
pub fn is_plugged_in(&self) -> bool {
|
||||
// 0.005033 * 100_000 against 1.50V * 100_000
|
||||
((self.adc_vbus().unwrap() as u32) * 503) > 150_000
|
||||
}
|
||||
|
||||
pub fn adc_vbus(&self) -> Result<u16, xous::Error> {
|
||||
let response = send_message(self.conn,
|
||||
Message::new_blocking_scalar(Opcode::AdcVbus.to_usize().unwrap(), 0, 0, 0, 0))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue