254bd0968847e634bc8c8fc25f523b36377e982f
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / pintest.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3   <head>
4     <title>MCTX3420 Web Interface</title>
5     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6     <!--[if lte IE 8]>
7       <script language="javascript" type="text/javascript" src="static/excanvas.min.js"></script>
8     <![endif]-->
9     <script type="text/javascript" src="static/jquery-1.10.1.min.js"></script>
10     <script type="text/javascript" src="static/jquery.flot.min.js"></script>
11     <script type="text/javascript" src="static/base64.js"></script>
12     <script type="text/javascript" src="static/mctx.gui.js"></script>
13     <script type="text/javascript" src="static/mctx.pintest.js"></script>
14     
15     <link rel="stylesheet" type="text/css" href="static/style.css">
16     <link rel="stylesheet" type="text/css" href="static/nav-menu.css">
17     <script type="text/javascript">
18       runBeforeLoad().done(function () {
19         //Ensure stuff is unloaded before leaving the page
20         $(window).unload(function(){
21           $("#adc-controls").find("input[type='checkbox']")
22           .each(function () {
23             if ($(this).is(":checked")) {
24               $(this).trigger("click");
25             }
26           });
27           $("#gpio-container").find("input[name='unexport']")
28           .each(function () {
29             $(this).trigger("click");
30           });
31           $("#pwm-container").find("input[name='unexport']")
32           .each(function () {
33             $(this).trigger("click");
34           });
35         });
36         
37         $(document).ready(function () {
38          //Set the welcome bar
39          var name = " " + (mctx.friendlyName ? mctx.friendlyName : "");
40          $("#welcome-container").text("Welcome"+ name + "!");
41          $("#content").css("display", "block");
42
43          $("#logout").click(function () {
44            $("#logout").logout();
45          });
46
47          $("#gpio-menu").populateDropdown(mctx.pintest.gpios, "GPIO ");
48          $("#pwm-menu").populateDropdown(mctx.pintest.pwms, "PWM ");
49
50          $("#gpio-go").click(function () {
51            if ($("#gpio-menu").val()) {
52              $(this).attr("disabled", true);
53              $("#gpio-container").exportGPIO($("#gpio-menu")).always(function () {
54                $("#gpio-go").attr("disabled", false);
55              });
56            }
57          });
58          $("#pwm-go").click(function () {
59            if ($("#pwm-menu").val()) {
60              $(this).attr("disabled", true);
61              $("#pwm-container").exportPWM($("#pwm-menu")).always(function () {
62                $("#pwm-go").attr("disabled", false);
63              });
64            }
65          });
66          $("#adc-controls").trigger("reset").setADCControl();
67
68          $("#errorlog").setErrorLog();
69        });
70       })
71
72     </script>
73   </head>
74   
75   <body>
76     <div id="header">
77       <div id="leftnav">
78         <a href="http://www.uwa.edu.au/" target="_blank">
79           <img alt = "The University of Western Australia"
80           src="static/uwacrest-text.png">
81         </a>
82         <span id="title">BBB Pin test (debug only)</span>
83       </div>
84       <div id="rightnav">
85         <div id="menu-container" class="nav-menu">
86         </div>
87         <span id="welcome-container">
88         </span>
89         <span id="date">
90           <script type="text/javascript">getDate();</script>
91         </span>
92         <div id="logout-container">
93           <form action="#">
94             <div>
95               <input type="button" id="logout" value="Logout">
96             </div>
97           </form>
98         </div>
99       </div>
100       <div class="clear"></div>
101     </div>
102     <!-- End header -->
103     
104     <div id="content">
105       <div id="sidebar">
106         <div class="widget">
107           <div class="title">Info</div>
108           <p>This test page gives control over the BBB's pins.
109           Select a pin that you wish to use from the relevant drop-down
110           menu and click 'Go'.</p>
111           <p>A new widget will appear with controls relevant to that pin.</p>
112           <p>Make sure to check the error log to see if something goes wrong.</p>
113         </div>
114         <div class="widget">
115           <div class="title">Pin out diagram</div>
116           <p>To see the pin out diagram of the BBB, click <a href="pinout-table.pdf" target="_blank">here</a>.</p>
117         </div>
118         <div class="widget">
119           <div class="title">Export/Unexport?</div>
120           <p>
121             To export/unexport a pin means to enable/disable it. Apart from the obvious
122             use case, sometimes this can be required if you use two PWM channels
123             that share the same frequency base.
124           </p>
125           <p>
126             You won't be able to change
127             the frequency until you unexport one of them.
128           </p>
129         </div>
130         <div class="widget">
131           <div class="title">PWM explained</div>
132           <p>The frequency must be a decimal number greater than 0.</p>
133           <p>
134             The duty cycle describes the proportion of off/on time per period.
135             This number is specified as a ratio, with values ranging from 0 to 1.
136           </p>
137           <p>
138             The polarity determines if the duty represents the 'active
139             high' or 'active low' portion. By default, the duty cycle
140             represents the 'active high' portion.
141           </p>
142         </div>
143       </div>
144       <!-- End sidebar -->
145
146       <div id="main">
147         <div class="widget">
148           <div class="title">Dashboard</div>
149           <table>
150             <tr>
151               <td>
152                 GPIO <select id="gpio-menu"></select>
153                 <input type="button" id="gpio-go" value="Go">
154               </td>
155               <td>
156                 PWM <select id="pwm-menu"></select>
157                 <input type="button" id="pwm-go" value="Go">
158               </td>
159             </tr>
160           </table>
161             
162           <div class="sub-title">Error log</div>
163           <textarea id="errorlog" wrap="off" rows="4" cols="30" readonly></textarea>
164         </div>
165
166         <div class="widget">
167           <div class="title">Analogue input (ADC)</div>
168           <form class="controls" action="#" id="adc-controls">
169             <table class="centre">
170               <tr>
171                 <td>AIN</td><th>0</th><th>1</th><th>2</th><th>3</th>
172                 <th>4</th><th>5</th><th>6</th><th>7</th>
173               </tr>
174               <tr>
175                 <td>Value</td>
176                 <td><input name="0" type="text" readonly></td>
177                 <td><input name="1" type="text" readonly></td>
178                 <td><input name="2" type="text" readonly></td>
179                 <td><input name="3" type="text" readonly></td>
180                 <td><input name="4" type="text" readonly></td>
181                 <td><input name="5" type="text" readonly></td>
182                 <td><input name="6" type="text" readonly></td>
183                 <td><input name="7" type="text" readonly></td>
184               </tr>
185               <tr>
186                 <td>Export</td>
187                 <td><input name="0" type="checkbox"></td>
188                 <td><input name="1" type="checkbox"></td>
189                 <td><input name="2" type="checkbox"></td>
190                 <td><input name="3" type="checkbox"></td>
191                 <td><input name="4" type="checkbox"></td>
192                 <td><input name="5" type="checkbox"></td>
193                 <td><input name="6" type="checkbox"></td>
194                 <td><input name="7" type="checkbox"></td>
195               </tr>
196             </table>
197           </form>
198         </div>
199         
200         <div class="widget" id="gpio-container">
201           <div class="title">GPIO controls</div>
202         </div>
203         
204         <div class="widget" id="pwm-container">
205           <div class="title">PWM controls</div>
206         </div>
207       </div>
208       <!-- End main content -->
209     </div>
210   </body>
211 </html>

UCC git Repository :: git.ucc.asn.au