diff options
author | Joel Challis <git@zvecr.com> | 2020-12-18 17:28:29 +0000 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-01-12 22:46:08 -0800 |
commit | c16ddb3985d4b8669d469d1b88db9e3825b2b461 (patch) | |
tree | fbf80235ebe98bb640dedb0667a85329d0cfc599 /drivers/haptic | |
parent | e33afb22554ac11ae93255c8ee960810bc9bfc55 (diff) |
Various compilation fixes for avr-gcc 10 (#9269)
Diffstat (limited to 'drivers/haptic')
-rw-r--r-- | drivers/haptic/DRV2605L.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/haptic/DRV2605L.c b/drivers/haptic/DRV2605L.c index 728554b01e..5de2b354c9 100644 --- a/drivers/haptic/DRV2605L.c +++ b/drivers/haptic/DRV2605L.c @@ -21,8 +21,6 @@ #include <math.h> uint8_t DRV2605L_transfer_buffer[2]; -uint8_t DRV2605L_tx_register[0]; -uint8_t DRV2605L_read_buffer[0]; uint8_t DRV2605L_read_register; void DRV_write(uint8_t drv_register, uint8_t settings) { @@ -32,16 +30,8 @@ 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 + i2c_readReg(DRV2605L_BASE_ADDRESS << 1, regaddress, &DRV2605L_read_register, 1, 100); + return DRV2605L_read_register; } @@ -115,18 +105,16 @@ void DRV_init(void) { } void DRV_rtp_init(void) { - DRV_write(DRV_GO, 0x00); - DRV_write(DRV_RTP_INPUT, 20); //20 is the lowest value I've found where haptics can still be felt. - DRV_write(DRV_MODE, 0x05); - DRV_write(DRV_GO, 0x01); + DRV_write(DRV_GO, 0x00); + DRV_write(DRV_RTP_INPUT, 20); // 20 is the lowest value I've found where haptics can still be felt. + DRV_write(DRV_MODE, 0x05); + DRV_write(DRV_GO, 0x01); } -void DRV_amplitude(uint8_t amplitude) { - DRV_write(DRV_RTP_INPUT, amplitude); -} +void DRV_amplitude(uint8_t amplitude) { DRV_write(DRV_RTP_INPUT, amplitude); } void DRV_pulse(uint8_t sequence) { DRV_write(DRV_GO, 0x00); DRV_write(DRV_WAVEFORM_SEQ_1, sequence); DRV_write(DRV_GO, 0x01); -}
\ No newline at end of file +} |