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
radio_control.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2006-2014 The Paparazzi Team
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, see
18
* <http://www.gnu.org/licenses/>.
19
*/
20
28
#include "
subsystems/radio_control.h
"
29
30
struct
RadioControl
radio_control
;
31
32
void
radio_control_init
(
void
)
33
{
34
uint8_t
i;
35
for
(i = 0; i <
RADIO_CONTROL_NB_CHANNEL
; i++) {
36
radio_control
.
values
[i] = 0;
37
}
38
radio_control
.
status
=
RC_REALLY_LOST
;
39
radio_control
.
time_since_last_frame
=
RC_REALLY_LOST_TIME
;
40
radio_control
.
radio_ok_cpt
= 0;
41
radio_control
.
frame_rate
= 0;
42
radio_control
.
frame_cpt
= 0;
43
radio_control_impl_init
();
44
}
45
46
void
radio_control_periodic_task
(
void
)
47
{
48
static
uint8_t
_1Hz;
49
_1Hz++;
50
51
if
(_1Hz >= 60) {
52
_1Hz = 0;
53
radio_control
.
frame_rate
=
radio_control
.
frame_cpt
;
54
radio_control
.
frame_cpt
= 0;
55
}
56
57
if
(
radio_control
.
time_since_last_frame
>=
RC_REALLY_LOST_TIME
) {
58
radio_control
.
status
=
RC_REALLY_LOST
;
59
}
else
{
60
if
(
radio_control
.
time_since_last_frame
>=
RC_LOST_TIME
) {
61
radio_control
.
status
=
RC_LOST
;
62
radio_control
.
radio_ok_cpt
=
RC_OK_CPT
;
63
}
64
radio_control
.
time_since_last_frame
++;
65
}
66
67
#if defined RADIO_CONTROL_LED
68
if
(
radio_control
.
status
==
RC_OK
) {
69
LED_ON
(RADIO_CONTROL_LED);
70
}
else
{
71
LED_OFF
(RADIO_CONTROL_LED);
72
}
73
#endif
74
75
}
RC_LOST
#define RC_LOST
Definition:
radio_control.h:49
radio_control_impl_init
void radio_control_impl_init(void)
Definition:
spektrum_arch.c:30
RadioControl::radio_ok_cpt
uint8_t radio_ok_cpt
Definition:
radio_control.h:55
RadioControl::status
uint8_t status
Definition:
radio_control.h:53
radio_control.h
RC_LOST_TIME
#define RC_LOST_TIME
Definition:
radio_control.h:43
RadioControl
Definition:
radio_control.h:52
RadioControl::values
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition:
radio_control.h:58
radio_control_init
void radio_control_init(void)
Definition:
radio_control.c:32
RC_REALLY_LOST_TIME
#define RC_REALLY_LOST_TIME
Definition:
radio_control.h:44
radio_control_periodic_task
void radio_control_periodic_task(void)
Definition:
radio_control.c:46
radio_control
struct RadioControl radio_control
Definition:
radio_control.c:30
RC_REALLY_LOST
#define RC_REALLY_LOST
Definition:
radio_control.h:50
RADIO_CONTROL_NB_CHANNEL
#define RADIO_CONTROL_NB_CHANNEL
Definition:
spektrum_arch.h:34
RC_OK
#define RC_OK
Definition:
radio_control.h:48
LED_ON
#define LED_ON(i)
Definition:
led_hw.h:42
RC_OK_CPT
#define RC_OK_CPT
Definition:
radio_control.h:46
uint8_t
unsigned char uint8_t
Definition:
types.h:14
RadioControl::time_since_last_frame
uint8_t time_since_last_frame
Definition:
radio_control.h:54
LED_OFF
#define LED_OFF(i)
Definition:
led_hw.h:43
RadioControl::frame_cpt
uint8_t frame_cpt
Definition:
radio_control.h:57
RadioControl::frame_rate
uint8_t frame_rate
Definition:
radio_control.h:56
sw
airborne
subsystems
radio_control.c
Generated on Tue Jun 21 2016 14:01:28 for Paparazzi UAS by
1.8.8