Skip to contentSkip to conversation

read_raw endianess

DISCUSSION Alexander Stein 2 participants 2 messages Aug 29, 2019 IIO

lore
Share & tools
lore
#0 lore raw

Hi,

I'm wondering which endianess read_raw shall be returned? E.g. when calling

Quoted 1 line

cat /sys/bus/iio/devices/iio\:device2/in_voltage0_raw

How much 'rawness' shall be returned? How shall i return my 14 Bit big-endian left-adjusted value stored in 16bits?

Best regards,
Alexander

#1 lore raw
Quoted 6 lines · Alexander Stein

Hi,

I'm wondering which endianess read_raw shall be returned? E.g. when calling

Quoted 1 line

cat /sys/bus/iio/devices/iio\:device2/in_voltage0_raw

How much 'rawness' shall be returned? How shall i return my 14 Bit big-endian left-adjusted value stored in 16bits?

Hi,

The sysfs attributes always return data in host system endianess and usually shifted so that the data is right-justified. So that the largest value that you'll get is 2**N_BITS-1.

raw in this case only means that the data has not been converted to e.g. a standard SI unit (like volt) since that will typically cause a loss of precision and/or quantization errors.

- Lars