Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
can_fuelcell.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 Freek van Tienen <freek.v.tienen@gmail.com>
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 */
20
29#include "uavcan/uavcan.h"
30#include "pprz.equipment.fuelcell.Status.h"
31
32/* Fuel-Cell */
46static struct uavcan_equipment_fuelcell can_fuelcell_data = { 0, 67, 0.78, 45.9, 1457.0, 1234.0, -223.0, 2, 12, 7};
47
48#if !(USE_NPS)
49
50/* CAN feedback */
52
54{
55
58 return; // decode error
59 }
60
61 can_fuelcell_data.pressure = msg.tank_pressure;
62 can_fuelcell_data.press_reg = msg.regulated_pressure / 100.0f;
63 can_fuelcell_data.volt_bat = msg.battery_voltage / 10.0f;
64 can_fuelcell_data.power_out = msg.output_power;
66 can_fuelcell_data.power_batt = msg.battery_power;
67 can_fuelcell_data.state = msg.psu_state;
68 can_fuelcell_data.error = msg.error_code;
70
72
73}
74#endif
75
76
77extern void can_fuelcell_periodic(void)
78{
79#if USE_NPS
80 // Simulate data
82#endif
83 if (can_fuelcell_data.timeout > 0) {
85 }
86}
87
88
89
90#if PERIODIC_TELEMETRY
92
102#endif /* PERIODIC_TELEMETRY */
103
104
105
107{
108#if !(USE_NPS)
109
110 // Bind uavcan BATTERYINFO message from EQUIPMENT.POWER
113#endif
114
115
116 // Configure telemetry
117#if PERIODIC_TELEMETRY
119#endif
120
121
122}
void can_fuelcell_periodic(void)
void can_fuelcell_init(void)
static uavcan_event fuelcell_uavcan_ev
static struct uavcan_equipment_fuelcell can_fuelcell_data
static void can_fuelcell_send_telemetry(struct transport_tx *trans, struct link_device *dev)
static void fuelcell_uavcan_cb(struct uavcan_iface_t *iface, CanardRxTransfer *transfer)
Main uavcan event structure for registering/calling callbacks.
Definition uavcan.h:61
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
uint16_t foo
Definition main_demo5.c:58
uavcan interface structure
Definition uavcan.h:35
static const struct usb_device_descriptor dev
Definition usb_ser_hw.c:74
int16_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint16_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition telemetry.h:66
void uavcan_bind(uint16_t data_type_id, uint64_t data_type_signature, uavcan_event *ev, uavcan_callback cb)
Bind to a receiving message from uavcan.
Definition uavcan.c:215
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
int transfer(const Mat *from, const image_t *to)