Wiki source code of Control Gateway GPIOs & LEDs
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
5 | = Products LEDs Mapping = | ||
6 | |||
7 | {{velocity}} | ||
8 | $xwiki.ssfx.use("js/xwiki/table/table.css") | ||
9 | $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true) | ||
10 | {{/velocity}} | ||
11 | |||
12 | (% class="doOddEven filterable grid sortable" id="tableid" %) | ||
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 | ||
14 | |**LPS8**|((( | ||
15 | GPIO28(BLUE), | ||
16 | |||
17 | GPIO21(RED), | ||
18 | |||
19 | GPIO22(GREEN(% style="background-color:transparent" %)) | ||
20 | )))|(% style="width:66px" %)((( | ||
21 | |||
22 | |||
23 | +3.3v | ||
24 | )))|(% style="width:80px" %) |GPIO17(RED)| | | | | ||
25 | |**LPS8N**|((( | ||
26 | GPIO28(BLUE), | ||
27 | |||
28 | GPIO21(RED), | ||
29 | |||
30 | GPIO22(GREEN(% style="background-color:transparent" %)) | ||
31 | )))|(% style="width:66px" %)((( | ||
32 | |||
33 | |||
34 | +3.3v | ||
35 | )))|(% style="width:80px" %) |GPIO17(RED)|((( | ||
36 | GPIO16(BLUE), | ||
37 | |||
38 | GPIO26(RED), | ||
39 | |||
40 | GPIO27(GREEN(% style="background-color:transparent" %)) | ||
41 | )))| |((( | ||
42 | |||
43 | |||
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), | ||
50 | |||
51 | PA9(RED(% style="background-color:transparent" %)) | ||
52 | )))|(% style="width:66px" %)+3.3v|(% style="width:80px" %)((( | ||
53 | EPHY-LINK-LED(GREEN), | ||
54 | |||
55 | PA17(BLUE) | ||
56 | )))| |((( | ||
57 | |||
58 | |||
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 | |||
68 | = Control LEDs & GPIOs = | ||
69 | |||
70 | == OpenWrt Base OS == | ||
71 | |||
72 | (% class="box infomessage" id="HControlanGeneralGPIO:" %) | ||
73 | ((( | ||
74 | **Control a General GPIO:** | ||
75 | |||
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 | |||
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 | |||
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]] |