mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Add host uart support for MacOS (#7095)
This commit is contained in:
parent
aa490e3726
commit
10205e06cb
1 changed files with 6 additions and 2 deletions
|
@ -5,8 +5,8 @@
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
#ifndef __linux__
|
#if !(defined(__linux__) || defined(__APPLE__))
|
||||||
#error This HostUartComponent implementation is only for Linux
|
#error This HostUartComponent implementation is not supported on this host OS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -24,6 +24,9 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
speed_t get_baud(int baud) {
|
speed_t get_baud(int baud) {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
return baud;
|
||||||
|
#else
|
||||||
switch (baud) {
|
switch (baud) {
|
||||||
case 50:
|
case 50:
|
||||||
return B50;
|
return B50;
|
||||||
|
@ -88,6 +91,7 @@ speed_t get_baud(int baud) {
|
||||||
default:
|
default:
|
||||||
return B0;
|
return B0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue