From e817fc1d2f47f3d5bbf7da68baf8e980c46fd449 Mon Sep 17 00:00:00 2001 From: hasenradball Date: Tue, 3 Dec 2024 21:15:22 +0100 Subject: [PATCH] improve contructor call --- PCF8574.cpp | 10 ++-------- PCF8574.h | 9 +++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/PCF8574.cpp b/PCF8574.cpp index 4c91bf3..81701e9 100644 --- a/PCF8574.cpp +++ b/PCF8574.cpp @@ -12,14 +12,8 @@ PCF8574::PCF8574(const uint8_t deviceAddress, TwoWire *wire) -{ - _address = deviceAddress; - _wire = wire; - _dataIn = 0; - _dataOut = 0xFF; - _buttonMask = 0xFF; - _error = PCF8574_OK; -} +: _address {deviceAddress}, _wire {wire} +{} bool PCF8574::begin(uint8_t value) diff --git a/PCF8574.h b/PCF8574.h index 96c5bb6..a3d91f9 100644 --- a/PCF8574.h +++ b/PCF8574.h @@ -78,11 +78,12 @@ class PCF8574 private: + int _error {PCF8574_OK}; uint8_t _address; - uint8_t _dataIn; - uint8_t _dataOut; - uint8_t _buttonMask; - int _error; + uint8_t _dataIn {0}; + uint8_t _dataOut {0xFF}; + uint8_t _buttonMask {0xFF}; + TwoWire* _wire; };