Lepton-FLiR-Arduino
Lepton-FLiR-Arduino copied to clipboard
Does lepton require the arduino to be little endian?
I have a question about this conversion:
(uint16_t *)&value
in
void LeptonFLiR::sendCommand(uint16_t cmdCode, uint32_t value) {
#ifdef LEPFLIR_ENABLE_DEBUG_OUTPUT
Serial.print(" LeptonFLiR::sendCommand cmdCode: 0x");
Serial.println(cmdCode, HEX);
#endif
if (waitCommandBegin(LEPFLIR_GEN_CMD_TIMEOUT)) {
if (writeCmdRegister(cmdCode, (uint16_t *)&value, 2) == 0) {
waitCommandFinish(LEPFLIR_GEN_CMD_TIMEOUT);
}
}
In the writeCmdRegister, the dataWords
argument, which corresponds (uint16_t *)&value
, is going to be written to the i2cwire position by position, starting at position 0.
My question is, why does we start at the beginning of dataWords
and not in the end?
This code seems to work if the arduino stores values using the little endian system, but what if it is stored as big endian? can we trust it never is? Am I getting it wrong?
Thank you
[Edit] After searching a bit, I realized almost every processor is little endian. Still, I'd like to confirm that this code is assuming that just for my own sanity.