pub fn new(expander: &'a T) -> Result<Self, StackShieldError<ExpanderError<E>>> {
        let detect = ExpanderInputPin::new(expander, Bank0, 3)
            .map_err(|err| StackShieldError::GpioError { source: err })?;

        let daughterboard_detect = DaughterboardDetect::new(detect);

        let red = ExpanderOutputPin::new(expander, Bank0, 0, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let green = ExpanderOutputPin::new(expander, Bank0, 1, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let blue = ExpanderOutputPin::new(expander, Bank0, 2, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;

        let status_led = Led::new(red, green, blue);

        let sw_target_0 = ExpanderOutputPin::new(expander, Bank1, 3, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_target_1 = ExpanderOutputPin::new(expander, Bank1, 2, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_target_2 = ExpanderOutputPin::new(expander, Bank1, 1, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_target_3 = ExpanderOutputPin::new(expander, Bank1, 0, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;

        let sw_probe_0 = ExpanderOutputPin::new(expander, Bank1, 7, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_1 = ExpanderOutputPin::new(expander, Bank1, 6, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_2 = ExpanderOutputPin::new(expander, Bank1, 5, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_3 = ExpanderOutputPin::new(expander, Bank1, 4, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;

        let bus_switch = BusSwitch::new(
            [sw_target_0, sw_target_1, sw_target_2, sw_target_3],
            [sw_probe_0, sw_probe_1, sw_probe_2, sw_probe_3],
        );

        Ok(ExpanderGpio {
            status_led,
            bus_switch,
            daughterboard_detect,
        })
    }
/// Creates a new instance of the struct. It configures the IO Expander to the required settings. All GPIO pins are initialized into the default mode (eg. All bus switches disconnected, status LED off, daughterboard detect configured as input pin)
Creates a new instance of the struct. It configures the IO Expander to the required settings. All GPIO pins are initialized into the default mode
Creates a new instance of the struct . It configures the IO Expander to the required settings . All GPIO pins are initialized into the default mode
pub fn new(expander: &'a T) -> Result<Self, StackShieldError<ExpanderError<E>>> {
        let detect = ExpanderInputPin::new(expander, Bank0, 3)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let daughterboard_detect = DaughterboardDetect::new(detect);
        let red = ExpanderOutputPin::new(expander, Bank0, 0, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let green = ExpanderOutputPin::new(expander, Bank0, 1, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let blue = ExpanderOutputPin::new(expander, Bank0, 2, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let status_led = Led::new(red, green, blue);
        let sw_target_0 = ExpanderOutputPin::new(expander, Bank1, 3, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_target_1 = ExpanderOutputPin::new(expander, Bank1, 2, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_target_2 = ExpanderOutputPin::new(expander, Bank1, 1, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_target_3 = ExpanderOutputPin::new(expander, Bank1, 0, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_0 = ExpanderOutputPin::new(expander, Bank1, 7, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_1 = ExpanderOutputPin::new(expander, Bank1, 6, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_2 = ExpanderOutputPin::new(expander, Bank1, 5, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let sw_probe_3 = ExpanderOutputPin::new(expander, Bank1, 4, High)
            .map_err(|err| StackShieldError::GpioError { source: err })?;
        let bus_switch = BusSwitch::new(
            [sw_target_0, sw_target_1, sw_target_2, sw_target_3],
            [sw_probe_0, sw_probe_1, sw_probe_2, sw_probe_3],
        );
        Ok(ExpanderGpio {
            status_led,
            bus_switch,
            daughterboard_detect,
        })
    }
pub fn new ( expander : & ' a T ) -> Result < Self , StackShieldError < ExpanderError < E > > > { let detect = ExpanderInputPin :: new ( expander , Bank0 , 3 ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let daughterboard_detect = DaughterboardDetect :: new ( detect ) ; let red = ExpanderOutputPin :: new ( expander , Bank0 , 0 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let green = ExpanderOutputPin :: new ( expander , Bank0 , 1 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let blue = ExpanderOutputPin :: new ( expander , Bank0 , 2 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let status_led = Led :: new ( red , green , blue ) ; let sw_target_0 = ExpanderOutputPin :: new ( expander , Bank1 , 3 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_target_1 = ExpanderOutputPin :: new ( expander , Bank1 , 2 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_target_2 = ExpanderOutputPin :: new ( expander , Bank1 , 1 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_target_3 = ExpanderOutputPin :: new ( expander , Bank1 , 0 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_probe_0 = ExpanderOutputPin :: new ( expander , Bank1 , 7 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_probe_1 = ExpanderOutputPin :: new ( expander , Bank1 , 6 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_probe_2 = ExpanderOutputPin :: new ( expander , Bank1 , 5 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let sw_probe_3 = ExpanderOutputPin :: new ( expander , Bank1 , 4 , High ) . map_err ( | err | StackShieldError :: GpioError { source : err } ) ? ; let bus_switch = BusSwitch :: new ( [ sw_target_0 , sw_target_1 , sw_target_2 , sw_target_3 ] , [ sw_probe_0 , sw_probe_1 , sw_probe_2 , sw_probe_3 ] , ) ; Ok ( ExpanderGpio { status_led , bus_switch , daughterboard_detect , } ) }
Creates a new instance of the struct.
Creates a new instance of the struct .
expander
&'a T