Changing the buffer size for I2C in twi.h without editing the MiniCore library · Issue #351 · MCUdude/MiniCore · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, I am very happy with MiniCore for the ATMEGA328PB. Development has been problem free and fast on my Macbook M4.
I wrote a small driver for a ST M24M02E 2Mb EEPROM. The device has a 256 write buffer as many EEPROM have. My application uses 32 byte records that we read and write. With the two bytes of address required for each transaction I can only write 30 data bytes per EEPROM write operation. Reviewing the code I found twi.h surrounded the define with an 'if not defined':
#ifndef TWI_BUFFER_SIZE
#define TWI_BUFFER_SIZE 32
#endif
I thought I could just define a size of 34 at the top of my sketch but then found that the IDE pre-compiles all the libraries before my sketch, making the 'if not defined' useless.
Am I doing this wrong? Is there a way to override the 32 byte default without editing your library?
The text was updated successfully, but these errors were encountered:
The i2c/twi library is compiled before the user program, so that's why you're stuck with 32 bytes. I'll recommend using PlatformIO instead. There you can specify compiler flags and fix this by adding -DTWI_BUFFER_SIZE=256.
First, I am very happy with MiniCore for the ATMEGA328PB. Development has been problem free and fast on my Macbook M4.
I wrote a small driver for a ST M24M02E 2Mb EEPROM. The device has a 256 write buffer as many EEPROM have. My application uses 32 byte records that we read and write. With the two bytes of address required for each transaction I can only write 30 data bytes per EEPROM write operation. Reviewing the code I found twi.h surrounded the define with an 'if not defined':
#ifndef TWI_BUFFER_SIZE
#define TWI_BUFFER_SIZE 32
#endif
I thought I could just define a size of 34 at the top of my sketch but then found that the IDE pre-compiles all the libraries before my sketch, making the 'if not defined' useless.
Am I doing this wrong? Is there a way to override the 32 byte default without editing your library?
The text was updated successfully, but these errors were encountered: