Paparazzi UAS  v5.15_devel-112-g521f3cf
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
38 {
39 
40 }
41 
42 #define _UART_INIT(i) i ## _init()
43 #define UART_INIT(i) _UART_INIT(i)
44 
47 {
48 #ifndef INTER_MCU_AP
50 #else
52 #endif
53 
55 }
56 
57 #ifndef INTER_MCU_AP
59 {
60  //power cycle the spektrum
61 #if defined(RADIO_CONTROL_LED)
62  LED_OFF(RADIO_CONTROL_LED);
63 #endif
64 
66  sys_time_usleep(100000);
68 #if defined(RADIO_CONTROL_LED)
69  LED_ON(RADIO_CONTROL_LED);
70 #endif
71 
72  //put to bind mode
73  RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind()
74 
75  // init uart peripherals
76  UART_INIT(SPEKTRUM_PRIMARY_UART);
77 #ifdef SPEKTRUM_SECONDARY_UART
78  UART_INIT(SPEKTRUM_SECONDARY_UART);
79 #endif
80 
81 }
82 #endif
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define RADIO_CONTROL_POWER_OFF
Definition: opa_ftd_1.0.h:152
#define LED_OFF(i)
Definition: led_hw.h:52
Some architecture independent helper functions for GPIOs.
#define RADIO_CONTROL_POWER_PORT
Definition: opa_ftd_1.0.h:149
bool bind_soft_value
#define UART_INIT(i)
#define RADIO_CONTROL_POWER_PIN
Definition: opa_ftd_1.0.h:150
void sys_time_usleep(uint32_t us)
sys_time_usleep(uint32_t us)
Definition: sys_time_arch.c:95
uint16_t val[TCOUPLE_NB]
void intermcu_send_spektrum_bind(void)
Definition: intermcu_ap.c:129
#define RADIO_CONTROL_POWER_ON
Definition: opa_ftd_1.0.h:151
Rotorcraft Inter-MCU on the autopilot.
void spektrum_soft_bind_click(bool val)
void send_spektrum_bind(void)
Arch independent mcu ( Micro Controller Unit ) utilities.
void spektrum_soft_bind_init(void)
arch independent LED (Light Emitting Diodes) API
#define LED_ON(i)
Definition: led_hw.h:51