FD32M0P Microcontroller SDK
Loading...
Searching...
No Matches
timer.c File Reference
#include "timer.h"
Include dependency graph for timer.c:

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_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)
void timer_set_pwm_cfg (TIMER_REGS_s *TIMER_REGS, timer_clk_cfg_t *clk_cfg, timer_pwm_cfg_t *pwm_cfg)

Function Documentation

◆ timer_set_clk_cfg()

void timer_set_clk_cfg ( TIMER_REGS_s * TIMER_REGS,
timer_clk_cfg_t * clk_cfg )

This function sets the clock configuration.

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().

Here is the caller graph for this function:

◆ timer_clk_enable()

void timer_clk_enable ( TIMER_REGS_s * TIMER_REGS)

This function enables the timer clock.

timer_clk_enable

References TIMER_REGS_s::CLK_CTRL.

Referenced by timer_delay_in_ms(), timer_delay_in_us(), and timer_set_init_cfg().

Here is the caller graph for this function:

◆ timer_clk_disable()

void timer_clk_disable ( TIMER_REGS_s * TIMER_REGS)

This function disables the timer clock.

timer_clk_disable

References TIMER_REGS_s::CLK_CTRL.

Referenced by timer_delay_in_ms().

Here is the caller graph for this function:

◆ timer_set_load_val()

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_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().

Here is the caller graph for this function:

◆ timer_set_counter_val()

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_set_counter_val

References TIMER_REGS_s::CTR_VAL.

◆ timer_set_counter_ctrl()

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_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().

Here is the caller graph for this function:

◆ timer_set_repeat_counter_val()

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_set_repeat_counter_val

References TIMER_REGS_s::RCTR_VAL.

◆ timer_start()

void timer_start ( TIMER_REGS_s * TIMER_REGS)

This function starts the timer counter.

timer_start

References TIMER_REGS_s::CTR_CTL.

Referenced by timer_delay_in_ms(), timer_delay_in_us(), and timer_set_init_cfg().

Here is the caller graph for this function:

◆ timer_stop()

void timer_stop ( TIMER_REGS_s * TIMER_REGS)

This function stops the timer counter.

timer_stop

References TIMER_REGS_s::CTR_CTL.

◆ timer_set_input_channel_cfg()

◆ timer_set_output_channel_cfg()

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_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().

Here is the caller graph for this function:

◆ timer_set_init_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_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().

Here is the call graph for this function:

◆ timer_delay_in_us()

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_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().

Here is the call graph for this function:

◆ timer_delay_in_ms()

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_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().

Here is the call graph for this function:

◆ timer_set_compare_val()

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().

Here is the caller graph for this function:

◆ timer_set_pwm_output_channel_action_cfg()

◆ timer_set_capture_channel_ctrl()

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_pwm_cfg()