Various compilation fixes for avr-gcc 10 (#9269)

This commit is contained in:
Joel Challis
2020-12-18 17:28:29 +00:00
committed by Drashna Jael're
parent e33afb2255
commit c16ddb3985
2 changed files with 9 additions and 21 deletions

View File

@@ -21,8 +21,6 @@
#include <math.h> #include <math.h>
uint8_t DRV2605L_transfer_buffer[2]; uint8_t DRV2605L_transfer_buffer[2];
uint8_t DRV2605L_tx_register[0];
uint8_t DRV2605L_read_buffer[0];
uint8_t DRV2605L_read_register; uint8_t DRV2605L_read_register;
void DRV_write(uint8_t drv_register, uint8_t settings) { 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) { uint8_t DRV_read(uint8_t regaddress) {
#ifdef __AVR__ i2c_readReg(DRV2605L_BASE_ADDRESS << 1, regaddress, &DRV2605L_read_register, 1, 100);
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; return DRV2605L_read_register;
} }
@@ -115,18 +105,16 @@ void DRV_init(void) {
} }
void DRV_rtp_init(void) { void DRV_rtp_init(void) {
DRV_write(DRV_GO, 0x00); 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_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_MODE, 0x05);
DRV_write(DRV_GO, 0x01); DRV_write(DRV_GO, 0x01);
} }
void DRV_amplitude(uint8_t amplitude) { void DRV_amplitude(uint8_t amplitude) { DRV_write(DRV_RTP_INPUT, amplitude); }
DRV_write(DRV_RTP_INPUT, amplitude);
}
void DRV_pulse(uint8_t sequence) { void DRV_pulse(uint8_t sequence) {
DRV_write(DRV_GO, 0x00); DRV_write(DRV_GO, 0x00);
DRV_write(DRV_WAVEFORM_SEQ_1, sequence); DRV_write(DRV_WAVEFORM_SEQ_1, sequence);
DRV_write(DRV_GO, 0x01); DRV_write(DRV_GO, 0x01);
} }

View File

@@ -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_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
__attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25); __attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
bool fauxclicky_enabled; extern bool fauxclicky_enabled;
// //
// tempo in BPM // tempo in BPM