Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00028
00029 #ifndef SVHCONTROLLERSTATE_H
00030 #define SVHCONTROLLERSTATE_H
00031
00032 namespace driver_svh {
00033
00037 struct SVHControllerState
00038 {
00041 uint16_t pwm_fault;
00044 uint16_t pwm_otw;
00046 uint16_t pwm_reset;
00049 uint16_t pwm_active;
00051 uint16_t pos_ctrl;
00053 uint16_t cur_ctrl;
00054
00056 SVHControllerState(uint16_t _pwm_fault =0,uint16_t _pwm_otw = 0 , uint16_t _pwm_reset = 0 ,uint16_t _pwm_active = 0 ,uint16_t _pos_ctrl =0, uint16_t _cur_ctrl =0):
00057 pwm_fault(_pwm_fault),
00058 pwm_otw(_pwm_otw),
00059 pwm_reset(_pwm_reset),
00060 pwm_active(_pwm_active),
00061 pos_ctrl(_pos_ctrl),
00062 cur_ctrl(_cur_ctrl)
00063 { }
00064
00066 bool operator == (const SVHControllerState& other) const
00067 {
00068 return
00069 (pwm_fault == other.pwm_fault
00070 && pwm_otw == other.pwm_otw
00071 && pwm_reset == other.pwm_reset
00072 && pwm_active == other.pwm_active
00073 && pos_ctrl == other.pos_ctrl
00074 && cur_ctrl == other.cur_ctrl);
00075 }
00076 };
00077
00079 inline icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHControllerState& data)
00080 {
00081 ab << data.pwm_fault
00082 << data.pwm_otw
00083 << data.pwm_reset
00084 << data.pwm_active
00085 << data.pos_ctrl
00086 << data.cur_ctrl;
00087 return ab;
00088 }
00089
00091 inline icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHControllerState& data)
00092 {
00093 ab >> data.pwm_fault
00094 >> data.pwm_otw
00095 >> data.pwm_reset
00096 >> data.pwm_active
00097 >> data.pos_ctrl
00098 >> data.cur_ctrl;
00099
00100 return ab;
00101 }
00102
00104 inline std::ostream& operator << (std::ostream& o, const SVHControllerState& cs)
00105 {
00106 o << std::setw(4) << std::setfill('0') << std::hex
00107 << "pwm_fault " << "0x" << static_cast<int>(cs.pwm_fault) << " "
00108 << "pwm_otw " << "0x" << static_cast<int>(cs.pwm_otw) << " "
00109 << "pwm_reset " << "0x" << static_cast<int>(cs.pwm_reset) << " "
00110 << "pwm_active " << "0x" << static_cast<int>(cs.pwm_active) << " "
00111 << "pos_ctr " << "0x" << static_cast<int>(cs.pos_ctrl) << " "
00112 << "cur_ctrl " << "0x" << static_cast<int>(cs.cur_ctrl) << " "
00113 << std::endl;
00114
00115 std::cout << std::dec ;
00116 return o;
00117 }
00118
00119 }
00120
00121
00122 #endif // SVHCONTROLLERSTATE_H