MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/driver/ModbusDiscreteOutput.hh

44 lines
823 B
C++
Raw Normal View History

2024-06-07 11:12:56 +03:00
/*
* ModbusDiscreteOutput.hh
*
* Created on: 18 мар. 2021 г.
* Author: titov
*/
#ifndef UMLIBRARY_DRIVER_MODBUSDISCRETEOUTPUT_HH_
#define UMLIBRARY_DRIVER_MODBUSDISCRETEOUTPUT_HH_
#include <stdint.h>
#include "IModBus.hh"
namespace driver {
namespace modbus {
class ModbusDiscreteOutput : public IModBusDispatch {
typedef IModBusDispatch::Status Status;
const bool inversion; //!<Признак инверсии выхода.
bool coil_state;
bool on_state() const { return not inversion; }
bool off_state() const { return inversion; }
public:
ModbusDiscreteOutput( bool initial_state, bool inversion );
const bool & status() const;
Status read( uint16_t & reg );
Status write( uint16_t reg );
};
}
}
#endif /* UMLIBRARY_DRIVER_MODBUSDISCRETEOUTPUT_HH_ */