Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for stm32-extended I²C driver #951

Merged
merged 2 commits into from
Feb 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/modm/platform/i2c/stm32-extended/i2c_master.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ MODM_ISR(I2C{{ id }}_EV)
transaction->detaching(modm::I2c::DetachCause::ErrorCondition);
transaction = nullptr;
}
callNextTransaction();
}
else if (nextOperation == modm::I2c::Operation::Stop)
{
Expand Down Expand Up @@ -501,7 +502,7 @@ modm::platform::I2cMaster{{ id }}::initializeWithPrescaler(uint32_t timingRegist
Rcc::enable<Peripheral::I2c{{id}}>();

// Disable the I2C peripheral which causes a software reset
I2C{{ id }}->CR1 &= ~I2C_CR1_PE;
I2C{{ id }}->CR1 = 0;

// Configure I2Cx: Frequency range
// 39.4.8: Before enabling the peripheral, the I2C master clock must be configured by setting the
Expand Down Expand Up @@ -538,9 +539,6 @@ modm::platform::I2cMaster{{ id }}::initializeWithPrescaler(uint32_t timingRegist
// Disable Own Address 2
I2C{{ id }}->OAR2 = 0;

// Configure Generalcall and NoStretch mode
I2C{{ id }}->CR1 = (0 | I2C_CR1_NOSTRETCH);

%% if shared_interrupt
// Enable Interrupt
NVIC_SetPriority(I2C{{ id }}_IRQn, 10);
Expand All @@ -556,7 +554,7 @@ modm::platform::I2cMaster{{ id }}::initializeWithPrescaler(uint32_t timingRegist
%% endif

// Enable peripheral
I2C{{ id }}->CR1 |= I2C_CR1_PE;
I2C{{ id }}->CR1 = I2C_CR1_PE;
}

void
Expand Down