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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

main.cpp 951B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "mbed.h"
  2. #include "debug.h"
  3. #include "timer.h"
  4. #include "action.h"
  5. #include "keycode.h"
  6. #include "host.h"
  7. #include "host_driver.h"
  8. #include "mbed_driver.h"
  9. // Button and LEDs of LPC11U35 board
  10. DigitalIn isp(P0_1); // ISP button
  11. DigitalOut led_red(P0_20);
  12. DigitalOut led_green(P0_21);
  13. int main(void) {
  14. isp.mode(PullUp);
  15. led_red = 1;
  16. led_green = 0;
  17. timer_init();
  18. host_set_driver(&mbed_driver);
  19. keyboard_init();
  20. //debug_enable = true;
  21. xprintf("mbed_onekey ver.eee:\r\n");
  22. bool last_isp = isp;
  23. while (1) {
  24. keyboard_task();
  25. //led_green = !led_green;
  26. if (last_isp == isp) continue;
  27. last_isp = isp;
  28. if (last_isp == 0) {
  29. led_red = 0; // on
  30. dprintf("timer: %i\r\n", timer_read());
  31. //register_code(KC_A);
  32. } else {
  33. led_red = 1; // off
  34. //unregister_code(KC_A);
  35. }
  36. }
  37. }