Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
input_capture_arch.h File Reference
#include "ch.h"
#include "hal.h"
+ Include dependency graph for input_capture_arch.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TimICConfig
 TimIC Driver configuration structure. More...
 
struct  TimICDriver
 Structure representing a TimIC driver. More...
 

Typedefs

typedef struct TimICDriver TimICDriver
 
typedef void(* TimICCallbackCapture_t) (const TimICDriver *timicp, uint32_t channel, uint32_t capture)
 
typedef void(* TimICCallbackOverflow_t) (const TimICDriver *timicp)
 

Enumerations

enum  TimICMode { TIMIC_INPUT_CAPTURE , TIMIC_PWM_IN }
 
enum  TimICActive {
  CH1_RISING_EDGE =1<<0 , CH1_FALLING_EDGE =1<<1 , CH1_BOTH_EDGES =1<<2 , CH2_RISING_EDGE =1<<3 ,
  CH2_FALLING_EDGE =1<<4 , CH2_BOTH_EDGES =1<<5 , CH3_RISING_EDGE =1<<6 , CH3_FALLING_EDGE =1<<7 ,
  CH3_BOTH_EDGES =1<<8 , CH4_RISING_EDGE =1<<9 , CH4_FALLING_EDGE =1<<10 , CH4_BOTH_EDGES =1<<11
}
 
enum  TimICState { TIMIC_STOP , TIMIC_READY , TIMIC_ACTIVE }
 

Functions

void timIcObjectInit (TimICDriver *timicp)
 Initializes an input capture driver. More...
 
void timIcStart (TimICDriver *timicp, const TimICConfig *configp)
 start an input capture driver More...
 
void timIcStartCapture (TimICDriver *timicp)
 start to capture More...
 
void timIcStopCapture (TimICDriver *timicp)
 stop to capture More...
 
void timIcStop (TimICDriver *timicp)
 stop a quadrature encoder driver More...
 
void timIcRccEnable (const TimICDriver *const timicp)
 
void timIcRccDisable (const TimICDriver *const timicp)
 

Data Structure Documentation

◆ TimICConfig

struct TimICConfig

TimIC Driver configuration structure.

Definition at line 25 of file input_capture_arch.h.

+ Collaboration diagram for TimICConfig:
Data Fields
uint32_t active
uint32_t arr
TimICCallbackCapture_t capture_cb
uint32_t dcr
uint32_t dier
enum TimICMode mode
TimICCallbackOverflow_t overflow_cb
uint32_t prescaler:17
stm32_tim_t * timer hardware timer pointer (example : &STM32_TIM1)

◆ TimICDriver

struct TimICDriver

Structure representing a TimIC driver.

Definition at line 44 of file input_capture_arch.h.

+ Collaboration diagram for TimICDriver:
Data Fields
uint32_t channel mutex to protect data read/write in concurrent context
const TimICConfig * config Current configuration data.
uint32_t dier
mutex_t mut
enum TimICState state

Typedef Documentation

◆ TimICCallbackCapture_t

typedef void(* TimICCallbackCapture_t) (const TimICDriver *timicp, uint32_t channel, uint32_t capture)

Definition at line 19 of file input_capture_arch.h.

◆ TimICCallbackOverflow_t

typedef void(* TimICCallbackOverflow_t) (const TimICDriver *timicp)

Definition at line 20 of file input_capture_arch.h.

◆ TimICDriver

typedef struct TimICDriver TimICDriver

Definition at line 1 of file input_capture_arch.h.

Enumeration Type Documentation

◆ TimICActive

Enumerator
CH1_RISING_EDGE 
CH1_FALLING_EDGE 
CH1_BOTH_EDGES 
CH2_RISING_EDGE 
CH2_FALLING_EDGE 
CH2_BOTH_EDGES 
CH3_RISING_EDGE 
CH3_FALLING_EDGE 
CH3_BOTH_EDGES 
CH4_RISING_EDGE 
CH4_FALLING_EDGE 
CH4_BOTH_EDGES 

Definition at line 12 of file input_capture_arch.h.

◆ TimICMode

enum TimICMode
Enumerator
TIMIC_INPUT_CAPTURE 
TIMIC_PWM_IN 

Definition at line 11 of file input_capture_arch.h.

◆ TimICState

enum TimICState
Enumerator
TIMIC_STOP 
TIMIC_READY 
TIMIC_ACTIVE 

Definition at line 17 of file input_capture_arch.h.

Function Documentation

◆ timIcObjectInit()

void timIcObjectInit ( TimICDriver timicp)

Initializes an input capture driver.

Parameters
[out]inputCaptureppointer to a TimICDriver structure @init

Definition at line 13 of file input_capture_arch.c.

References TimICDriver::config, TimICDriver::dier, TimICDriver::state, and TIMIC_STOP.

Referenced by initCache(), and timIcStop().

+ Here is the caller graph for this function:

◆ timIcRccDisable()

void timIcRccDisable ( const TimICDriver *const  timicp)

Definition at line 384 of file input_capture_arch.c.

References TimICDriver::config, and TimICConfig::timer.

Referenced by stopCapture(), and timIcStop().

+ Here is the caller graph for this function:

◆ timIcRccEnable()

◆ timIcStart()

void timIcStart ( TimICDriver timicp,
const TimICConfig configp 
)

◆ timIcStartCapture()

void timIcStartCapture ( TimICDriver timicp)

start to capture

Parameters
[in]timicppointer to a TimICDriver structure

start the input capture data from timer

Definition at line 200 of file input_capture_arch.c.

References TimICDriver::config, TimICDriver::dier, TimICDriver::state, TimICConfig::timer, TIMIC_ACTIVE, and TIMIC_READY.

Referenced by startCapture().

+ Here is the caller graph for this function:

◆ timIcStop()

void timIcStop ( TimICDriver timicp)

stop a quadrature encoder driver

Parameters
[in]timicppointer to a TimICDriver structure

stop and release the timer. After stop, any operation on timicp will result in undefined behavior and probably hardware fault

Definition at line 225 of file input_capture_arch.c.

References TimICDriver::dier, TimICDriver::mut, TimICDriver::state, TIMIC_STOP, timIcObjectInit(), and timIcRccDisable().

+ Here is the call graph for this function:

◆ timIcStopCapture()

void timIcStopCapture ( TimICDriver timicp)

stop to capture

Parameters
[in]timicppointer to a TimICDriver structure

stop the input capture data from timer

Definition at line 214 of file input_capture_arch.c.

References TimICDriver::config, TimICDriver::state, TimICConfig::timer, TIMIC_READY, and TIMIC_STOP.

Referenced by stopCapture().

+ Here is the caller graph for this function: