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
11
enum
TimICMode
{
TIMIC_INPUT_CAPTURE
,
TIMIC_PWM_IN
} ;
12
enum
TimICActive
{
CH1_RISING_EDGE
=1<<0,
CH1_FALLING_EDGE
=1<<1,
CH1_BOTH_EDGES
=1<<2,
13
CH2_RISING_EDGE
=1<<3,
CH2_FALLING_EDGE
=1<<4,
CH2_BOTH_EDGES
=1<<5,
14
CH3_RISING_EDGE
=1<<6,
CH3_FALLING_EDGE
=1<<7,
CH3_BOTH_EDGES
=1<<8,
15
CH4_RISING_EDGE
=1<<9,
CH4_FALLING_EDGE
=1<<10,
CH4_BOTH_EDGES
=1<<11
16
} ;
17
enum
TimICState
{
TIMIC_STOP
,
TIMIC_READY
,
TIMIC_ACTIVE
};
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
;
30
TimICCallbackCapture_t
capture_cb
;
31
TimICCallbackOverflow_t
overflow_cb;
32
enum
TimICMode
mode
;
33
uint32_t
active
;
34
uint32_t
dier
;
35
uint32_t
dcr
;
36
uint32_t
prescaler
:17;
37
uint32_t
arr
;
38
}
TimICConfig
;
39
40
44
struct
TimICDriver
{
48
const
TimICConfig
*
config
;
52
uint32_t
channel
;
53
uint32_t
dier
;
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
timIcStop
void timIcStop(TimICDriver *timicp)
stop a quadrature encoder driver
Definition:
input_capture_arch.c:225
TimICCallbackCapture_t
void(* TimICCallbackCapture_t)(const TimICDriver *timicp, uint32_t channel, uint32_t capture)
Definition:
input_capture_arch.h:19
timIcObjectInit
void timIcObjectInit(TimICDriver *timicp)
Initializes an input capture driver.
Definition:
input_capture_arch.c:13
TimICConfig::dcr
uint32_t dcr
Definition:
input_capture_arch.h:35
timIcStopCapture
void timIcStopCapture(TimICDriver *timicp)
stop to capture
Definition:
input_capture_arch.c:214
timIcRccEnable
void timIcRccEnable(const TimICDriver *const timicp)
Definition:
input_capture_arch.c:239
timIcStart
void timIcStart(TimICDriver *timicp, const TimICConfig *configp)
start an input capture driver
Definition:
input_capture_arch.c:20
TimICConfig::capture_cb
TimICCallbackCapture_t capture_cb
Definition:
input_capture_arch.h:30
TimICDriver::channel
uint32_t channel
mutex to protect data read/write in concurrent context
Definition:
input_capture_arch.h:52
timIcStartCapture
void timIcStartCapture(TimICDriver *timicp)
start to capture
Definition:
input_capture_arch.c:200
TimICDriver::mut
mutex_t mut
Definition:
input_capture_arch.h:54
TimICState
TimICState
Definition:
input_capture_arch.h:17
TIMIC_READY
@ TIMIC_READY
Definition:
input_capture_arch.h:17
TIMIC_ACTIVE
@ TIMIC_ACTIVE
Definition:
input_capture_arch.h:17
TIMIC_STOP
@ TIMIC_STOP
Definition:
input_capture_arch.h:17
TimICDriver::dier
uint32_t dier
Definition:
input_capture_arch.h:53
TimICActive
TimICActive
Definition:
input_capture_arch.h:12
CH2_FALLING_EDGE
@ CH2_FALLING_EDGE
Definition:
input_capture_arch.h:13
CH1_RISING_EDGE
@ CH1_RISING_EDGE
Definition:
input_capture_arch.h:12
CH4_RISING_EDGE
@ CH4_RISING_EDGE
Definition:
input_capture_arch.h:15
CH3_RISING_EDGE
@ CH3_RISING_EDGE
Definition:
input_capture_arch.h:14
CH2_RISING_EDGE
@ CH2_RISING_EDGE
Definition:
input_capture_arch.h:13
CH1_BOTH_EDGES
@ CH1_BOTH_EDGES
Definition:
input_capture_arch.h:12
CH4_FALLING_EDGE
@ CH4_FALLING_EDGE
Definition:
input_capture_arch.h:15
CH3_BOTH_EDGES
@ CH3_BOTH_EDGES
Definition:
input_capture_arch.h:14
CH3_FALLING_EDGE
@ CH3_FALLING_EDGE
Definition:
input_capture_arch.h:14
CH4_BOTH_EDGES
@ CH4_BOTH_EDGES
Definition:
input_capture_arch.h:15
CH1_FALLING_EDGE
@ CH1_FALLING_EDGE
Definition:
input_capture_arch.h:12
CH2_BOTH_EDGES
@ CH2_BOTH_EDGES
Definition:
input_capture_arch.h:13
TimICConfig::prescaler
uint32_t prescaler
Definition:
input_capture_arch.h:36
TimICMode
TimICMode
Definition:
input_capture_arch.h:11
TIMIC_INPUT_CAPTURE
@ TIMIC_INPUT_CAPTURE
Definition:
input_capture_arch.h:11
TIMIC_PWM_IN
@ TIMIC_PWM_IN
Definition:
input_capture_arch.h:11
TimICConfig::active
uint32_t active
Definition:
input_capture_arch.h:33
timIcRccDisable
void timIcRccDisable(const TimICDriver *const timicp)
Definition:
input_capture_arch.c:384
TimICDriver::state
enum TimICState state
Definition:
input_capture_arch.h:55
TimICConfig::arr
uint32_t arr
Definition:
input_capture_arch.h:37
TimICCallbackOverflow_t
void(* TimICCallbackOverflow_t)(const TimICDriver *timicp)
Definition:
input_capture_arch.h:20
TimICDriver::config
const TimICConfig * config
Current configuration data.
Definition:
input_capture_arch.h:48
TimICConfig::timer
stm32_tim_t * timer
hardware timer pointer (example : &STM32_TIM1)
Definition:
input_capture_arch.h:29
TimICConfig::dier
uint32_t dier
Definition:
input_capture_arch.h:34
TimICConfig
TimIC Driver configuration structure.
Definition:
input_capture_arch.h:25
TimICDriver
Structure representing a TimIC driver.
Definition:
input_capture_arch.h:44
mode
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
uint32_t
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition:
vl53l1_types.h:78
sw
airborne
arch
chibios
mcu_periph
input_capture_arch.h
Generated on Fri Nov 8 2024 14:10:44 for Paparazzi UAS by
1.9.1