This commit is contained in:
2025-10-16 17:27:49 +09:00
parent 5c7ffa4fb2
commit bf4951cf45
3 changed files with 322 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
Mobis CRC <20><><EFBFBD><EFBFBD>
void write_i2c_with_crc_test(const uint8 *data, uint32 length, IicSlaveConfigPtr LpSlaveConfig) {
//uint8 buffer[256]; // Ensure this is large enough
if (length + 2 > sizeof(buffer)) return; // Prevent overflow
// Copy data
for (uint8 i = 0; i < length+1; ++i) {
buffer[i] = data[i];
}
// Calculate and append CRC
buffer[length+1] = crc8(data, length+1);
// Send data + CRC over I2C
CddIic_Ch5Write(&buffer[1], length+1, LpSlaveConfig);
}