|
| #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_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.