Skip to content

Commit

Permalink
IIO: Add 4-byte unsigned reads into generic-buffer example
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marek Vasut authored and Jonathan Cameron committed Aug 16, 2012
1 parent 390d75c commit 6cffc1f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/staging/iio/Documentation/generic_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down

0 comments on commit 6cffc1f

Please sign in to comment.