mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
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:
parent
390d75c128
commit
6cffc1f814
@ -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 *)
|
||||
|
Loading…
Reference in New Issue
Block a user