japaric / ws2812b

WS2812B LED ring controlled via a serial interface
Other
25 stars 3 forks source link

update for rtfm 0.3 ? #5

Open dcarosone opened 6 years ago

dcarosone commented 6 years ago

Disclaimer preamble: this is waaay low priority compared to all the other things going on, but this is a useful blinky project to demo RTFM.

I tried updating Cargo.toml to use RTFM 0.3, as a way of seeing what changed, and whether I understood enough to do whatever adaptation was required.

image

I didn't even know macros could panic :roll_eyes:

dcarosone commented 6 years ago

Pursued this a little further this evening; got past the declaration of peripherals as resources and some of the other general updates. Currently stuck looking for the right -hal implementation for the Serial (etc) traits for stm32f103xx

dcarosone commented 6 years ago

I should have known to look at your repos rather than crates.io.. found https://github.com/japaric/stm32f103xx-hal

dcarosone commented 6 years ago

That was helpful and broke my initial logjam. Bashing away at the pile of compiler errors; now down to about 25 which is good progress. Next thing to tackle is the new DMA model and adjust the buffer accordingly.

One question (for now) relating to setting up the timers. hal::timer seems to have tim2+ but not tim1:

// where is Timer::tim1 for TIM1?
let timer1 = Timer::tim1(p.device.TIM1, LATCH_DELAY, clocks, &mut rcc.apb1);
let timer3 = Timer::tim3(p.device.TIM3, LOG_FREQUENCY, clocks, &mut rcc.apb1);

WIP at https://github.com/dcarosone/ws2812b

dcarosone commented 6 years ago

Ok, I'm at the point where all remaining errors are repetitious, and fall into one of two categories:

I'm thinking that the start-stop timer stuff that's there now, and the comments about getting the cpu to do something while dma is banging bits out to the LEDs, get replaced by a couple of ringbuffers: one for serial data, one for dma data, and a task (or idle loop activity) that does the translation from one to the other.

That needs more thought and attention than I have just at the moment, but comments and hints are welcome. I'm also interested to learn what would be the more minimal/direct translation of the current design, with single buffers and passing the timers around to start/stop them.

dcarosone commented 6 years ago

Regardless I've learned a lot already, so yay!

dcarosone commented 6 years ago

Progress! Down to 9 errors (which includes several repetitions :)

Worked around the either issue by just defining a local copy of the enum

Current blockers: