aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/pwm.go
blob: 06d61b9ab7bb995f190da944045fa4b29e064ad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package machine

import "errors"

var (
	ErrPWMPeriodTooLong = errors.New("pwm: period too long")
)

// PWMConfig allows setting some configuration while configuring a PWM
// peripheral. A zero PWMConfig is ready to use for simple applications such as
// dimming LEDs.
type PWMConfig struct {
	// PWM period in nanosecond. Leaving this zero will pick a reasonable period
	// value for use with LEDs.
	// If you want to configure a frequency instead of a period, you can use the
	// following formula to calculate a period from a frequency:
	//
	//     period = 1e9 / frequency
	//
	Period uint64
}