forked from espressif/arduino-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathESP_SR.h
38 lines (29 loc) · 1000 Bytes
/
ESP_SR.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#pragma once
#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32S3 && (CONFIG_USE_WAKENET || CONFIG_USE_MULTINET)
#include "ESP_I2S.h"
#include "esp32-hal-sr.h"
typedef void (*sr_cb)(sr_event_t event, int command_id, int phrase_id);
class ESP_SR_Class {
private:
sr_cb cb;
I2SClass * i2s;
public:
ESP_SR_Class();
~ESP_SR_Class();
void onEvent(sr_cb cb);
bool begin(I2SClass & i2s, const sr_cmd_t * sr_commands, size_t sr_commands_len, sr_channels_t rx_chan=SR_CHANNELS_STEREO, sr_mode_t mode=SR_MODE_WAKEWORD);
bool end(void);
bool setMode(sr_mode_t mode);
bool pause(void);
bool resume(void);
void _sr_event(sr_event_t event, int command_id, int phrase_id);
esp_err_t _fill(void * out, size_t len, size_t *bytes_read, uint32_t timeout_ms);
};
extern ESP_SR_Class ESP_SR;
#endif // CONFIG_IDF_TARGET_ESP32S3