mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
Servo control
This commit is contained in:
22
components/flatbuffers/include/AngleControlMessageBuilder.h
Normal file
22
components/flatbuffers/include/AngleControlMessageBuilder.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by Johnathon Slightham on 2025-06-30.
|
||||
//
|
||||
|
||||
#ifndef ANGLECONTROLMESSAGEBUILDER_H_
|
||||
#define ANGLECONTROLMESSAGEBUILDER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "SerializedMessage.h"
|
||||
#include "flatbuffers_generated/AngleControlMessage_generated.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
namespace Flatbuffers {
|
||||
class AngleControlMessageBuilder {
|
||||
public:
|
||||
static const Messaging::AngleControlMessage* parse_angle_control_message(const uint8_t* buffer);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_ANGLECONTROLMESSAGE_MESSAGING_H_
|
||||
#define FLATBUFFERS_GENERATED_ANGLECONTROLMESSAGE_MESSAGING_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
//static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
//FLATBUFFERS_VERSION_MINOR == 2 &&
|
||||
//FLATBUFFERS_VERSION_REVISION == 10,
|
||||
//"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace Messaging {
|
||||
|
||||
struct AngleControlMessage;
|
||||
struct AngleControlMessageBuilder;
|
||||
|
||||
struct AngleControlMessage FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef AngleControlMessageBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ANGLE = 4
|
||||
};
|
||||
int16_t angle() const {
|
||||
return GetField<int16_t>(VT_ANGLE, 0);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int16_t>(verifier, VT_ANGLE, 2) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct AngleControlMessageBuilder {
|
||||
typedef AngleControlMessage Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_angle(int16_t angle) {
|
||||
fbb_.AddElement<int16_t>(AngleControlMessage::VT_ANGLE, angle, 0);
|
||||
}
|
||||
explicit AngleControlMessageBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<AngleControlMessage> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<AngleControlMessage>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<AngleControlMessage> CreateAngleControlMessage(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int16_t angle = 0) {
|
||||
AngleControlMessageBuilder builder_(_fbb);
|
||||
builder_.add_angle(angle);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline const Messaging::AngleControlMessage *GetAngleControlMessage(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Messaging::AngleControlMessage>(buf);
|
||||
}
|
||||
|
||||
inline const Messaging::AngleControlMessage *GetSizePrefixedAngleControlMessage(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Messaging::AngleControlMessage>(buf);
|
||||
}
|
||||
|
||||
inline bool VerifyAngleControlMessageBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifyBuffer<Messaging::AngleControlMessage>(nullptr);
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedAngleControlMessageBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<Messaging::AngleControlMessage>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishAngleControlMessageBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Messaging::AngleControlMessage> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedAngleControlMessageBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Messaging::AngleControlMessage> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace Messaging
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_ANGLECONTROLMESSAGE_MESSAGING_H_
|
||||
Reference in New Issue
Block a user