Skip to content

Commit e0d2042

Browse files
Merge branch 'espressif:master' into master
2 parents c28a6a6 + 72c41d0 commit e0d2042

File tree

19 files changed

+1034
-112
lines changed

19 files changed

+1034
-112
lines changed

boards.txt

Lines changed: 594 additions & 2 deletions
Large diffs are not rendered by default.

cores/esp32/HWCDC.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ESP_EVENT_DEFINE_BASE(ARDUINO_HW_CDC_EVENTS);
2828

2929
static RingbufHandle_t tx_ring_buf = NULL;
3030
static xQueueHandle rx_queue = NULL;
31-
static uint8_t rx_data_buf[64];
31+
static uint8_t rx_data_buf[64] = {0};
3232
static intr_handle_t intr_handle = NULL;
3333
static volatile bool initial_empty = false;
3434
static xSemaphoreHandle tx_lock = NULL;
@@ -195,6 +195,7 @@ void HWCDC::end()
195195
intr_handle = NULL;
196196
if(tx_lock != NULL) {
197197
vSemaphoreDelete(tx_lock);
198+
tx_lock = NULL;
198199
}
199200
setRxBufferSize(0);
200201
setTxBufferSize(0);

cores/esp32/esp32-hal-bt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
#ifdef CONFIG_BT_ENABLED
1818

19-
bool btInUse(){ return true; }
19+
// user may want to change it to free resources
20+
__attribute__((weak)) bool btInUse(){ return true; }
2021

2122
#include "esp_bt.h"
2223

cores/esp32/esp32-hal-misc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,8 @@ bool verifyRollbackLater() { return false; }
209209
#endif
210210

211211
#ifdef CONFIG_BT_ENABLED
212-
//overwritten in esp32-hal-bt.c
213-
bool btInUse() __attribute__((weak));
214-
bool btInUse(){ return false; }
212+
//from esp32-hal-bt.c
213+
extern bool btInUse();
215214
#endif
216215

217216
void initArduino()

docs/source/api/ledc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ This function is used to setup the LEDC channel to 50 % PWM tone on selected fre
9090
* ``freq`` select frequency of pwm signal.
9191

9292
This function will return ``frequency`` set for channel.
93-
If ``0`` is returned, error occurs and ledc cahnnel was not configured.
93+
If ``0`` is returned, error occurs and ledc channel was not configured.
9494

9595
ledcWriteNote
9696
*************

libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
//#define CAMERA_MODEL_ESP32_CAM_BOARD
2929
//#define CAMERA_MODEL_ESP32S2_CAM_BOARD
3030
//#define CAMERA_MODEL_ESP32S3_CAM_LCD
31-
31+
//#define CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3 // Has PSRAM
32+
//#define CAMERA_MODEL_DFRobot_Romeo_ESP32S3 // Has PSRAM
3233
#include "camera_pins.h"
3334

3435
// ===========================

libraries/ESP32/examples/Camera/CameraWebServer/camera_pins.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,25 @@
293293
#define HREF_GPIO_NUM 7
294294
#define PCLK_GPIO_NUM 13
295295

296+
#elif defined(CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3) || defined(CAMERA_MODEL_DFRobot_Romeo_ESP32S3)
297+
#define PWDN_GPIO_NUM -1
298+
#define RESET_GPIO_NUM -1
299+
#define XCLK_GPIO_NUM 45
300+
#define SIOD_GPIO_NUM 1
301+
#define SIOC_GPIO_NUM 2
302+
303+
#define Y9_GPIO_NUM 48
304+
#define Y8_GPIO_NUM 46
305+
#define Y7_GPIO_NUM 8
306+
#define Y6_GPIO_NUM 7
307+
#define Y5_GPIO_NUM 4
308+
#define Y4_GPIO_NUM 41
309+
#define Y3_GPIO_NUM 40
310+
#define Y2_GPIO_NUM 39
311+
#define VSYNC_GPIO_NUM 6
312+
#define HREF_GPIO_NUM 42
313+
#define PCLK_GPIO_NUM 5
314+
296315
#else
297316
#error "Camera model not selected"
298317
#endif

libraries/RainMaker/src/RMakerDevice.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@
55
static esp_err_t err;
66
typedef void (*deviceWriteCb)(Device*, Param*, const param_val_t val, void *priv_data, write_ctx_t *ctx);
77
typedef void (*deviceReadCb)(Device*, Param*, void *priv_data, read_ctx_t *ctx);
8-
9-
void (*write_cb)(Device*, Param*, param_val_t, void*, write_ctx_t*);
10-
void (*read_cb)(Device*, Param*, void*, read_ctx_t*);
11-
Device device;
12-
Param param;
8+
typedef struct {
9+
void *priv_data;
10+
deviceWriteCb write_cb;
11+
deviceReadCb read_cb;
12+
} RMakerDevicePrivT;
1313

1414
static esp_err_t write_callback(const device_handle_t *dev_handle, const param_handle_t *par_handle, const param_val_t val, void *priv_data, write_ctx_t *ctx)
1515
{
16+
Device device;
17+
Param param;
1618
device.setDeviceHandle(dev_handle);
1719
param.setParamHandle(par_handle);
18-
19-
write_cb(&device, &param, val, priv_data, ctx);
20+
deviceWriteCb cb = ((RMakerDevicePrivT *)priv_data)->write_cb;
21+
cb(&device, &param, val, ((RMakerDevicePrivT *)priv_data)->priv_data, ctx);
2022
return ESP_OK;
2123
}
2224

