ST / X_NUCLEO_IHM12A1

Dependencies:   ST_INTERFACES

Dependents:   motori prova_motore SchedamotoriIHM12A1 prova_motore_duck ... more

Fork of X-NUCLEO-IHM12A1 by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

STSpin240_250 Class Reference

Class representing a STSpin240_250 component. More...

#include <STSpin240_250.h>

Public Member Functions

 STSpin240_250 (PinName flag_and_enable_pin, PinName standby_reset_pin, PinName dirA_pin, PinName dirB_pin, PinName pwmA_pin, PinName pwmB_pin, PinName pwmRef_pin)
 Constructor.
virtual ~STSpin240_250 (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 void disable_bridge (unsigned int bridgeId)
 Public functions inherited from the BCDMotor Class.
virtual void enable_bridge (unsigned int bridgeId)
 Enabling the specified bridge.
virtual unsigned int get_bridge_input_pwm_freq (unsigned int bridgeId)
 Getting the PWM frequency of the specified bridge;.
virtual unsigned int get_bridge_status (unsigned int bridgeId)
 Getting the bridge status.
virtual unsigned int get_device_state (unsigned int motorId)
 Getting the device State.
virtual unsigned int get_speed (unsigned int motorId)
 Getting the current speed in % of the specified motor.
virtual void hard_hiz (unsigned int motorId)
 Stopping the motor and disabling the power bridge immediately.
virtual void hard_stop (unsigned int motorId)
 Stopping the motor immediately.
virtual void run (unsigned int motorId, direction_t direction)
 Running the motor.
virtual void set_bridge_input_pwm_freq (unsigned int bridgeId, unsigned int frequency)
 Setting the PWM frequency of the specified bridge.
virtual void set_dual_full_bridge_config (unsigned int configuration)
 Setting the dual bridge configuration mode.
virtual bool set_speed (unsigned int motorId, unsigned int speed)
 Setting the speed in %.
virtual void attach_error_handler (void(*fptr)(uint16_t error))
 Public functions NOT inherited.
virtual direction_t get_direction (unsigned int motorId)
 Getting the motor current direction.
virtual unsigned int get_fw_version (void)
 Getting the version of the firmware.
virtual unsigned int get_ref_pwm_dc (unsigned int refId)
 Getting the duty cycle of the PWM used for REF.
virtual unsigned int get_ref_pwm_freq (unsigned int refId)
 Getting the frequency of the PWM used for REF.
virtual void release_reset (void)
 Releasing the reset (exiting standby mode).
virtual void reset (void)
 Reseting (entering standby mode).
virtual void set_direction (unsigned int motorId, direction_t direction)
 Setting the direction of rotation of the firmware.
virtual void set_ref_pwm_dc (unsigned int refId, unsigned int newDc)
 Setting the duty cycle of the PWM used for REF.
virtual void set_ref_pwm_freq (unsigned int refId, unsigned int frequency)
 Setting the frequency of the PWM used for REF.
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.

Static Public Member Functions

static uint8_t get_nb_devices (void)
 Public static functions.

Protected Member Functions

void STSpin240_250_DisableBridge (uint8_t bridgeId)
 Disable the specified bridge.
void STSpin240_250_EnableBridge (uint8_t bridgeId)
 Enable the specified bridge.
uint32_t STSpin240_250_GetBridgeInputPwmFreq (uint8_t bridgeId)
 Get the PWM frequency of the specified bridge.
uint16_t STSpin240_250_GetBridgeStatus (void)
 Get the status of the bridge enabling of the corresponding bridge.
uint16_t STSpin240_250_GetCurrentSpeed (uint8_t motorId)
 Returns the current speed of the specified motor.
motorState_t STSpin240_250_GetDeviceState (uint8_t motorId)
 Returns the device state.
motorDir_t STSpin240_250_GetDirection (uint8_t motorId)
 Get the motor current direction.
uint32_t STSpin240_250_GetFwVersion (void)
 Returns the FW version of the library.
uint8_t STSpin240_250_GetRefPwmDc (uint8_t refId)
 Return the duty cycle of PWM used for REF.
uint32_t STSpin240_250_GetRefPwmFreq (uint8_t refId)
 Return the frequency of PWM used for REF.
void STSpin240_250_HardHiz (uint8_t motorId)
 Immediatly stops the motor and disable the power bridge.
void STSpin240_250_HardStop (uint8_t motorId)
 Stops the motor without disabling the bridge.
void STSpin240_250_ReleaseReset (void)
 Release reset (exit standby mode)
void STSpin240_250_Reset (void)
 Reset (enter standby mode)
void STSpin240_250_Run (uint8_t motorId, motorDir_t direction)
 Runs the motor.
void STSpin240_250_SetBridgeInputPwmFreq (uint8_t bridgeId, uint32_t newFreq)
 Changes the PWM frequency of the bridge input.
void STSpin240_250_SetDirection (uint8_t motorId, motorDir_t dir)
 Specifies the direction.
void STSpin240_250_SetDualFullBridgeconfig (uint8_t enable)
 Set the dual bridge configuration mode.
bool STSpin240_250_SetMaxSpeed (uint8_t motorId, uint16_t newMaxSpeed)
 Changes the max speed of the specified device.
void STSpin240_250_SetRefPwmDc (uint8_t refId, uint8_t newDc)
 Changes the duty cycle of the PWM used for REF.
void STSpin240_250_SetRefPwmFreq (uint8_t refId, uint32_t newFreq)
 Changes the frequency of PWM used for REF.
void STSpin240_250_SetDeviceParamsToGivenValues (STSpin240_250_init_t *pInitPrm)
 Functions to initialize the registers.
void STSpin240_250_SetDeviceParamsToPredefinedValues (void)
 Sets the parameters of the device to predefined values from STSpin240_250_target_config.h.
uint8_t STSpin240_250_GetResetState (void)
 Get the state of the standby/reset pin.
void STSpin240_250_Board_Delay (uint32_t delay)
 Making the CPU wait.
void STSpin240_250_Board_DisableBridge (void)
 Disable bridge.
void STSpin240_250_Board_EnableBridge (uint8_t addDelay)
 Enable bridge.
uint16_t STSpin240_250_Board_GetResetPinState (void)
 Get the status of the reset Pin.
uint16_t STSpin240_250_Board_GetFaultPinState (void)
 Get the status of the flag and enable Pin.
void STSpin240_250_Board_PwmDeInit (uint8_t pwmId)
 Deinitialising the PWM.
void STSpin240_250_Board_PwmInit (uint8_t pwmId, uint8_t onlyChannel)
 Initialising the PWM.
void STSpin240_250_Board_PwmSetFreq (int8_t pwmId, uint32_t newFreq, uint8_t duty)
 Setting the frequency of PWM.
void STSpin240_250_Board_PwmStop (uint8_t pwmId)
 Stopping the PWM.
void STSpin240_250_Board_ReleaseReset (void)
 Putting the device in standby mode.
void STSpin240_250_Board_Reset (void)
 Putting the device in reset mode.
void STSpin240_250_Board_SetDirectionGpio (uint8_t bridgeId, uint8_t gpioState)
 Setting the direction of rotation.

Detailed Description

Class representing a STSpin240_250 component.

Definition at line 78 of file STSpin240_250.h.


Constructor & Destructor Documentation

STSpin240_250 ( PinName  flag_and_enable_pin,
PinName  standby_reset_pin,
PinName  dirA_pin,
PinName  dirB_pin,
PinName  pwmA_pin,
PinName  pwmB_pin,
PinName  pwmRef_pin 
)

Constructor.

Parameters:
flag_and_enable_pinpin name of the EN pin of the component.
standby_reset_pinpin name of the STBY pin of the component.
dirA_pinpin name for the direction pin for bridge A.
dirB_pinpin name for the direction pin for bridge B.
pwmA_pinpin name for the PWM input for bridge A.
pwmB_pinpin name for the PWM input for bridge B.
pwmRef_pinpin name for the REF pin of the component.

Definition at line 94 of file STSpin240_250.h.

virtual ~STSpin240_250 ( void   ) [virtual]

Destructor.

Definition at line 125 of file STSpin240_250.h.


Member Function Documentation

virtual void attach_error_handler ( void(*)(uint16_t error)  fptr ) [virtual]

Public functions NOT inherited.

Attaching an error handler.

Parameters:
fptrAn error handler.
Return values:
None.

Definition at line 311 of file STSpin240_250.h.

void attach_flag_irq ( void(*)(void)  fptr )

Attaching an interrupt handler to the FLAG interrupt.

Parameters:
fptrAn interrupt handler.
Return values:
None.

Definition at line 453 of file STSpin240_250.h.

virtual void disable_bridge ( unsigned int  bridgeId ) [virtual]

Public functions inherited from the BCDMotor Class.

Disabling the specified bridge.

Parameters:
bridgeIdfrom 0 for bridge A to 1 for bridge B.
Return values:
None.

Definition at line 184 of file STSpin240_250.h.

void disable_flag_irq ( void   )

Disabling the FLAG interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 474 of file STSpin240_250.h.

virtual void enable_bridge ( unsigned int  bridgeId ) [virtual]

Enabling the specified bridge.

Parameters:
bridgeIdfrom 0 for bridge A to 1 for bridge B
Return values:
None.

Definition at line 194 of file STSpin240_250.h.

void enable_flag_irq ( void   )

Enabling the FLAG interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 464 of file STSpin240_250.h.

virtual unsigned int get_bridge_input_pwm_freq ( unsigned int  bridgeId ) [virtual]

Getting the PWM frequency of the specified bridge;.

Parameters:
bridgeIdfrom 0 for bridge A to 1 for bridge B.
Return values:
Thefrequency in Hz of the specified bridge input PWM.

Definition at line 204 of file STSpin240_250.h.

virtual unsigned int get_bridge_status ( unsigned int  bridgeId ) [virtual]

Getting the bridge status.

Parameters:
bridgeIdfrom 0 for bridge A to 1 for bridge B.
Return values:
Thestatus.

Definition at line 214 of file STSpin240_250.h.

virtual unsigned int get_device_state ( unsigned int  motorId ) [virtual]

Getting the device State.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
Return values:
Thedevice state (STEADY or INACTIVE)

Definition at line 224 of file STSpin240_250.h.

virtual direction_t get_direction ( unsigned int  motorId ) [virtual]

Getting the motor current direction.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
Return values:
directionThe direction of rotation.

Definition at line 321 of file STSpin240_250.h.

virtual unsigned int get_fw_version ( void   ) [virtual]

Getting the version of the firmware.

Parameters:
None.
Return values:
Theversion of the firmware.

Definition at line 331 of file STSpin240_250.h.

static uint8_t get_nb_devices ( void   ) [static]

Public static functions.

Definition at line 412 of file STSpin240_250.h.

virtual unsigned int get_ref_pwm_dc ( unsigned int  refId ) [virtual]

Getting the duty cycle of the PWM used for REF.

Parameters:
refIdId of the reference PWM signal.
Return values:
dutycycle in % (from 0 to 100)

Definition at line 341 of file STSpin240_250.h.

virtual unsigned int get_ref_pwm_freq ( unsigned int  refId ) [virtual]

Getting the frequency of the PWM used for REF.

Parameters:
refIdId of the reference PWM signal.
Return values:
frequencyin Hz.

Definition at line 351 of file STSpin240_250.h.

virtual unsigned int get_speed ( unsigned int  motorId ) [virtual]

Getting the current speed in % of the specified motor.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
Return values:
Thecurrent speed in %.

Definition at line 234 of file STSpin240_250.h.

virtual void hard_hiz ( unsigned int  motorId ) [virtual]

Stopping the motor and disabling the power bridge immediately.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
Return values:
None.

Definition at line 244 of file STSpin240_250.h.

virtual void hard_stop ( unsigned int  motorId ) [virtual]

Stopping the motor immediately.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
Return values:
None.

Definition at line 254 of file STSpin240_250.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 160 of file STSpin240_250.h.

virtual int read_id ( 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 170 of file STSpin240_250.h.

virtual void release_reset ( void   ) [virtual]

Releasing the reset (exiting standby mode).

Parameters:
None.
Return values:
None.

Definition at line 361 of file STSpin240_250.h.

virtual void reset ( void   ) [virtual]

Reseting (entering standby mode).

Parameters:
None.
Return values:
None.

Definition at line 371 of file STSpin240_250.h.

virtual void run ( unsigned int  motorId,
direction_t  direction 
) [virtual]

Running the motor.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
directionThe direction of rotation.
Return values:
None.

Definition at line 265 of file STSpin240_250.h.

virtual void set_bridge_input_pwm_freq ( unsigned int  bridgeId,
unsigned int  frequency 
) [virtual]

Setting the PWM frequency of the specified bridge.

Parameters:
bridgeIdfrom 0 for bridge A to 1 for bridge B.
frequencyof the PWM in Hz
Return values:
None.

Definition at line 276 of file STSpin240_250.h.

virtual void set_direction ( unsigned int  motorId,
direction_t  direction 
) [virtual]

Setting the direction of rotation of the firmware.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
directionThe direction of rotation.
Return values:
None

Definition at line 382 of file STSpin240_250.h.

virtual void set_dual_full_bridge_config ( unsigned int  configuration ) [virtual]

Setting the dual bridge configuration mode.

Parameters:
configuration.The bridge configuration.
Return values:
None.

Definition at line 286 of file STSpin240_250.h.

virtual void set_ref_pwm_dc ( unsigned int  refId,
unsigned int  newDc 
) [virtual]

Setting the duty cycle of the PWM used for REF.

Parameters:
refIdId of the reference PWM signal.
newDcnew duty cycle from 0 to 100
Return values:
None.

Definition at line 393 of file STSpin240_250.h.

virtual void set_ref_pwm_freq ( unsigned int  refId,
unsigned int  frequency 
) [virtual]

Setting the frequency of the PWM used for REF.

Parameters:
refIdId of the reference PWM signal.
frequencyin Hz.
Return values:
None.

Definition at line 404 of file STSpin240_250.h.

virtual bool set_speed ( unsigned int  motorId,
unsigned int  speed 
) [virtual]

Setting the speed in %.

Parameters:
motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
speedThe new speed in %.
Return values:
truein case of success, "false" otherwise.

Definition at line 297 of file STSpin240_250.h.

void STSpin240_250_Board_Delay ( uint32_t  delay ) [protected]

Making the CPU wait.

Parameters:
None.
Return values:
None.

Definition at line 547 of file STSpin240_250.h.

void STSpin240_250_Board_DisableBridge ( void   ) [protected]

Disable bridge.

Parameters:
None.
Return values:
None.

Definition at line 557 of file STSpin240_250.h.

void STSpin240_250_Board_EnableBridge ( uint8_t  addDelay ) [protected]

Enable bridge.

Parameters:
addDelayif different from 0, a delay is added after bridge activation..
Return values:
None.

Definition at line 568 of file STSpin240_250.h.

uint16_t STSpin240_250_Board_GetFaultPinState ( void   ) [protected]

Get the status of the flag and enable Pin.

Parameters:
None.
Return values:
None.

Definition at line 593 of file STSpin240_250.h.

uint16_t STSpin240_250_Board_GetResetPinState ( void   ) [protected]

Get the status of the reset Pin.

Parameters:
None.
Return values:
None.

Definition at line 583 of file STSpin240_250.h.

void STSpin240_250_Board_PwmDeInit ( uint8_t  pwmId ) [protected]

Deinitialising the PWM.

Parameters:
pwmId0 for bridge A PWM, 1 for bridge B PWM, 2 for REF PWM.
Return values:
None.

Definition at line 603 of file STSpin240_250.h.

void STSpin240_250_Board_PwmInit ( uint8_t  pwmId,
uint8_t  onlyChannel 
) [protected]

Initialising the PWM.

Parameters:
pwmId0 for bridge A PWM, 1 for bridge B PWM, 2 for REF PWM.
onlyChannel.
Return values:
None.

Definition at line 614 of file STSpin240_250.h.

void STSpin240_250_Board_PwmSetFreq ( int8_t  pwmId,
uint32_t  newFreq,
uint8_t  duty 
) [protected]

Setting the frequency of PWM.

The frequency of bridge A and B controls directly the speed of the device.

Parameters:
pwmId0 for bridge A PWM, 1 for bridge B PWM, 2 for REF PWM.
newFreqfrequency to apply in Hz.
dutyDuty cycle to use from 0 to 100.
Return values:
None.

Definition at line 627 of file STSpin240_250.h.

void STSpin240_250_Board_PwmStop ( uint8_t  pwmId ) [protected]

Stopping the PWM.

Parameters:
pwmId0 for bridge A PWM, 1 for bridge B PWM, 2 for REF PWM.
Return values:
None.

Definition at line 658 of file STSpin240_250.h.

void STSpin240_250_Board_ReleaseReset ( void   ) [protected]

Putting the device in standby mode.

Parameters:
None.
Return values:
None.

Definition at line 680 of file STSpin240_250.h.

void STSpin240_250_Board_Reset ( void   ) [protected]

Putting the device in reset mode.

Parameters:
None.
Return values:
None.

Definition at line 691 of file STSpin240_250.h.

void STSpin240_250_Board_SetDirectionGpio ( uint8_t  bridgeId,
uint8_t  gpioState 
) [protected]

Setting the direction of rotation.

Parameters:
bridgeId0 for bridge A, 1 for bridge B.
gpioStatedirection of rotation: "1" for forward, "0" for backward.
Return values:
None.

Definition at line 702 of file STSpin240_250.h.

void STSpin240_250_DisableBridge ( uint8_t  bridgeId ) [protected]

Disable the specified bridge.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
None
Note:
Bridge A and bridge B share the same enable pin. When bridge A is disabled, bridge B is disabled and reversely

Definition at line 141 of file STSpin240_250.cpp.

void STSpin240_250_EnableBridge ( uint8_t  bridgeId ) [protected]

Enable the specified bridge.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
None
Note:
Bridge A and bridge B share the same enable pin. When bridge A is enabled, bridge B is enabled and reversely

Definition at line 156 of file STSpin240_250.cpp.

uint32_t STSpin240_250_GetBridgeInputPwmFreq ( uint8_t  bridgeId ) [protected]

Get the PWM frequency of the specified bridge.

Parameters:
[in]bridgeId0 for bridge A, 1 for bridge B
Return values:
Freqin Hz

Definition at line 186 of file STSpin240_250.cpp.

uint16_t STSpin240_250_GetBridgeStatus ( void   ) [protected]

Get the status of the bridge enabling of the corresponding bridge.

Parameters:
[in]bridgeIdfrom 0 for bridge A to 1 for bridge B
Return values:
Stateof the Enable&Fault pin (shared for bridge A and B)

Definition at line 201 of file STSpin240_250.cpp.

uint16_t STSpin240_250_GetCurrentSpeed ( uint8_t  motorId ) [protected]

Returns the current speed of the specified motor.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
Return values:
currentspeed in % from 0 to 100

Definition at line 213 of file STSpin240_250.cpp.

motorState_t STSpin240_250_GetDeviceState ( uint8_t  motorId ) [protected]

Returns the device state.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
Return values:
State(STEADY or INACTIVE)

Definition at line 236 of file STSpin240_250.cpp.

motorDir_t STSpin240_250_GetDirection ( uint8_t  motorId ) [protected]

Get the motor current direction.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
Return values:
direction

Definition at line 256 of file STSpin240_250.cpp.

uint32_t STSpin240_250_GetFwVersion ( void   ) [protected]

Returns the FW version of the library.

Return values:
STSPIN240_250_FW_VERSION

Definition at line 270 of file STSpin240_250.cpp.

uint8_t STSpin240_250_GetRefPwmDc ( uint8_t  refId ) [protected]

Return the duty cycle of PWM used for REF.

Parameters:
[in]refId0 is the only supported id for STSpin240 or STSpin250
Return values:
dutycycle in % (from 0 to 100)

Definition at line 282 of file STSpin240_250.cpp.

uint32_t STSpin240_250_GetRefPwmFreq ( uint8_t  refId ) [protected]

Return the frequency of PWM used for REF.

Parameters:
[in]refId0 is the only supported id for STSpin240 or STSpin250
Return values:
Frequencyin Hz

Definition at line 299 of file STSpin240_250.cpp.

uint8_t STSpin240_250_GetResetState ( void   ) [protected]

Get the state of the standby/reset pin.

Get the status of the bridge enabling of the corresponding bridge.

Return values:
Stateof the Enable&Fault pin (shared for bridge A and B)

Definition at line 612 of file STSpin240_250.cpp.

void STSpin240_250_HardHiz ( uint8_t  motorId ) [protected]

Immediatly stops the motor and disable the power bridge.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
Return values:
None
Note:
As all motors uses the same power bridge, the power bridge will be disable only if all motors are stopped

Definition at line 318 of file STSpin240_250.cpp.

void STSpin240_250_HardStop ( uint8_t  motorId ) [protected]

Stops the motor without disabling the bridge.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
Return values:
none

Definition at line 348 of file STSpin240_250.cpp.

void STSpin240_250_ReleaseReset ( void   ) [protected]

Release reset (exit standby mode)

Parameters:
[in]deviceId(from 0 to MAX_NUMBER_OF_DEVICES -1)
Return values:
None

Definition at line 372 of file STSpin240_250.cpp.

void STSpin240_250_Reset ( void   ) [protected]

Reset (enter standby mode)

Parameters:
[in]deviceId(from 0 to MAX_NUMBER_OF_DEVICES -1)
Return values:
None

Definition at line 385 of file STSpin240_250.cpp.

void STSpin240_250_Run ( uint8_t  motorId,
motorDir_t  direction 
) [protected]

Runs the motor.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
[in]directionFORWARD or BACKWARD
Return values:
None
Note:
For unidirectionnal motor, direction parameter has no effect

Definition at line 417 of file STSpin240_250.cpp.

void STSpin240_250_SetBridgeInputPwmFreq ( uint8_t  bridgeId,
uint32_t  newFreq 
) [protected]

Changes the PWM frequency of the bridge input.

Parameters:
[in]bridgeId0 for bridge A, 1 for bridge B
[in]newFreqin Hz
Return values:
None
Note:
1)The PWM is only enabled when the motor is requested to run. 2) If the two bridges share the same timer, their frequency has to be the same 3) If the two bridges share the same timer, the frequency is updated on the fly is there is only one motor running on the targeted bridge.

