internal AnalogOutput(NeuronGroup neuronGroup, int number, ushort registerNumber, NeuronSpiConnector spiConnector, DriverLogger logger) { _registerNumber = registerNumber; _logger = logger; _logger.LogInstantiating(this); _neuronGroup = neuronGroup; _spiConnector = spiConnector; UniqueIdentifyer = new UniqueIdentifier(neuronGroup, NeuronResource.AnalogOutput, number); var vOffset = _spiConnector.GetSingleRegisterValue(neuronGroup, 1021); var vDef = _spiConnector.GetSingleRegisterValue(neuronGroup, 1020); var vRef = _spiConnector.GetSingleRegisterValue(neuronGroup, 1009); var vRefInt = _spiConnector.GetSingleRegisterValue(neuronGroup, 5); if (vRefInt == null || vRef == null || vOffset == null || vDef == null) { throw new Exception("failure while getting the calibration Values from the Registers!"); } _vOffset = BitConverter.ToInt16(BitConverter.GetBytes(vOffset.Value), 0); _vDev = BitConverter.ToInt16(BitConverter.GetBytes(vDef.Value), 0); _vRealInt = 3.3 * ((double)vRef / (double)vRefInt); }
internal DigitalOutput(int numberOfOutputOnGroup, NeuronGroup neuronGroup, ushort coilNumber, NeuronSpiConnector neuronSpiConnector, DriverLogger logger, DigitalRelayOutputType digitalRelayOutputType, ushort registerNumber, ushort bitNumber) { _neuronGroup = neuronGroup; _coilNumber = coilNumber; _neuronSpiConnector = neuronSpiConnector; _registerNumber = registerNumber; _bitNumber = bitNumber; logger.LogInstantiating(this); UniqueIdentifyer = digitalRelayOutputType == DigitalRelayOutputType.DigitalOutput ? new UniqueIdentifier(_neuronGroup, NeuronResource.DigitalOutput, numberOfOutputOnGroup) : new UniqueIdentifier(_neuronGroup, NeuronResource.RelayOutput, numberOfOutputOnGroup); UpdateLocalValue(); }