IIO: Add 4-byte unsigned reads into generic-buffer example
authorMarek Vasut <marex@denx.de>
Sun, 12 Aug 2012 15:21:00 +0000 (16:21 +0100)
committerJonathan Cameron <jic23@kernel.org>
Thu, 16 Aug 2012 19:16:19 +0000 (20:16 +0100)
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>
drivers/staging/iio/Documentation/generic_buffer.c

index 827e92de8e30a83485a334344f75bfb60ee5dfa1..40d0ecac047f5a4511ae99a4fb250d2a8ebb3196 100644 (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 *)