-
Notifications
You must be signed in to change notification settings - Fork 48
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
Is this library compatible with ARM-based boards or/and Atmega32u4-based boards? #5
Comments
I'll answer here based on my current testing with an Arduino Due: it presently is not compatible with ARM, as it includes I've forked and am working on a fix. |
Thanks!! |
Okay, this goes a lot deeper than just swapping I started with some
This macro clears up the issue with the delay. But when I include the library in an near-empty sketch, I get the following compile errors:
So it looks like now the trouble is in the differences between direct port manipulation for AVR boards and the SAM/ARM-based Arduino Due. |
Hi
The Due/ARM part of the code would then also have a different Unfortunately I don't have a Due to try this on. I do have a Teensy3 which is a similar architecture. If I have time tonight I'll try it out. (I'd also like to try this change out on AVR-based Arduinos. When I wrote this, digitalWrite() was much slower than it is now on AVR and INPUT_PULLUP didn't exist. digitalWrite() might work now on AVR) |
Thanks for the suggestion! I have access to both Uno and Due so I'm happy to help test. I'm working a bit on this too. |
Okay, I'm a little bit stuck with porting the
but while that (obviously) resolves the compile error (complaints about FWIW, I replaced
I have very likely overlooked something obvious—any tips for this, @todbot? |
Hi! |
I mean the equivalent "avr" library for ARM |
Works for me, successfully read values from some pressure sensor with DUE . My changes: void SoftI2CMaster::i2c_init(void) { uint8_t SoftI2CMaster::i2c_readbit(void) { and todbot function definitions. |
Hello @dm99 , first i added in SoftI2CMaster.cpp:
then i added @todbot s function definitions:
(replacing the following code:)
then i inserted your changes:
(replacing this section:)
in my sketch i also replaced "#include <Wire.h>" with "#include "SoftI2CMaster.h"" and in my Wire-functions i replaced all "Wire." with "i2c.", e.g. "Wire.write(val)" with "i2c.write(val);" did i miss something? or did i do something wrong? it would be a great help for me and certainly fore some other people if you could post a whole working example, including also the changes in the relating library-files. thanks a lot, dm99! |
This is working SoftI2CMaster (.cpp) and arduino file for reading an Keller pressure transmitter and put the result on LCD. |
Thanks a lot, dm99! Is it working in SAM-chip or on Mega? |
Arduino Due |
Thank you- i need to connect a Humidity Sensor. I' ll try it this weekend... |
Hi again dm99, did you change anything else? I compiled with Arduino IDE 1.6.6. it should work, shouldnt it? |
My is 1.6.11, but it should works. It looks like arduino.h isn't included for same reason. |
i think, arduino.h is included, because if i comment it out with "//" , there are much more errors. is it possible that it has something to do with the formatting in the pdf-format? can you maybe post your complete code in raw code format in this forum? what about the SoftI2CMaster.h -file? is it original or also with some changes? thanks again! |
hi @dm99, |
try this (.cpp) |
Hi @dm99 |
Ok, finally i cleaned up the code a little bit and added the suggestions of @dm99. There are no compile errors left. there was a different spelling of the "read_user_register()" function, so i renamed it in the file SparkFunHTU21D.h. in attached files you can see my working code. only issue: the slight differences between the measured values, either with hardware or software i2C... |
Ok, everything works fine with the code. There was another reason for the wrong values, not the I2C-Bus: i had a reference Hygrometer, which lost its calibration- the values are identical on both kinds of I2C:-) Thank you once again, @dm99. So the zip-file in my previous posting works fine, if anybody else wants to use it;-) |
Thanks
The text was updated successfully, but these errors were encountered: