/*********************************************************************************
|
* 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
|