Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
STSPIN820 Class Reference
Class representing a STSPIN820 component. More...
#include <STSPIN820.h>
Public Member Functions | |
| STSPIN820 (PinName ssel, DevSPI &spi) | |
| Constructor. | |
| virtual | ~STSPIN820 (void) |
| Destructor. | |
Protected Member Functions | |
| void | STSPIN820_ApplySpeed (uint8_t pwmId, uint16_t newSpeed) |
| Updates the current speed of the device. | |
| void | STSPIN820_ApplyTorque (uint8_t deviceId, motor_torque_mode_t torqueMode) |
| Apply the set torque to the specified device. | |
| void | STSPIN820_ComputeSpeedProfile (uint8_t deviceId, uint32_t nbSteps) |
| Computes the speed profile according to the number of steps to move. | |
| void | STSPIN820_FlagInterruptHandler (void) |
| Handlers of the flag interrupt which calls the user callback (if defined) | |
| void | STSPIN820_SetDeviceParamsOtherValues (void) |
| Set the parameters of the device whose values are not defined in STSPIN820_config.h. | |
| void | STSPIN820_SetDeviceParamsToGivenValues (STSPIN820_init_t *initDevicePrm) |
| Set the parameters of the device to values of initDevicePrm structure. | |
| void | STSPIN820_SetDeviceParamsToPredefinedValues (void) |
| Sets the parameters of the device to predefined values from STSPIN820_config.h. | |
| void | STSPIN820_StartMovement (uint8_t deviceId) |
| Initialises the bridge parameters to start the movement and enable the power bridge. | |
| void | STSPIN820_StepClockHandler (uint8_t deviceId) |
| Handles the device state machine at each pulse. | |
| MOTOR_vt_t * | STSPIN820_GetMotorHandle (void) |
| Return motor handle (pointer to the STSPIN820 motor driver structure) | |
| void | STSPIN820_Init (void *pInit) |
| Start the STSPIN820 library. | |
| uint16_t | STSPIN820_ReadId (void) |
| Read id. | |
| void | STSPIN820_AttachFlagInterrupt (void(*callback)(void)) |
| Attach a user callback to the flag Interrupt The call back will be then called each time the status flag pin will be pulled down due to the occurrence of a programmed alarms ( OCD, thermal pre-warning or shutdown, UVLO, wrong command, non-performable command) | |
| uint8_t | STSPIN820_CheckStatusHw (void) |
| Check if STSPIN820 has a fault by reading EN pin position. | |
| void | STSPIN820_Disable (uint8_t deviceId) |
| Disable the power bridges (leave the output bridges HiZ) | |
| void | STSPIN820_Enable (uint8_t deviceId) |
| Enable the power bridges. | |
| void | STSPIN820_ErrorHandler (uint16_t error) |
| Error handler which calls the user callback (if defined) | |
| void | STSPIN820_ExitDeviceFromStandby (uint8_t deviceId) |
| Exit STSPIN820 device from standby (low power consumption) | |
| motor_decay_mode_t | STSPIN820_GetDecayMode (uint8_t deviceId) |
| Return the decay mode of the specified device. | |
| uint16_t | STSPIN820_GetDeceleration (uint8_t deviceId) |
| Return the deceleration of the specified device. | |
| motor_state_t | STSPIN820_GetDeviceState (uint8_t deviceId) |
| Return the device state. | |
| motor_direction_t | STSPIN820_GetDirection (uint8_t deviceId) |
| Get the motor current direction. | |
| uint32_t | STSPIN820_GetFwVersion (void) |
| Return the FW version of the library. | |
| int32_t | STSPIN820_GetMark (uint8_t deviceId) |
| Return the mark position of the specified device. | |
| uint16_t | STSPIN820_GetMaxSpeed (uint8_t deviceId) |
| Return the max speed of the specified device. | |
| uint16_t | STSPIN820_GetMinSpeed (uint8_t deviceId) |
| Return the min speed of the specified device. | |
| uint8_t | STSPIN820_GetNbDevices (void) |
| Returns the number of devices. | |
| int32_t | STSPIN820_GetPosition (uint8_t deviceId) |
| Return the current position value of the specified device. | |
| motor_step_mode_t | STSPIN820_GetStepMode (uint8_t deviceId) |
| Get the motor step mode. | |
| motor_stop_mode_t | STSPIN820_GetStopMode (uint8_t deviceId) |
| Get the selected stop mode. | |
| uint8_t | STSPIN820_GetTorque (uint8_t deviceId, motor_torque_mode_t torqueMode) |
| Get the torque of the specified device. | |
| bool | STSPIN820_GetTorqueBoostEnable (uint8_t deviceId) |
| Get the torque boost feature status. | |
| uint16_t | STSPIN820_GetTorqueBoostThreshold (uint8_t deviceId) |
| Get the torque boost threshold. | |
| void | STSPIN820_GoHome (uint8_t deviceId) |
| Request the motor to move to the home position (ABS_POSITION = 0) | |
| void | STSPIN820_GoMark (uint8_t deviceId) |
| Request the motor to move to the mark position. | |
| void | STSPIN820_GoTo (uint8_t deviceId, int32_t targetPosition) |
| Request the motor to move to the specified position. | |
| void | STSPIN820_GoToDir (uint8_t deviceId, motor_direction_t direction, int32_t targetPosition) |
| Move the motor to the absolute position. | |
| void | STSPIN820_HardStop (uint8_t deviceId) |
| Immediatly stop the motor and either set holding torque when stop mode is HOLD_MODE, or call STSPIN820_HardHiz function when stop mode is HIZ_MODE, or call STSPIN820_PutDeviceInStandby function when stop mode is STANDBY_MODE. | |
| void | STSPIN820_HardHiZ (uint8_t deviceId) |
| Immediatly stop the motor and disable the power bridge. | |
| void | STSPIN820_Move (uint8_t deviceId, motor_direction_t direction, uint32_t stepCount) |
| Moves the motor of the specified number of steps. | |
| void | STSPIN820_PutDeviceInStandby (uint8_t deviceId) |
| Put STSPIN820 device in standby (low power consumption) | |
| void | STSPIN820_Run (uint8_t deviceId, motor_direction_t direction) |
| Runs the motor. | |
| bool | STSPIN820_SetAcceleration (uint8_t deviceId, uint16_t newAcc) |
| Changes the acceleration of the specified device. | |
| bool | STSPIN820_SetDeceleration (uint8_t deviceId, uint16_t newDec) |
| Changes the deceleration of the specified device. | |
| void | STSPIN820_SetDecayMode (uint8_t deviceId, motor_decay_mode_t decay) |
| Specifies the decay mode. | |
| void | STSPIN820_SetDirection (uint8_t deviceId, motor_direction_t direction) |
| Specifies the direction. | |
| void | STSPIN820_SetHome (uint8_t deviceId) |
| Set current position to be the Home position (current position set to 0) | |
| void | STSPIN820_SetMark (uint8_t deviceId) |
| Set current position to be the Mark position. | |
| bool | STSPIN820_SetMaxSpeed (uint8_t deviceId, uint16_t newMaxSpeed) |
| Changes the max speed of the specified device. | |
| bool | STSPIN820_SetMinSpeed (uint8_t deviceId, uint16_t newMinSpeed) |
| Changes the min speed of the specified device. | |
| bool | STSPIN820_SetNbDevices (uint8_t nbDevices) |
| Sets the number of devices to be used. | |
| bool | STSPIN820_SetStepMode (uint8_t deviceId, motor_step_mode_t stepMode) |
| Set the stepping mode. | |
| void | STSPIN820_SetStopMode (uint8_t deviceId, motor_stop_mode_t stopMode) |
| Select the mode to stop the motor. | |
| void | STSPIN820_SetTorque (uint8_t deviceId, motor_torque_mode_t torqueMode, uint8_t torqueValue) |
| Set the torque of the specified device. | |
| void | STSPIN820_SetTorqueBoostEnable (uint8_t deviceId, bool enable) |
| Enable or disable the torque boost feature. | |
| void | STSPIN820_SetTorqueBoostThreshold (uint8_t deviceId, uint16_t speedThreshold) |
| Set the torque boost threshold. | |
| bool | STSPIN820_SoftStop (uint8_t deviceId) |
| Stops the motor by using the device deceleration. | |
| uint32_t | STSPIN820_VrefPwmGetFreq (uint8_t deviceId) |
| Get the frequency of REF PWM of the specified device. | |
| void | STSPIN820_VrefPwmSetFreq (uint8_t deviceId, uint32_t newFreq) |
| Set the frequency of REF PWM of the specified device. | |
| void | STSPIN820_WaitWhileActive (uint8_t deviceId) |
| Locks until the device state becomes Inactive. | |
| status_t | read (uint8_t *pBuffer, uint16_t NumBytesToRead) |
| Utility function to read data from STSPIN820. | |
| status_t | write (uint8_t *pBuffer, uint16_t NumBytesToWrite) |
| Utility function to write data to STSPIN820. | |
| status_t | read_write (uint8_t *pBufferToRead, uint8_t *pBufferToWrite, uint16_t NumBytes) |
| Utility function to read and write data from/to STSPIN820 at the same time. | |
Detailed Description
Class representing a STSPIN820 component.
Definition at line 84 of file STSPIN820.h.
Constructor & Destructor Documentation
| STSPIN820 | ( | PinName | ssel, |
| DevSPI & | spi | ||
| ) |
Constructor.
- Parameters:
-
ssel pin name of the SSEL pin of the SPI device to be used for communication. spi SPI device to be used for communication.
Definition at line 95 of file STSPIN820.h.
| virtual ~STSPIN820 | ( | void | ) | [virtual] |
Destructor.
Definition at line 116 of file STSPIN820.h.
Member Function Documentation
| status_t read | ( | uint8_t * | pBuffer, |
| uint16_t | NumBytesToRead | ||
| ) | [protected] |
Utility function to read data from STSPIN820.
- Parameters:
-
[out] pBuffer pointer to the buffer to read data into. [in] NumBytesToRead number of bytes to read.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 537 of file STSPIN820.h.
| status_t read_write | ( | uint8_t * | pBufferToRead, |
| uint8_t * | pBufferToWrite, | ||
| uint16_t | NumBytes | ||
| ) | [protected] |
Utility function to read and write data from/to STSPIN820 at the same time.
- Parameters:
-
[out] pBufferToRead pointer to the buffer to read data into. [in] pBufferToWrite pointer to the buffer of data to send. [in] NumBytes number of bytes to read and write.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 564 of file STSPIN820.h.
| status_t write | ( | uint8_t * | pBuffer, |
| uint16_t | NumBytesToWrite | ||
| ) | [protected] |
Utility function to write data to STSPIN820.
- Parameters:
-
[in] pBuffer pointer to the buffer of data to send. [in] NumBytesToWrite number of bytes to write.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 550 of file STSPIN820.h.
Generated on Sat Jul 16 2022 06:19:57 by
1.7.2