Added deinit function
This commit is contained in:
parent
8230df10a1
commit
9ef529779f
11
spi.cpp
11
spi.cpp
@ -65,6 +65,17 @@ void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode
|
|||||||
SPCR |= ( 1 << SPE );
|
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 )
|
void SPI::setClockDiv( ClockDiv enmClockDiv )
|
||||||
{
|
{
|
||||||
|
5
spi.h
5
spi.h
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) by BlackMark 2016-2017
|
* Copyright (c) by BlackMark 2016-2017
|
||||||
* Date 14/09/2017
|
* Date 15/09/2017
|
||||||
* Version 1.2
|
* Version 1.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SPI_H
|
#ifndef SPI_H
|
||||||
@ -50,6 +50,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static void init( ClockDiv enmClockDiv = ClockDiv::CLKDIV_128, Mode enmMode = Mode::MODE_0, bool bMaster = true, bool bLSBFirst = false );
|
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 setClockDiv( ClockDiv enmClockDiv );
|
||||||
static void setMode( Mode enmMode );
|
static void setMode( Mode enmMode );
|
||||||
static void setMaster( bool bMaster );
|
static void setMaster( bool bMaster );
|
||||||
|
Loading…
Reference in New Issue
Block a user