| 719 | }; |
| 720 | |
| 721 | class SerialDisplayClass : public VectorDisplayClass { |
| 722 | private: |
| 723 | Stream& s; |
| 724 | const bool doSerialBegin; |
| 725 | |
| 726 | public: |
| 727 | virtual int remoteRead() override { |
| 728 | //return s.read(); |
| 729 | return('A'); |
| 730 | } |
| 731 | |
| 732 | virtual void remoteWrite(uint8_t c) override { |
| 733 | //s.write(c); |
| 734 | } |
| 735 | |
| 736 | virtual void remoteWrite(const void* data, size_t n) override { |
| 737 | //s.write((uint8_t*)data, n); |
| 738 | } |
| 739 | |
| 740 | /* only works with the Serial object; do not call externally without it */ |
| 741 | void begin(uint32_t speed, int width=VECTOR_DISPLAY_DEFAULT_WIDTH, int height=VECTOR_DISPLAY_DEFAULT_HEIGHT) { |
| 742 | #ifndef NO_SERIAL |
| 743 | if (doSerialBegin) { |
| 744 | Serial.begin(speed); |
| 745 | while(!Serial) ; |
| 746 | } |
| 747 | #endif |
| 748 | VectorDisplayClass::begin(width, height); |
| 749 | } |
| 750 | |
| 751 | bool getSwapBytes(void) { return false; } // stub |
| 752 | void setSwapBytes(bool swap) { return; } // stub |
| 753 | |
| 754 | virtual void begin(int width=VECTOR_DISPLAY_DEFAULT_WIDTH, int height=VECTOR_DISPLAY_DEFAULT_HEIGHT) override { |
| 755 | begin(115200, width, height); |
| 756 | } |
| 757 | |
| 758 | virtual size_t remoteAvailable() override { |
| 759 | return s.available(); |
| 760 | } |
| 761 | |
| 762 | #ifndef NO_SERIAL |
| 763 | SerialDisplayClass() : s(Serial), doSerialBegin(true) {} |
| 764 | #endif |
| 765 | |
| 766 | SerialDisplayClass(Stream& _s) : s(_s), doSerialBegin(false) {} |
| 767 | }; |
| 768 | |
| 769 | #ifdef ESP8266 |
| 770 | class WiFiDisplayClass : public SerialDisplayClass { |
nothing calls this directly
no outgoing calls
no test coverage detected