Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void setup()
}

// Start the sensor with default register values
int32_t setupError = radarSensor.presenceDetectorStart(MY_XM125_RANGE_START, MY_XM125_RANGE_END);
int32_t setupError = radarSensor.detectorStart(MY_XM125_RANGE_START, MY_XM125_RANGE_END);
if (setupError != 0)
{
Serial.print("Presence Detection Start Setup Error: ");
Expand All @@ -84,11 +84,11 @@ void setup()
void loop()
{
// Busy wait loop until data is ready
radarSensor.presenceBusyWait();
radarSensor.busyWait();

// Get the presence distance value and print out if no errors.
// Note - this returns if Presense is detected now, or since last check (sticky)
presValError = radarSensor.getPresenceDistanceValuemm(distance);
// Note - this returns if Presence is detected now, or since last check (sticky)
presValError = radarSensor.getDistanceValuemm(distance);

if (presValError == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ void setup()

// Presence Sensor Setup
// Reset sensor configuration to reapply configuration registers
radarSensor.setPresenceCommand(SFE_XM125_PRESENCE_RESET_MODULE);
radarSensor.setCommand(SFE_XM125_PRESENCE_RESET_MODULE);

// Check error and busy bits
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Expand All @@ -83,19 +83,19 @@ void setup()
delay(100);

// Turn presence detection on GPIO0 on
if (radarSensor.setPresenceDetectionOnGPIO(1) != 0)
if (radarSensor.setDetectionOnGPIO(1) != 0)
{
Serial.println("GPIO0 Pin Setup Error");
}
radarSensor.getPresenceDetectionOnGPIO(gpioUsage);
radarSensor.getDetectionOnGPIO(gpioUsage);
Serial.print("GPIO0 Detection Status: ");
Serial.println(gpioUsage);

// Apply configuration
if (radarSensor.setPresenceCommand(SFE_XM125_PRESENCE_APPLY_CONFIGURATION) != 0)
if (radarSensor.setCommand(SFE_XM125_PRESENCE_APPLY_CONFIGURATION) != 0)
{
// Check for errors
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Expand All @@ -106,13 +106,13 @@ void setup()
}

// Poll detector status until busy bit is cleared
if (radarSensor.presenceBusyWait() != 0)
if (radarSensor.busyWait() != 0)
{
Serial.print("Busy wait error");
}

// Check detector status
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Expand All @@ -127,10 +127,10 @@ void setup()
void loop()
{
// Busy wait loop until data is ready
radarSensor.presenceBusyWait();
radarSensor.busyWait();

// Get the presence distance value and print out if no errors
presValError = radarSensor.getPresenceDistanceValuemm(distance);
presValError = radarSensor.getDistanceValuemm(distance);

if (presValError == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void setup()
delay(200);

// Start the sensor with default register values
int32_t setupError = radarSensor.presenceDetectorStart();
int32_t setupError = radarSensor.detectorStart();
if (setupError != 0)
{
Serial.print("Presence Detection Start Setup Error: ");
Expand All @@ -83,14 +83,14 @@ void setup()
void loop()
{
// Busy wait loop until data is ready
radarSensor.presenceBusyWait();
radarSensor.busyWait();

// Get the presence distance value and print out if no errors
presValError = radarSensor.getPresenceDistanceValuemm(distance);
presValError = radarSensor.getDistanceValuemm(distance);

if (presValError == 0)
{
radarSensor.getPresenceDistance(distance);
radarSensor.getDistance(distance);
Serial.println(distance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void setup()
delay(200);

// Start the sensor with default register values
int32_t setupError = radarSensor.presenceDetectorStart();
int32_t setupError = radarSensor.detectorStart();
if (setupError != 0)
{
Serial.print("Presence Detection Start Setup Error: ");
Expand All @@ -84,46 +84,46 @@ void setup()
void loop()
{
// Check error bits
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Serial.println(errorStatus);
}

// Start detector
if (radarSensor.setPresenceCommand(SFE_XM125_PRESENCE_START_DETECTOR) != 0)
if (radarSensor.setCommand(SFE_XM125_PRESENCE_START_DETECTOR) != 0)
{
Serial.println("Start detector error");
}

// Poll detector status until busy bit is cleared - CHECK ON THIS!
if (radarSensor.presenceBusyWait() != 0)
if (radarSensor.busyWait() != 0)
{
Serial.println("Busy wait error");
}

// Verify that no error bits are set in the detector status register
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Serial.println(errorStatus);
}

// Read detector result register and determine detection status
radarSensor.getPresenceDetectorPresenceDetected(presenceDetected);
radarSensor.getPresenceDetectorPresenceStickyDetected(presenceDetectedSticky);
radarSensor.getDetectorPresenceDetected(presenceDetected);
radarSensor.getDetectorPresenceStickyDetected(presenceDetectedSticky);

if ((presenceDetected == 1) || (presenceDetectedSticky == 1))
{
radarSensor.getPresenceDistance(distance);
radarSensor.getDistance(distance);
Serial.print("Presence Detected: ");
Serial.print(distance);
Serial.println("mm");

radarSensor.getPresenceIntraPresenceScore(intraScore);
radarSensor.getPresenceInterPresenceScore(interScore);
radarSensor.getIntraPresenceScore(intraScore);
radarSensor.getInterPresenceScore(interScore);

Serial.print("Intra-Presence Score: ");
Serial.println(intraScore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ void setup()

// *** Presence Sensor Setup ***
// Reset sensor configuration to reapply configuration registers
radarSensor.setPresenceCommand(SFE_XM125_PRESENCE_RESET_MODULE);
radarSensor.setCommand(SFE_XM125_PRESENCE_RESET_MODULE);

// Check error and busy bits
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Expand All @@ -85,30 +85,30 @@ void setup()
delay(100);

// Set Start register
if (radarSensor.setPresenceStart(beginReading) != 0)
if (radarSensor.setStart(beginReading) != 0)
{
Serial.println("Presence Start Error");
}
radarSensor.getPresenceStart(startVal);
radarSensor.getStart(startVal);
Serial.print("Start Val: ");
Serial.println(startVal);

delay(100);
// Set End register
if (radarSensor.setPresenceEnd(endReading) != 0)
if (radarSensor.setEnd(endReading) != 0)
{
Serial.println("Presence End Error");
}
radarSensor.getPresenceEnd(endVal);
radarSensor.getEnd(endVal);
Serial.print("End Val: ");
Serial.println(endVal);
delay(100);

// Apply configuration
if (radarSensor.setPresenceCommand(SFE_XM125_PRESENCE_APPLY_CONFIGURATION) != 0)
if (radarSensor.setCommand(SFE_XM125_PRESENCE_APPLY_CONFIGURATION) != 0)
{
// Check for errors
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Expand All @@ -119,13 +119,13 @@ void setup()
}

// Poll detector status until busy bit is cleared
if (radarSensor.presenceBusyWait() != 0)
if (radarSensor.busyWait() != 0)
{
Serial.print("Busy wait error");
}

// Check detector status
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Expand All @@ -140,40 +140,40 @@ void setup()
void loop()
{
// Check error bits
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Serial.println(errorStatus);
}

// Start detector
if (radarSensor.setPresenceCommand(SFE_XM125_PRESENCE_START_DETECTOR) != 0)
if (radarSensor.setCommand(SFE_XM125_PRESENCE_START_DETECTOR) != 0)
{
Serial.println("Start detector error");
}

// Poll detector status until busy bit is cleared - CHECK ON THIS!
if (radarSensor.presenceBusyWait() != 0)
if (radarSensor.busyWait() != 0)
{
Serial.println("Busy wait error");
}

// Verify that no error bits are set in the detector status register
radarSensor.getPresenceDetectorErrorStatus(errorStatus);
radarSensor.getDetectorErrorStatus(errorStatus);
if (errorStatus != 0)
{
Serial.print("Detector status error: ");
Serial.println(errorStatus);
}

// Read detector result register and determine detection status
radarSensor.getPresenceDetectorPresenceDetected(presenceDetected);
radarSensor.getPresenceDetectorPresenceStickyDetected(presenceDetectedSticky);
radarSensor.getDetectorPresenceDetected(presenceDetected);
radarSensor.getDetectorPresenceStickyDetected(presenceDetectedSticky);

if ((presenceDetected == 1) | (presenceDetectedSticky == 1))
{
radarSensor.getPresenceDistance(distance);
radarSensor.getDistance(distance);
Serial.print("Presence Detected: ");
Serial.print(distance);
Serial.println("mm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void setup()
Serial.println("Starting Sensor...");
Serial.println();
// Start the sensor with the specified range values
int32_t setupError = radarSensor.distanceBegin(MY_XM125_RANGE_START, MY_XM125_RANGE_END);
int32_t setupError = radarSensor.distanceSetup(MY_XM125_RANGE_START, MY_XM125_RANGE_END);
if (setupError != 0)
{
Serial.print("Distance Detection Start Setup Error: ");
Expand All @@ -79,7 +79,7 @@ void setup()

void loop()
{
uint32_t retCode = radarSensor.distanceDetectorReadingSetup();
uint32_t retCode = radarSensor.detectorReadingSetup();
if (retCode != 0)
{
Serial.print("Distance Reading Setup Error: ");
Expand All @@ -88,7 +88,7 @@ void loop()

// How many distance values were detected? (0-9)
uint32_t numDistances = 0;
radarSensor.getDistanceNumberDistances(numDistances);
radarSensor.getNumberDistances(numDistances);

if (numDistances == 0)
Serial.print(".");
Expand All @@ -103,7 +103,7 @@ void loop()
int32_t distanceStrength = 0;
for (uint32_t i = 0; i < numDistances; i++)
{
if (radarSensor.getDistancePeakDistance(i, distance) != ksfTkErrOk)
if (radarSensor.getPeakDistance(i, distance) != ksfTkErrOk)
{
Serial.print("Error retrieving Distance Peak ");
Serial.print(i);
Expand All @@ -129,7 +129,7 @@ void loop()
Serial.print("m");
}

if (radarSensor.getDistancePeakStrength(i, distanceStrength) != ksfTkErrOk)
if (radarSensor.getPeakStrength(i, distanceStrength) != ksfTkErrOk)
{
Serial.print("Error retrieving Distance Peak Strength");
Serial.print(i);
Expand Down
Loading