AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GpioPinVariable Class Reference

This class defines a type that can encode a GPIO pin as a variable. Read the section on [GPIO Pin Variables] (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).
 

Detailed Description

This class defines a type that can encode a GPIO pin as a variable. Read the section on [GPIO Pin Variables] (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:

GpioPinVariable pinArray[3];
pinArray[0] = pinA;
pinArray[1] = pinB;
pinArray[2] = makeGpioVarFromGpioPin( pPin07 );
#define makeGpioVarFromGpioPin(pinName)
Create a GPIO pin variable of type GpioPinVariable from a GPIO pin macro.
Definition GpioPinMacros.h:518
#define makeGpioVarFromGpioPinPwm(pinName)
Create a GPIO pin variable of type GpioPinVariable that can be used for PWM from a GPIO pin macro.
Definition GpioPinMacros.h:544
#define makeGpioVarFromGpioPinAnalog(pinName)
Create a GPIO pin variable of type GpioPinVariable that can be used for analog-to-digital reading fro...
Definition GpioPinMacros.h:531
This class defines a type that can encode a GPIO pin as a variable. Read the section on [GPIO Pin Var...
Definition GpioPinMacros.h:425

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.


The documentation for this class was generated from the following file: