-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
I2C frequency gets narrowed #100
Comments
Hi @ggatis the frequency is not a last parameter in SPlatformI2cConfig. Probably you should you something like this: |
Hi @lexus2k! And "DisplaySH1107_64x128_I2C display( -1, { -1, 0x3C, 1000000, -1, -1 } );" does not work anyway since the prob is in narrowing, not in the order: lcdgfx_sh1107_demo:47:69: error: narrowing conversion of '1000000' from 'long int' to 'int8_t {aka signed char}' inside { } [-Wnarrowing] Kind regards ~ |
I do not observe any narrowing error. |
Display works with default constructor.
Error using custom I2C frequency: DisplaySH1107_64x128_I2C display( -1, { -1, 0x3C -1, -1, 1000000 } );
lcdgfx_sh1107_demo:46:68: error: narrowing conversion of '1000000' from 'long int' to 'int8_t {aka signed char}' inside { } [-Wnarrowing]
DisplaySH1107_64x128_I2C display( -1, { -1, 0x3C -1, -1, 1000000 } );
^
Using library lcdgfx at version 1.1.4 in folder: ...\Arduino\libraries\lcdgfx
Using library SPI at version 1.0 in folder: ...\ArduinoData\packages\lgt8fx\hardware\avr\2.0.0\libraries\SPI
Using library Wire at version 1.0 in folder: ...\ArduinoData\packages\lgt8fx\hardware\avr\2.0.0\libraries\Wire
exit status 1
narrowing conversion of '1000000' from 'long int' to 'int8_t {aka signed char}' inside { } [-Wnarrowing]
I suspect
DisplaySH1107_64x128_I2C display( -1, { -1, 0x3C -1, -1, 1000000 } );
should set I2C frequency to 1MHz.
Changing in file lcd_sh1107.h "SPlatformI2cConfig{config.busId, static_cast<uint8_t>(config.addr ?: 0x3C), config.scl, config.sda, config.frequency ?: 400000})" to "SPlatformI2cConfig{config.busId, static_cast<uint8_t>(config.addr ?: 0x3C), config.scl, config.sda, config.frequency ?: 1000000})" does not give any effect.
Changing in file arduino_wire.cpp "Wire.setClock( 400000 );" to "Wire.setClock( 1000000 );" is efficient.
The effect was observed commenting all lcd_delay functions in demo file, initialising Serial and printing out demo execution time.
Changes in demo file:
...
void setup() {
...
unsigned long StartMillis;
unsigned long CurrentMillis;
void loop()
{
//lcd_delay(1000);
switch (menu.selection())
{
case 0:
StartMillis = millis();
bitmapDemo();
break;
...
case 4:
drawLinesDemo();
CurrentMillis = millis();
Serial.print("Test duration, ms:");
Serial.println( CurrentMillis - StartMillis );
break;
...
The execution time changed from default 1503 ms to 808 ms.
At I2C frequency 2 MHz it decreased to 576 ms.
The text was updated successfully, but these errors were encountered: