Skip to content

Commit bca9a7e

Browse files
ABOSTMfpistm
authored andcommitted
I2C: allow static redefinition of buffer size
Default buffer size is still 32, but it is now possible to redefine compilation switch: I2C_TXRX_BUFFER_SIZE It's maximum value is 255
1 parent 757493c commit bca9a7e

File tree

1 file changed

+4
-0
lines changed
  • libraries/Wire/src/utility

1 file changed

+4
-0
lines changed

libraries/Wire/src/utility/twi.h

+4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ extern "C" {
6161
#endif
6262

6363
/* I2C Tx/Rx buffer size */
64+
#if !defined(I2C_TXRX_BUFFER_SIZE)
6465
#define I2C_TXRX_BUFFER_SIZE 32
66+
#elif (I2C_TXRX_BUFFER_SIZE >= 256)
67+
#error I2C buffer size cannot exceed 255
68+
#endif
6569

6670
/* Redefinition of IRQ for F0/G0/L0 families */
6771
#if defined(STM32F0xx) || defined(STM32G0xx) || defined(STM32L0xx)

0 commit comments

Comments
 (0)