upm
0.1.8
Sensor/Actuator repository for libmraa (v0.4.5)
|
C++ API for Microphone. More...
This file defines the Microphone Analog sensor
Public Member Functions | |
Microphone (int micPin) | |
~Microphone () | |
int | getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples, uint16_t *buffer) |
int | findThreshold (thresholdContext *ctx, unsigned int threshold, uint16_t *buffer, unsigned int len) |
void | printGraph (thresholdContext *ctx) |
Microphone | ( | int | micPin | ) |
Instanciates a Microphone object
micPin | pin where microphone is connected |
~Microphone | ( | ) |
MAX31723 object destructor
int getSampledWindow | ( | unsigned int | freqMS, |
unsigned int | numberOfSamples, | ||
uint16_t * | buffer | ||
) |
Get samples from microphone according to provided window and number of samples
freqMS | time between each sample (in microseconds) |
numberOfSamples | number of sample to sample for this window |
buffer | bufer with sampled data |
int findThreshold | ( | thresholdContext * | ctx, |
unsigned int | threshold, | ||
uint16_t * | buffer, | ||
unsigned int | len | ||
) |
Given sampled buffer this method will return TRUE/FALSE if threshold was reached
ctx | threshold context |
threshold | sample threshold |
buffer | buffer with samples |
len | bufer len |
void printGraph | ( | thresholdContext * | ctx | ) |
Print running average of threshold context
ctx | threshold context |