disableInterrupt
Disables the interrupt until you enable it.
@discardableResult func disableInterrupt() -> Result<(), Errno>
Returns
Whether the configuration succeeds. If it fails, it returns the specific error.
Disables the interrupt until you enable it.
@discardableResult func disableInterrupt() -> Result<(), Errno>
s7SwiftIO9DigitalInC16disableInterrupts6ResultOyytAA5ErrnoVGyF
What are these?5II4O
Whether the configuration succeeds. If it fails, it returns the specific error.
import SwiftIO
The SwiftIO library allows you to access and control the hardware in an easy way.
final class DigitalIn
The DigitalIn class is intended to detect the state of a digital input pin, either true or false.
@frozen enum Result<Success, Failure> where Failure : Error, Success : ~Copyable
A value that represents either a success or a failure, including an associated value in each case.
struct Errno
The Errno struct lists all the possible errors.
@discardableResult func setInterrupt(_ mode: InterruptMode, enable: Bool = true, callback: @escaping () -> Void) -> Result<(), Errno>
Adds a callback function to a specified input pin. It sets interrupt by detecting the changes of the signal.
@discardableResult func enableInterrupt() -> Result<(), Errno>
Enables the interrupt.
@discardableResult func removeInterrupt() -> Result<(), Errno>
Removes the interrupt.
func getInterruptState() -> InterruptState
Checks whether the interrupt is enabled.
enum InterruptMode
Determines the event to raise an interrupt: rising edge, falling edge or both.
enum InterruptState
Determines whether the interrupt is enabled and will occur.
init(_ idName: Id, mode: Mode = .pullDown)
Initializes a DigitalIn to a specified pin.
var interruptMode: InterruptMode { get set }
The current interrupt mode: .rising
, falling
or bothEdge
.
var mode: Mode { get set }
The current input mode: .pullUp
, .pullDown
or .pullNone
.
let obj: UnsafeMutableRawPointer
func getMode() -> Mode
Gets the configuration of the internal pull-up and pull-down resistor on a specified input pin.
func read() -> Bool
Reads value from a digital input pin.
@discardableResult func setMode(_ mode: Mode) -> Result<(), Errno>
Sets the input mode, which means the pull-up and pull-down resistor pull-up and pull-down resistor.
enum Mode
The digital input mode sets the pull resistors connected to a pin.