I2C testing
This commit is contained in:
@@ -280,9 +280,9 @@ static void MX_ADC2_Init(void) {
|
|||||||
/* I2C1 init function */
|
/* I2C1 init function */
|
||||||
static void MX_I2C1_Init(void) {
|
static void MX_I2C1_Init(void) {
|
||||||
hi2c1.Instance = I2C1;
|
hi2c1.Instance = I2C1;
|
||||||
hi2c1.Init.ClockSpeed = 150000;
|
hi2c1.Init.ClockSpeed = 80000;
|
||||||
// OLED doesnt handle >100k when its asleep (off).
|
// OLED doesnt handle >100k when its asleep (off).
|
||||||
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_16_9;
|
||||||
hi2c1.Init.OwnAddress1 = 0;
|
hi2c1.Init.OwnAddress1 = 0;
|
||||||
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
|
||||||
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c) {
|
|||||||
GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin;
|
GPIO_InitStruct.Pin = SCL_Pin | SDA_Pin;
|
||||||
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_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(SCL_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
|
|||||||
Reference in New Issue
Block a user