From c46ab1b389d41092422e9b7bb159e3a72605afb2 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Mon, 13 Nov 2023 18:21:07 -0500 Subject: [PATCH] Tweak the bit-banging code to get the protocol right --- pico-blink/src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pico-blink/src/main.rs b/pico-blink/src/main.rs index cbe3672..57ff34a 100644 --- a/pico-blink/src/main.rs +++ b/pico-blink/src/main.rs @@ -29,8 +29,8 @@ fn send_byte( J: PinId, P: PullType, { - (0..7).for_each(|bit| { - if byte & (1 << (7 - bit)) > 0 { + (0..8).for_each(|bit| { + if byte & (1 << (8 - bit)) > 0 { data.set_high(); } else { data.set_low(); @@ -144,10 +144,13 @@ fn main() -> ! { &mut spi_clk, &mut delay, &[ - 0, 0, 0, 0, 0xf0, 0x80, 0x0, 0x0, 0xe1, 0x0, 0x80, 0x0, 0xe1, 0x0, 0x0, 0x80, 0xff, - 0xff, 0xff, 0xff, + 0xe1, 0x80, 0x00, 0x00, + 0xe1, 0x00, 0x80, 0x00, + 0xe1, 0x00, 0x00, 0x80, ], ); + spi_clk.set_low(); + spi_sdo.set_low(); /* spi.write(&[ 0, 0, 0, 0, 0xf0, 0x80, 0x0, 0x0, 0xe1, 0x0, 0x80, 0x0, 0xe1, 0x0, 0x0, 0x80, 0xff,