Comments (6)
I did some Googling and then decided to try some stuff. I was able to make a basic example compile by including the following code in a file called _make_unique.h
in the circular_queue
folder:
#ifndef ___MY_MAKE_UNIQUE___
#define ___MY_MAKE_UNIQUE___
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
namespace std {
template<class T> struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template<class T> struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template<class T, size_t N> struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
template<class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template<class T>
typename _Unique_if<T>::_Unknown_bound
make_unique(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
}
#endif
...and then adding #include "_make_unique.h"
at the top of circular_queue/circular_queue.h
.
The example that I wrote to see if it would compile is this:
#include <SoftwareSerial.h>
EspSoftwareSerial::UART swSerial;
EspSoftwareSerial::Config swSerialConfig = EspSoftwareSerial::SWSERIAL_8E1;
void setup() {
Serial.begin(115200);
swSerial.begin(9600, swSerialConfig, 10, 9, false, 128);
delay(2000);
Serial.println("Hello World");
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0) {
swSerial.write(Serial.read());
}
if(swSerial.available() > 0) {
Serial.write(swSerial.read());
}
}
I took inspiration from this SO post: https://stackoverflow.com/questions/24609271/errormake-unique-is-not-a-member-of-std which pointed me to this implementation https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique.
I'm not sure this is how you'd like to see this fixed, but let me know if you'd like me to make a PR.
from espsoftwareserial.
I'm sorry, I can't confirm. Currently, EspSoftwareSerial is ahead of the upcoming update of all ESP32 cores to IDF 5.1. I don't know which of the new chips are and which are not supported prior to IDF 5.1 anyway. As things are, the ghostl-async implementation that I'm focussed on is a part of EspSoftwareSerial, so if you think you needed to update EspSoftwareSerial - which you didn't as far as features are concerned - please checkout one of the latest IDF 5.1 based cores from Github, update the toolchains manually, and everything should compile just fine. I have built for ESP32S3 Dev Module successfully just this minute.
from espsoftwareserial.
I've been advised that SoftwareSerial should be generally be avoided in ESP32 by Espressif folks in arduino-esp gitter.
from espsoftwareserial.
@vicatcu On what grounds, if I may ask? Generally speaking, it's always wrong to use SW serial unless it offers features that you don't get from the HW UARTs. Like, being available at all :-)
from espsoftwareserial.
HW serial doesn't work on ESP32 with current IDF 5.1 based Arduino core. Reverting to release 2.0.14 of course yields the make_unique
issue you noticed.
I am reverting to the new
operator in HEAD.
from espsoftwareserial.
On the basis that there are 3 multiplexed hardware UARTs on the ESP32-S3 and if you only need to talk to one Serial input at a time you can just switch the pins a hardware UART at runtime by doing Serial.end followed by Serial.begin
from espsoftwareserial.
Related Issues (20)
- Hangs, when TX-PIN is using GPIO 2 HOT 1
- Polution of global namespace due to `using namespace EspSoftwareSerial;`. HOT 1
- Compile error HOT 1
- POLL command always responds 0x0b HOT 1
- fatal error: circular_queue.h: No such file or directory HOT 8
- Ghostl library not installed via PlatformIO HOT 8
- error: atomic: No such file or directory HOT 4
- Add support for ESP32 PICO series
- Can not debug an esp with this library
- Esp8266 HOT 1
- circular_queue.h: No such file or directory HOT 3
- ESP32-C3 Mini HOT 1
- Esp32 S3 HOT 1
- fatal error: EspSoftwareSerial.h: No such file or directory HOT 1
- Looking for old 2.1.0 version of this library
- espsoftwareserial
- EspSoftwareSerial 8.1.0 not working with ESP32 3.0.1
- Can't receive in one wire mode
- Increase receive and send buffer size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espsoftwareserial.