Skip to content

Commit

Permalink
Updates upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Nov 25, 2024
2 parents 0122fc3 + bf9ad4f commit dfeea6c
Show file tree
Hide file tree
Showing 21 changed files with 332 additions and 100 deletions.
19 changes: 18 additions & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,15 @@ esp32h2.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_co
esp32h2.menu.ZigbeeMode.rcp=Zigbee RCP (radio co-processor)
esp32h2.menu.ZigbeeMode.rcp.build.zigbee_mode=-DZIGBEE_MODE_RCP
esp32h2.menu.ZigbeeMode.rcp.build.zigbee_libs=-lesp_zb_api_rcp -lesp_zb_cli_command -lzboss_stack.rcp -lzboss_port

esp32h2.menu.ZigbeeMode.ed_debug=Zigbee ED (end device) - Debug
esp32h2.menu.ZigbeeMode.ed_debug.build.zigbee_mode=-DZIGBEE_MODE_ED
esp32h2.menu.ZigbeeMode.ed_debug.build.zigbee_libs=-lesp_zb_api_ed.debug -lesp_zb_cli_command -lzboss_stack.ed.debug -lzboss_port.debug
esp32h2.menu.ZigbeeMode.zczr_debug=Zigbee ZCZR (coordinator/router) - Debug
esp32h2.menu.ZigbeeMode.zczr_debug.build.zigbee_mode=-DZIGBEE_MODE_ZCZR
esp32h2.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api_zczr.debug -lesp_zb_cli_command -lzboss_stack.zczr.debug -lzboss_port.debug
esp32h2.menu.ZigbeeMode.rcp_debug=Zigbee RCP (radio co-processor) - Debug
esp32h2.menu.ZigbeeMode.rcp_debug.build.zigbee_mode=-DZIGBEE_MODE_RCP
esp32h2.menu.ZigbeeMode.rcp_debug.build.zigbee_libs=-lesp_zb_api_rcp.debug -lesp_zb_cli_command -lzboss_stack.rcp.debug -lzboss_port.debug

##############################################################

Expand Down Expand Up @@ -723,6 +731,15 @@ esp32c6.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_co
esp32c6.menu.ZigbeeMode.rcp=Zigbee RCP (radio co-processor)
esp32c6.menu.ZigbeeMode.rcp.build.zigbee_mode=-DZIGBEE_MODE_RCP
esp32c6.menu.ZigbeeMode.rcp.build.zigbee_libs=-lesp_zb_api_rcp -lesp_zb_cli_command -lzboss_stack.rcp -lzboss_port
esp32c6.menu.ZigbeeMode.ed_debug=Zigbee ED (end device) - Debug
esp32c6.menu.ZigbeeMode.ed_debug.build.zigbee_mode=-DZIGBEE_MODE_ED
esp32c6.menu.ZigbeeMode.ed_debug.build.zigbee_libs=-lesp_zb_api_ed.debug -lesp_zb_cli_command -lzboss_stack.ed.debug -lzboss_port.debug
esp32c6.menu.ZigbeeMode.zczr_debug=Zigbee ZCZR (coordinator/router) - Debug
esp32c6.menu.ZigbeeMode.zczr_debug.build.zigbee_mode=-DZIGBEE_MODE_ZCZR
esp32c6.menu.ZigbeeMode.zczr_debug.build.zigbee_libs=-lesp_zb_api_zczr.debug -lesp_zb_cli_command -lzboss_stack.zczr.debug -lzboss_port.debug
esp32c6.menu.ZigbeeMode.rcp_debug=Zigbee RCP (radio co-processor) - Debug
esp32c6.menu.ZigbeeMode.rcp_debug.build.zigbee_mode=-DZIGBEE_MODE_RCP
esp32c6.menu.ZigbeeMode.rcp_debug.build.zigbee_libs=-lesp_zb_api_rcp.debug -lesp_zb_cli_command -lzboss_stack.rcp.debug -lzboss_port.debug

##############################################################

Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include "hal/gpio_hal.h"
#include "esp_rom_gpio.h"

static int s_uart_debug_nr = 0; // UART number for debug output
#define REF_TICK_BAUDRATE_LIMIT 250000 // this is maximum UART badrate using REF_TICK as clock
static int s_uart_debug_nr = 0; // UART number for debug output
#define REF_TICK_BAUDRATE_LIMIT 250000 // this is maximum UART badrate using REF_TICK as clock

struct uart_struct_t {

Expand Down
26 changes: 26 additions & 0 deletions libraries/AsyncUDP/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

AsyncUDP KEYWORD1
AsyncUDPPacket KEYWORD1
AsyncUDPMessage KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
Expand All @@ -19,6 +20,21 @@ listen KEYWORD2
listenMulticast KEYWORD2
close KEYWORD2
write KEYWORD2
space KEYWORD2
flush KEYWORD2
isBroadcast KEYWORD2
isMulticast KEYWORD2
isIPv6 KEYWORD2
interface KEYWORD2
localIPv6 KEYWORD2
remoteIPv6 KEYWORD2
remoteMac KEYWORD2
send KEYWORD2
peek KEYWORD2
available KEYWORD2
writeTo KEYWORD2
broadcastTo KEYWORD2
sendTo KEYWORD2
broadcast KEYWORD2
onPacket KEYWORD2
data KEYWORD2
Expand All @@ -27,7 +43,17 @@ localIP KEYWORD2
localPort KEYWORD2
remoteIP KEYWORD2
remotePort KEYWORD2
listenIP KEYWORD2
listenIPv6 KEYWORD2
lastErr KEYWORD2
_s_recv KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################

TCPIP_ADAPTER_IF_STA LITERAL1
TCPIP_ADAPTER_IF_STA LITERAL1
TCPIP_ADAPTER_IF_AP LITERAL1
TCPIP_ADAPTER_IF_ETH LITERAL1
TCPIP_ADAPTER_IF_PPP LITERAL1
81 changes: 81 additions & 0 deletions libraries/Matter/examples/MatterMinimum/MatterMinimum.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*
* This example is the smallest code that will create a Matter Device which can be
* commissioned and controlled from a Matter Environment APP.
* It controls a GPIO that could be attached to a LED for visualization.
* Additionally the ESP32 will send debug messages indicating the Matter activity.
* Turning DEBUG Level ON may be useful to following Matter Accessory and Controller messages.
*/

// Matter Manager
#include <Matter.h>
#include <WiFi.h>

// List of Matter Endpoints for this Node
// Single On/Off Light Endpoint - at least one per node
MatterOnOffLight OnOffLight;

// Light GPIO that can be controlled by Matter APP
#ifdef LED_BUILTIN
const uint8_t ledPin = LED_BUILTIN;
#else
const uint8_t ledPin = 2; // Set your pin here if your board has not defined LED_BUILTIN
#endif

// Matter Protocol Endpoint (On/OFF Light) Callback
bool matterCB(bool state) {
digitalWrite(ledPin, state ? HIGH : LOW);
// This callback must return the success state to Matter core
return true;
}

// WiFi is manually set and started
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
const char *password = "your-password"; // Change this to your WiFi password

void setup() {
// Initialize the LED GPIO
pinMode(ledPin, OUTPUT);

WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}

// Initialize at least one Matter EndPoint
OnOffLight.begin();

// Associate a callback to the Matter Controller
OnOffLight.onChange(matterCB);

// Matter beginning - Last step, after all EndPoints are initialized
Matter.begin();

if (!Matter.isDeviceCommissioned()) {
log_i("Matter Node is not commissioned yet.");
log_i("Initiate the device discovery in your Matter environment.");
log_i("Commission it to your Matter hub with the manual pairing code or QR code");
log_i("Manual pairing code: %s\r\n", Matter.getManualPairingCode().c_str());
log_i("QR code URL: %s\r\n", Matter.getOnboardingQRCodeUrl().c_str());
}
}

void loop() {
delay(500);
}
7 changes: 7 additions & 0 deletions libraries/Matter/examples/MatterMinimum/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"fqbn_append": "PartitionScheme=huge_app",
"requires": [
"CONFIG_SOC_WIFI_SUPPORTED=y",
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
]
}
10 changes: 7 additions & 3 deletions libraries/Update/src/Update.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#ifndef ESP32UPDATER_H
#define ESP32UPDATER_H

#ifndef UPDATE_NOCRYPT
#define UPDATE_NOCRYPT
#endif

