Thread (11 messages) 11 messages, 3 authors, 2012-08-12
STALE5074d
Revisions (2)
  1. v1 current
  2. v1 [diff vs current]

[PATCH 1/3] IIO: Add 4-byte unsigned reads into generic-buffer example

From: marex@denx.de (Marek Vasut)
Date: 2012-08-03 15:28:39
Also in: linux-iio
Subsystem: iio subsystem and drivers, staging - industrial io, staging subsystem, the rest · Maintainers: Jonathan Cameron, Greg Kroah-Hartman, Linus Torvalds

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 <redacted>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Wolfgang Denk <redacted>
---
 drivers/staging/iio/Documentation/generic_buffer.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index 827e92d..40d0eca 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 *)
-- 
1.7.10.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help