Added option for pullup on MISO pin
This commit is contained in:
parent
9ef529779f
commit
7a1761e054
4
spi.cpp
4
spi.cpp
@ -33,7 +33,7 @@ void SPI::setCPHA( bool bCPHA )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode /* = Mode::MODE_0 */, bool bMaster /* = true */, bool bLSBFirst /* = false */ )
|
void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode /* = Mode::MODE_0 */, bool bMaster /* = true */, bool bLSBFirst /* = false */, bool bMISOPullup /* = false */ )
|
||||||
{
|
{
|
||||||
sm_cSCK.setPin( sm_enmSCK );
|
sm_cSCK.setPin( sm_enmSCK );
|
||||||
sm_cMISO.setPin( sm_enmMISO );
|
sm_cMISO.setPin( sm_enmMISO );
|
||||||
@ -45,7 +45,7 @@ void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode
|
|||||||
sm_cSS.write( true );
|
sm_cSS.write( true );
|
||||||
|
|
||||||
sm_cSCK.setDirection( InOut::Dir::D_OUT, false );
|
sm_cSCK.setDirection( InOut::Dir::D_OUT, false );
|
||||||
sm_cMISO.setDirection( InOut::Dir::D_IN, false );
|
sm_cMISO.setDirection( InOut::Dir::D_IN, bMISOPullup );
|
||||||
sm_cMOSI.setDirection( InOut::Dir::D_OUT, false );
|
sm_cMOSI.setDirection( InOut::Dir::D_OUT, false );
|
||||||
sm_cSS.setDirection( InOut::Dir::D_OUT, false );
|
sm_cSS.setDirection( InOut::Dir::D_OUT, false );
|
||||||
}
|
}
|
||||||
|
6
spi.h
6
spi.h
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) by BlackMark 2016-2017
|
* Copyright (c) by BlackMark 2016-2017
|
||||||
* Date 15/09/2017
|
* Date 17/09/2017
|
||||||
* Version 1.3
|
* Version 1.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SPI_H
|
#ifndef SPI_H
|
||||||
@ -49,7 +49,7 @@ private:
|
|||||||
static InOutPin sm_cSS;
|
static InOutPin sm_cSS;
|
||||||
|
|
||||||
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, bool bMISOPullup = false );
|
||||||
static void deinit();
|
static void deinit();
|
||||||
static void setClockDiv( ClockDiv enmClockDiv );
|
static void setClockDiv( ClockDiv enmClockDiv );
|
||||||
static void setMode( Mode enmMode );
|
static void setMode( Mode enmMode );
|
||||||
|
Loading…
Reference in New Issue
Block a user