public void EnableInterrupt(int gpioId, GpioInterruptEdge edge) { lock (_interruptMonitors) { if (_interruptMonitors.ContainsKey(gpioId)) { return; } lock (_syncRoot) { Export(gpioId); File.WriteAllText("/sys/class/gpio/gpio" + gpioId + "/direction", "in", Encoding.ASCII); // TODO: Edge is only required if the state is read via blocked thread. //File.WriteAllText("/sys/class/gpio/gpio" + gpioId + "/edge", edge.ToString().ToLowerInvariant()); } var initialState = ReadState(gpioId); _interruptMonitors.Add(gpioId, new InterruptMonitor { LatestState = initialState, GpioValuePath = $"/sys/class/gpio/gpio{gpioId}/value" }); } }
public void EnableInterrupt(string hostId, int gpioId, GpioInterruptEdge edge) { if (hostId == null) { throw new ArgumentNullException(nameof(hostId)); } GetAdapter(hostId).EnableInterrupt(gpioId, edge); }
public void EnableInterrupt(int gpioId, GpioInterruptEdge edge) { lock (_interruptMonitors) { if (_interruptMonitors.ContainsKey(gpioId)) { return; } lock (_syncRoot) { ExportGpio(gpioId); WriteGpioDirection(gpioId, "in"); _logger.Log(LogLevel.Information, $"Exported GPIO {gpioId}."); // TODO: Edge is only required if the state is read via blocked thread. //File.WriteAllText("/sys/class/gpio/gpio" + gpioId + "/edge", edge.ToString().ToLowerInvariant()); } _interruptMonitors.Add(gpioId, new InterruptMonitor()); } }
public void EnableInterrupt(int gpio, GpioInterruptEdge edge) { //_logger.Log(LogLevel.Information, $"FAKE EnableInterrupt: GPIO = {gpio}; Edge = {edge}"); }