diff options
Diffstat (limited to 'm0110.h')
-rw-r--r-- | m0110.h | 38 |
1 files changed, 23 insertions, 15 deletions
@@ -1,5 +1,5 @@ /* -Copyright 2011 Jun WAKO <wakojun@gmail.com> +Copyright 2011,2012 Jun WAKO <wakojun@gmail.com> This software is licensed with a Modified BSD License. All of this is supposed to be Free Software, Open Source, DFSG-free, @@ -54,23 +54,29 @@ 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 0x71 +#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 - -/* convert key event raw response into scan code */ -#define M0110_RAW2SCAN(key) ((key&(1<<7)) | ((key&0x7F)>>1)) +#define M0110_CALC_OFFSET 0x60 extern uint8_t m0110_error; @@ -80,5 +86,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 |