theCore C++ embedded framework
ecl::gpio_hw Namespace Reference

Data Structures

struct  pin_bin
 Gather given pins into one bin, suitable for passing to the TivaWare functions. More...
 
struct  pin_bin< Gn >
 

Enumerations

enum  port {
  port::a = GPIO_PORTA_BASE, port::b = GPIO_PORTB_BASE, port::c = GPIO_PORTC_BASE, port::d = GPIO_PORTD_BASE,
  port::e = GPIO_PORTE_BASE, port::f = GPIO_PORTF_BASE
}
 GPIO ports. More...
 
enum  num {
  num::pin0 = GPIO_PIN_0, num::pin1 = GPIO_PIN_1, num::pin2 = GPIO_PIN_2, num::pin3 = GPIO_PIN_3,
  num::pin4 = GPIO_PIN_4, num::pin5 = GPIO_PIN_5, num::pin6 = GPIO_PIN_6, num::pin7 = GPIO_PIN_7
}
 GPIO numbers. More...
 
enum  dir { dir::in = GPIO_DIR_MODE_IN, dir::out = GPIO_DIR_MODE_OUT, dir::hw = GPIO_DIR_MODE_HW }
 GPIO directions. More...
 
enum  pad_type {
  pad_type::push_pull = GPIO_PIN_TYPE_STD, pad_type::pull = GPIO_PIN_TYPE_STD_WPD, pad_type::push = GPIO_PIN_TYPE_STD_WPU, pad_type::od = GPIO_PIN_TYPE_OD,
  pad_type::analog = GPIO_PIN_TYPE_ANALOG, pad_type::wake_high = GPIO_PIN_TYPE_WAKE_HIGH, pad_type::wake_low = GPIO_PIN_TYPE_WAKE_LOW
}
 GPIO types. More...
 
enum  strength {
  strength::i2ma = GPIO_STRENGTH_2MA, strength::i4ma = GPIO_STRENGTH_4MA, strength::i6ma = GPIO_STRENGTH_6MA, strength::i8ma = GPIO_STRENGTH_8MA,
  strength::i8ma_sc = GPIO_STRENGTH_8MA_SC, strength::i10ma = GPIO_STRENGTH_10MA, strength::i12ma = GPIO_STRENGTH_12MA
}
 GPIO maximum current rating, in milliamperes. More...
 
enum  int_source {
  int_source::falling = GPIO_FALLING_EDGE, int_source::rising = GPIO_RISING_EDGE, int_source::both = GPIO_BOTH_EDGES, int_source::low = GPIO_LOW_LEVEL,
  int_source::high = GPIO_HIGH_LEVEL, int_source::discrete = GPIO_DISCRETE_INT
}
 GPIO Interrupt sources. More...
 

Functions

template<port Pt>
static constexpr auto get_periph ()
 Gets peripheral associated with given port. More...
 
template<port Pt>
static void enable_periph ()
 Enables peripheral for given port. More...
 
template<port Pt, num P, num ... Pn>
static void apply_cfg (dir d=dir::out, pad_type t=pad_type::push_pull, strength s=strength::i2ma)
 Applies given configuration for given GPIOs. More...
 
static constexpr auto get_irqn (port pt)
 Obtains IRQ number of given port. More...
 
static constexpr auto get_pin_intflag (num n)
 Obtains interrupt flag used for corresponding GPIO pin. More...
 

Enumeration Type Documentation

◆ port

enum ecl::gpio_hw::port
strong

GPIO ports.

Enumerator

◆ num

enum ecl::gpio_hw::num
strong

GPIO numbers.

Enumerator
pin0 
pin1 
pin2 
pin3 
pin4 
pin5 
pin6 
pin7 

◆ dir

enum ecl::gpio_hw::dir
strong

GPIO directions.

Enumerator
in 
out 
hw 

Alternate function.

◆ pad_type

GPIO types.

Enumerator
push_pull 
pull 
push 

Pull down (to ground)

od 

Push up (to Vcc)

analog 
wake_high 
wake_low 

◆ strength

GPIO maximum current rating, in milliamperes.

Enumerator
i2ma 
i4ma 
i6ma 
i8ma 
i8ma_sc 
i10ma 
i12ma 

◆ int_source

GPIO Interrupt sources.

Enumerator
falling 
rising 
both 
low 
high 
discrete 

Function Documentation

◆ get_periph()

template<port Pt>
static constexpr auto ecl::gpio_hw::get_periph ( )
static

Gets peripheral associated with given port.

◆ enable_periph()

template<port Pt>
static void ecl::gpio_hw::enable_periph ( )
inlinestatic

Enables peripheral for given port.

◆ apply_cfg()

template<port Pt, num P, num ... Pn>
static void ecl::gpio_hw::apply_cfg ( dir  d = dir::out,
pad_type  t = pad_type::push_pull,
strength  s = strength::i2ma 
)
inlinestatic

Applies given configuration for given GPIOs.

Template Parameters
PtGPIO port.
PGPIO pin.
PnRest of GPIO pins (optional)
Parameters
[in]dDirection of pins.
[in]tTypes of pins.
[in]sMaximum current of pins.

◆ get_irqn()

static constexpr auto ecl::gpio_hw::get_irqn ( port  pt)
inlinestatic

Obtains IRQ number of given port.

Parameters
ptPort for whom IRQn must be obtained.

◆ get_pin_intflag()

static constexpr auto ecl::gpio_hw::get_pin_intflag ( num  n)
inlinestatic

Obtains interrupt flag used for corresponding GPIO pin.

Parameters
nPin for whom interrup flag must be obtained.