mirror of
https://github.com/qmk/qmk_firmware
synced 2024-11-18 01:46:09 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
478f83f711
1 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
||||||
// Masks for Cirque Register Access Protocol (RAP)
|
// Masks for Cirque Register Access Protocol (RAP)
|
||||||
#define WRITE_MASK 0x80
|
#define WRITE_MASK 0x80
|
||||||
#define READ_MASK 0xA0
|
#define READ_MASK 0xA0
|
||||||
|
#define FILLER_BYTE 0xFC
|
||||||
|
|
||||||
extern bool touchpad_init;
|
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
|
uint8_t cmdByte = READ_MASK | address; // Form the READ command byte
|
||||||
if (touchpad_init) {
|
if (touchpad_init) {
|
||||||
if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) {
|
if (spi_start(CIRQUE_PINNACLE_SPI_CS_PIN, CIRQUE_PINNACLE_SPI_LSBFIRST, CIRQUE_PINNACLE_SPI_MODE, CIRQUE_PINNACLE_SPI_DIVISOR)) {
|
||||||
spi_write(cmdByte);
|
spi_write(cmdByte); // write command byte, receive filler
|
||||||
spi_read(); // filler
|
spi_write(FILLER_BYTE); // write & receive filler
|
||||||
spi_read(); // filler
|
spi_write(FILLER_BYTE); // write & receive filler
|
||||||
for (uint8_t i = 0; i < count; i++) {
|
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 {
|
} else {
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
|
|
Loading…
Reference in a new issue