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()); }
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); }
public string Read() { return(File.ReadAllText(GpioPath + GpioPinNumber.ToString().ToLower() + "/value")); }
public void Write(State state) { State = state; File.WriteAllText(GpioPath + GpioPinNumber.ToString().ToLower() + "/value", ((int)state).ToString()); }
public OutputGpioPin(GpioPinNumber pin, State state) : base(pin, Direction.Out) { Write(state); }
public OutputGpioPin(GpioPinNumber pin) : base(pin, Direction.Out) { Write(State.Low); }
public InputPin(GpioPinNumber pin) : base(pin, Direction.In) { }