79
79
static heap_trace_record_t trace_record[NUM_RECORDS]; // This buffer must be in internal RAM
80
80
#endif
81
81
82
- extern const char * GIT_TAG;
83
- extern const char * GIT_REV;
84
- extern const char * GIT_BRANCH;
85
- extern const char * BUILD_TIME;
82
+ extern const char * GIT_TAG;
83
+ extern const char * GIT_REV;
84
+ extern const char * GIT_BRANCH;
85
+ extern const char * BUILD_TIME;
86
86
87
87
extern std::string getFwVersion (void );
88
88
extern std::string getHTMLversion (void );
@@ -109,27 +109,51 @@ bool Init_NVS_SDCard()
109
109
sdmmc_host_t host = SDMMC_HOST_DEFAULT ();
110
110
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
111
111
112
+ // For SoCs where the SD power can be supplied both via an internal or external (e.g. on-board LDO) power supply.
113
+ // When using specific IO pins (which can be used for ultra high-speed SDMMC) to connect to the SD card
114
+ // and the internal LDO power supply, we need to initialize the power supply first.
115
+ #if SD_PWR_CTRL_LDO_INTERNAL_IO
116
+ sd_pwr_ctrl_ldo_config_t ldo_config = {
117
+ .ldo_chan_id = CONFIG_EXAMPLE_SD_PWR_CTRL_LDO_IO_ID,
118
+ };
119
+ sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL ;
120
+
121
+ ret = sd_pwr_ctrl_new_on_chip_ldo (&ldo_config, &pwr_ctrl_handle);
122
+ if (ret != ESP_OK)
123
+ {
124
+ ESP_LOGE (TAG, " Failed to create a new on-chip LDO power control driver" );
125
+ return ret;
126
+ }
127
+ host.pwr_ctrl_handle = pwr_ctrl_handle;
128
+ #endif
129
+
112
130
// This initializes the slot without card detect (CD) and write protect (WP) signals.
113
131
// Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.
132
+ #ifdef CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
133
+ sdmmc_slot_config_t slot_config = {
134
+ .cd = SDMMC_SLOT_NO_CD,
135
+ .wp = SDMMC_SLOT_NO_WP,
136
+ };
137
+ #else
114
138
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT ();
139
+ #endif
115
140
116
141
// Set bus width to use:
117
142
#ifdef __SD_USE_ONE_LINE_MODE__
118
143
slot_config.width = 1 ;
119
- #ifdef SOC_SDMMC_USE_GPIO_MATRIX
144
+ #ifdef CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
120
145
slot_config.clk = GPIO_SDCARD_CLK;
121
146
slot_config.cmd = GPIO_SDCARD_CMD;
122
147
slot_config.d0 = GPIO_SDCARD_D0;
123
- #endif
124
-
125
- #else
148
+ #endif // end CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
149
+ #else // else __SD_USE_ONE_LINE_MODE__
126
150
slot_config.width = 4 ;
127
- #ifdef SOC_SDMMC_USE_GPIO_MATRIX
151
+ #ifdef CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
128
152
slot_config.d1 = GPIO_SDCARD_D1;
129
153
slot_config.d2 = GPIO_SDCARD_D2;
130
154
slot_config.d3 = GPIO_SDCARD_D3;
131
- #endif
132
- #endif
155
+ #endif // end CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
156
+ #endif // end __SD_USE_ONE_LINE_MODE__
133
157
134
158
// Enable internal pullups on enabled pins. The internal pullups
135
159
// are insufficient however, please make sure 10k external pullups are
@@ -350,6 +374,12 @@ extern "C" void app_main(void)
350
374
// ********************************************
351
375
setupTime (); // NTP time service: Status of time synchronization will be checked after every round (server_tflite.cpp)
352
376
377
+ // Init SOC temperature sensor (if supported by hardware)
378
+ // ********************************************
379
+ #if defined(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
380
+ initTemperatureSensor ();
381
+ #endif
382
+
353
383
// Set CPU Frequency
354
384
// ********************************************
355
385
setCpuFrequency ();
0 commit comments