Skip to content

Commit

Permalink
SPISlave.end() added (#4248)
Browse files Browse the repository at this point in the history
* Change argument to Esp.deepSleep from uint32 to uint64 to match SDK, add deepSleepMax based on the cali_proc function per SDK

* SPISlave.end() added

* Nameoftherose patch for Issue #2435 (#4256)

* WiFiTelnetToSerial Example - Minor Issues #2435

* WiFiTelnetToSerial Example - Minor Issues #2435

Patch to rectify issue #2435

* Check that pins needed by Wire are defined at compile-time (#4261)
  • Loading branch information
JAndrassy authored and devyte committed Mar 18, 2018
1 parent 855b03c commit 8911136
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libraries/SPISlave/src/SPISlave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ void SPISlaveClass::begin()
hspi_slave_onStatusSent(&_s_status_tx);
hspi_slave_begin(4, this);
}
void SPISlaveClass::end()
{
hspi_slave_onData(nullptr);
hspi_slave_onDataSent(nullptr);
hspi_slave_onStatus(nullptr);
hspi_slave_onStatusSent(nullptr);
hspi_slave_end();
}
void SPISlaveClass::setData(uint8_t * data, size_t len)
{
if(len > 32) {
Expand Down
1 change: 1 addition & 0 deletions libraries/SPISlave/src/SPISlave.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SPISlaveClass
{}
~SPISlaveClass() {}
void begin();
void end();
void setData(uint8_t * data, size_t len);
void setData(const char * data)
{
Expand Down
17 changes: 17 additions & 0 deletions libraries/SPISlave/src/hspi_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ void hspi_slave_begin(uint8_t status_len, void * arg)
ETS_SPI_INTR_ENABLE();
}

void hspi_slave_end()
{
ETS_SPI_INTR_DISABLE();
ETS_SPI_INTR_ATTACH(NULL, NULL);

pinMode(SS, INPUT);
pinMode(SCK, INPUT);
pinMode(MISO, INPUT);
pinMode(MOSI, INPUT);

// defaults
SPI1S = 0;
SPI1U = SPIUSSE | SPIUCOMMAND;
SPI1S1 = 0;
SPI1P = B110;
}

void hspi_slave_setStatus(uint32_t status)
{
SPI1WS = status;
Expand Down
3 changes: 3 additions & 0 deletions libraries/SPISlave/src/hspi_slave.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
//Start SPI SLave
void hspi_slave_begin(uint8_t status_len, void * arg);

//End SPI SLave
void hspi_slave_end();

//set the status register so the master can read it
void hspi_slave_setStatus(uint32_t status);

Expand Down

0 comments on commit 8911136

Please sign in to comment.