Wiki source code of Control Gateway GPIOs & LEDs

Version 17.1 by Edwin Chen on 2022/05/29 08:04

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 17.1 12 (% class="doOddEven filterable grid sortable" id="tableid" style="height:25px; width:1020px" %)
13 (% class="sortHeader" %)|=(% style="width: 69px;" %)Model|=(% style="width: 75px;" %)OS|=(% style="width: 130px;" %)Global LED|=(% style="width: 93px;" %)PWR LED|=(% style="width: 95px;" %)LAN LED|=(% style="width: 119px;" %)WAN LED|=(% style="width: 111px;" %)WIFI LED|=SENSOR LED|=(% style="width: 133px;" %)(((
14 4G control
15
16 (Second +3.3v)
17 )))|=(% style="width: 134px;" %)(((
18 USB POWER
19
20 (+5v) Control
21 )))
22 |(% style="width:69px" %)LPS8|(% style="width:75px" %)Openwrt|(% style="width:130px" %)(((
Xiaoling 14.2 23 GPIO28(BLUE),
Edwin Chen 1.1 24
Xiaoling 14.2 25 GPIO21(RED),
26
Xiaoling 15.2 27 GPIO22(GREEN(% style="background-color:transparent" %))
Xiaoling 15.5 28 )))|(% style="width:93px" %)(((
Xiaoling 14.2 29
30
31 +3.3v
Edwin Chen 17.1 32 )))|(% style="width:95px" %) |(% style="width:119px" %)GPIO17(RED)|(% style="width:111px" %) | |(% style="width:133px" %) |(% style="width:134px" %)
33 |(% style="width:69px" %)LPS8N|(% style="width:75px" %)Openwrt|(% style="width:130px" %)(((
Xiaoling 14.2 34 GPIO28(BLUE),
35
36 GPIO21(RED),
37
Xiaoling 15.2 38 GPIO22(GREEN(% style="background-color:transparent" %))
Xiaoling 15.5 39 )))|(% style="width:93px" %)(((
Xiaoling 14.2 40
41
42 +3.3v
Xiaoling 15.5 43 )))|(% style="width:95px" %) |(% style="width:119px" %)GPIO17(RED)|(% style="width:111px" %)(((
Xiaoling 14.2 44 GPIO16(BLUE),
45
46 GPIO26(RED),
47
Xiaoling 15.2 48 GPIO27(GREEN(% style="background-color:transparent" %))
Edwin Chen 17.1 49 )))| |(% style="width:133px" %)(((
Xiaoling 15.2 50
Xiaoling 14.2 51
Xiaoling 15.2 52 GPIO15
Edwin Chen 17.1 53 )))|(% style="width:134px" %)
54 |(% style="width:69px" %)LG308|(% style="width:75px" %)Openwrt|(% style="width:130px" %)GPIO28(RED)|(% style="width:93px" %)+3.3v|(% style="width:95px" %)GPIO13(RED) |(% style="width:119px" %)GPIO17(RED)|(% style="width:111px" %)GPIO0(RED)| |(% style="width:133px" %)GPIO15 |(% style="width:134px" %)GPIO1
55 |(% style="width:69px" %)DLOS8|(% style="width:75px" %)Openwrt|(% style="width:130px" %)GPIO28(GREEN)|(% style="width:93px" %)+3.3v|(% style="width:95px" %) |(% style="width:119px" %)GPIO17(GREEN)|(% style="width:111px" %)GPIO0(GREEN)| |(% style="width:133px" %)GPIO15 |(% style="width:134px" %)GPIO1
56 |(% style="width:69px" %)(((
57 HP0C
58
59 LPS8V2
60 )))|(% style="width:75px" %)Armbian|(% style="width:130px" %)(((
Xiaoling 15.2 61 PA8(GREEN),
Xiaoling 14.2 62
Xiaoling 15.2 63 PA9(RED(% style="background-color:transparent" %))
Xiaoling 15.5 64 )))|(% style="width:93px" %)+3.3v|(% style="width:95px" %)(((
Xiaoling 15.2 65 EPHY-LINK-LED(GREEN),
Xiaoling 14.2 66
Xiaoling 15.2 67 PA17(BLUE)
Xiaoling 15.3 68 )))|(% style="width:119px" %) |(% style="width:111px" %)(((
Xiaoling 15.2 69
Xiaoling 14.2 70
Xiaoling 15.2 71 PA7(RED(% style="background-color:transparent" %))
Edwin Chen 17.1 72 )))| |(% style="width:133px" %) |(% style="width:134px" %)
73 |(% style="width:69px" %)HP0A|(% style="width:75px" %)Armbian|(% style="width:130px" %)PA8(GREEN)|(% style="width:93px" %)+3.3v|(% style="width:95px" %)EPHY-LINK-LED|(% style="width:119px" %)PA9(RED)|(% style="width:111px" %)PA7(RED)| |(% style="width:133px" %)PA17|(% style="width:134px" %)
74 |(% style="width:69px" %)IBB|(% style="width:75px" %)Openwrt|(% style="width:130px" %)GPIO28(GREEN)|(% style="width:93px" %)+3.3v|(% style="width:95px" %)GPIO13(GREEN)|(% style="width:119px" %)GPIO17(GREEN)|(% style="width:111px" %)GPIO0(GREEN)|SENSOR_LED|(% style="width:133px" %) |(% style="width:134px" %)GPIO1
75 |(% style="width:69px" %)LIG16|(% style="width:75px" %)Openwrt|(% style="width:130px" %)GPIO28(RED)|(% style="width:93px" %)+3.3v|(% style="width:95px" %)GPIO22(GREEN)|(% style="width:119px" %)GPIO17(GREEN)|(% style="width:111px" %)GPIO0(GREEN)|GPIO21(GREEN)|(% style="width:133px" %) |(% style="width:134px" %)
76 |(% style="width:69px" %)MS14N|(% style="width:75px" %)Openwrt|(% style="width:130px" %)GPIO28(GREEN)|(% style="width:93px" %)+3.3v|(% style="width:95px" %)GPIO13(GREEN)|(% style="width:119px" %)GPIO17(GREEN)|(% style="width:111px" %)GPIO0(GREEN)|SENSOR_LED|(% style="width:133px" %) |(% style="width:134px" %)GPIO1
Xiaoling 15.2 77
Edwin Chen 1.2 78 = Control LEDs & GPIOs =
Edwin Chen 1.1 79
Edwin Chen 1.2 80 == OpenWrt Base OS ==
Edwin Chen 1.1 81
Edwin Chen 6.1 82 (% class="box infomessage" id="HControlanGeneralGPIO:" %)
83 (((
Edwin Chen 8.1 84 **Control a General GPIO:**
Edwin Chen 1.1 85
Edwin Chen 1.2 86 **echo 18 > /sys/class/gpio/export**     ~/~/ Export gpio 18 so we can use it
87 **echo "high" > /sys/class/gpio/gpio18/direction**   ~/~/  Set direction to out and
88 set level to high. Use "low" to set direction to output and level to low
89
90 **echo 0 > /sys/class/gpio/gpio18/value**    ~/~/ Set output to 0 or 1
91 **echo "in" > /sys/class/gpio/gpio18/direction**  ~/~/ Set GPIO18 as input
92
93 **cat  /sys/class/gpio/gpio18/value**  ~/~/ Get GPIO18 value if set input
94 )))
95
Edwin Chen 9.1 96 (% class="box infomessage" %)
97 (((
98 **Control a GPIO already exported as SYSTEM LEDs .**
99 **echo 1 > /sys/class/leds/dragino2\:red\:system/brightness**  ~/~/ Turn On LED dragino2:red:system
100 **echo 0 > /sys/class/leds/dragino2\:red\:system/brightness**  ~/~/ Turn off LED dragino2:red:system
101 )))
102
103
Edwin Chen 3.1 104 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]]