public Switch(DigitalPin pin, PullUpDownMode pud) { Pin = pin; Pin.PullUpDown(pud); Pin.SetIOMode(PinMode.Input); Pin.SetupInterrupt(InterruptMode.Both); Pin.AddInterruptCallback(InterruptCB); Value = pin.DigitalRead(); Timer.Start(); }
public override void PullUpDown(int pin, PullUpDownMode pud) { if (pud == PullUpDownMode.Off) { WriteRegisterBit(ADDR_GPPU, pin, 0); } else if (pud == PullUpDownMode.Up) { WriteRegisterBit(ADDR_GPPU, pin, 1); } else { throw new NotSupportedException(); } }
public override void PullUpDown(PullUpDownMode pud) { if (pud == PullUpDownMode.Off) { Wrapper.pullUpDnControl(PinNum, Wrapper.PUD_OFF); } else if (pud == PullUpDownMode.Up) { Wrapper.pullUpDnControl(PinNum, Wrapper.PUD_UP); } else if (pud == PullUpDownMode.Down) { Wrapper.pullUpDnControl(PinNum, Wrapper.PUD_DOWN); } }
public RotaryEncoder(DigitalPin p1, DigitalPin p2, PullUpDownMode pud) { Pin1 = p1; Pin2 = p2; Pin1.SetIOMode(PinMode.Input); Pin1.PullUpDown(pud); Pin1.SetupInterrupt(InterruptMode.Both); Pin1.AddInterruptCallback(UpdateSequence); Pin2.SetIOMode(PinMode.Input); Pin2.PullUpDown(pud); Pin2.SetupInterrupt(InterruptMode.Both); Pin2.AddInterruptCallback(UpdateSequence); RotationSequence = GetRotationSequence(); }
public abstract void PullUpDown(int pin, PullUpDownMode pud);
public abstract void PullUpDown(PullUpDownMode pud);
public override void PullUpDown(PullUpDownMode pud) { Controller.PullUpDown(PinNum, pud); }