Arduino AudioKit HAL
board_pins_config.h
1 /*
2  * ESPRESSIF MIT License
3  *
4  * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD>
5  *
6  * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #pragma once
26 
27 #ifdef ESP32
28 
29 #include "driver/i2c.h"
30 #include "driver/i2s.h"
31 #include "driver/spi_common.h"
32 #include "driver/spi_master.h"
33 #include "driver/spi_slave.h"
34 
35 #else
36 
37 #include "audio_gpio.h"
38 
39 #endif
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * @brief Get i2c pins configuration
47  *
48  * @param port i2c port number to get configuration
49  * @param i2c_config i2c configuration parameters
50  *
51  * @return
52  * - ESP_OK
53  * - ESP_FAIL
54  */
55 esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config);
56 
57 /**
58  * @brief Get i2s pins configuration
59  *
60  * @param port i2s port number to get configuration
61  * @param i2s_config i2s configuration parameters
62  *
63  * @return
64  * - ESP_OK
65  * - ESP_FAIL
66  */
67 esp_err_t get_i2s_pins(i2s_port_t port, i2s_pin_config_t *i2s_config);
68 
69 /**
70  * @brief Get spi pins configuration
71  *
72  * @param spi_config spi bus configuration parameters
73  * @param spi_device_interface_config spi device configuration parameters
74  *
75  * @return
76  * - ESP_OK
77  * - ESP_FAIL
78  */
79 esp_err_t get_spi_pins(spi_bus_config_t *spi_config, spi_device_interface_config_t *spi_device_interface_config);
80 
81 /**
82  * @brief Set i2s mclk output pin
83  *
84  * @note GPIO1 and GPIO3 default are UART pins.
85  *
86  * @param i2s_num i2s port index
87  * @param gpio_num gpio number index, only support GPIO0, GPIO1 and GPIO3.
88 
89  * @return
90  * - ESP_OK Success
91  * - ESP_ERR_INVALID_ARG Parameter error
92  * - ESP_ERR_INVALID_STATE Driver state error
93  * - ESP_ERR_ADF_NOT_SUPPORT Not support
94  */
95 esp_err_t i2s_mclk_gpio_select(i2s_port_t i2s_num, gpio_num_t gpio_num);
96 
97 /**
98  * @brief Get the gpio number for sdcard interrupt
99  *
100  * @return -1 non-existent
101  * Others sdcard interrupt gpio number
102  */
103 int8_t get_sdcard_intr_gpio(void);
104 
105 /**
106  * @brief Get sdcard maximum number of open files
107  *
108  * @return -1 error
109  * Others max num
110  */
111 int8_t get_sdcard_open_file_num_max(void);
112 
113 /**
114  * @brief Get the gpio number for auxin detection
115  *
116  * @return -1 non-existent
117  * Others gpio number
118  */
119 int8_t get_auxin_detect_gpio(void);
120 
121 /**
122  * @brief Get the gpio number for headphone detection
123  *
124  * @return -1 non-existent
125  * Others gpio number
126  */
127 int8_t get_headphone_detect_gpio(void);
128 
129 /**
130  * @brief Get the gpio number for PA enable
131  *
132  * @return -1 non-existent
133  * Others gpio number
134  */
135 int8_t get_pa_enable_gpio(void);
136 
137 /**
138  * @brief Get the gpio number for adc detection
139  *
140  * @return -1 non-existent
141  * Others gpio number
142  */
143 int8_t get_adc_detect_gpio(void);
144 
145 /**
146  * @brief Get the mclk gpio number of es7243
147  *
148  * @return -1 non-existent
149  * Others gpio number
150  */
151 int8_t get_es7243_mclk_gpio(void);
152 
153 /**
154  * @brief Get the record-button id for adc-button
155  *
156  * @return -1 non-existent
157  * Others button id
158  */
159 int8_t get_input_rec_id(void);
160 
161 /**
162  * @brief Get the number for mode-button
163  *
164  * @return -1 non-existent
165  * Others number
166  */
167 int8_t get_input_mode_id(void);
168 
169 /**
170  * @brief Get number for set function
171  *
172  * @return -1 non-existent
173  * Others number
174  */
175 int8_t get_input_set_id(void);
176 
177 /**
178  * @brief Get number for play function
179  *
180  * @return -1 non-existent
181  * Others number
182  */
183 int8_t get_input_play_id(void);
184 
185 /**
186  * @brief number for volume up function
187  *
188  * @return -1 non-existent
189  * Others number
190  */
191 int8_t get_input_volup_id(void);
192 
193 /**
194  * @brief Get number for volume down function
195  *
196  * @return -1 non-existent
197  * Others number
198  */
199 int8_t get_input_voldown_id(void);
200 
201 /**
202  * @brief Get green led gpio number
203  *
204  * @return -1 non-existent
205  * Others gpio number
206  */
207 int8_t get_reset_codec_gpio(void);
208 
209 /**
210  * @brief Get DSP reset gpio number
211  *
212  * @return -1 non-existent
213  * Others gpio number
214  */
215 int8_t get_reset_board_gpio(void);
216 
217 /**
218  * @brief Get DSP reset gpio number
219  *
220  * @return -1 non-existent
221  * Others gpio number
222  */
223 int8_t get_green_led_gpio(void);
224 
225 /**
226  * @brief Get green led gpio number
227  *
228  * @return -1 non-existent
229  * Others gpio number
230  */
231 int8_t get_blue_led_gpio(void);
232 
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 
GPIO related functionality.
gpio_num_t
Definition: audio_gpio.h:39
I2C pins.
Definition: audio_gpio.h:102
SPI device configuration.
Definition: audio_gpio.h:140