SoftwareSerial child class to drive a netmedia serial lcd

Hi all,
I've got this serial lcd:

http://www.robot-italy.com/it/netmedia-serial-lcd-display-2x16-blue.html

And this is a SoftwareSerial child class that implements some of LiquidCrystal methods using the netmedia commands.

It's not finished yet, but I hope it can be useful.

class NetmediaSerialLCD : public SoftwareSerial {
public:
    NetmediaSerialLCD(uint8_t rxPin, uint8_t txPin) : SoftwareSerial(rxPin, txPin) {
    };
    
    void setBacklight(uint8_t brightnessLevel) {
        this->write(20);
        this->write(brightnessLevel);
    };
    
    void clear() {
        this->write(12);
    };
    
    void setCursor(uint8_t column, uint8_t row) {
        this->write(17);
        this->write(row);
        this->write(column);
    };
    
    void createChar(uint8_t location, uint8_t* charmap) {
        this->write(18);
        
        location &= 0x7; // we only have 8 locations 0-7
        location = 64 + (location << 3);
        this->write(location);
        for (uint8_t i = 0; i < 7; i++) {
            this->write(charmap[i]);
        }
    };
};

A serial LCD should only use a TX pin and no RX pin

Does this constructor work?

NetmediaSerialLCD(uint8_t rxPin, uint8_t txPin) : SoftwareSerial(-1, txPin) {
    };

if so you saved an IO pin ...

        this->write(17);
        this->write(row);
        this->write(column);

In the absence of a specific instance, this is implied. Why do you feel the need to explicitly use this->?

I'm not saying it's wrong. I'm asking why. The only time I use this-> is when a class field has the same name as a local variable (typically a method argument).

robtillaart:
A serial LCD should only use a TX pin and no RX pin

Does this constructor work?

NetmediaSerialLCD(uint8_t rxPin, uint8_t txPin) : SoftwareSerial(-1, txPin) {

};



if so you saved an IO pin ...

I have looked at SoftwareSerial source, and didn't see any test to skip pin initialization in case it has a "special" value. I've put in my todo list the task of looking closer to SS code and see if I can patch it to actually save a pin.
Another solution could be to shamelessly copy the tx code from SoftwareSerial and put it into a new "tx-only" SoftwareSerial class.

PaulS:

        this->write(17);

this->write(row);
        this->write(column);



In the absence of a specific instance, this is implied. Why do you feel the need to explicitly use this->?

I'm not saying it's wrong. I'm asking why. The only time I use this-> is when a class field has the same name as a local variable (typically a method argument).

It just looked clearer to me when I wrote it. Since it's implied, it becomes just a matter of taste IMHO.