Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
opa_controller_ap.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) C. De Wagter
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
*/
26
#include "
modules/boards/opa_controller_ap.h
"
27
#include "
subsystems/intermcu.h
"
28
#include "generated/airframe.h"
29
#include "
mcu_periph/gpio.h
"
30
31
bool
opa_controller_vision_power
=
false
;
32
bool
opa_controller_ftd_disarm
=
false
;
33
34
void
opa_controller_ap_disarm
(
bool
action) {
35
INTERMCU_SET_CMD_STATUS
(
INTERMCU_CMD_DISARM
);
36
opa_controller_ftd_disarm
= action;
37
}
38
39
void
opa_controller_init
() {
40
/* Enable Vision Power Control: Default Power Off */
41
opa_controller_vision_power
=
false
;
42
opa_controller_ftd_disarm
=
false
;
43
44
gpio_setup_output
(
VISION_PWR
,
VISION_PWR_PIN
);
45
VISION_PWR_OFF
(
VISION_PWR
,
VISION_PWR_PIN
);
46
}
47
48
void
opa_controller_periodic
() {
49
/* Update the vision control power */
50
if
(
opa_controller_vision_power
) {
51
VISION_PWR_ON
(
VISION_PWR
,
VISION_PWR_PIN
);
52
}
else
{
53
VISION_PWR_OFF
(
VISION_PWR
,
VISION_PWR_PIN
);
54
}
55
56
/* Set the FTD Disarm state */
57
opa_controller_ftd_disarm
=
intermcu
.
cmd_status
& (1 << 1);
58
}
59
intermcu.h
Rotorcraft Inter-MCU interface.
VISION_PWR_PIN
#define VISION_PWR_PIN
Definition:
opa_ap_1.0.h:38
gpio_setup_output
void gpio_setup_output(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
Definition:
gpio_arch.c:33
INTERMCU_SET_CMD_STATUS
#define INTERMCU_SET_CMD_STATUS(_bit)
Definition:
intermcu.h:65
opa_controller_ap.h
opa_controller_vision_power
bool opa_controller_vision_power
Definition:
opa_controller_ap.c:31
opa_controller_periodic
void opa_controller_periodic()
Definition:
opa_controller_ap.c:48
intermcu
struct intermcu_t intermcu
Definition:
intermcu_ap.c:41
VISION_PWR_OFF
#define VISION_PWR_OFF
Definition:
opa_ap_1.0.h:40
opa_controller_init
void opa_controller_init()
Definition:
opa_controller_ap.c:39
opa_controller_ftd_disarm
bool opa_controller_ftd_disarm
Definition:
opa_controller_ap.c:32
intermcu_t::cmd_status
uint8_t cmd_status
Command status information that is transfered (intermcu_cmd_status)
Definition:
intermcu.h:77
gpio.h
opa_controller_ap_disarm
void opa_controller_ap_disarm(bool action)
Definition:
opa_controller_ap.c:34
VISION_PWR_ON
#define VISION_PWR_ON
Definition:
opa_ap_1.0.h:39
INTERMCU_CMD_DISARM
@ INTERMCU_CMD_DISARM
Whether or not to dis-arm the FBW.
Definition:
intermcu.h:59
VISION_PWR
#define VISION_PWR
Definition:
opa_ap_1.0.h:37
sw
airborne
modules
boards
opa_controller_ap.c
Generated on Tue Feb 1 2022 13:51:14 for Paparazzi UAS by
1.8.17