mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-25 14:35:51 +08:00
*** empty log message ***
This commit is contained in:
+2
-2
@@ -181,8 +181,8 @@ endif
|
||||
|
||||
# Settings and variables:
|
||||
LPC21ISP = lpc21isp
|
||||
LPC21ISP_PORT = /dev/ttyUSB0
|
||||
#LPC21ISP_PORT = /dev/ttyS0
|
||||
#LPC21ISP_PORT = /dev/ttyUSB0
|
||||
LPC21ISP_PORT = /dev/ttyS0
|
||||
LPC21ISP_FLASHFILE = $(OBJDIR)/$(TARGET).hex
|
||||
# verbose output:
|
||||
#LPC21ISP_DEBUG = -debug
|
||||
|
||||
@@ -118,7 +118,7 @@ fbw.srcs += commands.c
|
||||
fbw.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 -DSERVOS_4017_CLOCK_FALLING
|
||||
fbw.srcs += $(SRC_ARCH)/servos_4017_hw.c
|
||||
|
||||
fbw.CFLAGS += -DRADIO_CONTROL
|
||||
fbw.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA
|
||||
fbw.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
|
||||
|
||||
fbw.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
/* reset on P1.25 */
|
||||
#define SERVO_RESET_PIN 25
|
||||
#define SERVO_RESET_PINSEL PINSEL2
|
||||
#define SERVO_RESET_PINSEL_VAL 0
|
||||
#define SERVO_RESET_PINSEL_BIT 3
|
||||
//#define SERVO_RESET_PINSEL_VAL 0
|
||||
//#define SERVO_RESET_PINSEL_BIT 3
|
||||
|
||||
/* ADCs : supply on AD0.6 ( P0.4 ) */
|
||||
#define USE_AD0_6
|
||||
|
||||
@@ -6,16 +6,12 @@ ap.ARCHDIR = $(ARCHI)
|
||||
ap.ARCH = arm7tdmi
|
||||
ap.TARGET = autopilot
|
||||
ap.TARGETDIR = autopilot
|
||||
ap.CFLAGS += -DAP -DCONFIG=\"classix.h\" -DLED -DTIME_LED=1
|
||||
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_ap_2.c main.c
|
||||
|
||||
|
||||
fbw.ARCHDIR = $(ARCHI)
|
||||
fbw.ARCH = arm7tdmi
|
||||
fbw.TARGET = fbw
|
||||
fbw.TARGETDIR = fbw
|
||||
fbw.CFLAGS += -DFBW -DCONFIG=\"classix.h\" -DLED -DTIME_LED=1
|
||||
fbw.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main.c
|
||||
|
||||
LPC21ISP_BAUD = 38400
|
||||
LPC21ISP_XTAL = 12000
|
||||
@@ -2,5 +2,5 @@ ap.srcs += main_ap.c sys_time.c main.c inter_mcu.c link_mcu.c gps_ubx.c gps.c in
|
||||
ap.CFLAGS += -DMCU_SPI_LINK -DGPS -DUBX -DINFRARED -DRADIO_CONTROL -DINTER_MCU
|
||||
|
||||
fbw.srcs += sys_time.c main_fbw.c main.c commands.c radio_control.c pprz_transport.c downlink.c inter_mcu.c spi.c link_mcu.c
|
||||
fbw.CFLAGS += -DRADIO_CONTROL -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DINTER_MCU -DMCU_SPI_LINK
|
||||
fbw.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DINTER_MCU -DMCU_SPI_LINK
|
||||
|
||||
|
||||
@@ -28,14 +28,16 @@
|
||||
</process>
|
||||
<process name="Fbw">
|
||||
<mode name="default">
|
||||
<message name="COMMANDS" period="5"/>
|
||||
<message name="FBW_STATUS" period="2"/>
|
||||
<message name="PPM" period="0.5"/>
|
||||
<message name="RC" period="0.5"/>
|
||||
<message name="COMMANDS" period="1"/>
|
||||
<message name="FBW_STATUS" period="1"/>
|
||||
<message name="ADC" period="1"/>
|
||||
</mode>
|
||||
<mode name="debug">
|
||||
<message name="PPM" period="0.5"/>
|
||||
<message name="RC" period="0.5"/>
|
||||
<message name="COMMANDS" period="0.5"/>
|
||||
<message name="COMMANDS" period="0.5"/>
|
||||
<message name="FBW_STATUS" period="1"/>
|
||||
</mode>
|
||||
</process>
|
||||
|
||||
@@ -7,18 +7,23 @@
|
||||
static inline void ppm_init ( void ) {
|
||||
/* select pin for capture */
|
||||
PPM_PINSEL |= PPM_PINSEL_VAL << PPM_PINSEL_BIT;
|
||||
/* enable capture 0.2 on rising edge + trigger interrupt */
|
||||
/* enable capture 0.2 on falling edge + trigger interrupt */
|
||||
#if defined RADIO_CONTROL_TYPE && RADIO_CONTROL_TYPE == RC_FUTABA
|
||||
T0CCR = TCCR_CR2_F | TCCR_CR2_I;
|
||||
#elif defined RADIO_CONTROL_TYPE && RADIO_CONTROL_TYPE == RC_JR
|
||||
T0CCR = TCCR_CR2_R | TCCR_CR2_I;
|
||||
#else
|
||||
#error "ppm_hw.h: Unknown RADIO_CONTROL_TYPE"
|
||||
#endif
|
||||
|
||||
ppm_valid = FALSE;
|
||||
}
|
||||
|
||||
#define PPM_NB_CHANNEL PPM_NB_PULSES
|
||||
|
||||
|
||||
#define PPM_ISR() { \
|
||||
static uint8_t state = PPM_NB_CHANNEL; \
|
||||
static uint32_t last; \
|
||||
static uint32_t last; \
|
||||
\
|
||||
uint32_t now = T0CR2; \
|
||||
uint32_t length = now - last; \
|
||||
|
||||
@@ -14,6 +14,7 @@ void actuators_init ( void ) {
|
||||
|
||||
/* select reset pin as GPIO output */
|
||||
IO1DIR |= _BV(SERVO_RESET_PIN);
|
||||
PINSEL2 &= ~(_BV(3)); /* P1.25-16 are used as GPIO */
|
||||
// SERVO_RESET_PINSEL |= SERVO_RESET_PINSEL_VAL << SERVO_RESET_PINSEL_BIT;
|
||||
/* assert RESET */
|
||||
IO1SET = _BV(SERVO_RESET_PIN);
|
||||
|
||||
@@ -22,9 +22,9 @@ extern uint8_t servos_4017_idx;
|
||||
#ifndef SERVOS_4017_CLOCK_FALLING
|
||||
#define SERVOS_4017_ISR() { \
|
||||
if (servos_4017_idx >= _4017_NB_CHANNELS) { \
|
||||
IO1SET = _BV(SERVO_RESET_PIN); \
|
||||
SetBit(IO1SET, SERVO_RESET_PIN); \
|
||||
servos_4017_idx = 0; \
|
||||
IO1CLR = _BV(SERVO_RESET_PIN); \
|
||||
SetBit(IO1CLR, SERVO_RESET_PIN); \
|
||||
} \
|
||||
\
|
||||
/* request clock high on next match */ \
|
||||
@@ -33,19 +33,19 @@ extern uint8_t servos_4017_idx;
|
||||
T0EMR &= ~TEMR_EM1; \
|
||||
servos_4017_idx++; \
|
||||
}
|
||||
#else /* SERVOS_4017_CLOCK_ON_RESET */
|
||||
#else /* SERVOS_4017_CLOCK_FALLING */
|
||||
#define SERVOS_4017_RESET_WIDTH SERVOS_TICS_OF_USEC(1000)
|
||||
#define SERVOS_4017_FIRST_PULSE_WIDTH SERVOS_TICS_OF_USEC(100)
|
||||
#define SERVOS_4017_ISR() { \
|
||||
if (servos_4017_idx == _4017_NB_CHANNELS) { \
|
||||
IO1SET = _BV(SERVO_RESET_PIN); \
|
||||
if (servos_4017_idx == _4017_NB_CHANNELS) { \
|
||||
SetBit(IO1SET, SERVO_RESET_PIN); \
|
||||
/* Start a long 1ms reset, keep clock low */ \
|
||||
T0MR1 += SERVOS_4017_RESET_WIDTH; \
|
||||
servos_4017_idx++; \
|
||||
} \
|
||||
else if (servos_4017_idx > _4017_NB_CHANNELS) { \
|
||||
/* Clear the reset*/ \
|
||||
IO1CLR = _BV(SERVO_RESET_PIN); \
|
||||
SetBit(IO1CLR,SERVO_RESET_PIN); \
|
||||
/* assert clock */ \
|
||||
T0EMR |= TEMR_EM1; \
|
||||
/* Starts a short pulse-like period */ \
|
||||
|
||||
@@ -12,20 +12,22 @@
|
||||
void TIMER0_ISR ( void ) {
|
||||
ISR_ENTRY();
|
||||
|
||||
while (T0IR & TIMER0_IT_MASK) {
|
||||
#ifdef RADIO_CONTROL
|
||||
if (T0IR&TIR_CR2I) {
|
||||
PPM_ISR();
|
||||
/* clear interrupt */
|
||||
T0IR = TIR_CR2I;
|
||||
}
|
||||
if (T0IR&TIR_CR2I) {
|
||||
PPM_ISR();
|
||||
/* clear interrupt */
|
||||
T0IR = TIR_CR2I;
|
||||
}
|
||||
#endif
|
||||
#ifdef SERVOS_4017
|
||||
if (T0IR&TIR_MR1I) {
|
||||
SERVOS_4017_ISR();
|
||||
/* clear interrupt */
|
||||
T0IR = TIR_MR1I;
|
||||
}
|
||||
if (T0IR&TIR_MR1I) {
|
||||
SERVOS_4017_ISR();
|
||||
/* clear interrupt */
|
||||
T0IR = TIR_MR1I;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
VICVectAddr = 0x00000000;
|
||||
ISR_EXIT();
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ static inline void sys_time_init( void ) {
|
||||
VICIntSelect &= ~VIC_BIT(VIC_TIMER0);
|
||||
/* enable TIMER0 interrupt */
|
||||
VICIntEnable = VIC_BIT(VIC_TIMER0);
|
||||
/* on slot vic slot 4 */
|
||||
VICVectCntl4 = VIC_ENABLE | VIC_TIMER0;
|
||||
/* on slot vic slot 1 */
|
||||
VICVectCntl1 = VIC_ENABLE | VIC_TIMER0;
|
||||
/* address of the ISR */
|
||||
VICVectAddr4 = (uint32_t)TIMER0_ISR;
|
||||
VICVectAddr1 = (uint32_t)TIMER0_ISR;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,15 +36,6 @@
|
||||
#ifndef PPM_HW_H
|
||||
#define PPM_HW_H
|
||||
|
||||
|
||||
/**
|
||||
* Receiver types
|
||||
*/
|
||||
#define RXFUTABA 0
|
||||
#define RXJR 1
|
||||
|
||||
#define PPM_RX_TYPE RXFUTABA
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
@@ -60,12 +51,12 @@
|
||||
static inline void
|
||||
ppm_init( void )
|
||||
{
|
||||
#if PPM_RX_TYPE == RXFUTABA
|
||||
#if defined RADIO_CONTROL_TYPE && RADIO_CONTROL_TYPE == RC_FUTABA
|
||||
cbi( TCCR1B, ICES1 );
|
||||
#elif PPM_RX_TYPE == RXJR
|
||||
#elif defined RADIO_CONTROL_TYPE && RADIO_CONTROL_TYPE == RC_JR
|
||||
sbi( TCCR1B, ICES1 );
|
||||
#else
|
||||
# error "ppm.h: Unknown receiver type in PPM_RX_TYPE"
|
||||
#error "ppm_hw.h: Unknown RADIO_CONTROL_TYPE"
|
||||
#endif
|
||||
/* No noise cancelation */
|
||||
sbi( TCCR1B, ICNC1 );
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "uart.h"
|
||||
#include "main_fbw.h"
|
||||
#include "radio_control.h"
|
||||
#include "inter_mcu.h"
|
||||
|
||||
#define DOWNLINK_DEVICE DOWNLINK_FBW_DEVICE
|
||||
extern uint8_t telemetry_mode_Fbw;
|
||||
@@ -41,8 +42,7 @@ extern uint8_t telemetry_mode_Fbw;
|
||||
#define PERIODIC_SEND_PPM() DOWNLINK_SEND_PPM(PPM_NB_PULSES, ppm_pulses)
|
||||
#define PERIODIC_SEND_RC() DOWNLINK_SEND_RC(PPM_NB_PULSES, rc_values)
|
||||
#define PERIODIC_SEND_COMMANDS() DOWNLINK_SEND_COMMANDS(COMMANDS_NB, commands)
|
||||
#define PERIODIC_SEND_FBW_STATUS() DOWNLINK_SEND_FBW_STATUS(&fbw_mode, &rc_status, &fbw_mode)
|
||||
|
||||
#define PERIODIC_SEND_FBW_STATUS() DOWNLINK_SEND_FBW_STATUS(&fbw_state->nb_err, &rc_status, &fbw_mode)
|
||||
|
||||
#ifdef BRICOLAGE_ADC
|
||||
extern uint16_t adc0_val[];
|
||||
|
||||
@@ -93,6 +93,8 @@ static inline void inter_mcu_fill_fbw_state (void) {
|
||||
for(i = 0; i < RADIO_CTL_NB; i++)
|
||||
fbw_state->channels[i] = rc_values[i];
|
||||
|
||||
fbw_state->ppm_cpt = last_ppm_cpt;
|
||||
|
||||
uint8_t status;
|
||||
status = (rc_status == RC_OK ? _BV(STATUS_RADIO_OK) : 0);
|
||||
status |= (rc_status == RC_REALLY_LOST ? _BV(RADIO_REALLY_LOST) : 0);
|
||||
@@ -104,12 +106,8 @@ static inline void inter_mcu_fill_fbw_state (void) {
|
||||
fbw_state->status |= _BV(AVERAGED_CHANNELS_SENT);
|
||||
rc_values_contains_avg_channels = FALSE;
|
||||
}
|
||||
fbw_state->ppm_cpt = last_ppm_cpt;
|
||||
fbw_state->vsupply = fbw_vsupply_decivolt;
|
||||
/***
|
||||
for(i = 0; i < 10; i++)
|
||||
((uint8_t*)fbw_state)[i] = i+42;
|
||||
***/
|
||||
|
||||
}
|
||||
|
||||
/** Prepares date for next comm with AP. Set ::ap_ok to TRUE */
|
||||
|
||||
@@ -66,7 +66,7 @@ void link_mcu_event_task( void ) {
|
||||
if (link_mcu_from_ap_msg.checksum == crc)
|
||||
inter_mcu_received_ap = TRUE;
|
||||
else
|
||||
link_mcu_from_fbw_msg.payload.from_fbw.nb_err++;
|
||||
fbw_state->nb_err++;
|
||||
}
|
||||
|
||||
#endif /* FBW */
|
||||
@@ -76,7 +76,7 @@ void link_mcu_event_task( void ) {
|
||||
/*****************************************************************************/
|
||||
#ifdef AP
|
||||
|
||||
volatile uint8_t link_mcu_nb_err;
|
||||
uint8_t link_mcu_nb_err;
|
||||
uint8_t link_mcu_fbw_nb_err;
|
||||
|
||||
void link_mcu_init(void) {
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#define LINK_MCU_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "link_mcu_hw.h"
|
||||
#include "inter_mcu.h"
|
||||
#include "link_mcu_hw.h"
|
||||
|
||||
struct link_mcu_msg {
|
||||
union {
|
||||
@@ -46,14 +46,14 @@ extern struct link_mcu_msg link_mcu_from_fbw_msg;
|
||||
|
||||
extern bool_t link_mcu_received;
|
||||
|
||||
void link_mcu_event_task( void );
|
||||
extern void link_mcu_event_task( void );
|
||||
|
||||
#ifdef FBW
|
||||
extern void link_mcu_restart(void);
|
||||
#endif /* FBW */
|
||||
|
||||
#ifdef AP
|
||||
extern volatile uint8_t link_mcu_nb_err;
|
||||
extern uint8_t link_mcu_nb_err;
|
||||
extern uint8_t link_mcu_fbw_nb_err;
|
||||
|
||||
extern void link_mcu_init(void);
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "main_ap.h"
|
||||
|
||||
#include "interrupt_hw.h"
|
||||
#include "init_hw.h"
|
||||
#include "adc.h"
|
||||
@@ -230,9 +232,7 @@ static inline void reporting_task( void ) {
|
||||
}
|
||||
/** then report periodicly */
|
||||
else {
|
||||
// IO1CLR = LED_2_BIT;
|
||||
PeriodicSendAp();
|
||||
// IO1SET = LED_2_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ static void navigation_task( void ) {
|
||||
}
|
||||
|
||||
|
||||
#define PERIOD (256. * 1024. / CLOCK / 1000000.)
|
||||
//#define PERIOD (256. * 1024. / CLOCK / 1000000.)
|
||||
|
||||
/** Maximum time allowed for low battery level */
|
||||
#define LOW_BATTERY_DELAY 5
|
||||
@@ -385,7 +385,7 @@ inline void periodic_task_ap( void ) {
|
||||
static uint8_t _4Hz = 0;
|
||||
static uint8_t _1Hz = 0;
|
||||
|
||||
estimator_t += PERIOD;
|
||||
// estimator_t += PERIOD;
|
||||
|
||||
_20Hz++;
|
||||
if (_20Hz>=3) _20Hz=0;
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
#ifndef PPM_H
|
||||
#define PPM_H
|
||||
|
||||
/**
|
||||
* Radio control type : futaba is falling edge clocked whereas JR is rising edge
|
||||
*/
|
||||
#define RC_FUTABA 0
|
||||
#define RC_JR 1
|
||||
|
||||
#if defined RADIO_CONTROL
|
||||
|
||||
#include "std.h"
|
||||
|
||||
@@ -73,22 +73,22 @@ extern uint8_t ck_a, ck_b;
|
||||
|
||||
#define PprzTransportPut2ByteByAddr(_byte) { \
|
||||
PprzTransportPut1ByteByAddr(_byte); \
|
||||
PprzTransportPut1ByteByAddr((uint8_t*)_byte+1); \
|
||||
PprzTransportPut1ByteByAddr((const uint8_t*)_byte+1); \
|
||||
}
|
||||
|
||||
#define PprzTransportPut4ByteByAddr(_byte) { \
|
||||
PprzTransportPut2ByteByAddr(_byte); \
|
||||
PprzTransportPut2ByteByAddr((uint8_t*)_byte+2); \
|
||||
PprzTransportPut2ByteByAddr((const uint8_t*)_byte+2); \
|
||||
}
|
||||
|
||||
|
||||
#define PprzTransportPutInt8ByAddr(_x) PprzTransportPut1ByteByAddr(_x)
|
||||
#define PprzTransportPutUint8ByAddr(_x) PprzTransportPut1ByteByAddr((uint8_t*)_x)
|
||||
#define PprzTransportPutInt16ByAddr(_x) PprzTransportPut2ByteByAddr((uint8_t*)_x)
|
||||
#define PprzTransportPutUint16ByAddr(_x) PprzTransportPut2ByteByAddr((uint8_t*)_x)
|
||||
#define PprzTransportPutInt32ByAddr(_x) PprzTransportPut4ByteByAddr((uint8_t*)_x)
|
||||
#define PprzTransportPutUint32ByAddr(_x) PprzTransportPut4ByteByAddr((uint8_t*)_x)
|
||||
#define PprzTransportPutFloatByAddr(_x) PprzTransportPut4ByteByAddr((uint8_t*)_x)
|
||||
#define PprzTransportPutUint8ByAddr(_x) PprzTransportPut1ByteByAddr((const uint8_t*)_x)
|
||||
#define PprzTransportPutInt16ByAddr(_x) PprzTransportPut2ByteByAddr((const uint8_t*)_x)
|
||||
#define PprzTransportPutUint16ByAddr(_x) PprzTransportPut2ByteByAddr((const uint8_t*)_x)
|
||||
#define PprzTransportPutInt32ByAddr(_x) PprzTransportPut4ByteByAddr((const uint8_t*)_x)
|
||||
#define PprzTransportPutUint32ByAddr(_x) PprzTransportPut4ByteByAddr((const uint8_t*)_x)
|
||||
#define PprzTransportPutFloatByAddr(_x) PprzTransportPut4ByteByAddr((const uint8_t*)_x)
|
||||
|
||||
#define PprzTransportPutArray(_put, _n, _x) { \
|
||||
uint8_t i; \
|
||||
|
||||
Reference in New Issue
Block a user