1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 04:40:04 +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
}
// Close.
func (d *L3GD20) Close() (err error) {
func (d *L3GD20) Stop() (err error) {
if d.closing != nil {
waitc := make(chan struct{})
d.closing <- 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()
}