Exemplo n.º 1
0
 void Setup(GpioPin portX, GpioPin portY, GpioPin portA, GpioPin portB,
            GpioPin portSelect, GpioPin portJoyHorizontal, GpioPin portJoyVertical)
 {
     ButtonA.PressEnded      += (s, e) => OnA?.Invoke(s, e);
     ButtonB.PressEnded      += (s, e) => OnB?.Invoke(s, e);
     ButtonX.PressEnded      += (s, e) => OnX?.Invoke(s, e);
     ButtonY.PressEnded      += (s, e) => OnY?.Invoke(s, e);
     ButtonSelect.PressEnded += (s, e) => OnSelect?.Invoke(s, e);
 }
Exemplo n.º 2
0
        public JoyWing(IDigitalInputPort portX, IDigitalInputPort portY, IDigitalInputPort portA, IDigitalInputPort portB,
                       IDigitalInputPort portSelect, IDigitalInputPort portJoyHorizontal, IDigitalInputPort portJoyVertical)
        {
            /*  ButtonA = new PushButton(portA);
             * ButtonB = new PushButton(portB);
             * ButtonX = new PushButton(portX);
             * ButtonY = new PushButton(portY);
             * ButtonSelect = new PushButton(portSelect);*/

            ButtonA.PressEnded      += (s, e) => OnA?.Invoke(s, e);
            ButtonB.PressEnded      += (s, e) => OnB?.Invoke(s, e);
            ButtonX.PressEnded      += (s, e) => OnX?.Invoke(s, e);
            ButtonY.PressEnded      += (s, e) => OnY?.Invoke(s, e);
            ButtonSelect.PressEnded += (s, e) => OnSelect?.Invoke(s, e);
        }
        public OLED128x32Wing(II2cBus i2cBus, IDigitalInputPort portA, IDigitalInputPort portB, IDigitalInputPort portC)
        {
            _i2cBus               = i2cBus;
            _display              = new Ssd1306(_i2cBus, 0x3C, Ssd1306.DisplayType.OLED128x32);
            _graphics             = new GraphicsLibrary(_display);
            _graphics.CurrentFont = new Font8x8();

            //Bug? Resistor Mode is being set properly from the above constructor but unless it is set again it doesn't work.
            portA.Resistor = portA.Resistor;
            portC.Resistor = portC.Resistor;

            _buttonA = new PushButton(portA);
            _buttonB = new PushButton(portB);
            _buttonC = new PushButton(portC);

            ButtonA.PressEnded += (s, e) => OnA?.Invoke(s, e);
            ButtonB.PressEnded += (s, e) => OnB?.Invoke(s, e);
            ButtonC.PressEnded += (s, e) => OnC?.Invoke(s, e);
        }