Hi everybody I was looking up the wire.h and the wire.cpp-file of the
Raspberry pico mbed-core
trying to understand how SDA / SCL-pins can be chosen.
There is this part of the code
class MbedI2C : public HardwareI2C
{
public:
MbedI2C(int sda, int scl);
which seems to deal with specifying the SDA / SCL-pins.
But I have no idea what I would have to write in my code because
using wire is done without any explicit constructor
there is only
wire.begin();
and that's it.
void arduino::MbedI2C::begin() {
end();
master = new mbed::I2C(_sda, _scl);
}
the begin-function uses _sca, _scl but the heck from where do the values come from?
where are the values for the SDA-pin / SCL-pin set???
Whenever I see a demo-code using I2C there is only
wire.begin();
with empty parenthesis
The Earl Philhower-core has explicit functions for this which I understand.
But I do not understand how to assign particular I2C pins in the mbed-core.
Sure. What you have posted is the declaration.
But how does the code look like that makes use of this declaration?
How does the code look like that I write into my *.ino-file?
This declaration has again just a
without any parameters.
There is this mysterious
which has a completely different name.
In my *.ino-sketch: do I write
I'm sorry maybe I can't exactly get what you're asking for, especially because I never used mbed, but as far as I can see the MbedI2C class is defined on ArduinoCore-mbed/libraries/Wire/Wire.h you linked at first (and I think you already load), so what @UKHeliBob suggested before (give MbedI2C(6,7); a try) seems legit. What am I missing?
Well I gave it a try by installing a second portable Arduino 1.8.19 ide and tried to compile the I2C-scanner-sketch without any modification.
Compilation aborted with an error-message.
Me personal I am done with the RP2040-mbed-core. I will NOT use the mbed-core.