Wiki source code of Control Gateway GPIOs & LEDs

Version 16.1 by Xiaoling on 2022/05/09 14:13

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