devterm.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef DEVTERM_H
  2. #define DEVTERM_H
  3. #define KEY_LATENCY 1400
  4. #include "state.h"
  5. #include <USBComposite.h>
  6. typedef struct key_debouncing{
  7. bool deing;//debouncing
  8. uint16_t de_time;
  9. }KEY_DEB;
  10. typedef struct keyboard_lock{
  11. uint16_t lock;//
  12. uint16_t time;//
  13. uint16_t begin;//
  14. }KEYBOARD_LOCK;
  15. typedef struct keyboard_state{
  16. uint8_t layer;
  17. uint8_t prev_layer;
  18. uint8_t fn_on;
  19. uint8_t sf_on;//shift on
  20. uint8_t backlight;//0 1 2 3
  21. uint8_t lock;//0 1
  22. KEYBOARD_LOCK ctrl;
  23. KEYBOARD_LOCK shift;
  24. KEYBOARD_LOCK alt;
  25. KEYBOARD_LOCK fn;
  26. }KEYBOARD_STATE;
  27. class DEVTERM {
  28. public:
  29. HIDKeyboard *Keyboard;
  30. HIDMouse *Mouse;
  31. HIDJoystick *Joystick;
  32. HIDConsumer *Consumer;
  33. KEYBOARD_STATE Keyboard_state;
  34. USBCompositeSerial *_Serial;
  35. //if not to use USBCompositeSerial,then use default Serial
  36. //**Serial and USBCompositeSerial can not use together, otherwise the keyboard firmware uploading will be dead**
  37. //and you will need to find a way out to flash the stm32duino bootloader once again
  38. //USBSerial *_Serial;//_Serial = &Serial;
  39. State *state;
  40. uint32_t delta;
  41. };
  42. #define KEYBOARD_PULL 0 // 1 for PULLUP, 0 FOR PULLDOWN
  43. #define KEYBOARD_LED_PWM_PERIOD 200
  44. #endif