Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
TivaGPIO.hxx File Reference
#include "os/Gpio.hxx"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_gpio.h"
#include "driverlib/rom_map.h"

Go to the source code of this file.

Classes

class  TivaGpio< GPIO_BASE, GPIO_PIN >
 Generic GPIO class implementation. More...
 
struct  GpioShared< Defs >
 Shared class that defines static functions used by both GpioInputPin, GpioOutputPin and GpioHwPin. More...
 
struct  GpioOutputPin< Base, SAFE_VALUE, INVERT >
 Parametric GPIO output class. More...
 
struct  GpioOutputSafeLow< Defs >
 Defines a GPIO output pin, initialized to be an output pin with low level. More...
 
struct  GpioOutputSafeHigh< Defs >
 Defines a GPIO output pin, initialized to be an output pin with high level. More...
 
struct  GpioOutputOD< Defs, SAFE_VALUE >
 Defines a GPIO output pin with high-current drive and a defined initialization level. More...
 
struct  LedPin< Defs >
 Defines a GPIO output pin with high-current drive and low initialization level. More...
 
struct  GpioInputPin< Base, ACTIVE_HIGH >
 Parametric GPIO input class. More...
 
struct  GpioInputPU< Defs >
 Defines a GPIO input pin with pull-up. More...
 
struct  GpioInputPD< Defs >
 Defines a GPIO input pin with pull-down enabled. More...
 
struct  GpioInputNP< Defs >
 Defines a GPIO input pin. More...
 
struct  GpioInputOutputPin< Defs >
 Common class for GPIO input pins. More...
 
struct  GpioADCPin< Defs >
 GPIO Input pin in ADC configuration (analog). More...
 
struct  GpioUSBAPin< Defs >
 GPIO Input pin for USB. More...
 
struct  GpioHwPin< Defs >
 GPIO pin in a hardware configuration (via pinmux: UART, I2C, CAN, etc). More...
 

Macros

#define DECL_PIN(NAME, PORT, NUM)
 Helper macro for declaring a pin.
 
#define DECL_HWPIN(NAME, PORT, NUM, CONFIG, Type)
 Helper macro for declaring a GPIO pin wiht a specific hardware config (not GPIO but a different hardware muxed onto the same pin).
 
#define GPIO_PIN(NAME, BaseClass, PORT, NUM)
 Helper macro for defining GPIO pins on the Tiva microcontrollers.
 
#define GPIO_HWPIN(NAME, BaseClass, PORT, NUM, CONFIG, TYPE)
 Helper macro for defining GPIO pins with a specific hardware config on the Tiva microcontrollers.
 

Typedefs

template<class Defs >
using GpioOutputODSafeLow = GpioOutputOD< Defs, false >
 Defines a GPIO open-drain output pin with low initialization level.
 
template<class Defs >
using GpioOutputODSafeHigh = GpioOutputOD< Defs, true >
 Defines a GPIO open-drain output pin with high (==not pulled low) initialization level.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Helper declarations for using GPIO pins (both for GPIO and other hardware) on Tiva MCUs.

Author
Balazs Racz
Date
2 Dec 2014

Definition in file TivaGPIO.hxx.

Macro Definition Documentation

◆ DECL_HWPIN

#define DECL_HWPIN (   NAME,
  PORT,
  NUM,
  CONFIG,
  Type 
)
Value:
DECL_PIN(NAME, PORT, NUM); \
static void NAME##_SetPinType() \
{ \
MAP_GPIOPinType##Type(NAME##_BASE, NAME##_PIN); \
} \
static const auto NAME##_CONFIG = GPIO_P##PORT##NUM##_##CONFIG
#define DECL_PIN(NAME, PORT, NUM)
Helper macro for declaring a pin.
Definition TivaGPIO.hxx:51

Helper macro for declaring a GPIO pin wiht a specific hardware config (not GPIO but a different hardware muxed onto the same pin).

Deprecated:
, use GPIO_PIN instead.

Definition at line 60 of file TivaGPIO.hxx.

◆ DECL_PIN

#define DECL_PIN (   NAME,
  PORT,
  NUM 
)
Value:
static const auto NAME##_PERIPH = SYSCTL_PERIPH_GPIO##PORT; \
static const auto NAME##_BASE = GPIO_PORT##PORT##_BASE; \
static const auto NAME##_PIN = GPIO_PIN_##NUM; \

Helper macro for declaring a pin.

Deprecated:
, use GPIO_PIN instead.

Definition at line 51 of file TivaGPIO.hxx.

◆ GPIO_HWPIN

#define GPIO_HWPIN (   NAME,
  BaseClass,
  PORT,
  NUM,
  CONFIG,
  TYPE 
)
Value:
struct NAME##Defs \
{ \
DECL_HWPIN(GPIO, PORT, NUM, CONFIG, TYPE); \
}; \
typedef BaseClass<NAME##Defs> NAME##_Pin

Helper macro for defining GPIO pins with a specific hardware config on the Tiva microcontrollers.

Parameters
NAMEis the basename of the declaration. For NAME==FOO the macro declared FOO_Pin as a structure on which the read-write functions will be available.
BaseClassis the initialization structure, such as LedPin, or GpioOutputSafeHigh or GpioOutputSafeLow.
PORTis the letter (e.g. D)
NUMis the pin number, such as 3
CONFIGis the suffix of the symbol that defines the pinmux for the hardware, e.g. U7TX.
TYPEis a suffix for a TivaWare GPIOPinType function such as UART for GPIOPinTypeUART() to set the pin to the hardware configuration.

Definition at line 552 of file TivaGPIO.hxx.

◆ GPIO_PIN

#define GPIO_PIN (   NAME,
  BaseClass,
  PORT,
  NUM 
)
Value:
struct NAME##Defs \
{ \
DECL_PIN(GPIO, PORT, NUM); \
}; \
typedef BaseClass<NAME##Defs> NAME##_Pin

Helper macro for defining GPIO pins on the Tiva microcontrollers.

Parameters
NAMEis the basename of the declaration. For NAME==FOO the macro declared FOO_Pin as a structure on which the read-write functions will be available.
BaseClassis the initialization structure, such as LedPin, or GpioOutputSafeHigh or GpioOutputSafeLow.
PORTis the letter (e.g. D)
NUMis the pin number, such as 3

Example: GPIO_PIN(FOO, LedPin, D, 3); ... FOO_Pin::set(true);

Definition at line 329 of file TivaGPIO.hxx.

Typedef Documentation

◆ GpioOutputODSafeHigh

template<class Defs >
using GpioOutputODSafeHigh = GpioOutputOD<Defs, true>

Defines a GPIO open-drain output pin with high (==not pulled low) initialization level.

Do not use this class directly. Use GPIO_PIN instead.

Definition at line 290 of file TivaGPIO.hxx.

◆ GpioOutputODSafeLow

template<class Defs >
using GpioOutputODSafeLow = GpioOutputOD<Defs, false>

Defines a GPIO open-drain output pin with low initialization level.

Do not use this class directly. Use GPIO_PIN instead.

Definition at line 283 of file TivaGPIO.hxx.