mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 15:03:41 +00:00
machine: refactor PWM support
This commit refactors PWM support in the machine package to be more flexible. The new API can be used to produce tones at a specific frequency and control servos in a portable way, by abstracting over counter widths and prescalers.
This commit is contained in:
committed by
Ron Evans
parent
f880950c3e
commit
72acda22b0
@@ -63,7 +63,7 @@ func (i2c *I2C) setPins(scl, sda Pin) {
|
||||
|
||||
// PWM
|
||||
var (
|
||||
pwmChannelPins = [3]uint32{0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}
|
||||
pwms = [3]*nrf.PWM_Type{nrf.PWM0, nrf.PWM1, nrf.PWM2}
|
||||
pwmChannelSequence [3]uint16
|
||||
PWM0 = &PWM{PWM: nrf.PWM0}
|
||||
PWM1 = &PWM{PWM: nrf.PWM1}
|
||||
PWM2 = &PWM{PWM: nrf.PWM2}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user