Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
servos_4015_hw.h
Go to the documentation of this file.
1
#ifndef SERVOS_4015_HW_H
2
#define SERVOS_4015_HW_H
3
4
#include <
inttypes.h
>
5
#include "
std.h
"
6
7
#include "
LPC21xx.h
"
8
#include "
mcu_periph/sys_time.h
"
9
10
#include BOARD_CONFIG
11
12
/* PWM prescaler, set PWM input clock to 15MHz, PWM_CLK = PCLK / PWM_PRESCALER */
13
14
#if (PCLK == 15000000)
15
#define PWM_PRESCALER 1
16
#else
17
18
#if (PCLK == 30000000)
19
#define PWM_PRESCALER 2
20
#else
21
22
#if (PCLK == 60000000)
23
#define PWM_PRESCALER 4
24
#else
25
26
#error unknown PCLK frequency
27
#endif
28
#endif
29
#endif
30
31
#define PWM_TICS_OF_USEC(us) (uint32_t)((us) *1e-6 * PCLK / PWM_PRESCALER + 0.5)
32
33
#define SERVOS_TICS_OF_USEC(s) PWM_TICS_OF_USEC(s)
34
#define ClipServo(x,a,b) Clip(x, a, b)
35
36
#define _4015_NB_CHANNELS 8
37
extern
uint16_t
servos_values
[
_4015_NB_CHANNELS
];
38
#define Actuator4015Set(_i, _v) { servos_values[_i] = SERVOS_TICS_OF_USEC(_v); }
39
40
extern
void
actuators_4015_init
(
void
);
41
#define Actuators4015Commit() {}
42
#define Actuators4015Init() actuators_4015_init()
43
44
void
PWM_ISR
(
void
) __attribute__((naked));
45
46
47
#endif
/* SERVOS_4015_HW_H */
uint16_t
unsigned short uint16_t
Definition:
types.h:16
LPC21xx.h
PWM_ISR
void PWM_ISR(void)
Definition:
servos_4015_hw.c:104
_4015_NB_CHANNELS
#define _4015_NB_CHANNELS
Definition:
servos_4015_hw.h:36
std.h
servos_values
uint16_t servos_values[_4015_NB_CHANNELS]
Definition:
servos_4015_hw.c:29
sys_time.h
Architecture independent timing functions.
actuators_4015_init
void actuators_4015_init(void)
Definition:
servos_4015_hw.c:46
inttypes.h
sw
airborne
arch
lpc21
subsystems
actuators
servos_4015_hw.h
Generated on Tue Feb 1 2022 13:51:13 for Paparazzi UAS by
1.8.17