Fixed SS line floating for a little bit, while SPI is already active
This commit is contained in:
parent
7a1dcae580
commit
32b8e7bb3a
14
spi.cpp
14
spi.cpp
@ -29,13 +29,6 @@ void SPI::setCPHA( bool bCPHA )
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode /* = Mode::MODE_0 */, bool bMaster /* = true */, bool bLSBFirst /* = false */ )
|
||||
{
|
||||
setClockDiv( enmClockDiv );
|
||||
setMode( enmMode );
|
||||
setMaster( bMaster );
|
||||
setBitOrder( bLSBFirst );
|
||||
|
||||
SPCR |= ( 1 << SPE );
|
||||
|
||||
if( bMaster )
|
||||
{
|
||||
InOut::writePin( sm_enmSS, true );
|
||||
@ -52,6 +45,13 @@ void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode
|
||||
InOut::setPinDirection( sm_enmMOSI, InOut::Dir::D_IN, false );
|
||||
InOut::setPinDirection( sm_enmSS, InOut::Dir::D_IN, true );
|
||||
}
|
||||
|
||||
setClockDiv( enmClockDiv );
|
||||
setMode( enmMode );
|
||||
setMaster( bMaster );
|
||||
setBitOrder( bLSBFirst );
|
||||
|
||||
SPCR |= ( 1 << SPE );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user