Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
input_capture_arch.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ch.h"
4 #include "hal.h"
5 
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
16  } ;
18  typedef struct TimICDriver TimICDriver;
19  typedef void (*TimICCallbackCapture_t)(const TimICDriver *timicp, uint32_t channel, uint32_t capture);
20  typedef void (*TimICCallbackOverflow_t)(const TimICDriver *timicp);
21 
25  typedef struct {
29  stm32_tim_t *timer;
32  enum TimICMode mode;
38  } TimICConfig;
39 
40 
44  struct TimICDriver {
54  mutex_t mut;
55  enum TimICState state;
56  };
57 
58 
65  void timIcObjectInit(TimICDriver *timicp);
66 
74  void timIcStart(TimICDriver *timicp, const TimICConfig *configp);
75 
82  void timIcStartCapture(TimICDriver *timicp);
83 
90  void timIcStopCapture(TimICDriver *timicp);
91 
99  void timIcStop(TimICDriver *timicp);
100 
101  void timIcRccEnable(const TimICDriver * const timicp);
102  void timIcRccDisable(const TimICDriver * const timicp);
103 
104 
105 
106 #ifdef __cplusplus
107 }
108 #endif
void timIcStop(TimICDriver *timicp)
stop a quadrature encoder driver
void(* TimICCallbackCapture_t)(const TimICDriver *timicp, uint32_t channel, uint32_t capture)
void timIcObjectInit(TimICDriver *timicp)
Initializes an input capture driver.
void timIcStopCapture(TimICDriver *timicp)
stop to capture
void timIcRccEnable(const TimICDriver *const timicp)
void timIcStart(TimICDriver *timicp, const TimICConfig *configp)
start an input capture driver
TimICCallbackCapture_t capture_cb
uint32_t channel
mutex to protect data read/write in concurrent context
void timIcStartCapture(TimICDriver *timicp)
start to capture
TimICState
@ TIMIC_READY
@ TIMIC_ACTIVE
@ TIMIC_STOP
TimICActive
@ CH2_FALLING_EDGE
@ CH1_RISING_EDGE
@ CH4_RISING_EDGE
@ CH3_RISING_EDGE
@ CH2_RISING_EDGE
@ CH1_BOTH_EDGES
@ CH4_FALLING_EDGE
@ CH3_BOTH_EDGES
@ CH3_FALLING_EDGE
@ CH4_BOTH_EDGES
@ CH1_FALLING_EDGE
@ CH2_BOTH_EDGES
uint32_t prescaler
@ TIMIC_INPUT_CAPTURE
@ TIMIC_PWM_IN
void timIcRccDisable(const TimICDriver *const timicp)
enum TimICState state
void(* TimICCallbackOverflow_t)(const TimICDriver *timicp)
const TimICConfig * config
Current configuration data.
stm32_tim_t * timer
hardware timer pointer (example : &STM32_TIM1)
TimIC Driver configuration structure.
Structure representing a TimIC driver.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Definition: sonar_bebop.c:65
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78