From 2b30cc16a21b9d6d4d72ec9eb6b0392ce18592d8 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 9 Jul 2018 21:13:49 +0200 Subject: [PATCH] trezorhal: minor fixes to sdcard/touch power on sequence --- embed/trezorhal/sdcard.c | 1 + embed/trezorhal/touch.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/embed/trezorhal/sdcard.c b/embed/trezorhal/sdcard.c index 95d0abb748..4656398926 100644 --- a/embed/trezorhal/sdcard.c +++ b/embed/trezorhal/sdcard.c @@ -89,6 +89,7 @@ void sdcard_init(void) { GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStructure.Pin = GPIO_PIN_0; + HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET); HAL_GPIO_Init(GPIOC, &GPIO_InitStructure); sdcard_default_pin_state(); diff --git a/embed/trezorhal/touch.c b/embed/trezorhal/touch.c index d4f86ac7d5..488623b35a 100644 --- a/embed/trezorhal/touch.c +++ b/embed/trezorhal/touch.c @@ -39,6 +39,20 @@ static I2C_HandleTypeDef i2c_handle; +static void touch_power_on(void) +{ + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); // CTP_ON/PB10 + HAL_Delay(50); +} + +/* +static void touch_power_off(void) +{ + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_SET); // CTP_ON/PB10 + HAL_Delay(50); +} +*/ + void touch_init(void) { GPIO_InitTypeDef GPIO_InitStructure; @@ -48,10 +62,10 @@ void touch_init(void) GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStructure.Pin = GPIO_PIN_10; + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_SET); HAL_GPIO_Init(GPIOB, &GPIO_InitStructure); - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); // CTP_ON/PB10 - HAL_Delay(50); + touch_power_on(); // Enable I2C clock __HAL_RCC_I2C1_CLK_ENABLE();