Display init works
This commit is contained in:
parent
bd69ef82b9
commit
6323020528
|
@ -19,14 +19,13 @@ systick-monotonic = "1.0.0"
|
|||
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
|
||||
num = {version = "0.4", default-features = false}
|
||||
microfft = "0.5.1"
|
||||
st7735-lcd = "0.9.0"
|
||||
embedded-graphics = "0.8.0"
|
||||
|
||||
|
||||
[features]
|
||||
# set logging levels here
|
||||
default = [
|
||||
"defmt-default",
|
||||
# "dependency-a/defmt-trace",
|
||||
]
|
||||
default = ["defmt-default"]
|
||||
|
||||
# do NOT modify these features
|
||||
defmt-default = []
|
||||
|
|
44
src/main.rs
44
src/main.rs
|
@ -34,8 +34,9 @@ mod app {
|
|||
dma::{self, config::DmaConfig, PeripheralToMemory, Stream0, StreamsTuple, Transfer},
|
||||
gpio::{self, gpioa, gpioc, Analog, Output, PushPull},
|
||||
i2c::{self, I2c},
|
||||
pac::{ADC1, DMA2, I2C1, TIM2, TIM4},
|
||||
pac::{ADC1, DMA2, I2C1, SPI1, TIM2, TIM4},
|
||||
prelude::*,
|
||||
spi::{self, Spi},
|
||||
timer::{self, Channel, Channel1, Channel3, ChannelBuilder, CounterHz, Event, PwmHz},
|
||||
};
|
||||
|
||||
|
@ -47,6 +48,10 @@ mod app {
|
|||
use crate::filters;
|
||||
use crate::si5153;
|
||||
|
||||
use embedded_graphics::pixelcolor::Rgb565;
|
||||
use embedded_graphics::prelude::*;
|
||||
use st7735_lcd::{Orientation, ST7735};
|
||||
|
||||
type AudioPwm = PwmHz<TIM4, ChannelBuilder<TIM4, 2>>;
|
||||
|
||||
#[shared]
|
||||
|
@ -69,6 +74,10 @@ mod app {
|
|||
transfer:
|
||||
Transfer<Stream0<DMA2>, 0, Adc<ADC1>, PeripheralToMemory, &'static mut [u16; 256]>,
|
||||
iq_buffer: Option<&'static mut [u16; 256]>,
|
||||
|
||||
disp_led: gpioa::PA10<Output<PushPull>>,
|
||||
disp_cs: gpioa::PA15<Output<PushPull>>,
|
||||
disp: ST7735<Spi<SPI1>, gpio::Pin<'A', 12, Output>, gpio::Pin<'A', 11, Output>>,
|
||||
}
|
||||
|
||||
#[init]
|
||||
|
@ -174,6 +183,35 @@ 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::GREEN).unwrap();
|
||||
|
||||
(
|
||||
Shared {},
|
||||
Local {
|
||||
|
@ -191,6 +229,10 @@ mod app {
|
|||
usb_filter: filters::usb_firfilter(),
|
||||
transfer,
|
||||
iq_buffer: Some(iq_buff2),
|
||||
|
||||
disp_led,
|
||||
disp_cs,
|
||||
disp,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue