ArduinoDumbDisplay v0.9.9-r34
DumbDisplay Arduino Library -- https://github.com/trevorwslee/Arduino-DumbDisplay
 
Loading...
Searching...
No Matches
genericdumbdisplay.h
1#ifndef genericdumbdisplay_h
2#define genericdumbdisplay_h
3
4#if !defined(DD_SERIAL)
5 #error Before #include, must define the macro DD_SERIAL and optional DD_SERIAL_begin (a function call or a code block) \
6 *** \
7 e.g. STM32F103: PA3 (RX2) ==> TX; PA2 (TX2) ==> RX \
8 #define DD_SERIAL Serial2 \
9 *** \
10 e.g. Pico \
11 UART Serial2(8, 9, 0, 0); // 8: PICO_TX; 9: PICO_RX \
12 #define DD_SERIAL Serial2
13#endif
14
15#include "dumbdisplay.h"
16
36 public:
37 DDGenericIO(bool enableSerial = false, unsigned long serialBaud = DD_SERIAL_BAUD): DDInputOutput(serialBaud, enableSerial, enableSerial) {
38 }
39 const char* getWhat() {
40 return "GENERIC";
41 }
42 bool available() {
43 return DD_SERIAL.available();
44 }
45 char read() {
46 return DD_SERIAL.read();
47 }
48 void print(const String &s) {
49 DD_SERIAL.print(s);
50 }
51 void print(const char *p) {
52 DD_SERIAL.print(p);
53 }
54 void write(uint8_t b) {
55 DD_SERIAL.write(b);
56 }
57 void write(const uint8_t *buf, size_t size) {
58 DD_SERIAL.write(buf, size);
59 }
60 bool preConnect(bool firstCall) {
61 DDInputOutput::preConnect(firstCall);
62 if (firstCall) {
63#if defined(DD_SERIAL_begin)
64 DD_SERIAL_begin;
65#else
66 DD_SERIAL.begin(115200);
67#endif
68 }
69 return true;
70 }
71 void flush() {
72 }
73 bool canUseBuffer() {
74 return true;
75 }
76};
77
78#endif
Definition: genericdumbdisplay.h:35
Class for DD input/output; you explicitly constructed it, pass in when instantiate DumbDisplay,...
Definition: _dd_io.h:9