mirror of
https://github.com/sipeed/Maixduino.git
synced 2026-03-03 09:04:00 +01:00
fix bug of SD init failed
This commit is contained in:
@@ -252,18 +252,9 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
|
||||
uint32_t arg;
|
||||
|
||||
// set pin modes
|
||||
//#ifdef BOARD_SIPEED_MAIXDUINO
|
||||
int gpionum = get_gpio(chipSelectPin_);
|
||||
if(gpionum >= 0){
|
||||
fpioa_function_t function = fpioa_function_t(FUNC_GPIOHS0 + gpionum);
|
||||
fpioa_set_function(chipSelectPin_, function);
|
||||
gpiohs_set_drive_mode((uint8_t)gpionum, GPIO_DM_OUTPUT);
|
||||
gpiohs_set_pin((uint8_t)gpionum, GPIO_PV_HIGH);
|
||||
}
|
||||
//#else
|
||||
// pinMode(chipSelectPin_, OUTPUT);
|
||||
// digitalWrite(chipSelectPin_, HIGH);
|
||||
//#endif
|
||||
pinMode(chipSelectPin_, OUTPUT);
|
||||
digitalWrite(chipSelectPin_, HIGH);
|
||||
|
||||
#ifndef USE_SPI_LIB
|
||||
pinMode(SPI_MISO_PIN, INPUT);
|
||||
pinMode(SPI_MOSI_PIN, OUTPUT);
|
||||
|
||||
Reference in New Issue
Block a user