summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2012-08-12 16:21:00 +0100
committerJonathan Cameron <jic23@kernel.org>2012-08-16 20:16:19 +0100
commit6cffc1f814b25d59ca6f0cd75b64bb159801c0fa (patch)
tree03c4506e7122e3eb7de71e66fc9b4b3f94dab404
parent390d75c1287bf68c2e29226bf8eb10ae6a08c380 (diff)
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>
-rw-r--r--drivers/staging/iio/Documentation/generic_buffer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index 827e92de8e30..40d0ecac047f 100644
--- a/drivers/staging/iio/Documentation/generic_buffer.c
+++ b/drivers/staging/iio/Documentation/generic_buffer.c
@@ -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 *)