diff -r c850674a3101 -r b3c3d54d2c7c src/hp34comm.h --- a/src/hp34comm.h Sun Nov 01 22:16:33 2020 +0100 +++ b/src/hp34comm.h Sun Nov 01 22:21:19 2020 +0100 @@ -32,22 +32,24 @@ void startup(uint8_t keycode=0xFF); void sendkey(uint8_t keycode); + void send_key_when_idle(); private: void pushCmd(uint8_t cmd, uint8_t size, char *payload); - void rxIrq(void); + void rx_irq(void); void timeout(void); void set_timer(Kernel::Clock::duration_u32 v=0ms) { timeouter.detach(); if (v > 0ms) timeouter.attach(callback(this, &HPSerial::timeout), v); - } + }; private: UnbufferedSerial serial; uint8_t buf[BUF_SIZE]; uint8_t head; CircularBuffer cmdbuf; + CircularBuffer sendbuf; unsigned long ncmd; unsigned int errs[MAX_ERRS]; Ticker timeouter; @@ -84,7 +86,6 @@ STATE_PAYLOAD_SIZE, STATE_PAYLOAD, STATE_SENDING, - STATE_EOT, NUM_STATES} state_t; state_t state() {return cur_state;}; @@ -102,7 +103,6 @@ state_t do_state_payload_size(uint8_t c); state_t do_state_payload(uint8_t c); state_t do_state_sending(uint8_t c=0x00); - state_t do_state_eot(uint8_t c=0x55); void send_ack(uint8_t c);