[][src]Module tm4c123x_hal::gpio

General Purpose Input / Output

This module makes heavy use of types to try and ensure you can't have a pin in a mode you didn't expect.

Most pins start in the Tristate state. You can call methods to convert them to inputs, outputs or put them into Alternate Function mode (e.g. to use with a UART).

Some of the modes require extra information, and for that we use the so- called 'Turbo Fishsyntax, which looks likemethod::`.

If the operation is non-atomic, then you need to pass a mut-reference to the port's control structure. This ensures you can't change two pins in two threads at the same time. If the operation is fully atomic (using the chip's bit-banding feature) then this argument is not required.

Here's an example:

let p = Peripherals::take().unwrap();
let mut sc = p.SYSCTL.constrain();
let mut portb = p.GPIO_PORTB.split(&sc.power_control);
let timer_output_pin = portb.pb0.into_af_push_pull::<gpio::AF7>(&mut portb.control);
let uart_tx_pin = portb.pb1.into_af_open_drain::<gpio::AF1, gpio::PullUp>(&mut portb.control);
let blue_led = portb.pb2.into_push_pull_output();
let button = portb.pb3.into_pull_up_input();

Modules

gpioa

GPIO

gpiob

GPIO

gpioc

GPIO

gpiod

GPIO

gpioe

GPIO

gpiof

GPIO

Structs

AF1

Alternate function 1 (type state)

AF2

Alternate function 2 (type state)

AF3

Alternate function 3 (type state)

AF4

Alternate function 4 (type state)

AF5

Alternate function 5 (type state)

AF6

Alternate function 6 (type state)

AF7

Alternate function 7 (type state)

AF8

Alternate function 8 (type state)

AF9

Alternate function 9 (type state)

AF14

Alternate function 14 (type state)

AlternateFunction

AlternateFunction mode (type state for a GPIO pin)

Floating

Sub-mode of Input: Floating input (type state)

Input

Input mode (type state)

Locked

Pin is locked through the GPIOCR register

OpenDrain

Sub-mode of Output/AlternateFunction: Open drain output (type state for Output)

Output

Output mode (type state)

PullDown

Sub-mode of Input: Pulled down input (type state)

PullUp

Sub-mode of Input: Pulled up input (type state)

PushPull

Sub-mode of Output/AlternateFunction: Push pull output (type state for Output)

Tristate

Tri-state

Enums

InterruptMode

Sets when a GPIO pin triggers an interrupt.

Traits

AlternateFunctionChoice

All the different Alternate Functions you can choose implement this

GpioExt

Extension trait to split a GPIO peripheral in independent pins and registers

InputMode

All input modes implement this

IsUnlocked

All unlocked pin modes implement this

OpenDrainMode

OpenDrain modes implement this

OutputMode

All output modes implement this