예제 #1
0
        void EnsurePinFunction(GpioPin pin, GpioFunction function)
        {
            GpioFunction oldFunction;

            if (ConnectedPins.TryGetValue(pin, out oldFunction))
            {
                if (oldFunction == function)
                {
                    return;
                }
                ConnectedPins[pin] = function;
            }
            else
            {
                ConnectedPins.Add(pin, function);
                PinStates.Add(pin, false);
            }

            Gpio.SetFunction(pin, function);
        }
예제 #2
0
        // esp32-hal-gpio.h: 500~

        // void pinMode(uint8_t pin, uint8_t mode);
        // private const int PIN_MODE = 500;
        public void pinMode(int pin, GpioFunction mode)
        {
            GpioCommand(PIN_MODE, pin, (int)mode);
        }
예제 #3
0
 public static void SetFunction(GpioPin pin, GpioFunction function)
 {
     Native.bcm2835_gpio_fsel(pin, (byte)function);
 }