public DatapointValue GetValueFor(DatapointDefinition datapoint) { var eapiGpioId = _gpioIdMap[datapoint.Uri]; GpioLevel gpioLevel = _gpioDriver.GetLevel(); var levelOf = gpioLevel.GetLevelOf(eapiGpioId); return(new SgetDatapointValue(levelOf, datapoint)); }
private void Test(GpioCapability gpioCap) { if (gpioCap.IsUnsupported) { _logger.Warning("GPIO is not supported"); return; } _logger.Information(gpioCap.ToString()); GpioLevel level = _gpioDriver.GetLevel(); _logger.Information(level.ToString()); _logger.Information("EapiGpioId Value:" + _gpioDriver.GetLevel().GetLevelOf(EapiGpioId.EAPI_ID_GPIO_GPIO14)); for (int i = 0; i < 16; i++) { EapiGpioId pin = (EapiGpioId)i; if (gpioCap.IsOutput(pin)) { _gpioDriver.SetLevel(pin, GpioLevelEnum.EapiGpioHigh); } Thread.Sleep(200); } for (int i = 0; i < 16; i++) { EapiGpioId pin = (EapiGpioId)i; if (gpioCap.IsOutput(pin)) { _gpioDriver.SetLevel(pin, GpioLevelEnum.EapiGpioLow); } Thread.Sleep(200); } _logger.Information("EapiGpioId Value:" + _gpioDriver.GetLevel().GetLevelOf(EapiGpioId.EAPI_ID_GPIO_GPIO14)); _gpioDriver.SetAll(GpioLevelEnum.EapiGpioHigh); }