keycontrol.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef KEYCONTROL_LEGACY_H
  2. #define KEYCONTROL_LEGACY_H
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. typedef uint16_t tKeySwitchStateLegacy_t;
  6. typedef uint32_t tKeySwitchState_t;
  7. typedef uint32_t tKeySwitchCode_t;
  8. typedef struct
  9. {
  10. bool ( * Init)();
  11. bool ( * SetKeyState)( tKeySwitchState_t state );
  12. bool ( * GetKeyState)( tKeySwitchState_t * pstate );
  13. bool ( * GetKeyCode) ( tKeySwitchCode_t * pcode );
  14. void ( * DeInit)();
  15. }
  16. sKeySwitchControl_t;
  17. #define KEYSWITCH_LEGACYSTATE_2_STATE(ls) ((tKeySwitchState_t)(ls))
  18. #define KEYSWITCH_STATE_2_LEGACYSTATE(s) ((tKeySwitchStateLegacy_t)(s))
  19. #define KEYCONTROL_STATE_INVALID 0x00000000 //
  20. #define KEYCONTROL_STATE_SHORTALL 0x00000009 // 9 Short All
  21. #define KEYCONTROL_STATE_OPENALL 0x00000012 // 18 Open All
  22. #define KEYCONTROL_STATE_LOADALL 0x00000024 // 36 Load All
  23. #define KEYCONTROL_STATE_THRUAB 0x00000040 // 64 Thru A-B
  24. #define KEYCONTROL_STATE_LDASHALL 0x0000000C // 12 Load A, Short ALL
  25. #define KEYCONTROL_STATE_LDBSHALL 0x00000021 // 33 Load B, Short ALL
  26. #define KEYCONTROL_STATE_CHECK 0x00000080 // 128 Check State
  27. #define KEYCONTROL_STATE_DEFAULT KEYCONTROL_STATE_LOADALL
  28. extern const sKeySwitchControl_t KeySwitchHandle;
  29. #endif