romu-secure-key-hid.ino
Uses the Romu as a USB keyboard that automatically types a string when the button is pressed.
Use the Arduino core for RP2350/2354. The Keyboard library is included. Modify the button GPIO. Upload. Plug the Romu into a PC with a text field open. Press the button to see the typing. Ideal for local authentication macros.
romu-secure-key-hid.ino
// Exemple Arduino pour Romu - Clé de sécurité HID (Clavier)
// Note : Ceci est une démonstration pédagogique. Ne pas utiliser pour des secrets sensibles
// sans chiffrement matériel approprié (TrustZone).
#include <Keyboard.h>
const int BUTTON_PIN = 23; // À adapter au GPIO réel du bouton Romu
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
Keyboard.begin();
delay(5000); // Délai pour laisser le temps au PC de reconnaître le périphérique
}
void loop() {
if (digitalRead(BUTTON_PIN) == LOW) {
// Simule la frappe d'une chaîne de caractères
// Exemple : "MonSecret123\n"
Keyboard.print("MonSecret123");
Keyboard.write(KEY_RETURN);
// Délai pour éviter les frappes multiples
delay(2000);
// Attente que le bouton soit relâché
while(digitalRead(BUTTON_PIN) == LOW);
delay(500);
}
}