diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-11-26 15:30:34 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-11-26 15:30:34 +0100 |
commit | 0169625b253301ed24267ebfd19afb55e5121bca (patch) | |
tree | 6d27e9b12823c5086dc6ab25bbd31978df746e0d /software/shift.ino | |
parent | b2a27b3f0dc4b9db227184595062ffded0f5decb (diff) |
working software
Diffstat (limited to 'software/shift.ino')
-rw-r--r-- | software/shift.ino | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/software/shift.ino b/software/shift.ino index 20c1123..d8062af 100644 --- a/software/shift.ino +++ b/software/shift.ino @@ -9,22 +9,18 @@ unsigned char shift_state[2]; void update_shift_state() { for(int i = 0; i < 2; i++) shift(shift_state[i]); -} -void shift(unsigned char data) { - // pull down latch + digitalWrite(PINOUT_LCK, HIGH); digitalWrite(PINOUT_LCK, LOW); +} +void shift(unsigned char data) { for(int i = 0; i < 8; i++) { - bool bit = (data & 1 << i) > 0; + bool bit = (data & 1 << (7 - i)) > 0; - // write bit and pulse serial clock digitalWrite(PINOUT_SER, bit); + digitalWrite(PINOUT_SCK, HIGH); - delayMicroseconds(CONFIG_SRSER_DELAY); digitalWrite(PINOUT_SCK, LOW); } - - // pull up latch - digitalWrite(PINOUT_LCK, HIGH); } |