From ee7e6134a213a458d8cefe97b7e9a548a82feda4 Mon Sep 17 00:00:00 2001 From: mcudev <29890609+mcudev@users.noreply.github.com> Date: Wed, 18 Oct 2017 10:54:03 -0400 Subject: [PATCH] bootloader, firmware: do not need touch interrupt handlers or to enable touch interrupts (#59) --- embed/trezorhal/touch.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/embed/trezorhal/touch.c b/embed/trezorhal/touch.c index 578fff336e..a15bfbc049 100644 --- a/embed/trezorhal/touch.c +++ b/embed/trezorhal/touch.c @@ -14,8 +14,8 @@ I2C_HandleTypeDef i2c_handle = { .Instance = I2C1, }; -int touch_init(void) { - +int touch_init(void) +{ // Enable I2C clock __HAL_RCC_I2C1_CLK_ENABLE(); @@ -44,17 +44,14 @@ int touch_init(void) { return 1; } - // Enable IRQs - HAL_NVIC_EnableIRQ(I2C1_EV_IRQn); - HAL_NVIC_EnableIRQ(I2C1_ER_IRQn); - return 0; } #define TOUCH_ADDRESS 56 #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]; if (HAL_OK != HAL_I2C_Master_Receive(&i2c_handle, TOUCH_ADDRESS << 1, data, TOUCH_PACKET_SIZE, 1)) { return 0; // read failure @@ -90,11 +87,3 @@ void touch_click(void) // flush touch events if any while (touch_read()) { } } - -void I2C1_EV_IRQHandler(void) { - HAL_I2C_EV_IRQHandler(&i2c_handle); -} - -void I2C1_ER_IRQHandler(void) { - HAL_I2C_ER_IRQHandler(&i2c_handle); -}