![]() |
RA Flexible Software Package Documentation
Release v6.2.0
|
|
Interface for Motor functions.
The Motor interface provides Motor functionality.
Data Structures | |
| struct | motor_callback_args_t |
| struct | motor_cfg_t |
| struct | motor_api_t |
| struct | motor_instance_t |
Typedefs | |
| typedef void | motor_ctrl_t |
Enumerations | |
| enum | motor_error_t |
| enum | motor_callback_event_t |
| enum | motor_wait_stop_flag_t |
| enum | motor_function_select_t |
| struct motor_callback_args_t |
callback function parameter data
| Data Fields | ||
|---|---|---|
| void * | p_context | Placeholder for user data. |
| motor_callback_event_t | event | |
| struct motor_cfg_t |
Configuration parameters.
Data Fields | |
| motor_speed_instance_t const * | p_motor_speed_instance |
| Speed Instance. | |
| motor_current_instance_t const * | p_motor_current_instance |
| Current Instance. | |
| void(* | p_callback )(motor_callback_args_t *p_args) |
| void const * | p_extend |
| Placeholder for user extension. | |
| void(* motor_cfg_t::p_callback) (motor_callback_args_t *p_args) |
Placeholder for user data. Passed to the user callback in motor_callback_args_t.
| struct motor_api_t |
Functions implemented at the HAL layer will follow this API.
Data Fields | |
| fsp_err_t(* | open )(motor_ctrl_t *const p_ctrl, motor_cfg_t const *const p_cfg) |
| fsp_err_t(* | close )(motor_ctrl_t *const p_ctrl) |
| fsp_err_t(* | run )(motor_ctrl_t *const p_ctrl) |
| fsp_err_t(* | stop )(motor_ctrl_t *const p_ctrl) |
| fsp_err_t(* | reset )(motor_ctrl_t *const p_ctrl) |
| fsp_err_t(* | errorSet )(motor_ctrl_t *const p_ctrl, motor_error_t const error) |
| fsp_err_t(* | speedSet )(motor_ctrl_t *const p_ctrl, float const speed_rpm) |
| fsp_err_t(* | positionSet )(motor_ctrl_t *const p_ctrl, motor_speed_position_data_t const *const p_position) |
| fsp_err_t(* | statusGet )(motor_ctrl_t *const p_ctrl, uint8_t *const p_status) |
| fsp_err_t(* | angleGet )(motor_ctrl_t *const p_ctrl, float *const p_angle_rad) |
| fsp_err_t(* | speedGet )(motor_ctrl_t *const p_ctrl, float *const p_speed_rpm) |
| fsp_err_t(* | waitStopFlagGet )(motor_ctrl_t *const p_ctrl, motor_wait_stop_flag_t *const p_flag) |
| fsp_err_t(* | errorCheck )(motor_ctrl_t *const p_ctrl, uint16_t *const p_error) |
| fsp_err_t(* | functionSelect )(motor_ctrl_t *const p_ctrl, motor_function_select_t const function) |
| fsp_err_t(* motor_api_t::open) (motor_ctrl_t *const p_ctrl, motor_cfg_t const *const p_cfg) |
Open driver.
| [in] | p_ctrl | Pointer to control structure. |
| [in] | p_cfg | Pointer to configuration structure. |
| fsp_err_t(* motor_api_t::close) (motor_ctrl_t *const p_ctrl) |
Close driver.
| [in] | p_ctrl | Pointer to control structure. |
| fsp_err_t(* motor_api_t::run) (motor_ctrl_t *const p_ctrl) |
Run the motor. (Start the motor rotation.)
| [in] | p_ctrl | Pointer to control structure. |
| fsp_err_t(* motor_api_t::stop) (motor_ctrl_t *const p_ctrl) |
Stop the motor. (Stop the motor rotation.)
| [in] | p_ctrl | Pointer to control structure. |
| fsp_err_t(* motor_api_t::reset) (motor_ctrl_t *const p_ctrl) |
Reset the motor control. (Recover from the error status.)
| [in] | p_ctrl | Pointer to control structure. |
| fsp_err_t(* motor_api_t::errorSet) (motor_ctrl_t *const p_ctrl, motor_error_t const error) |
Set Error Information.
| [in] | p_ctrl | Pointer to control structure. |
| [in] | error | Happened error code |
| fsp_err_t(* motor_api_t::speedSet) (motor_ctrl_t *const p_ctrl, float const speed_rpm) |
Set rotation speed.
| [in] | p_ctrl | Pointer to control structure. |
| [in] | speed_rpm | Required rotation speed [rpm] |
| fsp_err_t(* motor_api_t::positionSet) (motor_ctrl_t *const p_ctrl, motor_speed_position_data_t const *const p_position) |
Set reference position.
| [in] | p_ctrl | Pointer to control structure. |
| [in] | p_position | Pointer to set required data |
| fsp_err_t(* motor_api_t::statusGet) (motor_ctrl_t *const p_ctrl, uint8_t *const p_status) |
Get the motor control status.
| [in] | p_ctrl | Pointer to control structure. |
| [out] | p_status | Pointer to get the motor control status |
| fsp_err_t(* motor_api_t::angleGet) (motor_ctrl_t *const p_ctrl, float *const p_angle_rad) |
Get the rotor angle.
| [in] | p_ctrl | Pointer to control structure. |
| [out] | p_angle_rad | Pointer to get the rotor angle [rad] |
| fsp_err_t(* motor_api_t::speedGet) (motor_ctrl_t *const p_ctrl, float *const p_speed_rpm) |
Get the rotation speed.
| [in] | p_ctrl | Pointer to control structure. |
| [out] | p_speed_rpm | Pointer to get the rotation speed [rpm] |
| fsp_err_t(* motor_api_t::waitStopFlagGet) (motor_ctrl_t *const p_ctrl, motor_wait_stop_flag_t *const p_flag) |
Get wait stop flag.
| [in] | p_ctrl | Pointer to control structure. |
| [out] | p_flag | Pointer to wait stop flag |
| fsp_err_t(* motor_api_t::errorCheck) (motor_ctrl_t *const p_ctrl, uint16_t *const p_error) |
Check the error occurrence
| [in] | p_ctrl | Pointer to control structure. |
| [out] | p_error | Pointer to get occurred error |
| fsp_err_t(* motor_api_t::functionSelect) (motor_ctrl_t *const p_ctrl, motor_function_select_t const function) |
FunctionSelect.
| [in] | p_ctrl | Pointer to control structure. |
| [in] | function | Selected function |
| struct motor_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
| Data Fields | ||
|---|---|---|
| motor_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
| motor_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
| motor_api_t const * | p_api | Pointer to the API structure for this instance. |
| typedef void motor_ctrl_t |
Motor Control block. Allocate an instance specific control block to pass into the API calls.
| enum motor_error_t |
Error information
Events that can trigger a callback function