tr
Diff: N5110.cpp
- Revision:
- 32:c9643726edca
- Parent:
- 31:8a0c21042f82
- Child:
- 33:d80e568a2e18
diff -r 8a0c21042f82 -r c9643726edca N5110.cpp --- a/N5110.cpp Thu Feb 16 15:36:44 2017 +0000 +++ b/N5110.cpp Thu Feb 16 15:41:00 2017 +0000 @@ -11,15 +11,14 @@ PinName const mosiPin, PinName const sclkPin, PinName const ledPin) -{ - // set up pins as required - _spi = new SPI(mosiPin,NC,sclkPin); // create new SPI instance and initialise - _led = new PwmOut(ledPin); - _pwr = new DigitalOut(pwrPin); - _sce = new DigitalOut(scePin); - _rst = new DigitalOut(rstPin); - _dc = new DigitalOut(dcPin); -} + : + _spi(new SPI(mosiPin,NC,sclkPin)), // create new SPI instance and initialise + _led(new PwmOut(ledPin)), + _pwr(new DigitalOut(pwrPin)), + _sce(new DigitalOut(scePin)), + _rst(new DigitalOut(rstPin)), + _dc(new DigitalOut(dcPin)) +{} // overloaded constructor does not include power pin - LCD Vcc must be tied to +3V3 // Best to use this with K64F as the GPIO hasn't sufficient output current to reliably @@ -30,15 +29,14 @@ PinName const mosiPin, PinName const sclkPin, PinName const ledPin) -{ - // set up pins as required - _spi = new SPI(mosiPin,NC,sclkPin); // create new SPI instance and initialise - _pwr = NULL; // pwr not needed so null it to be safe - _led = new PwmOut(ledPin); - _sce = new DigitalOut(scePin); - _rst = new DigitalOut(rstPin); - _dc = new DigitalOut(dcPin); -} + : + _spi(new SPI(mosiPin,NC,sclkPin)), // create new SPI instance and initialise + _led(new PwmOut(ledPin)), + _pwr(NULL), // pwr not needed so null it to be safe + _sce(new DigitalOut(scePin)), + _rst(new DigitalOut(rstPin)), + _dc(new DigitalOut(dcPin)) +{} N5110::~N5110() {