[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [5398] moved spektrum binding code from sw/airborne/
From: |
antoine drouin |
Subject: |
[paparazzi-commits] [5398] moved spektrum binding code from sw/airborne/stm32/bind.[ch] to sw/ airborne/booz/arch/stm32/radio_control/booz_radio_control_spektrum.[ch] |
Date: |
Mon, 16 Aug 2010 09:35:27 +0000 |
Revision: 5398
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5398
Author: poine
Date: 2010-08-16 09:35:26 +0000 (Mon, 16 Aug 2010)
Log Message:
-----------
moved spektrum binding code from sw/airborne/stm32/bind.[ch] to
sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_spektrum.[ch]
Modified Paths:
--------------
paparazzi3/trunk/conf/autopilot/lisa_passthrough.makefile
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_spektrum.makefile
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
paparazzi3/trunk/sw/airborne/booz/booz2_main.c
paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_spektrum.h
Removed Paths:
-------------
paparazzi3/trunk/sw/airborne/stm32/bind_hw.c
Modified: paparazzi3/trunk/conf/autopilot/lisa_passthrough.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/lisa_passthrough.makefile 2010-08-15
23:45:09 UTC (rev 5397)
+++ paparazzi3/trunk/conf/autopilot/lisa_passthrough.makefile 2010-08-16
09:35:26 UTC (rev 5398)
@@ -65,7 +65,7 @@
# PWM actuator
ifndef SERVOS_REFRESH_FREQ
-SERVOS_REFRESH_FREQ 50
+SERVOS_REFRESH_FREQ=50
endif
stm_passthrough.CFLAGS += -DSERVO_HZ=$(SERVOS_REFRESH_FREQ)
stm_passthrough.srcs += $(SRC_BOOZ)/actuators/booz_actuators_pwm.c
Modified:
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_spektrum.makefile
===================================================================
---
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_spektrum.makefile
2010-08-15 23:45:09 UTC (rev 5397)
+++
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_spektrum.makefile
2010-08-16 09:35:26 UTC (rev 5398)
@@ -5,7 +5,8 @@
ap.CFLAGS +=
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\"
ap.srcs += $(SRC_BOOZ)/booz_radio_control.c \
- $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c
+ $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c \
+ $(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
ifeq ($(ARCHI), arm7)
ap.CFLAGS += -DRADIO_CONTROL_LED=1
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B115200
@@ -14,6 +15,5 @@
ap.CFLAGS += -DRADIO_CONTROL_LED=4
ap.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B115200
ap.CFLAGS += -DRADIO_CONTROL_LINK=Uart3
-ap.srcs += $(SRC_ARCH)/bind_hw.c
endif
Modified:
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
===================================================================
---
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
2010-08-15 23:45:09 UTC (rev 5397)
+++
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
2010-08-16 09:35:26 UTC (rev 5398)
@@ -10,7 +10,7 @@
stm_passthrough.CFLAGS +=
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
stm_passthrough.srcs += $(SRC_BOOZ)/booz_radio_control.c \
$(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c
-stm_passthrough.srcs += $(SRC_ARCH)/bind_hw.c
+stm_passthrough.srcs +=
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
stm_passthrough.CFLAGS += -DRADIO_CONTROL_LED=5
stm_passthrough.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B115200
stm_passthrough.CFLAGS += -DRADIO_CONTROL_LINK=Uart3
Modified: paparazzi3/trunk/sw/airborne/booz/booz2_main.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/booz2_main.c 2010-08-15 23:45:09 UTC
(rev 5397)
+++ paparazzi3/trunk/sw/airborne/booz/booz2_main.c 2010-08-16 09:35:26 UTC
(rev 5398)
@@ -1,31 +1,31 @@
/*
* $Id$
*
- * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ * Copyright (C) 2008-2010 The Paparazzi Team
*
- * This file is part of paparazzi.
+ * This file is part of Paparazzi.
*
- * paparazzi is free software; you can redistribute it and/or modify
+ * 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,
+ * 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
+ * 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.
+ *
*/
#define MODULES_C
#include <inttypes.h>
#include "init_hw.h"
-#include "bind_hw.h"
#include "sys_time.h"
#include "led.h"
#include "interrupt_hw.h"
@@ -97,10 +97,6 @@
hw_init();
-#ifdef RADIO_CONTROL_LINK
- /* This function blocks for 73ms */
- bind_init();
-#endif
sys_time_init();
actuators_init();
@@ -172,11 +168,11 @@
{},
\
{},
\
{},
\
- { \
+ { \
Booz2TelemetryPeriodic();
\
- } \
+ } \
); \
-
+
#ifdef USE_GPS
if (radio_control.status != RADIO_CONTROL_OK && \
booz2_autopilot_mode == BOOZ2_AP_MODE_NAV && GpsIsLost())
\
Modified:
paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_spektrum.h
===================================================================
---
paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_spektrum.h
2010-08-15 23:45:09 UTC (rev 5397)
+++
paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_spektrum.h
2010-08-16 09:35:26 UTC (rev 5398)
@@ -1,8 +1,7 @@
/*
* Paparazzi $Id$
*
- * Copyright (C) 2009 Pascal Brisset <address@hidden>,
- * Antoine Drouin <address@hidden>
+ * Copyright (C) 2009-2010 The Paparazzi Team
*
* This file is part of paparazzi.
*
@@ -19,7 +18,8 @@
* 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.
+ * Boston, MA 02111-1307, USA.
+ *
*/
#ifndef BOOZ_RADIO_CONTROL_SPEKTRUM_H
@@ -28,6 +28,9 @@
#include "std.h"
#include "uart.h"
+/* implemented in
booz/arch/xxx/radio_control/booz_radio_control_spektrum_arch.c */
+extern void radio_control_spektrum_try_bind(void);
+
#include RADIO_CONTROL_SPEKTRUM_MODEL_H
#define RC_SPK_SYNC_1 0x03
Deleted: paparazzi3/trunk/sw/airborne/stm32/bind_hw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/bind_hw.c 2010-08-15 23:45:09 UTC
(rev 5397)
+++ paparazzi3/trunk/sw/airborne/stm32/bind_hw.c 2010-08-16 09:35:26 UTC
(rev 5398)
@@ -1,180 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2010 Eric Parsonage <address@hidden>
- *
- * 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 <stdint.h>
-#include <stm32/gpio.h>
-#include <stm32/rcc.h>
-#include <stm32/tim.h>
-
-#include BOARD_CONFIG
-
-#include "uart.h"
-#include "bind_hw.h"
-
-/* set TIM1 to run at DELAY_TIM_FREQUENCY */
-void delay_init( void );
-/* wait busy loop, microseconds */
-void delay_us( uint16_t uSecs );
-/* wait busy loop, milliseconds */
-void delay_ms( uint16_t mSecs );
-
-/* The longest delay with micro second granularity */
-#define MAX_DELAY INT16_MAX
-/* the frequency of the delay timer */
-#define DELAY_TIM_FREQUENCY 1000000
-/* Number of low pulses sent to satellite receivers */
-#define MASTER_RECEIVER_PULSES 3
-#define SLAVE_RECEIVER_PULSES 4
-
-/* The line that is pulled low at power up to initiate the bind process */
-#define BIND_PIN GPIO_Pin_3
-#define BIND_PIN_PORT GPIOC
-#define BIND_PIN_PERIPH RCC_APB2Periph_GPIOC
-
-
-/*
- * in the makefile we set RADIO_CONTROL_LINK to be Uartx
- * but in uart_hw.c the initialisation functions are
- * defined as uartx these macros give us the glue
- * that allows static calls at compile time
- */
-
-#define Uart1_init uart1_init()
-#define Uart2_init uart2_init()
-#define Uart3_init uart3_init()
-#define Uart5_init uart5_init()
-
-#define __MasterRcLink(dev, _x) dev##_x
-#define _MasterRcLink(dev, _x) __MasterRcLink(dev, _x)
-#define MasterRcLink(_x) _MasterRcLink(RADIO_CONTROL_LINK, _x)
-
-#define __SlaveRcLink(dev, _x) dev##_x
-#define _SlaveRcLink(dev, _x) __SlaveRcLink(dev, _x)
-#define SlaveRcLink(_x) _SlaveRcLink(RADIO_CONTROL_LINK_SLAVE, _x)
-
-
-/*
- * bind() init must called on powerup as the spektrum
- * satellites can only bind immediately after power up
- * also it must be called before we call uartx_init()
- * as we leave them with their Rx pins set as outputs
- */
-void bind_init( void ) {
-
- RCC_APB2PeriphClockCmd(BIND_PIN_PERIPH , ENABLE);
- GPIO_InitTypeDef gpio;
- gpio.GPIO_Pin = BIND_PIN;
- gpio.GPIO_Mode = GPIO_Mode_IPU;
- gpio.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(BIND_PIN_PORT, &gpio);
-
- /* exit if the BIND_PIN is high, it needs to be pulled low at startup to
initiate bind */
- if (GPIO_ReadInputDataBit(BIND_PIN_PORT, BIND_PIN))
- return;
-
- /* bind initiated, initialise the delay timer */
- delay_init();
-
- /* initialise the uarts rx pins as GPIOS */
- RCC_APB2PeriphClockCmd(MasterRcLink(_Periph) , ENABLE);
- /* Master receiver Rx push-pull */
- gpio.GPIO_Pin = MasterRcLink(_RxPin);
- gpio.GPIO_Mode = GPIO_Mode_Out_PP;
- gpio.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(MasterRcLink(_RxPort), &gpio);
- /* Master receiver RX line, drive high */
- GPIO_WriteBit(MasterRcLink(_RxPort), MasterRcLink(_RxPin) , Bit_SET );
-
-#ifdef RADIO_CONTROL_LINK_SLAVE
- RCC_APB2PeriphClockCmd(SlaveRcLink(_Periph) , ENABLE);
- /* Slave receiver Rx push-pull */
- gpio.GPIO_Pin = SlaveRcLink(_RxPin);
- gpio.GPIO_Mode = GPIO_Mode_Out_PP;
- gpio.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(SlaveRcLink(_RxPort), &gpio);
- /* Slave receiver RX line, drive high */
- GPIO_WriteBit(SlaveRcLink(_RxPort), SlaveRcLink(_RxPin) , Bit_SET );
-#endif
-
- /* We have no idea how long the window for allowing binding after
- power up is .This works for the moment but will need revisiting */
- delay_ms(73);
-
- for (int i = 0; i < MASTER_RECEIVER_PULSES ; i++)
- {
- GPIO_WriteBit(MasterRcLink(_RxPort), MasterRcLink(_RxPin), Bit_RESET );
- delay_us(120);
- GPIO_WriteBit(MasterRcLink(_RxPort), MasterRcLink(_RxPin), Bit_SET );
- delay_us(120);
- }
-
-#ifdef RADIO_CONTROL_LINK_SLAVE
- for (int i = 0; i < SLAVE_RECEIVER_PULSES; i++)
- {
- GPIO_WriteBit(SlaveRcLink(_RxPort), SlaveRcLink(_RxPin), Bit_RESET );
- delay_us(120);
- GPIO_WriteBit(SlaveRcLink(_RxPort), SlaveRcLink(_RxPin), Bit_SET );
- delay_us(120);
- }
-#endif /* RADIO_CONTROL_LINK_SLAVE */
-}
-
-
-/*
- *\Functions to implement busy wait loops with micro second granularity
- *
- */
-
-/* set TIM1 to run at DELAY_TIM_FREQUENCY */
-void delay_init( void ) {
- /* Enable timer clock */
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
- /* Time base configuration */
- TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
- TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
- TIM_TimeBaseStructure.TIM_Prescaler = (AHB_CLK / DELAY_TIM_FREQUENCY) - 1;
- TIM_TimeBaseStructure.TIM_Period = UINT16_MAX;
- TIM_TimeBaseStructure.TIM_ClockDivision = 0;
- TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
- TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
-
- /* Enable counter */
- TIM_Cmd(TIM1, ENABLE);
-}
-
-/* wait busy loop, microseconds */
-void delay_us( uint16_t uSecs ) {
- uint16_t start = TIM1->CNT;
- /* use 16 bit count wrap around */
- while((uint16_t)(TIM1->CNT - start) <= uSecs);
-}
-
-/* wait busy loop, milliseconds */
-void delay_ms( uint16_t mSecs ) {
- for(int i = 0; i < mSecs; i++) {
- delay_us(DELAY_TIM_FREQUENCY / 1000);
- }
-}
-
-
-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [5398] moved spektrum binding code from sw/airborne/stm32/bind.[ch] to sw/ airborne/booz/arch/stm32/radio_control/booz_radio_control_spektrum.[ch],
antoine drouin <=