github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/pwm.go (about) 1 package machine 2 3 import "errors" 4 5 var ( 6 ErrPWMPeriodTooLong = errors.New("pwm: period too long") 7 ) 8 9 // PWMConfig allows setting some configuration while configuring a PWM 10 // peripheral. A zero PWMConfig is ready to use for simple applications such as 11 // dimming LEDs. 12 type PWMConfig struct { 13 // PWM period in nanosecond. Leaving this zero will pick a reasonable period 14 // value for use with LEDs. 15 // If you want to configure a frequency instead of a period, you can use the 16 // following formula to calculate a period from a frequency: 17 // 18 // period = 1e9 / frequency 19 // 20 Period uint64 21 }