Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
hott_common.h
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 
27 #ifndef RC_HOTT_COMMON_H
28 #define RC_HOTT_COMMON_H
29 
30 #include "std.h"
31 #include "mcu_periph/uart.h"
32 #include "mcu_periph/gpio.h"
33 
34 /* in case you want to override RADIO_CONTROL_NB_CHANNEL */
35 #include "generated/airframe.h"
36 
43 #define RC_PPM_TICKS_OF_USEC(_v) ((_v) * 8 ) // USEC IN HOTT OUT
44 #define RC_PPM_SIGNED_TICKS_OF_USEC(_v) ((_v) * 8 ) // usec -1000 + 1000 in, HOTT out
45 #define USEC_OF_RC_PPM_TICKS(_v) ((_v) / 8) // HOTT IN USEC OUT
46 
51 #include "generated/radio.h"
52 
60 #define HOTT_NB_CHANNEL 32
61 #define HOTT_BUF_LENGTH (HOTT_NB_CHANNEL*2+3+2) // 2 bytes per chennel 3 bytes header, 2 bytes CRC
62 
63 #if RADIO_CONTROL_NB_CHANNEL > HOTT_NB_CHANNEL
64 #error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 32."
65 #endif
66 
70 struct SHott {
78 };
79 
83 void hott_common_init(struct SHott *hott, struct uart_periph *dev);
84 
88 void hott_common_decode_event(struct SHott *hott, struct uart_periph *dev);
89 
90 #endif /* RC_HOTT_COMMON_H */
Some architecture independent helper functions for GPIOs.
#define HOTT_BUF_LENGTH
Definition: hott_common.h:61
bool frame_available
new frame available
Definition: hott_common.h:73
uint8_t idx
input index
Definition: hott_common.h:76
uint8_t buffer[HOTT_BUF_LENGTH]
input buffer
Definition: hott_common.h:74
void hott_common_decode_event(struct SHott *hott, struct uart_periph *dev)
Decoding event function.
Definition: hott_common.c:97
void hott_common_init(struct SHott *hott, struct uart_periph *dev)
Init function.
Definition: hott_common.c:42
uint16_t ppm[HOTT_NB_CHANNEL]
decoded and converted values
Definition: hott_common.h:72
uint16_t pulses[HOTT_NB_CHANNEL]
decoded values
Definition: hott_common.h:71
uint8_t status
decoder state machine status
Definition: hott_common.h:77
#define HOTT_NB_CHANNEL
Generated code holding the description of a given transmitter.
Definition: hott_common.h:60
uint8_t expected_channels
expected number of channels send in header
Definition: hott_common.h:75
HOTT structure.
Definition: hott_common.h:70
struct SHott hott
HOTT struct.
Definition: hott.c:33
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
UART peripheral.
Definition: uart.h:72
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98