mraa: change all existing code to use libmraa.

* Made CMake depend on 0.4 libmraa

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-06-25 10:05:27 +01:00
parent 8d25ecacdd
commit 36be22cb90
53 changed files with 640 additions and 640 deletions

View File

@ -33,17 +33,17 @@ using namespace upm;
Microphone::Microphone(int micPin) {
// initialise analog mic input
m_micCtx = maa_aio_init(micPin);
m_micCtx = mraa_aio_init(micPin);
}
Microphone::~Microphone() {
// close analog input
maa_result_t error;
error = maa_aio_close(m_micCtx);
if (error != MAA_SUCCESS) {
maa_result_print(error);
mraa_result_t error;
error = mraa_aio_close(m_micCtx);
if (error != MRAA_SUCCESS) {
mraa_result_print(error);
}
}
@ -63,7 +63,7 @@ Microphone::getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples,
}
while (sampleIdx < numberOfSamples) {
buffer[sampleIdx++] = maa_aio_read (m_micCtx);
buffer[sampleIdx++] = mraa_aio_read (m_micCtx);
usleep(freqMS * 1000);
}

View File

@ -24,8 +24,8 @@
#pragma once
#include <string>
#include <maa/gpio.h>
#include <maa/aio.h>
#include <mraa/gpio.h>
#include <mraa/aio.h>
struct thresholdContext {
long averageReading;
@ -80,7 +80,7 @@ class Microphone {
void printGraph (thresholdContext* ctx);
private:
maa_aio_context m_micCtx;
mraa_aio_context m_micCtx;
};
}