mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-24 22:05:58 +08:00
*** empty log message ***
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
#include "telemetry.h"
|
||||
uint8_t ck_a, ck_b;
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Paparazzi fbw mcu telemetry
|
||||
*
|
||||
* Copyright (C) 2003 Pascal Brisset, Antoine Drouin
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TELEMETRY_H
|
||||
#define TELEMETRY_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define STX 0x05
|
||||
#define ETX 0x06
|
||||
|
||||
extern uint8_t ck_a, ck_b;
|
||||
#include "uart.h"
|
||||
|
||||
#define TELEMETRY_START_MESSAGE(id) { \
|
||||
UART_PUT_1_BYTE(STX); UART_PUT_1_BYTE(id); ck_a = id; ck_b = id; \
|
||||
}
|
||||
|
||||
#define TELEMETRY_END_MESSAGE() { \
|
||||
UART_PUT_1_BYTE(ck_a); UART_PUT_1_BYTE(ck_b); UART_CHECK_RUNNING(); \
|
||||
}
|
||||
|
||||
#define TELEMETRY_CHECK_FREE_SPACE(_space) UART_CHECK_FREE_SPACE(_space)
|
||||
|
||||
#define TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte) { \
|
||||
UART_PUT_1_BYTE_BY_ADDR(_byte); \
|
||||
ck_a += *(_byte); \
|
||||
ck_b += ck_a; \
|
||||
}
|
||||
|
||||
#define TELEMETRY_PUT_2_DATA_BYTE_BY_ADDR(_byte) { \
|
||||
TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte); \
|
||||
TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte+1); \
|
||||
}
|
||||
|
||||
#define TELEMETRY_PUT_4_DATA_BYTE_BY_ADDR(_byte) { \
|
||||
TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte); \
|
||||
TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte+1); \
|
||||
TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte+2); \
|
||||
TELEMETRY_PUT_1_DATA_BYTE_BY_ADDR(_byte+3); \
|
||||
}
|
||||
|
||||
#endif /* TELEMETRY_H */
|
||||
@@ -53,7 +53,7 @@ endif
|
||||
|
||||
rc_transmitter.srcs = rc_transmitter.c ../ppm.c ../uart.c
|
||||
|
||||
new_rc_transmitter.srcs = new_rc_transmitter.c ../ppm.c ../uart.c
|
||||
new_rc_transmitter.srcs = new_rc_transmitter.c ../ppm.c ../uart.c ../telemetry.c
|
||||
|
||||
setup_servos.srcs = setup_servos.c ../uart.c ../servo.c
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "timer.h"
|
||||
#include "uart.h"
|
||||
#include "ppm.h"
|
||||
|
||||
#include "fbw_messages.h"
|
||||
|
||||
uint8_t nb_spi_err = 0;
|
||||
uint8_t rc_status = 0;
|
||||
uint8_t mode = 0;
|
||||
|
||||
int main( void ) {
|
||||
uart_init_tx();
|
||||
uart_print_string("Calib_radio Booting $Id$\n");
|
||||
timer_init();
|
||||
ppm_init();
|
||||
sei();
|
||||
int n = 0;
|
||||
while( 1 ) {
|
||||
if( ppm_valid ) {
|
||||
ppm_valid = FALSE;
|
||||
}
|
||||
if (timer_periodic()) {
|
||||
n++;
|
||||
if (n == 60) {
|
||||
n = 0;
|
||||
TELEMETRY_SEND_FBW_STATUS(&nb_spi_err, &rc_status, &mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,10 +30,9 @@
|
||||
#include "std.h"
|
||||
#include "uart.h"
|
||||
|
||||
//#define TX_BUF_SIZE 256
|
||||
static uint8_t tx_head; /* next free in buf */
|
||||
static volatile uint8_t tx_tail; /* next char to send */
|
||||
static uint8_t tx_buf[ TX_BUF_SIZE ];
|
||||
uint8_t tx_head; /* next free in buf */
|
||||
volatile uint8_t tx_tail; /* next char to send */
|
||||
uint8_t tx_buf[ TX_BUF_SIZE ];
|
||||
|
||||
/*
|
||||
* UART Baud rate generation settings:
|
||||
|
||||
@@ -43,6 +43,16 @@ extern uint8_t tx_buf[ TX_BUF_SIZE ];
|
||||
|
||||
#define UART_CHECK_FREE_SPACE(_space) (tx_head>=tx_tail? _space < (TX_BUF_SIZE - (tx_head - tx_tail)) : _space < (tx_tail - tx_head))
|
||||
|
||||
#define UART_PUT_1_BYTE(_byte) { \
|
||||
tx_buf[tx_head] = _byte; \
|
||||
tx_head++; \
|
||||
if (tx_head >= TX_BUF_SIZE) tx_head = 0; \
|
||||
}
|
||||
|
||||
#define UART_PUT_1_BYTE_BY_ADDR(_byte) { \
|
||||
UART_PUT_1_BYTE(*(_byte)); \
|
||||
}
|
||||
|
||||
#define UART_CHECK_RUNNING() {}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user