Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
icp_scale.h
Go to the documentation of this file.
1
#ifndef ICP_SCALE_H
2
#define ICP_SCALE_H
3
4
/* INPUT CAPTURE on P0.6*/
5
#define ICP_PINSEL PINSEL0
6
#define ICP_PINSEL_VAL 0x02
7
#define ICP_PINSEL_BIT 12
8
9
#include "
led.h
"
10
11
volatile
uint32_t
pulse_len
;
12
13
static
inline
void
icp_scale_init
(
void
)
14
{
15
/* select pin for capture */
16
ICP_PINSEL
|=
ICP_PINSEL_VAL
<<
ICP_PINSEL_BIT
;
17
/* enable capture 0.2 on falling edge + trigger interrupt */
18
T0CCR
|=
TCCR_CR2_F
|
TCCR_CR2_I
;
19
}
20
21
22
#define ICP_ISR() { \
23
static uint32_t last; \
24
uint32_t now = T0CR2; \
25
pulse_len = now - last; \
26
last = now; \
27
LED_TOGGLE(2); \
28
}
29
30
31
32
#endif
/* ICP_SCALE_H */
T0CCR
#define T0CCR
Definition:
LPC21xx.h:60
ICP_PINSEL
#define ICP_PINSEL
Definition:
icp_scale.h:5
uint32_t
unsigned long uint32_t
Definition:
types.h:18
pulse_len
volatile uint32_t pulse_len
Definition:
icp_scale.h:11
ICP_PINSEL_BIT
#define ICP_PINSEL_BIT
Definition:
icp_scale.h:7
TCCR_CR2_I
#define TCCR_CR2_I
Definition:
lpcTMR.h:142
led.h
arch independent LED (Light Emitting Diodes) API
TCCR_CR2_F
#define TCCR_CR2_F
Definition:
lpcTMR.h:141
ICP_PINSEL_VAL
#define ICP_PINSEL_VAL
Definition:
icp_scale.h:6
icp_scale_init
static void icp_scale_init(void)
Definition:
icp_scale.h:13
sw
airborne
arch
lpc21
icp_scale.h
Generated on Tue Jun 21 2016 14:01:09 for Paparazzi UAS by
1.8.8