Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
xtend_rssi.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2011 The Paparazzi Team
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
32#include "mcu_periph/sys_time.h"
33
34
35#include "mcu_periph/uart.h"
36#include "pprzlink/messages.h"
38
39//from Digi XTend manual
40#define XTEND_RSSI_PWM_PERIOD_USEC 8320 //rssi pwm period () in sys tics
41
42#define XTEND_RSSI_PWM_ARRAY_INDEX (XTEND_RSSI_PWM_INPUT_CHANNEL - 1)
43
45{
46
47 /* get the last duty if valid then reset valid flag (this says if we got another pulse since the last one)
48 calculate the % and dB from the duty using datasheet specs
49 send the %, dB, datalink time
50 */
51
54 uint8_t rssi_dB_fade_margin = 0; //shows dB fade margin above rated minimum sensitivity
55
58 rssi_dB_fade_margin = (2 * duty_percent + 10) / 3; //not sure if this is right, datasheet isn't very informative
60 }
65}
uint16_t foo
Definition main_demo5.c:58
volatile uint32_t pwm_input_duty_tics[PWM_INPUT_NB]
Definition pwm_input.c:34
volatile uint8_t pwm_input_duty_valid[PWM_INPUT_NB]
Definition pwm_input.c:35
arch independent PWM input capture API
Architecture independent timing functions.
static uint32_t cpu_ticks_of_usec(uint32_t usec)
Definition sys_time.h:187
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
#define XTEND_RSSI_PWM_PERIOD_USEC
Definition xtend_rssi.c:40
void xtend_rssi_periodic(void)
Definition xtend_rssi.c:44
#define XTEND_RSSI_PWM_ARRAY_INDEX
Definition xtend_rssi.c:42
This measures the rssi pwm signal from a Digi XTend radio modem and sends a message with the info.