guowenxue
2021-04-21 8913f64d481a3da19d7e03b619605dc67eaf0591
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
/*********************************************************************************
 *      Copyright:  (C) 2018 LingYun IoT System Studio
 *                  All rights reserved.
 *
 *       Filename:  led.h
 *    Description:  This file is used to control RGB 3-colours LED
 *
 *     pi@raspberrypi:~ $ gpio readall     #show BCM and wPi pinmap  
 *
 *                 LED     #PIN        BCM          wPi 
 *                  I ----  9   ----   GND    ----  GND  
 *                  G ----  11  ----   17     ----   0
 *                  R ----  13  ----   27     ----   2 
 *                  B ----  15  ----   22     ----   3  
 *                 
 *        Version:  1.0.0(2018/10/14)
 *         Author:  Guo Wenxue <guowenxue@gmail.com>
 *      ChangeLog:  1, Release initial version on "2018/10/14 12:13:26"
 *                 
 ********************************************************************************/
 
#ifndef __LED_H
#define __LED_H
 
#define OFF   0
#define ON    1
 
 
/* Three LEDs code */
enum
{
    LED_R = 0,
    LED_G,
    LED_B,
    LED_MAX,
};
 
/* 3 LEDs WiringPi GPIO port */
                               
 
#ifdef CONFIG_USE_WIRINGPI
static int led_gpio[LED_MAX]= {   2,     0,      3  };
#else /* use libgpiod library */
static int led_gpio[LED_MAX]= {   27,    17,     22  };
#endif
 
 
void init_led(void);
int turn_led(int which, int cmd);
 
 
#endif