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
Have a way to test if an SSD1306 Oled display is present #59
Comments
This can be be done outside of this library but still along the same lines as your suggestion. Here is an example of how I have done it in the past.
|
Thanks for the suggestion. However, I would like avoid using Wire explicitely as much as possible but I guess it could be a workaround especially if Wire library is already inplicitely in use in my other libraries. |
Hi, |
There is a small custom driver for AVR on boards like Uno. See this example. SPI displays use less memory also. On Uno with the 128x64 examples: Wire
My I2C driver
An SPI display
|
This is exactly what i used. It works very VERY well. Thanks a lot. |
Try the following function to check for an I2C device that responds to a zero length write. Should give the same result as DirtyEngineer's method.
|
Thanks !!
If I understand correctly that could eventually be applied to other I2C devices !
…________________________________
From: Bill Greiman ***@***.***>
Sent: Sunday, July 4, 2021 7:08 PM
To: greiman/SSD1306Ascii ***@***.***>
Cc: bgrigoriu ***@***.***>; Comment ***@***.***>
Subject: Re: [greiman/SSD1306Ascii] Have a way to test if an SSD1306 Oled display is present (#59)
Try the following function to check for an I2C device that responds to a zero length write. Should give the same result as DirtyEngineer's method.
// Retrun true if device responds to write.
bool i2cCheck(uint8_t i2cAdd) {
bool rtn;
AvrI2c i2c;
i2c.begin();
// low bit zero starts write, low bit 1 starts read.
rtn = i2c.start(i2cAdd << 1);
i2c.end();
return rtn;
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#59 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AST5TZ2QBN3XK264XKGAVG3TWCISHANCNFSM4HEAELSQ>.
|
Yes it should work for other devices. Here is a debug program I used for AvrI2c. It prints two times the what Arduino uses for an address. The I2C bus specification specifies that in standard-mode I2C, the slave address is 7-bits long followed by the read/write bit.
|
Thanks !!
I really learned something today.
Bogdan
…________________________________
From: Bill Greiman ***@***.***>
Sent: Sunday, July 4, 2021 7:26 PM
To: greiman/SSD1306Ascii ***@***.***>
Cc: bgrigoriu ***@***.***>; Comment ***@***.***>
Subject: Re: [greiman/SSD1306Ascii] Have a way to test if an SSD1306 Oled display is present (#59)
Yes it should work for other devices.
Here is a debug program I used for AvrI2c. It prints two times the what Arduino uses for an address. The I2C bus specification specifies that in standard-mode I2C, the slave address is 7-bits long followed by the read/write bit.
// See which addresses respond to a start condition.
#include <AvrI2c.h>
AvrI2c i2c;
//------------------------------------------------------------------------------
void setup(void) {
Serial.begin(9600);
uint8_t add = 0;
i2c.begin();
// try read
do {
if (i2c.start(add | I2C_READ)) {
Serial.print("Add read: ");
Serial.println(add, HEX);
i2c.read(true);
}
i2c.stop();
add += 2;
} while (add);
// try write
add = 0;
do {
if (i2c.start(add | I2C_WRITE)) {
Serial.print("Add write: ");
Serial.println(add, HEX);
}
i2c.stop();
add += 2;
} while (add);
Serial.println("Done");
}
void loop(void){}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#59 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AST5TZ5FO6UCPVYXNU5WF53TWCKTBANCNFSM4HEAELSQ>.
|
My project can use several displays and an SSD1306 OLED display is not mandatory. But if I try to call the
begin
method, it freezes my firmware as I use your version I²C. So I have no practical way to detect an SSD1306 controller is present through your interface. I notice there is an active polling to check an ACK after sending a command. Wouldn't it be okay to poll a certain amount and abort with a boolean telling if it was ACKed? At leastbegin
may return a boolean to say if a SSD1306 was able to answer while the rest of interface may stay unchanged.Regards.
The text was updated successfully, but these errors were encountered: