LingYun Studio embeded system framwork software, such as thirdparty build shell and lingyun library
guowenxue
2024-08-21 d48b80fc277cb123738461b6125a58ffe9923019
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*********************************************************************************
 *      Copyright:  (C) 2024 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  infrared.h
 *    Description:  This file is HC-SR501 infrared sensor code
 *
 * Pin connection:
 *               HC-SR501 Module          IGKBoard-IMX6ULL
 *                  VCC       <----->      5V
 *                  I/O       <----->      #Pin37(GPIO5_IO09)
 *                  GND       <----->      GND
 *
 ********************************************************************************/
 
#ifndef  _INFRARED_H_
#define  _INFRARED_H_
 
#include "gpiod.h"
 
/* infrared number */
enum
{
    IR1 = 0,
    IR_CNT,
};
 
enum
{
    IR_ACTIVE_LOW,  /* Low level active */
    IR_ACTIVE_HIGH, /* High level active */
};
 
/* infrared hardware information */
typedef struct infrared_s
{
    const char               *name;      /* infrared name  */
    int                       chip_num;  /* infrared connect chip */
    int                       gpio_num;  /* infrared connect line */
    int                       active;    /* infrared active level */
    struct gpiod_line_request *request;  /* libgpiod gpio request handler */
} infrared_t;
 
/* infrared structure */
typedef struct infrareds_s
{
    infrared_t          *infrareds;/* infrared pointer to infrareds_info */
    int                  count; /* infrared count */
} infrareds_t;
 
/* initial infrareds */
int init_infrared(void);
 
/* terminate infrareds   */
int term_infrared(void);
 
/* detect infrareds */
int detect_infrared(int which);
 
#endif