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

Go to the source code of this file.

Data Structures

struct  mcl_analog_callback_t
 callback function More...
 
struct  mcl_analog_cfg_t
 Configuration of analog functions. More...
 
struct  mcl_analog_t
 Operational data of the analog function. More...
 

Enumerations

enum  { mcl_analog_init_error = MAKE_STATUS(mcl_group_analog, 0) , mcl_analog_not_ready = MAKE_STATUS(mcl_group_analog, 1) , mcl_analog_update_location_error = MAKE_STATUS(mcl_group_analog, 2) , mcl_analog_get_value_error = MAKE_STATUS(mcl_group_analog, 3) }
 
enum  mcl_analog_status_t { analog_status_null = 0 , analog_status_init = 1 , analog_status_run = 2 , analog_status_fail = 3 }
 
enum  mcl_analog_chn_t {
  analog_a_current = 0 , analog_b_current = 1 , analog_c_current = 2 , analog_a_voltage = 3 ,
  analog_b_voltage = 4 , analog_c_voltage = 5 , analog_vbus = 6
}
 Analog function channel numbers. More...
 

Functions

hpm_mcl_stat_t hpm_mcl_analog_init (mcl_analog_t *analog, mcl_analog_cfg_t *cfg, mcl_cfg_t *mcl_cfg)
 Initialize data structures for analog functions. More...
 
hpm_mcl_stat_t hpm_mcl_analog_get_value (mcl_analog_t *analog, mcl_analog_chn_t chn, float *value)
 Get the value of the analog channel. More...
 
hpm_mcl_stat_t hpm_mcl_analog_iir_filter_init (mcl_analog_t *analog, mcl_analog_chn_t chn, mcl_filter_iir_df1_t *iir)
 Initializing the iir filter for analog functions. More...
 
hpm_mcl_stat_t hpm_mcl_analog_disable_iir_filter (mcl_analog_t *analog, mcl_analog_chn_t chn)
 Turn off the iir filter for analog functions. More...
 
hpm_mcl_stat_t hpm_mcl_analog_step_convert (mcl_analog_t *analog, float value, mcl_analog_chn_t chn, float angle, float *output)
 Current conversion of stepper motors. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
mcl_analog_init_error 
mcl_analog_not_ready 
mcl_analog_update_location_error 
mcl_analog_get_value_error 

◆ mcl_analog_chn_t

Analog function channel numbers.

Enumerator
analog_a_current 
analog_b_current 
analog_c_current 
analog_a_voltage 
analog_b_voltage 
analog_c_voltage 
analog_vbus 

◆ mcl_analog_status_t

Enumerator
analog_status_null 
analog_status_init 
analog_status_run 
analog_status_fail 

Function Documentation

◆ hpm_mcl_analog_disable_iir_filter()

hpm_mcl_stat_t hpm_mcl_analog_disable_iir_filter ( mcl_analog_t analog,
mcl_analog_chn_t  chn 
)

Turn off the iir filter for analog functions.

Parameters
analogmcl_analog_t
chnmcl_analog_chn_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_analog_get_value()

hpm_mcl_stat_t hpm_mcl_analog_get_value ( mcl_analog_t analog,
mcl_analog_chn_t  chn,
float *  value 
)

Get the value of the analog channel.

Parameters
analogmcl_analog_t
chnmcl_analog_chn_t
valueProcessed Sample Values
Returns
hpm_mcl_stat_t

◆ hpm_mcl_analog_iir_filter_init()

hpm_mcl_stat_t hpm_mcl_analog_iir_filter_init ( mcl_analog_t analog,
mcl_analog_chn_t  chn,
mcl_filter_iir_df1_t iir 
)

Initializing the iir filter for analog functions.

Parameters
analogmcl_analog_t
chnmcl_analog_chn_t
iirmcl_filter_iir_df1_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_analog_init()

hpm_mcl_stat_t hpm_mcl_analog_init ( mcl_analog_t analog,
mcl_analog_cfg_t cfg,
mcl_cfg_t mcl_cfg 
)

Initialize data structures for analog functions.

Parameters
analogmcl_analog_t
cfgmcl_analog_cfg_t
mcl_cfgmcl_cfg_t
Returns
hpm_mcl_stat_t

◆ hpm_mcl_analog_step_convert()

hpm_mcl_stat_t hpm_mcl_analog_step_convert ( mcl_analog_t analog,
float  value,
mcl_analog_chn_t  chn,
float  angle,
float *  output 
)

Current conversion of stepper motors.

Parameters
analogmcl_analog_t
valueRaw data acquired by the analog function
chnmcl_analog_chn_t
angleelectrical angle
outputTransformed data
Returns
hpm_mcl_stat_t