| 1 | // Push the Reaper root layout to the physical keypad as one atomic panel write |
| 2 | // and exit (faces persist on the device). Validates the panel image protocol. |
| 3 | import { Keypad } from "../src/Keypad.ts"; |
| 4 | import { composePanel, type Face } from "../src/KeypadUI.ts"; |
| 5 | import { blank, lucide, txt } from "../src/icons.ts"; |
| 6 | |
| 7 | const keypad = await Keypad.open(); |
| 8 | if (!keypad.connected) { |
| 9 | console.error("Keypad not connected."); |
| 10 | process.exit(1); |
| 11 | } |
| 12 | |
| 13 | keypad.setBrightness(0.85); |
| 14 | |
| 15 | // Faces in grid order: up-left, up, up-right, left, center, right, down-*. |
| 16 | const faces: Face[] = [ |
| 17 | lucide("AlarmClock"), |
| 18 | lucide("Clock"), |
| 19 | txt("BPM"), |
| 20 | lucide("Plus"), |
| 21 | blank, |
| 22 | blank, |
| 23 | lucide("Disc").fg("red"), |
| 24 | blank, |
| 25 | lucide("Play"), |
| 26 | ]; |
| 27 | |
| 28 | keypad.setPanel(await composePanel(faces)); |
| 29 | console.info("Pushed the panel to the keypad — look at the device."); |
| 30 | process.exit(0); |