RA Flexible Software Package Documentation  Release v5.7.0

 
Motor Interface

Detailed Description

Interface for Motor functions.

Summary

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
 

Data Structure Documentation

◆ motor_callback_args_t

struct motor_callback_args_t

callback function parameter data

Data Fields
void const * p_context Placeholder for user data.
motor_callback_event_t event

◆ motor_cfg_t

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.
 

Field Documentation

◆ p_callback

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.

◆ motor_api_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)
 

Field Documentation

◆ open

fsp_err_t(* motor_api_t::open) (motor_ctrl_t *const p_ctrl, motor_cfg_t const *const p_cfg)

Open driver.

Parameters
[in]p_ctrlPointer to control structure.
[in]p_cfgPointer to configuration structure.

◆ close

fsp_err_t(* motor_api_t::close) (motor_ctrl_t *const p_ctrl)

Close driver.

Parameters
[in]p_ctrlPointer to control structure.

◆ run

fsp_err_t(* motor_api_t::run) (motor_ctrl_t *const p_ctrl)

Run the motor. (Start the motor rotation.)

Parameters
[in]p_ctrlPointer to control structure.

◆ stop

fsp_err_t(* motor_api_t::stop) (motor_ctrl_t *const p_ctrl)

Stop the motor. (Stop the motor rotation.)

Parameters
[in]p_ctrlPointer to control structure.

◆ reset

fsp_err_t(* motor_api_t::reset) (motor_ctrl_t *const p_ctrl)

Reset the motor control. (Recover from the error status.)

Parameters
[in]p_ctrlPointer to control structure.

◆ errorSet

fsp_err_t(* motor_api_t::errorSet) (motor_ctrl_t *const p_ctrl, motor_error_t const error)

Set Error Information.

Parameters
[in]p_ctrlPointer to control structure.
[in]errorHappend error code

◆ speedSet

fsp_err_t(* motor_api_t::speedSet) (motor_ctrl_t *const p_ctrl, float const speed_rpm)

Set rotation speed.

Parameters
[in]p_ctrlPointer to control structure.
[in]speed_rpmRequired rotation speed [rpm]

◆ positionSet

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.

Parameters
[in]p_ctrlPointer to control structure.
[in]p_positionPointer to set required data

◆ statusGet

fsp_err_t(* motor_api_t::statusGet) (motor_ctrl_t *const p_ctrl, uint8_t *const p_status)

Get the motor control status.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_statusPointer to get the motor control status

◆ angleGet

fsp_err_t(* motor_api_t::angleGet) (motor_ctrl_t *const p_ctrl, float *const p_angle_rad)

Get the rotor angle.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_angle_radPointer to get the rotor angle [rad]

◆ speedGet

fsp_err_t(* motor_api_t::speedGet) (motor_ctrl_t *const p_ctrl, float *const p_speed_rpm)

Get the rotation speed.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_speed_rpmPointer to get the rotation speed [rpm]

◆ waitStopFlagGet

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.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_flagPointer to wait stop flag

◆ errorCheck

fsp_err_t(* motor_api_t::errorCheck) (motor_ctrl_t *const p_ctrl, uint16_t *const p_error)

Check the error occurrence

Parameters
[in]p_ctrlPointer to control structure.
[out]p_errorPointer to get occured error

◆ functionSelect

fsp_err_t(* motor_api_t::functionSelect) (motor_ctrl_t *const p_ctrl, motor_function_select_t const function)

FunctionSelect.

Parameters
[in]p_ctrlPointer to control structure.
[in]functionSelected function

◆ motor_instance_t

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 Documentation

◆ motor_ctrl_t

typedef void motor_ctrl_t

Motor Control block. Allocate an instance specific control block to pass into the API calls.

Enumeration Type Documentation

◆ motor_error_t

Error information

◆ motor_callback_event_t

Events that can trigger a callback function

Enumerator
MOTOR_CALLBACK_EVENT_SPEED_FORWARD 

Event forward speed control.

MOTOR_CALLBACK_EVENT_SPEED_BACKWARD 

Event backward speed control.

MOTOR_CALLBACK_EVENT_CURRENT_FORWARD 

Event forward current control.

MOTOR_CALLBACK_EVENT_CURRENT_BACKWARD 

Event backward current control.

MOTOR_CALLBACK_EVENT_ADC_FORWARD 

Event before motor 120 driver process.

MOTOR_CALLBACK_EVENT_ADC_BACKWARD 

Event after motor 120 driver process.

MOTOR_CALLBACK_EVENT_CYCLE_FORWARD 

Before cyclic process of speed control.

MOTOR_CALLBACK_EVENT_CYCLE_BACKWARD 

After cyclic process of speed control.

◆ motor_wait_stop_flag_t

Flag for waiting for motor stop

Enumerator
MOTOR_WAIT_STOP_FLAG_CLEAR 

Wait stop flag clear.

MOTOR_WAIT_STOP_FLAG_SET 

Wait stop flag set.

◆ motor_function_select_t

Function select

Enumerator
MOTOR_FUNCTION_SELECT_NONE 

No function selected.

MOTOR_FUNCTION_SELECT_INERTIA_ESTIMATE 

Inertia estimation.

MOTOR_FUNCTION_SELECT_RETURN_ORIGIN 

Return origin position.