Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 ChopServo(x,a,b) Chop(x, a, b)
35 
36 #define _4015_NB_CHANNELS 8
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 */
unsigned short uint16_t
Definition: types.h:16
void actuators_4015_init(void)
void PWM_ISR(void)
#define _4015_NB_CHANNELS
Architecture independent timing functions.
uint16_t servos_values[_4015_NB_CHANNELS]