From 6544acff8d08ffc452f3a41ef960bbfd92778854 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 12 Feb 2011 13:03:30 +0000 Subject: [PATCH] hostside: hidrawconv: declarations for hatswitches; impl'n is still no-op --- hostside/hidrawconv.c | 4 ++++ hostside/hidrawconv.h | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/hostside/hidrawconv.c b/hostside/hidrawconv.c index 622e2ce..bbb1edc 100644 --- a/hostside/hidrawconv.c +++ b/hostside/hidrawconv.c @@ -76,6 +76,10 @@ DEFINE_STANDARD_REPORTER(ValLoc, val, { printf("%s %.5f\n", val->str, val->sign * v); }) +DEFINE_STANDARD_REPORTER(HatLoc, hat, { + /* nyi */ + }) + /*---------- core functions ----------*/ diff --git a/hostside/hidrawconv.h b/hostside/hidrawconv.h index cc2c4ec..4fb2465 100644 --- a/hostside/hidrawconv.h +++ b/hostside/hidrawconv.h @@ -52,4 +52,20 @@ void reportvals(const uint8_t msg[], const uint8_t last[], int len, const ValLoc vallocs[]); +/*----- "hats", ie hatswitches -----*/ + +typedef struct { + int x, y; +} HatPosn; + +typedef struct { + const char *str; /* base; reporter will append "X" and "Y" to this */ + int pos, rshift, max; /* mask is applied before rshift */ + uint8_t mask; + const HatPosn *posns; +} HatLoc; + +void reporthats(const uint8_t msg[], const uint8_t last[], + int len, const HatLoc hatlocs[]); + #endif /*HIDRAWCONV_H*/ -- 2.30.2