View Single Post
  #3   Spotlight this post!  
Unread 14-01-2008, 18:05
Abrakadabra Abrakadabra is offline
Here We Go !!!
AKA: Scott Kukshtel, Mr. K
FRC #3467 (The Windham Windup!)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Windham, New Hampshire
Posts: 160
Abrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant futureAbrakadabra has a brilliant future
Re: Programming the Infrared board

Hi Brad -

Thanks for doing this. This is also a good example of showing that you can use the IFI headers in a WPILib program, something that's not so apparent on first glance.

Some questions:

- I think I understand what RegisterRepeatingTimer() does, although it is not really documented. The header file says that timer interrupt handlers are "called with interrupts disabled". However, do you not also need to disable interrupts when you access the shared globals in the main( ) routine?

- The variables "changed" and "previous" in your ISR don't seem to do anything? Again, I think I understand what you are trying to do (e.g. collect all the commands in between times that the program actually checks for them), but "previous" never gets set to anything other than zero, and "changed" is calculated, but then not used. Would it not be simpler to just say:
Code:
 irCommands |= current;
and then the main() routine can turn off each bit as it gets processed? I think that's what the code is essentially doing now, since "previous" is always zero.
Reply With Quote