Skip to content

Commit c6b4377

Browse files
removed data copying in i2c write - this wasn't needed, we'll see if rabbit2 "developers" will "fix" this bug too.
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@349 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
1 parent ab75f22 commit c6b4377

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/drv_i2c.c

+2-11
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ void I2C2_EV_IRQHandler(void)
3131
i2c_ev_handler();
3232
}
3333

34-
3534
#define I2C_DEFAULT_TIMEOUT 30000
3635
static volatile uint16_t i2cErrorCount = 0;
3736

@@ -79,26 +78,18 @@ static void i2c_er_handler(void)
7978
bool i2cWriteBuffer(uint8_t addr_, uint8_t reg_, uint8_t len_, uint8_t *data)
8079
{
8180
uint8_t i;
82-
uint8_t my_data[16];
8381
uint32_t timeout = I2C_DEFAULT_TIMEOUT;
8482

8583
addr = addr_ << 1;
8684
reg = reg_;
8785
writing = 1;
8886
reading = 0;
89-
write_p = my_data;
90-
read_p = my_data;
87+
write_p = data;
88+
read_p = data;
9189
bytes = len_;
9290
busy = 1;
9391
error = false;
9492

95-
// too long
96-
if (len_ > 16)
97-
return false;
98-
99-
for (i = 0; i < len_; i++)
100-
my_data[i] = data[i];
101-
10293
if (!(I2Cx->CR2 & I2C_IT_EVT)) { //if we are restarting the driver
10394
if (!(I2Cx->CR1 & 0x0100)) { // ensure sending a start
10495
while (I2Cx->CR1 & 0x0200) { ; } //wait for any stop to finish sending

0 commit comments

Comments
 (0)