MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / makePacket

Function makePacket

Tactility/Source/hal/gps/Ublox.cpp:42–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42uint8_t makePacket(uint8_t classId, uint8_t messageId, const uint8_t* payload, uint8_t payloadSize, uint8_t* bufferOut) {
43 // Construct the UBX packet
44 bufferOut[0] = 0xB5U; // header
45 bufferOut[1] = 0x62U; // header
46 bufferOut[2] = classId; // class
47 bufferOut[3] = messageId; // id
48 bufferOut[4] = payloadSize; // length
49 bufferOut[5] = 0x00U;
50
51 bufferOut[6 + payloadSize] = 0x00U; // CK_A
52 bufferOut[7 + payloadSize] = 0x00U; // CK_B
53
54 for (int i = 0; i < payloadSize; i++) {
55 bufferOut[6 + i] = payload[i];
56 }
57 checksum(bufferOut, (payloadSize + 8U));
58 return (payloadSize + 8U);
59}
60
61GpsResponse getAck(::Device* uart, uint8_t class_id, uint8_t msg_id, uint32_t waitMillis) {
62 uint8_t b;

Callers 3

initUblox10Function · 0.85
initUblox789Function · 0.85
initUblox6Function · 0.85

Calls 1

checksumFunction · 0.85

Tested by

no test coverage detected