Skip to content

STM32: Enable I2CTarget for STM32L4. #17945

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion ports/stm32/i2cslave.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void i2c_slave_irq_handler(i2c_slave_t *i2c) {
}
}

#elif defined(STM32F7) || defined(STM32H7) || defined(STM32WB)
#elif defined(STM32F7) || defined(STM32H7) || defined(STM32WB) || defined(STM32L4)

void i2c_slave_init_helper(i2c_slave_t *i2c, int addr) {
i2c->CR1 = I2C_CR1_STOPIE | I2C_CR1_ADDRIE | I2C_CR1_RXIE | I2C_CR1_TXIE;
Expand Down
4 changes: 2 additions & 2 deletions ports/stm32/i2cslave.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include STM32_HAL_H

#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32WB)
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32WB) || defined(STM32L4)

#if !defined(I2C2_BASE)
// This MCU doesn't have I2C2_BASE, define it so that the i2c_idx calculation works.
Expand Down Expand Up @@ -63,7 +63,7 @@ static inline void i2c_slave_init(i2c_slave_t *i2c, int irqn, int irq_pri, int a
volatile uint32_t tmp = RCC->APB1ENR1; // Delay after enabling clock
(void)tmp;
}
#elif defined(STM32WB)
#elif defined(STM32WB) || defined(STM32L4)
RCC->APB1ENR1 |= 1 << (RCC_APB1ENR1_I2C1EN_Pos + i2c_idx);
volatile uint32_t tmp = RCC->APB1ENR1; // Delay after enabling clock
(void)tmp;
Expand Down
2 changes: 1 addition & 1 deletion ports/stm32/mpconfigboard_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@
|| defined(MICROPY_HW_I2C3_SCL) || defined(MICROPY_HW_I2C4_SCL)
#define MICROPY_HW_ENABLE_HW_I2C (1)
#ifndef MICROPY_HW_ENABLE_HW_I2C_TARGET
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32WB)
#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32WB) || defined(STM32L4)
#define MICROPY_HW_ENABLE_HW_I2C_TARGET (1)
#else
#define MICROPY_HW_ENABLE_HW_I2C_TARGET (0)
Expand Down
Loading