chiark / gitweb /
9e34f780997fed5f3e684d79ddec8a45a6bcbcdf
[trains.git] / hostside / hidrawconv.h
1 #ifndef HIDRAWCONV_H
2 #define HIDRAWCONV_H
3
4 #include <stdio.h>
5 #include <stdint.h>
6
7 #include "common.h"
8
9 #define MAXREPORTLEN 256
10 #define MAXREPORTS 256
11
12 typedef void ProcessReport(uint8_t msg[MAXREPORTLEN], int msglen,
13                            const uint8_t last[MAXREPORTLEN]);
14
15 extern const char *const descriptor;
16 extern ProcessReport *const report_processors[MAXREPORTS];
17
18 typedef struct {
19   const char *str;
20   int pos;
21   uint8_t mask;
22 } KeyBit;
23
24 typedef struct {
25   const char *str;
26   int pos, rshift, sign; /* mask is applied before rshift */
27   uint8_t mask, zero;
28 } ValLoc;
29
30 void reportbits(const uint8_t msg[], const uint8_t last[],
31                 int len, const KeyBit bits[]);
32
33 void reportlocs(const uint8_t msg[], const uint8_t last[],
34                 int len, const ValLoc locs[]);
35
36 #endif /*HIDRAWCONV_H*/