IRLib 2.02 Increases Support for SAMD 21

A few weeks ago we released IRLib 2.01 with preliminary support for SAMD 21 processors such as used in Arduino Zero and Adafruit Feather M0 boards. Then initial release had many hardcoded values. For example output was only available on pin 9 and the timer interrupt for the 50 µs receiver class was hardcoded to use TC3.

In our latest release IRLib 2.02 you now can use any available PWM pin on your platform for output by editing values in IRLibProtocols/IRLibSAMD21.h

You can now also choose to use TC4 or TC5 to drive the hardware interrupt for the 50 µs receiver class.

Both sending and receiving use GCLK0. Note that typically GCLK0-GCLK3 are reserved for internal Arduino infrastructure use however we are using GCLK0 with its default clock source of 48 MHz and a divisor of 1. Because we are not modifying those defaults, it is safe to use. That allows you complete freedom to use GCLK4-GCLK7 for other purposes.

The code has been tested on Arduino Zero, Arduino M0 Pro, and Adafruit Feather M0 BLE boards successfully.

The code is available now on GitHub at https://github.com/cyborg5/IRLib2

3 thoughts on “IRLib 2.02 Increases Support for SAMD 21

  1. Hello Chris,
    I’d like to thank you for developing the IRLIB as I needed an interrupt driven system. I have it working partially on an Arduino Pro Mini, but have come across a problem which I think is a code clash. I have an RGB LED on pins 9, 10, and 11, and am running a simple test program on it cycling the colours, except pin 11 refuses to work with analogWrite, while 9 and 10 do. If I comment out the IRLIB references and make the switch/ case code go direct to the LED code, then all LEDs work as expected.
    Is this something you might be able to shed some light on to please?
    Thanks,
    Sin Tropy

    • Hmmph, on re-reading your extensive* notes I realised that it was a timer clash. Changing the errant LED from pin 11 to pin 5 fixed the problem.
      *It must have taken ages to write up such a clear set of notes in your user manual, but it helps enormously with understanding what is going on, so grateful thanks for that too.
      Sin T

      • I’m sorry I didn’t have time earlier to research your problem. I suspected it was a timer conflict that I needed to do a little research to figure that out for sure and I just didn’t have time to look into it. I’m glad you got it figured out on your own. And thanks for the kind words about the documentation. I guess my efforts to do that documentation really paid off.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.