diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-08-20 14:56:47 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-08-20 14:56:47 +0200 |
commit | 045391dddb59cc8b5cf8ee71ba0a367ba1a04ef7 (patch) | |
tree | eb4eba2ba8e7cbe8a62a9cf202e94e3d8a920b60 | |
parent | f3ddfd65a21e56647264aba819c054fa2830995a (diff) |
Send NAK after receiving last byte
-rw-r--r-- | commandline/i2cget.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/commandline/i2cget.c b/commandline/i2cget.c index 95243d4..f27ea51 100644 --- a/commandline/i2cget.c +++ b/commandline/i2cget.c @@ -66,9 +66,10 @@ int main(int argc, char **argv) return 3; } - for (i = 0; i < num_bytes; i++) { - printf("%i\n", i2c_hw_rx_byte(1)); + for (i = 1; i <= num_bytes; i++) { + printf("%i ", i2c_hw_rx_byte((i < num_bytes) * 1)); } + putc('\n', stdout); i2c_hw_stop(); i2c_deinit(); |