2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_H__
18 #define __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_H__
21 * @brief Reads the value of gpio connected infrared motion sensor(HC-SR501).
22 * @param[in] pin_num The number of the gpio pin connected to the infrared motion sensor
23 * @param[out] out_value The value of the gpio (zero or non-zero)
24 * @return 0 on success, otherwise a negative error value
25 * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
27 extern int resource_read_infrared_motion_sensor(int pin_num, uint32_t *out_value);
30 * @brief Releases the gpio handle and changes the gpio pin state to the close(0).
31 * @param[in] pin_num The number of the gpio pin connected to the infrared motion sensor
33 extern void resource_close_infrared_motion_sensor(void);
35 #endif /* __POSITION_FINDER_RESOURCE_INFRARED_MOTION_SENSOR_H__ */