summaryrefslogtreecommitdiff
path: root/src/resource
diff options
context:
space:
mode:
authorBoyeon <boyeon.son@samsung.com>2019-08-23 20:34:04 +0900
committerBoyeon <boyeon.son@samsung.com>2019-08-23 20:34:04 +0900
commit96b942dd26500fd12c61b1597185c6a44180fd78 (patch)
treef68f00d197f803abf7254ae897061d6284e1f1c4 /src/resource
parent9571c753b3c1f227a2d7a8ee0a77196c55732c23 (diff)
downloadst-things-light-96b942dd26500fd12c61b1597185c6a44180fd78.tar.gz
st-things-light-96b942dd26500fd12c61b1597185c6a44180fd78.tar.bz2
st-things-light-96b942dd26500fd12c61b1597185c6a44180fd78.zip
Add two projects in master repository
Change-Id: If7464555bb65cb0504597c3ac327c335a2fbaf7c
Diffstat (limited to 'src/resource')
-rwxr-xr-xsrc/resource/resource_infrared_motion_sensor.c66
-rwxr-xr-xsrc/resource/resource_led.c68
2 files changed, 0 insertions, 134 deletions
diff --git a/src/resource/resource_infrared_motion_sensor.c b/src/resource/resource_infrared_motion_sensor.c
deleted file mode 100755
index d0605e6..0000000
--- a/src/resource/resource_infrared_motion_sensor.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-
-#include "log.h"
-
-static peripheral_gpio_h g_sensor_h = NULL;
-static int g_pin_num = -1;
-
-void resource_close_infrared_motion_sensor(void)
-{
- if (!g_sensor_h) return;
-
- _I("Infrared Motion Sensor is finishing...");
-
- peripheral_gpio_close(g_sensor_h);
-
- g_sensor_h = NULL;
- g_pin_num = -1;
-}
-
-int resource_read_infrared_motion_sensor(int pin_num, uint32_t *out_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!g_sensor_h) {
- peripheral_gpio_h temp = NULL;
-
- ret = peripheral_gpio_open(pin_num, &temp);
- retv_if(ret, -1);
-
- ret = peripheral_gpio_set_direction(temp, PERIPHERAL_GPIO_DIRECTION_IN);
- if (ret) {
- peripheral_gpio_close(temp);
- _E("peripheral_gpio_set_direction failed.");
- return -1;
- }
-
- g_sensor_h = temp;
- g_pin_num = pin_num;
- }
-
- if (g_pin_num != pin_num) {
- _E("Invalid pin number.");
- return -1;
- }
-
- ret = peripheral_gpio_read(g_sensor_h, out_value);
- retv_if(ret < 0, -1);
-
- return 0;
-}
diff --git a/src/resource/resource_led.c b/src/resource/resource_led.c
deleted file mode 100755
index 242cf73..0000000
--- a/src/resource/resource_led.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <peripheral_io.h>
-
-#include "log.h"
-
-static peripheral_gpio_h g_sensor_h = NULL;
-static int g_pin_num = -1;
-
-void resource_close_led(void)
-{
- if (!g_sensor_h) return;
-
- _I("LED is finishing...");
-
- peripheral_gpio_close(g_sensor_h);
-
- g_sensor_h = NULL;
- g_pin_num = -1;
-}
-
-int resource_write_led(int pin_num, int write_value)
-{
- int ret = PERIPHERAL_ERROR_NONE;
-
- if (!g_sensor_h) {
- peripheral_gpio_h temp = NULL;
-
- ret = peripheral_gpio_open(pin_num, &temp);
- retv_if(ret, -1);
-
- ret = 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;
- }
-
- g_sensor_h = temp;
- g_pin_num = pin_num;
- }
-
- if (g_pin_num != pin_num) {
- _E("Invalid pin number.");
- return -1;
- }
-
- ret = peripheral_gpio_write(g_sensor_h, write_value);
- retv_if(ret < 0, -1);
-
- _I("LED Value : %s", write_value ? "ON":"OFF");
-
- return 0;
-}