stm32l0xx-hal icon indicating copy to clipboard operation
stm32l0xx-hal copied to clipboard

I2C slave support

Open kuon opened this issue 2 years ago • 0 comments

I use the STM32L0XX serie of chip as I2C->SPI/UART/IO bridge.

And for this, I need the chip to be in STOP mode and wake up on I2C address match.

I currently have a working rust implementation that does not use this HAL, but I'd like to improve it so it could get included.

I do not know what would be the best way to proceed as, while my code work, it might not be "friendly" to include in this HAL without a whole rewrite.

I'd be up to do it, but first I have a few questions:

  • Is there interest for this in the users of this HAL?
  • How do we implement interrupt in a HAL like this? As we need to handle the I2C interrupts, also, the chip is very sensitive to delay, and very little work can be done in the I2C interrupt handler, how do you handle the sharing of resources in the HAL (I use cortex-rtic in my implementation to share the buffer).
  • I2C slave might be possible with DMA, but I never used DMA in rust yet, I'm familiar with it in C, but the whole concept of DMA is a big "no-no" in the rust philosophy, so I am a bit puzzled in how it should be handled.

kuon avatar Jun 11 '22 23:06 kuon