doubleSerial.h 826 B

123456789101112131415161718192021222324252627282930313233
  1. // safety againts double-include
  2. #ifndef doubleSerial_h
  3. #define doubleSerial_h
  4. #include <Arduino.h>
  5. #include <HardwareSerial.h>
  6. #include "BluetoothSerial.h"
  7. #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
  8. #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
  9. #endif
  10. // Stub extension for now
  11. class doubleSerial {
  12. public:
  13. doubleSerial();
  14. doubleSerial(const char *BT_Name);
  15. void selectSerial(boolean useBluetooth);
  16. boolean isBT(void);
  17. boolean readSerial(uint8_t *data);
  18. void writeSerial(const char c);
  19. void writeSerial(const char *c);
  20. boolean hasClient(void);
  21. private:
  22. boolean useBT;
  23. const char *BTName = NULL;
  24. BluetoothSerial SerialBT;
  25. };
  26. extern HardwareSerial Serial;
  27. #endif
  28. // *********** END OF CODE **********