diff --git a/sw/airborne/booz/arch/lpc21/radio_control/booz_radio_control_ppm_arch.c b/sw/airborne/booz/arch/lpc21/radio_control/booz_radio_control_ppm_arch.c deleted file mode 100644 index 8cc6351fa1..0000000000 --- a/sw/airborne/booz/arch/lpc21/radio_control/booz_radio_control_ppm_arch.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * $Id$ - * - * 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 - -uint8_t booz_radio_control_ppm_cur_pulse; -uint32_t booz_radio_control_ppm_last_pulse_time; - -void booz_radio_control_ppm_arch_init ( void ) { - /* select pin for capture */ - PPM_PINSEL |= PPM_PINSEL_VAL << PPM_PINSEL_BIT; - /* enable capture 0.2 on falling or rising edge + trigger interrupt */ -#if defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_POSITIVE - T0CCR = PPM_CCR_CRR | PPM_CCR_CRI; -#elif defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_NEGATIVE - T0CCR = PPM_CCR_CRF | PPM_CCR_CRI; -#else -#error "ppm_hw.h: Unknown PM_PULSE_TYPE" -#endif - booz_radio_control_ppm_last_pulse_time = 0; - booz_radio_control_ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL; - booz_radio_control_ppm_frame_available = FALSE; -} diff --git a/sw/airborne/booz/arch/lpc21/radio_control/booz_radio_control_ppm_arch.h b/sw/airborne/booz/arch/lpc21/radio_control/booz_radio_control_ppm_arch.h deleted file mode 100644 index bed07b37fd..0000000000 --- a/sw/airborne/booz/arch/lpc21/radio_control/booz_radio_control_ppm_arch.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -#ifndef BOOZ_RADIO_CONTROL_PPM_ARCH_H -#define BOOZ_RADIO_CONTROL_PPM_ARCH_H - - -#include "LPC21xx.h" -#include BOARD_CONFIG - -/** - * On tiny (and booz) the ppm counter is running at the same speed as - * the systic counter. There is no reason for this to be true. - * Let's add a pair of macros to make it possible for them to be different. - * - */ -#define RC_PPM_TICS_OF_USEC SYS_TICS_OF_USEC -#define RC_PPM_SIGNED_TICS_OF_USEC SIGNED_SYS_TICS_OF_USEC - - -extern uint8_t booz_radio_control_ppm_cur_pulse; -extern uint32_t booz_radio_control_ppm_last_pulse_time; - - -#define RADIO_CONTROL_PPM_IT PPM_CRI -#define RADIO_CONTROL_PPM_ISR() { \ - \ - uint32_t now = PPM_CR; \ - uint32_t length = now - booz_radio_control_ppm_last_pulse_time; \ - booz_radio_control_ppm_last_pulse_time = now; \ - \ - if (booz_radio_control_ppm_cur_pulse == RADIO_CONTROL_NB_CHANNEL) { \ - if (length > SYS_TICS_OF_USEC(PPM_SYNC_MIN_LEN) && \ - length < SYS_TICS_OF_USEC(PPM_SYNC_MAX_LEN)) { \ - booz_radio_control_ppm_cur_pulse = 0; \ - } \ - } \ - else { \ - if (length > SYS_TICS_OF_USEC(PPM_DATA_MIN_LEN) && \ - length < SYS_TICS_OF_USEC(PPM_DATA_MAX_LEN)) { \ - booz_radio_control_ppm_pulses[booz_radio_control_ppm_cur_pulse] = length; \ - booz_radio_control_ppm_cur_pulse++; \ - if (booz_radio_control_ppm_cur_pulse == RADIO_CONTROL_NB_CHANNEL) { \ - booz_radio_control_ppm_frame_available = TRUE; \ - } \ - } \ - else \ - booz_radio_control_ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL; \ - } \ - } - - -#endif /* BOOZ_RADIO_CONTROL_PPM_ARCH_H */ diff --git a/sw/airborne/booz/arch/sim/radio_control/booz_radio_control_ppm_arch.c b/sw/airborne/booz/arch/sim/radio_control/booz_radio_control_ppm_arch.c deleted file mode 100644 index 9171f152aa..0000000000 --- a/sw/airborne/booz/arch/sim/radio_control/booz_radio_control_ppm_arch.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Id$ - * - * 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 "nps_radio_control.h" - -void booz_radio_control_ppm_arch_init ( void ) { - -} - -#define PPM_OF_NPS(_nps, _neutral, _min, _max) \ - ((_nps) >= 0 ? (_neutral) + (_nps) * ((_max)-(_neutral)) : (_neutral) + (_nps) * ((_neutral)- (_min))) - -void booz_radio_control_feed(void) { - booz_radio_control_ppm_pulses[RADIO_CONTROL_ROLL] = PPM_OF_NPS(nps_radio_control.roll, \ - RADIO_CONTROL_ROLL_NEUTRAL, \ - RADIO_CONTROL_ROLL_MIN, \ - RADIO_CONTROL_ROLL_MAX); - booz_radio_control_ppm_pulses[RADIO_CONTROL_PITCH] = PPM_OF_NPS(nps_radio_control.pitch, \ - RADIO_CONTROL_PITCH_NEUTRAL, \ - RADIO_CONTROL_PITCH_MIN, \ - RADIO_CONTROL_PITCH_MAX); - booz_radio_control_ppm_pulses[RADIO_CONTROL_YAW] = PPM_OF_NPS(nps_radio_control.yaw, \ - RADIO_CONTROL_YAW_NEUTRAL, \ - RADIO_CONTROL_YAW_MIN, \ - RADIO_CONTROL_YAW_MAX); - booz_radio_control_ppm_pulses[RADIO_CONTROL_THROTTLE] = PPM_OF_NPS(nps_radio_control.throttle, \ - RADIO_CONTROL_THROTTLE_NEUTRAL, \ - RADIO_CONTROL_THROTTLE_MIN, \ - RADIO_CONTROL_THROTTLE_MAX); - booz_radio_control_ppm_pulses[RADIO_CONTROL_MODE] = PPM_OF_NPS(nps_radio_control.mode, \ - RADIO_CONTROL_MODE_NEUTRAL, \ - RADIO_CONTROL_MODE_MIN, \ - RADIO_CONTROL_MODE_MAX); - booz_radio_control_ppm_frame_available = TRUE; -} - diff --git a/sw/airborne/booz/arch/sim/radio_control/booz_radio_control_ppm_arch.h b/sw/airborne/booz/arch/sim/radio_control/booz_radio_control_ppm_arch.h deleted file mode 100644 index 78645832a7..0000000000 --- a/sw/airborne/booz/arch/sim/radio_control/booz_radio_control_ppm_arch.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -#ifndef BOOZ_RADIO_CONTROL_PPM_ARCH_H -#define BOOZ_RADIO_CONTROL_PPM_ARCH_H - -#define RC_PPM_TICS_OF_USEC(_v) (_v) -#define RC_PPM_SIGNED_TICS_OF_USEC(_v) (_v) - -extern void booz_radio_control_feed(void); - -#endif /* BOOZ_RADIO_CONTROL_PPM_ARCH_H */ diff --git a/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c b/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c deleted file mode 100644 index ffa48ba547..0000000000 --- a/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2010 The Paparazzi Team - * - * 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 -#include -#include -#include - -#include "sys_time.h" - -/* - * - * This a radio control ppm driver for stm32 - * signal on PA1 TIM2/CH2 (uart1 trig on lisa/L) - * - */ -uint8_t booz_radio_control_ppm_cur_pulse; -uint32_t booz_radio_control_ppm_last_pulse_time; -static uint32_t timer_rollover_cnt; - -void tim2_irq_handler(void); - -void booz_radio_control_ppm_arch_init ( void ) { - - /* TIM2 channel 2 pin (PA.01) configuration */ - GPIO_InitTypeDef GPIO_InitStructure; - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_Init(GPIOA, &GPIO_InitStructure); - - /* TIM2 clock enable */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); - - /* GPIOA clock enable */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); - - /* Time Base configuration */ - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); - TIM_TimeBaseStructure.TIM_Period = 0xFFFF; - TIM_TimeBaseStructure.TIM_Prescaler = 0x8; - TIM_TimeBaseStructure.TIM_ClockDivision = 0x0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); - - /* TIM2 configuration: Input Capture mode --------------------- - The external signal is connected to TIM2 CH2 pin (PA.01) - The Rising edge is used as active edge, - ------------------------------------------------------------ */ - TIM_ICInitTypeDef TIM_ICInitStructure; - TIM_ICInitStructure.TIM_Channel = TIM_Channel_2; - TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; - TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; - TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; - TIM_ICInitStructure.TIM_ICFilter = 0x00; - TIM_ICInit(TIM2, &TIM_ICInitStructure); - - /* Enable the TIM2 global Interrupt */ - NVIC_InitTypeDef NVIC_InitStructure; - NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); - - /* TIM2 enable counter */ - TIM_Cmd(TIM2, ENABLE); - - /* Enable the CC2 Interrupt Request */ - TIM_ITConfig(TIM2, TIM_IT_CC2|TIM_IT_Update, ENABLE); - - booz_radio_control_ppm_last_pulse_time = 0; - booz_radio_control_ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL; - timer_rollover_cnt = 0; - -} - - -void tim2_irq_handler(void) { - - if(TIM_GetITStatus(TIM2, TIM_IT_CC2) == SET) { - TIM_ClearITPendingBit(TIM2, TIM_IT_CC2); - - uint32_t now = TIM_GetCapture2(TIM2) + timer_rollover_cnt; - uint32_t length = now - booz_radio_control_ppm_last_pulse_time; - booz_radio_control_ppm_last_pulse_time = now; - - if (booz_radio_control_ppm_cur_pulse == RADIO_CONTROL_NB_CHANNEL) { - if (length > RC_PPM_TICS_OF_USEC(PPM_SYNC_MIN_LEN) && - length < RC_PPM_TICS_OF_USEC(PPM_SYNC_MAX_LEN)) { - booz_radio_control_ppm_cur_pulse = 0; - } - } - else { - if (length > RC_PPM_TICS_OF_USEC(PPM_DATA_MIN_LEN) && - length < RC_PPM_TICS_OF_USEC(PPM_DATA_MAX_LEN)) { - booz_radio_control_ppm_pulses[booz_radio_control_ppm_cur_pulse] = length; - booz_radio_control_ppm_cur_pulse++; - if (booz_radio_control_ppm_cur_pulse == RADIO_CONTROL_NB_CHANNEL) { - booz_radio_control_ppm_frame_available = TRUE; - } - } - else { - booz_radio_control_ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL; - } - } - } - else if(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET) { - timer_rollover_cnt+=(1<<16); - TIM_ClearITPendingBit(TIM2, TIM_IT_Update); - } - -} diff --git a/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h b/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h deleted file mode 100644 index d3a18a537f..0000000000 --- a/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2010 The Paparazzi Team - * - * 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. - */ - -/** \file booz_radio_control_ppm_hw.h - * \brief STM32 ppm decoder - * - */ - -/** - * On tiny (and booz) the ppm counter is running at the same speed as - * the systic counter. There is no reason for this to be true. - * Let's add a pair of macros to make it possible for them to be different. - * - */ -#define RC_PPM_TICS_OF_USEC(_v) SYS_TICS_OF_USEC((_v)/9) -#define RC_PPM_SIGNED_TICS_OF_USEC(_v) SIGNED_SYS_TICS_OF_USEC((_v)/9) diff --git a/sw/airborne/booz/booz_radio_control.c b/sw/airborne/booz/booz_radio_control.c deleted file mode 100644 index c0e1e762db..0000000000 --- a/sw/airborne/booz/booz_radio_control.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * $Id$ - * - * 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 "led.h" - -struct RadioControl radio_control; - -void radio_control_init(void) { - uint8_t i; - for (i=0; i= RADIO_CONTROL_REALLY_LOST_TIME) { - radio_control.status = RADIO_CONTROL_REALLY_LOST; - } - else { - if (radio_control.time_since_last_frame >= RADIO_CONTROL_LOST_TIME) { - radio_control.status = RADIO_CONTROL_LOST; - radio_control.radio_ok_cpt = RADIO_CONTROL_OK_CPT; - } - radio_control.time_since_last_frame++; - } - - /* sigal status with LEDs */ -#if defined RADIO_CONTROL_LED - if (radio_control.status == RADIO_CONTROL_OK) { - LED_ON(RADIO_CONTROL_LED); - } - else { - LED_OFF(RADIO_CONTROL_LED); - } -#endif - -} diff --git a/sw/airborne/booz/booz_radio_control.h b/sw/airborne/booz/booz_radio_control.h deleted file mode 100644 index b6b6b84504..0000000000 --- a/sw/airborne/booz/booz_radio_control.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -#ifndef BOOZ_RADIO_CONTROL_H -#define BOOZ_RADIO_CONTROL_H - -#include "std.h" -#include "paparazzi.h" - -/* underlying hardware */ -#include RADIO_CONTROL_TYPE_H -/* must be defined by underlying hardware */ -extern void radio_control_impl_init(void); - -/* status */ -#define RADIO_CONTROL_OK 0 -#define RADIO_CONTROL_LOST 1 -#define RADIO_CONTROL_REALLY_LOST 2 - -/* timeouts - for now assumes 60Hz periodic */ -#define RADIO_CONTROL_LOST_TIME 30 -#define RADIO_CONTROL_REALLY_LOST_TIME 60 -/* number of valid frames before going back to OK */ -#define RADIO_CONTROL_OK_CPT 15 - -struct RadioControl { - uint8_t status; - uint8_t time_since_last_frame; - uint8_t radio_ok_cpt; - uint8_t frame_rate; - uint8_t frame_cpt; - pprz_t values[RADIO_CONTROL_NB_CHANNEL]; -}; - -extern struct RadioControl radio_control; - -extern void radio_control_init(void); -extern void radio_control_periodic(void); - - -#endif /* BOOZ_RADIO_CONTROL_H */ diff --git a/sw/airborne/booz/radio_control/booz_radio_control_ppm.c b/sw/airborne/booz/radio_control/booz_radio_control_ppm.c deleted file mode 100644 index aec53ae34d..0000000000 --- a/sw/airborne/booz/radio_control/booz_radio_control_ppm.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * $Id$ - * - * 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 - - -uint16_t booz_radio_control_ppm_pulses[ RADIO_CONTROL_NB_CHANNEL ]; -volatile bool_t booz_radio_control_ppm_frame_available; - -void radio_control_impl_init(void) { - booz_radio_control_ppm_frame_available = FALSE; - booz_radio_control_ppm_arch_init(); -} diff --git a/sw/airborne/booz/radio_control/booz_radio_control_ppm.h b/sw/airborne/booz/radio_control/booz_radio_control_ppm.h deleted file mode 100644 index 96b5b817cc..0000000000 --- a/sw/airborne/booz/radio_control/booz_radio_control_ppm.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Id$ - * - * 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. - */ - -#ifndef BOOZ_RADIO_CONTROL_PPM_H -#define BOOZ_RADIO_CONTROL_PPM_H - -/** - * Architecture dependant code - */ -#include "subsystems/radio_control/ppm_arch.h" -/* must be implemented by arch dependant code */ -extern void booz_radio_control_ppm_arch_init ( void ); - -/** - * Generated code holding the description of a given - * transmitter - */ -#include "conf_radio_control_ppm.h" - -/** - * ppm pulse type : futaba is falling edge clocked whereas JR is rising edge - */ -#define PPM_PULSE_TYPE_POSITIVE 0 -#define PPM_PULSE_TYPE_NEGATIVE 1 - -extern uint16_t booz_radio_control_ppm_pulses[ RADIO_CONTROL_NB_CHANNEL ]; -extern volatile bool_t booz_radio_control_ppm_frame_available; - - -#define RadioControlEvent(_received_frame_handler) { \ - if (booz_radio_control_ppm_frame_available) { \ - radio_control.frame_cpt++; \ - radio_control.time_since_last_frame = 0; \ - if (radio_control.radio_ok_cpt > 0) radio_control.radio_ok_cpt--; \ - else { \ - radio_control.status = RADIO_CONTROL_OK; \ - NormalizePpm(); \ - _received_frame_handler(); \ - } \ - booz_radio_control_ppm_frame_available = FALSE; \ - } \ - } - -#endif /* BOOZ_RADIO_CONTROL_PPM_H */