guowenxue
2021-04-21 a01524eb28cce72db4b499ec242995fbf99b6b7a
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
/*********************************************************************************
 *      Copyright:  (C) 2019 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  hal.h
 *    Description:  This file is HAL(Hardware Abstract Layer) initial functions
 *                 
 *        Version:  1.0.0(2019年06月24日)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "2019年06月24日 23时46分47秒"
 *                 
 ********************************************************************************/
 
#ifndef  _HAL_H_
#define  _HAL_H_
 
#include <wiringPi.h>
 
#include "lylib/logger.h"
#include "etc/conf.h"
 
#include "ds18b20.h"
#include "sht20.h"
#include "tsl2561.h"
#include "beep.h"
 
#define OFF   0
#define ON    1
 
/* Three LEDs code */
enum
{
    LED_R = 0,
    LED_G,
    LED_B,
    LED_MAX,
};
 
extern int hal_init(hwconf_t *conf);
extern void turn_relay(int cmd);
extern int turn_led(int which, int cmd);
extern void init_infrared(int pin);
extern void turn_beep(int times);
 
/*  jitter_time: cancel jitter interval time 
 * Return value: 1(HIGH): Sombody detected  0(LOW): Nobody detected */
extern int infrared_detect(int jitter_time);
 
#endif   /* ----- #ifndef _HAL_H_  ----- */