Skip to content
Snippets Groups Projects
Commit 63eb78df authored by Fabrizio Monti's avatar Fabrizio Monti
Browse files

[VN100-SPI] Added self test.

parent 50000396
No related branches found
No related tags found
No related merge requests found
Pipeline #7924 passed
...@@ -104,7 +104,13 @@ void VN100Spi::sendDummyPacket() ...@@ -104,7 +104,13 @@ void VN100Spi::sendDummyPacket()
bool VN100Spi::selfTest() bool VN100Spi::selfTest()
{ {
// TODO D(assert(isInit && "init() was not called"));
if (!checkModelNumber())
{
lastError = SensorErrors::SELF_TEST_FAIL;
return false;
}
return true; return true;
} }
......
...@@ -60,9 +60,15 @@ int main() ...@@ -60,9 +60,15 @@ int main()
} }
printf("Sensor initialized\n"); printf("Sensor initialized\n");
if (!sensor.selfTest())
{
printf("Error while performing self test\n\n");
return 0;
}
printf("Self test successful\n");
for (int i = 0; i < 100; ++i) for (int i = 0; i < 100; ++i)
{ {
// AccelerometerData data = sensor.readAcc();
sensor.sample(); sensor.sample();
VN100Data sample = sensor.getLastSample(); VN100Data sample = sensor.getLastSample();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment