1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-02 02:41:28 +00:00

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

This commit is contained in:
Pavol Rusnak 2018-07-19 16:26:40 +02:00
parent 99c5d049b9
commit f1d8a3aaf2
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 3 additions and 18 deletions

View File

@ -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();
}

View File

@ -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;