Skip to content

Commit 27c1404

Browse files
ydamigosnashif
authored andcommitted
i2c_smartbond: Introcude TX_FIFO_DEPTH macro
Introcude TX_FIFO_DEPTH macro to avoid "magic" numbers. Signed-off-by: Ioannis Damigos <[email protected]>
1 parent d9ad8c9 commit 27c1404

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/i2c_smartbond.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,14 @@ static int i2c_smartbond_transfer(const struct device *dev, struct i2c_msg *msgs
400400

401401
#ifdef CONFIG_I2C_CALLBACK
402402

403+
#define TX_FIFO_DEPTH 32
404+
403405
static int i2c_smartbond_enable_msg_interrupts(const struct i2c_smartbond_cfg *const config,
404406
struct i2c_smartbond_data *data)
405407
{
406408
if ((data->msgs->flags & I2C_MSG_RW_MASK) == I2C_MSG_READ) {
407409
uint32_t remaining = data->msgs->len - data->receive_cnt;
408-
uint32_t tx_space = 32 - config->regs->I2C_TXFLR_REG;
410+
uint32_t tx_space = TX_FIFO_DEPTH - config->regs->I2C_TXFLR_REG;
409411
uint32_t rx_tl = ((remaining < tx_space) ? remaining : tx_space) - 1;
410412

411413
config->regs->I2C_RX_TL_REG = rx_tl & I2C_I2C_RX_TL_REG_RX_TL_Msk;

0 commit comments

Comments
 (0)