Пример #1
0
 /// <summary>
 /// Unexports an exported pin.
 /// </summary>
 /// <param name="pin">
 /// The pin to unexport.
 /// </param>
 private static void internal_UnexportPin(Int32 pin)
 {
     Debug.WriteLine("Unexporting pin " + pin.ToString());
     // TODO Somehow reverse what we did in internal_ExportPin? Is there
     // a way to "free" the pin in the libbcm2835 library?
     UnsafeNativeMethods.bcm2835_gpio_write((uint)pin, (uint)PinState.Low);
     UnsafeNativeMethods.bcm2835_gpio_fsel((uint)pin, (uint)PinMode.TRI);
     ExportedPins.Remove(pin);
 }
Пример #2
0
 /// <summary>
 /// Unexport the GPIO. This removes the /sys/class/gpio/gpioXX directory.
 /// </summary>
 /// <param name="pin">
 /// The GPIO pin to unexport.
 /// </param>
 /// <param name="gpioNum">
 /// The GPIO number associated with the pin.
 /// </param>
 private static void internal_UnexportPin(Int32 pin, String gpioNum)
 {
     Debug.WriteLine("Unexporting pin " + pin.ToString());
     File.WriteAllText(GPIO_PATH + "unexport", gpioNum);
     ExportedPins.Remove(pin);
 }