Fixed order in init
This commit is contained in:
parent
0f3892fd51
commit
e6ab8845b3
60
src/main.rs
60
src/main.rs
|
@ -135,6 +135,37 @@ mod app {
|
|||
|
||||
defmt::info!("PLL chip setup done");
|
||||
|
||||
let mut disp_led = gpioa.pa10.into_push_pull_output();
|
||||
disp_led.set_high();
|
||||
let mut disp_cs = gpioa.pa15.into_push_pull_output();
|
||||
disp_cs.set_low();
|
||||
|
||||
let disp_rst = gpioa.pa11.into_push_pull_output();
|
||||
let disp_dc = gpioa.pa12.into_push_pull_output();
|
||||
|
||||
let disp_sck = gpiob.pb3.into_alternate();
|
||||
let disp_mosi = gpiob.pb5.into_alternate();
|
||||
let spi1 = Spi::new(
|
||||
cx.device.SPI1,
|
||||
(disp_sck, spi::NoMiso::new(), disp_mosi),
|
||||
spi::Mode {
|
||||
polarity: spi::Polarity::IdleLow,
|
||||
phase: spi::Phase::CaptureOnFirstTransition,
|
||||
},
|
||||
16.MHz(),
|
||||
&clocks,
|
||||
);
|
||||
|
||||
let mut disp = ST7735::new(spi1, disp_dc, disp_rst, true, false, 160, 128);
|
||||
|
||||
let mut delay = cx.core.SYST.delay(&clocks);
|
||||
|
||||
disp.init(&mut delay).unwrap();
|
||||
disp.set_orientation(&Orientation::Landscape).unwrap();
|
||||
disp.clear(Rgb565::BLUE).unwrap();
|
||||
|
||||
defmt::info!("Display setup done");
|
||||
|
||||
let i_in = gpioa.pa1.into_analog();
|
||||
let q_in = gpioa.pa0.into_analog();
|
||||
|
||||
|
@ -184,35 +215,6 @@ mod app {
|
|||
let bias_pin = Channel1::new(gpioa.pa6);
|
||||
let _bias_pwm = cx.device.TIM3.pwm_hz(bias_pin, 64.kHz(), &clocks);
|
||||
|
||||
let mut disp_led = gpioa.pa10.into_push_pull_output();
|
||||
disp_led.set_high();
|
||||
let mut disp_cs = gpioa.pa15.into_push_pull_output();
|
||||
disp_cs.set_low();
|
||||
|
||||
let disp_rst = gpioa.pa11.into_push_pull_output();
|
||||
let disp_dc = gpioa.pa12.into_push_pull_output();
|
||||
|
||||
let disp_sck = gpiob.pb3.into_alternate();
|
||||
let disp_mosi = gpiob.pb5.into_alternate();
|
||||
let spi1 = Spi::new(
|
||||
cx.device.SPI1,
|
||||
(disp_sck, spi::NoMiso::new(), disp_mosi),
|
||||
spi::Mode {
|
||||
polarity: spi::Polarity::IdleLow,
|
||||
phase: spi::Phase::CaptureOnFirstTransition,
|
||||
},
|
||||
16.MHz(),
|
||||
&clocks,
|
||||
);
|
||||
|
||||
let mut disp = ST7735::new(spi1, disp_dc, disp_rst, true, false, 160, 128);
|
||||
|
||||
let mut delay = cx.core.SYST.delay(&clocks);
|
||||
|
||||
disp.init(&mut delay).unwrap();
|
||||
disp.set_orientation(&Orientation::Landscape).unwrap();
|
||||
disp.clear(Rgb565::BLUE).unwrap();
|
||||
|
||||
(
|
||||
Shared {},
|
||||
Local {
|
||||
|
|
Loading…
Reference in New Issue