mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-27 21:16:50 +03:00
Merge remote-tracking branch 'remotes/esp8266/master'
This commit is contained in:
commit
2ebc7c9dc1
@ -98,11 +98,11 @@ extern "C" void optimistic_yield(uint32_t interval_us) {
|
|||||||
|
|
||||||
static void loop_wrapper() {
|
static void loop_wrapper() {
|
||||||
static bool setup_done = false;
|
static bool setup_done = false;
|
||||||
|
preloop_update_frequency();
|
||||||
if(!setup_done) {
|
if(!setup_done) {
|
||||||
setup();
|
setup();
|
||||||
setup_done = true;
|
setup_done = true;
|
||||||
}
|
}
|
||||||
preloop_update_frequency();
|
|
||||||
loop();
|
loop();
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
}
|
}
|
||||||
|
@ -151,3 +151,4 @@ Libraries that don't rely on low-level access to AVR registers should work well.
|
|||||||
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266.
|
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266.
|
||||||
- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB.
|
- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB.
|
||||||
- [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - Adafruit's ST7735 library modified to be compatible with ESP8266. Just make sure to modify the pins in the examples as they are still AVR specific.
|
- [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - Adafruit's ST7735 library modified to be compatible with ESP8266. Just make sure to modify the pins in the examples as they are still AVR specific.
|
||||||
|
- [UTFT-ESP8266](https://github.com/gnulabis/UTFT-ESP8266) - UTFT display library with support for ESP8266. Only serial interface (SPI) displays are supported for now (no 8-bit parallel mode, etc). Also includes support for the hardware SPI controller of the ESP8266.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This example demonstrates how to use
|
* This example demonstrates how to use
|
||||||
* WiFiClientSecure class to access HTTPS API.
|
* WiFiClientSecure class to access HTTPS API.
|
||||||
* We fetch and display the status of
|
* We fetch and display the status of
|
||||||
* esp8266/Arduino project continous integration
|
* esp8266/Arduino project continuous integration
|
||||||
* build.
|
* build.
|
||||||
*
|
*
|
||||||
* Created by Ivan Grokhotkov, 2015.
|
* Created by Ivan Grokhotkov, 2015.
|
||||||
@ -54,7 +54,7 @@ void setup() {
|
|||||||
Serial.println("certificate doesn't match");
|
Serial.println("certificate doesn't match");
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = "/repos/esp8266/Arduino/commits/esp8266/status";
|
String url = "/repos/esp8266/Arduino/commits/master/status";
|
||||||
Serial.print("requesting URL: ");
|
Serial.print("requesting URL: ");
|
||||||
Serial.println(url);
|
Serial.println(url);
|
||||||
|
|
||||||
|
@ -50,6 +50,17 @@ extern "C"
|
|||||||
#define SSL_DEBUG_OPTS 0
|
#define SSL_DEBUG_OPTS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uint8_t* default_private_key = 0;
|
||||||
|
uint32_t default_private_key_len = 0;
|
||||||
|
static bool default_private_key_dynamic = false;
|
||||||
|
//
|
||||||
|
uint8_t* default_certificate = 0;
|
||||||
|
uint32_t default_certificate_len = 0;
|
||||||
|
static bool default_certificate_dynamic = false;
|
||||||
|
|
||||||
|
static void clear_private_key();
|
||||||
|
static void clear_certificate();
|
||||||
|
|
||||||
|
|
||||||
class SSLContext {
|
class SSLContext {
|
||||||
public:
|
public:
|
||||||
@ -70,6 +81,9 @@ public:
|
|||||||
if (_ssl_ctx_refcnt == 0) {
|
if (_ssl_ctx_refcnt == 0) {
|
||||||
ssl_ctx_free(_ssl_ctx);
|
ssl_ctx_free(_ssl_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear_private_key();
|
||||||
|
clear_certificate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ref() {
|
void ref() {
|
||||||
@ -337,6 +351,66 @@ bool WiFiClientSecure::verify(const char* fp, const char* url) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WiFiClientSecure::setCertificate(const uint8_t* cert_data, size_t size) {
|
||||||
|
clear_certificate();
|
||||||
|
default_certificate = (uint8_t*) cert_data;
|
||||||
|
default_certificate_len = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WiFiClientSecure::setPrivateKey(const uint8_t* pk, size_t size) {
|
||||||
|
clear_private_key();
|
||||||
|
default_private_key = (uint8_t*) pk;
|
||||||
|
default_private_key_len = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WiFiClientSecure::loadCertificate(Stream& stream, size_t size) {
|
||||||
|
clear_certificate();
|
||||||
|
default_certificate = new uint8_t[size];
|
||||||
|
if (!default_certificate) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (stream.readBytes(default_certificate, size) != size) {
|
||||||
|
delete[] default_certificate;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default_certificate_dynamic = true;
|
||||||
|
default_certificate_len = size;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WiFiClientSecure::loadPrivateKey(Stream& stream, size_t size) {
|
||||||
|
clear_private_key();
|
||||||
|
default_private_key = new uint8_t[size];
|
||||||
|
if (!default_private_key) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (stream.readBytes(default_private_key, size) != size) {
|
||||||
|
delete[] default_private_key;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default_private_key_dynamic = true;
|
||||||
|
default_private_key_len = size;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clear_private_key() {
|
||||||
|
if (default_private_key && default_private_key_dynamic) {
|
||||||
|
delete[] default_private_key;
|
||||||
|
default_private_key_dynamic = false;
|
||||||
|
}
|
||||||
|
default_private_key = 0;
|
||||||
|
default_private_key_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clear_certificate() {
|
||||||
|
if (default_certificate && default_certificate_dynamic) {
|
||||||
|
delete[] default_certificate;
|
||||||
|
default_certificate_dynamic = false;
|
||||||
|
}
|
||||||
|
default_certificate = 0;
|
||||||
|
default_certificate_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" int ax_port_read(int fd, uint8_t* buffer, size_t count) {
|
extern "C" int ax_port_read(int fd, uint8_t* buffer, size_t count) {
|
||||||
ClientContext* _client = reinterpret_cast<ClientContext*>(fd);
|
ClientContext* _client = reinterpret_cast<ClientContext*>(fd);
|
||||||
if (_client->state() != ESTABLISHED && !_client->getSize()) {
|
if (_client->state() != ESTABLISHED && !_client->getSize()) {
|
||||||
|
@ -48,6 +48,22 @@ public:
|
|||||||
int peek() override;
|
int peek() override;
|
||||||
void stop() override;
|
void stop() override;
|
||||||
|
|
||||||
|
void setCertificate(const uint8_t* cert_data, size_t size);
|
||||||
|
void setPrivateKey(const uint8_t* pk, size_t size);
|
||||||
|
|
||||||
|
bool loadCertificate(Stream& stream, size_t size);
|
||||||
|
bool loadPrivateKey(Stream& stream, size_t size);
|
||||||
|
|
||||||
|
template<typename TFile>
|
||||||
|
bool loadCertificate(TFile& file) {
|
||||||
|
return loadCertificate(file, file.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TFile>
|
||||||
|
bool loadPrivateKey(TFile& file) {
|
||||||
|
return loadPrivateKey(file, file.size());
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _connectSSL();
|
int _connectSSL();
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user