Classes | Macros | Typedefs | Enumerations | Functions | Variables
drv_timer.c File Reference
#include <stdbool.h>
#include "stm32f10x_conf.h"
#include "core_cm3.h"
#include "drv_timer.h"
#include "drv_gpio.h"
Include dependency graph for drv_timer.c:

Go to the source code of this file.

Classes

struct  channelConfig_s
 
struct  timerConfig_s
 

Macros

#define CC_CHANNELS_PER_TIMER   4
 

Typedefs

typedef struct channelConfig_s channelConfig_t
 
typedef struct timerConfig_s timerConfig_t
 

Enumerations

enum  {
  TIM1_IDX = 0, TIM2_IDX, TIM3_IDX, TIM4_IDX,
  MAX_TIMERS
}
 

Functions

void configTimeBase (TIM_TypeDef *tim, uint16_t period, uint8_t mhz)
 
void configureTimerCaptureCompareInterrupt (const timerHardware_t *timerHardwarePtr, uint8_t reference, timerCCCallbackPtr *callback)
 
void configureTimerChannelCallback (TIM_TypeDef *tim, uint8_t channel, uint8_t reference, timerCCCallbackPtr *callback)
 
void configureTimerInputCaptureCompareChannel (TIM_TypeDef *tim, const uint8_t channel)
 
static timerConfig_tfindTimerConfig (unsigned int timerIndex, unsigned int channelIndex)
 
static int lookupChannelIndex (const int channel)
 
static int lookupTimerIndex (const TIM_TypeDef *tim)
 
void TIM1_CC_IRQHandler (void)
 
void TIM2_IRQHandler (void)
 
void TIM3_IRQHandler (void)
 
void TIM4_IRQHandler (void)
 
static void timCCxHandler (TIM_TypeDef *const tim, unsigned int timerIndex)
 
void timerConfigure (const timerHardware_t *timerHardwarePtr, uint16_t period, uint8_t mhz)
 
void timerNVICConfigure (uint8_t irq)
 

Variables

static const channelConfig_t channels [CC_CHANNELS_PER_TIMER]
 
timerConfig_t timerConfigs [MAX_TIMERS][CC_CHANNELS_PER_TIMER]
 
const timerHardware_t timerHardware []
 
static const TIM_TypeDef *const timers [MAX_TIMERS]
 

Macro Definition Documentation

#define CC_CHANNELS_PER_TIMER   4

Definition at line 99 of file drv_timer.c.

Typedef Documentation

typedef struct timerConfig_s timerConfig_t

Enumeration Type Documentation

anonymous enum
Enumerator
TIM1_IDX 
TIM2_IDX 
TIM3_IDX 
TIM4_IDX 
MAX_TIMERS 

Definition at line 91 of file drv_timer.c.

Function Documentation

void configTimeBase ( TIM_TypeDef tim,
uint16_t  period,
uint8_t  mhz 
)

Definition at line 198 of file drv_timer.c.

void configureTimerCaptureCompareInterrupt ( const timerHardware_t timerHardwarePtr,
uint8_t  reference,
timerCCCallbackPtr callback 
)

Definition at line 181 of file drv_timer.c.

void configureTimerChannelCallback ( TIM_TypeDef tim,
uint8_t  channel,
uint8_t  reference,
timerCCCallbackPtr callback 
)

Definition at line 147 of file drv_timer.c.

void configureTimerInputCaptureCompareChannel ( TIM_TypeDef tim,
const uint8_t  channel 
)

Definition at line 163 of file drv_timer.c.

static timerConfig_t* findTimerConfig ( unsigned int  timerIndex,
unsigned int  channelIndex 
)
static

Definition at line 223 of file drv_timer.c.

static int lookupChannelIndex ( const int  channel)
static

Definition at line 137 of file drv_timer.c.

static int lookupTimerIndex ( const TIM_TypeDef tim)
static

Definition at line 127 of file drv_timer.c.

void TIM1_CC_IRQHandler ( void  )

Definition at line 253 of file drv_timer.c.

void TIM2_IRQHandler ( void  )

Definition at line 258 of file drv_timer.c.

void TIM3_IRQHandler ( void  )

Definition at line 263 of file drv_timer.c.

void TIM4_IRQHandler ( void  )

Definition at line 268 of file drv_timer.c.

static void timCCxHandler ( TIM_TypeDef *const  tim,
unsigned int  timerIndex 
)
static

Definition at line 231 of file drv_timer.c.

void timerConfigure ( const timerHardware_t timerHardwarePtr,
uint16_t  period,
uint8_t  mhz 
)

Definition at line 215 of file drv_timer.c.

void timerNVICConfigure ( uint8_t  irq)

Definition at line 187 of file drv_timer.c.

Variable Documentation

const channelConfig_t channels[CC_CHANNELS_PER_TIMER]
static
Initial value:
= {
}
#define TIM_IT_CC3
uint32_t TIM_GetCapture3(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 3 value.
#define TIM_IT_CC4
uint32_t TIM_GetCapture1(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 1 value.
#define TIM_Channel_3
#define TIM_Channel_2
#define TIM_Channel_4
uint32_t TIM_GetCapture2(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 2 value.
#define TIM_IT_CC1
uint32_t TIM_GetCapture4(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 4 value.
#define TIM_Channel_1
#define TIM_IT_CC2

Definition at line 111 of file drv_timer.c.

Definition at line 125 of file drv_timer.c.

const timerHardware_t timerHardware[]
Initial value:
= {
{ TIM2, GPIOA, Pin_0, TIM_Channel_1, TIM2_IRQn, 0, },
{ TIM2, GPIOA, Pin_1, TIM_Channel_2, TIM2_IRQn, 0, },
{ TIM2, GPIOA, Pin_2, TIM_Channel_3, TIM2_IRQn, 0, },
{ TIM2, GPIOA, Pin_3, TIM_Channel_4, TIM2_IRQn, 0, },
{ TIM3, GPIOA, Pin_6, TIM_Channel_1, TIM3_IRQn, 0, },
{ TIM3, GPIOA, Pin_7, TIM_Channel_2, TIM3_IRQn, 0, },
{ TIM3, GPIOB, Pin_0, TIM_Channel_3, TIM3_IRQn, 0, },
{ TIM3, GPIOB, Pin_1, TIM_Channel_4, TIM3_IRQn, 0, },
{ TIM1, GPIOA, Pin_8, TIM_Channel_1, TIM1_CC_IRQn, 1, },
{ TIM1, GPIOA, Pin_11, TIM_Channel_4, TIM1_CC_IRQn, 1, },
{ TIM4, GPIOB, Pin_6, TIM_Channel_1, TIM4_IRQn, 0, },
{ TIM4, GPIOB, Pin_7, TIM_Channel_2, TIM4_IRQn, 0, },
{ TIM4, GPIOB, Pin_8, TIM_Channel_3, TIM4_IRQn, 0, },
{ TIM4, GPIOB, Pin_9, TIM_Channel_4, TIM4_IRQn, 0, },
}
Definition: drv_gpio.h:44
Definition: drv_gpio.h:50
#define TIM4
Definition: stm32f4xx.h:2039
#define TIM1
Definition: stm32f4xx.h:2078
#define TIM_Channel_3
#define GPIOA
Definition: stm32f4xx.h:2110
#define TIM3
Definition: stm32f4xx.h:2038
#define TIM2
Definition: stm32f4xx.h:2037
#define GPIOB
Definition: stm32f4xx.h:2111
#define TIM_Channel_2
#define TIM_Channel_4
Definition: drv_gpio.h:48
Definition: drv_gpio.h:45
#define TIM_Channel_1
Definition: drv_gpio.h:51
Definition: drv_gpio.h:43
Definition: drv_gpio.h:42
Definition: drv_gpio.h:49

Definition at line 74 of file drv_timer.c.

const TIM_TypeDef* const timers[MAX_TIMERS]
static
Initial value:
= {
}
#define TIM4
Definition: stm32f4xx.h:2039
#define TIM1
Definition: stm32f4xx.h:2078
#define TIM3
Definition: stm32f4xx.h:2038
#define TIM2
Definition: stm32f4xx.h:2037

Definition at line 101 of file drv_timer.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:26