mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 21:33:33 +08:00
Address review comments
Remove crc
This commit is contained in:
@@ -34,7 +34,6 @@ px4_add_module(
|
||||
MODULE drivers__si7210
|
||||
MAIN si7210
|
||||
COMPILE_FLAGS
|
||||
# -DDEBUG_BUILD
|
||||
SRCS
|
||||
si7210_main.cpp
|
||||
si7210.cpp
|
||||
|
||||
@@ -207,7 +207,6 @@ int SI7210::collect()
|
||||
perf_begin(_sample_perf);
|
||||
|
||||
_collect_phase = false;
|
||||
// bool si7210_notify = true;
|
||||
|
||||
uint8_t reg;
|
||||
|
||||
@@ -325,25 +324,3 @@ SI7210::RunImpl()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool SI7210::crc(const uint8_t data[], unsigned size, uint8_t checksum)
|
||||
{
|
||||
uint8_t crc_value = 0xff;
|
||||
|
||||
// calculate 8-bit checksum with polynomial 0x31 (x^8 + x^5 + x^4 + 1)
|
||||
for (unsigned i = 0; i < size; i++) {
|
||||
crc_value ^= (data[i]);
|
||||
|
||||
for (int bit = 8; bit > 0; --bit) {
|
||||
if (crc_value & 0x80) {
|
||||
crc_value = (crc_value << 1) ^ 0x31;
|
||||
|
||||
} else {
|
||||
crc_value = (crc_value << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// verify checksum
|
||||
return (crc_value == checksum);
|
||||
}
|
||||
|
||||
@@ -173,11 +173,6 @@ private:
|
||||
*/
|
||||
int get_sensor_data(uint8_t otpAddr, int8_t *data);
|
||||
|
||||
/**
|
||||
* Calculate the CRC8 for the sensor payload data
|
||||
*/
|
||||
bool crc(const uint8_t data[], unsigned size, uint8_t checksum);
|
||||
|
||||
/**
|
||||
* Write a command in Sensirion specific logic
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user