From bdffd368206347a1b59dd3e52aa221a6963ba07d Mon Sep 17 00:00:00 2001 From: Neil McKechnie Date: Tue, 31 Jan 2023 15:24:38 +0000 Subject: [PATCH] IODevice.h - change visibility of findDevice to protected. To support nested drivers efficiently (i.e. to allow the higher driver to call another driver directly, without searching for a VPIN every time), the visibility of the IODevice::findDevice() function has been changed from private to protected. --- IODevice.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/IODevice.h b/IODevice.h index 77b440d..5155aaf 100644 --- a/IODevice.h +++ b/IODevice.h @@ -93,6 +93,8 @@ public: CONFIGURE_INPUT = 1, CONFIGURE_SERVO = 2, CONFIGURE_OUTPUT = 3, + CONFIGURE_ANALOGOUTPUT = 4, + CONFIGURE_ANALOGINPUT = 5, } ConfigTypeEnum; typedef enum : uint8_t { @@ -174,9 +176,12 @@ protected: _I2CAddress=0; } - // Method to perform initialisation of the device (optionally implemented within device class) + // Method to perform initialisation of the device (optionally implemented within device class) virtual void _begin() {} + // Method to check whether the vpin corresponds to this device + bool owns(VPIN vpin); + // Method to configure device (optionally implemented within device class) virtual bool _configure(VPIN vpin, ConfigTypeEnum configType, int paramCount, int params[]) { (void)vpin; (void)configType; (void)paramCount; (void)params; // Suppress compiler warning. @@ -239,14 +244,13 @@ protected: // Static support function for subclass creation static void addDevice(IODevice *newDevice); + // Method to find device handling Vpin + static IODevice *findDevice(VPIN vpin); + // Current state of device DeviceStateEnum _deviceState = DEVSTATE_DORMANT; private: - // Method to check whether the vpin corresponds to this device - bool owns(VPIN vpin); - // Method to find device handling Vpin - static IODevice *findDevice(VPIN vpin); IODevice *_nextDevice = 0; unsigned long _nextEntryTime; static IODevice *_firstDevice;