Actions

EmSys

Tm4clib-gpio

From EdWiki

Revision as of 11:09, 27 December 2018 by Jshankar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

The GPIO module provides control for up to eight independent GPIO pins (the actual number present depend upon the GPIO port and part number). Each pin has the following capabilities:

  • Can be configured as an input or an output. On reset, GPIOs default to being inputs.
  • In input mode, can generate interrupts on high level, low level, rising edge, falling edge, or both edges.
  • In output mode, can be configured for 2-mA, 4-mA, or 8-mA drive strength. The 8-mA drive strength configuration has optional slew rate control to limit the rise and fall times of the signal. On reset, GPIOs default to 2-mA drive strength.
  • Optional weak pull-up or pull-down resistors. On reset, GPIOs default to no pull-up or pull-down resistors.
  • Optional open-drain operation. On reset, GPIOs default to standard push/pull operation.
  • Can be configured to be a GPIO or a peripheral pin. On reset, the default is GPIO. Note that not all pins on all parts have peripheral functions, in which case the pin is only useful as a GPIO.

GPIO

Attention
An important aspect to consider is that tm4clib uses the AHB aperture for accessing the GPIO registers on the TM4C. The AHB must be explicitly enabled with a call to gpio_enable_ahb_aperture() before accessing any GPIO functionality.

Please see the individual GPIO modules for more details. To use the GPIO, the gpio.h header needs to be included:

#include <gpio.h>

Modules


Macros

GPIO_LOCK_UNLOCK_CODE

#define GPIO_LOCK_UNLOCK_CODE   0x4C4F434B