I've been using the Arduino IDE for some time now, and I want to shift to coding for the bare AVR microcontroller. So I wanted to begin by porting required arduino libraries to C/C++. I started with the Radiohead library, but I've noticed a lot of variables/tokens that are directly used without a definition for them. For example:
// path :RadioHead/RH_ASK.cpp
#if (RH_PLATFORM == RH_PLATFORM_GENERIC_AVR8)
#ifdef RH_ASK_PTT_PIN
RH_ASK_PTT_DDR |= (1<<RH_ASK_PTT_PIN);
RH_ASK_TX_DDR |= (1<<RH_ASK_TX_PIN);
RH_ASK_RX_DDR &= ~(1<<RH_ASK_RX_PIN);
#else
RH_ASK_TX_DDR |= (1<<RH_ASK_TX_PIN);
RH_ASK_RX_DDR &= ~(1<<RH_ASK_RX_PIN);
#endif
#else
// Set up digital IO pins for arduino
pinMode(_txPin, OUTPUT);
pinMode(_rxPin, INPUT);
pinMode(_pttPin, OUTPUT);
#endif
None of the tokens in this snippet like "RH_ASK_PTT_PIN" or "RH_ASK_TX_PIN" were mentioned anywhere in the code before or any other file that was included.
I understand what the code does, but how does the compiler know what these tokens mean? I tried to compile this code using Atmel Studio but it gives me an error (As it should):
"RH_ASK_PTT_PIN" not declared in this scope
So how does this library work with the Arduino IDE?
Link to the library : https://github.com/PaulStoffregen/RadioHead
Also can someone suggest tags for this post? Its my first post here.