Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/i2c/i2c_nrfx_twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ static int i2c_nrfx_twi_transfer(struct device *dev, struct i2c_msg *msgs,
u8_t num_msgs, u16_t addr)
{
for (size_t i = 0; i < num_msgs; i++) {
if (I2C_MSG_ADDR_10_BITS & msgs[i].flags) {
return -ENOTSUP;
}

nrfx_twi_xfer_desc_t cur_xfer = {
.p_primary_buf = msgs[i].buf,
.primary_length = msgs[i].len,
Expand Down
4 changes: 4 additions & 0 deletions drivers/i2c/i2c_nrfx_twim.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ static int i2c_nrfx_twim_transfer(struct device *dev, struct i2c_msg *msgs,
u8_t num_msgs, u16_t addr)
{
for (size_t i = 0; i < num_msgs; i++) {
if (I2C_MSG_ADDR_10_BITS & msgs[i].flags) {
return -ENOTSUP;
}

nrfx_twim_xfer_desc_t cur_xfer = {
.p_primary_buf = msgs[i].buf,
.primary_length = msgs[i].len,
Expand Down
7 changes: 5 additions & 2 deletions include/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
#define I2C_SPEED_GET(cfg) (((cfg) & I2C_SPEED_MASK) \
>> I2C_SPEED_SHIFT)

/** Use 10-bit addressing. */
/** Use 10-bit addressing. DEPRECATED - Use I2C_MSG_ADDR_10_BITS instead. */
#define I2C_ADDR_10_BITS (1 << 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I2C_SLAVE_FLAGS_ADDR_10_BITS references this macro in line 66 (I can't put the comment there). I guess (1 << 0) should be used there directly.


/** Controller to act as Master. */
Expand All @@ -63,7 +63,7 @@ extern "C" {
*/

/** Slave device responds to 10-bit addressing. */
#define I2C_SLAVE_FLAGS_ADDR_10_BITS I2C_ADDR_10_BITS
#define I2C_SLAVE_FLAGS_ADDR_10_BITS (1 << 0)

/*
* I2C_MSG_* are I2C Message flags.
Expand All @@ -85,6 +85,9 @@ extern "C" {
/** RESTART I2C transaction for this message. */
#define I2C_MSG_RESTART (1 << 2)

/** Use 10-bit addressing for this message. */
#define I2C_MSG_ADDR_10_BITS (1 << 3)

/**
* @brief One I2C Message.
*
Expand Down