Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
hott.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Alexandre Bustico, Gautier Hattenberger
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 "modules/core/abi.h"
29 #include BOARD_CONFIG
30 
31 
33 struct SHott hott;
34 
35 // Telemetry function
36 #if PERIODIC_TELEMETRY
38 
39 static void send_hott(struct transport_tx *trans, struct link_device *dev)
40 {
41  // Using PPM message
42  pprz_msg_send_PPM(trans, dev, AC_ID,
44 }
45 #endif
46 
47 // Init function
48 void hott_init(void)
49 {
50  hott_common_init(&hott, &HOTT_UART_DEV);
52 
53  // Register telemetry message
54 #if PERIODIC_TELEMETRY
56 #endif
57 }
58 
59 
60 // Decoding event function
61 // Reading from UART
62 void hott_event(void)
63 {
64  hott_common_decode_event(&hott, &HOTT_UART_DEV);
65  if (hott.frame_available) {
68  if (radio_control.radio_ok_cpt > 0) {
70  } else {
72  NormalizePpmIIR(hott.pulses, radio_control);
73  AbiSendMsgRADIO_CONTROL(RADIO_CONTROL_HOTT_ID, &radio_control);
74  }
75  hott.frame_available = false;
76  }
77 }
radio_control.h
RadioControl::radio_ok_cpt
uint8_t radio_ok_cpt
Definition: radio_control.h:63
hott
struct SHott hott
HOTT struct.
Definition: hott.c:33
SHott
HOTT structure.
Definition: hott_common.h:70
abi.h
send_hott
static void send_hott(struct transport_tx *trans, struct link_device *dev)
Definition: hott.c:39
RadioControl::time_since_last_frame
uint8_t time_since_last_frame
Definition: radio_control.h:62
RadioControl::nb_channel
uint8_t nb_channel
Definition: radio_control.h:66
SHott::ppm
uint16_t ppm[HOTT_NB_CHANNEL]
decoded and converted values
Definition: hott_common.h:72
RadioControl::frame_rate
uint8_t frame_rate
Definition: radio_control.h:64
telemetry.h
hott_common_init
void hott_common_init(struct SHott *hott_p, struct uart_periph *dev)
Init function.
Definition: hott_common.c:42
hott_common_decode_event
void hott_common_decode_event(struct SHott *hott_p, struct uart_periph *dev)
Decoding event function.
Definition: hott_common.c:97
RADIO_CONTROL_HOTT_ID
#define RADIO_CONTROL_HOTT_ID
Definition: abi_sender_ids.h:565
SHott::frame_available
bool frame_available
new frame available
Definition: hott_common.h:73
hott_init
void hott_init(void)
RC init function.
Definition: hott.c:123
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
hott_event
void hott_event(void)
RC event function.
Definition: hott.c:291
HOTT_NB_CHANNEL
#define HOTT_NB_CHANNEL
Generated code holding the description of a given transmitter.
Definition: hott_common.h:60
RadioControl::status
uint8_t status
Definition: radio_control.h:61
RadioControl::frame_cpt
uint8_t frame_cpt
Definition: radio_control.h:65
hott.h
RC_OK
#define RC_OK
Definition: radio_control.h:49
SHott::pulses
uint16_t pulses[HOTT_NB_CHANNEL]
decoded values
Definition: hott_common.h:71
DefaultPeriodic
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
radio_control
struct RadioControl radio_control
Definition: radio_control.c:33