Video experimenter and Wire

Store Forums Video Experimenter General Discussion Video experimenter and Wire

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #547
    Nesredna
    Member

    Hi. any known problems with I2C comunication with other components when using video overlay.
    I try to get a digital compass readings on display,
    when i isolate the code for the experimenter card works fine and isolate the code for the compass that works too. but merging the 2 codes it stops.

    anyone having some similar problems?

    #1139
    Michael
    Keymaster

    Yeah, the problem is that anything that relies on interrupts is going to be in conflict with all the video interrupts. The timing gets screwed up. During the vertical blanking interval (at the end of each frame) there is a period of time when interrupts are not firing, so you can do your I2C communication then. Create a function that sets a flag indicating that we are in VBI. Then register that function to be called at the beginning of VBI.


    void setVBIFlag() {
    inVBI = true;
    }

    In your sketch setup, register this function:


    tv.set_vbi_hook(&setVBIFlag);

    Now, in your sketch main loop you can communicate with the compass like this:


    if (inVBI) {
    // communicate with compass here
    inVBI = false; // reset the flag so we only try to communicate once per frame
    }

    I hope that makes sense. The interrupt driven nature of TVout makes this tricky. I had to do this when I communicated with a Nunchuk with my Hackvision product. You may also run into memory constraints because the I2C library is very bloated memory-wise. I trimmed it down in the Hackvision Controllers library, so you can take a look at that:
    http://nootropicdesign.com/hackvision/downloads/Controllers.zip

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.