mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-05 13:26:57 +00:00
touch: make i2c_handle static and trivial simplification
This commit is contained in:
parent
d1ed02fb98
commit
6aeccd5ee1
@ -13,9 +13,7 @@
|
|||||||
#include "secbool.h"
|
#include "secbool.h"
|
||||||
#include "touch.h"
|
#include "touch.h"
|
||||||
|
|
||||||
I2C_HandleTypeDef i2c_handle = {
|
static I2C_HandleTypeDef i2c_handle;
|
||||||
.Instance = I2C1,
|
|
||||||
};
|
|
||||||
|
|
||||||
void touch_init(void)
|
void touch_init(void)
|
||||||
{
|
{
|
||||||
@ -32,15 +30,15 @@ void touch_init(void)
|
|||||||
};
|
};
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||||
|
|
||||||
I2C_InitTypeDef *init = &(i2c_handle.Init);
|
i2c_handle.Instance = I2C1;
|
||||||
init->OwnAddress1 = 0xFE; // master
|
i2c_handle.Init.ClockSpeed = 400000;
|
||||||
init->ClockSpeed = 400000;
|
i2c_handle.Init.DutyCycle = I2C_DUTYCYCLE_16_9;
|
||||||
init->DutyCycle = I2C_DUTYCYCLE_16_9;
|
i2c_handle.Init.OwnAddress1 = 0xFE; // master
|
||||||
init->AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
i2c_handle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||||
init->DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
i2c_handle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||||
init->GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
i2c_handle.Init.OwnAddress2 = 0;
|
||||||
init->NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
i2c_handle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
|
||||||
init->OwnAddress2 = 0;
|
i2c_handle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
|
||||||
|
|
||||||
ensure(sectrue * (HAL_OK == HAL_I2C_Init(&i2c_handle)), NULL);
|
ensure(sectrue * (HAL_OK == HAL_I2C_Init(&i2c_handle)), NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user