Paparazzi UAS  v6.2_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 
radio_control.h
RadioControl::radio_ok_cpt
uint8_t radio_ok_cpt
Definition: radio_control.h:63
rxRuntimeConfig_s::rcProcessFrameFn
rcProcessFrameFnPtr rcProcessFrameFn
Definition: cc2500_rx.h:149
radio_control_cc2500_event
void radio_control_cc2500_event(void)
Definition: cc2500_paparazzi.c:63
abi.h
cc2500_init
void cc2500_init(void)
Definition: cc2500.c:43
RadioControl::time_since_last_frame
uint8_t time_since_last_frame
Definition: radio_control.h:62
send_cc2500_ppm
static void send_cc2500_ppm(struct transport_tx *trans, struct link_device *dev)
Definition: cc2500_paparazzi.c:41
RADIO_CONTROL_FRSKY_ID
#define RADIO_CONTROL_FRSKY_ID
Definition: abi_sender_ids.h:589
RadioControl::nb_channel
uint8_t nb_channel
Definition: radio_control.h:66
RadioControl::frame_rate
uint8_t frame_rate
Definition: radio_control.h:64
cc2500Reset
uint8_t cc2500Reset(void)
Definition: cc2500.c:228
cc2500_common.h
RX_FRAME_COMPLETE
@ RX_FRAME_COMPLETE
Definition: cc2500_rx.h:53
telemetry.h
rxRuntimeConfig
rxRuntimeConfig_t rxRuntimeConfig
Definition: cc2500_rx.c:131
cc2500_frsky_common.h
cc2500_settings.h
dev
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
register_periodic_telemetry
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
rxRuntimeConfig_s::rcFrameStatusFn
rcFrameStatusFnPtr rcFrameStatusFn
Definition: cc2500_rx.h:148
RadioControl::status
uint8_t status
Definition: radio_control.h:61
rxInit
void rxInit(void)
!TODO remove this extern, only needed once for channelCount
Definition: cc2500_rx.c:263
RadioControl::frame_cpt
uint8_t frame_cpt
Definition: radio_control.h:65
frsky_raw
static uint16_t frsky_raw[RADIO_CTL_NB]
Definition: cc2500_paparazzi.c:35
cc2500_rx.h
rxRuntimeConfig_s::rcReadRawFn
rcReadRawDataFnPtr rcReadRawFn
Definition: cc2500_rx.h:147
RC_OK
#define RC_OK
Definition: radio_control.h:49
cc2500_paparazzi.h
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
cc2500_settings_init
void cc2500_settings_init(void)
Definition: cc2500_settings.c:159
cc2500.h
DefaultPeriodic
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
radio_control_cc2500_init
void radio_control_cc2500_init(void)
Definition: cc2500_paparazzi.c:51
radio_control
struct RadioControl radio_control
Definition: radio_control.c:33