summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2022-05-13 06:21:56 +0000
committerQMK Bot <hello@qmk.fm>2022-05-13 06:21:56 +0000
commit478f83f711ac8305966b28cf4fa7fa0cee46c46e (patch)
tree87c3527db042ec3cb36f73926f1b1944352754d0 /drivers
parente53e75f4cef45b03d2fe15e6d7206afd7246238f (diff)
parentc199514372b40dea4b79cb02a65558715e1a628e (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sensors/cirque_pinnacle_spi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/sensors/cirque_pinnacle_spi.c b/drivers/sensors/cirque_pinnacle_spi.c
index e00e73eb8c..34c77df07b 100644
--- a/drivers/sensors/cirque_pinnacle_spi.c
+++ b/drivers/sensors/cirque_pinnacle_spi.c
@@ -7,6 +7,7 @@
// Masks for Cirque Register Access Protocol (RAP)
#define WRITE_MASK 0x80
#define READ_MASK 0xA0
+#define FILLER_BYTE 0xFC
extern bool touchpad_init;
@@ -16,11 +17,11 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count) {
uint8_t cmdByte = READ_MASK | address; // Form the READ command byte
if (touchpad_init) {
if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) {
- spi_write(cmdByte);
- spi_read(); // filler
- spi_read(); // filler
+ spi_write(cmdByte); // write command byte, receive filler
+ spi_write(FILLER_BYTE); // write & receive filler
+ spi_write(FILLER_BYTE); // write & receive filler
for (uint8_t i = 0; i < count; i++) {
- data[i] = spi_read(); // each sepsequent read gets another register's contents
+ data[i] = spi_write(FILLER_BYTE); // write filler, receive data on the third filler send
}
} else {
#ifdef CONSOLE_ENABLE