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" 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" %)((( | ||
15 | GPIO28(BLUE), | ||
16 | |||
17 | GPIO21(RED), | ||
18 | |||
19 | GPIO22(GREEN(% style="background-color:transparent" %)) | ||
20 | )))|(% style="width:93px" %)((( | ||
21 | |||
22 | |||
23 | +3.3v | ||
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" %)((( | ||
26 | GPIO28(BLUE), | ||
27 | |||
28 | GPIO21(RED), | ||
29 | |||
30 | GPIO22(GREEN(% style="background-color:transparent" %)) | ||
31 | )))|(% style="width:93px" %)((( | ||
32 | |||
33 | |||
34 | +3.3v | ||
35 | )))|(% style="width:95px" %) |(% style="width:119px" %)GPIO17(RED)|(% style="width:111px" %)((( | ||
36 | GPIO16(BLUE), | ||
37 | |||
38 | GPIO26(RED), | ||
39 | |||
40 | GPIO27(GREEN(% style="background-color:transparent" %)) | ||
41 | )))| |(% style="width:205px" %)((( | ||
42 | |||
43 | |||
44 | GPIO15 | ||
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" %)((( | ||
49 | PA8(GREEN), | ||
50 | |||
51 | PA9(RED(% style="background-color:transparent" %)) | ||
52 | )))|(% style="width:93px" %)+3.3v|(% style="width:95px" %)((( | ||
53 | EPHY-LINK-LED(GREEN), | ||
54 | |||
55 | PA17(BLUE) | ||
56 | )))|(% style="width:119px" %) |(% style="width:111px" %)((( | ||
57 | |||
58 | |||
59 | PA7(RED(% style="background-color:transparent" %)) | ||
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 | ||
65 | |||
66 | = Control LEDs & GPIOs = | ||
67 | |||
68 | == OpenWrt Base OS == | ||
69 | |||
70 | (% class="box infomessage" id="HControlanGeneralGPIO:" %) | ||
71 | ((( | ||
72 | **Control a General GPIO:** | ||
73 | |||
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 | |||
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 | |||
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]] |