FD32M0P Microcontroller SDK
|
Data Structures | |
struct | timer_clk_cfg_t |
Clock configuration. More... | |
struct | timer_ctr_cfg_t |
struct | timer_input_chan_cfg_t |
struct | timer_output_chan_cfg_t |
struct | timer_pwm_output_channel_action_cfg_t |
struct | timer_capture_channel_ctrl_t |
struct | timer_pwm_cfg_t |
Macros | |
#define | TIMER_CLK_CFG_DEFAULT |
#define | TIMER_CTR_CFG_DEFAULT |
#define | TIMER_INPUT_CHAN_CFG_DEFAULT |
#define | TIMER_OUTPUT_CHAN_CFG_DEFAULT |
#define | TIMER_PWM_OUTPUT_CHANNEL_ACTION_CFG_DEFAULT |
#define | TIMER_CAPTURE_CHANNEL_CTRL_CFG_DEFAULT |
#define | TIMER_PWM_CFG_DEFAULT |
Functions | |
void | timer_set_clk_cfg (TIMER_REGS_s *TIMER_REGS, timer_clk_cfg_t *clk_cfg) |
This function sets the clock configuration. | |
void | timer_clk_enable (TIMER_REGS_s *TIMER_REGS) |
This function enables the timer clock. | |
void | timer_clk_disable (TIMER_REGS_s *TIMER_REGS) |
This function disables the timer clock. | |
void | timer_set_load_val (TIMER_REGS_s *TIMER_REGS, uint16_t load_val) |
This function sets the LOAD value of the timer counter. | |
void | timer_set_counter_val (TIMER_REGS_s *TIMER_REGS, uint16_t ctr_val) |
This function sets the counter value of the timer counter. | |
void | timer_set_counter_ctrl (TIMER_REGS_s *TIMER_REGS, timer_ctr_cfg_t *ctr_cfg) |
This function sets the configuration of the timer counter. | |
void | timer_set_repeat_counter_val (TIMER_REGS_s *TIMER_REGS, uint16_t rctr_val) |
This function sets the REPEAT COUNTER value of the timer. | |
void | timer_start (TIMER_REGS_s *TIMER_REGS) |
This function starts the timer counter. | |
void | timer_stop (TIMER_REGS_s *TIMER_REGS) |
This function stops the timer counter. | |
void | timer_set_input_channel_cfg (TIMER_REGS_s *TIMER_REGS, timer_input_chan_cfg_t *in_chan_cfg, uint8_t chan_num) |
This function sets the input channel configuration of the desired timer channel. | |
void | timer_set_output_channel_cfg (TIMER_REGS_s *TIMER_REGS, timer_output_chan_cfg_t *out_chan_cfg, uint8_t chan_num) |
This function sets the output channel configuration of the desired timer channel. | |
void | timer_set_init_cfg (TIMER_REGS_s *TIMER_REGS, timer_clk_cfg_t *clk_cfg, timer_ctr_cfg_t *ctr_cfg) |
This function sets the initial timer configuration. It generates periodic interrupts. | |
void | timer_delay_in_us (TIMER_REGS_s *TIMER_REGS, uint16_t delay_in_us) |
This function generates an interrupt after a ceratin time period mentioned in us. | |
void | timer_delay_in_ms (TIMER_REGS_s *TIMER_REGS, uint16_t delay_in_ms) |
This function generates an interrupt after a ceratin time period mentioned in ms. | |
void | timer_set_compare_val (TIMER_REGS_s *TIMER_REGS, uint8_t comp_val, uint8_t chan_num) |
void | timer_set_pwm_cfg (TIMER_REGS_s *TIMER_REGS, timer_clk_cfg_t *clk_cfg, timer_pwm_cfg_t *pwm_cfg) |
void | timer_set_pwm_output_channel_action_cfg (TIMER_REGS_s *TIMER_REGS, timer_pwm_output_channel_action_cfg_t *pwm_act_cfg, uint8_t chan_num) |
void | timer_set_capture_channel_ctrl (TIMER_REGS_s *TIMER_REGS, timer_capture_channel_ctrl_t *cap_chan_ctrl, uint8_t chan_num) |
struct timer_clk_cfg_t |
Clock configuration.
Data Fields | ||
---|---|---|
TIMER_CLK_CONFIG_CLK_SEL_E | clk_sel | |
uint16_t | clk_div |
struct timer_ctr_cfg_t |
Data Fields | ||
---|---|---|
TIMER_CTR_CTL_COUNT_MODE_E | ctr_mode | |
bool | repeat | |
TIMER_CTR_CTL_CTR_ZERO_CTRL_E | ctr_zero_cond | |
TIMER_CTR_CTL_CTR_LOAD_CTRL_E | ctr_load_cond | |
TIMER_CTR_CTL_CTR_ADV_CTRL_E | ctr_adv_cond |
struct timer_input_chan_cfg_t |
Data Fields | ||
---|---|---|
TIMER_INPUT_CC_0_INPUT_SEL_0_E | in_sel | |
bool | in_inv | |
bool | in_filter_en | |
TIMER_INPUT_FILTER_CC_0_FILTER_PERIOD_0_E | in_filter_prd |
struct timer_output_chan_cfg_t |
Data Fields | ||
---|---|---|
TIMER_CC0_OUTPUT_CTL_CC_OUT_SEL_0_E | out_sel | |
bool | out_inv | |
bool | out_init_val |
struct timer_pwm_output_channel_action_cfg_t |
Data Fields | ||
---|---|---|
TIMER_CC0_CC_PWM_CFG_CC_OUT_CC2D_0_E | cc2d_act | |
TIMER_CC0_CC_PWM_CFG_CC_OUT_CC2U_0_E | cc2u_act | |
TIMER_CC0_CC_PWM_CFG_CC_OUT_CCD_0_E | ccd_act | |
TIMER_CC0_CC_PWM_CFG_CC_OUT_CCU_0_E | ccu_act | |
TIMER_CC0_CC_PWM_CFG_CC_OUT_LOAD_0_E | load_act | |
TIMER_CC0_CC_PWM_CFG_CC_OUT_ZERO_0_E | zero_act |
struct timer_capture_channel_ctrl_t |
Data Fields | ||
---|---|---|
TIMER_CC0_CAPTURE_CTRL_CAP_COND_0_E | cap_cond | |
TIMER_CC0_CAPTURE_CTRL_LOAD_COND_0_E | load_cond | |
TIMER_CC0_CAPTURE_CTRL_ZERO_COND_0_E | zero_cond | |
TIMER_CC0_CAPTURE_CTRL_ADV_COND_0_E | adv_cond |
struct timer_pwm_cfg_t |
Data Fields | ||
---|---|---|
timer_ctr_cfg_t | ctr_cfg | |
uint16_t | pwm_period | |
uint8_t | chan_num | |
uint16_t | pwm_high_period | |
timer_output_chan_cfg_t | out_chan_cfg | |
timer_capture_channel_ctrl_t | cap_chan_ctrl |
#define TIMER_CLK_CFG_DEFAULT |
Referenced by timer_delay_in_ms(), and timer_delay_in_us().
#define TIMER_CTR_CFG_DEFAULT |
Referenced by timer_delay_in_ms(), and timer_delay_in_us().
#define TIMER_INPUT_CHAN_CFG_DEFAULT |
#define TIMER_OUTPUT_CHAN_CFG_DEFAULT |
#define TIMER_PWM_OUTPUT_CHANNEL_ACTION_CFG_DEFAULT |
Referenced by timer_set_pwm_cfg().
#define TIMER_CAPTURE_CHANNEL_CTRL_CFG_DEFAULT |
#define TIMER_PWM_CFG_DEFAULT |
void timer_set_clk_cfg | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_clk_cfg_t * | clk_cfg ) |
This function sets the clock configuration.
TIMER_REGS | : pointer to the timer register space |
clk_cfg | : pointer to the struct containing the clock configurations |
void |
timer_set_clk_cfg
References TIMER_REGS_s::CLK_CONFIG, timer_clk_cfg_t::clk_div, and timer_clk_cfg_t::clk_sel.
Referenced by timer_delay_in_ms(), timer_delay_in_us(), timer_set_init_cfg(), and timer_set_pwm_cfg().
void timer_clk_enable | ( | TIMER_REGS_s * | TIMER_REGS | ) |
This function enables the timer clock.
TIMER_REGS | : pointer to the timer register space |
void |
timer_clk_enable
References TIMER_REGS_s::CLK_CTRL.
Referenced by timer_delay_in_ms(), timer_delay_in_us(), and timer_set_init_cfg().
void timer_clk_disable | ( | TIMER_REGS_s * | TIMER_REGS | ) |
This function disables the timer clock.
TIMER_REGS | : pointer to the timer register space |
void |
timer_clk_disable
References TIMER_REGS_s::CLK_CTRL.
Referenced by timer_delay_in_ms().
void timer_set_load_val | ( | TIMER_REGS_s * | TIMER_REGS, |
uint16_t | load_val ) |
This function sets the LOAD value of the timer counter.
TIMER_REGS | : pointer to the timer register space |
load_val | : LOAD value for the counter |
void |
timer_set_load_val
References TIMER_REGS_s::CTR_LOAD_VAL.
Referenced by timer_delay_in_ms(), timer_delay_in_us(), timer_set_init_cfg(), and timer_set_pwm_cfg().
void timer_set_counter_val | ( | TIMER_REGS_s * | TIMER_REGS, |
uint16_t | ctr_val ) |
This function sets the counter value of the timer counter.
TIMER_REGS | : pointer to the timer register space |
ctr_val | : counter value for the counter |
Note: Setting the counter value directly while the timer's counter is running can lead to unpredictable behavior. This function should only be used when the timer's counter isn't running.
void |
timer_set_counter_val
References TIMER_REGS_s::CTR_VAL.
void timer_set_counter_ctrl | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_ctr_cfg_t * | ctr_cfg ) |
This function sets the configuration of the timer counter.
TIMER_REGS | : pointer to the timer register space |
ctr_cfg | : pointer to the structure containing the timer counter configuration |
void |
timer_set_counter_ctrl
References timer_ctr_cfg_t::ctr_adv_cond, TIMER_REGS_s::CTR_CTL, timer_ctr_cfg_t::ctr_load_cond, timer_ctr_cfg_t::ctr_mode, timer_ctr_cfg_t::ctr_zero_cond, and timer_ctr_cfg_t::repeat.
Referenced by timer_delay_in_ms(), timer_delay_in_us(), timer_set_init_cfg(), and timer_set_pwm_cfg().
void timer_set_repeat_counter_val | ( | TIMER_REGS_s * | TIMER_REGS, |
uint16_t | rctr_val ) |
This function sets the REPEAT COUNTER value of the timer.
TIMER_REGS | : pointer to the timer register space |
rctr_val | : repeat counter value for the timer |
void |
timer_set_repeat_counter_val
References TIMER_REGS_s::RCTR_VAL.
void timer_start | ( | TIMER_REGS_s * | TIMER_REGS | ) |
This function starts the timer counter.
TIMER_REGS | : pointer to the timer register space |
void |
timer_start
References TIMER_REGS_s::CTR_CTL.
Referenced by timer_delay_in_ms(), timer_delay_in_us(), and timer_set_init_cfg().
void timer_stop | ( | TIMER_REGS_s * | TIMER_REGS | ) |
This function stops the timer counter.
TIMER_REGS | : pointer to the timer register space |
void |
timer_stop
References TIMER_REGS_s::CTR_CTL.
void timer_set_input_channel_cfg | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_input_chan_cfg_t * | in_chan_cfg, | ||
uint8_t | chan_num ) |
This function sets the input channel configuration of the desired timer channel.
TIMER_REGS | : pointer to the timer register space |
in_chan_cfg | : pointer to the structure containing the input channel configuration |
chan_num | : input channel number |
void |
timer_set_input_channel_cfg
References timer_input_chan_cfg_t::in_filter_en, timer_input_chan_cfg_t::in_filter_prd, timer_input_chan_cfg_t::in_inv, timer_input_chan_cfg_t::in_sel, TIMER_REGS_s::INPUT_CC_0, TIMER_REGS_s::INPUT_CC_1, TIMER_REGS_s::INPUT_CC_2, TIMER_REGS_s::INPUT_CC_3, TIMER_REGS_s::INPUT_FILTER_CC_0, TIMER_REGS_s::INPUT_FILTER_CC_1, TIMER_REGS_s::INPUT_FILTER_CC_2, and TIMER_REGS_s::INPUT_FILTER_CC_3.
void timer_set_output_channel_cfg | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_output_chan_cfg_t * | out_chan_cfg, | ||
uint8_t | chan_num ) |
This function sets the output channel configuration of the desired timer channel.
TIMER_REGS | : pointer to the timer register space |
in_chan_cfg | : pointer to the structure containing the output channel configuration |
chan_num | : output channel number |
void |
timer_set_output_channel_cfg
References TIMER_REGS_s::CC0_OUTPUT_CTL, TIMER_REGS_s::CC1_OUTPUT_CTL, TIMER_REGS_s::CC2_OUTPUT_CTL, TIMER_REGS_s::CC3_OUTPUT_CTL, timer_output_chan_cfg_t::out_init_val, timer_output_chan_cfg_t::out_inv, and timer_output_chan_cfg_t::out_sel.
Referenced by timer_set_pwm_cfg().
void timer_set_init_cfg | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_clk_cfg_t * | clk_cfg, | ||
timer_ctr_cfg_t * | ctr_cfg ) |
This function sets the initial timer configuration. It generates periodic interrupts.
TIMER_REGS | : pointer to the timer register space |
clk_cfg | : pointer to the struct containing the clock configurations |
ctr_cfg | : pointer to the structure containing the timer counter configuration |
void |
timer_set_init_cfg generates periodic interrupts
References timer_clk_enable(), timer_set_clk_cfg(), timer_set_counter_ctrl(), timer_set_load_val(), and timer_start().
void timer_delay_in_us | ( | TIMER_REGS_s * | TIMER_REGS, |
uint16_t | delay_in_us ) |
This function generates an interrupt after a ceratin time period mentioned in us.
TIMER_REGS | : pointer to the timer register space |
delay_in_us | : time period in us after which interrupt should be generated |
void |
timer_delay_in_us generates an interrupt after a certain time period mentioned in us
References timer_ctr_cfg_t::repeat, TIMER_CLK_CFG_DEFAULT, timer_clk_enable(), TIMER_CTR_CFG_DEFAULT, timer_set_clk_cfg(), timer_set_counter_ctrl(), timer_set_load_val(), and timer_start().
void timer_delay_in_ms | ( | TIMER_REGS_s * | TIMER_REGS, |
uint16_t | delay_in_ms ) |
This function generates an interrupt after a ceratin time period mentioned in ms.
TIMER_REGS | : pointer to the timer register space |
delay_in_ms | : time period in ms after which interrupt should be generated |
void |
timer_delay_in_ms generates an interrupt after a certain time period mentioned in ms
References timer_clk_cfg_t::clk_div, timer_ctr_cfg_t::repeat, TIMER_CLK_CFG_DEFAULT, timer_clk_disable(), timer_clk_enable(), TIMER_CTR_CFG_DEFAULT, timer_set_clk_cfg(), timer_set_compare_val(), timer_set_counter_ctrl(), timer_set_load_val(), and timer_start().
void timer_set_compare_val | ( | TIMER_REGS_s * | TIMER_REGS, |
uint8_t | comp_val, | ||
uint8_t | chan_num ) |
timer_set_compare_val Sets the compare value for a particular channel
References TIMER_REGS_s::CC0_COMPARE_CTRL, TIMER_REGS_s::CC1_COMPARE_CTRL, TIMER_REGS_s::CC2_COMPARE_CTRL, and TIMER_REGS_s::CC3_COMPARE_CTRL.
Referenced by timer_delay_in_ms(), and timer_set_pwm_cfg().
void timer_set_pwm_cfg | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_clk_cfg_t * | clk_cfg, | ||
timer_pwm_cfg_t * | pwm_cfg ) |
timer_set_pwm_cfg Sets the PWM configuration for a particular channel
References timer_pwm_cfg_t::cap_chan_ctrl, timer_pwm_output_channel_action_cfg_t::ccd_act, timer_pwm_output_channel_action_cfg_t::ccu_act, timer_pwm_cfg_t::chan_num, timer_pwm_cfg_t::ctr_cfg, timer_ctr_cfg_t::ctr_mode, timer_pwm_output_channel_action_cfg_t::load_act, timer_pwm_cfg_t::out_chan_cfg, timer_pwm_cfg_t::pwm_high_period, timer_pwm_cfg_t::pwm_period, TIMER_CC0_CC_PWM_CFG_CC_OUT_CCD_0_LOW, TIMER_CC0_CC_PWM_CFG_CC_OUT_CCU_0_HIGH, TIMER_CC0_CC_PWM_CFG_CC_OUT_CCU_0_LOW, TIMER_CC0_CC_PWM_CFG_CC_OUT_LOAD_0_HIGH, TIMER_CC0_CC_PWM_CFG_CC_OUT_ZERO_0_HIGH, TIMER_CTR_CTL_COUNT_MODE_DOWN, TIMER_CTR_CTL_COUNT_MODE_UP, TIMER_PWM_OUTPUT_CHANNEL_ACTION_CFG_DEFAULT, timer_set_capture_channel_ctrl(), timer_set_clk_cfg(), timer_set_compare_val(), timer_set_counter_ctrl(), timer_set_load_val(), timer_set_output_channel_cfg(), timer_set_pwm_output_channel_action_cfg(), and timer_pwm_output_channel_action_cfg_t::zero_act.
void timer_set_pwm_output_channel_action_cfg | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_pwm_output_channel_action_cfg_t * | pwm_act_cfg, | ||
uint8_t | chan_num ) |
timer_set_pwm_output_channel_action_cfg
References TIMER_REGS_s::CC0_CC_PWM_CFG, TIMER_REGS_s::CC1_CC_PWM_CFG, TIMER_REGS_s::CC2_CC_PWM_CFG, timer_pwm_output_channel_action_cfg_t::cc2d_act, timer_pwm_output_channel_action_cfg_t::cc2u_act, TIMER_REGS_s::CC3_CC_PWM_CFG, timer_pwm_output_channel_action_cfg_t::ccd_act, timer_pwm_output_channel_action_cfg_t::ccu_act, timer_pwm_output_channel_action_cfg_t::load_act, and timer_pwm_output_channel_action_cfg_t::zero_act.
Referenced by timer_set_pwm_cfg().
void timer_set_capture_channel_ctrl | ( | TIMER_REGS_s * | TIMER_REGS, |
timer_capture_channel_ctrl_t * | cap_chan_ctrl, | ||
uint8_t | chan_num ) |
timer_set_capture_channel_ctrl Sets the conditions for a specific channel to control the timer counter
References timer_capture_channel_ctrl_t::adv_cond, timer_capture_channel_ctrl_t::cap_cond, TIMER_REGS_s::CC0_CAPTURE_CTRL, TIMER_REGS_s::CC1_CAPTURE_CTRL, TIMER_REGS_s::CC2_CAPTURE_CTRL, TIMER_REGS_s::CC3_CAPTURE_CTRL, timer_capture_channel_ctrl_t::load_cond, and timer_capture_channel_ctrl_t::zero_cond.
Referenced by timer_set_pwm_cfg().