libvcomm  1.0
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
structs.h
Go to the documentation of this file.
1 /** \file
2  * @author Tarmo Kople <tarmo@flycom.ee>
3  * This file contains structure definitions
4  */
5 
6 #ifndef STRUCTS_H_
7 #define STRUCTS_H_
8 
9 //! EventMap size (number of events in EventMap)
10 #define MAX_EVENTS 200
11 //! IRframe length (number of pulses)
12 #define IRFRAME_MAX_LEN 192
13 
14  /**
15  * Request structure
16  */
17 typedef struct __attribute__((__packed__)){
18  //! USB HID report ID (always 0)
19  uint8_t report_id;
20  //! IRvoodoo request type
21  uint8_t type;
22  //! data (max report size 64 - 1 byte type = 63
23  char data[63];
24 } request_t;
25 
26 /**
27  * Response structure
28  */
29 typedef struct __attribute__((__packed__)) {
30 
31  //! IRvoodoo response type ID *
32  uint16_t type;
33  //! data length
34  uint16_t len;
35  //! data buffer max size 32kb
36  char data[32 * 1024];
37 } response_t;
38 
39 /**
40  * IRvoodoo IRcode data structure.\n
41  * The data array may hold:
42  * -# decoded IR data bits
43  * -# USB IN report for keyboard events
44  * -# USB IN report for media key events
45  * -# USB IN report for mouse events
46  */
47 typedef struct __attribute__ ((__packed__)){
48  //! decoded IR data bits or ...
49  uint8_t data[6] ;
50  //! number of bits in use
51  uint8_t numbits;
52  //! detected IR protocol
53  uint8_t protocol;
54 } ircode_t;
55 
56 /**
57  * IRvoodoo IRevent data structure.\n
58  * Used to link together In & Out event (#ircode_t).
59  */
60 typedef struct {
61  //! In IRcode
63  //! Out IRcode
65 } irevent_t;
66 
67 /**
68  * IRvoodoo EventMap data structure.
69  */
70 typedef struct {
71  //! Array of IRevents.
73 } eventmap_t;
74 
75 /**
76  * IRvoodoo IRframe data structure.\n
77  * This structure holds raw captured IR timing data.
78  */
79 typedef struct {
80  /**
81  * Array of IR data pulse lengths in microseconds\n
82  * Odd pulse represents logic 0\n
83  * Even pulse represents logic 1\n
84  */
85  uint32_t length[IRFRAME_MAX_LEN];
86  //! Number of captured pulses
87  uint16_t num_pulses;
88 } irframe_t;
89 
90 /**
91  * IRvoodoo Identification data
92  */
93 typedef struct {
94  //! IRvoodoo mcu type
95  uint32_t pid;
96  //! IRvoodoo unique UUID
97  uint32_t serial[4];
98 } hwid_t ;
99 
100 /**
101  * IRvoodoo command status struct
102  * (status of request RESP_OK | RESP_ERR)
103  */
104 typedef struct {
105  //! Status type (RESP_OK = 0 ,RESP_ERR = 0xFF)
106  uint16_t type;
107  //! Error code for for RESP_ERR, not used for RESP_OK
108  uint8_t err_code;
109 } cmdstat_t ;
110 
111 /**
112  * @brief IRvoodoo configuration structure
113  *
114  * This structure holds configuration data.
115  */
116 typedef struct __attribute__((__packed__)){
117  //! Speed of mouse movement
118  uint8_t mouse_speed;
119  //! Number of mouse reports between IRcode's
121  //! Mouse acceleration
122  uint8_t mouse_accel;
123  //! How fast to send keyboard events (0 == send only one keyboard event, no repeat)
124  uint8_t keyboard_speed;
125  //!
126  uint16_t keyboard_timeout;
127  //!
128  uint16_t mouse_timeout;
129  //!
130  uint8_t led_mask;
131 } config_t;
132 
133 /**
134  * @brief Runtime statistics
135  *
136  *
137  */
138 typedef struct __attribute__ ((__packed__)) {
139  //! EventMap size
140  uint16_t eventmap_size;
141  //! Number of events in EventMap
142  uint16_t events_in_use;
143 } stat_t;
144 #endif /* STRUCTS_H_ */