Commit Graph

70 Commits

Author SHA1 Message Date
huntc
482389a691 Own the sequence buffer
This approach owns the sequence buffers which, while introducing an extra move, it eliminates the need to guard the lifetime of the sequence buffer. Given ownership, the buffer will be retained until the PWM sequence task is stopped.
2022-01-29 18:01:06 +11:00
huntc
9ac52a768b Now permits sequences to be mutated subsequently 2022-01-28 16:32:58 +11:00
huntc
8e9f448866 Doc tidying 2022-01-28 13:43:36 +11:00
huntc
12ce024574 Make the sequence a little nicer to pass around 2022-01-28 13:38:20 +11:00
huntc
47aeab152f PWM WS2812B example and per sequence config
Demonstrates how to set the colour of a WS2812B to blue using PWM, and the use of multiple sequences along with their own config. This required an API change.
2022-01-28 11:20:04 +11:00
huntc
c9f29534d6 Stop PWM before assigning the new sequence
I had introduced a small bug in my last PR where I assigned the sequence before stopping the PWM. I now stop the PWM before doing that now.

Also, corrected a math comment.
2022-01-25 16:51:24 +11:00
huntc
48afef28a0 Strengthen the borrow
The start method is now safe. Because it has the potential of borrowing the sequence and mutating itself, the sequence must outlive the Pwm struct.
2022-01-24 17:22:35 +11:00
huntc
7598b8a40f Permit many sequences to be passed
Sequences are now passed in via the start method to avoid having to stop the PWM and restart it. Sequences continue to be constrained with the same lifetime of the Pwm object itself. The pwm_sequence example has been extended to illustrate multiple sequences being passed around.
2022-01-23 16:29:52 +11:00
Jacob Rosenthal
4010a829ae nrf: pwm clarify stop and disable pin state 2021-11-14 11:26:30 -07:00
Jacob Rosenthal
4d61f4aa0d nrf: sequencepwm dont wait for tasks_stop afterall 2021-11-13 17:31:09 -07:00
Jacob Rosenthal
3a166db280 nrf: pwm use register reset 2021-11-13 16:42:19 -07:00
Jacob Rosenthal
7dfc0acb2f nrf: pwm clarify stop and disable pin state 2021-11-13 16:42:17 -07:00
Jacob Rosenthal
2bcacd4f16 nrf: sequencepwm add events 2021-11-13 16:24:41 -07:00
Jacob Rosenthal
0f322c1d4e fix set_duty ptr write 2021-11-12 08:55:20 -07:00
Jacob Rosenthal
667a93b5c8 sequence pwm remove disable fn for clarity, and disable peripheral on stop 2021-11-11 23:46:27 -07:00
Jacob Rosenthal
7bee43df5a nrf: sequencepwm nitpicks for clarity 2021-11-11 22:50:07 -07:00
Jacob Rosenthal
937f49dead nrf: sequencepwm rename top to max_duty for consistancy 2021-11-11 22:47:57 -07:00
Jacob Rosenthal
f15c3a04d4 sequence must be live while DMA runs 2021-11-11 20:10:34 -07:00
Jacob Rosenthal
fe83daf45f remove const generic 2021-11-11 19:49:41 -07:00
Jacob Rosenthal
ec66fcd01a pwm_sequence consume buffer 2021-11-11 19:14:29 -07:00
Jacob Rosenthal
156caa9330 more comments 2021-11-10 19:56:36 -07:00
Jacob Rosenthal
66a43c2e58 more comments 2021-11-10 19:44:57 -07:00
Jacob Rosenthal
407e5d06e0 more comments 2021-11-10 19:43:47 -07:00
Jacob Rosenthal
613e88f1d2 fix bug with config.counter_mode 2021-11-10 18:53:21 -07:00
Jacob Rosenthal
4c2d0ac211 doccomments 2021-11-10 18:52:32 -07:00
Jacob Rosenthal
c6736abf5e dont wait seqend for sequencepwm 2021-11-10 18:52:03 -07:00
Jacob Rosenthal
c450f91bd9 doc comment cleanup 2021-11-10 17:30:59 -07:00
Jacob Rosenthal
6dcc731065 drop the debug 2021-11-10 17:25:38 -07:00
Jacob Rosenthal
5f28153b81 disconnect pwm pins on drop 2021-11-10 17:19:03 -07:00
Jacob Rosenthal
3b7af2f4ed fix wait seqend, pwm example is slow now... 2021-11-10 13:03:44 -07:00
Jacob Rosenthal
903b8f032f defensive dma 2021-11-10 12:34:41 -07:00
Jacob Rosenthal
4751dbddc6 move state into PwmSimple 2021-11-10 12:32:28 -07:00
Jacob Rosenthal
9548748c26 fix 2021-11-10 12:29:13 -07:00
Jacob Rosenthal
65843c033e pwm store and deconfigure pins 2021-11-10 11:02:43 -07:00
Jacob Rosenthal
64e1426b54 clean up some todo comments around infinite play 2021-11-03 18:46:42 -07:00
Jacob Rosenthal
b726ef1886 make SequenceConfig struct is consistent with other Config structs, that are always non_exhaustive and have a Default 2021-11-03 18:37:54 -07:00
Jacob Rosenthal
d961fd1015 rename to SimplePwm and SequencePwm 2021-11-03 18:25:44 -07:00
Jacob Rosenthal
9a6c2de4ea fix safety comments 2021-11-03 18:19:43 -07:00
Jacob Rosenthal
511c5cb892 intenset in a noop 2021-11-03 18:16:00 -07:00
Jacob Rosenthal
82695c8f65 make both news configure registers in same order 2021-11-03 18:15:42 -07:00
Jacob Rosenthal
44375b427c restore example and add set_time_stretch api 2021-11-03 15:29:09 -07:00
Jacob Rosenthal
682274870f set_duty does indeed loop forever 2021-11-02 11:56:01 -07:00
Jacob Rosenthal
c939edb8d0 rename error enum again 2021-11-02 10:57:01 -07:00
Jacob Rosenthal
4647792ad6 seperate start from pwmseq::new 2021-11-01 20:50:18 -07:00
Jacob Rosenthal
49253152cf seperate sequence from duty cycle pwm struct 2021-11-01 20:50:14 -07:00
Jacob Rosenthal
74e7f4a227 comments 2021-11-01 13:16:24 -07:00
Jacob Rosenthal
f2cfbe4262 align pwm.set_duty with embedded hal to not be one shot 2021-11-01 13:08:55 -07:00
Jacob Rosenthal
5285179218 generalize new and change pwm example to a servo 2021-11-01 13:08:51 -07:00
Jacob Rosenthal
12b2c5d5f7 better not as a constructor? 2021-11-01 08:54:07 -07:00
Jacob Rosenthal
90be851e4b reduce complexity of loopmode 2021-11-01 08:45:07 -07:00