got motor running

This commit is contained in:
Leonetienne
2025-12-14 18:57:28 +01:00
parent d339f5b297
commit bd906add53
14 changed files with 123 additions and 78 deletions
+14 -15
View File
@@ -5,25 +5,24 @@
// Singleton-class
class CommandParser
{
// Each command is 5 bytes long (assuming no padding)
struct Command {
enum class TYPE : uint8_t {
MOVE_ABSOLUTE = 0x00,
MOVE_RELATIVE = 0x01,
RESET_POSITIONS = 0x02,
} instruction;
uint16_t args[2];
};
public:
static CommandParser& getInstance() noexcept;
// Each command is 5 bytes long (assuming no padding)
struct Command {
enum class TYPE : uint8_t {
MOVE_ABSOLUTE = 0x00,
MOVE_RELATIVE = 0x01,
RESET_POSITIONS = 0x02,
} instruction;
int16_t args[2];
};
static CommandParser& getInstance() noexcept;
// Expecting command to be a packet of max size UartHandler::PACKET_SIZE
Command parsePacket(const uint8_t* packet) noexcept;
// Expecting command to be a packet of max size UartHandler::PACKET_SIZE
Command parsePacket(const uint8_t* packet) noexcept;
private:
CommandParser() noexcept;
CommandParser() noexcept {};
CommandParser(const CommandParser&) = delete;
CommandParser(CommandParser&&) = delete;
~CommandParser();