mirror of
https://github.com/kidoman/embd
synced 2025-02-24 11:28:19 +01:00
bbb: initialise at the start of SetMicroseconds
this will setup p.period to the default if not already done
This commit is contained in:
parent
779096e668
commit
6cfe268ada
4
bbb.go
4
bbb.go
@ -414,6 +414,10 @@ func (p *bbbPWMPin) SetDuty(ns int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *bbbPWMPin) SetMicroseconds(us int) error {
|
func (p *bbbPWMPin) SetMicroseconds(us int) error {
|
||||||
|
if err := p.init(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if p.period != 20000000 {
|
if p.period != 20000000 {
|
||||||
glog.Warningf("embd: pwm pin %v has freq %v hz. recommended 50 hz for servo mode", 1000000000/p.period)
|
glog.Warningf("embd: pwm pin %v has freq %v hz. recommended 50 hz for servo mode", 1000000000/p.period)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user