diff --git a/conf/autopilot/booz2_test_progs.makefile b/conf/autopilot/booz2_test_progs.makefile index 0928e9472b..401d0262fc 100644 --- a/conf/autopilot/booz2_test_progs.makefile +++ b/conf/autopilot/booz2_test_progs.makefile @@ -415,6 +415,33 @@ test_mc.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150 -DI2C0_VIC_SLOT=10 test_mc.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c + +# +# test BUSS BLDC +# +test_buss_bldc.ARCHDIR = $(ARCHI) +test_buss_bldc.ARCH = arm7tdmi +test_buss_bldc.TARGET = test_buss_bldc +test_buss_bldc.TARGETDIR = test_buss_bldc + +test_buss_bldc.CFLAGS += -DPERIPHERALS_AUTO_INIT +test_buss_bldc.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) +test_buss_bldc.srcs += $(SRC_BOOZ_TEST)/booz2_test_buss_bldc.c +test_buss_bldc.CFLAGS += -DUSE_LED +test_buss_bldc.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))' -DTIME_LED=1 +test_buss_bldc.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c + +test_buss_bldc.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 +test_buss_bldc.srcs += $(SRC_ARCH)/uart_hw.c + +test_buss_bldc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 +test_buss_bldc.srcs += downlink.c pprz_transport.c + +test_buss_bldc.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150 -DI2C0_VIC_SLOT=10 +test_buss_bldc.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c + + + # # test asctec BLMC # diff --git a/sw/airborne/booz/arch/lpc21/actuators_buss_twi_blmc_hw.h b/sw/airborne/booz/arch/lpc21/actuators_buss_twi_blmc_hw.h index ec69e15144..75af8fddb1 100644 --- a/sw/airborne/booz/arch/lpc21/actuators_buss_twi_blmc_hw.h +++ b/sw/airborne/booz/arch/lpc21/actuators_buss_twi_blmc_hw.h @@ -70,7 +70,7 @@ ActuatorsBussTwiBlmcSend(); \ } #else -#define ActuatorsCommit() { \ +#define ActuatorsCommit() { \ if ( buss_twi_blmc_status == BUSS_TWI_BLMC_STATUS_IDLE) { \ buss_twi_blmc_idx = 0; \ buss_twi_blmc_status = BUSS_TWI_BLMC_STATUS_BUSY; \ diff --git a/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c b/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c new file mode 100644 index 0000000000..709a2d5e61 --- /dev/null +++ b/sw/airborne/booz/test/booz2_test_buss_bldc_hexa.c @@ -0,0 +1,67 @@ +/* + * $Id: booz2_test_mc.c 3701 2009-07-13 09:57:55Z poine $ + * + * Copyright (C) 2008-2009 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. + */ + +#include + +#include "init_hw.h" +#include "sys_time.h" +#include "interrupt_hw.h" + +//static uint8_t addr = 0x52; /* 1 : back right */ +//static uint8_t addr = 0x54; /* 2 : back left bad balanced */ +//static uint8_t addr = 0x56; /* 3 : center right not so well balanced */ +static uint8_t addr = 0x58; /* 4 : center left */ +//static uint8_t addr = 0x5A; /* 5 : front right */ +//static uint8_t addr = 0x5C; /* 6 : front left */ +static bool_t i2c_done; + +static inline void main_init( void ); +static inline void main_periodic_task( void ); +static inline void main_event_task( 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(); + int_enable(); +} + +static inline void main_periodic_task( void ) { + uint8_t thrust = 20; + i2c0_buf[0] = thrust; + i2c0_transmit(addr, 1, &i2c_done); +} + +static inline void main_event_task( void ) { + +} +