Tweak the bit-banging code to get the protocol right

This commit is contained in:
Savanni D'Gerinel 2023-11-13 18:21:07 -05:00
parent 168ba6eb40
commit c46ab1b389
1 changed files with 7 additions and 4 deletions

View File

@ -29,8 +29,8 @@ fn send_byte<I, J, P>(
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,