refining headers included in resource modules
authorJeonghoon Park <jh1979.park@samsung.com>
Thu, 14 Dec 2017 08:22:03 +0000 (17:22 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Thu, 14 Dec 2017 09:45:31 +0000 (18:45 +0900)
inc/resource.h
inc/resource/resource_infrared_obstacle_avoidance_sensor.h
inc/resource_internal.h
inc/resource_type.h [new file with mode: 0644]
src/resource.c
src/resource/resource_infrared_obstacle_avoidance_sensor.c

index 1e06636..4fb9f04 100644 (file)
@@ -22,9 +22,6 @@
 #ifndef __POSITION_FINDER_RESOURCE_H__
 #define __POSITION_FINDER_RESOURCE_H__
 
-#include <peripheral_io.h>
-
-#include "resource_internal.h"
 #include "resource/resource_infrared_obstacle_avoidance_sensor.h"
 
 #endif /* __POSITION_FINDER_RESOURCE_H__ */
index fdd7482..20d088e 100644 (file)
@@ -22,9 +22,8 @@
 #ifndef __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
 #define __POSITION_FINDER_RESOURCE_INFRARED_OBSTACLE_AVOIDANCE_SENSOR_H__
 
+#include "resource_type.h"
 
-#include <stdint.h>
-#include "resource_internal.h"
 /**
  * @brief Reads the value of gpio connected infrared obstacle avoidance sensor.
  * @param[in] pin_num The number of the gpio pin connected to the infrared obstacle avoidance sensor
@@ -32,7 +31,7 @@
  * @return 0 on success, otherwise a negative error value
  * @see If the gpio pin is not open, creates gpio handle before reading the value of gpio.
  */
-extern int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, uint32_t *out_value);
+extern int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, unsigned int *out_value);
 
 extern int resource_set_infrared_obstacle_avoidance_sensor_interrupted_cb(int pin_num, resource_changed_cb cb, void *data);
 
index af694a6..12e318c 100644 (file)
 #define __POSITION_FINDER_RESOURCE_INTERNAL_H__
 
 #include <peripheral_io.h>
-#include <stdint.h>
+#include "resource_type.h"
 
 #define PIN_MAX 40
 
-typedef void (*resource_read_cb)(double value, void *data);
-
 typedef struct _resource_read_cb_s {
        resource_read_cb cb;
        void *data;
        int pin_num;
 } resource_read_s;
 
-typedef void (*resource_changed_cb)(unsigned int value, void *data);
-
 typedef struct _resource_changed_s {
        resource_changed_cb cb;
        void *data;
@@ -51,7 +47,6 @@ typedef struct _resource_s {
        resource_changed_s *resource_changed_info;
 } resource_s;
 
-
 extern resource_s *resource_get_info(int pin_num);
 extern void resource_close_all(void);
 
diff --git a/inc/resource_type.h b/inc/resource_type.h
new file mode 100644 (file)
index 0000000..6853164
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Contact: Jin Yoon <jinny.yoon@samsung.com>
+ *          Geunsun Lee <gs86.lee@samsung.com>
+ *          Eunyoung Lee <ey928.lee@samsung.com>
+ *          Junkyu Han <junkyu.han@samsung.com>
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef __POSITION_FINDER_RESOURCE_TYPE_H__
+#define __POSITION_FINDER_RESOURCE_TYPE_H__
+
+typedef void (*resource_read_cb)(double value, void *data);
+typedef void (*resource_changed_cb)(unsigned int value, void *data);
+
+#endif /* __POSITION_FINDER_RESOURCE_TYPE_H__ */
index bd6c085..1454937 100644 (file)
@@ -22,7 +22,7 @@
 #include <peripheral_io.h>
 
 #include "log.h"
-#include "resource.h"
+#include "resource_internal.h"
 
 static resource_s resource_info[PIN_MAX] = { {0, NULL, NULL}, };
 
index 573ee76..579ab80 100644 (file)
  */
 
 #include <stdlib.h>
-#include <unistd.h>
 #include <peripheral_io.h>
-#include <sys/time.h>
-
 #include "log.h"
 #include "resource_internal.h"
 
@@ -64,7 +61,7 @@ static int _init_pin(int pin_num)
        return 0;
 }
 
-int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, uint32_t *out_value)
+int resource_read_infrared_obstacle_avoidance_sensor(int pin_num, unsigned int *out_value)
 {
        int ret = PERIPHERAL_ERROR_NONE;