miniFOC 1.0.3
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.
Functions
timer.c File Reference

this file contains the code implementation of timer initialization and disable timer function and setting timer comparison value. More...

#include "timer.h"
#include "gd32f1x0.h"
#include "config.h"

Go to the source code of this file.

Functions

void update_pwm_dutycycle (float ch0, float ch1, float ch2)
 update timer1 ch0 1 2 duty-cycle More...
 
void timer13_disable (void)
 disable timer13 periph and timer2 interrupt More...
 
void timer2_disable (void)
 disable timer2 periph and timer2 interrupt More...
 
void timer2_config (void)
 configure timer2 periph for timing interrupt More...
 
void timer13_config (void)
 configure timer13 periph for timing interrupt More...
 
void pwm_config (void)
 configure timer1 periph and its gpios More...
 

Detailed Description

this file contains the code implementation of timer initialization and disable timer function and setting timer comparison value.

Author
Lao·Zhu
Version
V1.0.2
Date
29. October 2021

Definition in file timer.c.

Function Documentation

◆ pwm_config()

void pwm_config ( void  )

configure timer1 periph and its gpios

Definition at line 117 of file timer.c.

References PWM_PERIOD.

Referenced by main().

◆ timer13_config()

void timer13_config ( void  )

configure timer13 periph for timing interrupt

Definition at line 89 of file timer.c.

References TIM13_FREQUENCY, and TIM13_PRIORITY.

Referenced by main().

◆ timer13_disable()

void timer13_disable ( void  )

disable timer13 periph and timer2 interrupt

Definition at line 30 of file timer.c.

Referenced by main().

◆ timer2_config()

void timer2_config ( void  )

configure timer2 periph for timing interrupt

Definition at line 61 of file timer.c.

References TIM2_FREQUENCY, and TIM2_PRIORITY.

Referenced by main().

◆ timer2_disable()

void timer2_disable ( void  )

disable timer2 periph and timer2 interrupt

Definition at line 44 of file timer.c.

References update_pwm_dutycycle().

Referenced by main().

◆ update_pwm_dutycycle()

void update_pwm_dutycycle ( float  ch0,
float  ch1,
float  ch2 
)

update timer1 ch0 1 2 duty-cycle

Parameters
[in]ch0duty-cycle of channel0, 0 ~ 1.0f
[in]ch1duty-cycle of channel1, 0 ~ 1.0f
[in]ch2duty-cycle of channel2, 0 ~ 1.0f

Definition at line 20 of file timer.c.

References PWM_PERIOD.

Referenced by encoder_zeroing(), foc_calibrate_phase(), timer2_disable(), and TIMER2_IRQHandler().