void BaseStationEepromHelper::write_analogExceedanceEnabled(bool enable)
    {
        //throw exception is analog pairing isn't supported
        checkAnalogPairingSupported();

        //write the value to eeprom
        write(BaseStationEepromMap::ANALOG_EXCEED_ENABLE, Value::UINT16(static_cast<uint16>(enable)));
    }
    bool BaseStationEepromHelper::read_analogExceedanceEnabled() const
    {
        //throw exception is analog pairing isn't supported
        checkAnalogPairingSupported();

        //read and return the value from eeprom
        return (read(BaseStationEepromMap::ANALOG_EXCEED_ENABLE).as_uint16() == 1);
    }
    void BaseStationEepromHelper::write_analogTimeoutVoltage(float voltage)
    {
        //throw exception is analog pairing isn't supported
        checkAnalogPairingSupported();

        //write the value to eeprom
        write(BaseStationEepromMap::ANALOG_TIMEOUT_VOLTAGE, Value::FLOAT(voltage));
    }
    float BaseStationEepromHelper::read_analogTimeoutVoltage() const
    {
        //throw exception is analog pairing isn't supported
        checkAnalogPairingSupported();

        //read and return the value from eeprom
        return read(BaseStationEepromMap::ANALOG_TIMEOUT_VOLTAGE).as_float();
    }
    void BaseStationEepromHelper::write_analogTimeoutTime(uint16 seconds)
    {
        //throw exception is analog pairing isn't supported
        checkAnalogPairingSupported();

        //write the value to eeprom
        write(BaseStationEepromMap::ANALOG_TIMEOUT_TIME, Value::UINT16(seconds));
    }
Пример #6
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()));
	}
    BaseStationAnalogPair BaseStationEepromHelper::read_analogPair(uint8 portNumber) const
    {
        //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);

        //read all the eeprom values
        uint16 nodeAddress = read(analogEE_nodeAddress).as_uint16();
        uint8 nodeChannel = static_cast<uint8>(read(analogEE_nodeChannel).as_uint16());
        float maxFloat = read(analogEE_maxFloat).as_float();
        float minFloat = read(analogEE_minFloat).as_float();

        //build and return a BaseStationAnalogPair
        return BaseStationAnalogPair::Float(nodeAddress, nodeChannel, minFloat, maxFloat);
    }
    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()));
    }