Fixed SS line floating for a little bit, while SPI is already active

This commit is contained in:
BlackMark 2017-09-14 10:46:27 +02:00
parent 7a1dcae580
commit 32b8e7bb3a
2 changed files with 10 additions and 10 deletions

14
spi.cpp
View File

@ -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 );
}
//////////////////////////////////////////////////////////////////////////

6
spi.h
View File

@ -1,7 +1,7 @@
/*
* Copyright (c) by BlackMark 2016
* Date 26/05/2016
* Version 1.0
* Copyright (c) by BlackMark 2016-2017
* Date 14/09/2017
* Version 1.1
*/
#ifndef SPI_H