sdcard code sanitizations
This commit is contained in:
		
							parent
							
								
									46cc027ee4
								
							
						
					
					
						commit
						5dd5c481ad
					
				| @ -15,7 +15,9 @@ | |||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifdef HAS_SDS011 | ||||||
| #include "sds011read.h" | #include "sds011read.h" | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef SDCARD_CS | #ifndef SDCARD_CS | ||||||
| #define SDCARD_CS SS | #define SDCARD_CS SS | ||||||
|  | |||||||
| @ -1,12 +1,12 @@ | |||||||
| // routines for writing data to an SD-card, if present
 | // routines for writing data to an SD-card, if present
 | ||||||
| 
 | 
 | ||||||
| #if (HAS_SDCARD) |  | ||||||
| 
 |  | ||||||
| // Local logging tag
 | // Local logging tag
 | ||||||
| static const char TAG[] = __FILE__; | static const char TAG[] = __FILE__; | ||||||
| 
 | 
 | ||||||
| #include "sdcard.h" | #include "sdcard.h" | ||||||
| 
 | 
 | ||||||
|  | #ifdef HAS_SDCARD | ||||||
|  | 
 | ||||||
| static bool useSDCard; | static bool useSDCard; | ||||||
| 
 | 
 | ||||||
| File fileSDCard; | File fileSDCard; | ||||||
| @ -14,10 +14,13 @@ File fileSDCard; | |||||||
| bool sdcard_init() { | bool sdcard_init() { | ||||||
|   ESP_LOGI(TAG, "looking for SD-card..."); |   ESP_LOGI(TAG, "looking for SD-card..."); | ||||||
| 
 | 
 | ||||||
| #if HAS_SDCARD == 1 |   // for usage of SD drivers on ESP32 platform see
 | ||||||
|   pinMode(SDCARD_CS, OUTPUT); |   // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdspi_host.html
 | ||||||
|  |   // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/sdmmc_host.html
 | ||||||
|  | 
 | ||||||
|  | #if HAS_SDCARD == 1 // use SD SPI host driver
 | ||||||
|   useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK); |   useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK); | ||||||
| #elif HAS_SDCARD == 2 | #elif HAS_SDCARD == 2 // use SD MMC host driver
 | ||||||
|   useSDCard = SD_MMC.begin(); |   useSDCard = SD_MMC.begin(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user