APM:Libraries
|
timer interface. More...
Go to the source code of this file.
Classes | |
struct | TimerState |
struct | TIM_DMA |
struct | Timer_dev |
Typedefs | |
typedef enum timer_type | timer_type |
Timer type. More... | |
typedef void(* | TimerHandler) (TIM_TypeDef *tim) |
typedef enum timer_mode | timer_mode |
typedef enum timer_Channel | timer_Channel |
typedef enum timer_interrupt_id | timer_interrupt_id |
Timer interrupt number. More... | |
typedef enum timer_oc_mode | timer_oc_mode |
typedef enum timer_ic_mode | timer_ic_mode |
typedef enum Timer_cc_Polarity | timer_cc_polarity |
typedef enum timer_oc_mode_flags | timer_oc_mode_flags |
typedef struct TimerState | timerState |
typedef struct TIM_DMA | Tim_dma |
typedef struct Timer_dev | timer_dev |
typedef enum timer_dma_base_addr | timer_dma_base_addr |
Timer DMA base address. More... | |
Functions | |
void | TIM2_IRQHandler (void) |
void | TIM3_IRQHandler (void) |
void | TIM4_IRQHandler (void) |
void | TIM5_IRQHandler (void) |
void | TIM6_IRQHandler (void) |
void | TIM7_IRQHandler (void) |
void | TIM8_IRQHandler (void) |
void | timer_init (const timer_dev *dev) |
void | timer_reset (const timer_dev *dev) |
void | timer_disable (const timer_dev *dev) |
Disable a timer. More... | |
void | timer_set_mode (const timer_dev *dev, timer_Channel channel, timer_mode mode) |
void | timer_foreach (void(*fn)(const timer_dev *)) |
Call a function on timer devices. More... | |
void | timer_attach_interrupt (const timer_dev *dev, uint8_t interrupt, Handler handler, uint8_t priority) |
void | timer_detach_interrupt (const timer_dev *dev, uint8_t interrupt) |
void | timer_attach_all_interrupts (const timer_dev *dev, Handler handler) |
uint32_t | configTimeBase (const timer_dev *dev, uint16_t period, uint16_t khz) |
void | timer_enable_NVICirq (const timer_dev *dev, uint8_t interrupt, uint8_t priority) |
void | timer_disable_NVICirq (const timer_dev *dev, uint8_t interrupt) |
static INLINE uint32_t | get_timer_mask (const timer_dev *dev) |
static void | timer_init_all (void) |
static void | timer_disable_all (void) |
static INLINE void | timer_pause (const timer_dev *dev) |
Stop a timer's counter from changing. More... | |
static INLINE void | timer_resume (const timer_dev *dev) |
Start a timer's counter. More... | |
static INLINE uint16_t | timer_get_count (const timer_dev *dev) |
Returns the timer's counter value. More... | |
static INLINE uint32_t | timer_get_count32 (const timer_dev *dev) |
static INLINE void | timer_set_count (const timer_dev *dev, uint16_t value) |
Sets the counter value for the given timer. More... | |
static uint16_t | timer_get_prescaler (const timer_dev *dev) |
Returns the given timer's prescaler. More... | |
static void | timer_set_prescaler (const timer_dev *dev, uint16_t psc) |
Set a timer's prescale value. More... | |
static uint16_t | timer_get_reload (const timer_dev *dev) |
Returns a timer's reload value. More... | |
static INLINE void | timer_set_reload (const timer_dev *dev, uint32_t arr) |
Set a timer's reload value. More... | |
static uint16_t | timer_get_compare (const timer_dev *dev, timer_Channel channel) |
Get the compare value for the given timer channel. More... | |
static void | timer_set_compare (const timer_dev *dev, timer_Channel channel, uint16_t value) |
Set the compare value for the given timer channel. More... | |
static INLINE uint16_t | timer_get_capture (const timer_dev *dev, timer_Channel channel) |
static void | timer_generate_update (const timer_dev *dev) |
Generate an update event for the given timer. More... | |
static void | timer_dma_enable_trg_req (const timer_dev *dev) |
Enable a timer's trigger DMA request. More... | |
static void | timer_dma_disable_trg_req (const timer_dev *dev) |
Disable a timer's trigger DMA request. More... | |
static void | timer_dma_enable_req (const timer_dev *dev, timer_Channel channel) |
Enable a timer channel's DMA request. More... | |
static void | timer_dma_disable_req (const timer_dev *dev, timer_Channel channel) |
Disable a timer channel's DMA request. More... | |
static void | timer_cc_enable (const timer_dev *dev, timer_Channel channel) |
Enable a timer channel's capture/compare signal. More... | |
static void | timer_cc_disable (const timer_dev *dev, timer_Channel channel) |
Disable a timer channel's output compare or input capture signal. More... | |
static timer_cc_polarity | timer_cc_get_pol (const timer_dev *dev, timer_Channel channel) |
Get a channel's capture/compare output polarity. More... | |
static void | timer_cc_set_pol (const timer_dev *dev, timer_Channel channel, timer_cc_polarity pol) |
Set a timer channel's capture/compare output polarity. More... | |
static uint8_t | timer_dma_get_burst_len (const timer_dev *dev) |
Get a timer's DMA burst length. More... | |
static void | timer_dma_set_burst_len (const timer_dev *dev, uint8_t length) |
Set a timer's DMA burst length. More... | |
static timer_dma_base_addr | timer_dma_get_base_addr (const timer_dev *dev) |
Get the timer's DMA base address. More... | |
static void | timer_dma_set_base_addr (const timer_dev *dev, timer_dma_base_addr dma_base) |
Set the timer's DMA base address. More... | |
static void | timer_oc_set_mode (const timer_dev *dev, timer_Channel _channel, timer_oc_mode mode, uint8_t flags) |
Configure a channel's output compare mode. More... | |
static void | timer_ic_set_mode (const timer_dev *dev, timer_Channel _channel, uint8_t mode, uint16_t filter) |
Configure a channel's input capture mode. More... | |
static void | timer_enable_irq (const timer_dev *dev, timer_interrupt_id interrupt) |
Enable a timer interrupt. More... | |
static void | timer_disable_irq (const timer_dev *dev, timer_interrupt_id interrupt) |
Disable a timer interrupt. More... | |
Variables | |
const timer_dev | timers [] |
timer interface.
based on timer's code from LeafLabs by Marti Bolivar mboli var@ leafl abs. com
Definition in file timer.h.
#define BOARD_PWM_MODE TIM_OCMode_PWM1 |
Definition at line 45 of file timer.h.
Referenced by pwm_mode().
#define TIMER1 (&timer1) |
Definition at line 609 of file timer.h.
Referenced by TIM1_BRK_TIM9_IRQHandler(), TIM1_CC_IRQHandler(), TIM1_TRG_COM_TIM11_IRQHandler(), and TIM1_UP_TIM10_IRQHandler().
#define TIMER10 (&timer10) |
Definition at line 618 of file timer.h.
Referenced by TIM1_UP_TIM10_IRQHandler().
#define TIMER11 (&timer11) |
Definition at line 619 of file timer.h.
Referenced by TIM1_TRG_COM_TIM11_IRQHandler().
#define TIMER12 (&timer12) |
Definition at line 620 of file timer.h.
Referenced by TIM8_BRK_TIM12_IRQHandler().
#define TIMER13 (&timer13) |
Definition at line 621 of file timer.h.
Referenced by F4Light::Scheduler::do_io_completion(), F4Light::Scheduler::init(), and TIM8_UP_TIM13_IRQHandler().
#define TIMER14 (&timer14) |
Definition at line 622 of file timer.h.
Referenced by F4Light::Scheduler::_tail_timer_event(), F4Light::Scheduler::context_switch_isr(), F4Light::Scheduler::get_next_task(), F4Light::Scheduler::init(), F4Light::Scheduler::SVC_Handler(), F4Light::Scheduler::switch_task(), and TIM8_TRG_COM_TIM14_IRQHandler().
#define TIMER2 (&timer2) |
Definition at line 610 of file timer.h.
Referenced by F4Light::RCOutput::_set_output_mode(), and TIM2_IRQHandler().
#define TIMER3 (&timer3) |
Definition at line 611 of file timer.h.
Referenced by F4Light::RCOutput::_set_output_mode(), and TIM3_IRQHandler().
#define TIMER4 (&timer4) |
Definition at line 612 of file timer.h.
Referenced by TIM4_IRQHandler().
#define TIMER5 (&timer5) |
Definition at line 613 of file timer.h.
Referenced by F4Light::Scheduler::_micros(), F4Light::Scheduler::init(), micros(), and TIM5_IRQHandler().
#define TIMER6 (&timer6) |
Definition at line 614 of file timer.h.
Referenced by idle_task(), F4Light::Scheduler::init(), and TIM6_DAC_IRQHandler().
#define TIMER7 (&timer7) |
Definition at line 615 of file timer.h.
Referenced by F4Light::Scheduler::_tail_timer_event(), F4Light::Scheduler::init(), F4Light::Scheduler::SVC_Handler(), F4Light::Scheduler::switch_task(), and TIM7_IRQHandler().
#define TIMER8 (&timer8) |
Definition at line 616 of file timer.h.
Referenced by TIM8_BRK_TIM12_IRQHandler(), TIM8_CC_IRQHandler(), TIM8_TRG_COM_TIM14_IRQHandler(), and TIM8_UP_TIM13_IRQHandler().
#define TIMER9 (&timer9) |
Definition at line 617 of file timer.h.
Referenced by TIM1_BRK_TIM9_IRQHandler().
#define TIMER_BDTR_AOE BIT(TIMER_BDTR_AOE_BIT) |
#define TIMER_BDTR_BKE BIT(TIMER_BDTR_BKE_BIT) |
#define TIMER_BDTR_BKP BIT(TIMER_BDTR_BKP_BIT) |
#define TIMER_BDTR_LOCK_OFF (0x0 << 8) |
Definition at line 363 of file timer.h.
Referenced by configTimeBase().
#define TIMER_BDTR_MOE BIT(TIMER_BDTR_MOE_BIT) |
Definition at line 356 of file timer.h.
Referenced by configTimeBase().
#define TIMER_BDTR_OSSI BIT(TIMER_BDTR_OSSI_BIT) |
#define TIMER_BDTR_OSSR BIT(TIMER_BDTR_OSSR_BIT) |
#define TIMER_CCER_CC1E BIT(TIMER_CCER_CC1E_BIT) |
#define TIMER_CCER_CC1NE BIT(TIMER_CCER_CC1NE_BIT) |
#define TIMER_CCER_CC1NP BIT(TIMER_CCER_CC1NP_BIT) |
#define TIMER_CCER_CC1P BIT(TIMER_CCER_CC1P_BIT) |
#define TIMER_CCER_CC2E BIT(TIMER_CCER_CC2E_BIT) |
#define TIMER_CCER_CC2NE BIT(TIMER_CCER_CC2NE_BIT) |
#define TIMER_CCER_CC2NP BIT(TIMER_CCER_CC2NP_BIT) |
#define TIMER_CCER_CC2P BIT(TIMER_CCER_CC2P_BIT) |
#define TIMER_CCER_CC3E BIT(TIMER_CCER_CC3E_BIT) |
#define TIMER_CCER_CC3NE BIT(TIMER_CCER_CC3NE_BIT) |
#define TIMER_CCER_CC3NP BIT(TIMER_CCER_CC3NP_BIT) |
#define TIMER_CCER_CC3P BIT(TIMER_CCER_CC3P_BIT) |
#define TIMER_CCER_CC4E BIT(TIMER_CCER_CC4E_BIT) |
#define TIMER_CCER_CC4P BIT(TIMER_CCER_CC4P_BIT) |
#define TIMER_CCMR1_CC1S_INPUT_TI1 TIMER_CCMR_CCS_INPUT_TI1 |
#define TIMER_CCMR1_CC1S_INPUT_TI2 TIMER_CCMR_CCS_INPUT_TI2 |
#define TIMER_CCMR1_CC1S_INPUT_TRC TIMER_CCMR_CCS_INPUT_TRC |
#define TIMER_CCMR1_CC1S_OUTPUT TIMER_CCMR_CCS_OUTPUT |
#define TIMER_CCMR1_CC2S_INPUT_TI1 (TIMER_CCMR_CCS_INPUT_TI1 << 8) |
#define TIMER_CCMR1_CC2S_INPUT_TI2 (TIMER_CCMR_CCS_INPUT_TI2 << 8) |
#define TIMER_CCMR1_CC2S_INPUT_TRC (TIMER_CCMR_CCS_INPUT_TRC << 8) |
#define TIMER_CCMR1_CC2S_OUTPUT (TIMER_CCMR_CCS_OUTPUT << 8) |
#define TIMER_CCMR1_CC3S_INPUT_TI1 TIMER_CCMR_CCS_INPUT_TI1 |
#define TIMER_CCMR1_CC3S_INPUT_TI2 TIMER_CCMR_CCS_INPUT_TI2 |
#define TIMER_CCMR1_CC3S_INPUT_TRC TIMER_CCMR_CCS_INPUT_TRC |
#define TIMER_CCMR1_CC3S_OUTPUT TIMER_CCMR_CCS_OUTPUT |
#define TIMER_CCMR1_CC4S_INPUT_TI1 (TIMER_CCMR_CCS_INPUT_TI1 << 8) |
#define TIMER_CCMR1_CC4S_INPUT_TI2 (TIMER_CCMR_CCS_INPUT_TI2 << 8) |
#define TIMER_CCMR1_CC4S_INPUT_TRC (TIMER_CCMR_CCS_INPUT_TRC << 8) |
#define TIMER_CCMR1_CC4S_OUTPUT (TIMER_CCMR_CCS_OUTPUT << 8) |
#define TIMER_CCMR1_OC1CE BIT(TIMER_CCMR1_OC1CE_BIT) |
#define TIMER_CCMR1_OC1FE BIT(TIMER_CCMR1_OC1FE_BIT) |
#define TIMER_CCMR1_OC1PE BIT(TIMER_CCMR1_OC1PE_BIT) |
#define TIMER_CCMR1_OC2CE BIT(TIMER_CCMR1_OC2CE_BIT) |
#define TIMER_CCMR1_OC2FE BIT(TIMER_CCMR1_OC2FE_BIT) |
#define TIMER_CCMR1_OC2PE BIT(TIMER_CCMR1_OC2PE_BIT) |
#define TIMER_CCMR2_OC3CE BIT(TIMER_CCMR2_OC3CE_BIT) |
#define TIMER_CCMR2_OC3FE BIT(TIMER_CCMR2_OC3FE_BIT) |
#define TIMER_CCMR2_OC3PE BIT(TIMER_CCMR2_OC3PE_BIT) |
#define TIMER_CCMR2_OC4CE BIT(TIMER_CCMR2_OC4CE_BIT) |
#define TIMER_CCMR2_OC4FE BIT(TIMER_CCMR2_OC4FE_BIT) |
#define TIMER_CCMR2_OC4PE BIT(TIMER_CCMR2_OC4PE_BIT) |
#define TIMER_CCMR_CCS_OUTPUT 0x0 |
Definition at line 245 of file timer.h.
Referenced by timer_oc_set_mode().
#define TIMER_CH_MASK 7 |
Definition at line 455 of file timer.h.
Referenced by pwmIRQHandler(), timer_cc_disable(), timer_cc_enable(), timer_cc_get_pol(), timer_cc_set_pol(), timer_disable_irq(), timer_dma_disable_req(), timer_dma_enable_req(), timer_enable_irq(), timer_get_capture(), timer_get_compare(), timer_ic_set_mode(), timer_oc_set_mode(), and timer_set_compare().
#define TIMER_CR1_ARPE BIT(TIMER_CR1_ARPE_BIT) |
Definition at line 90 of file timer.h.
Referenced by configTimeBase(), and F4Light::Scheduler::init().
#define TIMER_CR1_CEN BIT(TIMER_CR1_CEN_BIT) |
#define TIMER_CR1_CEN_BIT 0 |
Definition at line 84 of file timer.h.
Referenced by timer_pause(), and timer_resume().
#define TIMER_CR1_DIR BIT(TIMER_CR1_DIR_BIT) |
#define TIMER_CR1_OPM BIT(TIMER_CR1_OPM_BIT) |
#define TIMER_CR1_UDIS BIT(TIMER_CR1_UDIS_BIT) |
#define TIMER_CR1_URS BIT(TIMER_CR1_URS_BIT) |
Definition at line 98 of file timer.h.
Referenced by F4Light::Scheduler::init().
#define TIMER_CR2_CCDS BIT(TIMER_CR2_CCDS_BIT) |
#define TIMER_CR2_CCPC BIT(TIMER_CR2_CCPC_BIT) |
#define TIMER_CR2_CCUS BIT(TIMER_CR2_CCUS_BIT) |
#define TIMER_CR2_OIS1 BIT(TIMER_CR2_OIS1_BIT) |
#define TIMER_CR2_OIS1N BIT(TIMER_CR2_OIS1N_BIT) |
#define TIMER_CR2_OIS2 BIT(TIMER_CR2_OIS2_BIT) |
#define TIMER_CR2_OIS2N BIT(TIMER_CR2_OIS2N_BIT) |
#define TIMER_CR2_OIS3 BIT(TIMER_CR2_OIS3_BIT) |
#define TIMER_CR2_OIS3N BIT(TIMER_CR2_OIS3N_BIT) |
#define TIMER_CR2_OIS4 BIT(TIMER_CR2_OIS4_BIT) |
#define TIMER_CR2_TI1S BIT(TIMER_CR2_TI1S_BIT) |
#define TIMER_DCR_DBA 0x1F |
Definition at line 390 of file timer.h.
Referenced by timer_dma_get_base_addr(), and timer_dma_set_base_addr().
#define TIMER_DCR_DBL (0x1F << 8) |
Definition at line 371 of file timer.h.
Referenced by timer_dma_get_burst_len(), and timer_dma_set_burst_len().
#define TIMER_DIER_CC1DE BIT(TIMER_DIER_CC1DE_BIT) |
#define TIMER_DIER_CC1IE BIT(TIMER_DIER_CC1IE_BIT) |
#define TIMER_DIER_CC2DE BIT(TIMER_DIER_CC2DE_BIT) |
#define TIMER_DIER_CC2IE BIT(TIMER_DIER_CC2IE_BIT) |
#define TIMER_DIER_CC3DE BIT(TIMER_DIER_CC3DE_BIT) |
#define TIMER_DIER_CC3IE BIT(TIMER_DIER_CC3IE_BIT) |
#define TIMER_DIER_CC4DE BIT(TIMER_DIER_CC4DE_BIT) |
#define TIMER_DIER_CC4IE BIT(TIMER_DIER_CC4IE_BIT) |
#define TIMER_DIER_TDE BIT(TIMER_DIER_TDE_BIT) |
#define TIMER_DIER_TDE_BIT 14 |
Definition at line 173 of file timer.h.
Referenced by timer_dma_disable_trg_req(), and timer_dma_enable_trg_req().
#define TIMER_DIER_TIE BIT(TIMER_DIER_TIE_BIT) |
#define TIMER_DIER_UDE BIT(TIMER_DIER_UDE_BIT) |
#define TIMER_DIER_UIE BIT(TIMER_DIER_UIE_BIT) |
#define TIMER_EGR_CC1G BIT(TIMER_EGR_CC1G_BIT) |
#define TIMER_EGR_CC2G BIT(TIMER_EGR_CC2G_BIT) |
#define TIMER_EGR_CC3G BIT(TIMER_EGR_CC3G_BIT) |
#define TIMER_EGR_CC4G BIT(TIMER_EGR_CC4G_BIT) |
#define TIMER_EGR_TG BIT(TIMER_EGR_TG_BIT) |
#define TIMER_EGR_UG BIT(TIMER_EGR_UG_BIT) |
Definition at line 241 of file timer.h.
Referenced by configTimeBase().
#define TIMER_EGR_UG_BIT 0 |
Definition at line 234 of file timer.h.
Referenced by timer_generate_update().
#define TIMER_SMCR_ECE BIT(TIMER_SMCR_ECE_BIT) |
#define TIMER_SMCR_ETP BIT(TIMER_SMCR_ETP_BIT) |
#define TIMER_SMCR_MSM BIT(TIMER_SMCR_MSM_BIT) |
#define TIMER_SR_BIF BIT(TIMER_SR_BIF_BIT) |
Definition at line 218 of file timer.h.
Referenced by dispatch_adv_brk().
#define TIMER_SR_CC1IF BIT(TIMER_SR_CC1IF_BIT) |
Definition at line 224 of file timer.h.
Referenced by dispatch_adv_cc(), dispatch_general(), and dispatch_general_h().
#define TIMER_SR_CC1OF BIT(TIMER_SR_CC1OF_BIT) |
#define TIMER_SR_CC2IF BIT(TIMER_SR_CC2IF_BIT) |
Definition at line 223 of file timer.h.
Referenced by dispatch_adv_cc(), dispatch_general(), and dispatch_general_h().
#define TIMER_SR_CC2OF BIT(TIMER_SR_CC2OF_BIT) |
#define TIMER_SR_CC3IF BIT(TIMER_SR_CC3IF_BIT) |
Definition at line 222 of file timer.h.
Referenced by dispatch_adv_cc(), and dispatch_general().
#define TIMER_SR_CC3OF BIT(TIMER_SR_CC3OF_BIT) |
#define TIMER_SR_CC4IF BIT(TIMER_SR_CC4IF_BIT) |
Definition at line 221 of file timer.h.
Referenced by dispatch_adv_cc(), and dispatch_general().
#define TIMER_SR_CC4OF BIT(TIMER_SR_CC4OF_BIT) |
#define TIMER_SR_COMIF BIT(TIMER_SR_COMIF_BIT) |
Definition at line 220 of file timer.h.
Referenced by dispatch_adv_trg_com().
#define TIMER_SR_TIF BIT(TIMER_SR_TIF_BIT) |
Definition at line 219 of file timer.h.
Referenced by dispatch_adv_trg_com(), dispatch_general(), and dispatch_general_h().
#define TIMER_SR_UIF BIT(TIMER_SR_UIF_BIT) |
Definition at line 225 of file timer.h.
Referenced by dispatch_adv_up(), dispatch_basic(), dispatch_general(), dispatch_general_h(), and idle_task().
typedef enum Timer_cc_Polarity timer_cc_polarity |
typedef enum timer_Channel timer_Channel |
Timer channel numbers
typedef enum timer_dma_base_addr timer_dma_base_addr |
Timer DMA base address.
Defines the base address for DMA transfers.
typedef enum timer_ic_mode timer_ic_mode |
typedef enum timer_interrupt_id timer_interrupt_id |
Timer interrupt number.
Not all timers support all of these values; see the descriptions for each value.
typedef enum timer_mode timer_mode |
Used to configure the behavior of a timer channel. Note that not all timers can be configured in every mode.
typedef enum timer_oc_mode timer_oc_mode |
typedef enum timer_oc_mode_flags timer_oc_mode_flags |
Timer output compare mode flags.
typedef enum timer_type timer_type |
typedef struct TimerState timerState |
anonymous enum |
enum Timer_cc_Polarity |
enum timer_Channel |
enum timer_dma_base_addr |
Timer DMA base address.
Defines the base address for DMA transfers.
enum timer_ic_mode |
enum timer_interrupt_id |
Timer interrupt number.
Not all timers support all of these values; see the descriptions for each value.
enum timer_mode |
Used to configure the behavior of a timer channel. Note that not all timers can be configured in every mode.
enum timer_oc_mode |
enum timer_oc_mode_flags |
Timer output compare mode flags.
Enumerator | |
---|---|
TIMER_OC_CE | Output compare clear enable. |
TIMER_OC_PE | Output compare preload enable. |
TIMER_OC_FE | Output compare fast enable. |
enum timer_type |
uint32_t configTimeBase | ( | const timer_dev * | dev, |
uint16_t | period, | ||
uint16_t | khz | ||
) |
Definition at line 357 of file timer.c.
Referenced by F4Light::RCOutput::_set_output_mode(), F4Light::RCOutput::_set_pin_output_mode(), Soft_I2C::_start(), F4Light::Scheduler::init(), pwmInitializeInput(), and F4Light::GPIO::write().
Definition at line 651 of file timer.h.
Referenced by configTimeBase().
void TIM2_IRQHandler | ( | void | ) |
Definition at line 571 of file timer.c.
Referenced by timer_detach_interrupt().
void TIM3_IRQHandler | ( | void | ) |
Definition at line 575 of file timer.c.
Referenced by timer_detach_interrupt().
void TIM4_IRQHandler | ( | void | ) |
Definition at line 579 of file timer.c.
Referenced by timer_detach_interrupt().
void TIM5_IRQHandler | ( | void | ) |
Definition at line 583 of file timer.c.
Referenced by timer_detach_interrupt().
void TIM6_IRQHandler | ( | void | ) |
void TIM7_IRQHandler | ( | void | ) |
Definition at line 591 of file timer.c.
Referenced by timer_detach_interrupt().
void TIM8_IRQHandler | ( | void | ) |
Definition at line 494 of file timer.c.
Referenced by pwmInitializeInput().
void timer_attach_interrupt | ( | const timer_dev * | dev, |
uint8_t | interrupt, | ||
Handler | handler, | ||
uint8_t | priority | ||
) |
|
inlinestatic |
Disable a timer channel's output compare or input capture signal.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel to disable, from 1 to 4. |
Definition at line 891 of file timer.h.
Referenced by disable_channel().
|
inlinestatic |
Enable a timer channel's capture/compare signal.
If the channel is configured as output, the corresponding output compare signal will be output on the corresponding output pin. If the channel is configured as input, enables capture of the counter value into the input capture/compare register.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel to enable, from 1 to 4. |
Definition at line 858 of file timer.h.
Referenced by output_compare_mode(), pwm_mode(), and pwmInitializeInput().
|
inlinestatic |
Get a channel's capture/compare output polarity.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel whose capture/compare output polarity to get. |
Definition at line 925 of file timer.h.
|
inlinestatic |
Set a timer channel's capture/compare output polarity.
If the timer channel is configured as output: polarity == 0 means the output channel will be active high; polarity == 1 means active low.
If the timer channel is configured as input: polarity == 0 means capture is done on the rising edge of ICn; when used as an external trigger, ICn is non-inverted. polarity == 1 means capture is done on the falling edge of ICn; when used as an external trigger, ICn is inverted.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel whose capture/compare output polarity to set. |
pol | New polarity, 0 or 1. |
Definition at line 950 of file timer.h.
Referenced by pwmInitializeInput(), and pwmIRQHandler().
void timer_detach_interrupt | ( | const timer_dev * | dev, |
uint8_t | interrupt | ||
) |
void timer_disable | ( | const timer_dev * | dev | ) |
Disable a timer.
The timer will stop counting, all DMA requests and interrupts will be disabled, and no state changes will be output.
dev | Timer to disable. |
Definition at line 340 of file timer.c.
Referenced by timer_disable_all().
|
inlinestatic |
|
inlinestatic |
Disable a timer interrupt.
dev | Timer device. |
interrupt | Interrupt number to disable; this may be any timer_interrupt_id value appropriate for the timer. |
Definition at line 1138 of file timer.h.
Referenced by pwm_mode(), and timer_detach_interrupt().
void timer_disable_NVICirq | ( | const timer_dev * | dev, |
uint8_t | interrupt | ||
) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Enable a timer interrupt.
dev | Timer device. |
interrupt | Interrupt number to enable; this may be any timer_interrupt_id value appropriate for the timer. |
Definition at line 1125 of file timer.h.
Referenced by F4Light::Scheduler::init(), pwmInitializeInput(), and timer_attach_interrupt().
void timer_enable_NVICirq | ( | const timer_dev * | dev, |
uint8_t | interrupt, | ||
uint8_t | priority | ||
) |
Definition at line 845 of file timer.c.
Referenced by pwmInitializeInput().
void timer_foreach | ( | void(*)(const timer_dev *) | fn | ) |
Call a function on timer devices.
fn | Function to call on each timer device. |
Definition at line 468 of file timer.c.
Referenced by F4Light::Scheduler::init(), timer_disable_all(), and timer_init_all().
|
inlinestatic |
Generate an update event for the given timer.
Normally, this will cause the prescaler and auto-reload values in the PSC and ARR registers to take immediate effect. However, this function will do nothing if the UDIS bit is set in the timer's CR1 register (UDIS is cleared by default).
dev | Timer device to generate an update for. |
Definition at line 807 of file timer.h.
Referenced by Soft_I2C::_start(), F4Light::Scheduler::_tail_timer_event(), F4Light::Scheduler::context_switch_isr(), F4Light::Scheduler::do_io_completion(), F4Light::RCOutput::push(), F4Light::Scheduler::SVC_Handler(), and F4Light::Scheduler::switch_task().
|
static |
Definition at line 791 of file timer.h.
Referenced by pwmIRQHandler().
|
inlinestatic |
Definition at line 706 of file timer.h.
Referenced by F4Light::Scheduler::_micros(), and micros().
|
inlinestatic |
Returns the given timer's prescaler.
Note that if the timer's prescaler is set (e.g. via timer_set_prescaler() or accessing a TIMx_PSC register), the value returned by this function will reflect the new setting, but the timer's counter will only reflect the new prescaler at the next update event.
dev | Timer whose prescaler to return |
|
inlinestatic |
Returns a timer's reload value.
dev | Timer whose reload value to return |
Definition at line 753 of file timer.h.
Referenced by F4Light::RCOutput::get_freq().
|
inlinestatic |
Configure a channel's input capture mode.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel to configure in input capture mode. |
mode | Timer mode to set. |
flags | OR of timer_ic_mode_flags. |
Definition at line 1096 of file timer.h.
Referenced by pwmInitializeInput().
void timer_init | ( | const timer_dev * | dev | ) |
Initialize a timer (enable timer clock)
dev | Timer to initialize |
Definition at line 303 of file timer.c.
Referenced by configTimeBase(), and timer_init_all().
|
inlinestatic |
|
inlinestatic |
Configure a channel's output compare mode.
Timer output compare modes.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel to configure in output compare mode. |
mode | Timer mode to set. |
flags | OR of timer_oc_mode_flags. |
Definition at line 1065 of file timer.h.
Referenced by output_compare_mode(), and pwm_mode().
Stop a timer's counter from changing.
Does not affect the timer's mode or other settings.
dev | Device whose counter to pause. |
Definition at line 679 of file timer.h.
Referenced by F4Light::Scheduler::_tail_timer_event(), configTimeBase(), pwmInitializeInput(), F4Light::Scheduler::SVC_Handler(), F4Light::Scheduler::switch_task(), Soft_I2C::tick(), and Soft_I2C::wait_done().
void timer_reset | ( | const timer_dev * | dev | ) |
Initialize a timer, and reset its register map.
dev | Timer to initialize |
Definition at line 316 of file timer.c.
Referenced by F4Light::Scheduler::init().
Start a timer's counter.
Does not affect the timer's mode or other settings.
dev | Device whose counter to resume |
Definition at line 690 of file timer.h.
Referenced by F4Light::RCOutput::_set_output_mode(), Soft_I2C::_start(), F4Light::RCOutput::enable_ch(), F4Light::Scheduler::get_next_task(), F4Light::Scheduler::init(), pwmInitializeInput(), and Soft_I2C::wait_done().
|
inlinestatic |
Set the compare value for the given timer channel.
dev | Timer device, must have type TIMER_ADVANCED or TIMER_GENERAL. |
channel | Channel whose compare value to set. |
value | New compare value. |
Definition at line 783 of file timer.h.
Referenced by F4Light::RCOutput::init_channel(), F4Light::RCOutput::push(), F4Light::RCOutput::set_pwm(), and F4Light::GPIO::write().
Sets the counter value for the given timer.
dev | Timer whose counter to set |
value | New counter value |
Definition at line 715 of file timer.h.
Referenced by configTimeBase(), F4Light::Scheduler::get_next_task(), and F4Light::Scheduler::init().
void timer_set_mode | ( | const timer_dev * | dev, |
timer_Channel | channel, | ||
timer_mode | mode | ||
) |
Sets the mode of an individual timer channel.
Note that not all timers can be configured in every mode. For example, basic timers cannot be configured to output compare mode. Be sure to use a timer which is appropriate for the mode you want.
dev | Timer whose channel mode to set |
channel | Relevant channel |
mode | New timer mode for channel |
Definition at line 442 of file timer.c.
Referenced by F4Light::GPIO::_pinMode(), and F4Light::RCOutput::init_channel().
|
inlinestatic |
Set a timer's prescale value.
Divides the input clock by (PSC+1). The new value will not take effect until the next update event.
dev | Timer whose prescaler to set |
psc | New prescaler value |
Set a timer's reload value.
dev | Timer whose reload value to set |
arr | New reload value to use. Takes effect at next update event. |
Definition at line 763 of file timer.h.
Referenced by Soft_I2C::_start(), F4Light::Scheduler::get_next_task(), F4Light::Scheduler::init(), F4Light::RCOutput::init_channel(), F4Light::RCOutput::set_freq(), and F4Light::GPIO::write().
const timer_dev timers[] |
Definition at line 75 of file timer.c.
Referenced by timer_foreach().