43 if (v > 0.0) |
43 if (v > 0.0) |
44 timeouter.attach(callback(this, &HPSerial::timeout), v); |
44 timeouter.attach(callback(this, &HPSerial::timeout), v); |
45 } |
45 } |
46 |
46 |
47 private: |
47 private: |
48 RawSerial serial; |
48 UnbufferedSerial serial; |
49 uint8_t buf[BUF_SIZE]; |
49 uint8_t buf[BUF_SIZE]; |
50 uint8_t head; |
50 uint8_t head; |
51 CircularBuffer<CMD, 32> cmdbuf; |
51 CircularBuffer<CMD, 32> cmdbuf; |
52 unsigned long ncmd; |
52 unsigned long ncmd; |
53 unsigned int errs[MAX_ERRS]; |
53 unsigned int errs[MAX_ERRS]; |
101 state_t do_state_initial(uint8_t c=0x00); |
101 state_t do_state_initial(uint8_t c=0x00); |
102 state_t do_state_command(uint8_t c); |
102 state_t do_state_command(uint8_t c); |
103 state_t do_state_payload_size(uint8_t c); |
103 state_t do_state_payload_size(uint8_t c); |
104 state_t do_state_payload(uint8_t c); |
104 state_t do_state_payload(uint8_t c); |
105 state_t do_state_sending(uint8_t c=0x00); |
105 state_t do_state_sending(uint8_t c=0x00); |
106 state_t do_state_eot(uint8_t c=0x00); |
106 state_t do_state_eot(uint8_t c=0x55); |
107 |
107 |
108 void send_ack(uint8_t c); |
108 void send_ack(uint8_t c); |
109 |
109 |
110 typedef state_t(HPSerial::*statemethod)(uint8_t c); |
110 typedef state_t(HPSerial::*statemethod)(uint8_t c); |
111 static statemethod state_table[NUM_STATES]; |
111 static statemethod state_table[NUM_STATES]; |