Author Topic: mc-Things Video Suggestions??  (Read 637 times)

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: mc-Things Video Suggestions??
« on: October 20, 2016, 10:34:45 pm »
I think you are probably right about the version numbers.

You might want to turn on "issues" on your github site so we can comment there rather than here.

So far, it's working well, I fixed a couple of trivial items. The idea of using strings to feedback items is brilliant! I never would have thought of that. As you can probably tell I'm mostly a C programmer (not vb.net at all), so passing strings would not be a thing.

I am having a lot of trouble with sleep/wake mode though. Not with your library, more with the way the accelerator works. When you set sleep mode, when it wakes, you get 1 interrupt, not 2 as expected (ie strings "autosleep", "shock"). You have to read the interrupt, get "autosleep", then read the SMOD register (to clear the sleep/wake interrupt), then read the interrupt source register again, to get the actual interrupt, clear it, etc.

If you don't read SMOD, you get no more interrupts - autosleep is stuck there, if you don't read the int_source again, then clear it, you are again stuck.

This is not what I expected, I thought that you would get two interrupts, "autosleep", and "shock" (or whatever). So the for loop would handle it. Doesn't work.

Have you had any success with sleep mode? All the documentation glosses over the ISR routine part of things.

This is what the application notes say the ISR is supposed to be:

Code: [Select]
Interrupt void isr_KBI (void)
{
      //clear the interrupt flag
      CLEAR_KBI_INTERRUPT;
      //Determine the source of interrupt by reading the system interrupt register
      Int_SourceSystem = IIC_RegRead(0x0C);
      //Set up Case statement here to service all of the possible interrupts
      if ((Int_SourceSystem &=0x80)==0x80)
      {
            //Perform an Action since Auto-Sleep Flag has been set
            //Read the System Mode to clear the system interrupt
            Int_SysMod = IIC_RegRead(0x0B);
            if (Int_SysMod==0x02)
            {//sleep mode
            }
            else if (Int_SysMod==0x01)
            {//Wake Mode
            }
            else
            {//Error
            }
      }
}

Which really doesn't seem to be what happens.

Thanks.
« Last Edit: October 20, 2016, 10:46:09 pm by Nick_W »