mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
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:
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user