mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-07 09:36:19 +08:00
*** empty log message ***
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
<airframe name="DEMO">
|
||||
|
||||
<makefile>
|
||||
|
||||
ARCHI=arm7
|
||||
|
||||
FLASH_MODE = IAP
|
||||
|
||||
|
||||
#
|
||||
# simple emtpy demo
|
||||
#
|
||||
demo1.ARCHDIR = $(ARCHI)
|
||||
demo1.ARCH = arm7tdmi
|
||||
demo1.TARGET = demo1
|
||||
demo1.TARGETDIR = demo1
|
||||
|
||||
demo1.CFLAGS += -DCONFIG=\"conf_demo.h\"
|
||||
demo1.srcs = main_demo1.c
|
||||
|
||||
#
|
||||
# hardware init ( pll ), system time and LEDs
|
||||
#
|
||||
demo2.ARCHDIR = $(ARCHI)
|
||||
demo2.ARCH = arm7tdmi
|
||||
demo2.TARGET = demo2
|
||||
demo2.TARGETDIR = demo2
|
||||
|
||||
demo2.CFLAGS += -DCONFIG=\"conf_demo.h\"
|
||||
demo2.srcs = main_demo2.c
|
||||
|
||||
demo2.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(10e-2)'
|
||||
demo2.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
|
||||
|
||||
demo2.CFLAGS += -DLED
|
||||
|
||||
#
|
||||
# UART (interrupts) and formated ascii printing
|
||||
#
|
||||
demo3.ARCHDIR = $(ARCHI)
|
||||
demo3.ARCH = arm7tdmi
|
||||
demo3.TARGET = demo3
|
||||
demo3.TARGETDIR = demo3
|
||||
|
||||
demo3.CFLAGS += -DCONFIG=\"conf_demo.h\"
|
||||
demo3.srcs = main_demo3.c
|
||||
|
||||
demo3.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(10e-2)'
|
||||
demo3.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
|
||||
|
||||
demo3.CFLAGS += -DLED
|
||||
|
||||
demo3.srcs += $(SRC_ARCH)/armVIC.c
|
||||
|
||||
demo3.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400
|
||||
demo3.srcs += $(SRC_ARCH)/uart_hw.c
|
||||
|
||||
#
|
||||
# DOWNLINK : send formated messages according to messages.xml description
|
||||
# requires "link" to run on the other side of the serial link
|
||||
#
|
||||
demo4.ARCHDIR = $(ARCHI)
|
||||
demo4.ARCH = arm7tdmi
|
||||
demo4.TARGET = demo4
|
||||
demo4.TARGETDIR = demo4
|
||||
|
||||
demo4.CFLAGS += -DCONFIG=\"conf_demo.h\"
|
||||
demo4.srcs = main_demo4.c
|
||||
|
||||
demo4.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(10e-2)'
|
||||
demo4.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
|
||||
|
||||
demo4.CFLAGS += -DLED
|
||||
|
||||
demo4.srcs += $(SRC_ARCH)/armVIC.c
|
||||
|
||||
demo4.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400
|
||||
demo4.srcs += $(SRC_ARCH)/uart_hw.c
|
||||
|
||||
demo4.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0
|
||||
demo4.srcs += downlink.c pprz_transport.c
|
||||
|
||||
#
|
||||
# DATALINK : receives datalink messages. demonstrates the "settings" service
|
||||
# which lets you adjust variables described in the settings.xml file
|
||||
# IvySendMsg("1ME RAW_DATALINK 144 SETTING;0;0;%d", foo_value);
|
||||
#
|
||||
demo5.ARCHDIR = $(ARCHI)
|
||||
demo5.ARCH = arm7tdmi
|
||||
demo5.TARGET = demo5
|
||||
demo5.TARGETDIR = demo5
|
||||
|
||||
demo5.CFLAGS += -DCONFIG=\"conf_demo.h\"
|
||||
demo5.srcs = main_demo5.c
|
||||
|
||||
demo5.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(10e-2)'
|
||||
demo5.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
|
||||
|
||||
demo5.CFLAGS += -DLED
|
||||
|
||||
demo5.srcs += $(SRC_ARCH)/armVIC.c
|
||||
|
||||
demo5.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400
|
||||
demo5.srcs += $(SRC_ARCH)/uart_hw.c
|
||||
|
||||
demo5.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0
|
||||
demo5.srcs += downlink.c pprz_transport.c
|
||||
|
||||
demo5.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0
|
||||
|
||||
|
||||
</makefile>
|
||||
|
||||
</airframe>
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef CONFIG_DEMO_H
|
||||
#define CONFIG_DEMO_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)
|
||||
|
||||
#define LED_1_BANK 1
|
||||
#define LED_1_PIN 24
|
||||
|
||||
|
||||
#endif /* CONFIG_DEMO_H */
|
||||
@@ -67,4 +67,15 @@
|
||||
gui_color="#ba6293"
|
||||
/>
|
||||
|
||||
|
||||
<aircraft
|
||||
name="DEMO"
|
||||
ac_id="144"
|
||||
airframe="airframes/demo.xml"
|
||||
radio="radios/T9cap.xml"
|
||||
telemetry="telemetry/default.xml"
|
||||
flight_plan="flight_plans/dummy.xml"
|
||||
settings="settings/demo5_settings.xml"
|
||||
/>
|
||||
|
||||
</conf>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE settings SYSTEM "settings.dtd">
|
||||
|
||||
<!-- -->
|
||||
|
||||
<settings>
|
||||
<dl_settings>
|
||||
<dl_setting MAX="1000" MIN="0" STEP="5" VAR="foo"/>
|
||||
</dl_settings>
|
||||
</settings>
|
||||
@@ -25,7 +25,7 @@ OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGET)
|
||||
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
|
||||
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
|
||||
|
||||
INCLUDES = -I $(PAPARAZZI_SRC)/sw/include -I $(PAPARAZZI_SRC)/sw/airborne -I $(PAPARAZZI_SRC)/conf/autopilot -I $(PAPARAZZI_SRC)/sw/airborne/$(ARCHI) -I $(VARINCLUDE) -I $(ACINCLUDE)
|
||||
INCLUDES = -I $(PAPARAZZI_SRC)/sw/include -I $(PAPARAZZI_SRC)/sw/airborne -I $(PAPARAZZI_SRC)/conf/autopilot -I $(PAPARAZZI_SRC)/sw/airborne/$($(TARGET).ARCHDIR) -I $(VARINCLUDE) -I $(ACINCLUDE)
|
||||
|
||||
SRC_ARCH = $(PAPARAZZI_SRC)/sw/airborne/$(ARCHDIR)
|
||||
|
||||
@@ -33,7 +33,7 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||
include $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/Makefile.ac
|
||||
$(TARGET).srcs += $($(TARGET).EXTRA_SRCS)
|
||||
include ../../conf/Makefile.local
|
||||
include ../../conf/Makefile.$(ARCHI)
|
||||
include ../../conf/Makefile.$($(TARGET).ARCHDIR)
|
||||
endif
|
||||
|
||||
$(TARGET).install : warn_conf
|
||||
|
||||
@@ -25,7 +25,10 @@ extern void i2c_transmit(uint8_t slave_addr, uint8_t len, volatile bool_t* finis
|
||||
|
||||
extern volatile uint8_t i2c_status;
|
||||
|
||||
#ifndef I2C_BUF_LEN
|
||||
#define I2C_BUF_LEN 8
|
||||
#endif
|
||||
|
||||
extern volatile uint8_t i2c_buf[I2C_BUF_LEN];
|
||||
extern volatile uint8_t i2c_len;
|
||||
extern volatile uint8_t i2c_index;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#include "std.h"
|
||||
|
||||
|
||||
int main( void ) {
|
||||
while(1) {
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
#include "std.h"
|
||||
#include "init_hw.h"
|
||||
#include "sys_time.h"
|
||||
#include "led.h"
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_periodic())
|
||||
main_periodic_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
hw_init();
|
||||
sys_time_init();
|
||||
led_init();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
LED_TOGGLE(1);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
#include "std.h"
|
||||
#include "init_hw.h"
|
||||
#include "sys_time.h"
|
||||
#include "led.h"
|
||||
#include "interrupt_hw.h"
|
||||
#include "uart.h"
|
||||
#include "print.h"
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_periodic())
|
||||
main_periodic_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
hw_init();
|
||||
sys_time_init();
|
||||
led_init();
|
||||
uart0_init_tx();
|
||||
int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
LED_TOGGLE(1);
|
||||
Uart0PrintString("demo3 running since ");
|
||||
Uart0PrintHex16(cpu_time_sec);
|
||||
uart0_transmit(' seconds\n');
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "std.h"
|
||||
#include "init_hw.h"
|
||||
#include "sys_time.h"
|
||||
#include "led.h"
|
||||
#include "interrupt_hw.h"
|
||||
#include "uart.h"
|
||||
|
||||
#include "messages.h"
|
||||
#include "downlink.h"
|
||||
|
||||
static inline void main_init( void );
|
||||
static inline void main_periodic_task( void );
|
||||
|
||||
int main( void ) {
|
||||
main_init();
|
||||
while(1) {
|
||||
if (sys_time_periodic())
|
||||
main_periodic_task();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void main_init( void ) {
|
||||
hw_init();
|
||||
sys_time_init();
|
||||
led_init();
|
||||
uart0_init_tx();
|
||||
int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
LED_TOGGLE(1);
|
||||
DOWNLINK_SEND_TAKEOFF(&cpu_time_sec);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "std.h"
|
||||
#include "init_hw.h"
|
||||
#include "sys_time.h"
|
||||
#include "led.h"
|
||||
#include "interrupt_hw.h"
|
||||
#include "uart.h"
|
||||
|
||||
#include "messages.h"
|
||||
#include "downlink.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();
|
||||
sys_time_init();
|
||||
led_init();
|
||||
uart0_init_tx();
|
||||
int_enable();
|
||||
}
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
// LED_TOGGLE(1);
|
||||
DOWNLINK_SEND_TAKEOFF(&cpu_time_sec);
|
||||
}
|
||||
|
||||
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(1);
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t foo;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user