HerkuleXLib  1.1
Arduino library to drive HerkuleX DRS-0101 and DRS-0201
/home/benoit/sketchbook/libraries/HerkuleXLib/HkxStatus.h
Go to the documentation of this file.
1 #ifndef _HKXSTATUS_H
2 #define _HKXSTATUS_H
3 
13 #include "Arduino.h"
14 
15 // Status - See. Manual p39.
16 
18 const uint8_t HKX_STAT_VOLTAGE = 0x01;
20 const uint8_t HKX_STAT_POSITION = 0x02;
22 const uint8_t HKX_STAT_TEMPERATURE = 0x04;
24 const uint8_t HKX_STAT_PACKET = 0x08;
26 const uint8_t HKX_STAT_OVERLOAD = 0x10;
28 const uint8_t HKX_STAT_DRIVER = 0x20;
30 const uint8_t HKX_STAT_ROM_DISTORTED = 0x40;
31 
33 const uint8_t HKX_STAT_MOVING_FLAG = 0x01;
35 const uint8_t HKX_STAT_INPOSITION_FLAG = 0x02;
37 const uint8_t HKX_STAT_CKECKSUM = 0x04;
39 const uint8_t HKX_STAT_COMMAND = 0x08;
41 const uint8_t HKX_STAT_EXCEED_REGISTER = 0x10;
43 const uint8_t HKX_STAT_GARBAGE = 0x20;
45 const uint8_t HKX_STAT_MOTOR_FLAG = 0x40;
46 
48 const uint8_t HKX_STAT_ALL = 0x7F;
49 
55 class HkxStatus{
56 private:
58  uint8_t _statusED[2];
59 
60 public:
66  _statusED[0] = 0;
67  _statusED[1] = 0;
68  };
69 
92  boolean isError(uint8_t mask) const {
93  return (mask &= this->_statusED[0])?true:false;
94  };
95 
118  boolean isDetail(uint8_t mask) const {
119  return (mask &= this->_statusED[1])?true:false;
120  };
121 
127  void getRawData(uint8_t statusED[]) const {
128  statusED[0] = this->_statusED[0];
129  statusED[1] = this->_statusED[1];
130  };
131 
137  void setRawData(const uint8_t statusED[]){
138  this->_statusED[0] = statusED[0];
139  this->_statusED[1] = statusED[1];
140  };
141 };
142 
143 #endif // _HKXSTATUS_H
144 
145 
const uint8_t HKX_STAT_EXCEED_REGISTER
Definition: HkxStatus.h:41
const uint8_t HKX_STAT_PACKET
Definition: HkxStatus.h:24
const uint8_t HKX_STAT_MOTOR_FLAG
Definition: HkxStatus.h:45
const uint8_t HKX_STAT_VOLTAGE
Definition: HkxStatus.h:18
const uint8_t HKX_STAT_POSITION
Definition: HkxStatus.h:20
HkxStatus()
Default constructor.
Definition: HkxStatus.h:65
uint8_t _statusED[2]
Definition: HkxStatus.h:58
Class to manage the status of the servos.
Definition: HkxStatus.h:55
const uint8_t HKX_STAT_ALL
Definition: HkxStatus.h:48
const uint8_t HKX_STAT_COMMAND
Definition: HkxStatus.h:39
void getRawData(uint8_t statusED[]) const
Get the status raw data.
Definition: HkxStatus.h:127
boolean isDetail(uint8_t mask) const
Check for details.
Definition: HkxStatus.h:118
boolean isError(uint8_t mask) const
Check for errors.
Definition: HkxStatus.h:92
const uint8_t HKX_STAT_ROM_DISTORTED
Definition: HkxStatus.h:30
const uint8_t HKX_STAT_MOVING_FLAG
Definition: HkxStatus.h:33
const uint8_t HKX_STAT_OVERLOAD
Definition: HkxStatus.h:26
const uint8_t HKX_STAT_DRIVER
Definition: HkxStatus.h:28
const uint8_t HKX_STAT_INPOSITION_FLAG
Definition: HkxStatus.h:35
void setRawData(const uint8_t statusED[])
Set the status raw data.
Definition: HkxStatus.h:137
const uint8_t HKX_STAT_TEMPERATURE
Definition: HkxStatus.h:22
const uint8_t HKX_STAT_CKECKSUM
Definition: HkxStatus.h:37
const uint8_t HKX_STAT_GARBAGE
Definition: HkxStatus.h:43