nitacku/nI2C

Two undefined reference issues with slave code

Opened this issue · 1 comments

Hi, I´m trying to implement your library in my code but keep getting errors about undefined references using Visual Studio Code and PlatformIO.
I´m not that into C++ and can´t figure out how to solve this. Am I doing something wrong or is there a bug in your library?

C:\Users\Martin\AppData\Local\Temp\ccmrTEpa.ltrans0.ltrans.o: In function main: <artificial>:(.text.startup+0x2c2): undefined reference to CTWI::SetLocalDeviceAddress(unsigned char) <artificial>:(.text.startup+0x2ce): undefined reference to CTWI::SetSlaveReceiveHandler(void (*)(unsigned char const*, unsigned char)) collect2.exe: error: ld returned 1 exit status *** [.pio\build\nanoatmega328\firmware.elf] Error 1

Thanks in advance!

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.