comparison Small_CPU/Src/stm32f4xx_hal_msp_v3.c @ 327:abec171c2c4b I2C_Improvment

Deactivated internal pullups and I2C interrupt callback Internal GPIO should be configurated to no pull to avoid interferance with external electronic. The interrupt functionality is no longer in used and the callbacks are empty => uncommented enables
author ideenmodellierer
date Wed, 17 Jul 2019 22:41:31 +0200
parents 5f11787b4f42
children 1b995079c045
comparison
equal deleted inserted replaced
326:2559a3f0f1f2 327:abec171c2c4b
108 108
109 /*##-2- Configure peripheral GPIO ##########################################*/ 109 /*##-2- Configure peripheral GPIO ##########################################*/
110 /* I2C TX GPIO pin configuration */ 110 /* I2C TX GPIO pin configuration */
111 GPIO_InitStruct.Pin = I2Cx_SCL_PIN; 111 GPIO_InitStruct.Pin = I2Cx_SCL_PIN;
112 GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; 112 GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
113 GPIO_InitStruct.Pull = GPIO_PULLUP; 113 GPIO_InitStruct.Pull = GPIO_NOPULL;
114 GPIO_InitStruct.Speed = GPIO_SPEED_FAST; 114 GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
115 GPIO_InitStruct.Alternate = I2Cx_SCL_AF; 115 GPIO_InitStruct.Alternate = I2Cx_SCL_AF;
116 116
117 HAL_GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStruct); 117 HAL_GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStruct);
118 118
122 122
123 HAL_GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStruct); 123 HAL_GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStruct);
124 124
125 /*##-3- Configure the NVIC for I2C #########################################*/ 125 /*##-3- Configure the NVIC for I2C #########################################*/
126 /* NVIC for I2C1 */ 126 /* NVIC for I2C1 */
127
128 /* The callbacks are not used => no need to activate the interrupts */
129 /*
127 HAL_NVIC_SetPriority(I2Cx_ER_IRQn, 1, 2); 130 HAL_NVIC_SetPriority(I2Cx_ER_IRQn, 1, 2);
128 HAL_NVIC_EnableIRQ(I2Cx_ER_IRQn); 131 HAL_NVIC_EnableIRQ(I2Cx_ER_IRQn);
129 HAL_NVIC_SetPriority(I2Cx_EV_IRQn, 1, 3); 132 HAL_NVIC_SetPriority(I2Cx_EV_IRQn, 1, 3);
130 HAL_NVIC_EnableIRQ(I2Cx_EV_IRQn); 133 HAL_NVIC_EnableIRQ(I2Cx_EV_IRQn);
134 */
131 } 135 }
132 136
133 /** 137 /**
134 * @brief I2C MSP De-Initialization 138 * @brief I2C MSP De-Initialization
135 * This function frees the hardware resources used in this example: 139 * This function frees the hardware resources used in this example: