Replace Safe functions with legacy.PinOutput

This commit is contained in:
Yurii Soldak
2025-09-21 10:04:20 +02:00
parent c6d83b783f
commit 453ff96a66
16 changed files with 112 additions and 108 deletions
+2 -4
View File
@@ -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,
+2 -2
View File
@@ -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,
},