示例#1
0
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);
}
示例#2
0
文件: SPI.cpp 项目: Eih3/v0.83
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);
}