From 2f60747dd3b51321903de9c51789765d41ed83e4 Mon Sep 17 00:00:00 2001 From: ozpv <39195175+ozpv@users.noreply.github.com> Date: Mon, 17 Aug 2026 00:01:22 -0500 Subject: audio driver --- Core/Src/i2c.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Core/Src/i2c.c') diff --git a/Core/Src/i2c.c b/Core/Src/i2c.c index 6ebfe13..4f3b697 100755 --- a/Core/Src/i2c.c +++ b/Core/Src/i2c.c @@ -38,7 +38,7 @@ void MX_I2C4_Init(void) /* USER CODE END I2C4_Init 1 */ hi2c4.Instance = I2C4; - hi2c4.Init.Timing = 0x00201E2D; + hi2c4.Init.Timing = 0x307075B1; hi2c4.Init.OwnAddress1 = 0; hi2c4.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c4.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; @@ -74,12 +74,22 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef* i2cHandle) { GPIO_InitTypeDef GPIO_InitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; if(i2cHandle->Instance==I2C4) { /* USER CODE BEGIN I2C4_MspInit 0 */ /* USER CODE END I2C4_MspInit 0 */ + /** Initializes the peripherals clock + */ + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2C4; + PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_D3PCLK1; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) + { + Error_Handler(); + } + __HAL_RCC_GPIOB_CLK_ENABLE(); /**I2C4 GPIO Configuration PB8 ------> I2C4_SCL -- cgit v1.2.3