MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/driver/ModbusDiscreteOutput.hh
2024-06-07 11:12:56 +03:00

44 lines
823 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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_ */