Skip to content

Commit

Permalink
feat: Add get_captured_value() function (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhthies authored Sep 14, 2024
1 parent 507379a commit c0e9e8d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,15 @@ where
Err(e) => Err(e),
}
}

/// Get the complete value captured at the last interrupt of the specified port
pub fn get_captured_value(&mut self, port: Port) -> Result<u8, E> {
let reg = match port {
Port::GPIOA => Register::INTCAPA,
Port::GPIOB => Register::INTCAPB,
};
self.read_register(reg)
}
}

/// Changes the bit at position `bit` within `reg` to `val`.
Expand Down

0 comments on commit c0e9e8d

Please sign in to comment.