blob: 45cb08b3813092b6a1d64b6a765b9960f2b11b38 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.hardware.gpio;
using zx;
/// Flags for `ConfigIn`.
enum GpioFlags : uint32 {
PULL_DOWN = 0x0;
PULL_UP = 0x1;
NO_PULL = 0x2;
PULL_MASK = 0x3;
};
protocol Gpio {
/// Configures a GPIO for input.
ConfigIn(GpioFlags flags) -> () error zx.status;
/// Configures a GPIO for output.
ConfigOut(uint8 initial_value) -> () error zx.status;
/// Reads the current value of a GPIO (0 or 1).
Read() -> (uint8 value) error zx.status;
/// Sets the current value of the GPIO (any non-zero value maps to 1).
Write(uint8 value) -> () error zx.status;
};