2325
static esp_err_t read_callback(const device_handle_t *dev_handle, const param_handle_t *par_handle, void *priv_data, read_ctx_t *ctx)
2426
{
27+
Device device;
28+
Param param;
2529
device.setDeviceHandle(dev_handle);
2630
param.setParamHandle(par_handle);
27-
28-
read_cb(&device, &param, priv_data, ctx);
31+
deviceReadCb cb = ((RMakerDevicePrivT *)priv_data)->read_cb;
32+
cb(&device, &param, ((RMakerDevicePrivT *)priv_data)->priv_data, ctx);
2933
return ESP_OK;
3034
}
3135

@@ -41,8 +45,8 @@ esp_err_t Device::deleteDevice()
4145

4246
void Device::addCb(deviceWriteCb writeCb, deviceReadCb readCb)
4347
{
44-
write_cb = writeCb;
45-
read_cb = readCb;
48+
this->private_data.write_cb = writeCb;
49+
this->private_data.read_cb = readCb;
4650
err = esp_rmaker_device_add_cb(getDeviceHandle(), write_callback, read_callback);
4751
if(err != ESP_OK) {
4852
log_e("Failed to register callback");

libraries/RainMaker/src/RMakerDevice.h

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,42 @@
2121

2222
class Device
2323
{
24+
public:
25+
typedef void (*deviceWriteCb)(Device*, Param*, const param_val_t val, void *priv_data, write_ctx_t *ctx);
26+
typedef void (*deviceReadCb)(Device*, Param*, void *priv_data, read_ctx_t *ctx);
27+
typedef struct {
28+
void *priv_data;
29+
deviceWriteCb write_cb;
30+
deviceReadCb read_cb;
31+
} RMakerDevicePrivT;
2432
private:
2533
const device_handle_t *device_handle;
34+
RMakerDevicePrivT private_data;
2635

36+
protected:
37+
void setPrivateData(void *priv_data) {
38+
this->private_data.priv_data = priv_data;
39+
}
40+
41+
const RMakerDevicePrivT* getDevicePrivateData()
42+
{
43+
return &this->private_data;
44+
}
2745
public:
2846
Device()
2947
{
3048
device_handle = NULL;
31-
}
49+
this->private_data.priv_data = NULL;
50+
this->private_data.write_cb = NULL;
51+
this->private_data.read_cb = NULL;
52+
}
53+
3254
Device(const char *dev_name, const char *dev_type = NULL, void *priv_data = NULL)
3355
{
34-
device_handle = esp_rmaker_device_create(dev_name, dev_type, priv_data);
56+
this->private_data.priv_data = priv_data;
57+
this->private_data.write_cb = NULL;
58+
this->private_data.read_cb = NULL;
59+
device_handle = esp_rmaker_device_create(dev_name, dev_type, &this->private_data);
3560
if(device_handle == NULL){
3661
log_e("Device create error");
3762
}
@@ -48,9 +73,6 @@ class Device
4873
{
4974
return device_handle;
5075
}
51-
52-
typedef void (*deviceWriteCb)(Device*, Param*, const param_val_t val, void *priv_data, write_ctx_t *ctx);
53-
typedef void (*deviceReadCb)(Device*, Param*, void *priv_data, read_ctx_t *ctx);
5476

5577
esp_err_t deleteDevice();
5678
void addCb(deviceWriteCb write_cb, deviceReadCb read_cb = NULL);
@@ -94,7 +116,8 @@ class Switch : public Device
94116
}
95117
void standardSwitchDevice(const char *dev_name, void *priv_data, bool power)
96118
{
97-
esp_rmaker_device_t *dev_handle = esp_rmaker_switch_device_create(dev_name, priv_data, power);
119+
this->setPrivateData(priv_data);
120+
esp_rmaker_device_t *dev_handle = esp_rmaker_switch_device_create(dev_name, (void *)this->getDevicePrivateData(), power);
98121
setDeviceHandle(dev_handle);
99122
if(dev_handle == NULL){
100123
log_e("Switch device not created");
@@ -115,7 +138,8 @@ class LightBulb : public Device
115138
}
116139
void standardLightBulbDevice(const char *dev_name, void *priv_data, bool power)
117140
{
118-
esp_rmaker_device_t *dev_handle = esp_rmaker_lightbulb_device_create(dev_name, priv_data, power);
141+
this->setPrivateData(priv_data);
142+
esp_rmaker_device_t *dev_handle = esp_rmaker_lightbulb_device_create(dev_name, (void *)this->getDevicePrivateData(), power);
119143
setDeviceHandle(dev_handle);
120144
if(dev_handle == NULL){
121145
log_e("Light device not created");
@@ -157,7 +181,8 @@ class TemperatureSensor : public Device
157181
}
158182
void standardTemperatureSensorDevice(const char *dev_name, void *priv_data, float temp)
159183
{
160-
esp_rmaker_device_t *dev_handle = esp_rmaker_temp_sensor_device_create(dev_name, priv_data, temp);
184+
this->setPrivateData(priv_data);
185+
esp_rmaker_device_t *dev_handle = esp_rmaker_temp_sensor_device_create(dev_name, (void *)this->getDevicePrivateData(), temp);
161186
setDeviceHandle(dev_handle);
162187
if(dev_handle == NULL){
163188
log_e("Temperature Sensor device not created");

0 commit comments

Comments
 (0)