AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
|
This class defines a type that can encode a GPIO pin as a variable. Read the section on GPIO Pin Variables to understand how to use this class. More...
#include <GpioPinMacros.h>
Public Member Functions | |
Gpio8Ptr | ddr () const |
Return a pointer to the DDR register. | |
Gpio8Ptr | port () const |
Return a pointer to the PORT register. | |
Gpio8Ptr | pin () const |
Return a pointer to the PIN register. | |
Gpio16Ptr | ocr () const |
Return a pointer to the OCR register (PWM related). | |
Gpio8Ptr | tccr () const |
Return a pointer to the TCCR register (PWM related). | |
uint8_t | bitNbr () const |
Return the bit number of this GPIO pin within the DDR, PORT, and PIN registers. | |
uint8_t | com () const |
Return the bit number needed for manipulating TCCR register (PWM related). | |
uint8_t | adcNbr () const |
Return the ADC channel number (analog-to-digital related). | |
This class defines a type that can encode a GPIO pin as a variable. Read the section on GPIO Pin Variables to understand how to use this class.
There are also three macros that you need to create vaiables of type GpioPinVariable: makeGpioVarFromGpioPin(), makeGpioVarFromGpioPinAnalog(), and makeGpioVarFromGpioPinPwm(). These are used like this:
Once you've done this, these variables can be assign and passed to functions as needed. To use these GPIO pin variables, there are special function analogs of the GPIO pin manipulation macros. These have the same names as the GPIO pin manipulation macros, except with a "V" appended.