Design Log DEC 087 cypher input led colour architecture moved off plain bits onto local rgb select circuit - thepinkmile/Enigma-NG GitHub Wiki

DEC-087 - Cypher-Input LED Colour Architecture Moved Off plain-bits, Onto a Local RGB Colour-Select Circuit

Field Value
Decision ID DEC-087
Status Decided
Date 2026-08-14
Author Izzyonstage & GitHub Copilot
Amends Cypher-Input Design_Spec.md §1, §3, §3a, §5, §6, §7, §9, §11; Board_Layout.md §1, §4; all three variant files (Cypher_Input_26_Char_Design.md, Cypher_Input_64_Char_Design.md, Cypher_Input_10_Numeric_Design.md) §3-§6; Cypher/Board_Layout.md §4 (retires GREEN_PWM_N/YELLOW_PWM_N); Encoder_Module/Board_Layout.md §1a usage note; supersedes the LED drive design introduced in the 2026-08-06/08-09 sessions

Context

The original Cypher-Input LED indicator design piggybacked 2 spare plain-bits positions per variant (YELLOW_DRIVE_N/GREEN_DRIVE_N, at a different PB[] index on each variant depending on key count) to carry LED colour-select signals generated by the ENC module's CPLD. Brightness was fed into the CPLD's GCLK0 pin via a 555 astable oscillator (RV1 dial), and the resulting brightness/colour state was broadcast to the future Cypher-Output board via GREEN_PWM_N/ YELLOW_PWM_N on the shared JTAG chain-through connector pair (J5/J7).

A design review identified three problems with this approach:

  1. plain-bits should be a pure keyswitch bus. Reserving 2 of the 64 lines for LED signals permanently costs headroom that a future variant might want to use for one signal per character (e.g. a hypothetical 64-key variant using all 64 lines directly).
  2. LED colour selection is not a cipher-path concern. It has no reason to route through the ENC module's CPLD or its plain-bits/cypher-bits connectors at all - the LED bank, its current-limit resistors, and its drive MOSFETs are entirely local to the carrier board (Cypher- Input/future Cypher-Output), never touching the ENC module physically.
  3. Only Yellow/Green was ever supported, with no path to a real RGB LED or software-selectable colour without another hardware redesign.

Decision

  1. LED colour selection is now generated entirely on the Cypher-Input board, never via the ENC module or its plain-bits bus. All 64 plain-bits positions are freed for cipher-path keyswitch use on every variant.
  2. Colour is software-configurable via the existing I2C GPIO expander (U4, PCA9534A), not CPLD firmware:
    • 64-Char Extended variant (the only variant with a Shift key): U4 drives two independent 3-bit RGB codes ("Colour A" = non-shifted, "Colour B" = shifted). A local hardware mux (U9, 74HC157PW-Q100,118 - reusing the same part already used as the Cypher Board's U4/U5 keyboard-source mux) switches between them in real time, selected by a local, hardware-only Shift-key sense signal (SHIFT_ACTIVE_N) - a diode-OR (D9, BAT54C) of both Shift key switch nodes (tapped in parallel with their existing plain-bits connections), pulled up via R9 (10 kOhm). This keeps real-time colour switching fast and independent of firmware/I2C write latency, while colour definition remains software-configurable.
    • 26-Char Classic and 10-Numeric variants (no Shift key): U4 drives a single software-configured 3-bit RGB code directly - no mux, no Shift-sense network populated.
  3. Brightness (RV1 dial) moves to the LED bank's termination, not the ENC module's GCLK0. The 555 astable oscillator's PWM output now gates U8 (BSS138, N-channel MOSFET - same family as the User Settings Module's colour-rail sink stage, DEC-034), a shared low-side switch common to every LED's cathode return, placed downstream of all colour selection. RV1/U1/U8 exist only on Cypher-Input - one physical dial dims every LED on both this board and the future Cypher-Output board.
  4. Final colour (RED_DRIVE_N/GREEN_DRIVE_N/BLUE_DRIVE_N) and brightness (BRIGHTNESS_PWM_EN) are broadcast to the future Cypher-Output board via the left connector pair (J4/J6), not the JTAG chain-through pair. GREEN_PWM_N/YELLOW_PWM_N (previously on J5/J7 pins 30/32) are retired - those pins are now unused/GND pending merge-create-plugboard/merge-cypher-board-j3j6-pinouts. Cypher-Output will need no local colour-select mux, Shift-sense network, or 555 oscillator of its own - only the same 3 colour-bank MOSFETs plus 1 cathode-return MOSFET, driven by the incoming broadcast signals.
  5. LED part becomes an explicit placeholder. The previous Kingbright APFA2507Y2G2C-C2 bicolour part is retired in favour of a TBD RGB SMD LED, since every variant now supports software-configurable colour rather than fixed Yellow/Green. The user will confirm a specific part once footprint compatibility with the Cherry MX2A-71NB keyswitch cutout is verified - this is explicitly not sourced by the agent (per the established sourcing-responsibility convention). Current-limit resistor values are placeholders pending that part.

Rationale

  • Keeping plain-bits as a pure keyswitch bus preserves maximum flexibility for future variants and avoids baking a variant-dependent "spare pin" assumption into the ENC module interface.
  • LED colour/brightness is architecturally a carrier-board-local concern; routing it through the ENC module's CPLD added an unnecessary dependency with no benefit, and prevented true per-instance software configurability.
  • Reusing already-approved part families (74HC157 mux, BSS138-class sink switch, BAT54-class diode) keeps the new circuit consistent with existing project precedent rather than introducing unrelated component families.
  • Centralising colour/brightness generation on Cypher-Input and broadcasting the result avoids duplicating the mux/Shift-sense/oscillator circuitry on Cypher-Output, which has no Shift key or brightness dial of its own.

Impact

  • design/Electronics/Cypher-Input/Design_Spec.md - §1 (role table), FR/DR tables (FR-CYPI-01/03/ 04, DR-CYPI-06 through 09 rewritten, DR-CYPI-09a/09b/11a added), block diagram, §3/§3a (plain- bits/I2C GPIO budget), §5 (full LED Indicator Circuit rewrite), §6 (Brightness Control rewrite), §7 (J4/J6 vs J5/J7 signal reallocation), §9 (thermal RefDes update), §11 (BOM: U2/U3 replaced by U5-U9/D9/R9, placeholder LED/resistor rows).
  • design/Electronics/Cypher-Input/Board_Layout.md - §1 (J1 pin table, PB[] usage note), §4 (J4-J7 summary table, J5/J7 pin map retiring pins 30/32, wiring notes).
  • Cypher_Input_26_Char_Design.md, Cypher_Input_64_Char_Design.md, Cypher_Input_10_Numeric_Design.md - §3 (plain-bits tables cleaned up), §4 (GPIO budget notes), §5 (LED behaviour rewritten per-variant), §6 (BOM placeholder rows).
  • design/Electronics/Cypher/Board_Layout.md §4 - retires GREEN_PWM_N/YELLOW_PWM_N (pins 30/32) from the shared HID Interconnect pin template and its wiring note.
  • design/Electronics/Encoder_Module/Board_Layout.md §1a - removed the now-stale "board-specific reuse such as LED drive outputs on Cypher-Input" example from the plain-bits usage note.
  • .copilot/todos/merge-create-cypher-output.md - updated to describe the new broadcast-only LED architecture Cypher-Output will need to implement.