Build a color test pattern.
This commit is contained in:
parent
c46ab1b389
commit
6d14cdbe2a
|
@ -120,49 +120,127 @@ fn main() -> ! {
|
|||
|
||||
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
|
||||
|
||||
let mut spi_clk = pins.gpio10.into_push_pull_output();
|
||||
let mut spi_sdo = pins.gpio11.into_push_pull_output();
|
||||
|
||||
/*
|
||||
let mut spi_clk = pins.gpio10.into_function();
|
||||
let mut spi_sdo = pins.gpio11.into_function();
|
||||
let spi = Spi::<_, _, _, 8>::new(pac.SPI1, (spi_sdo, spi_clk));
|
||||
let mut spi = spi.init(
|
||||
&mut pac.RESETS,
|
||||
clocks.peripheral_clock.freq(),
|
||||
1.MHz(),
|
||||
embedded_hal::spi::MODE_0,
|
||||
embedded_hal::spi::MODE_1,
|
||||
);
|
||||
*/
|
||||
|
||||
let mut led_pin = pins.led.into_push_pull_output();
|
||||
let mut blue_pin = pins.gpio3.into_push_pull_output();
|
||||
led_pin.set_high().unwrap();
|
||||
delay.delay_ms(500);
|
||||
led_pin.set_low().unwrap();
|
||||
|
||||
let mut spi_clk = pins.gpio10.into_push_pull_output();
|
||||
let mut spi_sdo = pins.gpio11.into_push_pull_output();
|
||||
spi_clk.set_low();
|
||||
spi_sdo.set_low();
|
||||
|
||||
let bits_1 = &[
|
||||
0, 0, 0, 0,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
];
|
||||
let bits_2 = &[
|
||||
0, 0, 0, 0,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
];
|
||||
let bits_3 = &[
|
||||
0, 0, 0, 0,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
];
|
||||
|
||||
let a = 15 / 2;
|
||||
|
||||
loop {
|
||||
send(
|
||||
&mut spi_sdo,
|
||||
&mut spi_clk,
|
||||
&mut delay,
|
||||
&[
|
||||
0xe1, 0x80, 0x00, 0x00,
|
||||
0xe1, 0x00, 0x80, 0x00,
|
||||
0xe1, 0x00, 0x00, 0x80,
|
||||
],
|
||||
bits_1,
|
||||
);
|
||||
spi_clk.set_low();
|
||||
spi_sdo.set_low();
|
||||
delay.delay_ms(500);
|
||||
|
||||
send(
|
||||
&mut spi_sdo,
|
||||
&mut spi_clk,
|
||||
&mut delay,
|
||||
bits_2,
|
||||
);
|
||||
spi_clk.set_low();
|
||||
spi_sdo.set_low();
|
||||
delay.delay_ms(500);
|
||||
|
||||
send(
|
||||
&mut spi_sdo,
|
||||
&mut spi_clk,
|
||||
&mut delay,
|
||||
bits_3,
|
||||
);
|
||||
spi_clk.set_low();
|
||||
spi_sdo.set_low();
|
||||
delay.delay_ms(500);
|
||||
|
||||
/*
|
||||
spi.write(&[
|
||||
0, 0, 0, 0, 0xf0, 0x80, 0x0, 0x0, 0xe1, 0x0, 0x80, 0x0, 0xe1, 0x0, 0x0, 0x80, 0xff,
|
||||
0xff, 0xff, 0xff,
|
||||
]);
|
||||
spi.write(bits_1);
|
||||
delay.delay_ms(500);
|
||||
spi.write(bits_2);
|
||||
delay.delay_ms(500);
|
||||
spi.write(bits_3);
|
||||
delay.delay_ms(500);
|
||||
*/
|
||||
|
||||
/*
|
||||
led_pin.set_high().unwrap();
|
||||
blue_pin.set_low().unwrap();
|
||||
delay.delay_ms(500);
|
||||
led_pin.set_low().unwrap();
|
||||
blue_pin.set_high().unwrap();
|
||||
delay.delay_ms(500);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue