- Define port and pin used for a signal, easily changed later in the development process
- Define polarity of a signal, i. e. active high or active low, easily changed later in the development process
- use port/pin/polarity definition for regular input/output
- Simulate open-collector outputs
- use port/pin/polarity for pin change interrupt applications
- also be able to use 3rd party libraries such as VUSB or IRMP, which require specifying a port letter and pin number as separate #defines,
- also be able to use Arduino libraries, which refer to pins by the number used in the Arduino IDE
- Refer to pins with alternate functions like RXD0 or OC1B in a manner that is independent of the controller model (e. g. is PB1 on ATtiny85, but PD5 on ATmega328, and PD4 on ATmega644)
-
R001
usable in C programs -
R002
usable in C++ programs -
R003
usable in "classic" AVR projects (AtmelStudio) -
R004
usable in Arduino projects -
R005
usable for projects with ATmega µCs -
R006
usable for projects with ATtiny µCs
-
R011
Assign information about port/pin/polarity to one symbol (preprocessor #define or variable) -
R012
Set output using defined port/pin/polarity-
R012.1
set output to true or false or a variable (polarity aware) -
R012.2
set output to high or low (not polarity aware)
-
-
R013
Test input using defined port/pin/polarity-
R013.1
test if input is true or false (polarity aware) -
R013.2
test if input is high or low (not polarity aware)
-
-
R014
Define data direction using defined port/pin, as one of input (pull-up undefined), input with pull-up, input without pull-up, output
-
R015
declare an output as open-collector (implies active-low polarity) -
R016
simulate open-collector behavior when setting the output value
-
R021
define alternate function names that can be used like normal pin/port/polarity definitions, independent of controller type-
R021.1
define names for UART pins -
R021.2
define names for I2C pins -
R021.3
define names for external interrupt pins (polarity aware) -
R021.4
define names for timer PWM pins (polarity aware)
-
-
R031
extract port name like 'A', 'B', 'C' from port & pin definition -
R032
extract bit number 0..7 from port & pin definition -
R033
calculate Arduino pin number from port & pin -
R033.1
calculate Arduino pin number for ATmega168/328 based boards -
R033.2
calculate Arduino pin number for ATmega324/644/1284 based boards
-
R041
calculate name of pin change interrupt mask registerPCMSKn
from pin/port/polarity definition -
R042
calculate name of pin change interrupt enable registerPCIEn
from pin/port/polarity definition -
R043
calculate name of pin change interrupt vectorPCINTx_vect
from pin/port/polarity definition