Arduino TKJHAT
Arduino library for Pico HAT extension board
Loading...
Searching...
No Matches
Microphone.h
1#ifndef TKJHAT_MICROPHONE_H
2#define TKJHAT_MICROPHONE_H
3
4#include <Arduino.h>
5
25
26extern "C" {
27#include "microphone/pico/pdm_microphone.h"
28}
29
31private:
32 uint8_t dataPin;
33 uint8_t clkPin;
34
35public:
36
41
42 Microphone(uint8_t dataPin, uint8_t clkPin);
43
62
63 int begin();
64
68 int start();
69
73 void stop();
74
80 void setCallback(pdm_samples_ready_handler_t handler);
81
88 int getSamples(int16_t* buffer, size_t samples);
89};
90
91#endif
Microphone(uint8_t dataPin, uint8_t clkPin)
Construct a new Microphone object.
int start()
Start capturing audio samples.
int begin()
Initialize the PDM MEMS microphone.
void setCallback(pdm_samples_ready_handler_t handler)
Set a callback function to be called when new samples are ready.
int getSamples(int16_t *buffer, size_t samples)
Read PCM samples from the microphone buffer.
void stop()
Stop capturing audio samples.