Author Topic: [ATSAMD10D13AS] Sleep mode and receiving multiple data packets with I2C  (Read 401 times)

0 Members and 1 Guest are viewing this topic.

Offline WILDERNESSBAGELTopic starter

  • Contributor
  • Posts: 28
  • Country: hr
The SAMD10 goes to sleep and is woken up by I2C on address match. I am just wondering if there is a way to set up the communication so I can send multiple data bytes without having to wake up the device until the transaction is over. So for example now I have this on the master side (arduino):
Code: [Select]
   

typedef union test{
  uint32_t toSend;
  uint8_t mBytes[sizeof(uint32_t)];
}test;

for(uint8_t i = 0; i < sizeof(uint32_t); ++i){

      Wire.beginTransmission(0x29);    // transmit address
      Wire.write(t.mBytes[i]);              // sends refresh time in ms
      Wire.endTransmission();
}

So everytime I want to send data to the device I need to send the address first and then check on the slave check if all bytes have been received. I would like to make the master code look like this:

Code: [Select]

Wire.beginTransmission(0x29);    // transmit address
for(uint8_t i = 0; i < sizeof(uint32_t); ++i){
      // or something like
     Wire.write(t.mBytes[i]);              // sends refresh time in ms
}
Wire.endTransmission();

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf