I am using Arduino pin 52 with IRQ enabled to detect an IR signal. I want to use the "Fast_digitalRead" macro to detect the state of the pin. My program fails to compile with the following error.
C:\Program Files (x86)\Arduino\hardware\aurduino_Dx/aurix/variants/tc275/Variant.h:511:36: error: 'D52_IN' was not declared in this scope
#define Fast_digitalRead(port) (D##port##_IN)
Is pin 52 not defined for fast read or do I need to do something? Thanks for any help
What about IRQs? I seem to be detecting transitions (FALLING) when I use 52 in attach IRQs although I do seem to be detecting more transitions than expected! Should I use 52A?
No, the attachInterrupt() function is not affected by the dual pin connections to pin52. The interrupt function will detect edges that are only a few hundred nanoseconds apart so any noise around the switching point could generate a lot of interrupts. I would suggest calling detachInterrupt(52) at the start of the service routine to stop subsequent calls to the interrupt from noise. At the end of the interrupt, you could then re-enable it with attachInterrupt(52). It might be a good idea to put a check in to make sure the pin is stable and in the expected state before re-attaching it!