Added option for pullup on MISO pin

This commit is contained in:
BlackMark 2017-09-17 14:12:05 +02:00
parent 9ef529779f
commit 7a1761e054
2 changed files with 5 additions and 5 deletions

View File

@ -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_cMISO.setPin( sm_enmMISO );
@ -45,7 +45,7 @@ void SPI::init( ClockDiv enmClockDiv /* = ClockDiv::CLKDIV_128 */, Mode enmMode
sm_cSS.write( true );
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_cSS.setDirection( InOut::Dir::D_OUT, false );
}

6
spi.h
View File

@ -1,7 +1,7 @@
/*
* Copyright (c) by BlackMark 2016-2017
* Date 15/09/2017
* Version 1.3
* Date 17/09/2017
* Version 1.4
*/
#ifndef SPI_H
@ -49,7 +49,7 @@ private:
static InOutPin sm_cSS;
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 setClockDiv( ClockDiv enmClockDiv );
static void setMode( Mode enmMode );