summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/arch/msp430fr5969lp/driver/stdin.h8
-rw-r--r--include/arch/msp430fr5994lp/driver/stdin.h8
-rw-r--r--src/arch/msp430fr5969lp/driver/stdin.cc2
-rw-r--r--src/arch/msp430fr5994lp/driver/stdin.cc2
4 files changed, 12 insertions, 8 deletions
diff --git a/include/arch/msp430fr5969lp/driver/stdin.h b/include/arch/msp430fr5969lp/driver/stdin.h
index 1085111..7b78a9a 100644
--- a/include/arch/msp430fr5969lp/driver/stdin.h
+++ b/include/arch/msp430fr5969lp/driver/stdin.h
@@ -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;
}
};
diff --git a/include/arch/msp430fr5994lp/driver/stdin.h b/include/arch/msp430fr5994lp/driver/stdin.h
index 1085111..7b78a9a 100644
--- a/include/arch/msp430fr5994lp/driver/stdin.h
+++ b/include/arch/msp430fr5994lp/driver/stdin.h
@@ -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;
}
};
diff --git a/src/arch/msp430fr5969lp/driver/stdin.cc b/src/arch/msp430fr5969lp/driver/stdin.cc
index 033349d..6ad43b8 100644
--- a/src/arch/msp430fr5969lp/driver/stdin.cc
+++ b/src/arch/msp430fr5969lp/driver/stdin.cc
@@ -22,7 +22,7 @@ bool StandardInput::hasKey()
char StandardInput::getKey()
{
char ret = buffer[read_pos++];
- read_pos %= 8;
+ read_pos %= bufsize;
return ret;
}
diff --git a/src/arch/msp430fr5994lp/driver/stdin.cc b/src/arch/msp430fr5994lp/driver/stdin.cc
index 033349d..6ad43b8 100644
--- a/src/arch/msp430fr5994lp/driver/stdin.cc
+++ b/src/arch/msp430fr5994lp/driver/stdin.cc
@@ -22,7 +22,7 @@ bool StandardInput::hasKey()
char StandardInput::getKey()
{
char ret = buffer[read_pos++];
- read_pos %= 8;
+ read_pos %= bufsize;
return ret;
}