31 unsigned int nerrors(uint8_t errorno); |
31 unsigned int nerrors(uint8_t errorno); |
32 |
32 |
33 void startup(uint8_t keycode=0xFF); |
33 void startup(uint8_t keycode=0xFF); |
34 void sendkey(uint8_t keycode); |
34 void sendkey(uint8_t keycode); |
35 void send_key_when_idle(); |
35 void send_key_when_idle(); |
|
36 void send_startup_seq(); |
|
37 void send_startup_seq(uint8_t keycode); |
36 |
38 |
37 private: |
39 private: |
38 void pushCmd(uint8_t cmd, uint8_t size, char *payload); |
40 void pushCmd(uint8_t cmd, uint8_t size, char *payload); |
39 void rx_irq(void); |
41 void rx_irq(void); |
40 void timeout(void); |
42 void timeout(void); |
51 CircularBuffer<CMD, 32> cmdbuf; |
53 CircularBuffer<CMD, 32> cmdbuf; |
52 CircularBuffer<uint8_t, 32> sendbuf; |
54 CircularBuffer<uint8_t, 32> sendbuf; |
53 unsigned long ncmd; |
55 unsigned long ncmd; |
54 unsigned int errs[MAX_ERRS]; |
56 unsigned int errs[MAX_ERRS]; |
55 Ticker timeouter; |
57 Ticker timeouter; |
|
58 |
|
59 Thread send_thread; |
|
60 void send_pending_key(); |
|
61 bool wait_for(uint8_t); |
|
62 |
56 |
63 |
57 public: |
64 public: |
58 // global state machine |
65 // global state machine |
59 typedef enum { |
66 typedef enum { |
60 GSTATE_STARTING, |
67 GSTATE_STARTING, |