diff options
author | Eunyoung Lee <ey928.lee@samsung.com> | 2017-07-21 17:41:39 +0900 |
---|---|---|
committer | Eunyoung Lee <ey928.lee@samsung.com> | 2017-07-21 17:43:48 +0900 |
commit | 5782ff3c7f400a0dba54c8fa2ac857d5d768674f (patch) | |
tree | bb57847e724cc6d7d707203167ad101e1fbf5e14 /src/controller.c | |
parent | 642dd73da4b7803e54891eb30251f6e52f44cbc4 (diff) | |
download | rcc-5782ff3c7f400a0dba54c8fa2ac857d5d768674f.tar.gz rcc-5782ff3c7f400a0dba54c8fa2ac857d5d768674f.tar.bz2 rcc-5782ff3c7f400a0dba54c8fa2ac857d5d768674f.zip |
Changed the method of reading the sensor value from the ultrasonic sensor
Change-Id: I2ca69857c66db8c2b3ae3bbd2867cc33734d59c0
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/controller.c b/src/controller.c index 886f712..cee20d9 100644 --- a/src/controller.c +++ b/src/controller.c @@ -39,7 +39,7 @@ #define GPIO_ULTRASONIC_ECHO_NUM_1 21 #define GPIO_INFRARED_MOTION_NUM_1 4 #define I2C_ILLUMINANCE_FIRST_PIN_1 3 -#define USE_MULTIPLE_SENSOR 1 +#define USE_MULTIPLE_SENSOR 0 #define MULTIPLE_SENSOR_NUMBER 5 static void _start_internal_function(void); @@ -81,12 +81,16 @@ static Eina_Bool _infrared_motion_getter_timer(void *data) } #if (!USE_MULTIPLE_SENSOR) +static void ultrasonic_sensor_read_cb(double value, void *data) +{ + _I("Distance : %.2fcm", value); +} + static Eina_Bool _ultrasonic_getter_timer(void *data) { double value = 0; - retv_if(resource_read_ultrasonic_sensor(GPIO_ULTRASONIC_TRIG_NUM_1, GPIO_ULTRASONIC_ECHO_NUM_1, &value) == -1, ECORE_CALLBACK_CANCEL); - _I("Ultra Sonic Distance is [%d cm]", value); + retv_if(resource_read_ultrasonic_sensor(GPIO_ULTRASONIC_TRIG_NUM_1, GPIO_ULTRASONIC_ECHO_NUM_1, ultrasonic_sensor_read_cb, NULL) == -1, ECORE_CALLBACK_CANCEL); return ECORE_CALLBACK_RENEW; } |