MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/communication/hiperface/HipAnalogValue.cpp

27 lines
649 B
C++
Raw Normal View History

2024-06-07 11:12:56 +03:00
/*
* HipAnalogValue.cpp
*
* Created on: 20 февр. 2020 г.
* Author: user
*/
#include "HipAnalogValue.hh"
unsigned long communication::hiperface::HipAnalogValue::getAnalogValue() const {
unsigned long value;
reinterpret_cast<unsigned char*>( &value )[0] = (request.rec_data[2] << 8);
reinterpret_cast<unsigned char*>( &value )[1] = (request.rec_data[0] << 8) | request.rec_data[1];
return value;
}
communication::hiperface::HipAnalogValue::HipAnalogValue(
driver::HiperfaceNetworkDriver & hip_driver, unsigned short address ) : hip_driver(hip_driver) {
request.message_control.address = address;
}