mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 03:27:33 +08:00
[uavcan] Fix NPS simulator (#2699)
This commit is contained in:
@@ -65,7 +65,7 @@
|
|||||||
<define name="RADIO_FMODE" value="0"/> <!-- Throttle curve select -->
|
<define name="RADIO_FMODE" value="0"/> <!-- Throttle curve select -->
|
||||||
<define name="RADIO_FBW_MODE" value="0"/> <!-- Switch between AP and FBW control -->
|
<define name="RADIO_FBW_MODE" value="0"/> <!-- Switch between AP and FBW control -->
|
||||||
<define name="RADIO_FLAPS" value="0"/> <!-- Flaps control -->
|
<define name="RADIO_FLAPS" value="0"/> <!-- Flaps control -->
|
||||||
<define name="RADIO_KILL_SWITCH" value="6"/>
|
<define name="RADIO_KILL_SWITCH" value="0"/>
|
||||||
<define name="RADIO_BACK_THOLD" value="0"/>
|
<define name="RADIO_BACK_THOLD" value="0"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<file name="actuators_uavcan.h" dir="subsystems/actuators"/>
|
<file name="actuators_uavcan.h" dir="subsystems/actuators"/>
|
||||||
</header>
|
</header>
|
||||||
<makefile target="ap|nps">
|
<makefile target="ap">
|
||||||
<file name="actuators_uavcan.c" dir="subsystems/actuators"/>
|
<file name="actuators_uavcan.c" dir="subsystems/actuators"/>
|
||||||
</makefile>
|
</makefile>
|
||||||
</module>
|
</module>
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2020 Freek van Tienen <freek.v.tienen@gmail.com>
|
|
||||||
*
|
|
||||||
* 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 arch/chibios/subsystems/actuators/actuators_uavcan_arch.c
|
|
||||||
* Interface from actuators to ChibiOS CAN driver using UAVCan
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "uavcan.h"
|
|
||||||
|
|
||||||
/** uavcan interfaces */
|
|
||||||
#if UAVCAN_USE_CAN1
|
|
||||||
struct uavcan_iface_t uavcan1;
|
|
||||||
#endif
|
|
||||||
#if UAVCAN_USE_CAN2
|
|
||||||
struct uavcan_iface_t uavcan2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** uavcan external functions */
|
|
||||||
void uavcan_init(void) {}
|
|
||||||
void uavcan_bind(uint16_t data_type_id, uint64_t data_type_signature, uavcan_event *ev, uavcan_callback cb) {}
|
|
||||||
void uavcan_broadcast(struct uavcan_iface_t *iface, uint64_t data_type_signature, uint16_t data_type_id, uint8_t priority,
|
|
||||||
const void* payload, uint16_t payload_len) {}
|
|
||||||
@@ -19,39 +19,12 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file arch/sim/modules/uavcan/uavcan.h
|
* @file arch/chibios/modules/uavcan/uavcan.h
|
||||||
* Stub interface for simulation
|
* Stub needed for compiling modules requiring uavcan
|
||||||
*/
|
*/
|
||||||
#ifndef MODULES_UAVCAN_ARCH_H
|
#ifndef MODULES_UAVCAN_ARCH_H
|
||||||
#define MODULES_UAVCAN_ARCH_H
|
#define MODULES_UAVCAN_ARCH_H
|
||||||
|
|
||||||
#include <std.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/** uavcan interface structure */
|
|
||||||
struct uavcan_iface_t {};
|
struct uavcan_iface_t {};
|
||||||
|
|
||||||
/** Generic uavcan callback definition */
|
|
||||||
struct CanardRxTransfer_t {};
|
|
||||||
typedef struct CanardRxTransfer_t CanardRxTransfer;
|
|
||||||
typedef void (*uavcan_callback)(struct uavcan_iface_t *iface, CanardRxTransfer* transfer);
|
|
||||||
|
|
||||||
/** Main uavcan event structure for registering/calling callbacks */
|
|
||||||
struct uavcan_event_t {};
|
|
||||||
typedef struct uavcan_event_t uavcan_event;
|
|
||||||
|
|
||||||
/** uavcan interfaces */
|
|
||||||
#if UAVCAN_USE_CAN1
|
|
||||||
extern struct uavcan_iface_t uavcan1;
|
|
||||||
#endif
|
|
||||||
#if UAVCAN_USE_CAN2
|
|
||||||
extern struct uavcan_iface_t uavcan2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** uavcan external functions */
|
|
||||||
void uavcan_init(void);
|
|
||||||
void uavcan_bind(uint16_t data_type_id, uint64_t data_type_signature, uavcan_event *ev, uavcan_callback cb);
|
|
||||||
void uavcan_broadcast(struct uavcan_iface_t *iface, uint64_t data_type_signature, uint16_t data_type_id, uint8_t priority,
|
|
||||||
const void* payload, uint16_t payload_len);
|
|
||||||
|
|
||||||
#endif /* MODULES_UAVCAN_ARCH_H */
|
#endif /* MODULES_UAVCAN_ARCH_H */
|
||||||
@@ -27,8 +27,14 @@
|
|||||||
/** Stub file needed per uavcan interface because of generator */
|
/** Stub file needed per uavcan interface because of generator */
|
||||||
extern int16_t actuators_uavcan1_values[SERVOS_UAVCAN1_NB];
|
extern int16_t actuators_uavcan1_values[SERVOS_UAVCAN1_NB];
|
||||||
|
|
||||||
|
#if USE_NPS
|
||||||
|
#define ActuatorsUavcan1Init() {}
|
||||||
|
#define ActuatorUavcan1Set(_i, _v) {}
|
||||||
|
#define ActuatorsUavcan1Commit() {}
|
||||||
|
#else
|
||||||
#define ActuatorsUavcan1Init() actuators_uavcan_init(&uavcan1)
|
#define ActuatorsUavcan1Init() actuators_uavcan_init(&uavcan1)
|
||||||
#define ActuatorUavcan1Set(_i, _v) { actuators_uavcan1_values[_i] = _v; }
|
#define ActuatorUavcan1Set(_i, _v) { actuators_uavcan1_values[_i] = _v; }
|
||||||
#define ActuatorsUavcan1Commit() actuators_uavcan_commit(&uavcan1, actuators_uavcan1_values, SERVOS_UAVCAN1_NB)
|
#define ActuatorsUavcan1Commit() actuators_uavcan_commit(&uavcan1, actuators_uavcan1_values, SERVOS_UAVCAN1_NB)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ACTUATORS_UAVCAN1_H */
|
#endif /* ACTUATORS_UAVCAN1_H */
|
||||||
@@ -27,8 +27,14 @@
|
|||||||
/** Stub file needed per interface because of generator */
|
/** Stub file needed per interface because of generator */
|
||||||
extern int16_t actuators_uavcan2_values[SERVOS_UAVCAN2_NB];
|
extern int16_t actuators_uavcan2_values[SERVOS_UAVCAN2_NB];
|
||||||
|
|
||||||
|
#if USE_NPS
|
||||||
|
#define ActuatorsUavcan2Init() {}
|
||||||
|
#define ActuatorUavcan2Set(_i, _v) {}
|
||||||
|
#define ActuatorsUavcan2Commit() {}
|
||||||
|
#else
|
||||||
#define ActuatorsUavcan2Init() actuators_uavcan_init(&uavcan2)
|
#define ActuatorsUavcan2Init() actuators_uavcan_init(&uavcan2)
|
||||||
#define ActuatorUavcan2Set(_i, _v) { actuators_uavcan2_values[_i] = _v; }
|
#define ActuatorUavcan2Set(_i, _v) { actuators_uavcan2_values[_i] = _v; }
|
||||||
#define ActuatorsUavcan2Commit() actuators_uavcan_commit(&uavcan2, actuators_uavcan2_values, SERVOS_UAVCAN2_NB)
|
#define ActuatorsUavcan2Commit() actuators_uavcan_commit(&uavcan2, actuators_uavcan2_values, SERVOS_UAVCAN2_NB)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ACTUATORS_UAVCAN2_H */
|
#endif /* ACTUATORS_UAVCAN2_H */
|
||||||
Reference in New Issue
Block a user