From 5b1f94522624e18fe9fd94478ada1c8d8997b747 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 11 Oct 2022 14:27:53 +0200 Subject: more WIP, untested i2c but usart2 works --- stm32f091/stm32f0xx_hal_msp.c | 52 ------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 stm32f091/stm32f0xx_hal_msp.c (limited to 'stm32f091/stm32f0xx_hal_msp.c') diff --git a/stm32f091/stm32f0xx_hal_msp.c b/stm32f091/stm32f0xx_hal_msp.c deleted file mode 100644 index d99b334..0000000 --- a/stm32f091/stm32f0xx_hal_msp.c +++ /dev/null @@ -1,52 +0,0 @@ -#include - -#include "main.h" -#include "stm32f0xx_hal_msp.h" - -void HAL_MspInit(void) { - __HAL_RCC_SYSCFG_CLK_ENABLE(); - __HAL_RCC_PWR_CLK_ENABLE(); -} - -void HAL_UART_MspInit(UART_HandleTypeDef* huart) { - return; - GPIO_InitTypeDef GPIO_InitStruct = {0}; - if(huart->Instance==USART2) { - __HAL_RCC_USART2_CLK_ENABLE(); - __HAL_RCC_GPIOA_CLK_ENABLE(); - GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.Alternate = GPIO_AF1_USART2; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - } -} - -void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) { - return; - if(huart->Instance==USART2) { - __HAL_RCC_USART2_CLK_DISABLE(); - HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3); - } -} - -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(); - } -} - -- cgit v1.2.3