Davide Aliprandi / X_NUCLEO_IHM03A1

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_IHM03A1 by ST

Embed: (wiki syntax)

« Back to documentation index

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_irqpin name of the FLAG pin of the component.
busy_irqpin name of the BUSY pin of the component.
standby_resetpin name of the STBY pin of the component.
pwmpin name of the PWM pin of the component.
sselpin name of the SSEL pin of the SPI device to be used for communication.
spiSPI 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:
fptrAn 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:
fptrAn 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:
fptrAn 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:
Oneif 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:
Oneif 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:
Theacceleration 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:
parameterA parameter's register adress.
Return values:
Theparameter'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:
Thedeceleration 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:
Thedirection 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:
Lastfetched 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:
Theversion 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:
Themarked 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:
Themaximum 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:
Theminimum 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:
Theposition.

Definition at line 180 of file powerstep01_class.h.

virtual unsigned int GetRawParameter ( unsigned int  parameter ) [virtual]

Getting a parameter register value.

Parameters:
parameterA parameter's register adress.
Return values:
Theparameter'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:
Thecurrent 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:
positionThe 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:
actiontype of action to undertake when the SW input is forced high (ACTION_RESET or ACTION_COPY).
directionThe direction of rotation.
speedin steps/s.
Return values:
Oneif 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:
initPointer to device specific initalization structure.
Return values:
0in 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:
trueif 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:
directionThe direction of rotation.
stepsThe 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:
pByteToTransmitpointer to the buffer of data to send.
[out]pReceivedBytepointer to the buffer to read data into.
Return values:
0in 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]directionmovement direction
[in]abs_posabsolute 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]actionACTION_RESET or ACTION_COPY
[in]directionmovement direction
[in]speedin 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]actiontype of action to undertake when the SW input is forced high
[in]directionmovement 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]directionMovement 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:
Lastfetched 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]commandCommand to queue (all Powerstep01 commmands except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, POWERSTEP01_GET_STATUS)
[in]valueargument 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:
commandCommand to queue (all Powerstep01 commmands except POWERSTEP01_SET_PARAM, POWERSTEP01_GET_PARAM, POWERSTEP01_GET_STATUS).
valueargument 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]pBufferpointer to the buffer to read data into.
NumBytesToReadnumber of bytes to read.
Return values:
COMPONENT_OKin 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:
idPointer to an allocated variable to store the ID into.
Return values:
0in 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]pBufferToReadpointer to the buffer to read data into.
pBufferToWritepointer to the buffer of data to send.
NumBytesnumber of bytes to read and write.
Return values:
COMPONENT_OKin 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:
actiontype of action to undertake when the SW input is forced high (ACTION_RESET or ACTION_COPY).
directionThe direction of rotation.
speedin steps/s.
Return values:
Oneif 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:
fThe floating point number.
Return values:
Thenearest 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:
directionThe direction of rotation.
speedin 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:
directionThe 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:
accelerationThe 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:
paramRegister adress.
valueFloat value to convert and set into the register.
Return values:
TRUEif 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:
decelerationThe 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:
speedThe maximum speed in steps/s.
Return values:
TRUEif 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:
speedThe minimum speed in steps/s.
Return values:
TRUEif 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:
parameterA parameter's register adress.
valueThe 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_modeThe 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:
frequencythe 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:
frequencythe 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:
pBufferpointer to the buffer of data to send.
NumBytesToWritenumber of bytes to write.
Return values:
COMPONENT_OKin case of success, COMPONENT_ERROR otherwise.

Definition at line 1320 of file powerstep01_class.h.