1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 12:50:19 +01:00

l3gd20: added a stop method

This commit is contained in:
Karan Misra 2014-01-08 19:43:56 +05:30
parent f6ed134486
commit b96018021e

View File

@ -370,12 +370,20 @@ func (d *L3GD20) Start() (err error) {
return return
} }
// Close. func (d *L3GD20) Stop() (err error) {
func (d *L3GD20) Close() (err error) {
if d.closing != nil { if d.closing != nil {
waitc := make(chan struct{}) waitc := make(chan struct{})
d.closing <- waitc d.closing <- waitc
<-waitc <-waitc
} }
return d.Bus.WriteByteToReg(address, ctrlReg1, ctrlReg1Finished) if err = d.Bus.WriteByteToReg(address, ctrlReg1, ctrlReg1Finished); err != nil {
return
}
d.initialized = false
return
}
// Close.
func (d *L3GD20) Close() (err error) {
return d.Stop()
} }