Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
superbitrf_rc.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Freek van Tienen <freek.v.tienen@gmail.com>
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 
26 #include "superbitrf_rc.h"
28 
33 {
35 }
36 
38 static void superbitrf_rc_normalize(int16_t *in, int16_t *out, uint8_t count)
39 {
40  uint8_t i;
41  for (i = 0; i < count; i++) {
42  if (i == RADIO_THROTTLE) {
43  out[i] = (in[i] + MAX_PPRZ) / 2;
44  Bound(out[i], 0, MAX_PPRZ);
45  } else {
46  out[i] = in[i];
47  Bound(out[i], MIN_PPRZ, MAX_PPRZ);
48  }
49  }
50 }
51 
52 void radio_control_impl_event(void (* _received_frame_handler)(void))
53 {
63  _received_frame_handler();
65  }
66 }
radio_control.h
MAX_PPRZ
#define MAX_PPRZ
Definition: paparazzi.h:8
RadioControl::radio_ok_cpt
uint8_t radio_ok_cpt
Definition: radio_control.h:66
superbitrf_rc.h
RadioControl::time_since_last_frame
uint8_t time_since_last_frame
Definition: radio_control.h:65
radio_control_impl_event
void radio_control_impl_event(void(*_received_frame_handler)(void))
RC event function with handler callback.
Definition: superbitrf_rc.c:52
superbitrf_rc_normalize
static void superbitrf_rc_normalize(int16_t *in, int16_t *out, uint8_t count)
normalize superbitrf rc_values to radio values
Definition: superbitrf_rc.c:38
int16_t
signed short int16_t
Definition: types.h:17
uint8_t
unsigned char uint8_t
Definition: types.h:14
MIN_PPRZ
#define MIN_PPRZ
Definition: paparazzi.h:9
RadioControl::status
uint8_t status
Definition: radio_control.h:64
RadioControl::frame_cpt
uint8_t frame_cpt
Definition: radio_control.h:68
RADIO_THROTTLE
#define RADIO_THROTTLE
Definition: intermcu_ap.h:40
RC_OK
#define RC_OK
Definition: radio_control.h:56
cyrf6936_event
void cyrf6936_event(struct Cyrf6936 *cyrf)
The on event call for the CYRF6936 chip.
Definition: cyrf6936.c:86
radio_control_impl_init
void radio_control_impl_init(void)
Initialization.
Definition: superbitrf_rc.c:32
radio_control
struct RadioControl radio_control
Definition: radio_control.c:30
RadioControl::values
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69