Library used to control ST Nucleo Evaluation board IHM04A1, based on L6206 motor control driver.

Dependencies:   ST_INTERFACES

Dependents:   HelloWorld_IHM04A1 RoboCane_Motore arm_dcmotor_can arm_linear_can_2 ... more

Fork of X_NUCLEO_IHM04A1 by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

L6206 Private Constants

L6206 Private Constants

Data Structures

class  L6206
 Class representing a L6206 component. More...

Functions

virtual ~L6206 (void)
 Destructor.
virtual int init (void *init=NULL)
 Initializing the component.
virtual int read_id (uint8_t *id=NULL)
 Getting the ID of the component.
virtual void attach_error_handler (void(*callback)(uint16_t error))
 Attaches a user callback to the error Handler.
virtual void attach_flag_interrupt (void(*callback)(void))
 Attaches a user callback to the flag Interrupt The call back will be then called each time the status flag pin will be pulled down due to the occurrence of a programmed alarms ( OCD, thermal alert)
virtual unsigned int get_speed (unsigned int motorId)
 Returns the current speed of the specified motor.
virtual unsigned int get_device_state (unsigned int motorId)
 Returns the device state.
virtual uint8_t get_fw_version (void)
 Returns the FW version of the library.
virtual uint16_t get_max_speed (unsigned int motorId)
 Returns the max speed of the specified motor.
virtual void hard_stop (unsigned int motorId)
 Stops the motor without disabling the bridge.
virtual void run (unsigned int motorId, direction_t direction)
 Runs the motor.
virtual bool set_speed (unsigned int motorId, unsigned int newMaxSpeed)
 Changes the max speed of the specified device.
virtual void disable_bridge (unsigned int bridgeId)
 Disable the specified bridge.
virtual void enable_bridge (unsigned int bridgeId)
 Enable the specified bridge.
virtual unsigned int get_bridge_status (unsigned int bridgeId)
 Get the status of the bridge enabling of the corresponding bridge.
virtual void hard_hiz (unsigned int motorId)
 Immediatly stops the motor and disable the power bridge.
virtual void error_handler (uint16_t error)
 Error handler which calls the user callback (if defined)
virtual void set_dual_full_bridge_config (unsigned int newConfig)
 Set dual full bridge parallelling configuration.
virtual unsigned int get_bridge_input_pwm_freq (unsigned int bridgeId)
 Get the PWM frequency of the specified bridge.
virtual void set_bridge_input_pwm_freq (unsigned int bridgeId, unsigned int newFreq)
 Changes the PWM frequency of the bridge input.
virtual bool set_nb_devices (uint8_t nbDevices)
 Sets the number of devices to be used.
virtual void enable_flag_irq (uint8_t bridgeId)
 Enabling the FLAG interrupt handling.
virtual void disable_flag_irq (uint8_t bridgeId)
 Disabling the FLAG interrupt handling.
void L6206_OutVal (uint8_t bridgeId, uint8_t val)
 Utility function to set or unset EN pin for Bridge A or Bridge B.
void L6206_Board_Delay (uint32_t delay)
 Making the CPU wait.
void L6206_Board_DisableBridge (uint8_t bridgeId)
 Disable the specified bridge.
void L6206_Board_EnableBridge (uint8_t bridgeId, uint8_t addDelay)
 Enable the specified bridge.
uint32_t L6206_Board_GetFlagPinState (uint8_t bridgeId)
 Returns the FLAG pin state.
void L6206_Board_GpioInit (void)
 Initiliases the GPIOs used by the L6206s.
void L6206_Board_PwmSetFreq (uint8_t bridgeInput, uint32_t newFreq, uint8_t duty)
 Sets the frequency of PWM used for bridges inputs.
void L6206_Board_PwmDeInit (uint8_t bridgeInput)
 Reset the PWM for the specified brigde input.
void L6206_Board_PwmInit (uint8_t bridgeInput)
 Set the PWM frequency the for the specified bridge input.
void L6206_Board_PwmStop (uint8_t bridgeInput)
 Stops the PWM uses for the specified brige input.

Variables

bool pwm_1A_activated
 PWM timer variables.

Function Documentation

virtual void attach_error_handler ( void(*)(uint16_t error)  callback ) [virtual, inherited]

Attaches a user callback to the error Handler.

