Skip to content

Commit

Permalink
Completely remove i2c_transmit_receive function (qmk#7686)
Browse files Browse the repository at this point in the history
* Add i2c_transmit_receive function

This function is listed in the ARM header file, but doesn't actually exist.

* Remove i2c_transmit_receive function

* Update DRV2605L read function to use i2c_readReg on both arm and avr
  • Loading branch information
drashna authored and patrl committed Dec 29, 2019
1 parent 937916b commit 1f57203
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion drivers/arm/i2c_master.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ void i2c_init(void);
i2c_status_t i2c_start(uint8_t address);
i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_transmit_receive(uint8_t address, uint8_t* tx_body, uint16_t tx_length, uint8_t* rx_body, uint16_t rx_length);
i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
void i2c_stop(void);
11 changes: 2 additions & 9 deletions drivers/haptic/DRV2605L.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,9 @@ void DRV_write(uint8_t drv_register, uint8_t settings) {
}

uint8_t DRV_read(uint8_t regaddress) {
#ifdef __AVR__
i2c_readReg(DRV2605L_BASE_ADDRESS << 1, regaddress, DRV2605L_read_buffer, 1, 100);
DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
#else
DRV2605L_tx_register[0] = regaddress;
if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1, DRV2605L_tx_register, 1, DRV2605L_read_buffer, 1)) {
printf("err reading reg \n");
}
DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
#endif

return DRV2605L_read_register;
}

Expand Down Expand Up @@ -127,4 +120,4 @@ void DRV_pulse(uint8_t sequence) {
DRV_write(DRV_GO, 0x00);
DRV_write(DRV_WAVEFORM_SEQ_1, sequence);
DRV_write(DRV_GO, 0x01);
}
}

0 comments on commit 1f57203

Please sign in to comment.