Asyncrhonous I2C transfert

brebisson
Posts: 13
Joined: Fri Dec 22, 2023 9:44 am

Asyncrhonous I2C transfert

Postby brebisson » Wed Sep 25, 2024 2:22 pm

Hello,

I need to send (repeatedly) a pack of 512 bytes using I2C in a non blocking manner...
Something along the lines of:
```
void myLoop()
{
while (true)
{
do stuff
if (done sending through I2C)
start_sendig_I2c(512 bytes buffer)
do more stuff
}
}
```

I have had a look at the I2C driver, and all I can find is the i2c_master_write_to_device function which seems to be blocking..
Is there a i2c_master_write_to_device_async function that will let me start a sending and then return imediately?

I am mostly working in the arduino IDE if it maters...

Thanks,
Cyrille

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Asyncrhonous I2C transfert

Postby MicroController » Wed Sep 25, 2024 4:34 pm

Code: Select all

do stuff
if (done sending through I2C)
  start_sendig_I2c(512 bytes buffer)
do more stuff
Looks like your typical state machine to simulate multi-tasking. Try using the actual multi-tasking provided by FreeRTOS.

Who is online

Users browsing this forum: Baidu [Spider] and 230 guests