GyverLibs / GyverTransfer

Библиотека для передачи данных по интерфейсу GyverTransfer (GT). Передача для Arduino по одному проводу
MIT License
8 stars 2 forks source link

Not compiling over Attiny85 with ATTinyCore #2

Open Rimbaldo opened 1 year ago

Rimbaldo commented 1 year ago

Hi! The examples sketches don't compile in Arduino 2.0 IDE, using ATTinyCore, in an Attiny85.

Here's the output from the compiler:

In file included from D:\Dados\Libraries\Meus Documentos\Arduino\nativeTXgyvertransfer\nativeTXgyvertransfer.ino:11:0: d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h: In instantiation of 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::write(const uint8_t*, size_t) [with unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0; uint8_t = unsigned char; size_t = unsigned int]': d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:197:14: required from 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::writeDataCRC(T&) [with T = Data; unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0]' D:\Dados\Libraries\Meus Documentos\Arduino\nativeTXgyvertransfer\nativeTXgyvertransfer.ino:26:24: required from here d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: error: '_delay_us' was not declared in this scope

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:173:17: note: in expansion of macro 'GT_DELAY' GT_DELAY(2 * GT_START(GT_SPEED)); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: note: suggested alternative: 'delay'

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:173:17: note: in expansion of macro 'GT_DELAY' GT_DELAY(2 * GT_START(GT_SPEED)); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h: In instantiation of 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::write(uint8_t) [with unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0; uint8_t = unsigned char]': d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:198:14: required from 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::writeDataCRC(T&) [with T = Data; unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0]' D:\Dados\Libraries\Meus Documentos\Arduino\nativeTXgyvertransfer\nativeTXgyvertransfer.ino:26:24: required from here d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: error: '_delay_us' was not declared in this scope

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:119:26: note: in expansion of macro 'GT_DELAY' else GT_DELAY(GT_HIGH(GT_SPEED)); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: note: suggested alternative: 'delay'

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:119:26: note: in expansion of macro 'GT_DELAY' else GT_DELAY(GT_HIGH(GT_SPEED)); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: error: '_delay_us' was not declared in this scope

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:122:26: note: in expansion of macro 'GT_DELAY' else GT_DELAY(GT_LOW(GT_SPEED)); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: note: suggested alternative: 'delay'

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:122:26: note: in expansion of macro 'GT_DELAY' else GT_DELAY(GT_LOW(GT_SPEED)); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: error: '_delay_us' was not declared in this scope

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:131:13: note: in expansion of macro 'GT_DELAY' GT_DELAY(GT_START(GT_SPEED) - GT_OFFSET); // START пульс ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: note: suggested alternative: 'delay'

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:131:13: note: in expansion of macro 'GT_DELAY' GT_DELAY(GT_START(GT_SPEED) - GT_OFFSET); // START пульс ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: error: '_delay_us' was not declared in this scope

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:142:9: note: in expansion of macro 'GT_DELAY' GT_DELAY(GT_LOW(GT_SPEED)); // LOW пульс (стоп бит) ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: note: suggested alternative: 'delay'

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:142:9: note: in expansion of macro 'GT_DELAY' GT_DELAY(GT_LOW(GT_SPEED)); // LOW пульс (стоп бит) ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h: In instantiation of 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::pulse38kHz(int) [with unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0]': d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:115:23: required from 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::write(uint8_t) [with unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0; uint8_t = unsigned char]' d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:198:14: required from 'void GyverTransfer<GT_PIN, GT_ROLE, GT_SPEED, GT_RXBUF>::writeDataCRC(T&) [with T = Data; unsigned char GT_PIN = 2; unsigned char GT_ROLE = 0; unsigned int GT_SPEED = 5000; unsigned int GT_RXBUF = 0]' D:\Dados\Libraries\Meus Documentos\Arduino\nativeTXgyvertransfer\nativeTXgyvertransfer.ino:26:24: required from here d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: error: '_delay_us' was not declared in this scope

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:358:13: note: in expansion of macro 'GT_DELAY' GT_DELAY(12.5); ^~~~ d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:62:30: note: suggested alternative: 'delay'

define GT_DELAY(x) _delay_us(x)

                 ~~~~~~~~~^~~

d:\Dados\Libraries\Meus Documentos\Arduino\libraries\GyverTransfer\src/GyverTransfer.h:358:13: note: in expansion of macro 'GT_DELAY' GT_DELAY(12.5); ^~~~

exit status 1

Compilation error: exit status 1

Rimbaldo commented 1 year ago

As a workaround, I removed these lines from the GyverTransfer.h and it compiled and uploaded and worked correctly on the Attiyn85 using ATTinyCore.

ifdef AVR

define GT_DELAY(x) _delay_us(x)

else

and let only the line:

define GT_DELAY(x) delayMicroseconds(x)

GyverLibs commented 1 year ago

Very strange. All avrs have _delay_us(x), it comes from gcc compiler. Try to include

#include <util/delay.h>

In library file instead

Rimbaldo commented 1 year ago

It worked! Thanks! But I added it in the sketch rather than in the library..

GyverLibs commented 1 year ago

I should add this include in avr section. Leave issue open as reminder