The call back will be then called each time the library detects an error

Parameters:
[in]callbackName of the callback to attach to the error Hanlder
Return values:
None

Definition at line 203 of file L6206.h.

virtual void attach_flag_interrupt ( void(*)(void)  callback ) [virtual, inherited]

Attaches a user callback to the flag Interrupt The call back will be then called each time the status flag pin will be pulled down due to the occurrence of a programmed alarms ( OCD, thermal alert)

Parameters:
[in]callbackName of the callback to attach to the Flag Interrupt
Return values:
None

Definition at line 218 of file L6206.h.

virtual void disable_bridge ( unsigned int  bridgeId ) [virtual, inherited]

Disable the specified bridge.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
None
Note:
When input of different brigdes are parallelized together, the disabling of one bridge leads to the disabling of the second one

Definition at line 303 of file L6206.h.

virtual void disable_flag_irq ( uint8_t  bridgeId ) [virtual, inherited]

Disabling the FLAG interrupt handling.

Parameters:
[in]bridgeId0 for bridge A, 1 for bridge B
Return values:
None.

Definition at line 454 of file L6206.h.

virtual void enable_bridge ( unsigned int  bridgeId ) [virtual, inherited]

Enable the specified bridge.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
None
Note:
When input of different brigdes are parallelized together, the enabling of one bridge leads to the enabling of the second one

Definition at line 316 of file L6206.h.

virtual void enable_flag_irq ( uint8_t  bridgeId ) [virtual, inherited]

Enabling the FLAG interrupt handling.

Parameters:
[in]bridgeId0 for bridge A, 1 for bridge B
Return values:
None.

Definition at line 435 of file L6206.h.

virtual void error_handler ( uint16_t  error ) [virtual, inherited]

Error handler which calls the user callback (if defined)

Parameters:
[in]errorNumber of the error
Return values:
None

Definition at line 348 of file L6206.h.

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

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 369 of file L6206.h.

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

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&Flag pin of the corresponding bridge (1 set, 0 for reset)

Definition at line 326 of file L6206.h.

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

Returns the device state.

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

Definition at line 238 of file L6206.h.

virtual uint8_t get_fw_version ( void   ) [virtual, inherited]

Returns the FW version of the library.

Return values:
L6206_FW_VERSION

Definition at line 247 of file L6206.h.

virtual uint16_t get_max_speed ( unsigned int  motorId ) [virtual, inherited]

Returns the max speed of the specified motor.

Parameters:
[in]motorIdfrom 0 to MAX_NUMBER_OF_BRUSH_DC_MOTORS
Return values:
maxSpeedin % from 0 to 100

Definition at line 257 of file L6206.h.

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

Returns the current speed of the specified motor.

Parameters:
[in]motorIdfrom 0 to MAX_NUMBER_OF_BRUSH_DC_MOTORS
Return values:
currentspeed in % from 0 to 100

Definition at line 228 of file L6206.h.

virtual void hard_hiz ( unsigned int  motorId ) [virtual, inherited]

Immediatly stops the motor and disable the power bridge.

Parameters:
[in]motorIdfrom 0 to MAX_NUMBER_OF_BRUSH_DC_MOTORS
Return values:
None
Note:
if two motors uses the same power bridge, the power bridge will be disable only if the two motors are stopped

Definition at line 338 of file L6206.h.

virtual void hard_stop ( unsigned int  motorId ) [virtual, inherited]

Stops the motor without disabling the bridge.

Parameters:
[in]motorIdfrom 0 to MAX_NUMBER_OF_BRUSH_DC_MOTORS
Return values:
none

Definition at line 267 of file L6206.h.

virtual int init ( void *  init = NULL ) [virtual, inherited]

Initializing the component.

Parameters:
initPointer to device specific initalization structure.
Return values:
0in case of success, an error code otherwise.

Definition at line 181 of file L6206.h.

void L6206_Board_Delay ( uint32_t  delay ) [protected, inherited]

Making the CPU wait.

Parameters:
None.
Return values:
None.

Definition at line 554 of file L6206.h.

void L6206_Board_DisableBridge ( uint8_t  bridgeId ) [protected, inherited]

Disable the specified bridge.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
None
Note:
When input of different brigdes are parallelized together, the disabling of one bridge leads to the disabling of the second one

