diff options
author | tmk <nobody@nowhere> | 2012-04-28 01:57:36 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2012-04-28 01:57:36 +0900 |
commit | 12f6e9ffa76f685f7256bf1421f918f90c93add1 (patch) | |
tree | a4f81dff6ea8450a4f482e06a957056e74d93734 /m0110.h | |
parent | 0a4fa89548e8c098c65c289865ebbf1e1c29adf4 (diff) |
Added M0110A support contributed by skagon@github.
- README is written with markdown notation.
- m0110.c can handles Arrow keys and Calc keys of M0110A.
- EXTRAFLAGS and EXTRALDFLAGS are added in rules.mk to give flags on make command line.
Diffstat (limited to 'm0110.h')
-rw-r--r-- | m0110.h | 42 |
1 files changed, 30 insertions, 12 deletions
@@ -54,23 +54,39 @@ POSSIBILITY OF SUCH DAMAGE. # error "M0110 data port setting is required in config.h" #endif -#define M0110_INQUIRY 0x10 -#define M0110_INSTANT 0x14 -#define M0110_MODEL 0x16 -#define M0110_TEST 0x36 - -#define M0110_PAD 0x79 -#define M0110_NULL 0x7B -#define M0110_TEST_ACK 0x7D -#define M0110_TEST_NAK 0x77 - +/* Commands */ +#define M0110_INQUIRY 0x10 +#define M0110_INSTANT 0x14 +#define M0110_MODEL 0x16 +#define M0110_TEST 0x36 + +/* Response(raw byte from M0110) */ +#define M0110_NULL 0x7B +#define M0110_KEYPAD 0x79 +#define M0110_TEST_ACK 0x7D +#define M0110_TEST_NAK 0x77 +#define M0110_SHIFT_MAKE 0x71 +#define M0110_SHIFT_BREAK 0xF1 +#define M0110_ARROW_UP 0x1B +#define M0110_ARROW_DOWN 0x11 +#define M0110_ARROW_LEFT 0x0D +#define M0110_ARROW_RIGHT 0x05 + +/* This inidcates no response. */ +#define M0110_ERROR 0xFF /* scan code offset for keypad and arrow keys */ #define M0110_KEYPAD_OFFSET 0x40 -#define M0110_ARROW_OFFSET 0x60 +#define M0110_CALC_OFFSET 0x60 /* convert key event raw response into scan code */ -#define M0110_RAW2SCAN(key) ((key&(1<<7)) | ((key&0x7F)>>1)) +#define M0110_RAW2SCAN(key) ( \ + (key == M0110_NULL) ? M0110_NULL : ( \ + (key == M0110_ERROR) ? M0110_ERROR : ( \ + ((key&0x80) | ((key&0x7F)>>1)) \ + ) \ + ) \ +) extern uint8_t m0110_error; @@ -80,5 +96,7 @@ void m0110_init(void); uint8_t m0110_send(uint8_t data); uint8_t m0110_recv(void); uint8_t m0110_recv_key(void); +uint8_t m0110_inquiry(void); +uint8_t m0110_instant(void); #endif |