*** empty log message ***

This commit is contained in:
Antoine Drouin
2007-10-03 21:33:27 +00:00
parent 621dc4faa5
commit d7bc8d0007
10 changed files with 331 additions and 25 deletions
+68
View File
@@ -0,0 +1,68 @@
<airframe name="BOOZ">
<makefile>
ARCHI=arm7
FLASH_MODE = IAP
ctl.ARCHDIR = $(ARCHI)
ctl.ARCH = arm7tdmi
ctl.TARGET = ctl
ctl.TARGETDIR = ctl
ctl.CFLAGS += -DCONTROLLER -DCONFIG=\"conf_booz.h\"
ctl.srcs = main_booz.c
ctl.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(5e-3)'
ctl.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
ctl.CFLAGS += -DLED
ctl.srcs += $(SRC_ARCH)/armVIC.c
ctl.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B38400
ctl.srcs += $(SRC_ARCH)/uart_hw.c
ctl.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1
ctl.srcs += downlink.c pprz_transport.c
ctl.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart1
ctl.srcs += link_imu.c
ctl.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA
ctl.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
imu.ARCHDIR = $(ARCHI)
imu.ARCH = arm7tdmi
imu.TARGET = imu
imu.TARGETDIR = imu
imu.CFLAGS += -DIMU -DCONFIG=\"pprz_imu.h\"
imu.srcs = main_imu.c sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
imu.CFLAGS += -DLED
imu.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B38400
imu.srcs += $(SRC_ARCH)/uart_hw.c
imu.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1
imu.srcs += downlink.c pprz_transport.c
imu.CFLAGS += -DADC -DUSE_AD0 -DUSE_AD0_1 -DUSE_AD0_2 -DUSE_AD0_3 -DUSE_AD0_4
imu.srcs += $(SRC_ARCH)/adc_hw.c
imu.srcs += $(SRC_ARCH)/max1167.c
imu.srcs += $(SRC_ARCH)/micromag.c
imu.srcs += imu_v3.c
imu.srcs += ahrs_new.c
imu.srcs += link_imu.c
</makefile>
</airframe>
+1 -1
View File
@@ -1,4 +1,4 @@
<airframe name="DEMO">
<airframe name="MOTOR_BENCH">
<makefile>
+50
View File
@@ -0,0 +1,50 @@
#ifndef CONFIG_BOOZ_H
#define CONFIG_BOOZ_H
/* Master oscillator freq. */
#define FOSC (12000000)
/* PLL multiplier */
#define PLL_MUL (5)
/* CPU clock freq. */
#define CCLK (FOSC * PLL_MUL)
/* Peripheral bus speed mask 0x00->4, 0x01-> 1, 0x02 -> 2 */
#define PBSD_BITS 0x00
#define PBSD_VAL 4
/* Peripheral bus clock freq. */
#define PCLK (CCLK / PBSD_VAL)
/* PPM : rc rx on P0.6*/
#define PPM_PINSEL PINSEL0
#define PPM_PINSEL_VAL 0x02
#define PPM_PINSEL_BIT 12
#define LED_1_BANK 0
#define LED_1_PIN 12
#define LED_2_BANK 0
#define LED_2_PIN 13
/* ADC */
#define ADC_0 AdcBank0(4)
#ifdef USE_ADC_0
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_4
#endif
#define ADC_1 AdcBank0(1)
#ifdef USE_ADC_1
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD0_1
#endif
#endif /* CONFIG_BOOZ_H */
+27
View File
@@ -67,4 +67,31 @@
flight_plan="flight_plans/dummy.xml"
/>
<aircraft
name="DCMC"
ac_id="146"
airframe="airframes/dc_mc.xml"
radio="radios/T9cap.xml"
telemetry="telemetry/default.xml"
flight_plan="flight_plans/dummy.xml"
/>
<aircraft
name="BLMC"
ac_id="147"
airframe="airframes/bl_mc.xml"
radio="radios/T9cap.xml"
telemetry="telemetry/default.xml"
flight_plan="flight_plans/dummy.xml"
/>
<aircraft
name="BOOZ"
ac_id="148"
airframe="airframes/booz.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/booz.xml"
flight_plan="flight_plans/dummy.xml"
/>
</conf>
+6
View File
@@ -0,0 +1,6 @@
<!DOCTYPE settings SYSTEM "settings.dtd">
<settings>
<dl_settings>
</dl_settings>
</settings>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE telemetry SYSTEM "telemetry.dtd">
<telemetry>
<process name="Ap">
<mode name="default">
</mode>
<mode name="debug">
</mode>
</process>
<process name="Fbw">
<mode name="default">
</mode>
<mode name="debug">
</mode>
</process>
</telemetry>
+12
View File
@@ -0,0 +1,12 @@
#ifndef BOOZ_DOWNLINK_H
#define BOOZ_DOWNLINK_H
#include "std.h"
static inline void booz_downlink_periodic_task(void) {
}
#endif /* BOOZ_DOWNLINK_H */
+56 -21
View File
@@ -135,42 +135,61 @@ void SPI0_ISR(void) {
#ifdef FBW /* mega128 control board code */
#ifdef CONTROLLER /* lpc controller board */
#include <avr/io.h>
#if (__GNUC__ == 3)
#include <avr/signal.h>
#endif
#include <avr/interrupt.h>
#include "LPC21xx.h"
#include "interrupt_hw.h"
#include CONFIG
#include "spi.h"
#include "fbw_downlink.h"
//#include CONFIG
//#include "spi.h"
//#include "fbw_downlink.h"
/* DRDY connected pin to P0.16 EINT0 */
#define IMU_DRDY_PINSEL PINSEL1
#define IMU_DRDY_PINSEL_VAL 0x01
#define IMU_DRDY_PINSEL_BIT 0
#define IMU_DRDY_EINT 0
static void EXTINT0_ISR(void) __attribute__((naked));
void link_imu_init ( void ) {
spi_buffer_input = (uint8_t*)&link_imu_state;
spi_buffer_output = (uint8_t*)&link_imu_state_foo;
spi_buffer_length = sizeof(link_imu_state);
/* configure DRDY pin */
IMU_DRDY_PINSEL |= IMU_DRDY_PINSEL_VAL << IMU_DRDY_PINSEL_BIT;
SetBit(EXTMODE, IMU_DRDY_EINT); /* EINT is edge trigered */
ClearBit(EXTPOLAR,IMU_DRDY_EINT); /* EINT is trigered on falling edge */
SetBit(EXTINT,IMU_DRDY_EINT); /* clear pending EINT */
/* initialize interrupt vector */
VICIntSelect &= ~VIC_BIT( VIC_EINT0 ); /* select EINT0 as IRQ source */
VICIntEnable = VIC_BIT( VIC_EINT0 ); /* enable it */
VICVectCntl9 = VIC_ENABLE | VIC_EINT0;
VICVectAddr9 = (uint32_t)EXTINT0_ISR; // address of the ISR
// spi_buffer_input = (uint8_t*)&link_imu_state;
// spi_buffer_output = (uint8_t*)&link_imu_state_foo;
// spi_buffer_length = sizeof(link_imu_state);
/** Falling edge */
SetBit(EICRB, ISC61);
// SetBit(EICRB, ISC61);
/** Clr pending interrupt */
SetBit(EIFR, INTF6);
// SetBit(EIFR, INTF6);
/** Enable DTRDY interrupt */
SetBit(EIMSK, INT6);
// SetBit(EIMSK, INT6);
}
static inline void link_imu_read( void ) {
SpiSelectSlave0();
SpiStart();
// SpiSelectSlave0();
// SpiStart();
}
SIGNAL( SIG_INTERRUPT6 ) {
link_imu_read();
}
//SIGNAL( SIG_INTERRUPT6 ) {
// link_imu_read();
//}
void link_imu_event_task( void ) {
/* static uint8_t foo; */
@@ -181,4 +200,20 @@ void link_imu_event_task( void ) {
/* } */
}
#endif /* FBW */
void EXTINT0_ISR(void) {
ISR_ENTRY();
/* read dummy control byte reply */
// uint8_t foo __attribute__ ((unused)) = SSPDR;
/* trigger 2 bytes read */
// SSPDR = 0;
// SSPDR = 0;
/* enable timeout interrupt */
// SpiEnableRti();
/* clear EINT2 */
SetBit(EXTINT,IMU_DRDY_EINT); /* clear EINT0 */
VICVectAddr = 0x00000000; /* clear this interrupt from the VIC */
ISR_EXIT();
}
#endif /* CONTROLLER */
+3 -3
View File
@@ -33,12 +33,12 @@ extern void link_imu_send( void );
#endif /* IMU */
#ifdef FBW
#ifdef CONTROLLER
void link_imu_event_task( void );
extern void link_imu_event_task( void );
#endif /* FBW */
#endif /* CONTROLLER */
#endif /* LINK_IMU_H */
+92
View File
@@ -0,0 +1,92 @@
#include "std.h"
#include "init_hw.h"
#include "sys_time.h"
#include "led.h"
#include "interrupt_hw.h"
#include "radio_control.h"
#include "uart.h"
#include "messages.h"
#include "downlink.h"
#include "booz_downlink.h"
#include "link_imu.h"
static inline void main_init( void );
static inline void main_periodic_task( void );
static inline void main_event_task( void );
static inline void main_dl_parse_msg( void );
int main( void ) {
main_init();
while(1) {
if (sys_time_periodic())
main_periodic_task();
main_event_task();
}
return 0;
}
static inline void main_init( void ) {
hw_init();
led_init();
sys_time_init();
radio_control_init();
link_imu_init();
uart1_init_tx();
int_enable();
}
static inline void main_periodic_task( void ) {
radio_control_periodic_task();
booz_downlink_periodic_task();
static uint8_t my_cnt = 0;
my_cnt++;
if (!(my_cnt%10)) {
LED_TOGGLE(1);
uint16_t foo;
DOWNLINK_SEND_BOOT(&foo);
}
}
static inline void main_event_task( void ) {
if (PprzBuffer()) {
ReadPprzBuffer();
if (pprz_msg_received) {
pprz_parse_payload();
pprz_msg_received = FALSE;
}
}
if (dl_msg_available) {
main_dl_parse_msg();
dl_msg_available = FALSE;
LED_TOGGLE(2);
}
}
bool_t dl_msg_available;
#define MSG_SIZE 128
uint8_t dl_buffer[MSG_SIZE] __attribute__ ((aligned));
#include "settings.h"
#define IdOfMsg(x) (x[1])
static inline void main_dl_parse_msg(void) {
uint8_t msg_id = IdOfMsg(dl_buffer);
if (msg_id == DL_SETTING) {
uint8_t i = DL_SETTING_index(dl_buffer);
float var = DL_SETTING_value(dl_buffer);
DlSetting(i, var);
DOWNLINK_SEND_DL_VALUE(&i, &var);
}
}