Example #1
0
        protected GpioPin(GpioPinNumber pin, Direction direction)
        {
            GpioPinNumber = pin;
            Direction     = direction;

            File.WriteAllText(GpioPath + "export", ((int)pin).ToString());
            File.WriteAllText(GpioPath + pin.ToString().ToLower() + "/direction", direction.ToString().ToLower());
        }
Example #2
0
        public static void AddData(DataModel dataModel)
        {
            foreach (var pin in dataModel.PinConfig.Pin)
            {
                var pinNo = int.Parse(pin.PinNumber);
                if (!dictionary.ContainsKey(pinNo))
                {
                    GpioPinNumber gpioPinNo = (GpioPinNumber)pinNo;
                    Direction     direction = DirectionDictionary[pin.Direction];
                    State         state     = StateDictionary[pin.State];
                    if (direction == Direction.Out)
                    {
                        var outputPin = new OutputGpioPin(gpioPinNo);
                        dictionary.Add(pinNo, outputPin);
                    }
                }
            }

            Console.WriteLine("Add Count : " + dictionary.Count);
        }
Example #3
0
 public string Read()
 {
     return(File.ReadAllText(GpioPath + GpioPinNumber.ToString().ToLower() + "/value"));
 }
Example #4
0
 public void Write(State state)
 {
     State = state;
     File.WriteAllText(GpioPath + GpioPinNumber.ToString().ToLower() + "/value", ((int)state).ToString());
 }
Example #5
0
 public OutputGpioPin(GpioPinNumber pin, State state) : base(pin, Direction.Out)
 {
     Write(state);
 }
Example #6
0
 public OutputGpioPin(GpioPinNumber pin) : base(pin, Direction.Out)
 {
     Write(State.Low);
 }
Example #7
0
 public InputPin(GpioPinNumber pin)
     : base(pin, Direction.In)
 {
 }