Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
spektrum_soft_bind_ap.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) Kevin van Hecke
3  *
4  * This file is part of paparazzi
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
28 #include "led.h"
29 
30 #include "mcu.h"
32 #include "mcu_periph/sys_time_arch.h"
33 
34 #include "mcu_periph/uart.h"
35 #include "mcu_periph/gpio.h"
36 
37 #ifdef RADIO_CONTROL_BIND_IMPL_FUNC
39 #endif
40 
42 {
43 
44 }
45 
46 #define _UART_INIT(i) i ## _init()
47 #define UART_INIT(i) _UART_INIT(i)
48 
51 {
52 #ifndef INTER_MCU_AP
54 #else
56 #endif
57 
59 }
60 
61 #ifndef INTER_MCU_AP
63 {
64  //power cycle the spektrum
65 #if defined(RADIO_CONTROL_LED)
66  LED_OFF(RADIO_CONTROL_LED);
67 #endif
68 
70  sys_time_usleep(100000);
72 #if defined(RADIO_CONTROL_LED)
73  LED_ON(RADIO_CONTROL_LED);
74 #endif
75 
76  //put to bind mode
77  RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind()
78 
79  // init uart peripherals
80  UART_INIT(SPEKTRUM_PRIMARY_UART);
81 #ifdef SPEKTRUM_SECONDARY_UART
82  UART_INIT(SPEKTRUM_SECONDARY_UART);
83 #endif
84 
85 }
86 #endif
#define LED_ON(i)
Definition: led_hw.h:51
#define LED_OFF(i)
Definition: led_hw.h:52
void sys_time_usleep(uint32_t us)
sys_time_usleep(uint32_t us)
Some architecture independent helper functions for GPIOs.
void intermcu_send_spektrum_bind(void)
send binding signal for spektrum receiver
Definition: intermcu_ap.c:147
Inter-MCU on the AP side.
arch independent LED (Light Emitting Diodes) API
Arch independent mcu ( Micro Controller Unit ) utilities.
#define RADIO_CONTROL_POWER_ON
Definition: opa_ftd_1.0.h:151
#define RADIO_CONTROL_POWER_PIN
Definition: opa_ftd_1.0.h:150
#define RADIO_CONTROL_POWER_PORT
Definition: opa_ftd_1.0.h:149
#define RADIO_CONTROL_POWER_OFF
Definition: opa_ftd_1.0.h:152
Generic interface for radio control modules.
Radio control spektrum interface.
void send_spektrum_bind(void)
void spektrum_soft_bind_init(void)
void spektrum_soft_bind_click(bool val)
#define UART_INIT(i)
bool bind_soft_value
uint16_t val[TCOUPLE_NB]
arch independent UART (Universal Asynchronous Receiver/Transmitter) API