First implementation

This commit is contained in:
Yury Shuvakin
2025-07-02 18:00:35 +09:00
commit 6cf2010c08
107 changed files with 10803 additions and 0 deletions

19
CanStructs.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include "CanStructs.h"
uint32_t CanId::serialize() const
{
uint32_t id = 0;
id |= destination;
id |= source << 8;
id |= address << 16;
id |= type << 27;
return id;
}
void CanId::deserialize(uint32_t id)
{
destination = id & 0xFF;
source = (id >> 8) & 0xFF;
address = (id >> 16) & 0x7FF;
type = (id >> 27) & 0x2;
}