Skip to content

Conversation

bernatalbet
Copy link

Description

I created a class which inherits and extends the current functionality, so that now I can do this:

void preTransmission() override {
    digitalWrite(mEnablePin, HIGH); // Enable Modbus communication
}
void postTransmission() override {
    digitalWrite(mEnablePin, LOW); // Disable Modbus communication
}

Where "mEnablePin" is passed as part of the constructor.

In the current implementation, I tried to implement a solution to use different Enable pins in different instantiated objects, but then I must set static functions externally to the class.

Issues Resolved

With this modification, I now can encapsulate the functionality to my inherited class.

I created a class which inherits and extends the current functionality, so that now I can do this:

    void preTransmission() override {
        digitalWrite(mEnablePin, HIGH); // Enable Modbus communication
    }
    void postTransmission() override {
        digitalWrite(mEnablePin, LOW); // Disable Modbus communication
    }

Where "mEnablePin" is passed as part of the constructor.

In the current implementation, I tried to implement a solution to use different Enable pins in different instantiated objects, but then I must set static functions externally to the class, so I can't encapsulate the functionality to my inherited class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant