Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
 public abstract void PullUpDown(int pin, PullUpDownMode pud);
Esempio n. 6
0
 public abstract void PullUpDown(PullUpDownMode pud);
Esempio n. 7
0
 public override void PullUpDown(PullUpDownMode pud)
 {
     Controller.PullUpDown(PinNum, pud);
 }