Skip to content

Commit

Permalink
Fix compilation with Arduino 3 alpha 1 (#19690)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Oct 6, 2023
1 parent bf9c5b8 commit 72b2767
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions lib/libesp32/berry_tasmota/src/be_serial_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
* 2 wire communication - I2C
*******************************************************************/
#include "be_constobj.h"

#include "esp32-hal.h"
#include "esp_idf_version.h"

extern int b_serial_init(bvm *vm);
extern int b_serial_deinit(bvm *vm);
Expand All @@ -17,6 +16,40 @@ extern int b_serial_read(bvm *vm);
extern int b_serial_available(bvm *vm);
extern int b_serial_flush(bvm *vm);

#if ESP_IDF_VERSION_MAJOR < 5
#include "esp32-hal.h"
#else
// it should be #include "HardwareSerial.h"
// but the C++ header cannot be included in a C file
// so there's a copy below
enum SerialConfig {
SERIAL_5N1 = 0x8000010,
SERIAL_6N1 = 0x8000014,
SERIAL_7N1 = 0x8000018,
SERIAL_8N1 = 0x800001c,
SERIAL_5N2 = 0x8000030,
SERIAL_6N2 = 0x8000034,
SERIAL_7N2 = 0x8000038,
SERIAL_8N2 = 0x800003c,
SERIAL_5E1 = 0x8000012,
SERIAL_6E1 = 0x8000016,
SERIAL_7E1 = 0x800001a,
SERIAL_8E1 = 0x800001e,
SERIAL_5E2 = 0x8000032,
SERIAL_6E2 = 0x8000036,
SERIAL_7E2 = 0x800003a,
SERIAL_8E2 = 0x800003e,
SERIAL_5O1 = 0x8000013,
SERIAL_6O1 = 0x8000017,
SERIAL_7O1 = 0x800001b,
SERIAL_8O1 = 0x800001f,
SERIAL_5O2 = 0x8000033,
SERIAL_6O2 = 0x8000037,
SERIAL_7O2 = 0x800003b,
SERIAL_8O2 = 0x800003f
};
#endif

#include "be_fixed_be_class_serial.h"

/* @const_object_info_begin
Expand Down

0 comments on commit 72b2767

Please sign in to comment.