pub struct B15F { /* private fields */ }
Expand description
Structure representing the driver for the board 15
Implementations
sourceimpl B15F
impl B15F
sourcepub fn new() -> Result<B15F, Error>
pub fn new() -> Result<B15F, Error>
Creates a new instance of the B15
This function will establish a connection to a connected B15 and return
a handle to interact with it. Only one such instance should exist per
program; calling B15F::new()
more than once might lead to unexpected
behaviour.
Examples
use b15f::B15F;
let drv = B15F::new().unwrap();
sourcepub fn get_board_info(&mut self) -> Result<Vec<String>, Error>
pub fn get_board_info(&mut self) -> Result<Vec<String>, Error>
Yields information about the installed firmware on the B15
Returns an array of strings, where each string contains a piece of information stored on the B15
Examples
use b15f::B15F;
let mut drv = B15F::new().unwrap();
// Print each bit of information on a new line
drv.get_board_info()
.unwrap()
.iter()
.for_each(|info| println!("{info}"));
sourcepub fn discard(&mut self) -> Result<(), Error>
pub fn discard(&mut self) -> Result<(), Error>
Clears data in the USART buffers on this device and on the B15
sourcepub fn test_connection(&mut self) -> Result<(), Error>
pub fn test_connection(&mut self) -> Result<(), Error>
Tests the connetion to the B15
To test the connection a Request::Test
request will be sent
to the board together with a randomly generated value. If the
board returns that value the connection is working correctly.
Examples
use b15f::B15F;
fn main() {
let mut drv = B15F::new().unwrap();
if let Err(err) = drv.test_connection() {
panic!("Connection is not working: {err}");
}
}
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for B15F
impl Send for B15F
impl !Sync for B15F
impl Unpin for B15F
impl !UnwindSafe for B15F
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more