linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* read_raw endianess
@ 2019-08-29 16:30 Alexander Stein
  2019-08-29 18:45 ` Lars-Peter Clausen
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Stein @ 2019-08-29 16:30 UTC (permalink / raw)
  To: linux-iio

Hi,

I'm wondering which endianess read_raw shall be returned? E.g. when calling
> 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: read_raw endianess
  2019-08-29 16:30 read_raw endianess Alexander Stein
@ 2019-08-29 18:45 ` Lars-Peter Clausen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars-Peter Clausen @ 2019-08-29 18:45 UTC (permalink / raw)
  To: Alexander Stein, linux-iio

On 8/29/19 6:30 PM, Alexander Stein wrote:
> Hi,
> 
> I'm wondering which endianess read_raw shall be returned? E.g. when calling
>> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-29 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 16:30 read_raw endianess Alexander Stein
2019-08-29 18:45 ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).