-
Notifications
You must be signed in to change notification settings - Fork 673
/
zl38063.h
119 lines (110 loc) · 3.17 KB
/
zl38063.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2018 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case,
* it is free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __ZL38063_H__
#define __ZL38063_H__
#include "audio_hal.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize ZL38063 chip
*
* @param cfg configuration of ZL38063
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t zl38063_codec_init(audio_hal_codec_config_t *cfg);
/**
* @brief Deinitialize ZL38063 chip
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t zl38063_codec_deinit(void);
/**
* The functions zl38063_ctrl_state and zl38063_config_i2s are not used by this driver.
* They are kept here to maintain the uniformity and convenience of the interface
* of the ADF project.
* These settings for zl38063 are burned in firmware and configuration files.
* Default i2s configuration: 48000Hz, 16bit, Left-Right channels.
* Use resampling to be compatible with different file types.
*
* @brief Control ZL38063 chip
*
* @param mode codec mode
* @param ctrl_state start or stop decode or encode progress
*
* @return
* - ESP_FAIL Parameter error
* - ESP_OK Success
*/
esp_err_t zl38063_codec_ctrl_state(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state);
/**
* @brief Configure ZL38063 codec mode and I2S interface
*
* @param mode codec mode
* @param iface I2S config
*
* @return
* - ESP_FAIL Parameter error
* - ESP_OK Success
*/
esp_err_t zl38063_codec_config_i2s(audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface);
/**
* @brief mute or unmute the codec
*
* @param mute: true, false
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t zl38063_codec_set_voice_mute(bool mute);
/**
* @brief Set voice volume
*
* @param volume: voice volume (0~100)
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t zl38063_codec_set_voice_volume(int volume);
/**
* @brief Get voice volume
*
* @param[out] *volume: voice volume (0~100)
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t zl38063_codec_get_voice_volume(int *volume);
#ifdef __cplusplus
}
#endif
#endif