HPM APP
HPMicro Application solution
rdc_init.c File Reference
#include "rdc_init.h"
#include "hpm_pwm_drv.h"
#include "hpm_trgm_drv.h"
#include "hpm_gptmr_drv.h"
#include "hpm_clock_drv.h"
#include "hpm_uart_drv.h"
#include "hpm_rdc_drv.h"
#include "hpm_gpio_drv.h"
#include "hpm_motor_math.h"
#include "hpm_adc16_drv.h"

Macros

#define BOARD_APP_PWM_BASE   BOARD_BLDCPWM
 
#define BOARD_APP_PWM_IRQ   IRQn_PWM0
 
#define BOARD_APP_MOTOR_CLK   BOARD_BLDC_QEI_CLOCK_SOURCE
 
#define PWM_FREQUENCY   (20000) /*20k pwm freq*/
 
#define motor_clock_hz   clock_get_frequency(BOARD_APP_MOTOR_CLK)
 
#define PWM_RELOAD   (motor_clock_hz/PWM_FREQUENCY)
 
#define PWM_TRIG_CMP_INDEX   (9U)
 

Functions

void init_trigger_cfg (uint8_t trig_ch, bool inten)
 init ADC16 trigger configuration struct for the preemption mode. More...
 
void adc_init (void)
 init ADC16 configuration . More...
 
void init_pwm_pla_trgm (TRGM_Type *ptr)
 config TRGM input and output . More...
 
void rdc_cfg (RDC_Type *rdc)
 config Rdc output . More...
 
void rdc_init (void)
 RDC initialize function ;RDC初始化函数 More...
 
void Pwm_Duty_Init (void)
 config PWM. ;pwm配置 More...
 
void Pwm_TrigFor_interrupt_Init (void)
 Config the PWM channel trig for speed calculation interrupt. ;配置pwm通道产生比较中断,用来进行电机速度计算 More...
 
void speed_cal (SPEED_CAL *speed_CalHdl)
 speed calculation function. More...
 
void isr_speed_cal (void)
 interrupt entry function of speed calculation. More...
 

Variables

SPEED_CAL g_speed_cal
 

Macro Definition Documentation

◆ BOARD_APP_MOTOR_CLK

#define BOARD_APP_MOTOR_CLK   BOARD_BLDC_QEI_CLOCK_SOURCE

◆ BOARD_APP_PWM_BASE

#define BOARD_APP_PWM_BASE   BOARD_BLDCPWM

◆ BOARD_APP_PWM_IRQ

#define BOARD_APP_PWM_IRQ   IRQn_PWM0

◆ motor_clock_hz

#define motor_clock_hz   clock_get_frequency(BOARD_APP_MOTOR_CLK)

◆ PWM_FREQUENCY

#define PWM_FREQUENCY   (20000) /*20k pwm freq*/

◆ PWM_RELOAD

#define PWM_RELOAD   (motor_clock_hz/PWM_FREQUENCY)

◆ PWM_TRIG_CMP_INDEX

#define PWM_TRIG_CMP_INDEX   (9U)

Function Documentation

◆ isr_speed_cal()

void isr_speed_cal ( void  )

interrupt entry function of speed calculation.

20k interrupt, get a theta every 50us, and the speed is calculated after getting 20 points .