mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-13 03:13:41 +00:00
legacy.PinOutput->pin.Output and add High+Low methods on drivers.PinOutput and use them in drivers
This commit is contained in:
committed by
deadprogram
parent
2e007a6de7
commit
8ac285e821
@@ -9,6 +9,16 @@ package drivers
|
||||
// var pin drivers.PinOutput = led.Set // Going from a machine.Pin to a drivers.PinOutput
|
||||
type PinOutput func(level bool)
|
||||
|
||||
// High sets the underlying pin's level to high. This is equivalent to calling PinOutput(true).
|
||||
func (po PinOutput) High() {
|
||||
po(true)
|
||||
}
|
||||
|
||||
// Low sets the underlying pin's level to low. This is equivalent to calling PinOutput(false).
|
||||
func (po PinOutput) Low() {
|
||||
po(false)
|
||||
}
|
||||
|
||||
// PinInput is hardware abstraction for a pin which receives a
|
||||
// digital signal and reads it (high or low level).
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user