Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: zifnab06 on April 16, 2013, 11:02:47 am

Title: DigiUSB and IRremote
Post by: zifnab06 on April 16, 2013, 11:02:47 am
Hello,


I've been attempting (fairly unsuccessfully) to get the IRremote library (https://github.com/microtherion/Arduino-IRremote (https://github.com/microtherion/Arduino-IRremote)) working with DigiUSB. I guess I had a few questions:


What exactly does DigiUSB use as far as the hardware goes? I've seen conflicting reports, anywhere from "Both timers" to "One timer" to "Something that breaks Delay() and millis()".


The main error when compiling a project containing both of these libraries is:
Code: [Select]
IRremote\IRremote.cpp.o: In function `__vector_2':
C:\users\zifnab06\Documents\Arduino\libraries\IRremote/IRremote.cpp:429: multiple definitions of `__vector_2'
DigiSparkUSB\usbdrvasm.S.o:(.text+0x58): first defined here




From what I've been able to find, __vector_2 refers to a timer? My assembly is incredibly rusty.


Thanks!
Title: Re: DigiUSB and IRremote
Post by: digistump on April 16, 2013, 06:00:54 pm
DigiUSB no longer breaks the timers, delay, millis - if you're using the newest version of the software - http://sourceforge.net/projects/digistump/files/ (http://sourceforge.net/projects/digistump/files/)


Timer1 is used by the system for delay and other functions.


DigiUSB isn't taking up the timers (there are two - 0 and 1) but it does use some interrupts which is what is conflicting here.


Here is another IRremote library some have had luck with - though whether it works with DigiUSB I can't say for sure - [size=78%]http://digistump.com/board/index.php/topic,19.15.html (http://digistump.com/board/index.php/topic,19.15.html)[/size]
Title: Re: DigiUSB and IRremote
Post by: Bluebie on April 17, 2013, 02:04:14 am
Vector 2 is specifically the Pin Change interrupt.
Title: Re: DigiUSB and IRremote
Post by: microtherion on April 17, 2013, 01:25:28 pm
Vector 2 is specifically the Pin Change interrupt.


Correct. My flavor of the IRremote library switched to using pin change interrupts for IR input. However, it should be perfectly possible to use the polling based method in the original IRremote library: https://github.com/shirriff/Arduino-IRremote (https://github.com/shirriff/Arduino-IRremote)


You would have to combine the polling with the timer definitions in IRremoteInt.h in my flavor of the library (IR_USE_TIMER0 should work best for digispark).
Title: Re: DigiUSB and IRremote
Post by: zifnab06 on April 17, 2013, 04:11:24 pm
Cool, thank you for your help! I'll try and post back when I get something working.