pub struct B15F { /* private fields */ }
Expand description

Structure representing the driver for the board 15

Implementations

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.

Returns

A new B15F object is returned. It contains an already active USART connection, so calling this function multiple times will create an Error

Errors

An error::Error is generated if the connection to the board cannot be established, or if testing of that connection fails.

Examples
use b15f::B15F;
 
let drv = B15F::new().unwrap();

Sets the value of the specified port

Errors

port can either be 0 or 1, other values will cause a compile-time error. Otherwise an error::Error is generated if communication with the B15 fails.

Examples

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

Returns

A list of strings where each string contains a piece of information about the board. What string contains what information is determined, but not explicitly listed.

Errors

An error::Error is generated if the communication with the board fails.

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}"));

Clears data in the USART buffers on this device and on the B15

Test the integer conversion of the USART connection

Errors

If an error occurs in the conversion or the communication with the board, an error::Error will be returned.

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.

Errors

An error::Error is returned if the test fails, or if the communication itself fails.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.