some trivial fix
use less #[cfg] macro; reuse same variable
This commit is contained in:
parent
24f569821c
commit
873ee06151
2 changed files with 9 additions and 10 deletions
|
@ -177,15 +177,14 @@ where
|
||||||
let req = self.dma.request();
|
let req = self.dma.request();
|
||||||
|
|
||||||
#[cfg(not(any(bdma, gpdma)))]
|
#[cfg(not(any(bdma, gpdma)))]
|
||||||
let dma_regs = self.dma.regs();
|
let (isr_bit, isr_reg, ifcr_reg) = {
|
||||||
#[cfg(not(any(bdma, gpdma)))]
|
let dma_regs = self.dma.regs();
|
||||||
let isr_num = self.dma.num() / 4;
|
let isr_num = self.dma.num() / 4;
|
||||||
#[cfg(not(any(bdma, gpdma)))]
|
let isr_bit = self.dma.num() % 4;
|
||||||
let isr_bit = self.dma.num() % 4;
|
let isr_reg = dma_regs.isr(isr_num);
|
||||||
#[cfg(not(any(bdma, gpdma)))]
|
let ifcr_reg = dma_regs.ifcr(isr_num);
|
||||||
let isr_reg = dma_regs.isr(isr_num);
|
(isr_bit, isr_reg, ifcr_reg)
|
||||||
#[cfg(not(any(bdma, gpdma)))]
|
};
|
||||||
let ifcr_reg = dma_regs.ifcr(isr_num);
|
|
||||||
|
|
||||||
#[cfg(not(any(bdma, gpdma)))]
|
#[cfg(not(any(bdma, gpdma)))]
|
||||||
// clean DMA FIFO error before a transfer
|
// clean DMA FIFO error before a transfer
|
||||||
|
|
|
@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
for &color in color_list {
|
for &color in color_list {
|
||||||
ws2812_pwm.gen_waveform(Channel::Ch1, color).await;
|
ws2812_pwm.gen_waveform(pwm_channel, color).await;
|
||||||
// ws2812 need at least 50 us low level input to confirm the input data and change it's state
|
// ws2812 need at least 50 us low level input to confirm the input data and change it's state
|
||||||
Timer::after_micros(50).await;
|
Timer::after_micros(50).await;
|
||||||
// wait until ticker tick
|
// wait until ticker tick
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue