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
audio_telemetry_hw.h
Go to the documentation of this file.
1
#ifndef AUDIO_TELEMETRY_HW_H
2
#define AUDIO_TELEMETRY_HW_H
3
4
#include "
LPC21xx.h
"
5
#include BOARD_CONFIG
6
7
void
TIMER1_ISR
(
void
) __attribute__((naked));
8
9
/* T1 prescaler, set T1_CLK to 5MHz, T1_CLK = PCLK / T1PCLK_DIV */
10
11
#if (PCLK == 15000000)
12
#define T1_PCLK_DIV 3
13
#else
14
15
#if (PCLK == 30000000)
16
#define T1_PCLK_DIV 6
17
#else
18
19
#if (PCLK == 60000000)
20
#define T1_PCLK_DIV 12
21
#else
22
23
#error unknown PCLK frequency
24
#endif
25
#endif
26
#endif
27
28
#define SAMPLES_PER_PERIOD 4
29
#define SAMPLE_PERIOD (PCLK/4762/SAMPLES_PER_PERIOD/T1_PCLK_DIV)
30
31
static
inline
void
audio_telemetry_init
(
void
)
32
{
33
/* turn on DAC pins */
34
PINSEL1
&= 1 << 19;
35
PINSEL1
|= ~(1 << 18);
36
/* reset & disable timer 1 */
37
T1TCR
=
TCR_RESET
;
38
/* set the prescale divider */
39
T1PR
= T1_PCLK_DIV - 1;
40
/* select TIMER1 as IRQ */
41
VICIntSelect
&= ~
VIC_BIT
(
VIC_TIMER1
);
42
/* enable TIMER1 interrupt */
43
VICIntEnable
=
VIC_BIT
(
VIC_TIMER1
);
44
/* on slot vic slot 1 */
45
VICVectCntl1
=
VIC_ENABLE
|
VIC_TIMER1
;
46
/* address of the ISR */
47
VICVectAddr1
= (
uint32_t
)
TIMER1_ISR
;
48
/* trigger initial match in a long time from now */
49
T1MR0
=
SAMPLE_PERIOD
;
50
/* enable interrupt on match register 0 */
51
T1MCR
|=
TMCR_MR0_I
|
TMCR_MR0_R
;
52
/* enable timer 1 */
53
T1TCR
=
TCR_ENABLE
;
54
}
55
56
57
#define AUDIO_TELEMETRY_CHECK_RUNNING() {}
58
59
60
#endif
/* AUDIO_TELEMETRY_HW_H */
VICIntSelect
#define VICIntSelect
Definition:
LPC21xx.h:430
TIMER1_ISR
void TIMER1_ISR(void)
Definition:
audio_telemetry_hw.c:66
T1TCR
#define T1TCR
Definition:
LPC21xx.h:73
T1MR0
#define T1MR0
Definition:
LPC21xx.h:78
TCR_RESET
#define TCR_RESET
Definition:
lpcTMR.h:55
T1MCR
#define T1MCR
Definition:
LPC21xx.h:77
audio_telemetry_init
static void audio_telemetry_init(void)
Definition:
audio_telemetry_hw.h:31
T1PR
#define T1PR
Definition:
LPC21xx.h:75
uint32_t
unsigned long uint32_t
Definition:
types.h:18
TCR_ENABLE
#define TCR_ENABLE
Definition:
lpcTMR.h:54
VIC_BIT
#define VIC_BIT(chan)
Definition:
lpcVIC.h:105
SAMPLE_PERIOD
#define SAMPLE_PERIOD
Definition:
audio_telemetry_hw.h:29
VICIntEnable
#define VICIntEnable
Definition:
LPC21xx.h:431
TMCR_MR0_R
#define TMCR_MR0_R
Definition:
lpcTMR.h:60
PINSEL1
#define PINSEL1
Definition:
LPC21xx.h:348
VICVectAddr1
#define VICVectAddr1
Definition:
LPC21xx.h:439
LPC21xx.h
TMCR_MR0_I
#define TMCR_MR0_I
Definition:
lpcTMR.h:59
VICVectCntl1
#define VICVectCntl1
Definition:
LPC21xx.h:455
VIC_TIMER1
#define VIC_TIMER1
Definition:
lpcVIC.h:73
VIC_ENABLE
#define VIC_ENABLE
Definition:
lpcVIC.h:102
sw
airborne
arch
lpc21
subsystems
datalink
audio_telemetry_hw.h
Generated on Tue Jun 21 2016 14:01:10 for Paparazzi UAS by
1.8.8