Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
imu_aspirin_arch.c
Go to the documentation of this file.
1
#include "
modules/imu/imu.h
"
2
3
#include <libopencm3/stm32/gpio.h>
4
#include <libopencm3/stm32/rcc.h>
5
#include <libopencm3/stm32/exti.h>
6
#include <libopencm3/stm32/spi.h>
7
#include <libopencm3/stm32/dma.h>
8
#include <libopencm3/cm3/nvic.h>
9
10
#include "
mcu_periph/i2c.h
"
11
12
#ifndef STM32F1
13
#error "imu_aspirin_arch arch currently only implemented for STM32F1"
14
#endif
15
16
void
imu_aspirin_arch_int_enable
(
void
)
17
{
18
19
#ifdef ASPIRIN_USE_GYRO_INT
20
nvic_set_priority
(
NVIC_EXTI15_10_IRQ
, 0x0F);
21
nvic_enable_irq
(
NVIC_EXTI15_10_IRQ
);
22
#endif
23
24
nvic_set_priority
(
NVIC_EXTI2_IRQ
, 0x0F);
25
nvic_enable_irq
(
NVIC_EXTI2_IRQ
);
26
27
// should not be needed anymore, handled by the spi driver
28
#if 0
29
/* Enable DMA1 channel4 IRQ Channel ( SPI RX) */
30
nvic_set_priority
(
NVIC_DMA1_CHANNEL4_IRQ
, 0);
31
nvic_enable_irq
(
NVIC_DMA1_CHANNEL4_IRQ
);
32
#endif
33
}
16
void
imu_aspirin_arch_int_enable
(
void
) {
…
}
34
35
void
imu_aspirin_arch_int_disable
(
void
)
36
{
37
38
#ifdef ASPIRIN_USE_GYRO_INT
39
nvic_disable_irq
(
NVIC_EXTI15_10_IRQ
);
40
#endif
41
42
nvic_disable_irq
(
NVIC_EXTI2_IRQ
);
43
44
// should not be needed anymore, handled by the spi driver
45
#if 0
46
/* Enable DMA1 channel4 IRQ Channel ( SPI RX) */
47
nvic_disable_irq
(
NVIC_DMA1_CHANNEL4_IRQ
);
48
#endif
49
}
35
void
imu_aspirin_arch_int_disable
(
void
) {
…
}
50
51
void
imu_aspirin_arch_init
(
void
)
52
{
53
54
// This was needed for Lisa/L????
55
#if 0
56
/* Set "mag ss" and "mag reset" as floating inputs ------------------------*/
57
/* "mag ss" (PC12) is shorted to I2C2 SDA */
58
/* "mag reset" (PC13) is shorted to I2C2 SCL */
59
rcc_periph_clock_enable
(
RCC_GPIOC
);
60
gpio_set_mode
(
GPIOC
,
GPIO_MODE_INPUT
,
61
GPIO_CNF_INPUT_FLOAT
,
GPIO12
|
GPIO13
);
62
#endif
63
64
/* Gyro --------------------------------------------------------------------*/
65
/* configure external interrupt exti15_10 on PC14( gyro int ) */
66
rcc_periph_clock_enable
(
RCC_GPIOC
);
67
rcc_periph_clock_enable
(
RCC_AFIO
);
68
gpio_set_mode
(
GPIOC
,
GPIO_MODE_INPUT
,
69
GPIO_CNF_INPUT_FLOAT
,
GPIO14
);
70
71
#ifdef ASPIRIN_USE_GYRO_INT
72
exti_select_source
(
EXTI14
,
GPIOC
);
73
exti_set_trigger
(
EXTI14
,
EXTI_TRIGGER_FALLING
);
74
exti_enable_request
(
EXTI14
);
75
#endif
76
77
/* configure external interrupt exti2 on PB2( accel int ) */
78
rcc_periph_clock_enable
(
RCC_GPIOB
);
79
gpio_set_mode
(
GPIOB
,
GPIO_MODE_INPUT
,
80
GPIO_CNF_INPUT_FLOAT
,
GPIO2
);
81
exti_select_source
(
EXTI2
,
GPIOB
);
82
exti_set_trigger
(
EXTI2
,
EXTI_TRIGGER_FALLING
);
83
exti_enable_request
(
EXTI2
);
84
85
}
51
void
imu_aspirin_arch_init
(
void
) {
…
}
86
87
88
/****** the interrupts should be handled in the peripheral drivers *******/
89
90
/*
91
* Gyro data ready
92
*/
93
void
exti15_10_isr
(
void
)
94
{
95
96
/* clear EXTI */
97
exti_reset_request
(
EXTI14
);
98
99
#ifdef ASPIRIN_USE_GYRO_INT
100
imu_aspirin
.gyro_eoc =
true
;
101
imu_aspirin
.status =
AspirinStatusReadingGyro
;
102
#endif
103
104
}
93
void
exti15_10_isr
(
void
) {
…
}
105
106
/*
107
* Accel data ready
108
*/
109
void
exti2_isr
(
void
)
110
{
111
112
/* clear EXTI */
113
exti_reset_request
(
EXTI2
);
114
115
//adxl345_start_reading_data();
116
}
109
void
exti2_isr
(
void
) {
…
}
117
GPIO12
#define GPIO12
Definition
gpio_def.h:43
GPIO13
#define GPIO13
Definition
gpio_def.h:44
GPIO2
#define GPIO2
Definition
gpio_def.h:33
GPIO14
#define GPIO14
Definition
gpio_def.h:45
i2c.h
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
imu.h
Inertial Measurement Unit interface.
imu_aspirin
struct ImuAspirin imu_aspirin
Definition
imu_aspirin.c:68
exti2_isr
void exti2_isr(void)
Definition
imu_aspirin_arch.c:109
imu_aspirin_arch_init
void imu_aspirin_arch_init(void)
Definition
imu_aspirin_arch.c:51
imu_aspirin_arch_int_enable
void imu_aspirin_arch_int_enable(void)
Definition
imu_aspirin_arch.c:16
imu_aspirin_arch_int_disable
void imu_aspirin_arch_int_disable(void)
Definition
imu_aspirin_arch.c:35
exti15_10_isr
void exti15_10_isr(void)
Definition
imu_aspirin_arch.c:93
foo
uint16_t foo
Definition
main_demo5.c:58
GPIOC
#define GPIOC
Definition
gpio_arch.h:36
GPIOB
#define GPIOB
Definition
gpio_arch.h:35
sw
airborne
arch
stm32
modules
imu
imu_aspirin_arch.c
Generated on Fri Apr 4 2025 14:56:49 for Paparazzi UAS by
1.9.8