ArduinoDumbDisplay v0.9.9-r34
DumbDisplay Arduino Library -- https://github.com/trevorwslee/Arduino-DumbDisplay
 
Loading...
Searching...
No Matches
serial2dumbdisplay.h
1#ifndef serial2dumbdisplay_h
2#define serial2dumbdisplay_h
3
4// e.g. STM32F103: PA3 (RX2) ==> TX; PA2 (TX2) ==> RX
5
6#include "dumbdisplay.h"
7
10 public:
11 DDSerial2IO(unsigned long baud,
12 bool enableSerial = false, unsigned long serialBaud = DD_SERIAL_BAUD):
13 DDInputOutput(serialBaud, enableSerial, enableSerial) {
14 this->baud = baud;
15 }
16 const char* getWhat() {
17 return "S2";
18 }
19 bool available() {
20 return Serial2.available();
21 }
22 char read() {
23 return Serial2.read();
24 }
25 void print(const String &s) {
26 Serial2.print(s);
27 }
28 void print(const char *p) {
29 Serial2.print(p);
30 }
31 void write(uint8_t b) {
32 Serial2.write(b);
33 }
34 void write(const uint8_t *buf, size_t size) {
35 Serial2.write(buf, size);
36 }
37 bool preConnect(bool firstCall) {
38 DDInputOutput::preConnect(firstCall);
39 if (firstCall) {
40 Serial2.begin(baud);
41 }
42 return true;
43 }
44 void flush() {
45 }
46 bool canUseBuffer() {
47 return true;
48 }
49 private:
50 unsigned long baud;
51};
52
53#endif
Class for DD input/output; you explicitly constructed it, pass in when instantiate DumbDisplay,...
Definition: _dd_io.h:9
Deprecated. Use DDGenericIO (in genericdumbdisplay.h) instead.
Definition: serial2dumbdisplay.h:9