![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
UART object
Fork of DigoleSerialDisp1 by
Diff: DigoleSerialDisp.h
- Revision:
- 6:fc42c0dc7b7f
- Parent:
- 5:7d3fd21b9ead
--- a/DigoleSerialDisp.h Tue Nov 17 16:09:34 2015 +0000 +++ b/DigoleSerialDisp.h Sun Nov 22 16:01:18 2015 +0000 @@ -6,6 +6,7 @@ #define DigoleSerialDisp_h #include "mbed.h" +#include "Serial.h" #include <inttypes.h> #define DEC 10 @@ -25,57 +26,13 @@ #define _TEXT_ 0 #define _GRAPH_ 1 -/** Digole Serial LCD/OLED Library - * www.digole.com/index.php?productID=535 - * - * Includes Arduino Print class member functions - */ -class DigoleSerialDisp { + +class DigoleSerialDisp : Serial +{ public: - -#if defined(_Digole_Serial_UART_) - - - size_t write(uint8_t value) { - _mySerial->write((uint8_t) value); - return 1; // assume sucess - } - - void begin(void) { - _mySerial->begin(9600); - _mySerial->print("SB"); - _mySerial->println(_Baud); - delay(100); - _mySerial->begin(_Baud); - } - size_t read1(void) - { - int t; - do { - t = _mySerial->read(); - } while (t == -1); - return t; - } -#endif - - /** Create a new Digole Serial Display interface - * - * @param sda is the pin for I2C SDA - * @param scl is the pin for I2C SCL - * @param address is the 7-bit address (default is 0x27 for the device) - */ - DigoleSerialDisp(PinName sda, PinName scl, uint8_t address=0x27); - - - /** Carryover from Arduino library, not needed - */ - void begin(void) { } // nothing to do here - - - /** Write out a raw character - * @param x is the character to write - * @returns 1 - */ + DigoleSerialDisp(PinName, PinName); + + // Simple write methods. size_t write(const char x); @@ -366,8 +323,8 @@ void digitalOutput(uint8_t x); private: - I2C _device; - uint8_t _address; +// I2C _device; +// uint8_t _address; uint8_t _Comdelay; size_t printNumber(unsigned long n, uint8_t base);