Commit fb6e2fed authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

msp430fr: use 16-byte uart input buffer

parent 84f2392e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -9,8 +9,10 @@
class StandardInput {
	private:
		StandardInput(const StandardInput &copy);
		char buffer[8];
		unsigned char write_pos, read_pos;
		static unsigned char const bufsize = 16;
		char buffer[bufsize];
		volatile unsigned char write_pos;
		unsigned char read_pos;

	public:
		StandardInput() : write_pos(0), read_pos(0) {}
@@ -20,7 +22,7 @@ class StandardInput {

		inline void addKey(char key) {
			buffer[write_pos++] = key;
			write_pos %= 8;
			write_pos %= bufsize;
		}
};

+5 −3
Original line number Diff line number Diff line
@@ -9,8 +9,10 @@
class StandardInput {
	private:
		StandardInput(const StandardInput &copy);
		char buffer[8];
		unsigned char write_pos, read_pos;
		static unsigned char const bufsize = 16;
		char buffer[bufsize];
		volatile unsigned char write_pos;
		unsigned char read_pos;

	public:
		StandardInput() : write_pos(0), read_pos(0) {}
@@ -20,7 +22,7 @@ class StandardInput {

		inline void addKey(char key) {
			buffer[write_pos++] = key;
			write_pos %= 8;
			write_pos %= bufsize;
		}
};

+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ bool StandardInput::hasKey()
char StandardInput::getKey()
{
	char ret = buffer[read_pos++];
	read_pos %= 8;
	read_pos %= bufsize;
	return ret;
}

+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ bool StandardInput::hasKey()
char StandardInput::getKey()
{
	char ret = buffer[read_pos++];
	read_pos %= 8;
	read_pos %= bufsize;
	return ret;
}