aboutsummaryrefslogtreecommitdiff
path: root/software/shift.ino
diff options
context:
space:
mode:
Diffstat (limited to 'software/shift.ino')
-rw-r--r--software/shift.ino12
1 files changed, 5 insertions, 7 deletions
diff --git a/software/shift.ino b/software/shift.ino
index b27795a..20c1123 100644
--- a/software/shift.ino
+++ b/software/shift.ino
@@ -1,7 +1,10 @@
#include "shift.h"
#include "consts.h"
+#ifdef DEBUG
+#include "util.h"
+#endif
-unsigned char shift_state[2] = {0};
+unsigned char shift_state[2];
void update_shift_state() {
for(int i = 0; i < 2; i++)
@@ -9,18 +12,13 @@ void update_shift_state() {
}
void shift(unsigned char data) {
- #ifdef DEBUG
- Serial.print("Sending data to shift register: ");
- Serial.println(data, BIN);
- #endif
-
// pull down latch
digitalWrite(PINOUT_LCK, LOW);
for(int i = 0; i < 8; i++) {
bool bit = (data & 1 << i) > 0;
- // schrijf bit en pulse serial clock
+ // write bit and pulse serial clock
digitalWrite(PINOUT_SER, bit);
digitalWrite(PINOUT_SCK, HIGH);
delayMicroseconds(CONFIG_SRSER_DELAY);