From 4ff5fe054d3e9db5edf1eb8e9114729b5f7918a3 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 22 Apr 2021 03:18:37 +0800
Subject: [PATCH] update iotd for infrared detect

---
 iotd/hal/gpio.h |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/iotd/hal/gpio.h b/iotd/hal/gpio.h
index d1a2a23..2623e72 100644
--- a/iotd/hal/gpio.h
+++ b/iotd/hal/gpio.h
@@ -16,18 +16,15 @@
 
 #include <gpiod.h>
 
-#define OFF   0
-#define ON    1
-
 #define GPIO_MAXOUT         8
 #define GPIO_MAXIN          4
 
 typedef struct gpio_info_s
 {
     char                 name[32];      /*  GPIO connected module name */
-    int                  pin;          /*  GPIO BCM pin number */
+    int                  pin;           /*  GPIO BCM pin number */
     int                  active_level;  /*  active power level */
-    struct gpiod_line   *lines;         /*  gpiod lines */
+    struct gpiod_line   *line;          /*  gpiod line */
 } gpio_info_t;
 
 
@@ -39,20 +36,19 @@
 
     gpio_info_t          input[GPIO_MAXIN];   /* GPIO input pins */
     int                  incnt;               /* GPIO input numbers */
+    int                  infrared_enable;     /* infrared enable or not */
 } gpio_t; 
 
 extern int gpio_init(gpio_t *gpio);
 extern void gpio_term(void);
 
-
 /* turn which light on/off */
-extern void turn_light(int which, int cmd);
-
-/* turn which led on/off */
-extern void turn_led(int which, int cmd);
+extern void gpio_out(char *name, char *cmd);
 
 /* Return value: 0(LOW): Nobody detected, !0: Which infrared detect incoming */
-extern int infrared_detect(void);
+#define FLAG_INFRARED_INDOOR          (1<<0)
+#define FLAG_INFRARED_HALLWAY         (1<<1)
+extern int infrared_detect(int interval);
 
 #endif   /* ----- #ifndef _GPIO_H_  ----- */
 

--
Gitblit v1.9.1