libClearCore/src/SerialBase.cpp
void SerialBase::SpiClock(
    SpiClockPolarities polarity, SpiClockPhases phase) {
    m_polarity = polarity;
    m_phase = phase;

    // If we are not currently in SPI mode, don't apply the change yet.
    if (m_portMode != PortModes::SPI) {
        return;
    }
    bool sercomEnabled = m_serPort->USART.CTRLA.bit.ENABLE;
    PortDisable();
    m_serPort->SPI.CTRLA.bit.CPOL = m_polarity;
    m_serPort->SPI.CTRLA.bit.CPHA = m_phase;
    if (sercomEnabled) {
        PortEnable();
    }
}
/**
    Change the polarity and phase for the SPI clock.
**/
Change the polarity and phase for the SPI clock.
Change the polarity and phase for the SPI clock .
void SerialBase::SpiClock(
    SpiClockPolarities polarity, SpiClockPhases phase) {
    m_polarity = polarity;
    m_phase = phase;
    if (m_portMode != PortModes::SPI) {
        return;
    }
    bool sercomEnabled = m_serPort->USART.CTRLA.bit.ENABLE;
    PortDisable();
    m_serPort->SPI.CTRLA.bit.CPOL = m_polarity;
    m_serPort->SPI.CTRLA.bit.CPHA = m_phase;
    if (sercomEnabled) {
        PortEnable();
    }
}
void SerialBase :: SpiClock ( SpiClockPolarities polarity , SpiClockPhases phase ) { m_polarity = polarity ; m_phase = phase ; if ( m_portMode != PortModes :: SPI ) { return ; } bool sercomEnabled = m_serPort -> USART . CTRLA . bit . ENABLE ; PortDisable ( ) ; m_serPort -> SPI . CTRLA . bit . CPOL = m_polarity ; m_serPort -> SPI . CTRLA . bit . CPHA = m_phase ; if ( sercomEnabled ) { PortEnable ( ) ; } }
Change the polarity and phase for the SPI clock.
Change the polarity and phase for the SPI clock .
// If we are not currently in SPI mode, don't apply the change yet.