nitacku / nI2C

A non-blocking I2C library for Arduino/AVR without limitations!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not compiling slave_receiver example

altdaps opened this issue · comments

Arduino IDE 1.8.9, board mega2560

C:\Program Files (x86)\Arduino\libraries\nI2C\nTWI.cpp: In member function 'void CTWI::InterruptHandler()':

C:\Program Files (x86)\Arduino\libraries\nI2C\nTWI.cpp:598:9: warning: attributes at the beginning of statement are ignored [-Wattributes]

     [[gnu::fallthrough]]; // Fall-through

     ^

C:\Users\SONY\AppData\Local\Temp\cc9495FG.ltrans0.ltrans.o: In function `main':

:(.text.startup+0x280): undefined reference to `CTWI::SetLocalDeviceAddress(unsigned char)'

:(.text.startup+0x28c): undefined reference to `CTWI::SetSlaveReceiveHandler(void ()(unsigned char const, unsigned char))'

collect2.exe: error: ld returned 1 exit status

commented

It's not explained, but there is a define statement which controls whether the slave functions are enabled:
CTWI_ENABLE_SLAVE_MODE: https://github.com/nitacku/nI2C/blob/master/nTWI.h#L29

Simply uncomment this line to enable slave mode.

Thanks.