Definition at line 567 of file L6206.h.

void L6206_Board_EnableBridge ( uint8_t  bridgeId,
uint8_t  addDelay 
) [protected, inherited]

Enable the specified bridge.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
None
Note:
When input of different brigdes are parallelized together, the enabling of one bridge leads to the enabling of the second one

Definition at line 585 of file L6206.h.

uint32_t L6206_Board_GetFlagPinState ( uint8_t  bridgeId ) [protected, inherited]

Returns the FLAG pin state.

Parameters:
[in]bridgeId(from 0 for bridge A to 1 for bridge B)
Return values:
TheFLAG pin value.

Definition at line 602 of file L6206.h.

void L6206_Board_GpioInit ( void   ) [protected, inherited]

Initiliases the GPIOs used by the L6206s.

Return values:
None

Definition at line 620 of file L6206.h.

void L6206_Board_PwmDeInit ( uint8_t  bridgeInput ) [protected, inherited]

Reset the PWM for the specified brigde input.

Parameters:
[in]bridgeInput0 for input 1A, 1 for input 2A, 2 for input 1B, 3 for input 2B
Return values:
None

Definition at line 695 of file L6206.h.

void L6206_Board_PwmInit ( uint8_t  bridgeInput ) [protected, inherited]

Set the PWM frequency the for the specified bridge input.

Parameters:
[in]bridgeInput0 for input 1A, 1 for input 2A, 2 for input 1B, 3 for input 2B
Return values:
None

Definition at line 724 of file L6206.h.

void L6206_Board_PwmSetFreq ( uint8_t  bridgeInput,
uint32_t  newFreq,
uint8_t  duty 
) [protected, inherited]

Sets the frequency of PWM used for bridges inputs.

Parameters:
[in]bridgeInput0 for input 1A, 1 for input 2A, 2 for input 1B, 3 for input 2B
[in]newFreqin Hz
[in]dutyDuty cycle
Return values:
None
Note:
The frequency is directly the current speed of the device

Definition at line 647 of file L6206.h.

void L6206_Board_PwmStop ( uint8_t  bridgeInput ) [protected, inherited]

Stops the PWM uses for the specified brige input.

Parameters:
[in]bridgeInput0 for input 1A, 1 for input 2A, 2 for input 1B, 3 for input 2B
Return values:
None

Definition at line 734 of file L6206.h.

void L6206_OutVal ( uint8_t  bridgeId,
uint8_t  val 
) [protected, inherited]

Utility function to set or unset EN pin for Bridge A or Bridge B.

Parameters:
[out]none
[in]bridgeId0 for bridge A, 1 for bridge B
Return values:
none

Definition at line 533 of file L6206.h.

virtual int read_id ( uint8_t *  id = NULL ) [virtual, inherited]

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 191 of file L6206.h.

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

Runs the motor.

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

Definition at line 279 of file L6206.h.

virtual void set_bridge_input_pwm_freq ( unsigned int  bridgeId,
unsigned int  newFreq 
) [virtual, inherited]

Changes the PWM frequency of the bridge input.

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

Definition at line 380 of file L6206.h.

virtual void set_dual_full_bridge_config ( unsigned int  newConfig ) [virtual, inherited]

Set dual full bridge parallelling configuration.

Parameters:
[in]newConfigbridge configuration to apply from dualFullBridgeConfig_t enum
Return values:
None

Definition at line 359 of file L6206.h.

virtual bool set_nb_devices ( uint8_t  nbDevices ) [virtual, inherited]

Sets the number of devices to be used.

Parameters:
[in]nbDevices(from 1 to MAX_NUMBER_OF_DEVICES)
Return values:
TRUEif successfull, FALSE if failure, attempt to set a number of devices greater than MAX_NUMBER_OF_DEVICES

Definition at line 391 of file L6206.h.

virtual bool set_speed ( unsigned int  motorId,
unsigned int  newMaxSpeed 
) [virtual, inherited]

Changes the max speed of the specified device.

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

Definition at line 290 of file L6206.h.

virtual ~L6206 ( void   ) [virtual, inherited]

Destructor.

Definition at line 150 of file L6206.h.


Variable Documentation

bool pwm_1A_activated [protected, inherited]

PWM timer variables.

Definition at line 831 of file L6206.h.