diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-11 13:31:06 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-11 13:31:06 +0200 |
commit | 687767404ede06182a5d1f09ab3b7c66ba5f4d13 (patch) | |
tree | 7fd270d23424c103f8efe5f94ba9a43fedbf3997 /stm32f091/stm32f0xx_hal_msp.c | |
parent | 4625b939aad3537bd130617944e01f5da693b23d (diff) |
WIP merge fix
Diffstat (limited to 'stm32f091/stm32f0xx_hal_msp.c')
-rw-r--r-- | stm32f091/stm32f0xx_hal_msp.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/stm32f091/stm32f0xx_hal_msp.c b/stm32f091/stm32f0xx_hal_msp.c index 8fd7330..d99b334 100644 --- a/stm32f091/stm32f0xx_hal_msp.c +++ b/stm32f091/stm32f0xx_hal_msp.c @@ -1,10 +1,11 @@ +#include <stm32f0xx_hal.h> + +#include "main.h" #include "stm32f0xx_hal_msp.h" void HAL_MspInit(void) { - return; __HAL_RCC_SYSCFG_CLK_ENABLE(); __HAL_RCC_PWR_CLK_ENABLE(); - HAL_NVIC_SetPriority(PendSV_IRQn, 3, 0); } void HAL_UART_MspInit(UART_HandleTypeDef* huart) { @@ -30,3 +31,22 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) { } } +void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) { + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if (hi2c->Instance==I2C1) { + __HAL_RCC_GPIOB_CLK_ENABLE(); + /** + * I2C1 GPIO Configuration + * PB8 ------> I2C1_SCL + * PB9 ------> I2C1_SDA + */ + GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; + GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF1_I2C1; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + __HAL_RCC_I2C1_CLK_ENABLE(); + } +} + |