pub trait Commands: CommandResponse {
Show 27 methods
// Provided methods
fn get_chip_status(&mut self) -> Result<ChipStatus, Mcp2210Error> { ... }
fn cancel_spi_transfer(&mut self) -> Result<ChipStatus, Mcp2210Error> { ... }
fn get_interrupt_event_counter(&mut self) -> Result<u16, Mcp2210Error> { ... }
fn reset_interrupt_event_counter(&mut self) -> Result<u16, Mcp2210Error> { ... }
fn get_chip_settings(&mut self) -> Result<ChipSettings, Mcp2210Error> { ... }
fn set_chip_settings(
&mut self,
settings: &ChipSettings,
) -> Result<(), Mcp2210Error> { ... }
fn set_gpio_value(&mut self, value: GpioValue) -> Result<(), Mcp2210Error> { ... }
fn get_gpio_value(&mut self) -> Result<GpioValue, Mcp2210Error> { ... }
fn set_gpio_direction(
&mut self,
direction: GpioDirection,
) -> Result<(), Mcp2210Error> { ... }
fn get_gpio_direction(&mut self) -> Result<GpioDirection, Mcp2210Error> { ... }
fn set_spi_transfer_settings(
&mut self,
settings: &SpiTransferSettings,
) -> Result<(), Mcp2210Error> { ... }
fn get_spi_transfer_settings(
&mut self,
) -> Result<SpiTransferSettings, Mcp2210Error> { ... }
fn spi_transfer<'a>(
&mut self,
data: &[u8],
res: &'a mut Buffer,
) -> Result<SpiTransferResponse<'a>, Mcp2210Error> { ... }
fn read_eeprom(&mut self, addr: u8) -> Result<u8, Mcp2210Error> { ... }
fn write_eeprom(&mut self, addr: u8, data: u8) -> Result<(), Mcp2210Error> { ... }
fn set_nvram_spi_transfer_settings(
&mut self,
settings: &SpiTransferSettings,
) -> Result<(), Mcp2210Error> { ... }
fn set_nvram_chip_settings(
&mut self,
settings: &ChipSettings,
password: Option<&[u8; 8]>,
) -> Result<(), Mcp2210Error> { ... }
fn set_nvram_usb_parameters(
&mut self,
params: &UsbParameters,
) -> Result<(), Mcp2210Error> { ... }
fn set_nvram_usb_product_name(
&mut self,
name: &str,
) -> Result<(), Mcp2210Error> { ... }
fn set_nvram_usb_vendor_name(
&mut self,
name: &str,
) -> Result<(), Mcp2210Error> { ... }
fn get_nvram_spi_transfer_settings(
&mut self,
) -> Result<SpiTransferSettings, Mcp2210Error> { ... }
fn get_nvram_chip_settings(&mut self) -> Result<ChipSettings, Mcp2210Error> { ... }
fn get_nvram_usb_parameters(
&mut self,
) -> Result<UsbParameters, Mcp2210Error> { ... }
fn get_nvram_usb_product_name(&mut self) -> Result<String, Mcp2210Error> { ... }
fn get_nvram_usb_vendor_name(&mut self) -> Result<String, Mcp2210Error> { ... }
fn send_access_password(
&mut self,
password: &[u8; 8],
) -> Result<(), Mcp2210Error> { ... }
fn request_bus_release(
&mut self,
ack_value: bool,
) -> Result<(), Mcp2210Error> { ... }
}
Provided Methods§
Sourcefn get_chip_status(&mut self) -> Result<ChipStatus, Mcp2210Error>
fn get_chip_status(&mut self) -> Result<ChipStatus, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 19)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
fn cancel_spi_transfer(&mut self) -> Result<ChipStatus, Mcp2210Error>
Sourcefn get_interrupt_event_counter(&mut self) -> Result<u16, Mcp2210Error>
fn get_interrupt_event_counter(&mut self) -> Result<u16, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 23)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
fn reset_interrupt_event_counter(&mut self) -> Result<u16, Mcp2210Error>
Sourcefn get_chip_settings(&mut self) -> Result<ChipSettings, Mcp2210Error>
fn get_chip_settings(&mut self) -> Result<ChipSettings, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 28)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
fn set_chip_settings( &mut self, settings: &ChipSettings, ) -> Result<(), Mcp2210Error>
fn set_gpio_value(&mut self, value: GpioValue) -> Result<(), Mcp2210Error>
Sourcefn get_gpio_value(&mut self) -> Result<GpioValue, Mcp2210Error>
fn get_gpio_value(&mut self) -> Result<GpioValue, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 38)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
fn set_gpio_direction( &mut self, direction: GpioDirection, ) -> Result<(), Mcp2210Error>
Sourcefn get_gpio_direction(&mut self) -> Result<GpioDirection, Mcp2210Error>
fn get_gpio_direction(&mut self) -> Result<GpioDirection, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 33)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
Sourcefn set_spi_transfer_settings(
&mut self,
settings: &SpiTransferSettings,
) -> Result<(), Mcp2210Error>
fn set_spi_transfer_settings( &mut self, settings: &SpiTransferSettings, ) -> Result<(), Mcp2210Error>
Examples found in repository?
examples/loopback.rs (lines 23-28)
10fn main() {
11 //! ##################################################################################
12 //! ## ⚠️ WARNING ⚠️ ##
13 //! ## This code sends 0xaa55 on the MCP2210's SPI bus. ##
14 //! ## If you have a device connected to the SPI bus, ensure this will not harm it. ##
15 //! ##################################################################################
16 //! #
17 //! This code sends 0xaa55 on the MCP2210's SPI bus MOSI pin and asserts that the same
18 //! data is simultaneously recieved at the MISO pin. The circuit required for this is
19 //! simply a wire between the MOSI and MISO pins of the MCP2210 and no real slave device.
20
21 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
22 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
23 mcp.set_spi_transfer_settings(&SpiTransferSettings {
24 bit_rate: 1_000,
25 bytes_per_tx: 2,
26 spi_mode: SpiMode::Mode0,
27 ..Default::default()
28 })
29 .expect("Failed to set settings");
30 let mut buf = Vec::new();
31 mcp.spi_transfer_to_end(&[0xaa, 0x55], &mut buf)
32 .expect("SPI transfer failed");
33 assert_eq!(buf, [0xaa, 0x55]);
34}
fn get_spi_transfer_settings( &mut self, ) -> Result<SpiTransferSettings, Mcp2210Error>
fn spi_transfer<'a>( &mut self, data: &[u8], res: &'a mut Buffer, ) -> Result<SpiTransferResponse<'a>, Mcp2210Error>
fn read_eeprom(&mut self, addr: u8) -> Result<u8, Mcp2210Error>
fn write_eeprom(&mut self, addr: u8, data: u8) -> Result<(), Mcp2210Error>
fn set_nvram_spi_transfer_settings( &mut self, settings: &SpiTransferSettings, ) -> Result<(), Mcp2210Error>
fn set_nvram_chip_settings( &mut self, settings: &ChipSettings, password: Option<&[u8; 8]>, ) -> Result<(), Mcp2210Error>
fn set_nvram_usb_parameters( &mut self, params: &UsbParameters, ) -> Result<(), Mcp2210Error>
fn set_nvram_usb_product_name(&mut self, name: &str) -> Result<(), Mcp2210Error>
fn set_nvram_usb_vendor_name(&mut self, name: &str) -> Result<(), Mcp2210Error>
Sourcefn get_nvram_spi_transfer_settings(
&mut self,
) -> Result<SpiTransferSettings, Mcp2210Error>
fn get_nvram_spi_transfer_settings( &mut self, ) -> Result<SpiTransferSettings, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 45)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
Sourcefn get_nvram_chip_settings(&mut self) -> Result<ChipSettings, Mcp2210Error>
fn get_nvram_chip_settings(&mut self) -> Result<ChipSettings, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 50)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
Sourcefn get_nvram_usb_parameters(&mut self) -> Result<UsbParameters, Mcp2210Error>
fn get_nvram_usb_parameters(&mut self) -> Result<UsbParameters, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 55)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
Sourcefn get_nvram_usb_product_name(&mut self) -> Result<String, Mcp2210Error>
fn get_nvram_usb_product_name(&mut self) -> Result<String, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 60)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
Sourcefn get_nvram_usb_vendor_name(&mut self) -> Result<String, Mcp2210Error>
fn get_nvram_usb_vendor_name(&mut self) -> Result<String, Mcp2210Error>
Examples found in repository?
examples/info.rs (line 65)
12fn main() {
13 let hidapi_context = HidApi::new().expect("Could not create hidapi context");
14 let mut mcp = open_first(&hidapi_context).expect("Failed to connect");
15 println!("Current Chip Status");
16 println!("===================");
17 println!(
18 "{:#?}",
19 mcp.get_chip_status().expect("Failed to read chip status")
20 );
21 println!(
22 "Interrupt event counter: {}",
23 mcp.get_interrupt_event_counter()
24 .expect("Failed to read interrupt count")
25 );
26 println!(
27 "{:#?}",
28 mcp.get_chip_settings()
29 .expect("Failed to read chip settings")
30 );
31 println!(
32 "GPIO directions (inputs): {:#?}",
33 mcp.get_gpio_direction()
34 .expect("Failed to read GPIO directions")
35 );
36 println!(
37 "GPIO values: {:#?}",
38 mcp.get_gpio_value().expect("Failed to read GPIO values")
39 );
40 println!();
41 println!("NVRAM settings");
42 println!("==============");
43 println!(
44 "{:#?}",
45 mcp.get_nvram_spi_transfer_settings()
46 .expect("Failed to read NVRAM SPI transfer settings")
47 );
48 println!(
49 "{:#?}",
50 mcp.get_nvram_chip_settings()
51 .expect("Failed to read NVRAM chip settings")
52 );
53 println!(
54 "{:#?}",
55 mcp.get_nvram_usb_parameters()
56 .expect("Failed to read NVRAM USB parameters")
57 );
58 println!(
59 "Product name: {:?}",
60 mcp.get_nvram_usb_product_name()
61 .expect("Failed to read NVRAM USB product name")
62 );
63 println!(
64 "Vendor name: {:?}",
65 mcp.get_nvram_usb_vendor_name()
66 .expect("Failed to read NVRAM USB vendor name")
67 );
68}
fn send_access_password( &mut self, password: &[u8; 8], ) -> Result<(), Mcp2210Error>
fn request_bus_release(&mut self, ack_value: bool) -> Result<(), Mcp2210Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.