khoih-prog / TimerInterrupt

This library enables you to use Interrupt from Hardware Timers on an Arduino, such as Nano, UNO, Mega, etc. It now supports 16 ISR-based timers, while consuming only 1 hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks.
MIT License
98 stars 11 forks source link

Leonardo gives old error in #13 when using in Atmel Studio. Not a problem in Arduino IDE or library #19

Closed utsavZebra closed 3 years ago

utsavZebra commented 3 years ago

Introduction

Compiler complains about 'else' without a previous if whereever #if ( TIMER_INTERRUPT_USING_ATMEGA_32U4 ) is in TimerInterrupt-Impl.h

The examples provided in Arduino IDE work though. This is not a problem with Arduino Uno. I was using Uno before I switched.

Steps to Reproduce

An atmel studio project with .h files moved from src_h

Screenshots

image image image

Setup

Microchip Studio: 7.0.2542
Arduino Leonardo: ATMega32U4
khoih-prog commented 3 years ago

Hi,

Thanks for using the library.

I just retested the examples and they're compiled OK, without any error for Leonardo 32u4.

Selection_785

I'm afraid you did something wrong in your code or installation.

I suggest you

  1. Try with the simple example first to see if it's compiled OK on Arduino IDE.
  2. Then move to the new Microchip Studio to see if it's still OK. Even if this is not OK, I still won't work on the issue as this is the responsibility of other people.

You also had to post the MRE at least and to prove this is the issue caused by the library, so that I'll re-open the issue.

Good Luck,

utsavZebra commented 3 years ago

Update: Not a problem with the library. Atmel studio has the option to make a project from an Arduino Sketch. That did the trick as opposed to adding Arduino library in an existing project. Sorry about the confusion and MRE.

khoih-prog commented 3 years ago

Good news. Thanks for the info.