gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Using TIMER Irq on Arm7

#75595 - sasq - Tue Mar 14, 2006 2:52 pm

I need to update the touchscreen position more often then once per frame and tried using the timer instead of vblank as interrupt source on the arm7 side but I could not get it to work (interrupts never occured).

I basically changed the standard (libnds) arm7 template like this:

Code:

        //irqSet(IRQ_VBLANK, VblankHandler);
        //irqEnable(IRQ_VBLANK);

        irqSet(IRQ_TIMER0, VblankHandler);
        TIMER0_CR = TIMER_ENABLE | TIMER_DIV_256;
        TIMER0_DATA = TIMER_FREQ_256(100);
        irqEnable(IRQ_TIMER0);


I alos tried using TIMER1 and keeping VBLANK interrupt on too, but the timer never triggers.... any ideas?

#75600 - knight0fdragon - Tue Mar 14, 2006 3:51 pm

did u comment out irqInit()?
_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206

#75651 - sasq - Tue Mar 14, 2006 11:14 pm

nope. for a while there I thought maybe I had but to be sure I tried again and still nothing...

#75652 - DekuTree64 - Tue Mar 14, 2006 11:24 pm

You need to set bit6 of TIMER0_CR for it to generate an interrupt.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#75703 - sasq - Wed Mar 15, 2006 10:19 am

shit, how stupid am I ?