mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-07 17:49:49 +08:00
*** empty log message ***
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
<makefile>
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/tiny_test.makefile
|
||||
|
||||
ap.CFLAGS += -Werror
|
||||
|
||||
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -7,7 +7,9 @@ ap.ARCH = arm7tdmi
|
||||
ap.TARGET = autopilot
|
||||
ap.TARGETDIR = autopilot
|
||||
ap.CFLAGS += -DAP
|
||||
ap.CFLAGS += -DGPS -DUBX
|
||||
ap.CFLAGS += -DMODEM
|
||||
# -DGPS -DUBX -DDOWNLINK
|
||||
ap.srcs = inter_mcu.c pid.c estimator.c cam.c main_ap.c mainloop.c main.c $(SRC_ARCH)/uart.c $(SRC_ARCH)/armVIC.c
|
||||
ap.srcs += gps_ubx.c gps.c nav.c
|
||||
ap.srcs += nav.c $(SRC_ARCH)/modem.c
|
||||
# ap.srcs += gps_ubx.c gps.c
|
||||
# ap.srcs += $(SRC_ARCH)/modem.c $(SRC_ARCH)/adc_ap.c $(SRC_ARCH)/uart_ap.c $(SRC_ARCH)/servo.c
|
||||
|
||||
+8
-4
@@ -46,6 +46,7 @@
|
||||
<field name="climb" type="int16" unit="cm/s"></field>
|
||||
<field name="itow" type="uint32" unit="ms"></field>
|
||||
<field name="utm_zone" type="uint8"></field>
|
||||
<field name="gps_nb_err" type="uint8"></field>
|
||||
</message>
|
||||
|
||||
<message name="NAVIGATION_REF" ID="0x09" period="9" >
|
||||
@@ -84,13 +85,11 @@
|
||||
<field name="energy" type="uint16" unit="mAh"/>
|
||||
</message>
|
||||
|
||||
<message name="DEBUG" ID="13" period="5" >
|
||||
<message name="DEBUG_MCU_LINK" ID="13" period="5" >
|
||||
<field name="i2c_nb_err" type="uint8"></field>
|
||||
<field name="i2c_mcu1_nb_err" type="uint8"></field>
|
||||
<field name="modem_nb_err" type="uint8"></field>
|
||||
<field name="gps_nb_err" type="uint8"></field>
|
||||
<field name="ppm_rate" type="uint8"></field>
|
||||
</message>
|
||||
</message>
|
||||
|
||||
<message name="CALIBRATION" ID="14" period="2">
|
||||
<field name="climb_sum_err" type="float" format="%.1f"></field>
|
||||
@@ -207,6 +206,11 @@
|
||||
<field name="range" type="uint16"/>
|
||||
</message>
|
||||
|
||||
|
||||
<message name="DEBUG_MODEM" id="30" period="5">
|
||||
<field name="modem_nb_err" type="uint8"></field>
|
||||
</message>
|
||||
|
||||
</class>
|
||||
|
||||
<class name="telemetry_fbw" ID="0X41">
|
||||
|
||||
@@ -198,8 +198,9 @@ endif
|
||||
#LPC21ISP = lpc21isp
|
||||
LPC21ISP = lpc21isp
|
||||
LPC21ISP_PORT = /dev/ttyS0
|
||||
LPC21ISP_BAUD = 115200
|
||||
LPC21ISP_XTAL = 14746
|
||||
LPC21ISP_BAUD = 38400
|
||||
#LPC21ISP_XTAL = 14746
|
||||
LPC21ISP_XTAL = 12000
|
||||
LPC21ISP_FLASHFILE = $(TARGET).hex
|
||||
# verbose output:
|
||||
#LPC21ISP_DEBUG = -debug
|
||||
|
||||
@@ -91,7 +91,7 @@ static void sysInit(void) {
|
||||
initSysTime(); // initialize the system timer
|
||||
|
||||
uart0Init(UART_BAUD(HOST_BAUD), UART_8N1, UART_FIFO_8); // setup the UART
|
||||
uart1Init(B38400, UART_8N1, UART_FIFO_8); // setup the UART
|
||||
// uart1Init(B38400, UART_8N1, UART_FIFO_8); // setup the UART
|
||||
adc_init();
|
||||
servos_init();
|
||||
ppm_init();
|
||||
@@ -110,11 +110,12 @@ static void periodic_task ( void ) {
|
||||
/* modem_put_one_byte(0x42); */
|
||||
// MODEM_PRINT_GPS();
|
||||
if (!(foo%10)) {
|
||||
if (IO0PIN & LED1_BIT)
|
||||
IO0CLR = LED1_BIT;
|
||||
if (IO1PIN & LED_TINY_BIT)
|
||||
// IO0CLR = LED1_BIT;
|
||||
IO1CLR = LED_TINY_BIT;
|
||||
else
|
||||
IO0SET = LED1_BIT;
|
||||
MODEM_PRINT_GPS();
|
||||
//IO0SET = LED1_BIT;
|
||||
IO1SET = LED_TINY_BIT;
|
||||
// PRINT_ADC();
|
||||
DOWNLINK_SEND_IDENT(&AC_ID);
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "armVIC.h"
|
||||
#include "config.h"
|
||||
|
||||
//#define TX_BUF_SIZE 256
|
||||
|
||||
uint8_t modem_nb_ovrn;
|
||||
uint8_t tx_head;
|
||||
volatile uint8_t tx_tail;
|
||||
@@ -46,7 +44,7 @@ void modem_init ( void ) {
|
||||
VICIntSelect &= ~VIC_BIT(VIC_TIMER1);
|
||||
/* enable TIMER1 interrupt */
|
||||
VICIntEnable = VIC_BIT(VIC_TIMER1);
|
||||
/* on slot vic slot 5 */
|
||||
/* on slot vic slot 1 */
|
||||
VICVectCntl1 = VIC_ENABLE | VIC_TIMER1;
|
||||
/* address of the ISR */
|
||||
VICVectAddr1 = (uint32_t)TIMER1_ISR;
|
||||
@@ -58,12 +56,6 @@ void modem_init ( void ) {
|
||||
T1TCR = TCR_ENABLE;
|
||||
}
|
||||
|
||||
void modem_put_one_byte( uint8_t _byte) {
|
||||
tx_buf[tx_head] = _byte;
|
||||
tx_head++;
|
||||
// if (tx_head >= TX_BUF_SIZE) tx_head = 0; /* TX_BUF_SIZE == 256 */
|
||||
}
|
||||
|
||||
static inline uint8_t get_next_bit( void ) {
|
||||
uint8_t ret;
|
||||
/* start bit */
|
||||
@@ -99,7 +91,7 @@ static inline uint8_t get_next_bit( void ) {
|
||||
|
||||
void TIMER1_ISR ( void ) {
|
||||
ISR_ENTRY();
|
||||
IO0CLR = LED2_BIT;
|
||||
// IO1CLR = LED_2_BIT;
|
||||
static uint8_t modem_bit;
|
||||
|
||||
DACR = modem_sample[modem_bit][modem_phase][modem_sample_idx] << 6;
|
||||
@@ -108,16 +100,12 @@ void TIMER1_ISR ( void ) {
|
||||
modem_sample_idx = 0;
|
||||
modem_phase ^= modem_bit;
|
||||
modem_bit = get_next_bit();
|
||||
// if (modem_bit)
|
||||
// modem_phase = !modem_phase;
|
||||
}
|
||||
|
||||
/* trigger next match */
|
||||
// T1MR0 += SAMPLE_PERIOD;
|
||||
/* clear interrupt */
|
||||
T1IR = TIR_MR0I;
|
||||
VICVectAddr = 0x00000000;
|
||||
IO0SET = LED2_BIT;
|
||||
// IO1SET = LED_2_BIT;
|
||||
ISR_EXIT();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Paparazzi mcu0 cmx469 modem functions
|
||||
*
|
||||
* 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 MODEM_H
|
||||
#define MODEM_H
|
||||
|
||||
#include "inttypes.h"
|
||||
|
||||
void modem_init( void );
|
||||
extern uint8_t modem_nb_ovrn;
|
||||
|
||||
#ifdef MODEM
|
||||
|
||||
#include "airframe.h"
|
||||
#include "modem_hw.h"
|
||||
|
||||
|
||||
#define TX_BUF_SIZE 255
|
||||
extern uint8_t tx_head;
|
||||
extern volatile uint8_t tx_tail;
|
||||
extern uint8_t tx_buf[ TX_BUF_SIZE ];
|
||||
|
||||
extern uint8_t tx_byte;
|
||||
extern uint8_t tx_byte_idx;
|
||||
|
||||
extern uint8_t ck_a, ck_b;
|
||||
|
||||
#define STX 0x05
|
||||
|
||||
#define ModemStartMessage(id) \
|
||||
{ MODEM_PUT_1_BYTE(STX); MODEM_PUT_1_BYTE(id); ck_a = id; ck_b = id; }
|
||||
|
||||
#define ModemEndMessage() \
|
||||
{ MODEM_PUT_1_BYTE(ck_a); MODEM_PUT_1_BYTE(ck_b); MODEM_CHECK_RUNNING(); }
|
||||
|
||||
#if TX_BUF_SIZE == 256
|
||||
#define UPDATE_HEAD() { \
|
||||
tx_head++; \
|
||||
if (tx_head >= TX_BUF_SIZE) tx_head = 0; \
|
||||
}
|
||||
#else
|
||||
#define UPDATE_HEAD() { \
|
||||
tx_head++; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MODEM_CHECK_FREE_SPACE(_space) (tx_head>=tx_tail? _space < (TX_BUF_SIZE - (tx_head - tx_tail)) : _space < (tx_tail - tx_head))
|
||||
|
||||
#define MODEM_PUT_1_BYTE(_byte) { \
|
||||
tx_buf[tx_head] = _byte; \
|
||||
UPDATE_HEAD(); \
|
||||
}
|
||||
|
||||
#define MODEM_PUT_1_BYTE_BY_ADDR(_byte) { \
|
||||
tx_buf[tx_head] = *(_byte); \
|
||||
ck_a += *(_byte); \
|
||||
ck_b += ck_a; \
|
||||
UPDATE_HEAD(); \
|
||||
}
|
||||
|
||||
#define MODEM_PUT_2_BYTE_BY_ADDR(_byte) { \
|
||||
MODEM_PUT_1_BYTE_BY_ADDR(_byte); \
|
||||
MODEM_PUT_1_BYTE_BY_ADDR(_byte+1); \
|
||||
}
|
||||
|
||||
#define MODEM_PUT_4_BYTE_BY_ADDR(_byte) { \
|
||||
MODEM_PUT_1_BYTE_BY_ADDR(_byte); \
|
||||
MODEM_PUT_1_BYTE_BY_ADDR(_byte+1); \
|
||||
MODEM_PUT_1_BYTE_BY_ADDR(_byte+2); \
|
||||
MODEM_PUT_1_BYTE_BY_ADDR(_byte+3); \
|
||||
}
|
||||
|
||||
#define MODEM_LOAD_NEXT_BYTE() { \
|
||||
tx_byte = tx_buf[tx_tail]; \
|
||||
tx_byte_idx = 0; \
|
||||
tx_tail++; \
|
||||
if( tx_tail >= TX_BUF_SIZE ) \
|
||||
tx_tail = 0; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // MODEM
|
||||
|
||||
#endif /* MODEM_H */
|
||||
@@ -58,8 +58,9 @@ static inline void sys_time_init( void ) {
|
||||
|
||||
#define SysTicsOfSec(s) (uint32_t)(s * PCLK / T0_PCLK_DIV + 0.5)
|
||||
#define FIFTY_MS SysTicsOfSec( 50e-3 )
|
||||
#define AVR_PERIOD_MS SysTicsOfSec( 15.625e-3 )
|
||||
|
||||
#define PERIODIC_TASK_PERIOD FIFTY_MS
|
||||
#define PERIODIC_TASK_PERIOD AVR_PERIOD_MS
|
||||
|
||||
static inline bool_t sys_time_periodic( void ) {
|
||||
uint32_t now = T0TC;
|
||||
|
||||
@@ -186,8 +186,10 @@ DIRARMBIN = $(DIRARM)/bin/
|
||||
LPC21ISP = $(DIRARMBIN)/lpc21isp
|
||||
#LPC21ISP = $(DIRARMBIN)/lpc21isp_beta
|
||||
LPC21ISP_PORT = /dev/ttyS0
|
||||
LPC21ISP_BAUD = 115200
|
||||
LPC21ISP_XTAL = 14746
|
||||
#LPC21ISP_BAUD = 115200
|
||||
LPC21ISP_BAUD = 38400
|
||||
#LPC21ISP_XTAL = 14746
|
||||
LPC21ISP_XTAL = 12000
|
||||
LPC21ISP_FLASHFILE = $(TARGET).hex
|
||||
# verbose output:
|
||||
## LPC21ISP_DEBUG = -debug
|
||||
|
||||
+29
-124
@@ -1,4 +1,11 @@
|
||||
.global main // int main(void)
|
||||
/*
|
||||
crt0.S for LPC2xxx
|
||||
- based on examples from R O Software
|
||||
- based on examples from newlib-lpc
|
||||
- based on an example from Anglia Designs
|
||||
|
||||
collected and modified by Martin Thomas
|
||||
*/
|
||||
|
||||
.global _etext // -> .data initial values in ROM
|
||||
.global _data // -> .data area in RAM
|
||||
@@ -6,8 +13,6 @@
|
||||
.global __bss_start // -> .bss area in RAM
|
||||
.global __bss_end__ // end of .bss area
|
||||
.global _stack // top of stack
|
||||
|
||||
.global irq_dispatcher
|
||||
|
||||
// Stack Sizes
|
||||
.set UND_STACK_SIZE, 0x00000004
|
||||
@@ -28,62 +33,10 @@
|
||||
.equ I_BIT, 0x80 // when I bit is set, IRQ is disabled
|
||||
.equ F_BIT, 0x40 // when F bit is set, FIQ is disabled
|
||||
|
||||
#define FOSC 14745600 /* External clock input frequency (must be between 10 MHz and 25 MHz) */
|
||||
|
||||
#define USE_PLL 1 /* 0 = do not use on-chip PLL,
|
||||
1 = use on-chip PLL) */
|
||||
#define PLL_MUL 4 /* PLL multiplication factor (1 to 32) */
|
||||
#define PLL_DIV 2 /* PLL division factor (1, 2, 4, or 8) */
|
||||
#define PBSD 4 /* Peripheral bus speed divider (1, 2, or 4) */
|
||||
|
||||
/* initialize the MAM (Memory Accelerator Module) */
|
||||
#if (FOSC * PLL_MUL) < 20000000
|
||||
#define MAM_TIMING 1 /* number of CCLK to read from the FLASH */
|
||||
#elif (FOSC * PLL_MUL) < 40000000
|
||||
#define MAM_TIMING 2 /* number of CCLK to read from the FLASH */
|
||||
#else
|
||||
#define MAM_TIMING 3 /* number of CCLK to read from the FLASH */
|
||||
#endif
|
||||
#define MAM_SETTING 2 /* 0=disabled,
|
||||
1=partly enabled (enabled for code prefetch, but not for data),
|
||||
2=fully enabled */
|
||||
#define MEM_MAPPING 1 /* 0=Boot loader,
|
||||
1=User Flash,
|
||||
2=User RAM */
|
||||
|
||||
#define VAL_PLLCFG_MSEL ((PLL_MUL - 1) << 0)
|
||||
#if (PLL_DIV == 1)
|
||||
#define PLL_DIV_VALUE 0x00
|
||||
#elif (PLL_DIV == 2)
|
||||
#define PLL_DIV_VALUE 0x01
|
||||
#elif (PLL_DIV == 4)
|
||||
#define PLL_DIV_VALUE 0x10
|
||||
#elif (PLL_DIV == 8)
|
||||
#define PLL_DIV_VALUE 0x11
|
||||
#endif
|
||||
#define VAL_PLLCFG_PSEL (PLL_DIV_VALUE << 5)
|
||||
#define VAL_PLLCFG (VAL_PLLCFG_MSEL | VAL_PLLCFG_PSEL)
|
||||
|
||||
|
||||
# Phase Locked Loop (PLL) definitions
|
||||
.equ PLL_BASE, 0xE01FC080 /* PLL Base Address */
|
||||
.equ PLLCON_OFS, 0x00 /* PLL Control Offset*/
|
||||
.equ PLLCFG_OFS, 0x04 /* PLL Configuration Offset */
|
||||
.equ PLLSTAT_OFS, 0x08 /* PLL Status Offset */
|
||||
.equ PLLFEED_OFS, 0x0C /* PLL Feed Offset */
|
||||
.equ PLLCON_PLLE, (1<<0) /* PLL Enable */
|
||||
.equ PLLCON_PLLC, (1<<1) /* PLL Connect */
|
||||
.equ PLLSTAT_PLOCK, (1<<10) /* PLL Lock Status */
|
||||
.equ MAM_BASE, 0xE01FC000 /* Memory Accelerator Module */
|
||||
.equ MAMCR_OFS, 0x00 /* MAM Control */
|
||||
.equ MAMTIM_OFS, 0x04 /* MAM Timing */
|
||||
.equ MEMMAP_BASE, 0xE01FC040 /* Memory Mapping Base */
|
||||
.equ MEMMAP_OFS, 0x00 /* Memory Mapping */
|
||||
.equ VIC_BASE, 0xFFFFF000 /* Vector Interrupt Controller */
|
||||
.equ VICIRQStats_OFS,0x10 /* IRQ Status Register */
|
||||
.equ VICIntEnClr_OFS,0x14 /* VIC Interrupt Enable Clear */
|
||||
|
||||
.text
|
||||
.arm
|
||||
.section .init, "ax"
|
||||
|
||||
.code 32
|
||||
.align 2
|
||||
|
||||
@@ -100,20 +53,9 @@ Vectors:
|
||||
ldr pc,_pabt // program abort - _pabt
|
||||
ldr pc,_dabt // data abort - _dabt
|
||||
nop // reserved
|
||||
b irq_handler // IRQ - jump to fct
|
||||
ldr pc,[pc,#-0xFF0] // IRQ - read the VIC
|
||||
ldr pc,_fiq // FIQ - _fiq
|
||||
|
||||
irq_handler:
|
||||
stmfd sp!,{r0-r12,lr} // save regs r0-r12 and link register
|
||||
|
||||
ldr r1, =VIC_BASE // load IRQ status
|
||||
ldr r0, [r1, #VICIRQStats_OFS]
|
||||
bl irq_dispatcher // c-function irq
|
||||
|
||||
ldmfd sp!,{r0-r12,lr} // restore regs and lr
|
||||
subs pc,lr,#4
|
||||
|
||||
|
||||
#if 0
|
||||
// Use this group for production
|
||||
_undf: .word _reset // undefined - _reset
|
||||
@@ -152,55 +94,6 @@ _start:
|
||||
start:
|
||||
_mainCRTStartup:
|
||||
|
||||
#if (USE_PLL == 1)
|
||||
LDR R0, =PLL_BASE
|
||||
MOV R1, #0xAA
|
||||
MOV R2, #0x55
|
||||
|
||||
# Disable PLL before programming
|
||||
MOV R3,#0
|
||||
STR R3, [R0, #PLLCON_OFS]
|
||||
STR R1, [R0, #PLLFEED_OFS]
|
||||
STR R2, [R0, #PLLFEED_OFS]
|
||||
|
||||
# Configure and Enable PLL
|
||||
MOV R3, #VAL_PLLCFG
|
||||
STR R3, [R0, #PLLCFG_OFS]
|
||||
MOV R3, #PLLCON_PLLE
|
||||
STR R3, [R0, #PLLCON_OFS]
|
||||
STR R1, [R0, #PLLFEED_OFS]
|
||||
STR R2, [R0, #PLLFEED_OFS]
|
||||
|
||||
# Wait until PLL Locked
|
||||
PLL_Loop: LDR R3, [R0, #PLLSTAT_OFS]
|
||||
ANDS R3, R3, #PLLSTAT_PLOCK
|
||||
BEQ PLL_Loop
|
||||
|
||||
# Switch to PLL Clock
|
||||
MOV R3, #(PLLCON_PLLE | PLLCON_PLLC)
|
||||
STR R3, [R0, #PLLCON_OFS]
|
||||
STR R1, [R0, #PLLFEED_OFS]
|
||||
STR R2, [R0, #PLLFEED_OFS]
|
||||
#endif
|
||||
// switch on MAM
|
||||
ldr R0, =MAM_BASE
|
||||
mov R1, #MAM_TIMING
|
||||
mov R2, #MAM_SETTING
|
||||
str R1, [R0, #MAMTIM_OFS]
|
||||
str R2, [R0, #MAMCR_OFS]
|
||||
|
||||
// set interrupt table location
|
||||
ldr R0, =MEMMAP_BASE
|
||||
mov R1, #MEM_MAPPING
|
||||
str R1, [R0, #MEMMAP_OFS]
|
||||
|
||||
// turn off interrupts
|
||||
ldr R0, =VIC_BASE
|
||||
mov R1, #0xFFFFFFFF
|
||||
str R1, [R0, #VICIntEnClr_OFS]
|
||||
|
||||
|
||||
|
||||
// Initialize Interrupt System
|
||||
// - Set stack location for each mode
|
||||
// - Leave in System Mode with Interrupts Disabled
|
||||
@@ -263,11 +156,6 @@ ctor_loop:
|
||||
B ctor_loop
|
||||
ctor_end:
|
||||
|
||||
enable_irq:
|
||||
mrs r0,CPSR // get current CPSR
|
||||
bic r0,r0,#I_BIT // clear I bit, normal interrupts enabled
|
||||
msr CPSR_c,r0 // write CPSR
|
||||
|
||||
// Call main program: main(0)
|
||||
// --------------------------
|
||||
mov r0,#0 // no arguments (argc = 0)
|
||||
@@ -277,10 +165,27 @@ enable_irq:
|
||||
mov r7,r0 // null frame pointer for thumb
|
||||
ldr r10,=main
|
||||
mov lr,pc
|
||||
|
||||
/* Enter the C code, use BX instruction so as to never return */
|
||||
/* use BLX (?) main if you want to use c++ destructors below */
|
||||
|
||||
bx r10 // enter main()
|
||||
|
||||
/* "global object"-dtors are never called and it should not be
|
||||
needed since there is no OS to exit to. */
|
||||
/* Call destructors */
|
||||
# LDR r0, =__dtors_start__
|
||||
# LDR r1, =__dtors_end__
|
||||
dtor_loop:
|
||||
# CMP r0, r1
|
||||
# BEQ dtor_end
|
||||
# LDR r2, [r0], #4
|
||||
# STMFD sp!, {r0-r1}
|
||||
# MOV lr, pc
|
||||
# MOV pc, r2
|
||||
# LDMFD sp!, {r0-r1}
|
||||
# B dtor_loop
|
||||
dtor_end:
|
||||
|
||||
.size _start, . - _start
|
||||
.endfunc
|
||||
|
||||
@@ -380,8 +380,8 @@ void uart1Init(uint16_t baud, uint8_t mode, uint8_t fmode)
|
||||
// initialize the interrupt vector
|
||||
VICIntSelect &= ~VIC_BIT(VIC_UART1); // UART1 selected as IRQ
|
||||
VICIntEnable = VIC_BIT(VIC_UART1); // UART1 interrupt enabled
|
||||
VICVectCntl1 = VIC_ENABLE | VIC_UART1;
|
||||
VICVectAddr1 = (uint32_t)uart1ISR; // address of the ISR
|
||||
VICVectCntl2 = VIC_ENABLE | VIC_UART1;
|
||||
VICVectAddr2 = (uint32_t)uart1ISR; // address of the ISR
|
||||
|
||||
#ifdef UART1_TX_INT_MODE
|
||||
uart1_tx_extract_idx = uart1_tx_insert_idx = 0;
|
||||
|
||||
+16
-6
@@ -43,8 +43,13 @@
|
||||
|
||||
#define PERIODIC_SEND_BAT() Downlink({ int16_t e = energy; DOWNLINK_SEND_BAT(&desired_gaz, &vsupply, &estimator_flight_time, &low_battery, &block_time, &stage_time, &e); })
|
||||
|
||||
#define PERIODIC_SEND_DEBUG() DOWNLINK_SEND_DEBUG(&link_fbw_nb_err, &link_fbw_fbw_nb_err, &modem_nb_ovrn, &gps_nb_ovrn, &mcu1_ppm_cpt);
|
||||
#ifdef MCU_SPI_LINK
|
||||
#define PERIODIC_SEND_DEBUG_MCU_LINK() DOWNLINK_SEND_DEBUG_MCU_LINK(&link_fbw_nb_err, &link_fbw_fbw_nb_err, &mcu1_ppm_cpt);
|
||||
#else
|
||||
#define PERIODIC_SEND_DEBUG_MCU_LINK() {}
|
||||
#endif
|
||||
|
||||
#define PERIODIC_SEND_DEBUG_MODEM() DOWNLINK_SEND_DEBUG_MODEM(&modem_nb_ovrn)
|
||||
#define PERIODIC_SEND_ATTITUDE() Downlink({ \
|
||||
int8_t phi = DegOfRad(estimator_phi); \
|
||||
int8_t psi = DegOfRad(estimator_psi); \
|
||||
@@ -52,7 +57,6 @@
|
||||
DOWNLINK_SEND_ATTITUDE(&phi, &psi, &theta); \
|
||||
})
|
||||
|
||||
#define PERIODIC_SEND_ADC() DOWNLINK_SEND_ADC(&ir_roll, &ir_pitch);
|
||||
#define PERIODIC_SEND_PPRZ_MODE() DOWNLINK_SEND_PPRZ_MODE(&pprz_mode, &vertical_mode, &lateral_mode, &horizontal_mode, &inflight_calib_mode, &mcu1_status, &ir_estim_mode);
|
||||
#define PERIODIC_SEND_DESIRED() DOWNLINK_SEND_DESIRED(&desired_roll, &desired_pitch, &desired_x, &desired_y, &desired_altitude, &desired_climb);
|
||||
|
||||
@@ -73,7 +77,17 @@
|
||||
#define PERIODIC_SEND_SETTINGS() {}
|
||||
#endif
|
||||
|
||||
#ifdef INFRARED
|
||||
#define PERIODIC_SEND_ADC() DOWNLINK_SEND_ADC(&ir_roll, &ir_pitch);
|
||||
#define SEND_RAD_OF_IR() Downlink({ int16_t rad = DeciDegOfRad(estimator_rad); DOWNLINK_SEND_RAD_OF_IR(&ir_roll, &rad, &estimator_rad_of_ir);})
|
||||
#define PERIODIC_SEND_CALIB_START() if (!estimator_flight_time && calib_status == WAITING_CALIB_CONTRAST) { DOWNLINK_SEND_CALIB_START(); }
|
||||
#define PERIODIC_SEND_CALIB_CONTRAST() if (!estimator_flight_time && calib_status == CALIB_DONE) { DOWNLINK_SEND_CALIB_CONTRAST(&ir_contrast); }
|
||||
#else
|
||||
#define PERIODIC_SEND_ADC() {}
|
||||
#define SEND_RAD_OF_IR() {}
|
||||
#define PERIODIC_SEND_CALIB_START() {}
|
||||
#define PERIODIC_SEND_CALIB_CONTRAST() {}
|
||||
#endif
|
||||
|
||||
#define PERIODIC_SEND_CALIBRATION() DOWNLINK_SEND_CALIBRATION(&climb_sum_err, &climb_pgain, &course_pgain)
|
||||
|
||||
@@ -81,10 +95,6 @@
|
||||
|
||||
#define PERIODIC_SEND_SEGMENT() if (in_segment) { DOWNLINK_SEND_SEGMENT(&segment_x_1, &segment_y_1, &segment_x_2, &segment_y_2); }
|
||||
|
||||
#define PERIODIC_SEND_CALIB_START() if (!estimator_flight_time && calib_status == WAITING_CALIB_CONTRAST) { DOWNLINK_SEND_CALIB_START(); }
|
||||
|
||||
#define PERIODIC_SEND_CALIB_CONTRAST() if (!estimator_flight_time && calib_status == CALIB_DONE) { DOWNLINK_SEND_CALIB_CONTRAST(&ir_contrast); }
|
||||
|
||||
#ifdef IMU_ANALOG
|
||||
#define PERIODIC_SEND_IMU() { int16_t dummy = 42; DOWNLINK_SEND_IMU(&(from_fbw.euler_dot[0]), &(from_fbw.euler_dot[1]), &(from_fbw.euler_dot[2]), &dummy, &dummy, &dummy); }
|
||||
#else
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ void estimator_update_state_gps( void ) {
|
||||
* \a DOWNLINK_SEND_TAKEOFF
|
||||
*/
|
||||
void use_gps_pos( void ) {
|
||||
DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone);
|
||||
DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn);
|
||||
if (GPS_FIX_VALID(gps_mode)) {
|
||||
last_gps_msg_t = cputime;
|
||||
estimator_update_state_gps();
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
|
||||
|
||||
|
||||
uint8_t inflight_calib_mode = IF_CALIB_MODE_NONE;
|
||||
|
||||
#include "estimator.h"
|
||||
|
||||
/** Includes generated code from airframe.xml */
|
||||
|
||||
@@ -58,6 +58,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t inflight_calib_mode = IF_CALIB_MODE_NONE;
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// FIXME estimator_flight_time should not be manipuled here anymore
|
||||
@@ -205,7 +208,7 @@ uint8_t ac_ident = AC_ID;
|
||||
|
||||
/** \brief Send a serie of initialisation messages followed by a stream of periodic ones
|
||||
*
|
||||
* Called at 20Hz.
|
||||
* Called at 10Hz.
|
||||
*/
|
||||
static inline void reporting_task( void ) {
|
||||
static uint8_t boot = TRUE;
|
||||
@@ -219,7 +222,9 @@ static inline void reporting_task( void ) {
|
||||
}
|
||||
/** then report periodicly */
|
||||
else {
|
||||
IO1CLR = LED_2_BIT;
|
||||
PeriodicSend();
|
||||
IO1SET = LED_2_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +288,7 @@ inline void telecommand_task( void ) {
|
||||
* \brief Compute desired_course
|
||||
*/
|
||||
static void navigation_task( void ) {
|
||||
#ifdef FAILSAFE_DELAY_WITHOUT_GPS
|
||||
#if defined GPS && defined FAILSAFE_DELAY_WITHOUT_GPS
|
||||
/** This section is used for the failsafe of GPS */
|
||||
static uint8_t last_pprz_mode;
|
||||
static bool_t has_lost_gps = FALSE;
|
||||
@@ -307,7 +312,7 @@ static void navigation_task( void ) {
|
||||
has_lost_gps = FALSE;
|
||||
PERIODIC_SEND_PPRZ_MODE();
|
||||
}
|
||||
#endif /* FAILSAFE_DELAY_WITHOUT_GPS */
|
||||
#endif /* GPS && FAILSAFE_DELAY_WITHOUT_GPS */
|
||||
|
||||
/** Default to keep compatibility with previous behaviour */
|
||||
lateral_mode = LATERAL_MODE_COURSE;
|
||||
|
||||
@@ -136,12 +136,10 @@ void event_task_ap( void ) {
|
||||
#ifdef GPS
|
||||
if (GpsBuffer()) {
|
||||
ReadGpsBuffer();
|
||||
#ifdef DEBUG_ARM7
|
||||
if (IO1PIN & LED_2_BIT)
|
||||
IO1CLR = LED_2_BIT;
|
||||
else
|
||||
IO1SET = LED_2_BIT;
|
||||
#endif
|
||||
/* if (IO1PIN & LED_2_BIT) */
|
||||
/* IO1CLR = LED_2_BIT; */
|
||||
/* else */
|
||||
/* IO1SET = LED_2_BIT; */
|
||||
}
|
||||
if (gps_msg_received) {
|
||||
/* parse and use GPS messages */
|
||||
|
||||
+3
-2
@@ -73,8 +73,9 @@ extern uint8_t ck_a, ck_b;
|
||||
}
|
||||
|
||||
#define MODEM_PUT_1_BYTE_BY_ADDR(_byte) { \
|
||||
tx_buf[tx_head] = *(_byte); \
|
||||
ck_a += *(_byte); \
|
||||
uint8_t _x = *(_byte); \
|
||||
tx_buf[tx_head] = _x; \
|
||||
ck_a += _x; \
|
||||
ck_b += ck_a; \
|
||||
UPDATE_HEAD(); \
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ module Gen_onboard = struct
|
||||
let print_avr_field = fun avr_h (t, name, (_f:format option)) ->
|
||||
match t with
|
||||
Basic _ ->
|
||||
fprintf avr_h "\t MODEM_PUT_%d_BYTE_BY_ADDR((uint8_t*)(%s)); \\\n" (sizeof t) name
|
||||
fprintf avr_h "\t MODEM_PUT_%d_BYTE_BY_ADDR((const uint8_t*)(%s)); \\\n" (sizeof t) name
|
||||
| Array (t, i) ->
|
||||
let s = sizeof (Basic t) in
|
||||
fprintf avr_h "\t {\\\n\t int i;\\\n\t for(i = 0; i < %d; i++) {\\\n" i;
|
||||
|
||||
Reference in New Issue
Block a user