Skip to content

Commit e80c72f

Browse files
committed
define sizes and explicit values for all enums
1 parent e24534a commit e80c72f

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

src/common/base_classes/FOCMotor.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@
2424
/**
2525
* Motiron control type
2626
*/
27-
enum MotionControlType{
28-
torque,//!< Torque control
29-
velocity,//!< Velocity motion control
30-
angle,//!< Position/angle motion control
31-
velocity_openloop,
32-
angle_openloop
27+
enum MotionControlType : uint8_t {
28+
torque = 0x00, //!< Torque control
29+
velocity = 0x01, //!< Velocity motion control
30+
angle = 0x02, //!< Position/angle motion control
31+
velocity_openloop = 0x03,
32+
angle_openloop = 0x04
3333
};
3434

3535
/**
3636
* Motiron control type
3737
*/
38-
enum TorqueControlType{
39-
voltage, //!< Torque control using voltage
40-
dc_current, //!< Torque control using DC current (one current magnitude)
41-
foc_current //!< torque control using dq currents
38+
enum TorqueControlType : uint8_t {
39+
voltage = 0x00, //!< Torque control using voltage
40+
dc_current = 0x01, //!< Torque control using DC current (one current magnitude)
41+
foc_current = 0x02, //!< torque control using dq currents
4242
};
4343

4444
/**
4545
* FOC modulation type
4646
*/
47-
enum FOCModulationType{
48-
SinePWM, //!< Sinusoidal PWM modulation
49-
SpaceVectorPWM, //!< Space vector modulation method
50-
Trapezoid_120,
51-
Trapezoid_150
47+
enum FOCModulationType : uint8_t {
48+
SinePWM = 0x00, //!< Sinusoidal PWM modulation
49+
SpaceVectorPWM = 0x01, //!< Space vector modulation method
50+
Trapezoid_120 = 0x02,
51+
Trapezoid_150 = 0x03,
5252
};
5353

5454
/**

src/common/base_classes/Sensor.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
/**
77
* Direction structure
88
*/
9-
enum Direction{
10-
CW = 1, //clockwise
9+
enum Direction : int8_t {
10+
CW = 1, // clockwise
1111
CCW = -1, // counter clockwise
12-
UNKNOWN = 0 //not yet known or invalid state
12+
UNKNOWN = 0 // not yet known or invalid state
1313
};
1414

1515

1616
/**
1717
* Pullup configuration structure
1818
*/
19-
enum Pullup{
20-
USE_INTERN, //!< Use internal pullups
21-
USE_EXTERN //!< Use external pullups
19+
enum Pullup : uint8_t {
20+
USE_INTERN = 0x00, //!< Use internal pullups
21+
USE_EXTERN = 0x01 //!< Use external pullups
2222
};
2323

2424
/**

src/communication/Commander.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313

1414
// Commander verbose display to the user type
15-
enum VerboseMode{
16-
nothing = 0, // display nothing - good for monitoring
17-
on_request, // display only on user request
18-
user_friendly // display textual messages to the user
15+
enum VerboseMode : uint8_t {
16+
nothing = 0x00, // display nothing - good for monitoring
17+
on_request = 0x01, // display only on user request
18+
user_friendly = 0x02 // display textual messages to the user
1919
};
2020

2121

src/sensors/Encoder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
/**
1111
* Quadrature mode configuration structure
1212
*/
13-
enum Quadrature{
14-
ON, //!< Enable quadrature mode CPR = 4xPPR
15-
OFF //!< Disable quadrature mode / CPR = PPR
13+
enum Quadrature : uint8_t {
14+
ON = 0x00, //!< Enable quadrature mode CPR = 4xPPR
15+
OFF = 0x01 //!< Disable quadrature mode / CPR = PPR
1616
};
1717

1818
class Encoder: public Sensor{

0 commit comments

Comments
 (0)