IIO: Add 4-byte unsigned reads into generic-buffer example

Add unsigned 32bit-wide reads into the generic-buffer.c

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Juergen Beisert <jbe@pengutronix.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Marek Vasut 2012-08-12 16:21:00 +01:00 committed by Jonathan Cameron
parent 390d75c128
commit 6cffc1f814

View File

@ -104,6 +104,16 @@ void process_scan(char *data,
print2byte(*(uint16_t *)(data + channels[k].location),
&channels[k]);
break;
case 4:
if (!channels[k].is_signed) {
uint32_t val = *(uint32_t *)
(data + channels[k].location);
printf("%05f ", ((float)val +
channels[k].offset)*
channels[k].scale);
}
break;
case 8:
if (channels[k].is_signed) {
int64_t val = *(int64_t *)