Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.cpp 663B

123456789101112131415161718192021222324252627282930313233
  1. #include "mbed.h"
  2. #include "action.h"
  3. #include "keycode.h"
  4. #include "host.h"
  5. #include "mbed_driver.h"
  6. // Button and LEDs of LPC11U35 board
  7. DigitalIn isp(P0_1); // ISP button
  8. DigitalOut led_red(P0_20);
  9. DigitalOut led_green(P0_21);
  10. int main(void) {
  11. isp.mode(PullUp);
  12. led_red = 1;
  13. led_green = 0;
  14. host_set_driver(&mbed_driver);
  15. bool last_isp = isp;
  16. while (1) {
  17. if (last_isp == isp) continue;
  18. last_isp = isp;
  19. if (last_isp == 0) {
  20. led_red = 0; // on
  21. register_code(KC_A);
  22. } else {
  23. led_red = 1; // off
  24. unregister_code(KC_A);
  25. }
  26. }
  27. }