void SPIClass::begin(uint8_t _pin) { init(); uint32_t spiPin = BOARD_PIN_TO_SPI_PIN(_pin); PIO_Configure( g_APinDescription[spiPin].pPort, g_APinDescription[spiPin].ulPinType, g_APinDescription[spiPin].ulPin, g_APinDescription[spiPin].ulPinConfiguration); // Default speed set to 4Mhz setClockDivider(_pin, 21); setDataMode(_pin, SPI_MODE0); setBitOrder(_pin, MSBFIRST); }
void SPIClass::end(uint8_t _pin) { uint32_t spiPin = BOARD_PIN_TO_SPI_PIN(_pin); // Setting the pin as INPUT will disconnect it from SPI peripheral pinMode(spiPin, INPUT); }