hackndev / zinc

The bare metal stack for rust
zinc.rs
Apache License 2.0
1k stars 100 forks source link

PWM Support #311

Closed posborne closed 8 years ago

posborne commented 9 years ago

This is my first crack at adding PWM support. It is working on my LPC1768 board (that is the only board I have added code for at this point). I haven't touched platformtree! with these initial changes as I expect that to be changing significantly in the short term.

Feedback very welcome. Its probably important to get the Trait for PWM close to right so feedback there very appreciated. Also, general comments on use of ioregs!, etc. is also very much appreciated as I will have to use it extensively for adding KLxx support if I move forward with that.

There are a couple of commits that we might consider backing out (linker script changes). I have left those in there for now for discussion.

hacknbot commented 9 years ago

Can one of the admins verify this patch?

posborne commented 9 years ago

Hmm, I may have to look over things a bit more closely. At 100% duty cycle, it still looks like the signal is not quite being fully driven (only driving at 98%).

image

posborne commented 9 years ago

Fixed the aforementioned issue, so should be ready for review. PWM on the LPC17xx supports addition features (registering interrupts on match, etc.), but this implementation only support configuring a traditional single-PWM output (e.g. it lets you configure several single-edged pwm outputs).

farcaller commented 9 years ago

test this please

posborne commented 9 years ago

Kinda forgot about this guy. I'll try to update this branch based on suggestions so we can get this code merged.

posborne commented 9 years ago

@farcaller @mcoffin I believe I have now (finally) made all the updates that were brought up previously and I have rebased on master.

farcaller commented 9 years ago

Thanks for the work. The tests fail on native due to nightly issues I guess.

I'll try to take a deeper look into this a bit later this week, lots of code in here.

posborne commented 8 years ago

This commit rebases on master, addresses comments from the PR, and includes some additional cleanup related to PWM. Tested working on my lpc1768 again:

blinking

farcaller commented 8 years ago

:+1: