From f1d8a3aaf217c9b2040313d4bb9327e8fe04c954 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 19 Jul 2018 16:26:40 +0200 Subject: [PATCH] embed: don't set pins to OUTPUT in {sdcard,touch}_active_pin_state when they were already set like this in {sdcard,touch}_default_pin_state --- embed/trezorhal/sdcard.c | 8 -------- embed/trezorhal/touch.c | 13 +++---------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/embed/trezorhal/sdcard.c b/embed/trezorhal/sdcard.c index e68a2c4f3d..78606772b1 100644 --- a/embed/trezorhal/sdcard.c +++ b/embed/trezorhal/sdcard.c @@ -84,13 +84,6 @@ static inline void sdcard_active_pin_state(void) { GPIO_InitTypeDef GPIO_InitStructure; - // configure the SD card circuitry on/off pin - GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStructure.Pull = GPIO_NOPULL; - GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStructure.Pin = GPIO_PIN_0; - HAL_GPIO_Init(GPIOC, &GPIO_InitStructure); - // configure SD GPIO GPIO_InitStructure.Mode = GPIO_MODE_AF_PP; GPIO_InitStructure.Pull = GPIO_PULLUP; @@ -102,7 +95,6 @@ static inline void sdcard_active_pin_state(void) { HAL_GPIO_Init(GPIOD, &GPIO_InitStructure); } - void sdcard_init(void) { sdcard_default_pin_state(); } diff --git a/embed/trezorhal/touch.c b/embed/trezorhal/touch.c index ca66f2ebc4..be562995eb 100644 --- a/embed/trezorhal/touch.c +++ b/embed/trezorhal/touch.c @@ -43,8 +43,8 @@ static inline void touch_default_pin_state(void) { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_SET); // CTP_ON/PB10 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_6, GPIO_PIN_RESET); // CTP_I2C_SCL/PB6 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); // CTP_I2C_SDA/PB7 - HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET); // CTPM_REST/PC5 - // don't touch CTPM_INT = leave in High Z + HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET); // CTP_REST/PC5 + // don't touch CTP_INT = leave in High Z // set above pins to OUTPUT / NOPULL GPIO_InitTypeDef GPIO_InitStructure; @@ -60,17 +60,10 @@ static inline void touch_default_pin_state(void) { static inline void touch_active_pin_state(void) { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); // CTP_ON/PB10 - HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET); // CTPM_REST/PC5 + HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET); // CTP_REST/PC5 GPIO_InitTypeDef GPIO_InitStructure; - // configure the CTP circuitry on/off pin - GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStructure.Pull = GPIO_NOPULL; - GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStructure.Pin = GPIO_PIN_10; - HAL_GPIO_Init(GPIOB, &GPIO_InitStructure); - // configure CTP I2C SCL and SDA GPIO lines (PB6 & PB7) GPIO_InitStructure.Mode = GPIO_MODE_AF_OD; GPIO_InitStructure.Pull = GPIO_NOPULL;