Wiki source code of Control Gateway GPIOs & LEDs

Version 15.2 by Xiaoling on 2022/05/07 16:39

Hide last authors
Edwin Chen 1.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
Edwin Chen 12.1 5 = Products LEDs Mapping =
Edwin Chen 11.1 6
7 {{velocity}}
Edwin Chen 10.1 8 $xwiki.ssfx.use("js/xwiki/table/table.css")
9 $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
10 {{/velocity}}
Edwin Chen 1.1 11
Edwin Chen 10.1 12 (% class="doOddEven filterable grid sortable" id="tableid" %)
Xiaoling 14.2 13 (% class="sortHeader" %)|=Model|=Global LED|=(% style="width: 66px;" %)PWR LED|=(% style="width: 66px;" %)LAN LED|=WAn LED|=WIFI LED|=SENSOR LED|=4G control (Second +3.3v)|=USB POWER(+5v) Control
Edwin Chen 15.1 14 |**LPS8**|(((
Xiaoling 14.2 15 GPIO28(BLUE),
Edwin Chen 1.1 16
Xiaoling 14.2 17 GPIO21(RED),
18
Xiaoling 15.2 19 GPIO22(GREEN(% style="background-color:transparent" %))
Xiaoling 14.2 20 )))|(% style="width:66px" %)(((
21
22
23 +3.3v
24 )))|(% style="width:80px" %) |GPIO17(RED)| | | |
Edwin Chen 15.1 25 |**LPS8N**|(((
Xiaoling 14.2 26 GPIO28(BLUE),
27
28 GPIO21(RED),
29
Xiaoling 15.2 30 GPIO22(GREEN(% style="background-color:transparent" %))
Xiaoling 14.2 31 )))|(% style="width:66px" %)(((
32
33
34 +3.3v
35 )))|(% style="width:80px" %) |GPIO17(RED)|(((
36 GPIO16(BLUE),
37
38 GPIO26(RED),
39
Xiaoling 15.2 40 GPIO27(GREEN(% style="background-color:transparent" %))
41 )))| |(((
42
Xiaoling 14.2 43
Xiaoling 15.2 44 GPIO15
45 )))|
46 |LG308|GPIO28(RED)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO13(RED) |GPIO17(RED)|GPIO0(RED)| |GPIO15 |GPIO1
47 |DLOS8|GPIO28(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %) |GPIO17(GREEN)|GPIO0(GREEN)| |GPIO15 |GPIO1
48 |HP0C|(((
49 PA8(GREEN),
Xiaoling 14.2 50
Xiaoling 15.2 51 PA9(RED(% style="background-color:transparent" %))
52 )))|(% style="width:66px" %)+3.3v|(% style="width:80px" %)(((
53 EPHY-LINK-LED(GREEN),
Xiaoling 14.2 54
Xiaoling 15.2 55 PA17(BLUE)
56 )))| |(((
57
Xiaoling 14.2 58
Xiaoling 15.2 59 PA7(RED(% style="background-color:transparent" %))
60 )))| | |
61 |HP0A|PA8(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)EPHY-LINK-LED|PA9(RED)|PA7(RED)| |PA17|
62 |IBB|GPIO28(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO13(GREEN)|GPIO17(GREEN)|GPIO0(GREEN)|SENSOR_LED| |GPIO1
63 |LIG16|GPIO28(RED)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO22(GREEN)|GPIO17(GREEN)|GPIO0(GREEN)|GPIO21(GREEN)| |
64 |MS14N|GPIO28(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO13(GREEN)|GPIO17(GREEN)|GPIO0(GREEN)|SENSOR_LED| |GPIO1
65
66 (% class="mark" %)Notice: GPIO28 is exposed as dragino2:red:system in firmware by default.
67
Edwin Chen 1.2 68 = Control LEDs & GPIOs =
Edwin Chen 1.1 69
Edwin Chen 1.2 70 == OpenWrt Base OS ==
Edwin Chen 1.1 71
Edwin Chen 6.1 72 (% class="box infomessage" id="HControlanGeneralGPIO:" %)
73 (((
Edwin Chen 8.1 74 **Control a General GPIO:**
Edwin Chen 1.1 75
Edwin Chen 1.2 76 **echo 18 > /sys/class/gpio/export**     ~/~/ Export gpio 18 so we can use it
77 **echo "high" > /sys/class/gpio/gpio18/direction**   ~/~/  Set direction to out and
78 set level to high. Use "low" to set direction to output and level to low
79
80 **echo 0 > /sys/class/gpio/gpio18/value**    ~/~/ Set output to 0 or 1
81 **echo "in" > /sys/class/gpio/gpio18/direction**  ~/~/ Set GPIO18 as input
82
83 **cat  /sys/class/gpio/gpio18/value**  ~/~/ Get GPIO18 value if set input
84 )))
85
Edwin Chen 9.1 86 (% class="box infomessage" %)
87 (((
88 **Control a GPIO already exported as SYSTEM LEDs .**
89 **echo 1 > /sys/class/leds/dragino2\:red\:system/brightness**  ~/~/ Turn On LED dragino2:red:system
90 **echo 0 > /sys/class/leds/dragino2\:red\:system/brightness**  ~/~/ Turn off LED dragino2:red:system
91 )))
92
93
Edwin Chen 3.1 94 Reference: [[http:~~/~~/www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs>>url:http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs]]