getSpeed
Gets the current clock speed of the data transmission.
func getSpeed() -> Speed
Returns
The current speed: .standard
(100 Kbps), .fast
(400 Kbps) or .fastPlus
(1 Mbps).
Gets the current clock speed of the data transmission.
func getSpeed() -> Speed
The current speed: .standard
(100 Kbps), .fast
(400 Kbps) or .fastPlus
(1 Mbps).
import SwiftIO
The SwiftIO library allows you to access and control the hardware in an easy way.
final class I2C
Inter-Integrated Circuit, I2C (I squared C) for short, is a two wire protocol for short distance communication between different devices.
enum Speed
The clock speed used to synchronize the data transmission between devices.
func setSpeed(_ speed: Speed) -> Result<(), Errno>
Changes the clock speed over I2C bus.
init(_ idName: Id, speed: Speed = .standard)
Initializes a specific I2C interface with specified speed.
let obj: UnsafeMutableRawPointer
@discardableResult func read(into buffer: inout [UInt8], count: Int? = nil, from address: UInt8) -> Result<(), Errno>
Reads bytes from the specified slave device with the given address and store them in the buffer.
@discardableResult func read(into byte: inout UInt8, from address: UInt8) -> Result<(), Errno>
Reads a byte from the specified slave device with the given address.
@discardableResult func write(_ data: [UInt8], count: Int? = nil, to address: UInt8) -> Result<(), Errno>
Writes an array of UInt8 to the specified slave device with the given address.
@discardableResult func write(_ byte: UInt8, to address: UInt8) -> Result<(), Errno>
Writes a UInt8 to the specified slave device with the given address.
@discardableResult func writeRead(_ byte: UInt8, into buffer: inout UInt8, address: UInt8) -> Result<(), Errno>
Writes a UInt8 to the specified slave device with the given address and then read a UInt8 from it.
@discardableResult func writeRead(_ byte: UInt8, into buffer: inout [UInt8], readCount: Int? = nil, address: UInt8) -> Result<(), Errno>
Writes a UInt8 to the specified slave device with the given address and then read bytes from it.
@discardableResult func writeRead(_ data: [UInt8], writeCount: Int? = nil, into buffer: inout [UInt8], readCount: Int? = nil, address: UInt8) -> Result<(), Errno>
Writes an array of UInt8 to the slave device with the given address and then read bytes from it.