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 Class Reference

Class representing a L6206 component. More...

#include <L6206.h>

Public Member Functions

 L6206 (PinName EN_flag_A, PinName EN_flag_B, PinName pwm_1A, PinName pwm_2A, PinName pwm_1B, PinName pwm_2B)
 Constructor.
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.

Protected Member Functions

status_t L6206_Init (void *init)
 Start the L6206 library.
status_t L6206_ReadId (uint8_t *id)
 Read id.
void L6206_AttachErrorHandler (void(*callback)(uint16_t error))
 Attaches a user callback to the error Handler.
void L6206_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)
void L6206_DisableBridge (uint8_t bridgeId)
 Disable the specified bridge.
void L6206_EnableBridge (uint8_t bridgeId)
 Enable the specified bridge.
uint16_t L6206_GetBridgeStatus (uint8_t deviceId)
 Get the status of the bridge enabling of the corresponding bridge.
uint16_t L6206_GetCurrentSpeed (uint8_t motorId)
 Returns the current speed of the specified motor.
motorState_t L6206_get_device_state (uint8_t motorId)
 Returns the device state.
uint8_t L6206_GetFwVersion (void)
 Returns the FW version of the library.
uint16_t L6206_GetMaxSpeed (uint8_t motorId)
 Returns the max speed of the specified motor.
void L6206_HardHiz (uint8_t motorId)
 Immediatly stops the motor and disable the power bridge.
void L6206_HardStop (uint8_t motorId)
 Stops the motor without disabling the bridge.
void L6206_Run (uint8_t motorId, motorDir_t direction)
 Runs the motor.
uint32_t L6206_GetBridgeInputPwmFreq (uint8_t bridgeId)
 Get the PWM frequency of the specified bridge.
void L6206_SetBridgeInputPwmFreq (uint8_t bridgeId, uint32_t newFreq)
 Changes the PWM frequency of the bridge input.
void L6206_SetDualFullBridgeConfig (uint8_t newConfig)
 Set dual full bridge parallelling configuration.
bool L6206_SetMaxSpeed (uint8_t motorId, uint16_t newMaxSpeed)
 Changes the max speed of the specified device.
bool L6206_SetNbDevices (uint8_t nbDevices)
 Sets the number of devices to be used.
void L6206_ErrorHandler (uint16_t error)
 Error handler which calls the user callback (if defined)
void L6206_FlagInterruptHandler (void)
 Handlers of the flag interrupt which calls the user callback (if defined)
uint8_t L6206_GetBridgeIdUsedByMotorId (uint8_t motorId)
 Get the bridges Id used by a given motor.
uint8_t L6206_GetBridgeInputUsedByMotorId (uint8_t motorId)
 Get the PWM input used by a given motor.
uint8_t L6206_GetMotorIdUsingbridgeInput (uint8_t bridgeInput)
 Get the motor Id which is using the specified bridge input.
uint8_t L6206_GetSecondBridgeInputUsedByMotorId (uint8_t motorId)
 Get the second PWM input used by a given bidirectionnal motor.
bool L6206_IsBidirectionnalMotor (uint8_t motorId)
 Test if motor is bidirectionnal.
void L6206_SetDeviceParamsToPredefinedValues (void)
 Sets the parameters of the device to predefined values from l6206_target_config.h.
void L6206_SetDeviceParamsToGivenValues (L6206_init_t *initDevicePrm)
 Set the parameters of the device to values of initDevicePrm structure Set GPIO according to these values.
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.

Protected Attributes

bool pwm_1A_activated
 PWM timer variables.

Detailed Description

Class representing a L6206 component.

Definition at line 121 of file L6206.h.


Constructor & Destructor Documentation

L6206 ( PinName  EN_flag_A,
PinName  EN_flag_B,
PinName  pwm_1A,
PinName  pwm_2A,
PinName  pwm_1B,
PinName  pwm_2B 
)

Constructor.

Definition at line 130 of file L6206.h.