Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPISlave.end() added #4248

Merged
merged 16 commits into from
Mar 18, 2018
Merged

SPISlave.end() added #4248

merged 16 commits into from
Mar 18, 2018

Conversation

JAndrassy
Copy link
Contributor

resetting the registers is needed for the switch to master mode for example for AVRISP

@@ -72,6 +72,14 @@ void SPISlaveClass::begin()
hspi_slave_onStatusSent(&_s_status_tx);
hspi_slave_begin(4, this);
}
void SPISlaveClass::end()
{
hspi_slave_onData(NULL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use nullptr instead of NULL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the hspi_slave_* functions are C functions called from C++. should nullptr be used?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. NULL is a #define 0 in C, so an int that gets cast into a 32bit ptr, and in C++ it is a #define 0x00 that is cast into a void*, while nullptr is a C++ builtin that is really a null ptr. It's a type and/or style thing. As a rule of thumb, use of nullptr is considered better in C++ code. You can google nullptr vs. NULL to read about the C++ decision.

void hspi_slave_end()
{
ETS_SPI_INTR_DISABLE();
ETS_SPI_INTR_ATTACH(_hspi_slave_isr_handler, NULL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be something like:
ETS_SPI_INTR_ATTACH(nullptr, nullptr);
?

Copy link
Contributor Author

@JAndrassy JAndrassy Jan 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, the first argument should be NULL. I change it. (Even though: is this a correct way to detach an interrupt on esp8266?)

it is a C source code and nullptr is not declared

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, C file, so NULL it is.

JAndrassy and others added 4 commits January 30, 2018 19:50
…add deepSleepMax based on the cali_proc function per SDK
* WiFiTelnetToSerial Example - Minor Issues #2435

* WiFiTelnetToSerial Example - Minor Issues #2435

Patch to rectify issue #2435
@JAndrassy
Copy link
Contributor Author

JAndrassy commented Jan 30, 2018

I made the requested changes into the original commit "SPISlave.end() added".

@svofski
Copy link

svofski commented Feb 25, 2018

I very much would love having this patch merged. Thanks!

@JAndrassy
Copy link
Contributor Author

@svofski try to add your request as issue, with a reason why you need this

@JAndrassy
Copy link
Contributor Author

@devyte, can you merge this?

@svofski
Copy link

svofski commented Mar 13, 2018

@JAndrassy sure! #4511

@devyte devyte merged commit 8911136 into esp8266:master Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants