Hello all,
First of all, I want to thank the folks at Leaf Labs for putting this product together. I have been using an Arduino for a while and ran into limitations with their IDE as well as with their chip's 8bit nature, so this product was a greatly needed upgrade even if the IDE and libraries are still in their early stages.
I have only been playing around in C for a month or so on the Arduino, so pardon any overly noobish questions. I am building a device to work with a telescope and carry out various astrodynamics calculations. I got my Maple board this past Friday and I already have just about everything working (serial VFD display and GPS, I2C RTC, 3-axis accelerometer and 3-axis magnetometer). What is proving to be a thorn in my side is the library that I was using on the Arduino for interfacing a Playstation2 controller.
The library that I am trying to port is called PS2X_lib. It makes use of several functions in this format:
unsigned long CalledFromLoopToGetPulseCounts( void )
{
unsigned long c;
{
uint8_t SaveSREG = SREG; // save interrupt flag
cli(); // disable interrupts
c = PulseCounts; // access the shared data
SREG = SaveSREG; // restore the interrupt flag
}
return( c );
}
I am not certain how to beat the code into submission to get it to work with the Maple. SREG is not defined, nor is cli(). I am under the belief that a the function nvic_globalirq_disable() is probably the best substitution, but that is just a wild guess based upon my browsing through the supplied Maple code.
If someone could show me a quick example of how this function could be rewritten, I could repeat the process for the rest of the Library that I am porting and I believe the code would then work as expected. If there is a Library porting guide or something that covers these sorts of pitfalls, I would be interested in having it pointed out. Google has failed me on this endeavor. :)
Thanks,
Jason