Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SDVOL pullup control and definition #450

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pic32/libraries/DSDVOL/DSDVOL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ void DSDVOL::power_on (void)
{
pinMode(_csPin, OUTPUT);
digitalWrite(_csPin, HIGH);
dSDspi.begin();
#ifdef _SD_SDI_PIN
pinMode(_SD_SDI_PIN, INPUT_PULLUP);
#endif

dSDspi.begin();

dSDspi.setMode(DSPI_MODE0);
FCLK_FAST();
}
Expand All @@ -36,6 +40,9 @@ void DSDVOL::power_off (void)
{
dSDspi.end();
pinMode(_csPin, INPUT);
#ifdef _SD_SDI_PIN
pinMode(_SD_SDI_PIN, INPUT);
#endif
}

/*-----------------------------------------------------------------------*/
Expand Down
3 changes: 2 additions & 1 deletion pic32/variants/WF32/Board_Defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ extern const uint8_t digital_pin_to_analog_PGM[];

// SoftSPI(uint8_t pinSSt, uint8_t pinMOSIt, uint8_t pinMISOt, uint8_t pinSCKt);
#define DefineSDSPI(var) SoftSPI var(SD_CS_PIN, 52, 49, 50)
#define DefineDSDVOL(vol, spi) DSDVOL vol(spi, 49) // Create an DSDVOL object
#define DefineDSDVOL(vol, spi) DSDVOL vol(spi, SD_CS_PIN) // Create an DSDVOL object
#define _SD_SDI_PIN 49

/* ------------------------------------------------------------ */
/* Defines for the WiFiShield MRF24 */
Expand Down
4 changes: 3 additions & 1 deletion pic32/variants/WiFire/Board_Defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ extern const uint8_t digital_pin_to_pps_in_PGM[];
#define _DSPI2_MOSI_OUT PPS_OUT_SDO3
#define _DSPI2_MOSI_PIN 54 // RA4 SDO1 RPA4R = SDO1 = 3


// this is the MRF24
#define _DSPI3_BASE _SPI4_BASE_ADDRESS
#define _DSPI3_ERR_IRQ _SPI4_FAULT_VECTOR
Expand Down Expand Up @@ -538,7 +539,8 @@ extern int convertADC(uint8_t channelNumber);
#define SD_SCK_PPS() RPB14R = 0b0000 // Bit Banging SPI, set as GPIO

#define DefineSDSPI(spi) DSPI2 spi
#define DefineDSDVOL(vol, spi) DSDVOL vol(spi, 53) // Create an DSDVOL object
#define DefineDSDVOL(vol, spi) DSDVOL vol(spi, PIN_DSPI2_SS) // Create an DSDVOL object
#define _SD_SDI_PIN _DSPI2_MISO_PIN

/* ------------------------------------------------------------ */
/* Defines for the On Board MRF24 */
Expand Down