ardupilot/libraries/AP_PiccoloCAN/piccolo_protocol/ServoCommands.h

195 lines
6.9 KiB
C
Raw Normal View History

// ServoCommands.h was generated by ProtoGen version 3.2.a
/*
* This file 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 3 of the License, or
* (at your option) any later version.
*
* This file 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Oliver Walters / Currawong Engineering Pty Ltd
*/
#ifndef _SERVOCOMMANDS_H
#define _SERVOCOMMANDS_H
// Language target is C, C++ compilers: don't mangle us
#ifdef __cplusplus
extern "C" {
#endif
/*!
* \file
*/
#include <stdbool.h>
#include "ServoProtocol.h"
#include "ServoDefines.h"
/*!
* Select packets for high-frequency transmission. Selected packets will be
* transmitted at 500Hz for one second. Sending this command again resets the
* timer, allowing continuous data as long as this packet is received
*/
typedef struct
{
Servo_TelemetryPackets_t packets; //!< Select which telemetry packets are transmitted at high-speed by the servo
}Servo_RequestHighFrequencyData_t;
//! Create the Servo_RequestHighFrequencyData packet from parameters
void encodeServo_RequestHighFrequencyDataPacket(void* pkt, const Servo_TelemetryPackets_t* packets);
//! Decode the Servo_RequestHighFrequencyData packet to parameters
int decodeServo_RequestHighFrequencyDataPacket(const void* pkt, Servo_TelemetryPackets_t* packets);
//! return the packet ID for the Servo_RequestHighFrequencyData packet
#define getServo_RequestHighFrequencyDataPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_RequestHighFrequencyData packet
#define getServo_RequestHighFrequencyDataMinDataLength() (2)
//! return the maximum encoded length for the Servo_RequestHighFrequencyData packet
#define getServo_RequestHighFrequencyDataMaxDataLength() (2)
/*!
* Set the Node ID (CAN Address) for the servo
*/
typedef struct
{
uint32_t serialNumber; //!< The serial number must match that of the servo for the command to be accepted
uint8_t nodeID; //!< Set the CAN Node ID of the target servo
}Servo_SetNodeID_t;
//! Create the Servo_SetNodeID packet from parameters
void encodeServo_SetNodeIDPacket(void* pkt, uint32_t serialNumber, uint8_t nodeID);
//! Decode the Servo_SetNodeID packet to parameters
int decodeServo_SetNodeIDPacket(const void* pkt, uint32_t* serialNumber, uint8_t* nodeID);
//! return the packet ID for the Servo_SetNodeID packet
#define getServo_SetNodeIDPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_SetNodeID packet
#define getServo_SetNodeIDMinDataLength() (6)
//! return the maximum encoded length for the Servo_SetNodeID packet
#define getServo_SetNodeIDMaxDataLength() (6)
/*!
* Set user programmable ID value
*/
typedef struct
{
uint16_t id; //!< User configurable value, 16-bit
}Servo_SetUserIdA_t;
//! Create the Servo_SetUserIdA packet from parameters
void encodeServo_SetUserIdAPacket(void* pkt, uint16_t id);
//! Decode the Servo_SetUserIdA packet to parameters
int decodeServo_SetUserIdAPacket(const void* pkt, uint16_t* id);
//! return the packet ID for the Servo_SetUserIdA packet
#define getServo_SetUserIdAPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_SetUserIdA packet
#define getServo_SetUserIdAMinDataLength() (3)
//! return the maximum encoded length for the Servo_SetUserIdA packet
#define getServo_SetUserIdAMaxDataLength() (3)
/*!
* Set user programmable ID value
*/
typedef struct
{
uint16_t id; //!< User configurable value, 16-bit
}Servo_SetUserIdB_t;
//! Create the Servo_SetUserIdB packet from parameters
void encodeServo_SetUserIdBPacket(void* pkt, uint16_t id);
//! Decode the Servo_SetUserIdB packet to parameters
int decodeServo_SetUserIdBPacket(const void* pkt, uint16_t* id);
//! return the packet ID for the Servo_SetUserIdB packet
#define getServo_SetUserIdBPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_SetUserIdB packet
#define getServo_SetUserIdBMinDataLength() (3)
//! return the maximum encoded length for the Servo_SetUserIdB packet
#define getServo_SetUserIdBMaxDataLength() (3)
//! Create the Servo_ResetDefaultSettings packet from parameters
void encodeServo_ResetDefaultSettingsPacket(void* pkt);
//! Decode the Servo_ResetDefaultSettings packet to parameters
int decodeServo_ResetDefaultSettingsPacket(const void* pkt);
//! return the packet ID for the Servo_ResetDefaultSettings packet
#define getServo_ResetDefaultSettingsPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_ResetDefaultSettings packet
#define getServo_ResetDefaultSettingsMinDataLength() (3)
//! return the maximum encoded length for the Servo_ResetDefaultSettings packet
#define getServo_ResetDefaultSettingsMaxDataLength() (3)
//! Create the Servo_UnlockSettings packet from parameters
void encodeServo_UnlockSettingsPacket(void* pkt);
//! Decode the Servo_UnlockSettings packet to parameters
int decodeServo_UnlockSettingsPacket(const void* pkt);
//! return the packet ID for the Servo_UnlockSettings packet
#define getServo_UnlockSettingsPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_UnlockSettings packet
#define getServo_UnlockSettingsMinDataLength() (4)
//! return the maximum encoded length for the Servo_UnlockSettings packet
#define getServo_UnlockSettingsMaxDataLength() (4)
//! Create the Servo_LockSettings packet from parameters
void encodeServo_LockSettingsPacket(void* pkt);
//! Decode the Servo_LockSettings packet to parameters
int decodeServo_LockSettingsPacket(const void* pkt);
//! return the packet ID for the Servo_LockSettings packet
#define getServo_LockSettingsPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_LockSettings packet
#define getServo_LockSettingsMinDataLength() (4)
//! return the maximum encoded length for the Servo_LockSettings packet
#define getServo_LockSettingsMaxDataLength() (4)
//! Create the Servo_EnterBootloader packet from parameters
void encodeServo_EnterBootloaderPacket(void* pkt);
//! Decode the Servo_EnterBootloader packet to parameters
int decodeServo_EnterBootloaderPacket(const void* pkt);
//! return the packet ID for the Servo_EnterBootloader packet
#define getServo_EnterBootloaderPacketID() (PKT_SERVO_SYSTEM_COMMAND)
//! return the minimum encoded length for the Servo_EnterBootloader packet
#define getServo_EnterBootloaderMinDataLength() (3)
//! return the maximum encoded length for the Servo_EnterBootloader packet
#define getServo_EnterBootloaderMaxDataLength() (3)
#ifdef __cplusplus
}
#endif
#endif // _SERVOCOMMANDS_H