upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
API for the Analog Microphone. More...
This module defines the Analog Microphone sensor
Public Member Functions | |
Microphone (int micPin) | |
~Microphone () | |
int | getSampledWindow (unsigned int freqMS, int numberOfSamples, uint16_t *buffer) |
int | findThreshold (thresholdContext *ctx, unsigned int threshold, uint16_t *buffer, int len) |
void | printGraph (thresholdContext *ctx) |
Microphone | ( | int | micPin | ) |
Instantiates a Microphone object
micPin | Pin where the microphone is connected |
~Microphone | ( | ) |
Microphone object destructor
int getSampledWindow | ( | unsigned int | freqMS, |
int | numberOfSamples, | ||
uint16_t * | buffer | ||
) |
Gets samples from the microphone according to the provided window and number of samples
freqMS | Time between each sample (in microseconds) |
numberOfSamples | Number of sample to sample for this window |
buffer | Buffer with sampled data |
int findThreshold | ( | thresholdContext * | ctx, |
unsigned int | threshold, | ||
uint16_t * | buffer, | ||
int | len | ||
) |
Given the sampled buffer, this method returns TRUE/FALSE if threshold is reached
ctx | Threshold context |
threshold | Sample threshold |
buffer | Buffer with samples |
len | Buffer length |
void printGraph | ( | thresholdContext * | ctx | ) |
Prints a running average of the threshold context
ctx | Threshold context |