Arduino AudioKit HAL
periph_sdcard.h
1 /*
2  * ESPRESSIF MIT License
3  *
4  * Copyright (c) 2018 <ESPRESSIF SYSTEMS (SHANGHAI) PTE 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 #ifndef _SDCARD_DEV_H_
26 #define _SDCARD_DEV_H_
27 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 
34 /**
35  * @brief SD card mode, SPI, 1-line SD mode, 4-line SD mode
36  *
37  */
38 typedef enum {
39  SD_MODE_SPI = 0x0, /*!< sd_card SPI*/
40  SD_MODE_1_LINE = 0x1, /*!< sd_card 1-line SD mode*/
41  SD_MODE_4_LINE = 0x2, /*!< sd_card 4-line SD mode*/
42  SD_MODE_MAX,
43 } periph_sdcard_mode_t;
44 
45 /**
46  * @brief The SD Card Peripheral configuration
47  */
48 typedef struct {
49  int card_detect_pin; /*!< Card detect gpio number */
50  const char* root; /*!< Base path for vfs */
51  periph_sdcard_mode_t mode; /*!< card mode*/
53 
54 
55 /**
56  * @brief DUMMY Definition - not used
57  *
58  */
59 
60 typedef void* esp_periph_handle_t;
61 
62 
63 /**
64  * @brief Create the sdcard peripheral handle for esp_peripherals
65  *
66  * @note The handle was created by this function automatically destroy when `esp_periph_destroy` is called
67  *
68  * @param sdcard_config The sdcard configuration
69  *
70  * @return The esp peripheral handle
71  */
72 esp_periph_handle_t periph_sdcard_init(periph_sdcard_cfg_t* sdcard_config);
73 
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif
The SD Card Peripheral configuration.
Definition: periph_sdcard.h:48
const char * root
Definition: periph_sdcard.h:50
periph_sdcard_mode_t mode
Definition: periph_sdcard.h:51