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.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IHM03A1 by
POWERSTEP01 Class Reference
Class representing a Powerstep01 component. More...
#include <powerstep01_class.h>
Public Member Functions | |
| POWERSTEP01 (PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName pwm, PinName ssel, DevSPI &spi) | |
| Constructor. | |
| virtual | ~POWERSTEP01 (void) |
| Destructor. | |
| virtual int | Init (void *init=NULL) |
| Public functions inherited from the Component Class. | |
| virtual int | ReadID (uint8_t *id=NULL) |
| Getting the ID of the component. | |
| virtual unsigned int | GetStatus (void) |
| Public functions inherited from the StepperMotor Class. | |
| virtual signed int | GetPosition (void) |
| Getting the position. | |
| virtual signed int | GetMark (void) |
| Getting the marked position. | |
| virtual unsigned int | GetSpeed (void) |
| Getting the current speed in pps. | |
| virtual unsigned int | GetMaxSpeed (void) |
| Getting the maximum speed in pps. | |
| virtual unsigned int | GetMinSpeed (void) |
| Getting the minimum speed in pps. | |
| virtual unsigned int | GetAcceleration (void) |
| Getting the acceleration in pps^2. | |
| virtual unsigned int | GetDeceleration (void) |
| Getting the deceleration in pps^2. | |
| virtual direction_t | GetDirection (void) |
| Getting the direction of rotation. | |
| virtual void | SetHome (void) |
| Setting the current position to be the home position. | |
| virtual void | SetMark (void) |
| Setting the current position to be the marked position. | |
| virtual bool | SetMaxSpeed (unsigned int speed) |
| Setting the maximum speed in steps/s. | |
| virtual bool | SetMinSpeed (unsigned int speed) |
| Setting the minimum speed in steps/s. | |
| virtual bool | SetAcceleration (unsigned int acceleration) |
| Setting the acceleration in steps/s^2. | |
| virtual bool | SetDeceleration (unsigned int deceleration) |
| Setting the deceleration in steps/s^2. | |
| virtual bool | SetStepMode (step_mode_t step_mode) |
| Setting the Step Mode. | |
| virtual void | GoTo (signed int position) |
| Going to a specified position. | |
| virtual void | GoHome (void) |
| Going to the home position. | |
| virtual void | GoMark (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 | SoftStop (void) |
| Stopping the motor through an immediate deceleration up to zero speed. | |
| virtual void | HardStop (void) |
| Stopping the motor through an immediate infinite deceleration. | |
| virtual void | SoftHiZ (void) |
| Disabling the power bridge after performing a deceleration to zero. | |
| virtual void | HardHiZ (void) |
| Disabling the power bridge immediately. | |
| virtual void | WaitWhileActive (void) |
| Waiting while the motor is active. | |
| virtual void | AttachErrorHandler (void(*fptr)(uint16_t error)) |
| Public functions NOT inherited. | |
| virtual int | CheckBusyHw (void) |
| Checks if the device is busy by reading the busy pin position. | |
| virtual unsigned int | CheckStatusHw (void) |
| Checks if the device has an alarm flag set by reading the flag pin position. | |
| virtual void | FetchAndClearAllStatus (void) |
| Fetch and clear status flags of all devices by issuing a GET_STATUS command simultaneously to all devices. | |
| virtual float | GetAnalogValue (unsigned int parameter) |
| Getting a parameter float value. | |
| virtual uint16_t | GetFetchedStatus (void) |
| Get the value of the STATUS register which was fetched by using Powerstep01_FetchAndClearAllStatus. | |
| virtual unsigned int | GetFwVersion (void) |
| Getting the version of the firmware. | |
| virtual unsigned int | GetRawParameter (unsigned int parameter) |
| Getting a parameter register value. | |
| virtual void | GoUntil (motorAction_t action, direction_t direction, float speed) |
| Issues PowerStep01 Go Until command. | |
| virtual bool | IsDeviceBusy (void) |
| Checks if the device is busy by reading the Busy flag bit ot its status Register This operation clears the status register. | |
| virtual void | QueueCommands (uint8_t command, int32_t value) |
| Put commands in queue before synchronous sending done by calling SendQueuedCommands. | |
| virtual uint16_t | ReadStatusRegister (void) |
| Reading the Status Register. | |
| virtual void | ReleaseSw (motorAction_t action, direction_t direction) |
| Issues PowerStep01 Release SW command. | |
| virtual void | ResetCommand (void) |
| Issues PowerStep01 Reset Device command. | |
| virtual void | ResetPosition (void) |
| Issues PowerStep01 ResetPos command. | |
| virtual void | Run (direction_t direction, float speed) |
| Running the motor towards a specified direction. | |
| virtual void | SendQueuedCommands (void) |
| Sends commands stored previously in the queue by QueueCommands. | |
| virtual bool | SetAnalogValue (unsigned int param, float value) |
| Setting a parameter with an input float value. | |
| virtual void | SetRawParameter (unsigned int parameter, unsigned int value) |
| Setting a parameter. | |
| virtual void | StepClockModeEnable (direction_t direction) |
| Enable the step clock mode. | |
| virtual void | StepClockStart (uint16_t frequency) |
| Setting the frequency of PWM. | |
| virtual void | StepClockStop (void) |
| Stopping the PWM. | |
| void | AttachFlagIRQ (void(*fptr)(void)) |
| Attaching an interrupt handler to the FLAG interrupt. | |
| void | EnableFlagIRQ (void) |
| Enabling the FLAG interrupt handling. | |
| void | DisableFlagIRQ (void) |
| Disabling the FLAG interrupt handling. | |
| void | AttachBusyIRQ (void(*fptr)(void)) |
| Attaching an interrupt handler to the BUSY interrupt. | |
| void | EnableBusyIRQ (void) |
| Enabling the BUSY interrupt handling. | |
| void | DisableBusyIRQ (void) |
| Disabling the BUSY interrupt handling. | |
Static Public Member Functions | |
| static uint8_t | GetNbDevices (void) |
| Public static functions. | |
| static uint16_t | AccDec_Steps_s2_to_RegVal (float steps_s2) |
| To and from register parameter conversion functions. | |
Protected Member Functions | |
| void | Powerstep01_CmdGoToDir (motorDir_t direction, int32_t targetPosition) |
| Issues PowerStep01 Go To Dir command. | |
| void | Powerstep01_CmdGoUntil (motorAction_t action, motorDir_t direction, uint32_t speed) |
| Issues PowerStep01 Go Until command. | |
| void | Powerstep01_CmdReleaseSw (motorAction_t action, motorDir_t direction) |
| Issues PowerStep01 Release SW command. | |
| void | Powerstep01_CmdResetDevice (void) |
| Issues PowerStep01 Reset Device command. | |
| void | Powerstep01_CmdResetPos (void) |
| Issues PowerStep01 Reset Pos command. | |
| void | Powerstep01_CmdStepClock (motorDir_t direction) |
| Issues PowerStep01 Step Clock command. | |
| void | Powerstep01_FetchAndClearAllStatus (void) |
| Fetch and clear status flags of all devices by issuing a GET_STATUS command simultaneously to all devices. | |
| uint16_t | Powerstep01_GetFetchedStatus (void) |
| Get the value of the STATUS register which was fetched by using Powerstep01_FetchAndClearAllStatus. | |
| int32_t | Powerstep01_ConvertPosition (uint32_t abs_position_reg) |
| To and from register parameter conversion functions. | |
| void | Powerstep01_SetDeviceParamsToGivenValues (powerstep01_Init_u_t *initPrm) |
| Functions to initialize the registers. | |
| uint32_t | Powerstep01_CmdGetParam (powerstep01_Registers_t param) |
| Functions to get and set parameters using digital or analog values. | |
| void | Powerstep01_QueueCommands (uint8_t command, int32_t value) |
| Put commands in queue before synchronous sending done by calling Powerstep01_SendQueuedCommands. | |
| void | Powerstep01_SendQueuedCommands (void) |
| Sends commands stored previously in the queue by Powerstep01_QueueCommands. | |
| int | round (float f) |
| Rounding a floating point number to the nearest unsigned integer number. | |
| Status_t | Read (uint8_t *pBuffer, uint16_t NumBytesToRead) |
| Utility function to read data from Powerstep01. | |
| Status_t | Write (uint8_t *pBuffer, uint16_t NumBytesToWrite) |
| Utility function to write data to Powerstep01. | |
| Status_t | ReadWrite (uint8_t *pBufferToRead, uint8_t *pBufferToWrite, uint16_t NumBytes) |
| Utility function to read and write data from/to Powerstep01 at the same time. | |
| void | Powerstep01_Board_Delay (uint32_t delay) |
| Making the CPU wait. | |
| void | Powerstep01_Board_EnableIrq (void) |
| Enabling interrupts. | |
| void | Powerstep01_Board_DisableIrq (void) |
| Disabling interrupts. | |
| void | Powerstep01_Board_StepClockInit (void) |
| Initialising the PWM. | |
| void | Powerstep01_Board_ReleaseReset (void) |
| Exit the device from reset mode. | |
| void | Powerstep01_Board_Reset (void) |
| Put the device in reset mode. | |
| uint8_t | Powerstep01_Board_SpiWriteBytes (uint8_t *pByteToTransmit, uint8_t *pReceivedByte) |
| Writing and reading bytes to/from the component through the SPI at the same time. | |
Detailed Description
Class representing a Powerstep01 component.
Definition at line 72 of file powerstep01_class.h.
Constructor & Destructor Documentation
| POWERSTEP01 | ( | PinName | flag_irq, |
| PinName | busy_irq, | ||
| PinName | standby_reset, | ||
| PinName | pwm, | ||
| PinName | ssel, | ||
| DevSPI & | spi | ||
| ) |
Constructor.
- Parameters:
-
flag_irq pin name of the FLAG pin of the component. busy_irq pin name of the BUSY pin of the component. standby_reset pin name of the STBY pin of the component. pwm pin name of the PWM pin of the component. 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 87 of file powerstep01_class.h.
| virtual ~POWERSTEP01 | ( | void | ) | [virtual] |
Destructor.
Definition at line 110 of file powerstep01_class.h.
Member Function Documentation
| static uint16_t AccDec_Steps_s2_to_RegVal | ( | float | steps_s2 ) | [static] |
To and from register parameter conversion functions.
Definition at line 852 of file powerstep01_class.h.
| void AttachBusyIRQ | ( | void(*)(void) | fptr ) |
Attaching an interrupt handler to the BUSY interrupt.
- Parameters:
-
fptr An interrupt handler.
- Return values:
-
None.
Definition at line 1183 of file powerstep01_class.h.
| virtual void AttachErrorHandler | ( | 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 456 of file powerstep01_class.h.
| void AttachFlagIRQ | ( | void(*)(void) | fptr ) |
Attaching an interrupt handler to the FLAG interrupt.
- Parameters:
-
fptr An interrupt handler.
- Return values:
-
None.
Definition at line 1153 of file powerstep01_class.h.
| virtual int CheckBusyHw | ( | void | ) | [virtual] |
Checks if the device is busy by reading the busy pin position.
- Parameters:
-
None.
- Return values:
-
One if the device his busy (low logic level on busy output), otherwise zero
Definition at line 467 of file powerstep01_class.h.
| virtual unsigned int CheckStatusHw | ( | void | ) | [virtual] |
Checks if the device has an alarm flag set by reading the flag pin position.
- Parameters:
-
None.
- Return values:
-
One if the device has an alarm flag set (low logic level on flag output), otherwise zero
Definition at line 479 of file powerstep01_class.h.
| void DisableBusyIRQ | ( | void | ) |
Disabling the BUSY interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1203 of file powerstep01_class.h.
| void DisableFlagIRQ | ( | void | ) |
Disabling the FLAG interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1173 of file powerstep01_class.h.
| void EnableBusyIRQ | ( | void | ) |
Enabling the BUSY interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1193 of file powerstep01_class.h.
| void EnableFlagIRQ | ( | void | ) |
Enabling the FLAG interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1163 of file powerstep01_class.h.
| virtual void FetchAndClearAllStatus | ( | void | ) | [virtual] |
Fetch and clear status flags of all devices by issuing a GET_STATUS command simultaneously to all devices.
Then, the fetched status of each device can be retrieved by using the Powerstep01_GetFetchedStatus function provided there is no other calls to functions which use the SPI in between.
- Return values:
-
None
Definition at line 495 of file powerstep01_class.h.
| virtual unsigned int GetAcceleration | ( | void | ) | [virtual] |
Getting the acceleration in pps^2.
- Parameters:
-
None.
- Return values:
-
The acceleration in pps^2.
Definition at line 230 of file powerstep01_class.h.
| virtual float GetAnalogValue | ( | unsigned int | parameter ) | [virtual] |
Getting a parameter float value.
- Parameters:
-
parameter A parameter's register adress.
- Return values:
-
The parameter's float value. parameter can be one of the following: + POWERSTEP01_ABS_POS + POWERSTEP01_MARK + POWERSTEP01_ACC + POWERSTEP01_DEC + POWERSTEP01_SPEED + POWERSTEP01_MAX_SPEED + POWERSTEP01_MIN_SPEED + POWERSTEP01_FS_SPD (voltage mode) + POWERSTEP01_INT_SPD (voltage mode) + POWERSTEP01_K_THERM + POWERSTEP01_OCD_TH (voltage mode) + POWERSTEP01_STALL_TH (voltage mode) + POWERSTEP01_KVAL_HOLD : value in % (current mode) + POWERSTEP01_TVAL_HOLD : value in mV (voltage mode) + POWERSTEP01_KVAL_RUN : value in % (current mode) + POWERSTEP01_TVAL_RUN : value in mV (voltage mode) + POWERSTEP01_KVAL_ACC : value in % (current mode) + POWERSTEP01_TVAL_ACC : value in mV (voltage mode) + POWERSTEP01_KVAL_DEC : value in % (current mode) + POWERSTEP01_TVAL_DEC : value in mV (voltage mode) + POWERSTEP01_ST_SLP (voltage mode) + POWERSTEP01_FN_SLP_ACC (voltage mode) + POWERSTEP01_FN_SLP_DEC
Definition at line 529 of file powerstep01_class.h.
| virtual unsigned int GetDeceleration | ( | void | ) | [virtual] |
Getting the deceleration in pps^2.
- Parameters:
-
None.
- Return values:
-
The deceleration in pps^2.
Definition at line 240 of file powerstep01_class.h.
| virtual direction_t GetDirection | ( | void | ) | [virtual] |
Getting the direction of rotation.
- Parameters:
-
None.
- Return values:
-
The direction of rotation.
Definition at line 250 of file powerstep01_class.h.
| virtual uint16_t GetFetchedStatus | ( | void | ) | [virtual] |
Get the value of the STATUS register which was fetched by using Powerstep01_FetchAndClearAllStatus.
The fetched values are available as long as there no other calls to functions which use the SPI.
- Return values:
-
Last fetched value of the STATUS register.
Definition at line 541 of file powerstep01_class.h.
| virtual unsigned int GetFwVersion | ( | void | ) | [virtual] |
Getting the version of the firmware.
- Parameters:
-
None.
- Return values:
-
The version of the firmware.
Definition at line 551 of file powerstep01_class.h.
| virtual signed int GetMark | ( | void | ) | [virtual] |
Getting the marked position.
- Parameters:
-
None.
- Return values:
-
The marked position.
Definition at line 190 of file powerstep01_class.h.
| virtual unsigned int GetMaxSpeed | ( | void | ) | [virtual] |
Getting the maximum speed in pps.
- Parameters:
-
None.
- Return values:
-
The maximum speed in pps.
Definition at line 210 of file powerstep01_class.h.
| virtual unsigned int GetMinSpeed | ( | void | ) | [virtual] |
Getting the minimum speed in pps.
- Parameters:
-
None.
- Return values:
-
The minimum speed in pps.
Definition at line 220 of file powerstep01_class.h.
| static uint8_t GetNbDevices | ( | void | ) | [static] |
Public static functions.
Definition at line 836 of file powerstep01_class.h.
| virtual signed int GetPosition | ( | void | ) | [virtual] |
Getting the position.
- Parameters:
-
None.
- Return values:
-
The position.
Definition at line 180 of file powerstep01_class.h.
| virtual unsigned int GetRawParameter | ( | unsigned int | parameter ) | [virtual] |
Getting a parameter register value.
- Parameters:
-
parameter A parameter's register adress.
- Return values:
-
The parameter's register value. parameter can be one of the following: + POWERSTEP01_ABS_POS + POWERSTEP01_EL_POS + POWERSTEP01_MARK + POWERSTEP01_SPEED + POWERSTEP01_ACC + POWERSTEP01_DEC + POWERSTEP01_MAX_SPEED + POWERSTEP01_MIN_SPEED (voltage mode) + POWERSTEP01_KVAL_HOLD : value in % (current mode) + POWERSTEP01_TVAL_HOLD : value in mV (voltage mode) + POWERSTEP01_KVAL_RUN : value in % (current mode) + POWERSTEP01_TVAL_RUN : value in mV (voltage mode) + POWERSTEP01_KVAL_ACC : value in % (current mode) + POWERSTEP01_TVAL_ACC : value in mV (voltage mode) + POWERSTEP01_KVAL_DEC : value in % (current mode) + POWERSTEP01_TVAL_DEC : value in mV (voltage mode) + POWERSTEP01_INT_SPD (voltage mode) + POWERSTEP01_ST_SLP (current mode) + POWERSTEP01_T_FAST (voltage mode) + POWERSTEP01_FN_SLP_ACC (current mode) + POWERSTEP01_TON_MIN (voltage mode) + POWERSTEP01_FN_SLP_DEC (current mode) + POWERSTEP01_TOFF_MIN (voltage mode) + POWERSTEP01_K_THERM + POWERSTEP01_ADC_OUT + POWERSTEP01_OCD_TH (voltage mode) + POWERSTEP01_STALL_TH + POWERSTEP01_FS_SPD + POWERSTEP01_STEP_MODE + POWERSTEP01_ALARM_EN + POWERSTEP01_GATECFG1 + POWERSTEP01_GATECFG2 + POWERSTEP01_CONFIG + POWERSTEP01_STATUS
Definition at line 596 of file powerstep01_class.h.
| virtual unsigned int GetSpeed | ( | void | ) | [virtual] |
Getting the current speed in pps.
- Parameters:
-
None.
- Return values:
-
The current speed in pps.
Definition at line 200 of file powerstep01_class.h.
| virtual unsigned int GetStatus | ( | void | ) | [virtual] |
Public functions inherited from the StepperMotor Class.
Getting the value of the Status Register.
- Parameters:
-
None.
- Return values:
-
None.
- Note:
- The Status Register's flags are cleared, contrary to ReadStatusRegister().
Definition at line 170 of file powerstep01_class.h.
| virtual void GoHome | ( | void | ) | [virtual] |
Going to the home position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 361 of file powerstep01_class.h.
| virtual void GoMark | ( | void | ) | [virtual] |
Going to the marked position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 371 of file powerstep01_class.h.
| virtual void GoTo | ( | signed int | position ) | [virtual] |
Going to a specified position.
- Parameters:
-
position The desired position.
- Return values:
-
None.
Definition at line 346 of file powerstep01_class.h.
| virtual void GoUntil | ( | motorAction_t | action, |
| direction_t | direction, | ||
| float | speed | ||
| ) | [virtual] |
Issues PowerStep01 Go Until command.
- Parameters:
-
action type of action to undertake when the SW input is forced high (ACTION_RESET or ACTION_COPY). direction The direction of rotation. speed in steps/s.
- Return values:
-
One if the device has an alarm flag set (low logic level on flag output), otherwise zero
Definition at line 610 of file powerstep01_class.h.
| virtual void HardHiZ | ( | void | ) | [virtual] |
Disabling the power bridge immediately.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 432 of file powerstep01_class.h.
| virtual void HardStop | ( | void | ) | [virtual] |
Stopping the motor through an immediate infinite deceleration.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 412 of file powerstep01_class.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 145 of file powerstep01_class.h.
| virtual bool IsDeviceBusy | ( | void | ) | [virtual] |
Checks if the device is busy by reading the Busy flag bit ot its status Register This operation clears the status register.
- Return values:
-
true if device is busy, false zero
Definition at line 623 of file powerstep01_class.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 392 of file powerstep01_class.h.
| void Powerstep01_Board_Delay | ( | uint32_t | delay ) | [protected] |
Making the CPU wait.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1350 of file powerstep01_class.h.
| void Powerstep01_Board_DisableIrq | ( | void | ) | [protected] |
Disabling interrupts.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1370 of file powerstep01_class.h.
| void Powerstep01_Board_EnableIrq | ( | void | ) | [protected] |
Enabling interrupts.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1360 of file powerstep01_class.h.
| void Powerstep01_Board_ReleaseReset | ( | void | ) | [protected] |
Exit the device from reset mode.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1387 of file powerstep01_class.h.
| void Powerstep01_Board_Reset | ( | void | ) | [protected] |
Put the device in reset mode.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1397 of file powerstep01_class.h.
| uint8_t Powerstep01_Board_SpiWriteBytes | ( | uint8_t * | pByteToTransmit, |
| uint8_t * | pReceivedByte | ||
| ) | [protected] |
Writing and reading bytes to/from the component through the SPI at the same time.
- Parameters:
-
pByteToTransmit pointer to the buffer of data to send. [out] pReceivedByte pointer to the buffer to read data into.
- Return values:
-
0 in case of success, "1" otherwise.
Definition at line 1408 of file powerstep01_class.h.
| void Powerstep01_Board_StepClockInit | ( | void | ) | [protected] |
Initialising the PWM.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1380 of file powerstep01_class.h.
| uint32_t Powerstep01_CmdGetParam | ( | powerstep01_Registers_t | param ) | [protected] |
Functions to get and set parameters using digital or analog values.
Definition at line 1120 of file powerstep01_class.cpp.
| void Powerstep01_CmdGoToDir | ( | motorDir_t | direction, |
| int32_t | abs_pos | ||
| ) | [protected] |
Issues PowerStep01 Go To Dir command.
- Parameters:
-
[in] direction movement direction [in] abs_pos absolute position where requested to move
- Return values:
-
None
Definition at line 211 of file powerstep01_class.cpp.
| void Powerstep01_CmdGoUntil | ( | motorAction_t | action, |
| motorDir_t | direction, | ||
| uint32_t | speed | ||
| ) | [protected] |
Issues PowerStep01 Go Until command.
- Parameters:
-
[in] action ACTION_RESET or ACTION_COPY [in] direction movement direction [in] speed in steps/tick
- Return values:
-
None
Definition at line 225 of file powerstep01_class.cpp.
| void Powerstep01_CmdReleaseSw | ( | motorAction_t | action, |
| motorDir_t | direction | ||
| ) | [protected] |
Issues PowerStep01 Release SW command.
- Parameters:
-
[in] action type of action to undertake when the SW input is forced high [in] direction movement direction
- Return values:
-
None
Definition at line 292 of file powerstep01_class.cpp.
| void Powerstep01_CmdResetDevice | ( | void | ) | [protected] |
Issues PowerStep01 Reset Device command.
- Parameters:
-
[in] deviceId (from 0 to MAX_NUMBER_OF_DEVICES-1 )
- Return values:
-
None
Definition at line 306 of file powerstep01_class.cpp.
| void Powerstep01_CmdResetPos | ( | void | ) | [protected] |
Issues PowerStep01 Reset Pos command.
- Parameters:
-
[in] deviceId (from 0 to MAX_NUMBER_OF_DEVICES-1 )
- Return values:
-
None
Definition at line 316 of file powerstep01_class.cpp.
| void Powerstep01_CmdStepClock | ( | motorDir_t | direction ) | [protected] |
Issues PowerStep01 Step Clock command.
- Parameters:
-
[in] direction Movement direction (FORWARD, BACKWARD)
- Return values:
-
None
Definition at line 373 of file powerstep01_class.cpp.
| int32_t Powerstep01_ConvertPosition | ( | uint32_t | abs_position_reg ) | [protected] |
To and from register parameter conversion functions.
Definition at line 600 of file powerstep01_class.cpp.
| void Powerstep01_FetchAndClearAllStatus | ( | void | ) | [protected] |
Fetch and clear status flags of all devices by issuing a GET_STATUS command simultaneously to all devices.
Then, the fetched status of each device can be retrieved by using the Powerstep01_GetFetchedStatus function provided there is no other calls to functions which use the SPI in between.
- Return values:
-
None
Definition at line 407 of file powerstep01_class.cpp.
| uint16_t Powerstep01_GetFetchedStatus | ( | void | ) | [protected] |
Get the value of the STATUS register which was fetched by using Powerstep01_FetchAndClearAllStatus.
The fetched values are available as long as there no other calls to functions which use the SPI.
- Return values:
-
Last fetched value of the STATUS register
Definition at line 438 of file powerstep01_class.cpp.
| void Powerstep01_QueueCommands | ( | uint8_t | command, |
| int32_t | value | ||
| ) | [protected] |
Put commands in queue before synchronous sending done by calling Powerstep01_SendQueuedCommands.
Any call to functions that use the SPI between the calls of Powerstep01_QueueCommands and Powerstep01_SendQueuedCommands will corrupt the queue. A command for each device of the daisy chain must be specified before calling Powerstep01_SendQueuedCommands.
- Parameters:
-
[in] command Command to queue (all Powerstep01 commmands except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, POWERSTEP01_GET_STATUS) [in] value argument of the command to queue
- Return values:
-
None
Definition at line 1350 of file powerstep01_class.cpp.
| void Powerstep01_SendQueuedCommands | ( | void | ) | [protected] |
Sends commands stored previously in the queue by Powerstep01_QueueCommands.
- Return values:
-
None
Definition at line 1450 of file powerstep01_class.cpp.
| void Powerstep01_SetDeviceParamsToGivenValues | ( | powerstep01_Init_u_t * | initPrm ) | [protected] |
Functions to initialize the registers.
Definition at line 630 of file powerstep01_class.cpp.
| virtual void QueueCommands | ( | uint8_t | command, |
| int32_t | value | ||
| ) | [virtual] |
Put commands in queue before synchronous sending done by calling SendQueuedCommands.
Any call to functions that use the SPI between the calls of QueueCommands and SendQueuedCommands will corrupt the queue. A command for each device of the daisy chain must be specified before calling SendQueuedCommands.
- Parameters:
-
command Command to queue (all Powerstep01 commmands except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, POWERSTEP01_GET_STATUS). value argument of the command to queue.
- Return values:
-
None.
Definition at line 642 of file powerstep01_class.h.
| Status_t Read | ( | uint8_t * | pBuffer, |
| uint16_t | NumBytesToRead | ||
| ) | [protected] |
Utility function to read data from Powerstep01.
- Parameters:
-
[out] pBuffer pointer to the buffer to read data into. NumBytesToRead number of bytes to read.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 1307 of file powerstep01_class.h.
| virtual int ReadID | ( | 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 155 of file powerstep01_class.h.
| virtual uint16_t ReadStatusRegister | ( | void | ) | [virtual] |
Reading the Status Register.
- Parameters:
-
None.
- Return values:
-
None.
- Note:
- The Status Register's flags are not cleared, contrary to GetStatus().
Definition at line 653 of file powerstep01_class.h.
| Status_t ReadWrite | ( | uint8_t * | pBufferToRead, |
| uint8_t * | pBufferToWrite, | ||
| uint16_t | NumBytes | ||
| ) | [protected] |
Utility function to read and write data from/to Powerstep01 at the same time.
- Parameters:
-
[out] pBufferToRead pointer to the buffer to read data into. pBufferToWrite pointer to the buffer of data to send. NumBytes number of bytes to read and write.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 1334 of file powerstep01_class.h.
| virtual void ReleaseSw | ( | motorAction_t | action, |
| direction_t | direction | ||
| ) | [virtual] |
Issues PowerStep01 Release SW command.
- Parameters:
-
action type of action to undertake when the SW input is forced high (ACTION_RESET or ACTION_COPY). direction The direction of rotation. speed in steps/s.
- Return values:
-
One if the device has an alarm flag set (low logic level on flag output), otherwise zero
Definition at line 667 of file powerstep01_class.h.
| virtual void ResetCommand | ( | void | ) | [virtual] |
Issues PowerStep01 Reset Device command.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 678 of file powerstep01_class.h.
| virtual void ResetPosition | ( | void | ) | [virtual] |
Issues PowerStep01 ResetPos command.
- Parameters:
-
None.
- Return values:
-
None.
- Note:
- Same effect as SetHome().
Definition at line 689 of file powerstep01_class.h.
| int round | ( | float | f ) | [protected] |
Rounding a floating point number to the nearest unsigned integer number.
- Parameters:
-
f The floating point number.
- Return values:
-
The nearest unsigned integer number.
Definition at line 1291 of file powerstep01_class.h.
| virtual void Run | ( | direction_t | direction, |
| float | speed | ||
| ) | [virtual] |
Running the motor towards a specified direction.
- Parameters:
-
direction The direction of rotation. speed in steps/s.
- Return values:
-
None.
Definition at line 700 of file powerstep01_class.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 381 of file powerstep01_class.h.
| virtual void SendQueuedCommands | ( | void | ) | [virtual] |
Sends commands stored previously in the queue by QueueCommands.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 710 of file powerstep01_class.h.
| virtual bool SetAcceleration | ( | unsigned int | acceleration ) | [virtual] |
Setting the acceleration in steps/s^2.
- Parameters:
-
acceleration The acceleration in steps/s^2.
- Return values:
-
None.
Definition at line 307 of file powerstep01_class.h.
| virtual bool SetAnalogValue | ( | unsigned int | param, |
| float | value | ||
| ) | [virtual] |
Setting a parameter with an input float value.
- Parameters:
-
param Register adress. value Float value to convert and set into the register.
- Return values:
-
TRUE if param and value are valid, FALSE otherwise
- Note:
- parameter can be one of the following: + POWERSTEP01_EL_POS + POWERSTEP01_ABS_POS + POWERSTEP01_MARK + POWERSTEP01_ACC + POWERSTEP01_DEC + POWERSTEP01_MAX_SPEED + POWERSTEP01_MIN_SPEED + POWERSTEP01_FS_SPD + POWERSTEP01_INT_SPD + POWERSTEP01_K_THERM + POWERSTEP01_OCD_TH + POWERSTEP01_STALL_TH + POWERSTEP01_KVAL_HOLD + POWERSTEP01_KVAL_RUN + POWERSTEP01_KVAL_ACC + POWERSTEP01_KVAL_DEC + POWERSTEP01_ST_SLP + POWERSTEP01_FN_SLP_ACC + POWERSTEP01_FN_SLP_DEC + POWERSTEP01_TVAL_HOLD + POWERSTEP01_TVAL_RUN + POWERSTEP01_TVAL_ACC + POWERSTEP01_TVAL_DEC + POWERSTEP01_TON_MIN + POWERSTEP01_TOFF_MIN
Definition at line 747 of file powerstep01_class.h.
| virtual bool SetDeceleration | ( | unsigned int | deceleration ) | [virtual] |
Setting the deceleration in steps/s^2.
- Parameters:
-
deceleration The deceleration in steps/s^2.
- Return values:
-
None.
Definition at line 317 of file powerstep01_class.h.
| virtual void SetHome | ( | void | ) | [virtual] |
Setting the current position to be the home position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 267 of file powerstep01_class.h.
| virtual void SetMark | ( | void | ) | [virtual] |
Setting the current position to be the marked position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 277 of file powerstep01_class.h.
| virtual bool SetMaxSpeed | ( | unsigned int | speed ) | [virtual] |
Setting the maximum speed in steps/s.
- Parameters:
-
speed The maximum speed in steps/s.
- Return values:
-
TRUE if value is valid, FALSE otherwise.
Definition at line 287 of file powerstep01_class.h.
| virtual bool SetMinSpeed | ( | unsigned int | speed ) | [virtual] |
Setting the minimum speed in steps/s.
- Parameters:
-
speed The minimum speed in steps/s.
- Return values:
-
TRUE if value is valid, FALSE otherwise.
Definition at line 297 of file powerstep01_class.h.
| virtual void SetRawParameter | ( | unsigned int | parameter, |
| unsigned int | value | ||
| ) | [virtual] |
Setting a parameter.
- Parameters:
-
parameter A parameter's register adress. value The parameter's value.
- Return values:
-
None. parameter can be one of the following: + POWERSTEP01_ABS_POS + POWERSTEP01_EL_POS + POWERSTEP01_MARK + POWERSTEP01_ACC + POWERSTEP01_DEC + POWERSTEP01_MAX_SPEED + POWERSTEP01_MIN_SPEED (voltage mode) + POWERSTEP01_KVAL_HOLD : value in % (current mode) + POWERSTEP01_TVAL_HOLD : value in mV (voltage mode) + POWERSTEP01_KVAL_RUN : value in % (current mode) + POWERSTEP01_TVAL_RUN : value in mV (voltage mode) + POWERSTEP01_KVAL_ACC : value in % (current mode) + POWERSTEP01_TVAL_ACC : value in mV (voltage mode) + POWERSTEP01_KVAL_DEC : value in % (current mode) + POWERSTEP01_TVAL_DEC : value in mV (voltage mode) + POWERSTEP01_INT_SPD (voltage mode) + POWERSTEP01_ST_SLP (current mode) + POWERSTEP01_T_FAST (voltage mode) + POWERSTEP01_FN_SLP_ACC (current mode) + POWERSTEP01_TON_MIN (voltage mode) + POWERSTEP01_FN_SLP_DEC (current mode) + POWERSTEP01_TOFF_MIN (voltage mode) + POWERSTEP01_K_THERM + POWERSTEP01_ADC_OUT + POWERSTEP01_OCD_TH (voltage mode) + POWERSTEP01_STALL_TH + POWERSTEP01_FS_SPD + POWERSTEP01_STEP_MODE + POWERSTEP01_ALARM_EN + POWERSTEP01_GATECFG1 + POWERSTEP01_GATECFG2 + POWERSTEP01_CONFIG
Definition at line 791 of file powerstep01_class.h.
| virtual bool SetStepMode | ( | step_mode_t | step_mode ) | [virtual] |
Setting the Step Mode.
- Parameters:
-
step_mode The Step Mode.
- Return values:
-
None.
- Note:
- step_mode can be one of the following: + STEP_MODE_FULL + STEP_MODE_HALF + STEP_MODE_1_4 + STEP_MODE_1_8 + STEP_MODE_1_16 + STEP_MODE_1_32 + STEP_MODE_1_64 + STEP_MODE_1_128
Definition at line 336 of file powerstep01_class.h.
| virtual void SoftHiZ | ( | void | ) | [virtual] |
Disabling the power bridge after performing a deceleration to zero.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 422 of file powerstep01_class.h.
| virtual void SoftStop | ( | void | ) | [virtual] |
Stopping the motor through an immediate deceleration up to zero speed.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 402 of file powerstep01_class.h.
| virtual void StepClockModeEnable | ( | direction_t | direction ) | [virtual] |
Enable the step clock mode.
- Parameters:
-
frequency the frequency of PWM.
- Return values:
-
None.
Definition at line 801 of file powerstep01_class.h.
| virtual void StepClockStart | ( | uint16_t | frequency ) | [virtual] |
Setting the frequency of PWM.
The frequency controls directly the speed of the device.
- Parameters:
-
frequency the frequency of PWM.
- Return values:
-
None.
Definition at line 812 of file powerstep01_class.h.
| virtual void StepClockStop | ( | void | ) | [virtual] |
Stopping the PWM.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 827 of file powerstep01_class.h.
| virtual void WaitWhileActive | ( | void | ) | [virtual] |
Waiting while the motor is active.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 442 of file powerstep01_class.h.
| Status_t Write | ( | uint8_t * | pBuffer, |
| uint16_t | NumBytesToWrite | ||
| ) | [protected] |
Utility function to write data to Powerstep01.
- Parameters:
-
pBuffer pointer to the buffer of data to send. NumBytesToWrite number of bytes to write.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 1320 of file powerstep01_class.h.
Generated on Wed Jul 13 2022 08:47:39 by
1.7.2
