Skip to content

define sizes and explicit values for all enums #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/common/base_classes/FOCMotor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
/**
* Motiron control type
*/
enum MotionControlType{
torque,//!< Torque control
velocity,//!< Velocity motion control
angle,//!< Position/angle motion control
velocity_openloop,
angle_openloop
enum MotionControlType : uint8_t {
torque = 0x00, //!< Torque control
velocity = 0x01, //!< Velocity motion control
angle = 0x02, //!< Position/angle motion control
velocity_openloop = 0x03,
angle_openloop = 0x04
};

/**
* Motiron control type
*/
enum TorqueControlType{
voltage, //!< Torque control using voltage
dc_current, //!< Torque control using DC current (one current magnitude)
foc_current //!< torque control using dq currents
enum TorqueControlType : uint8_t {
voltage = 0x00, //!< Torque control using voltage
dc_current = 0x01, //!< Torque control using DC current (one current magnitude)
foc_current = 0x02, //!< torque control using dq currents
};

/**
* FOC modulation type
*/
enum FOCModulationType{
SinePWM, //!< Sinusoidal PWM modulation
SpaceVectorPWM, //!< Space vector modulation method
Trapezoid_120,
Trapezoid_150
enum FOCModulationType : uint8_t {
SinePWM = 0x00, //!< Sinusoidal PWM modulation
SpaceVectorPWM = 0x01, //!< Space vector modulation method
Trapezoid_120 = 0x02,
Trapezoid_150 = 0x03,
};

/**
Expand Down
12 changes: 6 additions & 6 deletions src/common/base_classes/Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
/**
* Direction structure
*/
enum Direction{
CW = 1, //clockwise
enum Direction : int8_t {
CW = 1, // clockwise
CCW = -1, // counter clockwise
UNKNOWN = 0 //not yet known or invalid state
UNKNOWN = 0 // not yet known or invalid state
};


/**
* Pullup configuration structure
*/
enum Pullup{
USE_INTERN, //!< Use internal pullups
USE_EXTERN //!< Use external pullups
enum Pullup : uint8_t {
USE_INTERN = 0x00, //!< Use internal pullups
USE_EXTERN = 0x01 //!< Use external pullups
};

/**
Expand Down
8 changes: 4 additions & 4 deletions src/communication/Commander.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@


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


Expand Down
6 changes: 3 additions & 3 deletions src/sensors/Encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
/**
* Quadrature mode configuration structure
*/
enum Quadrature{
ON, //!< Enable quadrature mode CPR = 4xPPR
OFF //!< Disable quadrature mode / CPR = PPR
enum Quadrature : uint8_t {
ON = 0x00, //!< Enable quadrature mode CPR = 4xPPR
OFF = 0x01 //!< Disable quadrature mode / CPR = PPR
};

class Encoder: public Sensor{
Expand Down