Skip to content

Change Timer1 to Timer3 on ATmega32u4-based dev boards #115

Open
@CoolBots

Description

@CoolBots

As of version 1.2.1 of the library, ATmega32u4-based boards are defined to use Timer1 raher than Timer3. This configuration conflicts with millis() and micros() functions. While not too difficult to change, it does make the library more difficult to use in educational settings (we're a robotics/programming school for kids). If possible, could Timer1 be changed to Timer3 for these devices? The specific device we are using is an Adafruit ItsyBitsy 5V.

It would be no issue to submit a PR, of course, provided there isn't a strong reason to keep it as Timer1, as technically this would be a breaking change (although it is likely 32u4 users of this library make this modification anyhow, as millis() and micros() are useful functions...). Likewise, if there is a workaround that is fairly straightforward and does not require modification of the library that we are not aware of, please let us know.

It is worthwhile mentioning that we have seen other examples of this choice of Timer1 instead of Timer3 being an issue on 32u4 boards, most notably from Pololu Robotics and Electronics: https://www.pololu.com/docs/0J57/8.b

CodeRef:

#elif defined(__AVR_ATmega32U4__)
#define _useTimer1
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions