Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
cc2500_paparazzi.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Tom van Dijk <tomvand@users.noreply.github.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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #include "cc2500_paparazzi.h"
23 
25 #include "modules/core/abi.h"
26 #include "peripherals/cc2500.h"
27 #include "cc2500_common.h"
28 #include "cc2500_frsky_common.h"
29 #include "cc2500_settings.h"
30 #include "cc2500_rx.h"
31 
32 #include <stdint.h>
33 
34 
35 static uint16_t frsky_raw[RADIO_CTL_NB];
36 
37 
38 #if PERIODIC_TELEMETRY
40 
41 static void send_cc2500_ppm(struct transport_tx *trans, struct link_device *dev)
42 {
43  pprz_msg_send_PPM(trans, dev, AC_ID,
45  (sizeof(frsky_raw) / sizeof(frsky_raw[0])),
46  frsky_raw);
47 }
48 #endif
49 
50 
53  cc2500_init();
54  cc2500Reset();
55  rxInit();
56  radio_control.nb_channel = RADIO_CTL_NB;
57 #if PERIODIC_TELEMETRY
59 #endif
60 }
61 
62 
68  if (radio_control.radio_ok_cpt > 0) {
70  } else {
72  for (int i = 0; i < RADIO_CTL_NB; ++i) {
74  }
75  NormalizePpmIIR(frsky_raw, radio_control);
76  AbiSendMsgRADIO_CONTROL(RADIO_CONTROL_FRSKY_ID, &radio_control);
77  }
78  }
79 }
80 
Main include for ABI (AirBorneInterface).
#define RADIO_CONTROL_FRSKY_ID
void cc2500_init(void)
Definition: cc2500.c:43
uint8_t cc2500Reset(void)
Definition: cc2500.c:228
static uint16_t frsky_raw[RADIO_CTL_NB]
void radio_control_cc2500_event(void)
static void send_cc2500_ppm(struct transport_tx *trans, struct link_device *dev)
void radio_control_cc2500_init(void)
void rxInit(void)
!TODO remove this extern, only needed once for channelCount
Definition: cc2500_rx.c:263
rxRuntimeConfig_t rxRuntimeConfig
Definition: cc2500_rx.c:131
@ RX_FRAME_COMPLETE
Definition: cc2500_rx.h:53
rcFrameStatusFnPtr rcFrameStatusFn
Definition: cc2500_rx.h:148
rcProcessFrameFnPtr rcProcessFrameFn
Definition: cc2500_rx.h:149
rcReadRawDataFnPtr rcReadRawFn
Definition: cc2500_rx.h:147
void cc2500_settings_init(void)
struct RadioControl radio_control
Definition: radio_control.c:33
Generic interface for radio control modules.
uint8_t time_since_last_frame
Definition: radio_control.h:62
uint8_t status
Definition: radio_control.h:61
uint8_t radio_ok_cpt
Definition: radio_control.h:63
uint8_t frame_rate
Definition: radio_control.h:64
uint8_t frame_cpt
Definition: radio_control.h:65
#define RC_OK
Definition: radio_control.h:49
uint8_t nb_channel
Definition: radio_control.h:66
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88