Added deinit function

This commit is contained in:
BlackMark 2017-09-15 15:36:16 +02:00
parent 8230df10a1
commit 9ef529779f
2 changed files with 14 additions and 2 deletions

11
spi.cpp
View File

@ -65,6 +65,17 @@ void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode
SPCR |= ( 1 << SPE );
}
//////////////////////////////////////////////////////////////////////////
void SPI::deinit()
{
SPCR = 0;
sm_cSCK.setDirection( InOut::Dir::D_IN, false );
sm_cMISO.setDirection( InOut::Dir::D_IN, false );
sm_cMOSI.setDirection( InOut::Dir::D_IN, false );
sm_cSS.setDirection( InOut::Dir::D_IN, false );
}
//////////////////////////////////////////////////////////////////////////
void SPI::setClockDiv( ClockDiv enmClockDiv )
{

5
spi.h
View File

@ -1,7 +1,7 @@
/*
* Copyright (c) by BlackMark 2016-2017
* Date 14/09/2017
* Version 1.2
* Date 15/09/2017
* Version 1.3
*/
#ifndef SPI_H
@ -50,6 +50,7 @@ private:
public:
static void init( ClockDiv enmClockDiv = ClockDiv::CLKDIV_128, Mode enmMode = Mode::MODE_0, bool bMaster = true, bool bLSBFirst = false );
static void deinit();
static void setClockDiv( ClockDiv enmClockDiv );
static void setMode( Mode enmMode );
static void setMaster( bool bMaster );