Instance Propertymadmachineio.swiftio 0.1.0SwiftIO
obj
PWMOut.swift:94This declaration is gated by at least one @_spi attribute.
let obj: UnsafeMutableRawPointer
This declaration is gated by at least one @_spi attribute.
let obj: UnsafeMutableRawPointer
import SwiftIO
The SwiftIO library allows you to access and control the hardware in an easy way.
final class PWMOut
The PWMOut class is used to generate periodic square waves and modulate the pulse width to get different average output.
@frozen struct UnsafeMutableRawPointer
A raw pointer for accessing and manipulating untyped data.
init(_ idName: Id, frequency: Int = 1000, dutycycle: Float = 0.0)
Initializes a PWM output with the specified frequency and dutycycle.
var maxFrequency: Int { get }
The max frequency of PWM output.
var minFrequency: Int { get }
The min frequency of PWM output.
func resume()
Continues the PWM output.
func set(frequency: Int, dutycycle: Float)
Sets the frequency and the dutycycle of PWM output signal.
func set(period: Int, pulse: Int)
Sets the period and pulse width of PWM output signal.
func setDutycycle(_ dutycycle: Float)
Sets the percentage of time during a period in which the output is high, from 0.0 to 1.0
func suspend()
Suspends the PWM output.