Attiny1634 i2c twi probléme

Bonjour à tous,

Je tente de mettre un écran LCD i2c sur mon Attiny1634 mais je crois qu’il ne supporte pas la librairie Wire.h
Mais j’ai cette erreur :sob:

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c: In function 'twi_init':

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:76:16: error: 'SDA' undeclared (first use in this function)

   digitalWrite(SDA, 1);

                ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:76:16: note: each undeclared identifier is reported only once for each function it appears in

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:77:16: error: 'SCL' undeclared (first use in this function)

   digitalWrite(SCL, 1);

                ^

In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:25:

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:80:7: error: 'TWSR' undeclared (first use in this function)

   cbi(TWSR, TWPS0);

       ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:80:3: note: in expansion of macro 'cbi'

   cbi(TWSR, TWPS0);

   ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:80:13: error: 'TWPS0' undeclared (first use in this function)

   cbi(TWSR, TWPS0);

             ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:80:3: note: in expansion of macro 'cbi'

   cbi(TWSR, TWPS0);

   ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:81:13: error: 'TWPS1' undeclared (first use in this function)

   cbi(TWSR, TWPS1);

             ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:81:3: note: in expansion of macro 'cbi'

   cbi(TWSR, TWPS1);

   ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:82:3: error: 'TWBR' undeclared (first use in this function)

   TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;

   ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:90:3: error: 'TWCR' undeclared (first use in this function)

   TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);

   ^

In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:25:

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:90:26: error: 'TWIE' undeclared (first use in this function)

   TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);

                          ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:90:38: error: 'TWEA' undeclared (first use in this function)

   TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);

                                      ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c: In function 'twi_setAddress':

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:102:3: error: 'TWAR' undeclared (first use in this function)

   TWAR = address << 1;

   ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c: In function 'twi_readFrom':

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:154:5: error: 'TWDR' undeclared (first use in this function)

     TWDR = twi_slarw;

     ^

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:155:5: error: 'TWCR' undeclared (first use in this function)

     TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START

     ^

In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:25:

C:\Users\jon\Documents\Arduino\libraries\Wire\utility\twi.c:155:16: error: 'TWINT' undeclared (first use in this function)

     TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START

                ^

Je pense qu’il faut definir un SDA et SCL mais je ne sais pas comment faire.

Help me please

Merci d’avance.

Enfaite c'est plus compliqué les ATmega et les ATtiny n'ont pas les même registres.

Bonjour, De plus le module ne fonctionne qu'en esclave. La librairie Wire ne convient donc pas. Il faut chercher une librairie, qui convient, pas forcément officielle, donc tu risques de ramer un peu.