Comments (5)
The hardware isn't going to function properly if the pullups aren't there regardless of the order you issue calls. The pinConfigure() which is used by setSCL() and setSDA() will abort on bus busy (there is a low-level way to circumvent that, but it is a pointless exercise if pullups don't exist).
You can use getSCL() and getSDA() to verify pin changes have occurred.
Regarding setSCL() and setSDA() before begin(), the code is setup to utilize existing pin settings if they are not provided in the begin() call, so the code is already configured to operate in either order.
from i2c_t3.
I can only tell you that using setSCL()/setSDA() did not work for me with my Teensy 3.2. Execution stopped at the setSCL()/setSDA() call and did not continue no matter how long I waited. The only way I could change the SCL/SDA from pins 19/18 to 16/17 was to use begin(I2C_MASTER, 0,I2C_PINS_16_17). It didn't matter which order I tried. I admit that I was just guessing that the missing pullups on 19/18 were the reason. Just to avoid confusion. Of course I have pullups on 16/17. But I shouldn't need pullups on 19/18 if I don't want to use these pins for i2c.
from i2c_t3.
This is an interesting logical problem. setSCL/setSDA make an assumption that the current pins are on an active bus. Try this as a patch, comment out line #394 in the pinConfigure_() in i2c_t3.cpp, then try setSCL/setSDA method again.
//if(reconfig && (*(i2c->S) & I2C_S_BUSY)) return 0; // if reconfig return immediately if bus busy (reconfig=0 for init)
That will ignore bus busy status (while not affecting reconfig function). Let me know if this works and I can push it as a patch.
from i2c_t3.
I'll try it but it might take a while till I get around to it. But just conceptually I would like it better if there was a special case for setSCL/setSDA being used before begin. Something like:
void setSCL(uint8_t pin) {
if (begin not yet called) {
i2c->currentSCL = pin;
} else {
pinConfigure_(i2c, bus, pin, i2c->currentSDA, i2c->currentPullup, 1);
}
}
This way, if any of the begin() functions is later called that does not specify a SCL pin, the one set before begin will be used. As far as I can tell there is no need to verify the validity of the pin if setSCL() is called before begin() because the check will be done when begin() is called.
from i2c_t3.
I uploaded a v11 version with a fix for this. It seemed to work on my test case. If you have further problems then let me know.
from i2c_t3.
Related Issues (20)
- Using Wire with multiple devices HOT 4
- Not an issue, but a question: Avoid memory issues due to virtual double buffering? HOT 2
- Does this library utilize any filters like Kalman filter?
- I2C Master Issue HOT 3
- MiCS-6814 with i2c_t3 library
- Are asynchronous callbacks called from interrupt? (documentation) HOT 2
- Guidelines for using DMA vs interrupts HOT 2
- Licensing question HOT 10
- Teensy 3.6 multi-master configuration not working. HOT 2
- Wire.end() not implemented HOT 4
- Teensy 4.0 HOT 4
- Wire status question HOT 1
- I2C Slave Receive Buffer HOT 4
- Is there a way to undo the effects of Begin? HOT 4
- Wire.write multiple bytes
- Interrupts either not running and/or call wrong function. HOT 2
- Document glitch filter values HOT 1
- Incorrect order of operations? HOT 2
- Simultaneous HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from i2c_t3.