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:
Michael Meister
2022-10-27 08:49:39 +02:00
committed by Ron Evans
parent 0ec887c9d8
commit 5b2c2f800d
+7
View File
@@ -23,6 +23,7 @@ type rangingData struct {
status RangeStatus
signalRateMCPS int32 //MCPS : Mega Count Per Second
ambientRateMCPS int32
effectiveSPADCount uint16
}
type resultBuffer struct {
@@ -337,6 +338,11 @@ func (d *Device) AmbientRate() int32 {
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
func (d *Device) getRangingData() {
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.ambientRateMCPS = 1000000 * int32(d.results.ambientRateMCPSSD0) / (1 << 7)
d.rangingData.effectiveSPADCount = d.results.effectiveSPADCount
}
// setupManualCalibration configures the manual calibration