mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #12789 from maribu/bmx280_endianess
drivers/bmx280: Fix incorrect endian conversion
This commit is contained in:
commit
f4876013cd
@ -123,20 +123,12 @@ static int _read_burst(const bmx280_t *dev, uint8_t reg, void *buf, size_t len)
|
||||
|
||||
static uint16_t _to_u16_le(const uint8_t *buffer, size_t offset)
|
||||
{
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
return (((uint16_t)buffer[offset + 1]) << 8) + buffer[offset];
|
||||
#else
|
||||
return (((uint16_t)buffer[offset]) << 8) + buffer[offset + 1];
|
||||
#endif
|
||||
return (((uint16_t)buffer[offset + 1]) << 8) | buffer[offset];
|
||||
}
|
||||
|
||||
static int16_t _to_i16_le(const uint8_t *buffer, size_t offset)
|
||||
{
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
return (((int16_t)buffer[offset + 1]) << 8) + buffer[offset];
|
||||
#else
|
||||
return (((int16_t)buffer[offset]) << 8) + buffer[offset + 1];
|
||||
#endif
|
||||
return (((int16_t)buffer[offset + 1]) << 8) | buffer[offset];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user