From 30f0c4ea61c375c4b43ebcabb66608f188a009ed Mon Sep 17 00:00:00 2001 From: Hubert Zwiercan Date: Wed, 17 Oct 2018 14:02:52 +0200 Subject: [PATCH] fix to hitechnic_irseeker example and Lego_Ultrasonic.cpp --- examples/robocore/hitechnic_irseeker.cpp | 3 +-- src/Lego_Ultrasonic.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/robocore/hitechnic_irseeker.cpp b/examples/robocore/hitechnic_irseeker.cpp index 1c4bddb..68bbfdd 100644 --- a/examples/robocore/hitechnic_irseeker.cpp +++ b/examples/robocore/hitechnic_irseeker.cpp @@ -9,8 +9,7 @@ using namespace hSensors; void hMain(void) { - hLegoSensor_i2c ls(hSens1); - Hitechnic_IRSeeker sensor(ls); + Hitechnic_IRSeeker sensor(hSens1); for (;;) { diff --git a/src/Lego_Ultrasonic.cpp b/src/Lego_Ultrasonic.cpp index 3ea3459..ce90eee 100644 --- a/src/Lego_Ultrasonic.cpp +++ b/src/Lego_Ultrasonic.cpp @@ -45,7 +45,7 @@ int Lego_Ultrasonic::readDist() init(); uint8_t tx[1], rx[1]; tx[0] = LEGOUS_REG_DATA; - if (!sens.getI2C().read(1, tx, 1, rx, 1)) + if (!sens.getI2C().rw(1, tx, 1, rx, 1, 10000)) return -1; return rx[0]; @@ -55,7 +55,7 @@ bool Lego_Ultrasonic::readDistances(uint8_t distances[8]) init(); uint8_t tx[1]; tx[0] = LEGOUS_REG_DATA; - return sens.getI2C().read(1, tx, 1, distances, 8); + return sens.getI2C().rw(1, tx, 1, distances, 8, 10000); } bool Lego_Ultrasonic::setSingleMode() {