Expansion SW library to control a bipolar stepper motor using X-NUCLEO-IHM05A1 expansion board based on L6208.
Dependencies: ST_INTERFACES
Dependents: HelloWorld_IHM05A1 TAU_ROTATING_PLATFORM_IHM05A1 Amaldi_13_Exercise_IHM05A1 Amaldi_13_Exercise_IHM05A1motore ... more
Fork of X-NUCLEO-IHM05A1 by
L6208 Class Reference
Class representing a L6208 component. More...
#include <L6208.h>
Public Member Functions | |
L6208 (PinName flag_and_enable_pin, PinName reset_pin, PinName direction_pin, PinName half_full_pin, PinName control_pin, PinName clock_pin, PinName vrefA_pwm_pin, PinName vrefB_pwm_pin) | |
Constructor. | |
virtual | ~L6208 (void) |
Destructor. | |
virtual int | init (void *init=NULL) |
Public functions inherited from the Component Class. | |
virtual int | read_id (uint8_t *id=NULL) |
Getting the ID of the component. | |
virtual unsigned int | get_status (void) |
Public functions inherited from the StepperMotor Class. | |
virtual signed int | get_position (void) |
Getting the position. | |
virtual signed int | get_mark (void) |
Getting the marked position. | |
virtual unsigned int | get_speed (void) |
Getting the current speed in pps. | |
virtual unsigned int | get_max_speed (void) |
Getting the maximum speed in pps. | |
virtual unsigned int | get_min_speed (void) |
Getting the minimum speed in pps. | |
virtual unsigned int | get_acceleration (void) |
Getting the acceleration in pps^2. | |
virtual unsigned int | get_deceleration (void) |
Getting the deceleration in pps^2. | |
virtual direction_t | get_direction (void) |
Getting the direction of rotation. | |
virtual void | set_home (void) |
Setting the current position to be the home position. | |
virtual void | set_mark (void) |
Setting the current position to be the marked position. | |
virtual bool | set_max_speed (unsigned int speed) |
Setting the maximum speed in pps. | |
virtual bool | set_min_speed (unsigned int speed) |
Setting the minimum speed in pps. | |
virtual bool | set_acceleration (unsigned int acceleration) |
Setting the acceleration in pps^2. | |
virtual bool | set_deceleration (unsigned int deceleration) |
Setting the deceleration in pps^2. | |
virtual bool | set_step_mode (step_mode_t step_mode) |
Setting the Step Mode. | |
virtual void | go_to (signed int position) |
Going to a specified position. | |
virtual void | go_home (void) |
Going to the home position. | |
virtual void | go_mark (void) |
Going to the marked position. | |
virtual void | run (direction_t direction) |
Running the motor towards a specified direction. | |
virtual void | move (direction_t direction, unsigned int steps) |
Moving the motor towards a specified direction for a certain number of steps. | |
virtual void | soft_stop (void) |
Stopping the motor through an immediate deceleration up to zero speed. | |
virtual void | hard_stop (void) |
Stopping the motor through an immediate infinite deceleration. | |
virtual void | soft_hiz (void) |
Disabling the power bridge after performing a deceleration to zero. | |
virtual void | hard_hiz (void) |
Disabling the power bridge immediately. | |
virtual void | wait_while_active (void) |
Waiting while the motor is active. | |
virtual void | attach_error_handler (void(*fptr)(uint16_t error)) |
Public functions NOT inherited. | |
virtual unsigned int | check_status_hw (void) |
Checks if the device is disabled or/and has an alarm flag set by reading the EN pin position. | |
virtual void | disable (void) |
Disabling the device. | |
virtual void | enable (void) |
Enabling the device. | |
virtual motorDecayMode_t | get_decay_mode () |
Getting the motor decay mode. | |
virtual uint32_t | get_freq_vref_pwm (void) |
Set the frequency of the VREFA and VREFB PWM. | |
virtual unsigned int | get_fw_version (void) |
Getting the version of the firmware. | |
virtual step_mode_t | get_step_mode (void) |
Getting the motor step mode. | |
virtual motorStopMode_t | get_stop_mode (void) |
Getting the motor stop mode. | |
virtual void | go_to (direction_t direction, signed int position) |
Going to a specified position with a specificied direction. | |
virtual void | release_reset (void) |
Release the L6208 reset (Reset pin set to high level). | |
virtual void | reset (void) |
Reset the device with current step mode, resets current speed, positions and microstep variables. | |
virtual void | reset_device (void) |
Reset the L6208 (Reset pin set to low level). | |
virtual void | set_decay_mode (motorDecayMode_t decayMode) |
Set the motor decay mode. | |
virtual void | set_direction (direction_t direction) |
Set the motor direction. | |
virtual void | set_freq_vref_pwm (uint32_t frequency) |
Set the frequency of the VREFA and VREFB PWM. | |
virtual void | set_stop_mode (motorStopMode_t stopMode) |
Set the motor stop mode. | |
void | attach_flag_irq (void(*fptr)(void)) |
Attaching an interrupt handler to the FLAG interrupt. | |
void | enable_flag_irq (void) |
Enabling the FLAG interrupt handling. | |
Protected Member Functions | |
status_t | L6208_Init (void *init) |
Start the L6208 library. | |
void | L6208_Disable (void) |
Disable the power bridges (leave the output bridges HiZ) | |
void | L6208_ErrorHandler (uint16_t error) |
Error handler which calls the user callback (if defined) | |
void | L6208_Enable (void) |
Enable the power bridges. | |
uint16_t | L6208_GetAcceleration (void) |
Get the stepper acceleration rate in step/s^2 for full, half and wave modes in microsteps/s^2 for microstep modes. | |
uint16_t | L6208_GetCurrentSpeed (void) |
Get the current speed in step/s for full, half and wave modes in microsteps/s for microstep modes. | |
uint16_t | L6208_GetDeceleration (void) |
Get the stepper deceleration rate in step/s^2 for full, half and wave modes in microsteps/s^2 for microstep modes. | |
motorDecayMode_t | L6208_get_decay_mode (void) |
Get the motor decay mode. | |
motorDir_t | L6208_GetDirection (void) |
Get the motor current direction. | |
uint32_t | L6208_GetFwVersion (void) |
Return the FW version. | |
int32_t | L6208_GetMark (void) |
Get the mark position (32b signed) | |
uint16_t | L6208_GetMaxSpeed (void) |
Get the max speed in step/s for full, half and wave modes in microsteps/s for microstep modes. | |
uint16_t | L6208_GetMinSpeed (void) |
Get the min speed in step/s for full, half and wave modes in microsteps/s for microstep modes. | |
motorState_t | L6208_GetMotionState (void) |
Get the stepper state machine index. | |
int32_t | L6208_GetPosition (void) |
Get the current position (32b signed) | |
motorStepMode_t | L6208_GetStepMode (void) |
Get the motor step mode. | |
motorStopMode_t | L6208_GetStopMode (void) |
Get the selected stop mode. | |
void | L6208_GoHome (void) |
Go to the home position. | |
void | L6208_GoMark (void) |
Go to the Mark position. | |
void | L6208_GoTo (int32_t targetPosition) |
move the motor to the absolute position using the shortest path | |
void | L6208_GoToDir (motorDir_t direction, int32_t targetPosition) |
move the motor to the absolute position | |
void | L6208_HardHiZ (void) |
Immediately stop the motor and disables the power bridges. | |
void | L6208_HardStop (void) |
Immediately stop the motor and keeps holding torque. | |
void | L6208_Move (motorDir_t direction, uint32_t stepCount) |
move the motor by the specified number of steps in the specified direction | |
void | L6208_ReleaseReset (void) |
Release the L6208 reset (Reset pin set to high level) | |
void | L6208_Reset (void) |
Reset the L6208 (Reset pin set to low level) | |
void | L6208_ResetDevice (void) |
Call L6208_SetStepMode with current step mode, the L6208_SetStepMode function along with setting the step mode resets the L6208 device. | |
void | L6208_Run (motorDir_t direction) |
run the motor in the specified direction according to the speed profile defined by the minimum speed, maximum speed, and acceleration parameters. | |
bool | L6208_SetAcceleration (uint16_t newAcc) |
Set the stepper acceleration rate in step/s^2 and step/tick^2 for full, half and wave modes in microsteps/s^2 and microsteps/tick^2 for microstep modes. | |
void | L6208_SetDecayMode (motorDecayMode_t decayMode) |
Select the motor decay mode. | |
bool | L6208_SetDeceleration (uint16_t newDec) |
Set the stepper deceleration rate in step/s^2 and step/tick^2 for full, half and wave modes in microsteps/s^2 and microsteps/tick^2 for microstep modes. | |
void | L6208_SetDirection (motorDir_t direction) |
Specify the direction. | |
void | L6208_SetHome (void) |
Set current position to be the home position. | |
void | L6208_SetMark (void) |
Set current position to be the mark position. | |
bool | L6208_SetMaxSpeed (uint16_t volatile newSpeed) |
Set the user selected maximum speed in step/s and step/tick for full, half and wave modes in microsteps/s and microsteps/tick for microstep modes. | |
bool | L6208_SetMinSpeed (uint16_t volatile newSpeed) |
Set the user selected minimum speed in step/s and step/tick for full, half and wave modes in microsteps/s and microsteps/tick for microstep modes. | |
bool | L6208_SetStepMode (motorStepMode_t stepMode) |
Set the step mode. | |
void | L6208_SetStopMode (motorStopMode_t stopMode) |
Select the mode to stop the motor. | |
bool | L6208_SoftStop (void) |
Stop the motor by using the device deceleration and set deceleration torque. | |
void | L6208_TickHandler (void) |
Handle the device state machine at each tick timer pulse end. | |
uint32_t | L6208_VrefPwmGetFreq (void) |
Get the frequency of VREFA and VREFB PWM. | |
void | L6208_VrefPwmSetFreq (uint32_t newFreq) |
Set the frequency of the VREFA and VREFB PWM. | |
void | L6208_WaitWhileActive (void) |
Lock while motor is running. | |
void | L6208_ClearSysFlag (uint32_t mask) |
Clear the bit/s of flags according to the specified mask. | |
uint32_t | L6208_ComputeNbAccOrDecSteps (uint16_t accOrDecRate) |
Compute the number of steps at the end of the accereration/deceleration phase P = position in steps at the end of the acceleration/deceleration phase T = acceleration/deceleration time in seconds A = acceleration/deceleration rate in steps per second per second (steps/sec^2) V = peak velocity during acceleration/deceleration phase V1 = average velocity during acceleration/deceleration phase T = V/A V1 = V/2 P = V1*T P = V^2/2A. | |
uint16_t | L6208_ConvertAcceDecelRateValue (uint16_t newAccOrDecRate) |
Compute the acceleration/deceleration speed increment value. | |
void | L6208_DoAccel (void) |
Compute next position and speed according to the acceleration rate. | |
void | L6208_DoDecel (void) |
Compute next position and speed according to the deceleration rate. | |
void | L6208_DoRun (void) |
Compute next position by adding current speed. | |
uint8_t | L6208_GetMicrostepSample2Scale (void) |
Get number of samples to rescale. | |
void | L6208_Indexmodeinit (void) |
Initialize the system for position mode motor moving command P = total move distance in steps P1 = steps required to accel from 0 to V P2 = steps required to decel from V to 0 V = peak velocity in steps per second (steps/sec) V1 = average velocity during accel or decel* A = required accel rate in steps per second per second (steps/sec2) D = required decel rate in steps per second per second (steps/sec2) T1 = acceleration time in seconds T2 = deceleration time in seconds*. | |
bool | L6208_IsSysFlag (uint32_t mask) |
Check the bit/s of flags according to the specified mask. | |
void | L6208_ResetSteps (void) |
Stepper driver device step state reset subroutine. | |
uint32_t | L6208_ScaleWaveformSample (uint8_t sampleIndex) |
Compute the specified micro stepping waveform sample with the current selected torque and pwm period. | |
void | L6208_ScaleWaveformTable (void) |
Compute the micro stepping waveform sample table samples with the current selected torque and pwm period. | |
void | L6208_SetDeviceParamsToGivenValues (l6208_init_t *pInitDevicePrm) |
Set the parameters of the device to values of the structure pointed by pInitDevicePrm. | |
void | L6208_SetDeviceParamsToPredefinedValues (void) |
Set the parameters of the device to predefined values Set GPIO according to these values from l6208_target_config.h. | |
void | L6208_SetMicrostepSample2Scale (uint8_t value) |
Set the number of micro stepping waveform samples to rescale. | |
void | L6208_SetMicrostepSample2Update (uint8_t value) |
Set the number of micro stepping waveform samples to update into scanning. | |
void | L6208_SetMotionState (motorState_t newMotionState) |
Set the stepper state machine index. | |
bool | L6208_SetSpeed (uint16_t newSpeed, uint32_t volatile *pSpeed) |
Set the user selected speed in step/tick. | |
void | L6208_SetSysFlag (uint32_t mask) |
Set the bit/s of flags according to the specified mask. | |
bool | L6208_StartMovement (void) |
Stepper motor start command. | |
void | L6208_UpdateScanWaveformTable (void) |
Update the micro stepping waveform samples table with the values previously scaled with current selected torque and tick period. | |
void | L6208_UstepWaveformHandling (void) |
Check if there are waveform samples to rescale and if so, perform the rescaling. | |
bool | L6208_VectorCalc (uint8_t newTorque) |
Set the current torque value (Vref) | |
bool | L6208_VrefPwmComputePulseWidth (uint8_t bridgeId, uint16_t value, bool valueIsPwmDutyCycle) |
Compute the pulse width of VREFA or VREFB PWM. | |
void | L6208_VrefPwmUpdatePulseWidth (void) |
Update the pulse width of VREFA or VREFB PWM. | |
void | L6208_Board_CLOCK_PIN_Reset (void) |
Reset the clock pin. | |
void | L6208_Board_CLOCK_PIN_Set (void) |
Set the clock pin. | |
void | L6208_Board_CONTROL_PIN_Set (void) |
Set the control pin. | |
void | L6208_Board_CONTROL_PIN_Reset (void) |
Reset the control pin. | |
void | L6208_Board_Delay (uint32_t delay) |
Making the CPU wait. | |
void | L6208_Board_DIR_PIN_Reset (void) |
Reset the dir pin. | |
void | L6208_Board_DIR_PIN_Set (void) |
Set the dir pin. | |
void | L6208_Board_Disable (void) |
Disable the power bridges (leave the output bridges HiZ). | |
void | L6208_Board_DisableIrq (void) |
Disabling interrupts. | |
void | L6208_Board_Enable (void) |
Enable the power bridges (leave the output bridges HiZ). | |
void | L6208_Board_EnableIrq (void) |
Enabling interrupts. | |
void | L6208_Board_HALF_FULL_PIN_Reset (void) |
Reset the half full pin. | |
void | L6208_Board_HALF_FULL_PIN_Set (void) |
Set the half full pin. | |
void | L6208_Board_VrefPwmInit (uint8_t bridgeId, uint32_t pwmFreq) |
Initialising the the VREFA or VREFB PWM. | |
void | L6208_Board_ReleaseReset (void) |
Exit the device from reset mode. | |
void | L6208_Board_Reset (void) |
Put the device in reset mode. | |
uint32_t | L6208_Board_TickGetFreq (void) |
Get the tick timer frequency in Hz. | |
void | L6208_Board_TickInit (void) |
Initialising the tick. | |
void | L6208_Board_TickStart (uint16_t frequency) |
Starting the tick timer, setting its frequency and attaching a tick handler function to it. | |
void | L6208_Board_TickStop (void) |
Stopping the tick. | |
void | L6208_Board_VrefPwmSetPulseWidthA (uint8_t pulseWidthInUs) |
Set the pulse width of the VREFA PWM. | |
void | L6208_Board_VrefPwmSetPulseWidthB (uint8_t pulseWidthInUs) |
Set the pulse width of the VREFB PWM. | |
bool | L6208_Board_VrefPwmStart (uint8_t bridgeId, uint16_t pwmPeriod) |
Start the timer for the VREFA or VREFB PWM. | |
bool | L6208_Board_VrefPwmStop (uint8_t bridgeId) |
Stop the timer for the VREFA or VREFB PWM. | |
Protected Attributes | |
uint16_t | updatedMicroTable [L6208_USTEPS_PER_QUARTER_PERIOD+1] |
microstepping PWM period and torque scaled waveform samples array | |
uint16_t | microTable1 [L6208_USTEPS_PER_QUARTER_PERIOD *3+1] |
waveform scanning microstepping PWM period sample arrays for VREFA wave | |
uint16_t * | pMicroTable2 |
waveform scanning microstepping PWM period sample array for VREFB wave | |
Static Protected Attributes | |
static const uint16_t | RefMicroTable [L6208_USTEPS_PER_QUARTER_PERIOD *3] |
RefMicroTable values are 2^L6208_SINE_WAVEFORM_POWER_OF_TWO_MAX_VALUE*|sin(n/16*PI/2)| where n is the index in the table. |
Detailed Description
Class representing a L6208 component.
Definition at line 72 of file L6208.h.
Constructor & Destructor Documentation
L6208 | ( | PinName | flag_and_enable_pin, |
PinName | reset_pin, | ||
PinName | direction_pin, | ||
PinName | half_full_pin, | ||
PinName | control_pin, | ||
PinName | clock_pin, | ||
PinName | vrefA_pwm_pin, | ||
PinName | vrefB_pwm_pin | ||
) |
Constructor.
- Parameters:
-
flag_and_enable_pin pin name of the EN pin of the component. reset_pin pin name of the RESET pin of the component. direction_pin pin name of the CW_CCW pin of the component. half_full_pin pin name of the HALF_FULL pin of the component. control_pin pin name of the CONTROL pin of the component. clock_pin pin name of the CLOCK pin of the component. vrefA_pwm_pin pin name of the PWM connected to the VREFA pin of the component. vrefB_pwm_pin pin name of the PWM connected to the VREFB pin of the component.
Member Function Documentation
virtual void attach_error_handler | ( | void(*)(uint16_t error) | fptr ) | [virtual] |
void attach_flag_irq | ( | void(*)(void) | fptr ) |
virtual unsigned int check_status_hw | ( | void | ) | [virtual] |
virtual void disable | ( | void | ) | [virtual] |
virtual void enable | ( | void | ) | [virtual] |
void enable_flag_irq | ( | void | ) |
virtual unsigned int get_acceleration | ( | void | ) | [virtual] |
virtual motorDecayMode_t get_decay_mode | ( | ) | [virtual] |
virtual unsigned int get_deceleration | ( | void | ) | [virtual] |
virtual direction_t get_direction | ( | void | ) | [virtual] |
virtual uint32_t get_freq_vref_pwm | ( | void | ) | [virtual] |
virtual unsigned int get_fw_version | ( | void | ) | [virtual] |
virtual signed int get_mark | ( | void | ) | [virtual] |
virtual unsigned int get_max_speed | ( | void | ) | [virtual] |
virtual unsigned int get_min_speed | ( | void | ) | [virtual] |
virtual signed int get_position | ( | void | ) | [virtual] |
virtual unsigned int get_speed | ( | void | ) | [virtual] |
virtual unsigned int get_status | ( | void | ) | [virtual] |
virtual step_mode_t get_step_mode | ( | void | ) | [virtual] |
virtual motorStopMode_t get_stop_mode | ( | void | ) | [virtual] |
virtual void go_home | ( | void | ) | [virtual] |
virtual void go_mark | ( | void | ) | [virtual] |
virtual void go_to | ( | signed int | position ) | [virtual] |
virtual void go_to | ( | direction_t | direction, |
signed int | position | ||
) | [virtual] |
virtual void hard_hiz | ( | void | ) | [virtual] |
virtual void hard_stop | ( | void | ) | [virtual] |
virtual int init | ( | void * | init = NULL ) |
[virtual] |
void L6208_Board_CLOCK_PIN_Reset | ( | void | ) | [protected] |
void L6208_Board_CLOCK_PIN_Set | ( | void | ) | [protected] |
void L6208_Board_CONTROL_PIN_Reset | ( | void | ) | [protected] |
void L6208_Board_CONTROL_PIN_Set | ( | void | ) | [protected] |
void L6208_Board_Delay | ( | uint32_t | delay ) | [protected] |
void L6208_Board_DIR_PIN_Reset | ( | void | ) | [protected] |
void L6208_Board_DIR_PIN_Set | ( | void | ) | [protected] |
void L6208_Board_Disable | ( | void | ) | [protected] |
void L6208_Board_DisableIrq | ( | void | ) | [protected] |
void L6208_Board_Enable | ( | void | ) | [protected] |
void L6208_Board_EnableIrq | ( | void | ) | [protected] |
void L6208_Board_HALF_FULL_PIN_Reset | ( | void | ) | [protected] |
void L6208_Board_HALF_FULL_PIN_Set | ( | void | ) | [protected] |
void L6208_Board_ReleaseReset | ( | void | ) | [protected] |
void L6208_Board_Reset | ( | void | ) | [protected] |
uint32_t L6208_Board_TickGetFreq | ( | void | ) | [protected] |
void L6208_Board_TickInit | ( | void | ) | [protected] |
void L6208_Board_TickStart | ( | uint16_t | frequency ) | [protected] |
void L6208_Board_TickStop | ( | void | ) | [protected] |
void L6208_Board_VrefPwmInit | ( | uint8_t | bridgeId, |
uint32_t | pwmFreq | ||
) | [protected] |
void L6208_Board_VrefPwmSetPulseWidthA | ( | uint8_t | pulseWidthInUs ) | [protected] |
void L6208_Board_VrefPwmSetPulseWidthB | ( | uint8_t | pulseWidthInUs ) | [protected] |
bool L6208_Board_VrefPwmStart | ( | uint8_t | bridgeId, |
uint16_t | pwmPeriod | ||
) | [protected] |
Start the timer for the VREFA or VREFB PWM.
- Parameters:
-
[in] bridgeId 0 for BRIDGE_A 1 for BRIDGE_B [in] pwmPeriod period of the PWM used to generate the reference voltage for the bridge.
- Return values:
-
true in case of success, "false" otherwise.
- Note:
- the unit is 1/256th of a microsecond. The VREFA PWM must be started before the VREFB PWM.
bool L6208_Board_VrefPwmStop | ( | uint8_t | bridgeId ) | [protected] |
void L6208_ClearSysFlag | ( | uint32_t | mask ) | [protected] |
uint32_t L6208_ComputeNbAccOrDecSteps | ( | uint16_t | accOrDecRate ) | [protected] |
Compute the number of steps at the end of the accereration/deceleration phase P = position in steps at the end of the acceleration/deceleration phase T = acceleration/deceleration time in seconds A = acceleration/deceleration rate in steps per second per second (steps/sec^2) V = peak velocity during acceleration/deceleration phase V1 = average velocity during acceleration/deceleration phase T = V/A V1 = V/2 P = V1*T P = V^2/2A.
- Parameters:
-
accOrDecRate acceleration/deceleration rate in steps per second per second (steps/sec^2)
- Return values:
-
end position or 0xFFFFFFFF on error
uint16_t L6208_ConvertAcceDecelRateValue | ( | uint16_t | newAccOrDecRate ) | [protected] |
Compute the acceleration/deceleration speed increment value.
- Parameters:
-
[in] newAccOrDecRate acceleration or deceleration value (steps/s^2) greater or equal than 24
- Return values:
-
the speed (step/tick) increment value LSB = 2^-24 step/tick^2 or 2^-20 microstep/tick^2
- Note:
- return 0 if the rate is too low or if the tick frequency is too small or if the device is running in position mode
void L6208_Disable | ( | void | ) | [protected] |
void L6208_DoAccel | ( | void | ) | [protected] |
void L6208_DoDecel | ( | void | ) | [protected] |
void L6208_DoRun | ( | void | ) | [protected] |
void L6208_Enable | ( | void | ) | [protected] |
void L6208_ErrorHandler | ( | uint16_t | error ) | [protected] |
motorDecayMode_t L6208_get_decay_mode | ( | void | ) | [protected] |
uint16_t L6208_GetAcceleration | ( | void | ) | [protected] |
uint16_t L6208_GetCurrentSpeed | ( | void | ) | [protected] |
uint16_t L6208_GetDeceleration | ( | void | ) | [protected] |
motorDir_t L6208_GetDirection | ( | void | ) | [protected] |
uint32_t L6208_GetFwVersion | ( | void | ) | [protected] |
int32_t L6208_GetMark | ( | void | ) | [protected] |
uint16_t L6208_GetMaxSpeed | ( | void | ) | [protected] |
uint8_t L6208_GetMicrostepSample2Scale | ( | void | ) | [protected] |
uint16_t L6208_GetMinSpeed | ( | void | ) | [protected] |
motorState_t L6208_GetMotionState | ( | void | ) | [protected] |
int32_t L6208_GetPosition | ( | void | ) | [protected] |
motorStepMode_t L6208_GetStepMode | ( | void | ) | [protected] |
motorStopMode_t L6208_GetStopMode | ( | void | ) | [protected] |
void L6208_GoHome | ( | void | ) | [protected] |
void L6208_GoMark | ( | void | ) | [protected] |
void L6208_GoTo | ( | int32_t | abs_pos ) | [protected] |
move the motor to the absolute position using the shortest path
- Parameters:
-
[in] abs_pos 32 bit signed value position
- Return values:
-
None
- Note:
- The position is at the resolution corresponding to the selected step mode. STEP_MODE_FULL or STEP_MODE_WAVE : step STEP_MODE_HALF : 1/2 step STEP_MODE_1_4 : 1/4 step STEP_MODE_1_8 : 1/8 step STEP_MODE_1_16 : 1/16 step
void L6208_GoToDir | ( | motorDir_t | direction, |
int32_t | abs_pos | ||
) | [protected] |
move the motor to the absolute position
- Parameters:
-
[in] direction FORWARD or BACKWARD [in] abs_pos 32 bit signed value position
- Return values:
-
None
- Note:
- The position is at the resolution corresponding to the selected step mode. STEP_MODE_FULL or STEP_MODE_WAVE : step STEP_MODE_HALF : 1/2 step STEP_MODE_1_4 : 1/4 step STEP_MODE_1_8 : 1/8 step STEP_MODE_1_16 : 1/16 step
void L6208_HardHiZ | ( | void | ) | [protected] |
void L6208_HardStop | ( | void | ) | [protected] |
void L6208_Indexmodeinit | ( | void | ) | [protected] |
Initialize the system for position mode motor moving command P = total move distance in steps P1 = steps required to accel from 0 to V P2 = steps required to decel from V to 0 V = peak velocity in steps per second (steps/sec) V1 = average velocity during accel or decel* A = required accel rate in steps per second per second (steps/sec2) D = required decel rate in steps per second per second (steps/sec2) T1 = acceleration time in seconds T2 = deceleration time in seconds*.
1) T1 = V / A 2) V1 = V / 2 3) P1 = V1 T1 Substituting 1 and 2 into 3 yields: 4) P1 = V2 / 2A In the same manner we have: 5) P2 = V2 / 2D
P1 = PD/(D+A)
- See also:
- Application Note: AN2044
- Return values:
-
None
status_t L6208_Init | ( | void * | pInit ) | [protected] |
bool L6208_IsSysFlag | ( | uint32_t | mask ) | [protected] |
void L6208_Move | ( | motorDir_t | direction, |
uint32_t | stepCount | ||
) | [protected] |
move the motor by the specified number of steps in the specified direction
- Parameters:
-
[in] direction FORWARD or BACKWARD [in] stepCount 32 bit unsigned step count
- Return values:
-
None
- Note:
- The step count resolution is corresponding to the selected step mode. STEP_MODE_FULL or STEP_MODE_WAVE : step STEP_MODE_HALF : 1/2 step STEP_MODE_1_4 : 1/4 step STEP_MODE_1_8 : 1/8 step STEP_MODE_1_16 : 1/16 step
void L6208_ReleaseReset | ( | void | ) | [protected] |
void L6208_Reset | ( | void | ) | [protected] |
void L6208_ResetDevice | ( | void | ) | [protected] |
void L6208_ResetSteps | ( | void | ) | [protected] |
void L6208_Run | ( | motorDir_t | direction ) | [protected] |
run the motor in the specified direction according to the speed profile defined by the minimum speed, maximum speed, and acceleration parameters.
The device accelerates from the minimum speed up to the maximum speed by using the device acceleration.
- Parameters:
-
[in] direction FORWARD or BACKWARD
- Return values:
-
None
uint32_t L6208_ScaleWaveformSample | ( | uint8_t | sampleIndex ) | [protected] |
void L6208_ScaleWaveformTable | ( | void | ) | [protected] |
bool L6208_SetAcceleration | ( | uint16_t | newAcc ) | [protected] |
void L6208_SetDecayMode | ( | motorDecayMode_t | decayMode ) | [protected] |
bool L6208_SetDeceleration | ( | uint16_t | newDec ) | [protected] |
void L6208_SetDeviceParamsToGivenValues | ( | l6208_init_t * | pInitDevicePrm ) | [protected] |
void L6208_SetDeviceParamsToPredefinedValues | ( | void | ) | [protected] |
void L6208_SetDirection | ( | motorDir_t | dir ) | [protected] |
Specify the direction.
- Parameters:
-
[in] dir FORWARD or BACKWARD
- Note:
- In velocity mode a direction change forces the device to stop and then run in the new direction. In position mode, if the device is running, a direction change will generate an error.
- Return values:
-
None
void L6208_SetHome | ( | void | ) | [protected] |
void L6208_SetMark | ( | void | ) | [protected] |
bool L6208_SetMaxSpeed | ( | uint16_t volatile | newSpeed ) | [protected] |
Set the user selected maximum speed in step/s and step/tick for full, half and wave modes in microsteps/s and microsteps/tick for microstep modes.
- Parameters:
-
[in] newSpeed speed value (step/s or microstep/s)
- Return values:
-
TRUE
- Note:
- One microstep is 1/16 step
void L6208_SetMicrostepSample2Scale | ( | uint8_t | value ) | [protected] |
void L6208_SetMicrostepSample2Update | ( | uint8_t | value ) | [protected] |
bool L6208_SetMinSpeed | ( | uint16_t volatile | newSpeed ) | [protected] |
Set the user selected minimum speed in step/s and step/tick for full, half and wave modes in microsteps/s and microsteps/tick for microstep modes.
- Parameters:
-
[in] newSpeed speed value (step/s or microstep/s)
- Return values:
-
TRUE
- Note:
- One microstep is 1/16 step
void L6208_SetMotionState | ( | motorState_t | newMotionState ) | [protected] |
bool L6208_SetSpeed | ( | uint16_t | newSpeed, |
uint32_t volatile * | pSpeed | ||
) | [protected] |
bool L6208_SetStepMode | ( | motorStepMode_t | stepMode ) | [protected] |
void L6208_SetStopMode | ( | motorStopMode_t | stopMode ) | [protected] |
void L6208_SetSysFlag | ( | uint32_t | mask ) | [protected] |
bool L6208_SoftStop | ( | void | ) | [protected] |
bool L6208_StartMovement | ( | void | ) | [protected] |
void L6208_TickHandler | ( | void | ) | [protected] |
void L6208_UpdateScanWaveformTable | ( | void | ) | [protected] |
void L6208_UstepWaveformHandling | ( | void | ) | [protected] |
bool L6208_VectorCalc | ( | uint8_t | newTorque ) | [protected] |
bool L6208_VrefPwmComputePulseWidth | ( | uint8_t | bridgeId, |
uint16_t | value, | ||
bool | valueIsPwmDutyCycle | ||
) | [protected] |
Compute the pulse width of VREFA or VREFB PWM.
- Parameters:
-
[in] bridgeId 0 for BRIDGE_A 1 for BRIDGE_B [in] value pulse length in 1/256th of microsecond or PWM duty cycle: 0 - 100 % [in] valueIsPwmDutyCycle must be TRUE if value is a PWM duty cycle
- Return values:
-
FALSE if wrong timer handle is used, else TRUE
uint32_t L6208_VrefPwmGetFreq | ( | void | ) | [protected] |
void L6208_VrefPwmSetFreq | ( | uint32_t | newFreq ) | [protected] |
void L6208_VrefPwmUpdatePulseWidth | ( | void | ) | [protected] |
void L6208_WaitWhileActive | ( | void | ) | [protected] |
virtual void move | ( | direction_t | direction, |
unsigned int | steps | ||
) | [virtual] |
virtual int read_id | ( | uint8_t * | id = NULL ) |
[virtual] |
virtual void release_reset | ( | void | ) | [virtual] |
virtual void reset | ( | void | ) | [virtual] |
virtual void reset_device | ( | void | ) | [virtual] |
virtual void run | ( | direction_t | direction ) | [virtual] |
virtual bool set_acceleration | ( | unsigned int | acceleration ) | [virtual] |
virtual void set_decay_mode | ( | motorDecayMode_t | decayMode ) | [virtual] |
virtual bool set_deceleration | ( | unsigned int | deceleration ) | [virtual] |
virtual void set_direction | ( | direction_t | direction ) | [virtual] |
virtual void set_freq_vref_pwm | ( | uint32_t | frequency ) | [virtual] |
virtual void set_home | ( | void | ) | [virtual] |
virtual void set_mark | ( | void | ) | [virtual] |
virtual bool set_max_speed | ( | unsigned int | speed ) | [virtual] |
virtual bool set_min_speed | ( | unsigned int | speed ) | [virtual] |
virtual bool set_step_mode | ( | step_mode_t | step_mode ) | [virtual] |
Setting the Step Mode.
- Parameters:
-
step_mode The Step Mode.
- Return values:
-
true in case of success, "false" otherwise.
- Note:
- step_mode can be one of the following: + STEP_MODE_FULL + STEP_MODE_WAVE + STEP_MODE_HALF + STEP_MODE_1_4 + STEP_MODE_1_8 + STEP_MODE_1_16
virtual void set_stop_mode | ( | motorStopMode_t | stopMode ) | [virtual] |
virtual void soft_hiz | ( | void | ) | [virtual] |
virtual void soft_stop | ( | void | ) | [virtual] |
virtual void wait_while_active | ( | void | ) | [virtual] |
Field Documentation
uint16_t microTable1[L6208_USTEPS_PER_QUARTER_PERIOD *3+1] [protected] |
uint16_t* pMicroTable2 [protected] |
const uint16_t RefMicroTable [static, protected] |
{ 0,3212,6393,9512,12540,15447,18205,20788,23170,25330,27246,28899,30274,31357,32138,32610, 32768,32610,32138,31357,30274,28899,27246,25330,23170,20788,18205,15447,12540,9512,6393,3212, 0,3212,6393,9512,12540,15447,18205,20788,23170,25330,27246,28899,30274,31357,32138,32610 }
RefMicroTable values are 2^L6208_SINE_WAVEFORM_POWER_OF_TWO_MAX_VALUE*|sin(n/16*PI/2)| where n is the index in the table.
uint16_t updatedMicroTable[L6208_USTEPS_PER_QUARTER_PERIOD+1] [protected] |
Generated on Thu Jul 14 2022 21:58:52 by 1.7.2