# Simple wrapper for DataFrame Create formatted frame from basic types: - uint8_t, int8_t => 1Byte - uint16_t, int16_t => 2Bytes - uint32_t, int32_t => 4Bytes - float => 4Bytes Data are stared in Little Endian format. Structure of data frame: - starting byte (0xCC) - length of frame: count of bytes in payload. The first 2 bytes is not included to overal length. Maximum length: 254 (0xFE) - payload - CRC8 The library contans universal function: - `uint8_t crc8(uint8_t crc, uint8_t Size, uint8_t *Buffer);` - crc - inital value for CRC computig. For new frame, use 0x0 - Size - size of data Buffer ## Basic usage ```c void main(){ uint8_t data[128]; DataFrame packet(data_packet, sizeof(data_packet)); packet.AddUint8(0xAB); packet.AddUint16(65874); packet.AddInt8(-45874); packet.AddUint32(0x12345678); packet.AddInt32(-0xA2345678); packet.AddFloat(0.265); packet.AddFloat(-3.1415); int data_length = packet.Commit(); uint8_t* frame = packet.GetFrame(); } ``` ## CRC8 Computation - Generator polynome: 0x97 -> 0x197 = x^8 + x^7 + x^4 + x^2 + x^1 +1 - CRC is implemented as fast computation with prepared CrcTable. Algorithm complexity is O(n)