pub trait ChipInterface {
// Required methods
fn get_pin_list(&self) -> HashMap<&'static str, PinMetadata>;
fn get_pin_value(&self, name: &str) -> Option<Box<dyn Any>>;
fn set_pin_value(&mut self, name: &str, val: &(dyn Any + 'static));
fn is_pin_tristated(&self, name: &str) -> bool;
fn in_input_mode(&self, name: &str) -> bool;
}
Expand description
This is the interface which should be exposed by the chip struct, and will be used by the pcb module. This is meant to be implemented by the #[Derive(Chip)] macro, but can also be manually implemented if needed
Required Methods§
Sourcefn get_pin_list(&self) -> HashMap<&'static str, PinMetadata>
fn get_pin_list(&self) -> HashMap<&'static str, PinMetadata>
gives a mapping from pin name to pin metadata
Sourcefn get_pin_value(&self, name: &str) -> Option<Box<dyn Any>>
fn get_pin_value(&self, name: &str) -> Option<Box<dyn Any>>
returns value of a specific pin, typecasted to Any
Sourcefn set_pin_value(&mut self, name: &str, val: &(dyn Any + 'static))
fn set_pin_value(&mut self, name: &str, val: &(dyn Any + 'static))
sets value of a specific pin, from the given reference
Sourcefn is_pin_tristated(&self, name: &str) -> bool
fn is_pin_tristated(&self, name: &str) -> bool
This is used to check if a tristatable pin is tristated or not
Sourcefn in_input_mode(&self, name: &str) -> bool
fn in_input_mode(&self, name: &str) -> bool
This returns if the io pin is in input mode or not, and false for other pins