Definition at line 471 of file STSpin240_250.cpp.

void STSpin240_250_SetDeviceParamsToGivenValues ( STSpin240_250_init_t *  pInitPrm ) [protected]

Functions to initialize the registers.

Set the parameters of the device to values of pInitPrm structure.

Parameters:
[in]deviceId(from 0 to MAX_NUMBER_OF_DEVICES -1)
pInitPrmpointer to a structure containing the initial device parameters
Return values:
None

Definition at line 625 of file STSpin240_250.cpp.

void STSpin240_250_SetDeviceParamsToPredefinedValues ( void   ) [protected]

Sets the parameters of the device to predefined values from STSpin240_250_target_config.h.

Return values:
None

Definition at line 653 of file STSpin240_250.cpp.

void STSpin240_250_SetDirection ( uint8_t  motorId,
motorDir_t  dir 
) [protected]

Specifies the direction.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
[in]dirFORWARD or BACKWARD
Note:
The direction change is only applied if the device is in INACTIVE state. To change direction while motor is running, use the run function
Return values:
None

Definition at line 500 of file STSpin240_250.cpp.

void STSpin240_250_SetDualFullBridgeconfig ( uint8_t  enable ) [protected]

Set the dual bridge configuration mode.

Parameters:
[in]enable0 to disable, 1 to enable (not supported by STSPIN250)
Return values:
None

Definition at line 522 of file STSpin240_250.cpp.

bool STSpin240_250_SetMaxSpeed ( uint8_t  motorId,
uint16_t  newMaxSpeed 
) [protected]

Changes the max speed of the specified device.

Parameters:
[in]motorIdfrom 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1)
[in]newMaxSpeedin % from 0 to 100
Return values:
trueif the command is successfully executed, else false

Definition at line 540 of file STSpin240_250.cpp.

void STSpin240_250_SetRefPwmDc ( uint8_t  refId,
uint8_t  newDc 
) [protected]

Changes the duty cycle of the PWM used for REF.

Parameters:
[in]refId0 is the only supported id for STSpin240 or STSpin250
[in]newDcnew duty cycle from 0 to 100
Return values:
None

Definition at line 568 of file STSpin240_250.cpp.

void STSpin240_250_SetRefPwmFreq ( uint8_t  refId,
uint32_t  newFreq 
) [protected]

Changes the frequency of PWM used for REF.

Parameters:
[in]refId0 is the only supported id for STSpin240 or STSpin250
[in]newFreqin Hz
Return values:
None

Definition at line 591 of file STSpin240_250.cpp.