|
| #define | MCL_DEBUG printf |
| |
| #define | MCL_PI HPM_PI |
| |
| #define | MCL_2PI HPM_2_PI |
| |
| #define | MCL_PI_DIV3 (MCL_PI / 3.0f) |
| |
| #define | MCL_DELAY_US(x) mcl_user_delay_us(x) |
| |
| #define | MCL_DELAY_MS(x) MCL_DELAY_US(1000*x) |
| |
| #define | MCL_EMPTY |
| |
| #define | MCL_ASSERT_BOOL(b, code_extend, errcode) |
| |
| #define | MCL_ASSERT_EXEC_CODE_BOOL(b, code_extend) |
| |
| #define | MCL_ASSERT(x, return_errcode) MCL_ASSERT_BOOL(((uint32_t)(x) != 0), MCL_EMPTY, return_errcode) |
| |
| #define | MCL_ASSERT_EXEC_CODE(x, code) MCL_ASSERT_EXEC_CODE_BOOL((x), code) |
| |
| #define | MCL_ASSERT_EXEC_CODE_AND_RETURN(x, code, return_errcode) MCL_ASSERT_BOOL((x), code, return_errcode) |
| |
| #define | MCL_ASSERT_EXEC_CODE_OPT MCL_ASSERT_EXEC_CODE |
| |
| #define | MCL_ASSERT_OPT MCL_ASSERT |
| |
| #define | MCL_ASSERT_EXEC_CODE_AND_RETURN_OPT MCL_ASSERT_EXEC_CODE_AND_RETURN |
| |
| #define | MCL_FUNCTION_EXC_IF_ENABLE(b, str_f, f) |
| |
| #define | MCL_FUNCTION_EXC_IF_ELSE_ENABLE(b, str_f, _if, _else) |
| |
| #define | MCL_FUNCTION_INIT_IF_EMPTY(str_function, function) MCL_FUNCTION_EXC_IF_ENABLE((str_function == NULL), str_function, function) |
| |
| #define | MCL_FUNCTION_INIT_IF_NO_EMPTY(function, str_function) MCL_FUNCTION_EXC_IF_ENABLE((str_function != NULL), function, str_function) |
| |
| #define | MCL_STATUS_SET_IF_TRUE(real, str, status) MCL_FUNCTION_EXC_IF_ENABLE((real), str, status) |
| |
| #define | MCL_VALUE_SET_IF_TRUE(real, str, value) MCL_FUNCTION_EXC_IF_ENABLE((real), str, value) |
| |
| #define | MCL_FUNCTION_SET_IF_ELSE_TRUE(real, str, _if, _else) MCL_FUNCTION_EXC_IF_ELSE_ENABLE((real), str, _if, _else) |
| |
| #define | MCL_ANGLE_MOD_X(down, up, val) |
| | Remainder of angle. More...
|
| |
| #define | MCL_GET_ANGLE_DELTA(val, offset) |
| | Calculate the difference in angle, because the angle is then changed between 0-360 degrees, there are 350 degrees to 0 degrees of the process of change, as well as 10 degrees to 360 degrees of the process of change, in this process, the actual angle change is 10 degrees, but it may be calculated as 350 degrees, so the role of the calculation is to strive for an angle value of 10 degrees, the offset value of the maximum angle value, the default is 2pi. More...
|
| |
| #define | MCL_VALUE_LIMIT(val, min, max) |
| | Data Range Limits. More...
|
| |
| #define | MCL_GET_ADC_12BIT_VALID_DATA(x) ((x & 0xffff) >> 4) |
| | Get ADC data with 12bit valid bits. More...
|
| |
| #define | MCL_USEC_TO_HZ(usec) (1000000.0f / (usec)) |
| | Macro to convert microseconds period to frequency in Hertz. The macro takes an unsigned integer representing a time period in microseconds, and returns the corresponding frequency as a floating-point number. More...
|
| |
| #define | MCL_PERIOD_TO_FREQUENCY(period) (1.0f / (period)) |
| | Macro to convert a time period in seconds to frequency in Hertz (Hz). The macro takes a floating-point number representing a time period in seconds, and returns the corresponding frequency as a floating-point number. More...
|
| |
| #define | MCL_FREQUENCY_TO_PERIOD(frequency) (1.0f / (frequency)) |
| | Macro to convert a frequency in Hertz (Hz) to a time period in seconds. The macro takes a floating-point number representing a frequency in Hertz. More...
|
| |
| #define | MCL_USEC_TO_SEC(usec) ((usec) / 1000000.0f) |
| | Converts microseconds (us) to seconds (s). More...
|
| |
| #define | MCL_USEC_TO_MSEC(usec) ((usec) / 1000.0f) |
| | Converts microseconds (us) to milliseconds (ms). More...
|
| |
| #define MCL_GET_ANGLE_DELTA |
( |
|
val, |
|
|
|
offset |
|
) |
| |
Value:({ \
float val_; \
float temp; \
val_ = 0; \
temp = 0; \
if ((val) > 0) { \
temp = (val) - offset; \
} else if ((val) < 0) { \
temp = (val) + offset; \
} else { \
val_ = 0; \
} \
if (fabs(val) < fabs(temp)) { \
val_ = val; \
} else {\
val_ = temp; \
} \
(val_); \
})
Calculate the difference in angle, because the angle is then changed between 0-360 degrees, there are 350 degrees to 0 degrees of the process of change, as well as 10 degrees to 360 degrees of the process of change, in this process, the actual angle change is 10 degrees, but it may be calculated as 350 degrees, so the role of the calculation is to strive for an angle value of 10 degrees, the offset value of the maximum angle value, the default is 2pi.