public GpioWatcher(PinConfigration pinConfigration) { config = pinConfigration; watcher = new FileSystemWatcher(); // watcher configration. watcher.Path = $"/sys/class/gpio/gpio{config.PinNumber}/"; watcher.NotifyFilter = NotifyFilters.LastWrite; watcher.Changed += (o, e) => { Console.WriteLine($"{DateTime.Now} : watcher :{e.Name}"); switch (e.Name) { case "value": OnValueChanged(); break; case "direction": OnDirectionChanged(); break; } }; watcher.EnableRaisingEvents = true; }
public GpioController(PinConfigration pinConfigration) { config = pinConfigration; Open(); Direction = config.Output; }