diff options
author | Karl Palsson <karlp@tweak.net.au> | 2017-03-22 23:03:29 +0000 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2017-03-22 23:03:29 +0000 |
commit | 4032ff221f8c21638aa57b4518dc1af31e5dd9b9 (patch) | |
tree | bbd62747b4cdfcfbc175be3cc430861fe3d0ed4a /tests/i2c-master | |
parent | 7a540fb4ab547fcb6bc6b56057ab8968fab12390 (diff) | |
download | olsndot-4032ff221f8c21638aa57b4518dc1af31e5dd9b9.tar.gz olsndot-4032ff221f8c21638aa57b4518dc1af31e5dd9b9.tar.bz2 olsndot-4032ff221f8c21638aa57b4518dc1af31e5dd9b9.zip |
use transfer style for serial number reading
Diffstat (limited to 'tests/i2c-master')
-rw-r--r-- | tests/i2c-master/i2c-master.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/i2c-master/i2c-master.c b/tests/i2c-master/i2c-master.c index b140b74..ec6404f 100644 --- a/tests/i2c-master/i2c-master.c +++ b/tests/i2c-master/i2c-master.c @@ -390,14 +390,16 @@ static void sht21_readid(void) uint8_t res[8]; // sht21_send_data(I2C1, 2, req1); // sht21_readn(I2C1, sizeof(res), res); - i2c_write_bytes7(hw_details.periph, SENSOR_ADDRESS, req1, 2, false); - i2c_read_bytes7(hw_details.periph, SENSOR_ADDRESS, res, 8, true); + i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, req1, sizeof(req1), res, 8); +// i2c_write_bytes7(hw_details.periph, SENSOR_ADDRESS, req1, 2, false); +// i2c_read_bytes7(hw_details.periph, SENSOR_ADDRESS, res, 8, true); uint8_t req2[] = {0xfc, 0xc9}; uint8_t res2[8]; // sht21_send_data(I2C1, 2, req2); // sht21_readn(I2C1, sizeof(res), res2); - i2c_write_bytes7(hw_details.periph, SENSOR_ADDRESS, req2, 2, false); - i2c_read_bytes7(hw_details.periph, SENSOR_ADDRESS, res2, 8, true); + i2c_transfer7(hw_details.periph, SENSOR_ADDRESS, req1, sizeof(req1), res2, 8); +// i2c_write_bytes7(hw_details.periph, SENSOR_ADDRESS, req2, 2, false); +// i2c_read_bytes7(hw_details.periph, SENSOR_ADDRESS, res2, 8, true); printf("Serial = %02x%02x %02x%02x %02x%02x %02x%02x\n", res2[3], res2[4], res[0], res[2], res[4], res[6], res2[0], res2[1]); |