mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-10 09:53:42 +00:00
Replace Safe functions with legacy.PinOutput
This commit is contained in:
+2
-4
@@ -45,9 +45,7 @@ type device struct {
|
||||
func (t *device) ReadMeasurements() error {
|
||||
// initial waiting
|
||||
state := powerUp(t.pin)
|
||||
defer func() {
|
||||
t.pin.Set(state)
|
||||
}()
|
||||
defer t.pin.Set(state)
|
||||
err := t.read()
|
||||
if err == nil {
|
||||
t.initialized = true
|
||||
@@ -213,7 +211,7 @@ func waitForDataTransmission(p drivers.PinInput) error {
|
||||
func NewDummyDevice(pin drivers.Pin, deviceType DeviceType) DummyDevice {
|
||||
pin.Set(true)
|
||||
return &device{
|
||||
pin: drivers.SafePin(pin),
|
||||
pin: pin,
|
||||
measurements: deviceType,
|
||||
initialized: false,
|
||||
temperature: 0,
|
||||
|
||||
@@ -129,7 +129,7 @@ func New(pin drivers.Pin, deviceType DeviceType) Device {
|
||||
pin.Set(true)
|
||||
return &managedDevice{
|
||||
t: device{
|
||||
pin: drivers.SafePin(pin),
|
||||
pin: pin,
|
||||
measurements: deviceType,
|
||||
initialized: false,
|
||||
},
|
||||
@@ -146,7 +146,7 @@ func NewWithPolicy(pin drivers.Pin, deviceType DeviceType, updatePolicy UpdatePo
|
||||
pin.Set(true)
|
||||
result := &managedDevice{
|
||||
t: device{
|
||||
pin: drivers.SafePin(pin),
|
||||
pin: pin,
|
||||
measurements: deviceType,
|
||||
initialized: false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user