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

setPins() for rx/tx and cs/irq? #139

Open
atestani opened this issue Jun 14, 2024 · 3 comments
Open

setPins() for rx/tx and cs/irq? #139

atestani opened this issue Jun 14, 2024 · 3 comments

Comments

@atestani
Copy link

I am using an MCP2515 on an ESP32 and writing code in PlatformIO/VSCode with the Arduino framework. I need to set both rx/tx and cs/irq from the defaults. I see in the API.md that there are two calls to setPins() for both pairs of pins. How does the library know which set of pins I am defining?

@alastaira
Copy link

That depends on whether you're targetting ESP32 or AVR architecture.

@brightproject
Copy link

I also didn't quite understand the function:

void MCP2515Class::setPins(int cs, int irq)
{
_csPin = cs;
_intPin = irq;
}

void MCP2515Class::setPins(int cs, int irq)

According to the code CAN.setPins(PA4, -1); there is an explicit installation of the pin of the CS and INT and nothing else, the platform has nothing to do with it.

@alastaira
Copy link

I also didn't quite understand the function:

void MCP2515Class::setPins(int cs, int irq)
{
_csPin = cs;
_intPin = irq;
}

void MCP2515Class::setPins(int cs, int irq)

According to the code CAN.setPins(PA4, -1); there is an explicit installation of the pin of the CS and INT and nothing else, the platform has nothing to do with it.

Look at the top of the header file... the MCP2515 class can't be used on ESP32:

#ifndef ARDUINO_ARCH_ESP32

And the SJA1000 can only be used on ESP32 hardware:

#ifdef ARDUINO_ARCH_ESP32

In other words, platform has everything to do with it ;)

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

No branches or pull requests

3 participants