blob: e7e930b8c5bb76ba2d7ca1d82fde94522d9de05f [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;
/// Sets the drive strength of the GPIO.
/// actual_ds_ua is always >= ds_ua. If ds_ua is larger than max value, the drive strength will be set to the max value.
/// Return error if unable to set drive strength. actual_ds_ua is not set in this case.
SetDriveStrength(uint64 ds_ua) -> (uint64 actual_ds_ua) error zx.status;
};