mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-20 14:39:00 +00:00
vl53l1x: Add getter for the effective SPAD count
Implement function to get the effective SPAD count. Signed-off-by: Michael Meister <michael.meister@bytesatwork.ch>
This commit is contained in:
committed by
Ron Evans
parent
0ec887c9d8
commit
5b2c2f800d
+11
-4
@@ -19,10 +19,11 @@ type DistanceMode uint8
|
|||||||
type RangeStatus uint8
|
type RangeStatus uint8
|
||||||
|
|
||||||
type rangingData struct {
|
type rangingData struct {
|
||||||
mm uint16
|
mm uint16
|
||||||
status RangeStatus
|
status RangeStatus
|
||||||
signalRateMCPS int32 //MCPS : Mega Count Per Second
|
signalRateMCPS int32 //MCPS : Mega Count Per Second
|
||||||
ambientRateMCPS int32
|
ambientRateMCPS int32
|
||||||
|
effectiveSPADCount uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type resultBuffer struct {
|
type resultBuffer struct {
|
||||||
@@ -337,6 +338,11 @@ func (d *Device) AmbientRate() int32 {
|
|||||||
return d.rangingData.ambientRateMCPS
|
return d.rangingData.ambientRateMCPS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EffectiveSPADCount returns the effective number of SPADs
|
||||||
|
func (d *Device) EffectiveSPADCount() uint16 {
|
||||||
|
return d.rangingData.effectiveSPADCount
|
||||||
|
}
|
||||||
|
|
||||||
// getRangingData stores in the buffer the ranging data
|
// getRangingData stores in the buffer the ranging data
|
||||||
func (d *Device) getRangingData() {
|
func (d *Device) getRangingData() {
|
||||||
d.rangingData.mm = uint16((uint32(d.results.mmCrosstalkSD0)*2011 + 0x0400) / 0x0800)
|
d.rangingData.mm = uint16((uint32(d.results.mmCrosstalkSD0)*2011 + 0x0400) / 0x0800)
|
||||||
@@ -384,6 +390,7 @@ func (d *Device) getRangingData() {
|
|||||||
|
|
||||||
d.rangingData.signalRateMCPS = 1000000 * int32(d.results.signalRateCrosstalkMCPSSD0) / (1 << 7)
|
d.rangingData.signalRateMCPS = 1000000 * int32(d.results.signalRateCrosstalkMCPSSD0) / (1 << 7)
|
||||||
d.rangingData.ambientRateMCPS = 1000000 * int32(d.results.ambientRateMCPSSD0) / (1 << 7)
|
d.rangingData.ambientRateMCPS = 1000000 * int32(d.results.ambientRateMCPSSD0) / (1 << 7)
|
||||||
|
d.rangingData.effectiveSPADCount = d.results.effectiveSPADCount
|
||||||
}
|
}
|
||||||
|
|
||||||
// setupManualCalibration configures the manual calibration
|
// setupManualCalibration configures the manual calibration
|
||||||
|
|||||||
Reference in New Issue
Block a user