1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-24 05:11:24 +01:00

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.
This commit is contained in:
Neil McKechnie 2023-01-31 15:24:38 +00:00
parent 4d350040ba
commit bdffd36820

View File

@ -93,6 +93,8 @@ public:
CONFIGURE_INPUT = 1, CONFIGURE_INPUT = 1,
CONFIGURE_SERVO = 2, CONFIGURE_SERVO = 2,
CONFIGURE_OUTPUT = 3, CONFIGURE_OUTPUT = 3,
CONFIGURE_ANALOGOUTPUT = 4,
CONFIGURE_ANALOGINPUT = 5,
} ConfigTypeEnum; } ConfigTypeEnum;
typedef enum : uint8_t { typedef enum : uint8_t {
@ -177,6 +179,9 @@ protected:
// 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() {} 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) // Method to configure device (optionally implemented within device class)
virtual bool _configure(VPIN vpin, ConfigTypeEnum configType, int paramCount, int params[]) { virtual bool _configure(VPIN vpin, ConfigTypeEnum configType, int paramCount, int params[]) {
(void)vpin; (void)configType; (void)paramCount; (void)params; // Suppress compiler warning. (void)vpin; (void)configType; (void)paramCount; (void)params; // Suppress compiler warning.
@ -239,14 +244,13 @@ protected:
// Static support function for subclass creation // Static support function for subclass creation
static void addDevice(IODevice *newDevice); static void addDevice(IODevice *newDevice);
// Method to find device handling Vpin
static IODevice *findDevice(VPIN vpin);
// Current state of device // Current state of device
DeviceStateEnum _deviceState = DEVSTATE_DORMANT; DeviceStateEnum _deviceState = DEVSTATE_DORMANT;
private: 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; IODevice *_nextDevice = 0;
unsigned long _nextEntryTime; unsigned long _nextEntryTime;
static IODevice *_firstDevice; static IODevice *_firstDevice;