1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

trezorhal: don't use legacy symbols from STMhal

This commit is contained in:
Pavol Rusnak 2017-04-10 18:15:48 +02:00
parent 8a1ec2aad6
commit f12c630914
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 23 additions and 25 deletions

View File

@ -12,8 +12,6 @@ int touch_init(void) {
// Enable I2C clock // Enable I2C clock
__HAL_RCC_I2C1_CLK_ENABLE(); __HAL_RCC_I2C1_CLK_ENABLE();
__I2C1_CLK_ENABLE();
// Init SCL and SDA GPIO lines (PB6 & PB7) // Init SCL and SDA GPIO lines (PB6 & PB7)
GPIO_InitTypeDef GPIO_InitStructure = { GPIO_InitTypeDef GPIO_InitStructure = {
.Pin = GPIO_PIN_6 | GPIO_PIN_7, .Pin = GPIO_PIN_6 | GPIO_PIN_7,
@ -29,9 +27,9 @@ int touch_init(void) {
init->ClockSpeed = 400000; init->ClockSpeed = 400000;
init->DutyCycle = I2C_DUTYCYCLE_16_9; init->DutyCycle = I2C_DUTYCYCLE_16_9;
init->AddressingMode = I2C_ADDRESSINGMODE_7BIT; init->AddressingMode = I2C_ADDRESSINGMODE_7BIT;
init->DualAddressMode = I2C_DUALADDRESS_DISABLED; init->DualAddressMode = I2C_DUALADDRESS_DISABLE;
init->GeneralCallMode = I2C_GENERALCALL_DISABLED; init->GeneralCallMode = I2C_GENERALCALL_DISABLE;
init->NoStretchMode = I2C_NOSTRETCH_DISABLED; init->NoStretchMode = I2C_NOSTRETCH_DISABLE;
init->OwnAddress2 = 0; init->OwnAddress2 = 0;
// Init I2C handle // Init I2C handle

View File

@ -90,7 +90,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
GPIO_InitStruct.Pin = (GPIO_PIN_11 | GPIO_PIN_12); GPIO_InitStruct.Pin = (GPIO_PIN_11 | GPIO_PIN_12);
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS; GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
@ -134,7 +134,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
GPIO_InitStruct.Pin = (GPIO_PIN_14 | GPIO_PIN_15); GPIO_InitStruct.Pin = (GPIO_PIN_14 | GPIO_PIN_15);
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS; GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
@ -143,7 +143,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
GPIO_InitStruct.Pin = GPIO_PIN_13; GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS; GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
#endif #endif
@ -153,7 +153,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
GPIO_InitStruct.Pin = GPIO_PIN_12; GPIO_InitStruct.Pin = GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS; GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
#endif #endif
@ -179,7 +179,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Pin = GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS; GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
@ -187,7 +187,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
GPIO_InitStruct.Pin = GPIO_PIN_3; GPIO_InitStruct.Pin = GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS; GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
@ -433,11 +433,11 @@ if (pdev->id == USB_PHY_FS_ID)
/*Initialize LL Driver */ /*Initialize LL Driver */
HAL_PCD_Init(&pcd_fs_handle); HAL_PCD_Init(&pcd_fs_handle);
HAL_PCD_SetRxFiFo(&pcd_fs_handle, 0x80); HAL_PCDEx_SetRxFiFo(&pcd_fs_handle, 0x80);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 0, 0x20); HAL_PCDEx_SetTxFiFo(&pcd_fs_handle, 0, 0x20);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 1, 0x40); HAL_PCDEx_SetTxFiFo(&pcd_fs_handle, 1, 0x40);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 2, 0x20); HAL_PCDEx_SetTxFiFo(&pcd_fs_handle, 2, 0x20);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 3, 0x40); HAL_PCDEx_SetTxFiFo(&pcd_fs_handle, 3, 0x40);
} }
#endif #endif
#if defined(USE_USB_HS) #if defined(USE_USB_HS)
@ -465,11 +465,11 @@ if (pdev->id == USB_PHY_HS_ID)
/*Initialize LL Driver */ /*Initialize LL Driver */
HAL_PCD_Init(&pcd_hs_handle); HAL_PCD_Init(&pcd_hs_handle);
HAL_PCD_SetRxFiFo(&pcd_hs_handle, 0x80); HAL_PCDEx_SetRxFiFo(&pcd_hs_handle, 0x80);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 0, 0x20); HAL_PCDEx_SetTxFiFo(&pcd_hs_handle, 0, 0x20);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 1, 0x40); HAL_PCDEx_SetTxFiFo(&pcd_hs_handle, 1, 0x40);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 2, 0x20); HAL_PCDEx_SetTxFiFo(&pcd_hs_handle, 2, 0x20);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 3, 0x40); HAL_PCDEx_SetTxFiFo(&pcd_hs_handle, 3, 0x40);
#else // !defined(USE_USB_HS_IN_FS) #else // !defined(USE_USB_HS_IN_FS)
/*Set LL Driver parameters */ /*Set LL Driver parameters */
pcd_hs_handle.Instance = USB_OTG_HS; pcd_hs_handle.Instance = USB_OTG_HS;
@ -495,9 +495,9 @@ if (pdev->id == USB_PHY_HS_ID)
/*Initialize LL Driver */ /*Initialize LL Driver */
HAL_PCD_Init(&pcd_hs_handle); HAL_PCD_Init(&pcd_hs_handle);
HAL_PCD_SetRxFiFo(&pcd_hs_handle, 0x200); HAL_PCDEx_SetRxFiFo(&pcd_hs_handle, 0x200);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 0, 0x80); HAL_PCDEx_SetTxFiFo(&pcd_hs_handle, 0, 0x80);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 1, 0x174); HAL_PCDEx_SetTxFiFo(&pcd_hs_handle, 1, 0x174);
#endif // !USE_USB_HS_IN_FS #endif // !USE_USB_HS_IN_FS
} }
@ -748,7 +748,7 @@ void OTG_FS_WKUP_IRQHandler(void) {
OTG_CMD_WKUP_Handler(&pcd_fs_handle); OTG_CMD_WKUP_Handler(&pcd_fs_handle);
/* Clear EXTI pending Bit*/ /* Clear EXTI pending Bit*/
__HAL_USB_FS_EXTI_CLEAR_FLAG(); __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
} }
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/