Loading include/arch/arduino-nano/driver/stdin.h +3 −2 Original line number Diff line number Diff line Loading @@ -9,18 +9,19 @@ class StandardInput { private: StandardInput(const StandardInput ©); char buffer[8]; char buffer[32]; unsigned char write_pos, read_pos; public: StandardInput() : write_pos(0), read_pos(0) {} void setup(); void disable(); bool hasKey(); char getKey(); inline void addKey(char key) { buffer[write_pos] = key; write_pos = (write_pos + 1) % 8; write_pos = (write_pos + 1) % (sizeof(buffer) / sizeof(buffer[0])); } }; Loading src/arch/arduino-nano/driver/stdin.cc +6 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,11 @@ void StandardInput::setup() UCSR0B |= _BV(RXCIE0); } void StandardInput::disable() { UCSR0B &= ~_BV(RXCIE0); } bool StandardInput::hasKey() { if (write_pos != read_pos) { Loading @@ -23,7 +28,7 @@ bool StandardInput::hasKey() char StandardInput::getKey() { char ret = buffer[read_pos++]; read_pos %= 8; read_pos %= sizeof(buffer) / sizeof(buffer[0]); return ret; } Loading Loading
include/arch/arduino-nano/driver/stdin.h +3 −2 Original line number Diff line number Diff line Loading @@ -9,18 +9,19 @@ class StandardInput { private: StandardInput(const StandardInput ©); char buffer[8]; char buffer[32]; unsigned char write_pos, read_pos; public: StandardInput() : write_pos(0), read_pos(0) {} void setup(); void disable(); bool hasKey(); char getKey(); inline void addKey(char key) { buffer[write_pos] = key; write_pos = (write_pos + 1) % 8; write_pos = (write_pos + 1) % (sizeof(buffer) / sizeof(buffer[0])); } }; Loading
src/arch/arduino-nano/driver/stdin.cc +6 −1 Original line number Diff line number Diff line Loading @@ -12,6 +12,11 @@ void StandardInput::setup() UCSR0B |= _BV(RXCIE0); } void StandardInput::disable() { UCSR0B &= ~_BV(RXCIE0); } bool StandardInput::hasKey() { if (write_pos != read_pos) { Loading @@ -23,7 +28,7 @@ bool StandardInput::hasKey() char StandardInput::getKey() { char ret = buffer[read_pos++]; read_pos %= 8; read_pos %= sizeof(buffer) / sizeof(buffer[0]); return ret; } Loading