#include <Arduino.h>
#include <MD5Builder.h>
Expand Down Expand Up @@ -145,11 +147,13 @@ class UpdateClass {
sets the expected MD5 for the firmware (hexString)
If calc_post_decryption is true, the update library will calculate the MD5 after the decryption, if false the calculation occurs before the decryption
*/
bool setMD5(const char *expected_md5
bool setMD5(
const char *expected_md5
#ifndef UPDATE_NOCRYPT
, bool calc_post_decryption = true
,
bool calc_post_decryption = true
#endif /* #ifdef UPDATE_NOCRYPT */
);
);

/*
returns the MD5 String of the successfully ended firmware
Expand Down
18 changes: 11 additions & 7 deletions libraries/Update/src/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ bool UpdateClass::_enablePartition(const esp_partition_t *partition) {
UpdateClass::UpdateClass()
: _error(0),
#ifndef UPDATE_NOCRYPT
_cryptKey(0), _cryptBuffer(0),
_cryptKey(0), _cryptBuffer(0),
#endif /* UPDATE_NOCRYPT */
_buffer(0), _skipBuffer(0), _bufferLen(0), _size(0), _progress_callback(NULL), _progress(0), _paroffset(0), _command(U_FLASH), _partition(NULL)
_buffer(0), _skipBuffer(0), _bufferLen(0), _size(0), _progress_callback(NULL), _progress(0), _paroffset(0), _command(U_FLASH), _partition(NULL)
#ifndef UPDATE_NOCRYPT
, _cryptMode(U_AES_DECRYPT_AUTO), _cryptAddress(0), _cryptCfg(0xf)
,
_cryptMode(U_AES_DECRYPT_AUTO), _cryptAddress(0), _cryptCfg(0xf)
#endif /* UPDATE_NOCRYPT */
{}
{
}

UpdateClass &UpdateClass::onProgress(THandlerFunction_Progress fn) {
_progress_callback = fn;
Expand Down Expand Up @@ -378,7 +380,7 @@ bool UpdateClass::_writeBuffer() {
return false;
}
}
#endif /* UPDATE_NOCRYPT */
#endif /* UPDATE_NOCRYPT */
//first bytes of new firmware
uint8_t skip = 0;
if (!_progress && _command == U_FLASH) {
Expand Down Expand Up @@ -476,9 +478,11 @@ bool UpdateClass::_verifyEnd() {
return false;
}

bool UpdateClass::setMD5(const char *expected_md5
bool UpdateClass::setMD5(
const char *expected_md5
#ifndef UPDATE_NOCRYPT
,bool calc_post_decryption
,
bool calc_post_decryption
#endif /* UPDATE_NOCRYPT */
) {
if (strlen(expected_md5) != 32) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ void identify(uint16_t time) {

/********************* Arduino functions **************************/
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(10);
}

// Init RMT and leave light OFF
rgbLedWrite(LED_PIN, 0, 0, 0);

Expand All @@ -80,12 +85,21 @@ void setup() {
zbColorLight.setManufacturerAndModel("Espressif", "ZBColorLightBulb");

// Add endpoint to Zigbee Core
log_d("Adding ZigbeeLight endpoint to Zigbee Core");
Serial.println("Adding ZigbeeLight endpoint to Zigbee Core");
Zigbee.addEndpoint(&zbColorLight);

// When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
log_d("Calling Zigbee.begin()");
Zigbee.begin();
// When all EPs are registered, start Zigbee in End Device mode
if (!Zigbee.begin()) {
Serial.println("Zigbee failed to start!");
Serial.println("Rebooting...");
ESP.restart();
}
Serial.println("Connecting to network");
while (!Zigbee.connected()) {
Serial.print(".");
delay(100);
}
Serial.println();
}

void loop() {
Expand All @@ -98,7 +112,8 @@ void loop() {
delay(50);
if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
delay(1000);
Zigbee.factoryReset();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ ZigbeeColorDimmerSwitch zbSwitch = ZigbeeColorDimmerSwitch(SWITCH_ENDPOINT_NUMBE

/********************* Arduino functions **************************/
void setup() {

Serial.begin(115200);
while (!Serial) {
delay(10);
Expand All @@ -68,11 +67,15 @@ void setup() {
Zigbee.setRebootOpenNetwork(180);

//When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode
Zigbee.begin(ZIGBEE_COORDINATOR);
if (!Zigbee.begin(ZIGBEE_COORDINATOR)) {
Serial.println("Zigbee failed to start!");
Serial.println("Rebooting...");
ESP.restart();
}

Serial.println("Waiting for Light to bound to the switch");
//Wait for switch to bound to a light:
while (!zbSwitch.isBound()) {
while (!zbSwitch.bound()) {
Serial.printf(".");
delay(500);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void setLED(bool value) {

/********************* Arduino functions **************************/
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(10);
}
// Init LED and turn it OFF (if LED_PIN == RGB_BUILTIN, the rgbLedWrite() will be used under the hood)
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Expand All @@ -59,12 +63,21 @@ void setup() {
zbLight.onLightChange(setLED);

//Add endpoint to Zigbee Core
log_d("Adding ZigbeeLight endpoint to Zigbee Core");
Serial.println("Adding ZigbeeLight endpoint to Zigbee Core");
Zigbee.addEndpoint(&zbLight);

// When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
log_d("Calling Zigbee.begin()");
Zigbee.begin();
if (!Zigbee.begin()) {
Serial.println("Zigbee failed to start!");
Serial.println("Rebooting...");
ESP.restart();
}
Serial.println("Connecting to network");
while (!Zigbee.connected()) {
Serial.print(".");
delay(100);
}
Serial.println();
}

void loop() {
Expand All @@ -77,7 +90,8 @@ void loop() {
delay(50);
if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
delay(1000);
Zigbee.factoryReset();
}
}
Expand Down
Loading

0 comments on commit dfeea6c

Please sign in to comment.