Skip to content

Commit a8a5e39

Browse files
authored
Merge pull request #39 from iZhangHui/master
fix issue #38
2 parents 4fad772 + 9b2f110 commit a8a5e39

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

libraries/SD/src/utility/Sd2Card.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,9 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
252252
uint32_t arg;
253253

254254
// set pin modes
255-
//#ifdef BOARD_SIPEED_MAIXDUINO
256-
int gpionum = get_gpio(chipSelectPin_);
257-
if(gpionum >= 0){
258-
fpioa_function_t function = fpioa_function_t(FUNC_GPIOHS0 + gpionum);
259-
fpioa_set_function(chipSelectPin_, function);
260-
gpiohs_set_drive_mode((uint8_t)gpionum, GPIO_DM_OUTPUT);
261-
gpiohs_set_pin((uint8_t)gpionum, GPIO_PV_HIGH);
262-
}
263-
//#else
264-
// pinMode(chipSelectPin_, OUTPUT);
265-
// digitalWrite(chipSelectPin_, HIGH);
266-
//#endif
255+
pinMode(chipSelectPin_, OUTPUT);
256+
digitalWrite(chipSelectPin_, HIGH);
257+
267258
#ifndef USE_SPI_LIB
268259
pinMode(SPI_MISO_PIN, INPUT);
269260
pinMode(SPI_MOSI_PIN, OUTPUT);

variants/sipeed_maixduino/pins_arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ typedef struct _pwm_fpio_set_t{
7171
uint8_t inuse;
7272
}pwm_fpio_set_t;
7373

74-
#define MD_PIN_MAP(fpio) _maixduino_pin_map[(fpio)]
74+
#define MD_PIN_MAP(fpio) (((fpio) < 17) ? _maixduino_pin_map[(fpio)] : (fpio))
7575

7676
static const uint8_t _maixduino_pin_map[17] = {4, 5, 21, 22, 23, 24, 32, 15, 14, 13, 12, 11, 10, 3, 31, 30, 16};
7777

0 commit comments

Comments
 (0)