bbb: initialise at the start of SetMicroseconds

this will setup p.period to the default if not already done
This commit is contained in:
Kunal Powar 2014-04-05 01:44:02 +05:30
parent 779096e668
commit 6cfe268ada
1 changed files with 4 additions and 0 deletions

4
bbb.go
View File

@ -414,6 +414,10 @@ func (p *bbbPWMPin) SetDuty(ns int) error {
}
func (p *bbbPWMPin) SetMicroseconds(us int) error {
if err := p.init(); err != nil {
return err
}
if p.period != 20000000 {
glog.Warningf("embd: pwm pin %v has freq %v hz. recommended 50 hz for servo mode", 1000000000/p.period)
}