Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Frsky_Telem/AP_Frsky_MAVlite_Message.h
Views: 1798
#pragma once12#include "AP_Frsky_MAVlite.h"34#include <AP_Common/AP_Common.h>56#include <stdint.h>78#if HAL_WITH_FRSKY_TELEM_BIDIRECTIONAL9class AP_Frsky_MAVlite_Message {10public:11// helpers12bool get_float(float &value, const uint8_t offset) const WARN_IF_UNUSED {13return get_bytes((uint8_t*)&value, offset, 4);14}15bool set_float(const float value, const uint8_t offset) WARN_IF_UNUSED {16return set_bytes((uint8_t*)&value, offset, 4);17}1819bool get_string(char* value, const uint8_t offset) const WARN_IF_UNUSED;20bool set_string(const char* value, const uint8_t offset) WARN_IF_UNUSED;2122bool get_uint16(uint16_t &value, const uint8_t offset) const WARN_IF_UNUSED {23return get_bytes((uint8_t*)&value, offset, 2);24}25bool set_uint16(const uint16_t value, const uint8_t offset) WARN_IF_UNUSED {26return set_bytes((uint8_t*)&value, offset, 2);27}2829bool get_uint8(uint8_t &value, const uint8_t offset) const WARN_IF_UNUSED {30return get_bytes((uint8_t*)&value, offset, 1);31}32bool set_uint8(const uint8_t value, const uint8_t offset) WARN_IF_UNUSED {33return set_bytes((uint8_t*)&value, offset, 1);34}3536uint8_t msgid = 0; // ID of message in payload37uint8_t len = 0; // Length of payload38uint8_t payload[MAVLITE_MAX_PAYLOAD_LEN];3940static void bit8_pack(uint8_t &value, const uint8_t bit_value, const uint8_t bit_count, const uint8_t bit_offset);41static uint8_t bit8_unpack(const uint8_t value, const uint8_t bit_count, const uint8_t bit_offset);4243private:44bool get_bytes(uint8_t *bytes, const uint8_t offset, const uint8_t count) const WARN_IF_UNUSED;45bool set_bytes(const uint8_t *bytes, const uint8_t offset, const uint8_t count) WARN_IF_UNUSED;46};47#endif4849