Paparazzi UAS  v5.18.0_stable
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 
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
radio_control.h
val
uint16_t val[TCOUPLE_NB]
Definition: temp_tcouple_adc.c:49
intermcu_ap.h
Rotorcraft Inter-MCU on the autopilot.
LED_OFF
#define LED_OFF(i)
Definition: led_hw.h:52
sys_time_usleep
void sys_time_usleep(uint32_t us)
sys_time_usleep(uint32_t us)
Definition: sys_time_arch.c:95
spektrum_soft_bind_ap.h
LED_ON
#define LED_ON(i)
Definition: led_hw.h:51
RADIO_CONTROL_POWER_OFF
#define RADIO_CONTROL_POWER_OFF
Definition: opa_ftd_1.0.h:152
UART_INIT
#define UART_INIT(i)
Definition: spektrum_soft_bind_ap.c:43
spektrum_soft_bind_click
void spektrum_soft_bind_click(bool val)
Definition: spektrum_soft_bind_ap.c:46
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
intermcu_send_spektrum_bind
void intermcu_send_spektrum_bind(void)
Definition: intermcu_ap.c:129
RADIO_CONTROL_POWER_ON
#define RADIO_CONTROL_POWER_ON
Definition: opa_ftd_1.0.h:151
mcu.h
Arch independent mcu ( Micro Controller Unit ) utilities.
led.h
arch independent LED (Light Emitting Diodes) API
spektrum_soft_bind_init
void spektrum_soft_bind_init(void)
Definition: spektrum_soft_bind_ap.c:37
RADIO_CONTROL_POWER_PIN
#define RADIO_CONTROL_POWER_PIN
Definition: opa_ftd_1.0.h:150
gpio.h
RADIO_CONTROL_POWER_PORT
#define RADIO_CONTROL_POWER_PORT
Definition: opa_ftd_1.0.h:149
bind_soft_value
bool bind_soft_value
Definition: spektrum_soft_bind_ap.c:45
send_spektrum_bind
void send_spektrum_bind(void)
Definition: spektrum_soft_bind_ap.c:58