diff options
author | px4dev <px4@purgatory.org> | 2013-01-09 21:39:54 -0800 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-01-13 19:05:00 -0800 |
commit | 3cea0959b72fe160e6a05e8efef1d325d12d4544 (patch) | |
tree | 92067e4c4d1e5c54000d29218bddd5b6d57a7acb /apps/systemcmds/i2c/i2c.c | |
parent | 2fb820fabd7c7b675c4e0da026c95546b62424e6 (diff) | |
download | px4-firmware-3cea0959b72fe160e6a05e8efef1d325d12d4544.tar.gz px4-firmware-3cea0959b72fe160e6a05e8efef1d325d12d4544.tar.bz2 px4-firmware-3cea0959b72fe160e6a05e8efef1d325d12d4544.zip |
Implement a simple byte loopback server on I2C for more testing.
Diffstat (limited to 'apps/systemcmds/i2c/i2c.c')
-rw-r--r-- | apps/systemcmds/i2c/i2c.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/systemcmds/i2c/i2c.c b/apps/systemcmds/i2c/i2c.c index 57c61e824..422d9f915 100644 --- a/apps/systemcmds/i2c/i2c.c +++ b/apps/systemcmds/i2c/i2c.c @@ -84,8 +84,13 @@ int i2c_main(int argc, char *argv[]) int ret = transfer(PX4_I2C_OBDEV_PX4IO, (uint8_t *)&val, sizeof(val), NULL, 0); if (ret) - errx(1, "transfer failed"); - exit(0); + errx(1, "send failed - %d", ret); + + ret = transfer(PX4_I2C_OBDEV_PX4IO, NULL, 0, (uint8_t *)&val, sizeof(val)); + if (ret) + errx(1, "recive failed - %d", ret); + + errx(0, "got 0x%08x", val); } static int |