public BeagleGpioReader(BbbPort pPort, string pLabel = "undef", bool pInitialState = true, bool pInvertPolarity = false)
 {
     port           = pPort;
     label          = pLabel;
     oldState       = pInitialState ? InputSensorState.High : InputSensorState.Low;
     invertPolarity = pInvertPolarity;
     gpio           = new Gpio(BbbPort.P8_43, true, true);
 }
Example #2
0
        public PortBase(BbbPort port, bool autoConfigure = true)
        {
            Port = port;

            if (autoConfigure)
            {
                Configure();
            }
        }
        protected static string GetDevicePath(BbbPort port, IDictionary <BbbPort, string> mappings)
        {
            string result;
            var    ocpPath = Directory.EnumerateDirectories("/sys/devices/", "ocp.*").FirstOrDefault()
                             ?? "/sys/devices/ocp.2"; // Default OCP number
            var mapping = mappings[port];

            result = Directory.EnumerateDirectories(ocpPath, mapping).FirstOrDefault();
            if (result == null)
            {
                throw new BlackNetException(String.Format("Unable to find the device path for '{0}' in OCP path '{1}'.", mapping, ocpPath));
            }
            return(result);
        }
 /// <summary> Constructs a Pulse Width Modulation (PWM) GPIO port wrapper. </summary>
 /// <param name="port"> Must be an available port supporting PWM. </param>
 /// <param name="autoConfigure"> Configure the device tree.  Should be true unless you are certain that it is already configured or you are constructing the instance to unconfgure it. </param>
 public Pwm(BbbPort port, bool autoConfigure = true) : base(port, autoConfigure)
 {
 }
 public SlotPortBase(BbbPort port, bool autoConfigure = true) : base(port, autoConfigure)
 {
 }
 /// <summary> Wraps a digital I/O port. </summary>
 /// <param name="autoConfigure"> Whether to automatically configure the port.  Set to true unless you're certain the port is already configured. </param>
 /// <param name="checkSafety"> When true, extra checks are performed to be sure the port is in ready state before writing. </param>
 public Gpio(BbbPort port, bool autoConfigure = true, bool checkSafety = true) : base(port, autoConfigure)
 {
     _checkSafety = checkSafety;
 }