Expansion SW library to control high power stepper motor(s) using IHM03A1 expansion board(s) with Powerstep01 driver.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: IHM03A1_ExampleFor1Motor HelloWorld_IHM03A1 IHM03A1_ExampleFor3Motors KYPHOS_Stepper_Motor_Control
Fork of X_NUCLEO_IHM03A1 by
PowerStep01 Class Reference
Class representing a Powerstep01 component. More...
#include <PowerStep01.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 | 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 step/s. | |
virtual unsigned int | get_max_speed (void) |
Getting the maximum speed in step/s. | |
virtual unsigned int | get_min_speed (void) |
Getting the minimum speed in step/s. | |
virtual unsigned int | get_acceleration (void) |
Getting the acceleration in step/s^2. | |
virtual unsigned int | get_deceleration (void) |
Getting the deceleration in step/s^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 steps/s. | |
virtual bool | set_min_speed (unsigned int speed) |
Setting the minimum speed in steps/s. | |
virtual bool | set_acceleration (unsigned int acceleration) |
Setting the acceleration in steps/s^2. | |
virtual bool | set_deceleration (unsigned int deceleration) |
Setting the deceleration in steps/s^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 int | check_busy_hw (void) |
Checks if the device is busy by reading the busy pin position. | |
virtual unsigned int | check_status_hw (void) |
Checks if the device has an alarm flag set by reading the flag pin position. | |
virtual void | fetch_and_clear_all_status (void) |
Fetch and clear status flags of all devices by issuing a GET_STATUS command simultaneously to all devices. | |
virtual float | get_analog_value (unsigned int parameter) |
Getting a parameter float value. | |
virtual uint16_t | get_fetched_status (void) |
Get the value of the STATUS register which was fetched by using Powerstep01_FetchAndClearAllStatus. | |
virtual unsigned int | get_fw_version (void) |
Getting the version of the firmware. | |
virtual unsigned int | get_raw_parameter (unsigned int parameter) |
Getting a parameter register value. | |
virtual void | go_until (motorAction_t action, direction_t direction, float speed) |
Issues PowerStep01 Go Until command. | |
virtual bool | is_device_busy (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 | queue_commands (uint8_t command, int32_t value) |
Put commands in queue before synchronous sending done by calling send_queued_commands. | |
virtual uint16_t | read_status_register (void) |
Reading the Status Register. | |
virtual void | release_sw (motorAction_t action, direction_t direction) |
Issues PowerStep01 Release SW command. | |
virtual void | reset_command (void) |
Issues PowerStep01 Reset Device command. | |
virtual void | reset_position (void) |
Issues PowerStep01 ResetPos command. | |
virtual void | run (direction_t direction, float speed) |
Running the motor towards a specified direction. | |
virtual void | send_queued_commands (void) |
Sends commands stored previously in the queue by queue_commands. | |
virtual bool | set_analog_value (unsigned int param, float value) |
Setting a parameter with an input float value. | |
virtual void | set_raw_parameter (unsigned int parameter, unsigned int value) |
Setting a parameter. | |
virtual void | step_clock_mode_enable (direction_t direction) |
Enable the step clock mode. | |
virtual void | step_clock_start (uint16_t frequency) |
Setting the frequency of PWM. | |
virtual void | step_clock_stop (void) |
Stopping the PWM. | |
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. | |
void | disable_flag_irq (void) |
Disabling the FLAG interrupt handling. | |
void | attach_busy_irq (void(*fptr)(void)) |
Attaching an interrupt handler to the BUSY interrupt. | |
void | enable_busy_irq (void) |
Enabling the BUSY interrupt handling. | |
void | disable_busy_irq (void) |
Disabling the BUSY interrupt handling. | |
Static Public Member Functions | |
static uint8_t | get_nb_devices (void) |
Public static functions. | |
static uint16_t | acc_dec_steps_s2_to_reg_val (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.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.h.
virtual ~PowerStep01 | ( | void | ) | [virtual] |
Destructor.
Definition at line 111 of file PowerStep01.h.
Member Function Documentation
static uint16_t acc_dec_steps_s2_to_reg_val | ( | float | steps_s2 ) | [static] |
To and from register parameter conversion functions.
Definition at line 859 of file PowerStep01.h.
void attach_busy_irq | ( | void(*)(void) | fptr ) |
Attaching an interrupt handler to the BUSY interrupt.
- Parameters:
-
fptr An interrupt handler.
- Return values:
-
None.
Definition at line 1190 of file PowerStep01.h.
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 457 of file PowerStep01.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 1160 of file PowerStep01.h.
virtual int check_busy_hw | ( | 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 468 of file PowerStep01.h.
virtual unsigned int check_status_hw | ( | 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 483 of file PowerStep01.h.
void disable_busy_irq | ( | void | ) |
Disabling the BUSY interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1210 of file PowerStep01.h.
void disable_flag_irq | ( | void | ) |
Disabling the FLAG interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1180 of file PowerStep01.h.
void enable_busy_irq | ( | void | ) |
Enabling the BUSY interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1200 of file PowerStep01.h.
void enable_flag_irq | ( | void | ) |
Enabling the FLAG interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1170 of file PowerStep01.h.
virtual void fetch_and_clear_all_status | ( | 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 502 of file PowerStep01.h.
virtual unsigned int get_acceleration | ( | void | ) | [virtual] |
Getting the acceleration in step/s^2.
- Parameters:
-
None.
- Return values:
-
The acceleration in step/s^2.
Definition at line 231 of file PowerStep01.h.
virtual float get_analog_value | ( | 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 536 of file PowerStep01.h.
virtual unsigned int get_deceleration | ( | void | ) | [virtual] |
Getting the deceleration in step/s^2.
- Parameters:
-
None.
- Return values:
-
The deceleration in step/s^2.
Definition at line 241 of file PowerStep01.h.
virtual direction_t get_direction | ( | void | ) | [virtual] |
Getting the direction of rotation.
- Parameters:
-
None.
- Return values:
-
The direction of rotation.
Definition at line 251 of file PowerStep01.h.
virtual uint16_t get_fetched_status | ( | 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 548 of file PowerStep01.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 558 of file PowerStep01.h.
virtual signed int get_mark | ( | void | ) | [virtual] |
Getting the marked position.
- Parameters:
-
None.
- Return values:
-
The marked position.
Definition at line 191 of file PowerStep01.h.
virtual unsigned int get_max_speed | ( | void | ) | [virtual] |
Getting the maximum speed in step/s.
- Parameters:
-
None.
- Return values:
-
The maximum speed in step/s.
Definition at line 211 of file PowerStep01.h.
virtual unsigned int get_min_speed | ( | void | ) | [virtual] |
Getting the minimum speed in step/s.
- Parameters:
-
None.
- Return values:
-
The minimum speed in step/s.
Definition at line 221 of file PowerStep01.h.
static uint8_t get_nb_devices | ( | void | ) | [static] |
Public static functions.
Definition at line 843 of file PowerStep01.h.
virtual signed int get_position | ( | void | ) | [virtual] |
Getting the position.
- Parameters:
-
None.
- Return values:
-
The position.
Definition at line 181 of file PowerStep01.h.
virtual unsigned int get_raw_parameter | ( | 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 603 of file PowerStep01.h.
virtual unsigned int get_speed | ( | void | ) | [virtual] |
Getting the current speed in step/s.
- Parameters:
-
None.
- Return values:
-
The current speed in step/s.
Definition at line 201 of file PowerStep01.h.
virtual unsigned int get_status | ( | 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 read_status_register().
Definition at line 171 of file PowerStep01.h.
virtual void go_home | ( | void | ) | [virtual] |
Going to the home position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 362 of file PowerStep01.h.
virtual void go_mark | ( | void | ) | [virtual] |
Going to the marked position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 372 of file PowerStep01.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 347 of file PowerStep01.h.
virtual void go_until | ( | 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 617 of file PowerStep01.h.
virtual void hard_hiz | ( | void | ) | [virtual] |
Disabling the power bridge immediately.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 433 of file PowerStep01.h.
virtual void hard_stop | ( | void | ) | [virtual] |
Stopping the motor through an immediate infinite deceleration.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 413 of file PowerStep01.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 146 of file PowerStep01.h.
virtual bool is_device_busy | ( | 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 630 of file PowerStep01.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 393 of file PowerStep01.h.
void Powerstep01_Board_Delay | ( | uint32_t | delay ) | [protected] |
Making the CPU wait.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1361 of file PowerStep01.h.
void Powerstep01_Board_DisableIrq | ( | void | ) | [protected] |
Disabling interrupts.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1381 of file PowerStep01.h.
void Powerstep01_Board_EnableIrq | ( | void | ) | [protected] |
Enabling interrupts.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1371 of file PowerStep01.h.
void Powerstep01_Board_ReleaseReset | ( | void | ) | [protected] |
Exit the device from reset mode.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1398 of file PowerStep01.h.
void Powerstep01_Board_reset | ( | void | ) | [protected] |
Put the device in reset mode.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1408 of file PowerStep01.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 1419 of file PowerStep01.h.
void Powerstep01_Board_StepClockInit | ( | void | ) | [protected] |
Initialising the PWM.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 1391 of file PowerStep01.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.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.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.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.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.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.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.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.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.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.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.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.cpp.
void Powerstep01_SetDeviceParamsToGivenValues | ( | powerstep01_init_u_t * | initPrm ) | [protected] |
Functions to initialize the registers.
Definition at line 630 of file PowerStep01.cpp.
virtual void queue_commands | ( | uint8_t | command, |
int32_t | value | ||
) | [virtual] |
Put commands in queue before synchronous sending done by calling send_queued_commands.
Any call to functions that use the SPI between the calls of queue_commands and send_queued_commands will corrupt the queue. A command for each device of the daisy chain must be specified before calling send_queued_commands.
- 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 649 of file PowerStep01.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 1315 of file PowerStep01.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 156 of file PowerStep01.h.
virtual uint16_t read_status_register | ( | void | ) | [virtual] |
Reading the Status Register.
- Parameters:
-
None.
- Return values:
-
None.
- Note:
- The Status Register's flags are not cleared, contrary to get_status().
Definition at line 660 of file PowerStep01.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 1344 of file PowerStep01.h.
virtual void release_sw | ( | 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 674 of file PowerStep01.h.
virtual void reset_command | ( | void | ) | [virtual] |
Issues PowerStep01 Reset Device command.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 685 of file PowerStep01.h.
virtual void reset_position | ( | void | ) | [virtual] |
Issues PowerStep01 ResetPos command.
- Parameters:
-
None.
- Return values:
-
None.
- Note:
- Same effect as set_home().
Definition at line 696 of file PowerStep01.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 1298 of file PowerStep01.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 707 of file PowerStep01.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 382 of file PowerStep01.h.
virtual void send_queued_commands | ( | void | ) | [virtual] |
Sends commands stored previously in the queue by queue_commands.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 717 of file PowerStep01.h.
virtual bool set_acceleration | ( | 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 308 of file PowerStep01.h.
virtual bool set_analog_value | ( | 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 754 of file PowerStep01.h.
virtual bool set_deceleration | ( | 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 318 of file PowerStep01.h.
virtual void set_home | ( | void | ) | [virtual] |
Setting the current position to be the home position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 268 of file PowerStep01.h.
virtual void set_mark | ( | void | ) | [virtual] |
Setting the current position to be the marked position.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 278 of file PowerStep01.h.
virtual bool set_max_speed | ( | 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 288 of file PowerStep01.h.
virtual bool set_min_speed | ( | 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 298 of file PowerStep01.h.
virtual void set_raw_parameter | ( | 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 798 of file PowerStep01.h.
virtual bool set_step_mode | ( | 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 337 of file PowerStep01.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 423 of file PowerStep01.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 403 of file PowerStep01.h.
virtual void step_clock_mode_enable | ( | direction_t | direction ) | [virtual] |
Enable the step clock mode.
- Parameters:
-
frequency the frequency of PWM.
- Return values:
-
None.
Definition at line 808 of file PowerStep01.h.
virtual void step_clock_start | ( | 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 819 of file PowerStep01.h.
virtual void step_clock_stop | ( | void | ) | [virtual] |
Stopping the PWM.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 834 of file PowerStep01.h.
virtual void wait_while_active | ( | void | ) | [virtual] |
Waiting while the motor is active.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 443 of file PowerStep01.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 1329 of file PowerStep01.h.
Generated on Thu Jul 14 2022 15:33:06 by
