diff options
-rw-r--r-- | drivers/haptic/DRV2605L.c | 28 | ||||
-rw-r--r-- | quantum/fauxclicky.h | 2 |
2 files changed, 9 insertions, 21 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 +} diff --git a/quantum/fauxclicky.h b/quantum/fauxclicky.h index bfaacf9096..ed54d0edcf 100644 --- a/quantum/fauxclicky.h +++ b/quantum/fauxclicky.h @@ -24,7 +24,7 @@ __attribute__((weak)) float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25 __attribute__((weak)) float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125); __attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25); -bool fauxclicky_enabled; +extern bool fauxclicky_enabled; // // tempo in BPM |