summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeonghoon Park <jh1979.park@samsung.com>2019-08-29 16:04:21 +0900
committerJeonghoon Park <jh1979.park@samsung.com>2019-08-29 16:04:21 +0900
commitc61f5ecf42298fc732ae22f4fd1de7ae35b35671 (patch)
tree1606eda7f423bc49aa1492e7f7d1140b74a9f395
parent11f716aa906fc294f0822693a273c613cc99a19a (diff)
downloadst-things-light-c61f5ecf42298fc732ae22f4fd1de7ae35b35671.tar.gz
st-things-light-c61f5ecf42298fc732ae22f4fd1de7ae35b35671.tar.bz2
st-things-light-c61f5ecf42298fc732ae22f4fd1de7ae35b35671.zip
update infrared_motion
Change-Id: Ie644dcf946d3c87b5a543bff796da604421b8c1e
-rwxr-xr-xsrc/resource/resource_infrared_motion.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/resource/resource_infrared_motion.c b/src/resource/resource_infrared_motion.c
index 574c58f..b432637 100755
--- a/src/resource/resource_infrared_motion.c
+++ b/src/resource/resource_infrared_motion.c
@@ -54,11 +54,18 @@ static int resource_open_infrared_motion(int pin_num)
int ret = peripheral_gpio_open(pin_num, &temp);
if (ret) {
- peripheral_gpio_close(temp);
_E("peripheral_gpio_open failed.");
return -1;
}
+ // It should be removed after peripheral-io is patched.
+ peripheral_gpio_set_direction(temp, PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
+ if (ret) {
+ peripheral_gpio_close(temp);
+ _E("peripheral_gpio_set_direction failed.");
+ return -1;
+ }
+
ret = peripheral_gpio_set_direction(temp, PERIPHERAL_GPIO_DIRECTION_IN);
if (ret) {
peripheral_gpio_close(temp);
@@ -127,6 +134,8 @@ int resource_set_interrupted_cb_infrared_motion(int pin_num, resource_infrared_m
int ret = PERIPHERAL_ERROR_NONE;
int ret_valid = MOTION_HANDLE_ERROR_NONE;
+ retv_if(!interrupted_cb, -1);
+
ret_valid = _resource_validate_infrared_motion(pin_num);
if (ret_valid == MOTION_HANDLE_ERROR_NOT_OPEN) {
ret = resource_open_infrared_motion(pin_num);