Changing some typedef enum {} name; to enum name {};

This commit is contained in:
Rob Giseburt
2020-01-10 19:24:35 -06:00
parent 6b03213ea6
commit 6c7980b1e6
2 changed files with 15 additions and 23 deletions
+10 -10
View File
@@ -53,20 +53,20 @@ using Motate::kStartLow;
//--- do not change from here down ---//
typedef enum {
enum ioEnabled {
IO_UNAVAILABLE = -1, // input/output is missing/used/unavailable
IO_DISABLED = 0, // input/output is disabled
IO_ENABLED = 1 // input/output enabled
} ioEnabled;
};
typedef enum {
enum ioPolarity {
IO_ACTIVE_HIGH = 0, // input/output is active high (aka normally closed)
IO_ACTIVE_LOW = 1, // input/output is active low (aka normally open)
} ioPolarity;
};
#define NORMALLY_OPEN IO_ACTIVE_LOW // equivalent
#define NORMALLY_CLOSED IO_ACTIVE_HIGH // equivalent
typedef enum { // actions are initiated from within the input's ISR
enum inputAction { // actions are initiated from within the input's ISR
INPUT_ACTION_NONE = 0,
INPUT_ACTION_STOP, // 1 - stop at normal jerk - preserves positional accuracy
INPUT_ACTION_FAST_STOP, // 2 - stop at high jerk - preserves positional accuracy
@@ -81,21 +81,21 @@ typedef enum { // actions are initiated from within the
INPUT_ACTION_INTERLOCK, // 10 - interlock processing
INPUT_ACTION_INTERNAL, // 11 - homing/probing processing (internal only)
} inputAction;
};
#define INPUT_ACTION_MAX INPUT_ACTION_INTERLOCK // for range checking
#define INPUT_ACTION_ACTUAL_MAX INPUT_ACTION_INTERNAL // for internal checking and resource allocation
typedef enum {
enum ioState {
INPUT_INACTIVE = 0, // aka switch open, also read as 'false'
INPUT_ACTIVE = 1, // aka switch closed, also read as 'true'
INPUT_DISABLED = 2 // value returned if input is disabled
} ioState;
};
typedef enum {
enum inputEdgeFlag {
INPUT_EDGE_NONE = 0, // no edge detected or edge flag reset (must be zero)
INPUT_EDGE_LEADING, // flag is set when leading edge is detected
INPUT_EDGE_TRAILING // flag is set when trailing edge is detected
} inputEdgeFlag;
};
// forward declare
struct gpioDigitalInputReader;
+5 -13
View File
@@ -264,26 +264,18 @@
*********************************/
//See hardware.h for platform specific stepper definitions
typedef enum {
enum prepBufferState {
PREP_BUFFER_OWNED_BY_LOADER = 0, // staging buffer is ready for load
PREP_BUFFER_OWNED_BY_EXEC // staging buffer is being loaded
} prepBufferState;
};
typedef enum { // used w/start and stop flags to sequence motor power
MOTOR_OFF = 0, // motor is stopped and deenergized
MOTOR_IDLE, // motor is stopped and may be partially energized for torque maintenance
MOTOR_RUNNING, // motor is running (and fully energized)
MOTOR_POWER_TIMEOUT_START, // transitional state to start power-down timeout
MOTOR_POWER_TIMEOUT_COUNTDOWN // count down the time to de-energizing motor
} stPowerState;
typedef enum {
enum stPowerMode {
MOTOR_DISABLED = 0, // motor enable is deactivated
MOTOR_ALWAYS_POWERED, // motor is always powered while machine is ON
MOTOR_POWERED_IN_CYCLE, // motor fully powered during cycles, de-powered out of cycle
MOTOR_POWERED_ONLY_WHEN_MOVING, // motor only powered while moving - idles shortly after it's stopped - even in cycle
MOTOR_POWER_REDUCED_WHEN_IDLE // enable Vref current reduction for idle
} stPowerMode;
};
#define MOTOR_POWER_MODE_MAX_VALUE MOTOR_POWER_REDUCED_WHEN_IDLE
// Min/Max timeouts allowed for motor disable. Allow for inertial stop; must be non-zero
@@ -478,7 +470,7 @@ public:
virtual float getCurrentPowerLevel()
{
// Override to return a proper value
return (0.0);
return (0.0);
};
// turn on motor in all cases unless it's disabled