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
servos_4015_MAT_hw.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2006 Antoine Drouin
3
*
4
* This file is part of paparazzi.
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, write to
18
* the Free Software Foundation, 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
20
*
21
*/
22
28
#ifndef SERVOS_4015_HW_H
29
#define SERVOS_4015_HW_H
30
31
32
#include "
std.h
"
33
#include "
LPC21xx.h
"
34
#include "
mcu_periph/sys_time.h
"
35
36
#include BOARD_CONFIG
37
38
#define SERVOS_TICS_OF_USEC(s) cpu_ticks_of_usec(s)
39
#define ChopServo(x,a,b) Chop(x, a, b)
40
41
#define _4015_NB_CHANNELS 8
42
extern
uint16_t
servos_values
[
_4015_NB_CHANNELS
];
43
#define Actuator4015Set(_i, _v) { servos_values[_i] = SERVOS_TICS_OF_USEC(_v); }
44
45
extern
void
actuators_4015_init
(
void
);
46
#define Actuators4015Commit() {}
47
#define Actuators4015Init() actuators_4015_init()
48
extern
uint8_t
servos_4015_idx
;
49
extern
uint32_t
servos_delay
;
50
51
#define SERVO_REFRESH_TICS SERVOS_TICS_OF_USEC(20000)
52
53
#define ACTUATORS_IT TIR_MR1I
54
#define Servos4015Mat_ISR() { \
55
if (servos_4015_idx == 0) { \
56
servos_delay = SERVO_REFRESH_TICS; \
57
SetBit(IO1CLR, SERVO_DATA_PIN); \
58
} \
59
if (servos_4015_idx < _4015_NB_CHANNELS ) { \
60
T0MR1 += servos_values[servos_4015_idx]; \
61
servos_delay -= servos_values[servos_4015_idx]; \
62
servos_4015_idx++; \
63
} else if (servos_4015_idx == _4015_NB_CHANNELS) { \
64
SetBit(IO1SET, SERVO_RESET_PIN); \
65
servos_4015_idx++; \
66
T0MR1 += servos_delay/2; \
67
} else { \
68
SetBit(IO1SET, SERVO_DATA_PIN); \
69
SetBit(IO1CLR, SERVO_RESET_PIN); \
70
servos_4015_idx = 0; \
71
T0MR1 += servos_delay/2; \
72
} \
73
/* lower clock pin */
\
74
T0EMR &= ~TEMR_EM1; \
75
}
76
77
#endif
/* SERVOS_4015_HW_H */
uint16_t
unsigned short uint16_t
Definition:
types.h:16
_4015_NB_CHANNELS
#define _4015_NB_CHANNELS
Definition:
servos_4015_MAT_hw.h:41
actuators_4015_init
void actuators_4015_init(void)
Definition:
servos_4015_hw.c:46
servos_delay
uint32_t servos_delay
Definition:
servos_4015_MAT_hw.c:33
servos_values
uint16_t servos_values[_4015_NB_CHANNELS]
Definition:
servos_4015_hw.c:29
sys_time.h
Architecture independent timing functions.
uint32_t
unsigned long uint32_t
Definition:
types.h:18
std.h
uint8_t
unsigned char uint8_t
Definition:
types.h:14
servos_4015_idx
uint8_t servos_4015_idx
Definition:
servos_4015_MAT_hw.c:32
LPC21xx.h
sw
airborne
arch
lpc21
subsystems
actuators
servos_4015_MAT_hw.h
Generated on Tue Jun 21 2016 14:01:10 for Paparazzi UAS by
1.8.8