ST Expansion SW Team / X_NUCLEO_IHM14A1

Dependencies:   ST_INTERFACES

Dependents:   HelloWorld_IHM14A1

Fork of X_NUCLEO_IHM14A1 by Davide Aliprandi

Embed: (wiki syntax)

« Back to documentation index

STSPIN820 Class Reference

Class representing an STSPIN820 component. More...

#include <STSPIN820.h>

Public Member Functions

 STSPIN820 (PinName en_fault_irq, PinName standby_reset, PinName direction, PinName ref_pwm, PinName decay, PinName step_clock, PinName mode1, PinName mode2, PinName mode3)
 Constructor.
virtual ~STSPIN820 (void)
 Destructor.
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.
void attach_en_fault_irq (void(*fptr)(void))
 Attaching an interrupt handler to the FLAG interrupt.
void enable_en_fault_irq (void)
 Enabling the FLAG interrupt handling.
void disable_en_fault_irq (void)
 Disabling the FLAG interrupt handling.

Protected Member Functions

void STSPIN820_Delay (uint32_t delay)
 Making the CPU wait.
void STSPIN820_Enable_Power_Bridges (void)
 Enabling the power bridges (leaving the output bridges at HiZ).
void STSPIN820_Disable_Power_Bridges (void)
 Disabling the power bridges (forcing the output bridges at HiZ).
void STSPIN820_EnableIrq (void)
 Enabling interrupts.
void STSPIN820_DisableIrq (void)
 Disabling interrupts.
uint32_t STSPIN820_EN_FAULT_PIN_GetState (void)
 Getting the state of the EN_FAULT pin.
void STSPIN820_GpioInit (void)
 Initialising the GPIOs.
void STSPIN820_PwmRefInit (void)
 Initialising the PWM.
void STSPIN820_PwmRefSetFreqAndDutyCycle (uint32_t frequency, uint8_t duty_cycle)
 Setting the frequency and the duty-cycle of PWM.
void STSPIN820_PwmRefStart (void)
 Starting the PWM.
void STSPIN820_PwmRefStop (void)
 Stopping the PWM.
void STSPIN820_ReleaseReset (void)
 Putting the device in standby mode.
void STSPIN820_Reset (void)
 Putting the device in reset mode.
void STSPIN820_SetDecayGpio (uint8_t gpio_state)
 Setting the decay mode pin state.
uint8_t STSPIN820_GetDecayGpio (void)
 Getting the decay mode pin state.
void STSPIN820_SetDirectionGpio (uint8_t gpio_state)
 Setting the direction pin state.
void STSPIN820_SetFullStep (void)
 Setting the full step mode.
void STSPIN820_SetModePins (uint8_t mode1_level, uint8_t mode2_level, uint8_t mode3_level)
 Selecting the STSPIN820 mode1, mode2 and mode3 pins levels.
void STSPIN820_TimStckCompareInit (void)
 Initializing step clock compare value.
void STSPIN820_TimStckDeInit (void)
 Deinitializing the timer used for the step clock.
void STSPIN820_TimStckInit (void)
 Initializing the timer used for the step clock.
void STSPIN820_TimStckSetFreq (uint32_t frequency)
 Setting the frequency of PWM.
void STSPIN820_TimStckStart (void)
 Starting the step clock.
uint8_t STSPIN820_TimStckStop (volatile uint8_t *p_toggle_odd)
 Stopping the step clock.

Detailed Description

Class representing an STSPIN820 component.

Definition at line 84 of file STSPIN820.h.


Constructor & Destructor Documentation

STSPIN820 ( PinName  en_fault_irq,
PinName  standby_reset,
PinName  direction,
PinName  ref_pwm,
PinName  decay,
PinName  step_clock,
PinName  mode1,
PinName  mode2,
PinName  mode3 
)

Constructor.

Parameters:
en_fault_irqpin name of the EN_FAULT pin of the component.
standby_resetpin name of the STBY pin of the component.
directionpin name of the DIR pin of the component.
ref_pwmpin name of the REF_PWM pin of the component.
decaypin name of the DECAY pin of the component.
step_clockpin name of the STCK pin of the component.
mode1pin name of the MODE1 pin of the component.
mode2pin name of the MODE2 pin of the component.
mode3pin name of the MODE3 pin of the component.

Definition at line 102 of file STSPIN820.h.

virtual ~STSPIN820 ( void   ) [virtual]

Destructor.

Definition at line 140 of file STSPIN820.h.


Member Function Documentation

void attach_en_fault_irq ( void(*)(void)  fptr )

Attaching an interrupt handler to the FLAG interrupt.

Parameters:
fptrAn interrupt handler.
Return values:
None.

Definition at line 484 of file STSPIN820.h.

void disable_en_fault_irq ( void   )

Disabling the FLAG interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 505 of file STSPIN820.h.

void enable_en_fault_irq ( void   )

Enabling the FLAG interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 495 of file STSPIN820.h.

virtual void hard_hiz ( void   ) [virtual]

Disabling the power bridge immediately.

Parameters:
None.
Return values:
None.

Definition at line 282 of file STSPIN820.h.

virtual void hard_stop ( void   ) [virtual]

Stopping the motor through an immediate infinite deceleration.

Parameters:
None.
Return values:
None.

Definition at line 265 of file STSPIN820.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 275 of file STSPIN820.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 255 of file STSPIN820.h.

void STSPIN820_Delay ( uint32_t  delay ) [protected]

Making the CPU wait.

Parameters:
None.
Return values:
None.

Definition at line 665 of file STSPIN820.h.

