Skip to content

Commit 5b2c2f8

Browse files
baw-michaeldeadprogram
authored andcommitted
vl53l1x: Add getter for the effective SPAD count
Implement function to get the effective SPAD count. Signed-off-by: Michael Meister <[email protected]>
1 parent 0ec887c commit 5b2c2f8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

vl53l1x/vl53l1x.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ type DistanceMode uint8
1919
type RangeStatus uint8
2020

2121
type rangingData struct {
22-
mm uint16
23-
status RangeStatus
24-
signalRateMCPS int32 //MCPS : Mega Count Per Second
25-
ambientRateMCPS int32
22+
mm uint16
23+
status RangeStatus
24+
signalRateMCPS int32 //MCPS : Mega Count Per Second
25+
ambientRateMCPS int32
26+
effectiveSPADCount uint16
2627
}
2728

2829
type resultBuffer struct {
@@ -337,6 +338,11 @@ func (d *Device) AmbientRate() int32 {
337338
return d.rangingData.ambientRateMCPS
338339
}
339340

341+
// EffectiveSPADCount returns the effective number of SPADs
342+
func (d *Device) EffectiveSPADCount() uint16 {
343+
return d.rangingData.effectiveSPADCount
344+
}
345+
340346
// getRangingData stores in the buffer the ranging data
341347
func (d *Device) getRangingData() {
342348
d.rangingData.mm = uint16((uint32(d.results.mmCrosstalkSD0)*2011 + 0x0400) / 0x0800)
@@ -384,6 +390,7 @@ func (d *Device) getRangingData() {
384390

385391
d.rangingData.signalRateMCPS = 1000000 * int32(d.results.signalRateCrosstalkMCPSSD0) / (1 << 7)
386392
d.rangingData.ambientRateMCPS = 1000000 * int32(d.results.ambientRateMCPSSD0) / (1 << 7)
393+
d.rangingData.effectiveSPADCount = d.results.effectiveSPADCount
387394
}
388395

389396
// setupManualCalibration configures the manual calibration

0 commit comments

Comments
 (0)