fix lint errors

This commit is contained in:
Jörn-Michael Miehe 2024-03-25 00:36:02 +00:00
parent f3151add3a
commit 08db62f4f9
2 changed files with 8 additions and 7 deletions

View file

@ -73,6 +73,7 @@ impl<const DMX_LEN: usize> TxDMA<DMX_LEN> {
} }
} }
#[allow(clippy::upper_case_acronyms)]
pub struct DMX<const DMX_LEN: usize> { pub struct DMX<const DMX_LEN: usize> {
tx_universe: DMXUniverse<DMX_LEN>, tx_universe: DMXUniverse<DMX_LEN>,
sender: TxDMA<DMX_LEN>, sender: TxDMA<DMX_LEN>,
@ -106,8 +107,8 @@ impl<const DMX_LEN: usize> DMX<DMX_LEN> {
unsafe { unsafe {
pac::CorePeripherals::steal() pac::CorePeripherals::steal()
.NVIC .NVIC
.set_priority(pac::Interrupt::DMA1_CHANNEL4, 1) .set_priority(pac::Interrupt::DMA1_CHANNEL4, 1);
}; }
// Serial config // Serial config
let serial = serial::Serial::new( let serial = serial::Serial::new(
@ -118,7 +119,7 @@ impl<const DMX_LEN: usize> DMX<DMX_LEN> {
), ),
mapr, mapr,
250_000.bps(), 250_000.bps(),
&clocks, clocks,
); );
Self { Self {
@ -136,6 +137,6 @@ impl<const DMX_LEN: usize> DMX<DMX_LEN> {
} }
pub fn tx_is_idle(&mut self) -> bool { pub fn tx_is_idle(&mut self) -> bool {
return self.sender.is_idle(); self.sender.is_idle()
} }
} }

View file

@ -40,7 +40,7 @@ mod app {
int_pin: gpio::gpiob::PB10<gpio::Input<gpio::PullUp>>, int_pin: gpio::gpiob::PB10<gpio::Input<gpio::PullUp>>,
} }
#[init(local = [buffer: [u8; DMX_LEN * 2] = [0b01010101; DMX_LEN * 2]])] #[init(local = [buffer: [u8; DMX_LEN * 2] = [0b0101_0101; DMX_LEN * 2]])]
fn init(mut cx: init::Context) -> (Shared, Local, init::Monotonics) { fn init(mut cx: init::Context) -> (Shared, Local, init::Monotonics) {
// Take ownership over the raw flash and rcc devices and convert them into the corresponding // Take ownership over the raw flash and rcc devices and convert them into the corresponding
// HAL structs // HAL structs
@ -103,7 +103,7 @@ mod app {
.pc13 .pc13
.into_push_pull_output_with_state(&mut gpioc.crh, gpio::PinState::High), .into_push_pull_output_with_state(&mut gpioc.crh, gpio::PinState::High),
int_pin: int_pin, int_pin,
}, },
init::Monotonics(mono), init::Monotonics(mono),
) )
@ -118,7 +118,7 @@ mod app {
#[task(local = [led], shared = [delay_us, dmx])] #[task(local = [led], shared = [delay_us, dmx])]
fn sender(mut cx: sender::Context) { fn sender(mut cx: sender::Context) {
cx.shared.dmx.lock(|dmx| dmx.start_tx()); cx.shared.dmx.lock(DMX::start_tx);
cx.local.led.toggle(); cx.local.led.toggle();
cx.shared.delay_us.lock(|d| d.delay(1.secs())); cx.shared.delay_us.lock(|d| d.delay(1.secs()));