HPM SDK
HPMicro Software Development Kit
hpm_mcl_drivers.h File Reference
#include "hpm_mcl_common.h"

Go to the source code of this file.

Data Structures

struct  mcl_drivers_callback_t
 Callbacks for Driver Functions. More...
 
struct  mcl_drivers_cfg_t
 Driver Function Configuration. More...
 
struct  mcl_drivers_t
 Driver function running data. More...
 

Enumerations

enum  { mcl_drivers_init_error = MAKE_STATUS(mcl_group_drivers, 0) , mcl_drivers_not_ready = MAKE_STATUS(mcl_group_drivers, 1) , mcl_drivers_update_error = MAKE_STATUS(mcl_group_drivers, 2) }
 
enum  mcl_drivers_status_t { drivers_status_null = 0 , drivers_status_init = 1 , drivers_status_run = 2 , drivers_status_fail = 3 }
 Status of the drive function. More...
 
enum  mcl_drivers_channel_t {
  mcl_drivers_chn_a , mcl_drivers_chn_b , mcl_drivers_chn_c , mcl_drivers_chn_a0 ,
  mcl_drivers_chn_a1 , mcl_drivers_chn_b0 , mcl_drivers_chn_b1 , mcl_drivers_chn_ah ,
  mcl_drivers_chn_al , mcl_drivers_chn_bh , mcl_drivers_chn_bl , mcl_drivers_chn_ch ,
  mcl_drivers_chn_cl
}
 Channels for drive functions. More...
 

Functions

hpm_mcl_stat_t hpm_mcl_drivers_init (mcl_drivers_t *drivers, mcl_drivers_cfg_t *cfg)
 Initialising data for driver functions. More...
 
hpm_mcl_stat_t hpm_mcl_drivers_update_bldc_duty (mcl_drivers_t *drivers, float duty_a, float duty_b, float duty_c)
 Update the duty cycle of a brushless motor. More...
 
hpm_mcl_stat_t hpm_mcl_drivers_update_step_duty (mcl_drivers_t *drivers, float duty_a0, float duty_a1, float duty_b0, float duty_b1)
 Update the duty cycle of a step motor. More...
 
hpm_mcl_stat_t hpm_mcl_disable_all_drivers (mcl_drivers_t *drivers)
 Switch off all drive outputs. More...
 
hpm_mcl_stat_t hpm_mcl_enable_all_drivers (mcl_drivers_t *drivers)
 Enable all drive outputs. More...
 
hpm_mcl_stat_t hpm_mcl_disable_drivers (mcl_drivers_t *drivers, mcl_drivers_channel_t chn)
 Turns off the output of the specified channel of the driver. More...
 
hpm_mcl_stat_t hpm_mcl_enable_drivers (mcl_drivers_t *drivers, mcl_drivers_channel_t chn)
 Starts the output of the specified channel of the driver. More...
 
hpm_mcl_stat_t hpm_mcl_drivers_block_update (mcl_drivers_t *drivers, mcl_motor_dir_t dir, uint8_t sector)
 Block mode updates the outputs of the driver peripherals. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
mcl_drivers_init_error 
mcl_drivers_not_ready 
mcl_drivers_update_error 

◆ mcl_drivers_channel_t

Channels for drive functions.

Enumerator
mcl_drivers_chn_a 

Drive channels for three-phase motors in pair.

mcl_drivers_chn_b 
mcl_drivers_chn_c 
mcl_drivers_chn_a0 

Four channels of the stepper motor.

mcl_drivers_chn_a1 
mcl_drivers_chn_b0 
mcl_drivers_chn_b1 
mcl_drivers_chn_ah 

Drive channels for three-phase motors no pair.

mcl_drivers_chn_al 
mcl_drivers_chn_bh 
mcl_drivers_chn_bl 
mcl_drivers_chn_ch 
mcl_drivers_chn_cl 

◆ mcl_drivers_status_t

Status of the drive function.

Enumerator
drivers_status_null 
drivers_status_init 
drivers_status_run 
drivers_status_fail 

Function Documentation

◆ hpm_mcl_disable_all_drivers()

hpm_mcl_stat_t hpm_mcl_disable_all_drivers ( mcl_drivers_t drivers)

Switch off all drive outputs.

Parameters
driversmcl_drivers_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_disable_drivers()

hpm_mcl_stat_t hpm_mcl_disable_drivers ( mcl_drivers_t drivers,
mcl_drivers_channel_t  chn 
)

Turns off the output of the specified channel of the driver.

Parameters
driversmcl_drivers_t
chnmcl_drivers_channel_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_drivers_block_update()

hpm_mcl_stat_t hpm_mcl_drivers_block_update ( mcl_drivers_t drivers,
mcl_motor_dir_t  dir,
uint8_t  sector 
)

Block mode updates the outputs of the driver peripherals.

Parameters
driversmcl_drivers_t
dirmcl_motor_dir_t
sector1 - 6
Returns
hpm_mcl_stat_t

◆ hpm_mcl_drivers_init()

hpm_mcl_stat_t hpm_mcl_drivers_init ( mcl_drivers_t drivers,
mcl_drivers_cfg_t cfg 
)

Initialising data for driver functions.

Parameters
driversmcl_drivers_t
cfgmcl_drivers_cfg_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_drivers_update_bldc_duty()

hpm_mcl_stat_t hpm_mcl_drivers_update_bldc_duty ( mcl_drivers_t drivers,
float  duty_a,
float  duty_b,
float  duty_c 
)

Update the duty cycle of a brushless motor.

Parameters
driversmcl_drivers_t
duty_aa-phase duty cycle
duty_bb-phase duty cycle
duty_cc-phase duty cycle
Returns
hpm_mcl_stat_t

◆ hpm_mcl_drivers_update_step_duty()

hpm_mcl_stat_t hpm_mcl_drivers_update_step_duty ( mcl_drivers_t drivers,
float  duty_a0,
float  duty_a1,
float  duty_b0,
float  duty_b1 
)

Update the duty cycle of a step motor.

Parameters
driversmcl_drivers_t
duty_a0a0-phase duty cycle
duty_a1a1-phase duty cycle
duty_b0b0-phase duty cycle
duty_b1b1-phase duty cycle
Returns
hpm_mcl_stat_t

◆ hpm_mcl_enable_all_drivers()

hpm_mcl_stat_t hpm_mcl_enable_all_drivers ( mcl_drivers_t drivers)

Enable all drive outputs.

Parameters
driversmcl_drivers_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_enable_drivers()

hpm_mcl_stat_t hpm_mcl_enable_drivers ( mcl_drivers_t drivers,
mcl_drivers_channel_t  chn 
)

Starts the output of the specified channel of the driver.

Parameters
driversmcl_drivers_t
chnmcl_drivers_channel_t
Returns
hpm_mcl_stat_t