Wiki source code of Control Gateway GPIOs & LEDs

Version 21.1 by Xiaoling on 2022/07/14 11:48

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