void STSPIN820_Disable_Power_Bridges ( void   ) [protected]

Disabling the power bridges (forcing the output bridges at HiZ).

Parameters:
None.
Return values:
None.

Definition at line 690 of file STSPIN820.h.

void STSPIN820_DisableIrq ( void   ) [protected]

Disabling interrupts.

Parameters:
None.
Return values:
None.

Definition at line 711 of file STSPIN820.h.

uint32_t STSPIN820_EN_FAULT_PIN_GetState ( void   ) [protected]

Getting the state of the EN_FAULT pin.

Parameters:
None.
Return values:
None.

Definition at line 721 of file STSPIN820.h.

void STSPIN820_Enable_Power_Bridges ( void   ) [protected]

Enabling the power bridges (leaving the output bridges at HiZ).

Parameters:
None.
Return values:
None.

Definition at line 675 of file STSPIN820.h.

void STSPIN820_EnableIrq ( void   ) [protected]

Enabling interrupts.

Parameters:
None.
Return values:
None.

Definition at line 701 of file STSPIN820.h.

uint8_t STSPIN820_GetDecayGpio ( void   ) [protected]

Getting the decay mode pin state.

Parameters:
None.
Return values:
None.

Definition at line 820 of file STSPIN820.h.

void STSPIN820_GpioInit ( void   ) [protected]

Initialising the GPIOs.

Parameters:
None.
Return values:
None.

Definition at line 731 of file STSPIN820.h.

void STSPIN820_PwmRefInit ( void   ) [protected]

Initialising the PWM.

Parameters:
None.
Return values:
None.

Definition at line 743 of file STSPIN820.h.

void STSPIN820_PwmRefSetFreqAndDutyCycle ( uint32_t  frequency,
uint8_t  duty_cycle 
) [protected]

Setting the frequency and the duty-cycle of PWM.

The frequency controls directly the speed of the device. The duty-cycle controls the torque of the device.

Parameters:
frequencyThe frequency of PWM in Hz.
duty_cycleThe duty-cycle of PWM in [0..100]%.
Return values:
None.

Definition at line 753 of file STSPIN820.h.

void STSPIN820_PwmRefStart ( void   ) [protected]

Starting the PWM.

Parameters:
None.
Return values:
None.

Definition at line 764 of file STSPIN820.h.

void STSPIN820_PwmRefStop ( void   ) [protected]

Stopping the PWM.

Parameters:
None.
Return values:
None.

Definition at line 779 of file STSPIN820.h.

void STSPIN820_ReleaseReset ( void   ) [protected]

Putting the device in standby mode.

Parameters:
None.
Return values:
None.

Definition at line 790 of file STSPIN820.h.

void STSPIN820_Reset ( void   ) [protected]

Putting the device in reset mode.

Parameters:
None.
Return values:
None.

Definition at line 800 of file STSPIN820.h.

void STSPIN820_SetDecayGpio ( uint8_t  gpio_state ) [protected]

Setting the decay mode pin state.

Parameters:
gpio_stateState of the decay mode pin ("0" to reset, "1" to set).
Return values:
None.

Definition at line 810 of file STSPIN820.h.

void STSPIN820_SetDirectionGpio ( uint8_t  gpio_state ) [protected]

Setting the direction pin state.

Parameters:
gpio_stateState of the direction pin ("0" to reset, "1" to set).
Return values:
None.

Definition at line 830 of file STSPIN820.h.

void STSPIN820_SetFullStep ( void   ) [protected]

Setting the full step mode.

Parameters:
None.
Return values:
None.

Definition at line 840 of file STSPIN820.h.

void STSPIN820_SetModePins ( uint8_t  mode1_level,
uint8_t  mode2_level,
uint8_t  mode3_level 
) [protected]

Selecting the STSPIN820 mode1, mode2 and mode3 pins levels.

Parameters:
mode1_levelLevel of the mode1 gpio (0 low, 1+ high).
mode2_levelLevel of the mode2 gpio (0 low, 1+ high).
mode3_levelLevel of the mode3 gpio (0 low, 1+ high).
Return values:
None.

Definition at line 852 of file STSPIN820.h.

void STSPIN820_TimStckCompareInit ( void   ) [protected]

Initializing step clock compare value.

Parameters:
None.
Return values:
None.

Definition at line 864 of file STSPIN820.h.

void STSPIN820_TimStckDeInit ( void   ) [protected]

Deinitializing the timer used for the step clock.

Parameters:
None.
Return values:
None.

Definition at line 871 of file STSPIN820.h.

void STSPIN820_TimStckInit ( void   ) [protected]

Initializing the timer used for the step clock.

Parameters:
None.
Return values:
None.

Definition at line 878 of file STSPIN820.h.

void STSPIN820_TimStckSetFreq ( uint32_t  frequency ) [protected]

Setting the frequency of PWM.

The frequency controls directly the speed of the device.

Parameters:
frequencyThe frequency of PWM in Hz.
Return values:
None.

Definition at line 886 of file STSPIN820.h.

void STSPIN820_TimStckStart ( void   ) [protected]

Starting the step clock.

Parameters:
None.
Return values:
None.

Definition at line 896 of file STSPIN820.h.

uint8_t STSPIN820_TimStckStop ( volatile uint8_t *  p_toggle_odd ) [protected]

Stopping the step clock.

Parameters:
p_toggle_oddPointer to the volatile toggleOdd variable.
Return values:
1if OK, "0" if the STCK pin is High (forbidden configuration).

Definition at line 903 of file STSPIN820.h.