Skip to content

Commit e467afa

Browse files
authored
Merge pull request #46 from CommunityGD32Cores/f/i2c-configure-timeouts
Make it possible for a core to override the Wire library's global timeout
2 parents f719024 + 6ca2e80 commit e467afa

File tree

1 file changed

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

1 file changed

+6
-0
lines changed

libraries/Wire/src/utility/twi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ typedef enum {
4848

4949
static struct i2c_s *obj_s_buf[I2C_NUM] = {NULL};
5050
#define BUSY_TIMEOUT ((SystemCoreClock / obj_s->freq) * 2 * 10)
51+
52+
#ifndef WIRE_I2C_FLAG_TIMEOUT
5153
#define FLAG_TIMEOUT (0xF0000U)
54+
#else
55+
#define FLAG_TIMEOUT WIRE_I2C_FLAG_TIMEOUT
56+
#endif
57+
5258
#define I2C_S(obj) (struct i2c_s *) (obj)
5359

5460
/** Initialize the I2C peripheral

0 commit comments

Comments
 (0)