mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-20 11:32:04 +00:00
touch: address simplification
This commit is contained in:
parent
6aeccd5ee1
commit
2ae1c99b06
@ -43,13 +43,13 @@ void touch_init(void)
|
|||||||
ensure(sectrue * (HAL_OK == HAL_I2C_Init(&i2c_handle)), NULL);
|
ensure(sectrue * (HAL_OK == HAL_I2C_Init(&i2c_handle)), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TOUCH_ADDRESS 56
|
#define TOUCH_ADDRESS (0x38 << 1) // the HAL requires the 7-bit address to be shifted by one bit
|
||||||
#define TOUCH_PACKET_SIZE 16
|
#define TOUCH_PACKET_SIZE 16
|
||||||
|
|
||||||
uint32_t touch_read(void)
|
uint32_t touch_read(void)
|
||||||
{
|
{
|
||||||
static uint8_t data[TOUCH_PACKET_SIZE], old_data[TOUCH_PACKET_SIZE];
|
static uint8_t data[TOUCH_PACKET_SIZE], old_data[TOUCH_PACKET_SIZE];
|
||||||
if (HAL_OK != HAL_I2C_Master_Receive(&i2c_handle, TOUCH_ADDRESS << 1, data, TOUCH_PACKET_SIZE, 1)) {
|
if (HAL_OK != HAL_I2C_Master_Receive(&i2c_handle, TOUCH_ADDRESS, data, TOUCH_PACKET_SIZE, 1)) {
|
||||||
return 0; // read failure
|
return 0; // read failure
|
||||||
}
|
}
|
||||||
if (0 == memcmp(data, old_data, TOUCH_PACKET_SIZE)) {
|
if (0 == memcmp(data, old_data, TOUCH_PACKET_SIZE)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user