Library to handle the X-NUCLEO-IHM06A1 Motor Control Expansion Board based on the STSPIN220 component.
Dependencies: ST_INTERFACES
Dependents: HelloWorld_IHM06A1
Fork of X-NUCLEO-IHM06A1 by
STSpin220 Class Reference
Class representing a STSpin220 component. More...
#include <STSpin220.h>
Public Member Functions | |
| STSpin220 (PinName fault_and_enable_pin, PinName stby_reset_pin, PinName direction_mode4_pin, PinName mode1_pin, PinName mode2_pin, PinName stck_mode3_pin, PinName pwm_ref_pin, PinName monitor_pin=NC) | |
| Constructor. | |
| virtual | ~STSpin220 (void) |
| Destructor. | |
| virtual int | init (void *init=NULL) |
| Public functions inherited from the Component Class. | |
| virtual int | read_id (uint8_t *id=NULL) |
| Getting the ID of the component. | |
| virtual unsigned int | get_status (void) |
| Public functions inherited from the StepperMotor Class. | |
| virtual signed int | get_position (void) |
| Getting the position. | |
| virtual signed int | get_mark (void) |
| Getting the marked position. | |
| virtual unsigned int | get_speed (void) |
| Getting the current speed in pps. | |
| virtual unsigned int | get_max_speed (void) |
| Getting the maximum speed in pps. | |
| virtual unsigned int | get_min_speed (void) |
| Getting the minimum speed in pps. | |
| virtual unsigned int | get_acceleration (void) |
| Getting the acceleration in pps^2. | |
| virtual unsigned int | get_deceleration (void) |
| Getting the deceleration in pps^2. | |
| virtual direction_t | get_direction (void) |
| Getting the direction of rotation. | |
| virtual void | set_home (void) |
| Setting the current position to be the home position. | |
| virtual void | set_mark (void) |
| Setting the current position to be the marked position. | |
| virtual bool | set_max_speed (unsigned int speed) |
| Setting the maximum speed in pps. | |
| virtual bool | set_min_speed (unsigned int speed) |
| Setting the minimum speed in pps. | |
| virtual bool | set_acceleration (unsigned int acceleration) |
| Setting the acceleration in pps^2. | |
| virtual bool | set_deceleration (unsigned int deceleration) |
| Setting the deceleration in pps^2. | |
| virtual bool | set_step_mode (step_mode_t step_mode) |
| Setting the Step Mode. | |
| virtual void | go_to (signed int position) |
| Going to a specified position. | |
| virtual void | go_home (void) |
| Going to the home position. | |
| virtual void | go_mark (void) |
| Going to the marked position. | |
| virtual void | run (direction_t direction) |
| Running the motor towards a specified direction. | |
| virtual void | move (direction_t direction, unsigned int steps) |
| Moving the motor towards a specified direction for a certain number of steps. | |
| virtual void | soft_stop (void) |
| Stopping the motor through an immediate deceleration up to zero speed. | |
| virtual void | hard_stop (void) |
| Stopping the motor through an immediate infinite deceleration. | |
| virtual void | soft_hiz (void) |
| Disabling the power bridge after performing a deceleration to zero. | |
| virtual void | hard_hiz (void) |
| Disabling the power bridge immediately. | |
| virtual void | wait_while_active (void) |
| Waiting while the motor is active. | |
| virtual void | attach_error_handler (void(*fptr)(uint16_t error)) |
| Public functions NOT inherited. | |
| virtual unsigned int | check_status_hw (void) |
| Checks if the device is disabled or/and has an alarm flag set by reading the EN FAULT pin position. | |
| virtual void | disable (void) |
| Disabling the device. | |
| virtual void | enable (void) |
| Enabling the device. | |
| virtual void | exit_device_from_standby (void) |
| Exit STSpin220 device from standby (low power consumption) by setting STBY pin to high level and changing the motion state to INACTIVE. | |
| virtual uint32_t | get_freq_vref_pwm (void) |
| Set the frequency of the VREFA and VREFB PWM. | |
| virtual unsigned int | get_fw_version (void) |
| Getting the version of the firmware. | |
| virtual step_mode_t | get_step_mode (void) |
| Getting the motor step mode. | |
| virtual motorStopMode_t | get_stop_mode (void) |
| Getting the motor stop mode. | |
| virtual uint8_t | get_torque (motorTorqueMode_t torqueMode) |
| Get the motor torque. | |
| virtual bool | get_torque_boost_enable (void) |
| Get the torque boost feature status. | |
| virtual uint16_t | get_torque_boost_threshold (void) |
| Get the torque boost threshold. | |
| virtual void | go_to (direction_t direction, signed int position) |
| Going to a specified position with a specificied direction. | |
| virtual void | put_device_in_standby (void) |
| Put STSpin220 device in standby (low power consumption) by setting STBY pin to low level and changing the motion state to STANDBY. | |
| virtual void | release_reset (void) |
| Release the STSpin220 reset (Reset pin set to high level). | |
| virtual void | reset (void) |
| Reset the STSpin220 (Reset pin set to low level). | |
| virtual void | set_direction (direction_t direction) |
| Set the motor direction. | |
| virtual void | set_freq_vref_pwm (uint32_t frequency) |
| Set the frequency of the PWM for REF pin. | |
| virtual void | set_stop_mode (motorStopMode_t stopMode) |
| Set the motor stop mode. | |
| virtual void | set_torque (motorTorqueMode_t torqueMode, uint8_t torqueValue) |
| Set the motor torque. | |
| virtual void | set_torque_boost_enable (bool enable) |
| Enable or disable the motor torque boost feature. | |
| virtual void | set_torque_boost_threshold (uint16_t speedThreshold) |
| Set the torque boost threshold. | |
| void | attach_flag_irq (void(*fptr)(void)) |
| Attaching an interrupt handler to the FLAG interrupt. | |
| void | enable_flag_irq (void) |
| Enabling the FLAG interrupt handling. | |
Protected Member Functions | |
| status_t | STSpin220_Init (void *init) |
| Start the STSpin220 library. | |
| void | STSpin220_ApplyTorque (motorTorqueMode_t torqueMode) |
| Apply the set torque. | |
| void | STSpin220_Disable (void) |
| Disable the power bridges (leave the output bridges HiZ) | |
| void | STSpin220_ErrorHandler (uint16_t error) |
| Error handler which calls the user callback (if defined) | |
| void | STSpin220_Enable (void) |
| Enable the power bridges. | |
| void | STSpin220_ExitDeviceFromStandby (void) |
| Exit STSpin220 device from standby (low power consumption) | |
| uint16_t | STSpin220_GetAcceleration (void) |
| Return the acceleration. | |
| uint16_t | STSpin220_GetCurrentSpeed (void) |
| Return the current speed. | |
| uint16_t | STSpin220_GetDeceleration (void) |
| Return the deceleration. | |
| motorState_t | STSpin220_get_device_state (void) |
| Return the device state. | |
| motorDir_t | STSpin220_GetDirection (void) |
| Get the motor current direction. | |
| uint32_t | STSpin220_GetFwVersion (void) |
| Return the FW version. | |
| int32_t | STSpin220_GetMark (void) |
| Get the mark position (32b signed) | |
| uint16_t | STSpin220_GetMaxSpeed (void) |
| Return the max speed. | |
| uint16_t | STSpin220_GetMinSpeed (void) |
| Get the min speed in step/s for full, half and wave modes in microsteps/s for microstep modes. | |
| int32_t | STSpin220_GetPosition (void) |
| Get the current position (32b signed) | |
| motorStepMode_t | STSpin220_GetStepMode (void) |
| Get the motor step mode. | |
| motorStopMode_t | STSpin220_GetStopMode (void) |
| Get the selected stop mode. | |
| uint8_t | STSpin220_GetTorque (motorTorqueMode_t torqueMode) |
| Get the torque. | |
| bool | STSpin220_GetTorqueBoostEnable (void) |
| Get the torque boost feature status. | |
| uint16_t | STSpin220_GetTorqueBoostThreshold (void) |
| Get the torque boost threshold. | |
| void | STSpin220_GoHome (void) |
| Go to the home position. | |
| void | STSpin220_GoMark (void) |
| Go to the Mark position. | |
| void | STSpin220_GoTo (int32_t targetPosition) |
| Request the motor to move to the specified position. | |
| void | STSpin220_GoToDir (motorDir_t direction, int32_t targetPosition) |
| move the motor to the absolute position | |
| void | STSpin220_HardHiZ (void) |
| Immediately stop the motor and disables the power bridges. | |
| void | STSpin220_HardStop (void) |
| Immediatly stop the motor and either set holding torque when stop mode is HOLD_MODE, or call STSpin220_HardHiz function when stop mode is HIZ_MODE, or call STSpin220_PutDeviceInStandby function when stop mode is STANDBY_MODE. | |
| void | STSpin220_Move (motorDir_t direction, uint32_t stepCount) |
| Moves the motor of the specified number of steps. | |
| void | STSpin220_PutDeviceInStandby (void) |
| Put STSpin220 device in standby (low power consumption) | |
| void | STSpin220_Run (motorDir_t direction) |
| Runs the motor. | |
| bool | STSpin220_SetAcceleration (uint16_t newAcc) |
| Changes the acceleration. | |
| bool | STSpin220_SetDeceleration (uint16_t newDec) |
| Changes the deceleration. | |
| void | STSpin220_SetDirection (motorDir_t direction) |
| Specifies the direction. | |
| void | STSpin220_SetHome (void) |
| Set current position to be the Home position (current position set to 0) | |
| void | STSpin220_SetMark (void) |
| Set current position to be the Mark position. | |
| bool | STSpin220_SetMaxSpeed (uint16_t volatile newSpeed) |
| Changes the max speed. | |
| bool | STSpin220_SetMinSpeed (uint16_t volatile newSpeed) |
| Changes the min speed. | |
| bool | STSpin220_SetStepMode (motorStepMode_t stepMode) |
| Set the stepping mode. | |
| void | STSpin220_SetStopMode (motorStopMode_t stopMode) |
| Select the mode to stop the motor. | |
| bool | STSpin220_SoftStop (void) |
| Stops the motor by using the device deceleration. | |
| void | STSpin220_SetTorque (motorTorqueMode_t torqueMode, uint8_t torqueValue) |
| Set the torque. | |
| void | STSpin220_SetTorqueBoostEnable (bool enable) |
| Enable or disable the torque boost feature. | |
| void | STSpin220_SetTorqueBoostThreshold (uint16_t speedThreshold) |
| Set the torque boost threshold. | |
| uint32_t | STSpin220_VrefPwmGetFreq (void) |
| Get the frequency of REF PWM. | |
| void | STSpin220_VrefPwmSetFreq (uint32_t newFreq) |
| Set the frequency of REF PWM. | |
| void | STSpin220_WaitWhileActive (void) |
| Locks until the device state becomes Inactive. | |
| void | STSpin220_ApplySpeed (uint16_t newSpeed) |
| Updates the current speed of the device. | |
| void | STSpin220_ComputeSpeedProfile (uint32_t nbSteps) |
| Computes the speed profile according to the number of steps to move. | |
| void | STSpin220_SetDeviceParamsToGivenValues (STSpin220_init_t *pInitDevicePrm) |
| Set the parameters of the device to values of the structure pointed by pInitDevicePrm. | |
| void | STSpin220_SetDeviceParamsOtherValues (void) |
| Set the parameters of the device whose values are not defined in stspin220_target_config.h. | |
| void | STSpin220_SetDeviceParamsToPredefinedValues (void) |
| Sets the parameters of the device to predefined values from stspin220_target_config.h. | |
| bool | STSpin220_SetStepModeWithoutReset (motorStepMode_t stepMode) |
| Set the stepping mode without reset. | |
| void | STSpin220_StartMovement (void) |
| Initialises the bridge parameters to start the movement and enable the power bridge. | |
| void | STSpin220_StepClockHandler (void) |
| Handles the device state machine at each pulse. | |
| void | STSpin220_Board_Delay (uint32_t delay) |
| Making the CPU wait. | |
| void | STSpin220_Board_Disable (void) |
| Disable the power bridges (leave the output bridges HiZ). | |
| void | STSpin220_Board_DisableIrq (void) |
| Disabling interrupts. | |
| void | STSpin220_Board_Enable (void) |
| Enable the power bridges (leave the output bridges HiZ). | |
| void | STSpin220_Board_EnableIrq (void) |
| Enabling interrupts. | |
| void | STSpin220_Board_PwmRefSetDutyCycle (uint8_t dutyCycle) |
| Set the duty cycle of the PwmOut used for the REF reference voltage generation and actually start the pwm if the duty cycle is not zero. | |
| void | STSpin220_Board_PwmRefSetFreq (uint32_t newFreq) |
| Set the frequency of the PwmOut used for the REF reference voltage generation. | |
| void | STSpin220_Board_PwmRefStart (uint32_t frequency, motorTorqueMode_t torqueMode) |
| Start the PwmOut for the REF pin. | |
| void | STSpin220_Board_ReleaseReset (void) |
| Exit the device from standby reset mode. | |
| void | STSpin220_Board_Reset (void) |
| Put the device in standby reset mode. | |
| void | STSpin220_Board_SetDirectionGpio (motorDir_t dir) |
| Set the DIR pin. | |
| void | STSpin220_Board_SetFullStep (void) |
| Select Full Step mode. | |
| uint8_t | STSpin220_Board_SetModePins (uint8_t modePin1Level,\uint8_t modePin2Level,\uint8_t modePin3Level,\uint8_t modePin4Level) |
| Select the STSpin220 mode1, mode2, mode3 and mode4 pins levels. | |
| void | STSpin220_Board_StckMode3_Reset (void) |
| Reset the STCK pin. | |
| void | STSpin220_Board_StckMode3_Set (void) |
| Set the STCK pin. | |
| void | STSpin220_Board_TimStckInit (bool check) |
| Initialises the step clock pin level. | |
| void | STSpin220_Board_TimStckSetFreq (uint16_t newFreq) |
| Setting the Stck Timeout delay and attaching a callback function to it. | |
| uint8_t | STSpin220_Board_TimStckStop (volatile uint8_t *pToggleOdd) |
| Stopping the Timeout. | |
| void | STSpin220_Board_UnsetFullStep (void) |
| Unselect Full Step mode. | |
Detailed Description
Class representing a STSpin220 component.
Definition at line 72 of file STSpin220.h.
Constructor & Destructor Documentation
| STSpin220 | ( | PinName | fault_and_enable_pin, |
| PinName | stby_reset_pin, | ||
| PinName | direction_mode4_pin, | ||
| PinName | mode1_pin, | ||
| PinName | mode2_pin, | ||
| PinName | stck_mode3_pin, | ||
| PinName | pwm_ref_pin, | ||
| PinName | monitor_pin = NC |
||
| ) |
Constructor.
- Parameters:
-
fault_and_enable_pin pin name of the EN pin of the component. stby_reset_pin pin name of the STBY pin of the component. direction_mode4_pin pin name of the MODE4 pin of the component. mode1_pin pin name of the MODE1 pin of the component. mode2_pin pin name of the MODE2 pin of the component. stck_mode3_pin pin name of the MODE3 pin of the component. pwm_ref_pin pin name of the PWM connected to the REF pin of the component. Monitor_pin pin name for the step clock handler duration Monitoring.
Definition at line 87 of file STSpin220.h.
| virtual ~STSpin220 | ( | void | ) | [virtual] |
Destructor.
Definition at line 128 of file STSpin220.h.
Member Function Documentation
| virtual void attach_error_handler | ( | void(*)(uint16_t error) | fptr ) | [virtual] |
Public functions NOT inherited.
Attaching an error handler.
- Parameters:
-
fptr An error handler.
- Return values:
-
None.
Definition at line 495 of file STSpin220.h.
| void attach_flag_irq | ( | void(*)(void) | fptr ) |
Attaching an interrupt handler to the FLAG interrupt.
- Parameters:
-
fptr An interrupt handler.
- Return values:
-
None.
Definition at line 758 of file STSpin220.h.
| virtual unsigned int check_status_hw | ( | void | ) | [virtual] |
Checks if the device is disabled or/and has an alarm flag set by reading the EN FAULT pin position.
- Parameters:
-
None.
- Return values:
-
One if the EN FAULT pin is low (the device is disabled or/and has an alarm flag set), otherwise zero.
Definition at line 507 of file STSpin220.h.
| virtual void disable | ( | void | ) | [virtual] |
Disabling the device.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 518 of file STSpin220.h.
| virtual void enable | ( | void | ) | [virtual] |
Enabling the device.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 528 of file STSpin220.h.
| void enable_flag_irq | ( | void | ) |
Enabling the FLAG interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 771 of file STSpin220.h.
| virtual void exit_device_from_standby | ( | void | ) | [virtual] |
Exit STSpin220 device from standby (low power consumption) by setting STBY pin to high level and changing the motion state to INACTIVE.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 540 of file STSpin220.h.
| virtual unsigned int get_acceleration | ( | void | ) | [virtual] |
Getting the acceleration in pps^2.
- Parameters:
-
None.
- Return values:
-
The acceleration in pps^2.
Definition at line 247 of file STSpin220.h.
| virtual unsigned int get_deceleration | ( | void | ) | [virtual] |
Getting the deceleration in pps^2.
- Parameters:
-
None.
- Return values:
-
The deceleration in pps^2.
Definition at line 257 of file STSpin220.h.
| virtual direction_t get_direction | ( | void | ) | [virtual] |
Getting the direction of rotation.
- Parameters:
-
None.
- Return values:
-
The direction of rotation.
Definition at line 267 of file STSpin220.h.
| virtual uint32_t get_freq_vref_pwm | ( | void | ) | [virtual] |
Set the frequency of the VREFA and VREFB PWM.
- Parameters:
-
frequency in Hz
- Return values:
-
None.
Definition at line 550 of file STSpin220.h.
| virtual unsigned int get_fw_version | ( | void | ) | [virtual] |
Getting the version of the firmware.
- Parameters:
-
None.
- Return values:
-
The version of the firmware.
Definition at line 560 of file STSpin220.h.
| virtual signed int get_mark | ( | void | ) | [virtual] |
Getting the marked position.
- Parameters:
-
None.
- Return values:
-
The marked position.
Definition at line 207 of file STSpin220.h.
| virtual unsigned int get_max_speed | ( | void | ) | [virtual] |
Getting the maximum speed in pps.
- Parameters:
-
None.
- Return values:
-
The maximum speed in pps.
Definition at line 227 of file STSpin220.h.
| virtual unsigned int get_min_speed | ( | void | ) | [virtual] |
Getting the minimum speed in pps.
- Parameters:
-
None.
- Return values:
-
The minimum speed in pps.
Definition at line 237 of file STSpin220.h.
| virtual signed int get_position | ( | void | ) | [virtual] |
Getting the position.
- Parameters:
-
None.
- Return values:
-
The position.
Definition at line 197 of file STSpin220.h.
| virtual unsigned int get_speed | ( | void | ) | [virtual] |
Getting the current speed in pps.
- Parameters:
-
None.
- Return values:
-
The current speed in pps.
Definition at line 217 of file STSpin220.h.
| virtual unsigned int get_status | ( | void | ) | [virtual] |
Public functions inherited from the StepperMotor Class.
Getting the value of the motor state .
- Parameters:
-
None.
- Return values:
-
The motor state accoring to motorState_t in motor.h
Definition at line 187 of file STSpin220.h.
| virtual step_mode_t get_step_mode | ( | void | ) | [virtual] |
Getting the motor step mode.
- Parameters:
-
None.
- Return values:
-
The motor step mode.
Definition at line 570 of file STSpin220.h.
| virtual motorStopMode_t get_stop_mode | ( | void | ) | [virtual] |
Getting the motor stop mode.
- Parameters:
-
None.
- Return values:
-
The motor stop mode.
Definition at line 580 of file STSpin220.h.
| virtual uint8_t get_torque | ( | motorTorqueMode_t | torqueMode ) | [virtual] |
Get the motor torque.
- Parameters:
-
torqueMode Torque mode as specified in enum motorTorqueMode_t
- Return values:
-
the torqueValue in % (from 0 to 100)
Definition at line 590 of file STSpin220.h.
| virtual bool get_torque_boost_enable | ( | void | ) | [virtual] |
Get the torque boost feature status.
- Parameters:
-
None.
- Return values:
-
true if enabled, false if disabled
Definition at line 600 of file STSpin220.h.
| virtual uint16_t get_torque_boost_threshold | ( | void | ) | [virtual] |
Get the torque boost threshold.
- Return values:
-
The torque boost threshold above which the step mode is changed to full step
Definition at line 610 of file STSpin220.h.
| virtual void go_home | ( | void | ) | [virtual] |
Going to the home position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 399 of file STSpin220.h.
| virtual void go_mark | ( | void | ) | [virtual] |
Going to the marked position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 409 of file STSpin220.h.
| virtual void go_to | ( | signed int | position ) | [virtual] |
Going to a specified position.
- Parameters:
-
position The desired position.
- Return values:
-
None.
Definition at line 389 of file STSpin220.h.
| virtual void go_to | ( | direction_t | direction, |
| signed int | position | ||
| ) | [virtual] |
Going to a specified position with a specificied direction.
- Parameters:
-
direction The desired direction. position The desired position.
- Return values:
-
None.
Definition at line 621 of file STSpin220.h.
| virtual void hard_hiz | ( | void | ) | [virtual] |
Disabling the power bridge immediately.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 471 of file STSpin220.h.
| virtual void hard_stop | ( | void | ) | [virtual] |
Stopping the motor through an immediate infinite deceleration.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 450 of file STSpin220.h.
| virtual int init | ( | void * | init = NULL ) |
[virtual] |
Public functions inherited from the Component Class.
Initialize the component.
- Parameters:
-
init Pointer to device specific initalization structure.
- Return values:
-
0 in case of success, an error code otherwise.
Definition at line 163 of file STSpin220.h.
| virtual void move | ( | direction_t | direction, |
| unsigned int | steps | ||
| ) | [virtual] |
Moving the motor towards a specified direction for a certain number of steps.
- Parameters:
-
direction The direction of rotation. steps The desired number of steps.
- Return values:
-
None.
Definition at line 430 of file STSpin220.h.
| virtual void put_device_in_standby | ( | void | ) | [virtual] |
Put STSpin220 device in standby (low power consumption) by setting STBY pin to low level and changing the motion state to STANDBY.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 633 of file STSpin220.h.
| virtual int read_id | ( | uint8_t * | id = NULL ) |
[virtual] |
Getting the ID of the component.
- Parameters:
-
id Pointer to an allocated variable to store the ID into.
- Return values:
-
0 in case of success, an error code otherwise.
Definition at line 173 of file STSpin220.h.
| virtual void release_reset | ( | void | ) | [virtual] |
Release the STSpin220 reset (Reset pin set to high level).
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 643 of file STSpin220.h.
| virtual void reset | ( | void | ) | [virtual] |
Reset the STSpin220 (Reset pin set to low level).
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 653 of file STSpin220.h.
| virtual void run | ( | direction_t | direction ) | [virtual] |
Running the motor towards a specified direction.
- Parameters:
-
direction The direction of rotation.
- Return values:
-
None.
Definition at line 419 of file STSpin220.h.
| virtual bool set_acceleration | ( | unsigned int | acceleration ) | [virtual] |
Setting the acceleration in pps^2.
- Parameters:
-
acceleration The acceleration in pps/s^2.
- Return values:
-
true in case of success, "false" otherwise.
Definition at line 338 of file STSpin220.h.
| virtual bool set_deceleration | ( | unsigned int | deceleration ) | [virtual] |
Setting the deceleration in pps^2.
- Parameters:
-
deceleration The deceleration in pps^2.
- Return values:
-
true in case of success, "false" otherwise.
Definition at line 355 of file STSpin220.h.
| virtual void set_direction | ( | direction_t | direction ) | [virtual] |
Set the motor direction.
- Parameters:
-
direction The desired direction.
- Return values:
-
None.
Definition at line 663 of file STSpin220.h.
| virtual void set_freq_vref_pwm | ( | uint32_t | frequency ) | [virtual] |
Set the frequency of the PWM for REF pin.
- Parameters:
-
frequency in Hz
- Return values:
-
None.
Definition at line 673 of file STSpin220.h.
| virtual void set_home | ( | void | ) | [virtual] |
Setting the current position to be the home position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 284 of file STSpin220.h.
| virtual void set_mark | ( | void | ) | [virtual] |
Setting the current position to be the marked position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 294 of file STSpin220.h.
| virtual bool set_max_speed | ( | unsigned int | speed ) | [virtual] |
Setting the maximum speed in pps.
- Parameters:
-
speed The maximum speed in pps.
- Return values:
-
true in case of success, "false" otherwise.
Definition at line 304 of file STSpin220.h.
| virtual bool set_min_speed | ( | unsigned int | speed ) | [virtual] |
Setting the minimum speed in pps.
- Parameters:
-
speed The minimum speed in pps.
- Return values:
-
true in case of success, "false" otherwise.
Definition at line 321 of file STSpin220.h.
| virtual bool set_step_mode | ( | step_mode_t | step_mode ) | [virtual] |
Setting the Step Mode.
- Parameters:
-
step_mode The Step Mode.
- Return values:
-
true in case of success, "false" otherwise.
- Note:
- step_mode can be one of the following: + STEP_MODE_FULL + STEP_MODE_WAVE + STEP_MODE_HALF + STEP_MODE_1_4 + STEP_MODE_1_8 + STEP_MODE_1_16
Definition at line 379 of file STSpin220.h.
| virtual void set_stop_mode | ( | motorStopMode_t | stopMode ) | [virtual] |
Set the motor stop mode.
- Parameters:
-
stopMode The desired stop mode (HOLD_MODE, HIZ_MODE or STANDBY_MODE).
- Return values:
-
None.
Definition at line 684 of file STSpin220.h.
| virtual void set_torque | ( | motorTorqueMode_t | torqueMode, |
| uint8_t | torqueValue | ||
| ) | [virtual] |
Set the motor torque.
- Parameters:
-
torqueMode Torque mode as specified in enum motorTorqueMode_t torqueValue in % (from 0 to 100)
- Return values:
-
None.
Definition at line 695 of file STSpin220.h.
| virtual void set_torque_boost_enable | ( | bool | enable ) | [virtual] |
Enable or disable the motor torque boost feature.
- Parameters:
-
enable enable true to enable torque boost, false to disable
- Return values:
-
None.
Definition at line 705 of file STSpin220.h.
| virtual void set_torque_boost_threshold | ( | uint16_t | speedThreshold ) | [virtual] |
Set the torque boost threshold.
- Parameters:
-
[in] speedThreshold speed threshold above which the step mode is changed to full step
- Return values:
-
None.
Definition at line 716 of file STSpin220.h.
| virtual void soft_hiz | ( | void | ) | [virtual] |
Disabling the power bridge after performing a deceleration to zero.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 460 of file STSpin220.h.
| virtual void soft_stop | ( | void | ) | [virtual] |
Stopping the motor through an immediate deceleration up to zero speed.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 440 of file STSpin220.h.
| void STSpin220_ApplySpeed | ( | uint16_t | newSpeed ) | [protected] |
Updates the current speed of the device.
- Parameters:
-
[in] newSpeed in pps
- Return values:
-
None
Definition at line 981 of file STSpin220.cpp.
| void STSpin220_ApplyTorque | ( | motorTorqueMode_t | torqueMode ) | [protected] |
Apply the set torque.
- Parameters:
-
[in] torqueMode torque mode
- Return values:
-
None
- Note:
Definition at line 102 of file STSpin220.cpp.
| void STSpin220_Board_Delay | ( | uint32_t | delay ) | [protected] |
Making the CPU wait.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 865 of file STSpin220.h.
| void STSpin220_Board_Disable | ( | void | ) | [protected] |
Disable the power bridges (leave the output bridges HiZ).
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 875 of file STSpin220.h.
| void STSpin220_Board_DisableIrq | ( | void | ) | [protected] |
Disabling interrupts.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 887 of file STSpin220.h.
| void STSpin220_Board_Enable | ( | void | ) | [protected] |
Enable the power bridges (leave the output bridges HiZ).
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 897 of file STSpin220.h.
| void STSpin220_Board_EnableIrq | ( | void | ) | [protected] |
Enabling interrupts.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 912 of file STSpin220.h.
| void STSpin220_Board_PwmRefSetDutyCycle | ( | uint8_t | dutyCycle ) | [protected] |
Set the duty cycle of the PwmOut used for the REF reference voltage generation and actually start the pwm if the duty cycle is not zero.
- Parameters:
-
[in] dutyCycle 0 - 100%
- Return values:
-
None
Definition at line 924 of file STSpin220.h.
| void STSpin220_Board_PwmRefSetFreq | ( | uint32_t | newFreq ) | [protected] |
Set the frequency of the PwmOut used for the REF reference voltage generation.
- Parameters:
-
[in] newFreq in Hz.
- Return values:
-
None.
Definition at line 935 of file STSpin220.h.
| void STSpin220_Board_PwmRefStart | ( | uint32_t | frequency, |
| motorTorqueMode_t | torqueMode | ||
| ) | [protected] |
Start the PwmOut for the REF pin.
- Parameters:
-
[in] frequency frequency of the PwmOut used to generate the REF reference voltage for the bridges. [in] torqueMode Torque mode as specified in enum motorTorqueMode_t
- Return values:
-
None.
Definition at line 947 of file STSpin220.h.
| void STSpin220_Board_ReleaseReset | ( | void | ) | [protected] |
Exit the device from standby reset mode.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 961 of file STSpin220.h.
| void STSpin220_Board_Reset | ( | void | ) | [protected] |
Put the device in standby reset mode.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 971 of file STSpin220.h.
| void STSpin220_Board_SetDirectionGpio | ( | motorDir_t | dir ) | [protected] |
Set the DIR pin.
- Parameters:
-
dir motor direction FORWARD or BACKWARD.
- Return values:
-
None.
Definition at line 981 of file STSpin220.h.
| void STSpin220_Board_SetFullStep | ( | void | ) | [protected] |
Select Full Step mode.
- Parameters:
-
None.
- Return values:
-
None
Definition at line 998 of file STSpin220.h.
| uint8_t STSpin220_Board_SetModePins | ( | uint8_t | modePin1Level, |
| \uint8_t | modePin2Level, | ||
| \uint8_t | modePin3Level, | ||
| \uint8_t | modePin4Level | ||
| ) | [protected] |
Select the STSpin220 mode1, mode2, mode3 and mode4 pins levels.
- Parameters:
-
[in] modePin1Level level of the mode1 gpio (0 low, 1+ high) [in] modePin2Level level of the mode2 gpio (0 low, 1+ high) [in] modePin3Level level of the mode3 gpio (0 low, 1+ high) [in] modePin4Level level of the mode4 gpio (0 low, 1+ high)
- Return values:
-
1
Definition at line 1012 of file STSpin220.h.
| void STSpin220_Board_StckMode3_Reset | ( | void | ) | [protected] |
Reset the STCK pin.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1029 of file STSpin220.h.
| void STSpin220_Board_StckMode3_Set | ( | void | ) | [protected] |
Set the STCK pin.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1039 of file STSpin220.h.
| void STSpin220_Board_TimStckInit | ( | bool | check ) | [protected] |
Initialises the step clock pin level.
- Parameters:
-
None.
- Return values:
-
None
Definition at line 1049 of file STSpin220.h.
| void STSpin220_Board_TimStckSetFreq | ( | uint16_t | newFreq ) | [protected] |
Setting the Stck Timeout delay and attaching a callback function to it.
- Parameters:
-
frequency The frequency corresponding to the delay.
- Return values:
-
None.
Definition at line 1074 of file STSpin220.h.
| uint8_t STSpin220_Board_TimStckStop | ( | volatile uint8_t * | pToggleOdd ) | [protected] |
Stopping the Timeout.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1105 of file STSpin220.h.
| void STSpin220_Board_UnsetFullStep | ( | void | ) | [protected] |
Unselect Full Step mode.
- Parameters:
-
None.
- Return values:
-
None
Definition at line 1128 of file STSpin220.h.
| void STSpin220_ComputeSpeedProfile | ( | uint32_t | nbSteps ) | [protected] |
Computes the speed profile according to the number of steps to move.
- Parameters:
-
[in] nbSteps number of steps to perform
- Return values:
-
None
- Note:
- Using the acceleration and deceleration of the device, this function determines the duration in steps of the acceleration, steady and deceleration phases. If the total number of steps to perform is big enough, a trapezoidal move is performed (i.e. there is a steady phase where the motor runs at the maximum speed. Else, a triangular move is performed (no steady phase: the maximum speed is never reached.
Definition at line 1059 of file STSpin220.cpp.
| void STSpin220_Disable | ( | void | ) | [protected] |
Disable the power bridges (leave the output bridges HiZ)
- Return values:
-
None
Definition at line 133 of file STSpin220.cpp.
| void STSpin220_Enable | ( | void | ) | [protected] |
| void STSpin220_ErrorHandler | ( | uint16_t | error ) | [protected] |
Error handler which calls the user callback (if defined)
- Parameters:
-
[in] error Number of the error
- Return values:
-
None
Definition at line 152 of file STSpin220.cpp.
| void STSpin220_ExitDeviceFromStandby | ( | void | ) | [protected] |
Exit STSpin220 device from standby (low power consumption)
- Return values:
-
None
Definition at line 171 of file STSpin220.cpp.
| motorState_t STSpin220_get_device_state | ( | void | ) | [protected] |
Return the device state.
- Return values:
-
State (ACCELERATING, DECELERATING, STEADY or INACTIVE)
Definition at line 228 of file STSpin220.cpp.
| uint16_t STSpin220_GetAcceleration | ( | void | ) | [protected] |
Return the acceleration.
- Return values:
-
Acceleration in pps^2
Definition at line 201 of file STSpin220.cpp.
| uint16_t STSpin220_GetCurrentSpeed | ( | void | ) | [protected] |
| uint16_t STSpin220_GetDeceleration | ( | void | ) | [protected] |
Return the deceleration.
- Return values:
-
Deceleration in pps^2
Definition at line 219 of file STSpin220.cpp.
| motorDir_t STSpin220_GetDirection | ( | void | ) | [protected] |
Get the motor current direction.
- Return values:
-
direction
Definition at line 237 of file STSpin220.cpp.
| uint32_t STSpin220_GetFwVersion | ( | void | ) | [protected] |
| int32_t STSpin220_GetMark | ( | void | ) | [protected] |
Get the mark position (32b signed)
- Return values:
-
mark position
Definition at line 255 of file STSpin220.cpp.
| uint16_t STSpin220_GetMaxSpeed | ( | void | ) | [protected] |
| uint16_t STSpin220_GetMinSpeed | ( | void | ) | [protected] |
Get the min speed in step/s for full, half and wave modes in microsteps/s for microstep modes.
- Return values:
-
return the min speed in step/s or microstep/s
- Note:
Definition at line 276 of file STSpin220.cpp.
| int32_t STSpin220_GetPosition | ( | void | ) | [protected] |
Get the current position (32b signed)
- Return values:
-
current position value
Definition at line 285 of file STSpin220.cpp.
| motorStepMode_t STSpin220_GetStepMode | ( | void | ) | [protected] |
| motorStopMode_t STSpin220_GetStopMode | ( | void | ) | [protected] |
Get the selected stop mode.
- Return values:
-
the selected stop mode
Definition at line 303 of file STSpin220.cpp.
| uint8_t STSpin220_GetTorque | ( | motorTorqueMode_t | torqueMode ) | [protected] |
Get the torque.
- Parameters:
-
[in] torqueMode torque mode
- Return values:
-
the torqueValue in % (from 0 to 100)
- Note:
Definition at line 314 of file STSpin220.cpp.
| bool STSpin220_GetTorqueBoostEnable | ( | void | ) | [protected] |
Get the torque boost feature status.
- Return values:
-
TRUE if enabled, FALSE if disabled
Definition at line 344 of file STSpin220.cpp.
| uint16_t STSpin220_GetTorqueBoostThreshold | ( | void | ) | [protected] |
Get the torque boost threshold.
- Return values:
-
The torque boost threshold above which the step mode is changed to full step
Definition at line 354 of file STSpin220.cpp.
| void STSpin220_GoHome | ( | void | ) | [protected] |
| void STSpin220_GoMark | ( | void | ) | [protected] |
| void STSpin220_GoTo | ( | int32_t | targetPosition ) | [protected] |
Request the motor to move to the specified position.
- Parameters:
-
[in] targetPosition absolute position in steps
- Return values:
-
None
- Note:
- The position is at the resolution corresponding to the selected step mode. STEP_MODE_FULL : step STEP_MODE_HALF : 1/2 step STEP_MODE_1_4 : 1/4 step STEP_MODE_1_8 : 1/8 step STEP_MODE_1_16 : 1/16 step STEP_MODE_1_32 : 1/32 step STEP_MODE_1_64 : 1/64 step STEP_MODE_1_128 : 1/128 step STEP_MODE_1_256 : 1/256 step
Definition at line 393 of file STSpin220.cpp.
| void STSpin220_GoToDir | ( | motorDir_t | direction, |
| int32_t | targetPosition | ||
| ) | [protected] |
move the motor to the absolute position
- Parameters:
-
[in] direction FORWARD or BACKWARD [in] targetPosition 32 bit signed value position
- Return values:
-
None
- Note:
- The position is at the resolution corresponding to the selected step mode. STEP_MODE_FULL : step STEP_MODE_HALF : 1/2 step STEP_MODE_1_4 : 1/4 step STEP_MODE_1_8 : 1/8 step STEP_MODE_1_16 : 1/16 step STEP_MODE_1_32 : 1/32 step STEP_MODE_1_64 : 1/64 step STEP_MODE_1_128 : 1/128 step STEP_MODE_1_256 : 1/256 step
Definition at line 473 of file STSpin220.cpp.
| void STSpin220_HardHiZ | ( | void | ) | [protected] |
Immediately stop the motor and disables the power bridges.
- Return values:
-
None
Definition at line 536 of file STSpin220.cpp.
| void STSpin220_HardStop | ( | void | ) | [protected] |
Immediatly stop the motor and either set holding torque when stop mode is HOLD_MODE, or call STSpin220_HardHiz function when stop mode is HIZ_MODE, or call STSpin220_PutDeviceInStandby function when stop mode is STANDBY_MODE.
- Return values:
-
None
Definition at line 576 of file STSpin220.cpp.
| status_t STSpin220_Init | ( | void * | pInit ) | [protected] |
Start the STSpin220 library.
- Parameters:
-
[in] pInit pointer to the initialization data
- Return values:
-
COMPONENT_OK in case of success.
Definition at line 54 of file STSpin220.cpp.
| void STSpin220_Move | ( | motorDir_t | direction, |
| uint32_t | stepCount | ||
| ) | [protected] |
Moves the motor of the specified number of steps.
- Parameters:
-
[in] direction FORWARD or BACKWARD [in] stepCount Number of steps to perform
- Return values:
-
None
Definition at line 619 of file STSpin220.cpp.
| void STSpin220_PutDeviceInStandby | ( | void | ) | [protected] |
Put STSpin220 device in standby (low power consumption)
- Return values:
-
None
Definition at line 654 of file STSpin220.cpp.
| void STSpin220_Run | ( | motorDir_t | direction ) | [protected] |
Runs the motor.
It will accelerate from the min speed up to the max speed by using the device acceleration.
- Parameters:
-
[in] direction FORWARD or BACKWARD
- Return values:
-
None
Definition at line 671 of file STSpin220.cpp.
| bool STSpin220_SetAcceleration | ( | uint16_t | newAcc ) | [protected] |
Changes the acceleration.
- Parameters:
-
[in] newAcc New acceleration to apply in pps^2
- Return values:
-
true if the command is successfully executed, else false
- Note:
- The command is not performed if the device is executing a MOVE or GOTO command (but it can be used during a RUN command)
Definition at line 701 of file STSpin220.cpp.
| bool STSpin220_SetDeceleration | ( | uint16_t | newDec ) | [protected] |
Changes the deceleration.
- Parameters:
-
[in] newDec New deceleration to apply in pps^2
- Return values:
-
true if the command is successfully executed, else false
- Note:
- The command is not performed if the device is executing a MOVE or GOTO command (but it can be used during a RUN command)
Definition at line 721 of file STSpin220.cpp.
| void STSpin220_SetDeviceParamsOtherValues | ( | void | ) | [protected] |
Set the parameters of the device whose values are not defined in stspin220_target_config.h.
- Return values:
-
None
Definition at line 1115 of file STSpin220.cpp.
| void STSpin220_SetDeviceParamsToGivenValues | ( | STSpin220_init_t * | pInitDevicePrm ) | [protected] |
Set the parameters of the device to values of the structure pointed by pInitDevicePrm.
Set GPIO according to these values.
- Parameters:
-
pInitDevicePrm pointer onto the structure containing values to initialize the device parameters.
- Return values:
-
None
Definition at line 1146 of file STSpin220.cpp.
| void STSpin220_SetDeviceParamsToPredefinedValues | ( | void | ) | [protected] |
Sets the parameters of the device to predefined values from stspin220_target_config.h.
- Return values:
-
None
Definition at line 1188 of file STSpin220.cpp.
| void STSpin220_SetDirection | ( | motorDir_t | dir ) | [protected] |
Specifies the direction.
- Parameters:
-
[in] dir FORWARD or BACKWARD
- Note:
- The direction change is applied if the device is in INACTIVE or STANDBY state or if the device is executing a run command
- Return values:
-
None
Definition at line 742 of file STSpin220.cpp.
| void STSpin220_SetHome | ( | void | ) | [protected] |
Set current position to be the Home position (current position set to 0)
- Return values:
-
None
Definition at line 765 of file STSpin220.cpp.
| void STSpin220_SetMark | ( | void | ) | [protected] |
Set current position to be the Mark position.
- Return values:
-
None
Definition at line 774 of file STSpin220.cpp.
| bool STSpin220_SetMaxSpeed | ( | uint16_t volatile | newSpeed ) | [protected] |
Changes the max speed.
- Parameters:
-
[in] newMaxSpeed New max speed to apply in pps
- Return values:
-
true if the command is successfully executed, else false
- Note:
- The command is not performed is the device is executing a MOVE or GOTO command (but it can be used during a RUN command).
Definition at line 786 of file STSpin220.cpp.
| bool STSpin220_SetMinSpeed | ( | uint16_t volatile | newSpeed ) | [protected] |
Changes the min speed.
- Parameters:
-
[in] newMinSpeed New min speed to apply in pps
- Return values:
-
true if the command is successfully executed, else false
- Note:
- The command is not performed is the device is executing a MOVE or GOTO command (but it can be used during a RUN command).
Definition at line 810 of file STSpin220.cpp.
| bool STSpin220_SetStepMode | ( | motorStepMode_t | stepMode ) | [protected] |
Set the stepping mode.
- Parameters:
-
[in] stepMode from full step to 1/256 microstep as specified in enum motorStepMode_t
- Return values:
-
true if the command is successfully executed, else false
Definition at line 831 of file STSpin220.cpp.
| bool STSpin220_SetStepModeWithoutReset | ( | motorStepMode_t | stepMode ) | [protected] |
Set the stepping mode without reset.
- Parameters:
-
[in] stepMode from full step to 1/256 microstep as specified in enum motorStepMode_t
- Return values:
-
true if the command is successfully executed, else false
Definition at line 1231 of file STSpin220.cpp.
| void STSpin220_SetStopMode | ( | motorStopMode_t | stopMode ) | [protected] |
Select the mode to stop the motor.
- Parameters:
-
[in] stopMode HOLD_MODE to let power bridge enabled
- Return values:
-
None
Definition at line 859 of file STSpin220.cpp.
| void STSpin220_SetTorque | ( | motorTorqueMode_t | torqueMode, |
| uint8_t | torqueValue | ||
| ) | [protected] |
Set the torque.
- Parameters:
-
[in] torqueMode Torque mode as specified in enum motorTorqueMode_t [in] torqueValue in % (from 0 to 100)
- Return values:
-
None
- Note:
Definition at line 871 of file STSpin220.cpp.
| void STSpin220_SetTorqueBoostEnable | ( | bool | enable ) | [protected] |
Enable or disable the torque boost feature.
- Parameters:
-
[in] enable true to enable torque boost, false to disable
- Return values:
-
None
Definition at line 906 of file STSpin220.cpp.
| void STSpin220_SetTorqueBoostThreshold | ( | uint16_t | speedThreshold ) | [protected] |
Set the torque boost threshold.
- Parameters:
-
[in] speedThreshold speed threshold above which the step mode is changed to full step
- Return values:
-
None
Definition at line 917 of file STSpin220.cpp.
| bool STSpin220_SoftStop | ( | void | ) | [protected] |
Stops the motor by using the device deceleration.
- Return values:
-
true if the command is successfully executed, else false
- Note:
- The command is not performed if the device is in INACTIVE, STANDBYTOINACTIVE or STANDBY state.
Definition at line 928 of file STSpin220.cpp.
| void STSpin220_StartMovement | ( | void | ) | [protected] |
Initialises the bridge parameters to start the movement and enable the power bridge.
- Return values:
-
None
Definition at line 1295 of file STSpin220.cpp.
| void STSpin220_StepClockHandler | ( | void | ) | [protected] |
Handles the device state machine at each pulse.
- Return values:
-
None
- Note:
- Must only be called by the timer ISR
Definition at line 1323 of file STSpin220.cpp.
| uint32_t STSpin220_VrefPwmGetFreq | ( | void | ) | [protected] |
Get the frequency of REF PWM.
- Return values:
-
the frequency of REF PWM in Hz
- Note:
Definition at line 945 of file STSpin220.cpp.
| void STSpin220_VrefPwmSetFreq | ( | uint32_t | newFreq ) | [protected] |
Set the frequency of REF PWM.
- Parameters:
-
[in] newFreq in Hz
- Return values:
-
None
- Note:
Definition at line 956 of file STSpin220.cpp.
| void STSpin220_WaitWhileActive | ( | void | ) | [protected] |
Locks until the device state becomes Inactive.
- Return values:
-
None
Definition at line 966 of file STSpin220.cpp.
| virtual void wait_while_active | ( | void | ) | [virtual] |
Waiting while the motor is active.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 481 of file STSpin220.h.
Generated on Tue Jul 12 2022 15:16:41 by
1.7.2

X-NUCLEO-IHM06A1 Low Voltage Stepper Motor Driver