Wiki source code of Control Gateway GPIOs & LEDs
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{box cssClass="floatinginfobox" title="**Contents**"}} |
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
![]() |
12.1 | 5 | = Products LEDs Mapping = |
![]() |
11.1 | 6 | |
7 | {{velocity}} | ||
![]() |
10.1 | 8 | $xwiki.ssfx.use("js/xwiki/table/table.css") |
9 | $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true) | ||
10 | {{/velocity}} | ||
![]() |
1.1 | 11 | |
![]() |
10.1 | 12 | (% class="doOddEven filterable grid sortable" id="tableid" %) |
![]() |
14.2 | 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), | ||
![]() |
1.1 | 16 | |
![]() |
14.2 | 17 | GPIO21(RED), |
18 | |||
19 | GPIO22(GREEN) | ||
20 | )))|(% style="width:66px" %)((( | ||
21 | |||
22 | |||
23 | +3.3v | ||
24 | |||
25 | |||
26 | )))|(% style="width:80px" %) |GPIO17(RED)| | | | | ||
27 | |LPS8N|((( | ||
28 | GPIO28(BLUE), | ||
29 | |||
30 | GPIO21(RED), | ||
31 | |||
32 | GPIO22(GREEN) | ||
33 | )))|(% style="width:66px" %)((( | ||
34 | |||
35 | |||
36 | +3.3v | ||
37 | )))|(% style="width:80px" %) |GPIO17(RED)|((( | ||
38 | GPIO16(BLUE), | ||
39 | |||
40 | GPIO26(RED), | ||
41 | |||
42 | GPIO27(GREEN) | ||
43 | )))| |GPIO15| | ||
44 | |LG308|GPIO28(RED)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO13(RED) |GPIO17(RED)| GPIO0(RED)| |GPIO15 |GPIO1 | ||
45 | |DLOS8|GPIO28(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %) |GPIO17(GREEN)| GPIO0(GREEN)| |GPIO15 |GPIO1 | ||
46 | |HP0C|PA8(GREEN),PA9(RED)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)EPHY-LINK-LED(GREEN),PA17(BLUE)| |PA7(RED)| | | | ||
47 | |HP0A|PA8(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)EPHY-LINK-LED|PA9(RED)|PA7(RED)| |PA17| | ||
48 | |IBB|GPIO28(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO13(GREEN)|GPIO17(GREEN)|GPIO0(GREEN)|SENSOR_LED| |GPIO1 | ||
49 | |LIG16|GPIO28(RED)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO22(GREEN)|GPIO17(GREEN)|GPIO0(GREEN)|GPIO21(GREEN)| | | ||
50 | |MS14N|GPIO28(GREEN)|(% style="width:66px" %)+3.3v|(% style="width:80px" %)GPIO13(GREEN)|GPIO17(GREEN)|GPIO0(GREEN)|SENSOR_LED| |GPIO1 | ||
51 | |||
52 | |||
53 | |||
54 | |||
55 | |||
![]() |
1.2 | 56 | = Control LEDs & GPIOs = |
![]() |
1.1 | 57 | |
![]() |
1.2 | 58 | == OpenWrt Base OS == |
![]() |
1.1 | 59 | |
![]() |
6.1 | 60 | (% class="box infomessage" id="HControlanGeneralGPIO:" %) |
61 | ((( | ||
![]() |
8.1 | 62 | **Control a General GPIO:** |
![]() |
1.1 | 63 | |
![]() |
1.2 | 64 | **echo 18 > /sys/class/gpio/export** ~/~/ Export gpio 18 so we can use it |
65 | **echo "high" > /sys/class/gpio/gpio18/direction** ~/~/ Set direction to out and | ||
66 | set level to high. Use "low" to set direction to output and level to low | ||
67 | |||
68 | **echo 0 > /sys/class/gpio/gpio18/value** ~/~/ Set output to 0 or 1 | ||
69 | **echo "in" > /sys/class/gpio/gpio18/direction** ~/~/ Set GPIO18 as input | ||
70 | |||
71 | **cat /sys/class/gpio/gpio18/value** ~/~/ Get GPIO18 value if set input | ||
72 | ))) | ||
73 | |||
![]() |
9.1 | 74 | (% class="box infomessage" %) |
75 | ((( | ||
76 | **Control a GPIO already exported as SYSTEM LEDs .** | ||
77 | **echo 1 > /sys/class/leds/dragino2\:red\:system/brightness** ~/~/ Turn On LED dragino2:red:system | ||
78 | **echo 0 > /sys/class/leds/dragino2\:red\:system/brightness** ~/~/ Turn off LED dragino2:red:system | ||
79 | ))) | ||
80 | |||
81 | |||
![]() |
3.1 | 82 | 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]] |