Files
espurna/code/espurna/uart.h
Maxim Prokhorov 574fbf1960 uart: standalone configuration
- setup uart at boot instead of delaying until some module needs it
  removes global `SERIAL_BAUDRATE` and `DEBUG_PORT` in favour or
  globally accessible numbered port configurations with `MODULE_NAME_PORT`
- automagically enable uart support for sensors that need it
- allow every sensor to configure uart0 (normal and swapped), uart1
  and an optional software-serial mode support with an extra build flag
  remove individual includes across the sensors
- settings queries and runtime port configuration (prefixed with uart)
- update dependencies header to cross-reference used ports at build time
- update deprecations header with serial baudrate notice
2022-09-25 08:26:22 +03:00

41 lines
540 B
C++

/*
UART MODULE
Copyright (C) 2022 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
*/
#pragma once
#include <Arduino.h>
#include <memory>
namespace espurna {
namespace driver {
namespace uart {
enum class Type {
Unknown,
Software,
Uart0,
Uart1,
};
struct Port {
Type type;
bool tx;
bool rx;
Stream* stream;
};
using PortPtr = std::unique_ptr<Port>;
} // namespace uart
} // namespace driver
} // namespace espurna
espurna::driver::uart::PortPtr uartPort(size_t index);
void uartSetup();