Changes for page Front I/O

Last modified by Kevin Wiki on 2024/07/07 22:48

From version 7.3
edited by Kevin Wiki
on 2024/07/05 09:31
Change comment: There is no comment for this version
To version 7.5
edited by Kevin Wiki
on 2024/07/05 10:29
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -194,6 +194,76 @@
194 194  * Power LED P3V3 - 3.30V
195 195  * Power LED - 0.87 V
196 196  
197 += Controlling top I/O LED =
198 +
199 +On the top row we have the following input/output devices in order from left to right;
200 +
201 +Left side:
202 +
203 +* physical lock
204 +* lock LED
205 +* warning/service button
206 +* warning/service LED
207 +* locate button
208 +* power LED (red & green)
209 +* fan LED (red & green)
210 +* temperature LED (red & green)
211 +* compute LED (unknown)
212 +
213 +Right side:
214 +
215 +* power LED (red & green)
216 +* fan LED (red & green)
217 +* temperature LED (red & green)
218 +* compute LED (unknown)
219 +* lock switch
220 +
221 +Each sides bank of LEDs are driven by each their PCA9554 shift register. The registers represent the following LEDs: (Note that Lock LED is only present for the LEFT side)
222 +
223 +|=(% scope="row" %)Register|1|2|3|4|5|6|7
224 +|=Device|Power LED Green|Power LED Red|Fan LED Green|Fan LED Red|Temperature LED Green|Temperature LED Red|Lock LED
225 +
226 +To control each LED we shift either a 0 to turn off or 1 to turn on. Since each device shares a single red/green LED (power LED green & power LED red) setting both to 1 at the same time will always leave it red. That is when power LED green and power LED red are both enabled, red always takes precedence.
227 +
228 +Use following script to power LEDs one at a time:
229 +
230 +{{code language="c++"}}
231 +#include <PCA9554.h> // Load the PCA9554 Library
232 +
233 +PCA9554 ioCon1(0x24); // Create an object at this address
234 +
235 +uint8_t mapIO = 0b10000000;
236 +
237 +void shiftL() {
238 + mapIO = (mapIO << 1) | ((mapIO & 0x80) >> 7);
239 +}
240 +
241 +void write() {
242 + Serial.println("writing to PCA9554 device");
243 +
244 + for (int i = 0; i < 8; ++i) {
245 + ioCon1.digitalWrite(i, (mapIO & (1 << i)) ? 0 : 1);
246 + }
247 +}
248 +
249 +void setup()
250 +{
251 + Serial.begin(9600);
252 + Serial.println("Setup");
253 +
254 + ioCon1.portMode(ALLOUTPUT);
255 +}
256 +
257 +void loop()
258 +{
259 + write();
260 + shiftL();
261 +
262 + delay(500);
263 +}
264 +{{/code}}
265 +
266 +
197 197  
198 198  )))
199 199