Exemplo n.º 1
0
	void BaseStationEepromHelper::write_analogPair(uint8 portNumber, const BaseStationAnalogPair& pair)
	{
		//throw exception is analog pairing isn't supported
		checkAnalogPairingSupported();

		EepromLocation analogEE_nodeAddress = BaseStationEepromMap::analogNodeAddressEeprom(portNumber);
		EepromLocation analogEE_nodeChannel = BaseStationEepromMap::analogNodeChannelEeprom(portNumber);
		EepromLocation analogEE_maxFloat = BaseStationEepromMap::analogMaxFloatEeprom(portNumber);
		EepromLocation analogEE_minFloat = BaseStationEepromMap::analogMinFloatEeprom(portNumber);

		//write all the values to eeprom
		write(analogEE_nodeAddress, Value::UINT16(pair.nodeAddress()));
		write(analogEE_nodeChannel, Value::UINT16(static_cast<uint16>(pair.nodeChannel())));
		write(analogEE_maxFloat, Value::FLOAT(pair.outputVal_3V()));
		write(analogEE_minFloat, Value::FLOAT(pair.outputVal_0V()));
	}
    void BaseStationEepromHelper::write_analogPair(uint8 portNumber, const BaseStationAnalogPair& pair)
    {
        //throw exception is analog pairing isn't supported
        checkAnalogPairingSupported();

        EepromLocation analogEE_nodeAddress = BaseStationEepromMap::analogNodeAddressEeprom(portNumber);
        EepromLocation analogEE_nodeChannel = BaseStationEepromMap::analogNodeChannelEeprom(portNumber);
        EepromLocation analogEE_maxFloat = BaseStationEepromMap::analogMaxFloatEeprom(portNumber);
        EepromLocation analogEE_minFloat = BaseStationEepromMap::analogMinFloatEeprom(portNumber);

        //write all the values to eeprom
        write(analogEE_nodeAddress, Value::UINT16(pair.nodeAddress()));

        //a value of 0xFF should disable the channel (actually write a 0xFFFF)
        uint16 chToWrite = pair.nodeChannel();
        if(chToWrite == 0xFF)
        {
            chToWrite = 0xFFFF;
        }
        write(analogEE_nodeChannel, Value::UINT16(chToWrite));

        write(analogEE_maxFloat, Value::FLOAT(pair.outputVal_3V()));
        write(analogEE_minFloat, Value::FLOAT(pair.outputVal_0V()));
    }