This is a combination of 2 commits.

aio: mraa_aio_read (v1.0.0) can now return -1, treat that in sensors using it

Adds alot of exceptions if the aio read goes wrong

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Brendan Le Foll
2016-04-25 14:29:41 +01:00
committed by Noel Eck
parent f6816797bb
commit e51c5f3018
17 changed files with 64 additions and 11 deletions

View File

@ -69,7 +69,11 @@ Microphone::getSampledWindow (unsigned int freqMS, int numberOfSamples,
}
while (sampleIdx < numberOfSamples) {
buffer[sampleIdx++] = mraa_aio_read (m_micCtx);
int x = mraa_aio_read (m_micCtx);
if (x == -1) {
return 0;
}
buffer[sampleIdx++] = x;
usleep(freqMS * 1000);
}