NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
timer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  timerCCHandlerRec_s
 
struct  timerOvrHandlerRec_s
 
struct  timerHardware_s
 

Macros

#define USABLE_TIMER_CHANNEL_COUNT   14
 

Typedefs

typedef uint16_t captureCompare_t
 
typedef void timerCCHandlerCallback (struct timerCCHandlerRec_s *self, uint16_t capture)
 
typedef void timerOvrHandlerCallback (struct timerOvrHandlerRec_s *self, uint16_t capture)
 
typedef struct timerCCHandlerRec_s timerCCHandlerRec_t
 
typedef struct timerOvrHandlerRec_s timerOvrHandlerRec_t
 
typedef struct timerHardware_s timerHardware_t
 

Enumerations

enum  channelType_t {
  TYPE_FREE, TYPE_PWMINPUT, TYPE_PPMINPUT, TYPE_PWMOUTPUT_MOTOR,
  TYPE_PWMOUTPUT_FAST, TYPE_PWMOUTPUT_SERVO, TYPE_SOFTSERIAL_RX, TYPE_SOFTSERIAL_TX,
  TYPE_SOFTSERIAL_RXTX, TYPE_SOFTSERIAL_AUXTIMER, TYPE_ADC, TYPE_SERIAL_RX,
  TYPE_SERIAL_TX, TYPE_SERIAL_RXTX, TYPE_TIMER
}
 

Functions

void timerConfigure (const timerHardware_t *timHw, uint16_t period, uint8_t mhz)
 
void timerChConfigIC (const timerHardware_t *timHw, bool polarityRising, unsigned inputFilterSamples)
 
void timerChConfigICDual (const timerHardware_t *timHw, bool polarityRising, unsigned inputFilterSamples)
 
void timerChICPolarity (const timerHardware_t *timHw, bool polarityRising)
 
volatile timCCR_t * timerChCCR (const timerHardware_t *timHw)
 
volatile timCCR_t * timerChCCRLo (const timerHardware_t *timHw)
 
volatile timCCR_t * timerChCCRHi (const timerHardware_t *timHw)
 
void timerChConfigOC (const timerHardware_t *timHw, bool outEnable, bool stateHigh)
 
void timerChConfigGPIO (const timerHardware_t *timHw, GPIO_Mode mode)
 
void timerChCCHandlerInit (timerCCHandlerRec_t *self, timerCCHandlerCallback *fn)
 
void timerChOvrHandlerInit (timerOvrHandlerRec_t *self, timerOvrHandlerCallback *fn)
 
void timerChConfigCallbacks (const timerHardware_t *channel, timerCCHandlerRec_t *edgeCallback, timerOvrHandlerRec_t *overflowCallback)
 
void timerChConfigCallbacksDual (const timerHardware_t *channel, timerCCHandlerRec_t *edgeCallbackLo, timerCCHandlerRec_t *edgeCallbackHi, timerOvrHandlerRec_t *overflowCallback)
 
void timerChITConfigDualLo (const timerHardware_t *timHw, FunctionalState newState)
 
void timerChITConfig (const timerHardware_t *timHw, FunctionalState newState)
 
void timerChClearCCFlag (const timerHardware_t *timHw)
 
void timerChInit (const timerHardware_t *timHw, channelType_t type, int irqPriority)
 
void timerInit (void)
 
void timerStart (void)
 
void timerForceOverflow (TIM_TypeDef *tim)
 
void configTimeBase (TIM_TypeDef *tim, uint16_t period, uint8_t mhz)
 

Variables

const timerHardware_t timerHardware []
 

Macro Definition Documentation

#define USABLE_TIMER_CHANNEL_COUNT   14

Typedef Documentation

typedef uint16_t captureCompare_t
typedef void timerCCHandlerCallback(struct timerCCHandlerRec_s *self, uint16_t capture)
typedef void timerOvrHandlerCallback(struct timerOvrHandlerRec_s *self, uint16_t capture)

Enumeration Type Documentation

Enumerator
TYPE_FREE 
TYPE_PWMINPUT 
TYPE_PPMINPUT 
TYPE_PWMOUTPUT_MOTOR 
TYPE_PWMOUTPUT_FAST 
TYPE_PWMOUTPUT_SERVO 
TYPE_SOFTSERIAL_RX 
TYPE_SOFTSERIAL_TX 
TYPE_SOFTSERIAL_RXTX 
TYPE_SOFTSERIAL_AUXTIMER 
TYPE_ADC 
TYPE_SERIAL_RX 
TYPE_SERIAL_TX 
TYPE_SERIAL_RXTX 
TYPE_TIMER 

Function Documentation

void configTimeBase ( TIM_TypeDef tim,
uint16_t  period,
uint8_t  mhz 
)
void timerChCCHandlerInit ( timerCCHandlerRec_t self,
timerCCHandlerCallback fn 
)
volatile timCCR_t* timerChCCR ( const timerHardware_t timHw)
volatile timCCR_t* timerChCCRHi ( const timerHardware_t timHw)
volatile timCCR_t* timerChCCRLo ( const timerHardware_t timHw)
void timerChClearCCFlag ( const timerHardware_t timHw)
void timerChConfigCallbacks ( const timerHardware_t channel,
timerCCHandlerRec_t edgeCallback,
timerOvrHandlerRec_t overflowCallback 
)
void timerChConfigCallbacksDual ( const timerHardware_t channel,
timerCCHandlerRec_t edgeCallbackLo,
timerCCHandlerRec_t edgeCallbackHi,
timerOvrHandlerRec_t overflowCallback 
)
void timerChConfigGPIO ( const timerHardware_t timHw,
GPIO_Mode  mode 
)

Here is the call graph for this function:

void timerChConfigIC ( const timerHardware_t timHw,
bool  polarityRising,
unsigned  inputFilterSamples 
)
void timerChConfigICDual ( const timerHardware_t timHw,
bool  polarityRising,
unsigned  inputFilterSamples 
)
void timerChConfigOC ( const timerHardware_t timHw,
bool  outEnable,
bool  stateHigh 
)
void timerChICPolarity ( const timerHardware_t timHw,
bool  polarityRising 
)
void timerChInit ( const timerHardware_t timHw,
channelType_t  type,
int  irqPriority 
)

Here is the call graph for this function:

void timerChITConfig ( const timerHardware_t timHw,
FunctionalState  newState 
)
void timerChITConfigDualLo ( const timerHardware_t timHw,
FunctionalState  newState 
)
void timerChOvrHandlerInit ( timerOvrHandlerRec_t self,
timerOvrHandlerCallback fn 
)
void timerConfigure ( const timerHardware_t timHw,
uint16_t  period,
uint8_t  mhz 
)

Here is the call graph for this function:

void timerForceOverflow ( TIM_TypeDef tim)

Force an overflow for a given timer. Saves the current value of the counter in the relevant timerConfig's forcedOverflowTimerValue variable.

Parameters
TIM_Typedef*tim The timer to overflow
Returns
void
void timerInit ( void  )

Here is the call graph for this function:

void timerStart ( void  )

Here is the call graph for this function:

Variable Documentation

const timerHardware_t timerHardware[]