summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasil Zlatanov <v@skozl.com>2017-05-04 13:32:18 +0100
committerVasil Zlatanov <v@skozl.com>2017-05-04 13:32:18 +0100
commit02feeb68dcfe121b6bcb370001f63de3a7151b6b (patch)
tree0ea8289b1656195a6177e200dda52e691714fd6b
parent007ea502e885e7773b0e3661cf4bc99f907345f2 (diff)
downloade2-switch-02feeb68dcfe121b6bcb370001f63de3a7151b6b.tar.gz
e2-switch-02feeb68dcfe121b6bcb370001f63de3a7151b6b.tar.bz2
e2-switch-02feeb68dcfe121b6bcb370001f63de3a7151b6b.zip
Correct frequency assignment
-rw-r--r--src/main.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 16b028e..eecc5da 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -50,17 +50,16 @@ int main(void)
oled.setTextCursor(0, 0);
- int frequency = 0;
//Write the latest switch osciallor count
for (int i = 3; i >= 0; --i) {
current_f[i] += (switch_pressed[i] && !last_pressed[i]);
if (current_f[i] > 9)
current_f[i] = 0;
-
- frequency += current_f[i] * (10^i);
oled.printf("\nS:%u C:%05u N:%u", switch_pressed[i], switch_count[i], current_f[i]);
}
+ uint16_t frequency = 1000*current_f[3] + 100*current_f[2] + 10*current_f[1] + current_f[0];
+
oled.printf("\nF:%u F:%d", frequency, frequency);
//Copy the display buffer to the display