1
0
Fork 0

Increase matrix scanning speed on xd84 (#7517)

* Increase matrix scanning speed

* Fix func name in failure output
This commit is contained in:
Joel Challis 2019-12-03 19:39:21 +00:00 committed by GitHub
parent 1c8208ad9a
commit 1718dfa658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 36 deletions

View file

@ -76,3 +76,20 @@ uint8_t pca9555_readPins(uint8_t slave_addr, uint8_t port) {
}
return data;
}
uint16_t pca9555_readAllPins(uint8_t slave_addr) {
uint8_t addr = SLAVE_TO_ADDR(slave_addr);
typedef union {
uint8_t u8[2];
uint16_t u16;
} data16;
data16 data;
i2c_status_t ret = i2c_readReg(addr, CMD_INPUT_0, &data.u8[0], sizeof(data), TIMEOUT);
if (ret != I2C_STATUS_SUCCESS) {
print("pca9555_readAllPins::FAILED\n");
}
return data.u16;
}