Skip to content

Commit 27b992f

Browse files
authored
Merge pull request #42 from tasmota/revert-41-revert-40-master
Revert "Revert "RMT refactor""
2 parents 857a9f7 + 0c310e3 commit 27b992f

File tree

89 files changed

+570
-954
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+570
-954
lines changed

cores/esp32/esp32-hal-rmt.c

Lines changed: 306 additions & 754 deletions
Large diffs are not rendered by default.

cores/esp32/esp32-hal-rmt.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ extern "C" {
2525
#define RMT_FLAG_ERROR (4)
2626
#define RMT_FLAGS_ALL (RMT_FLAG_TX_DONE | RMT_FLAG_RX_DONE | RMT_FLAG_ERROR)
2727

28+
#define RMT_TX_MODE true
29+
#define RMT_RX_MODE false
30+
2831
struct rmt_obj_s;
2932

3033
typedef enum {
@@ -54,6 +57,13 @@ typedef struct {
5457
};
5558
} rmt_data_t;
5659

60+
61+
/**
62+
* Prints object information
63+
*
64+
*/
65+
void _rmtDumpStatus(rmt_obj_t* rmt);
66+
5767
/**
5868
* Initialize the object
5969
*
@@ -69,10 +79,17 @@ float rmtSetTick(rmt_obj_t* rmt, float tick);
6979
/**
7080
* Sending data in one-go mode or continual mode
7181
* (more data being send while updating buffers in interrupts)
72-
*
82+
* Non-Blocking mode - returns right after executing
7383
*/
7484
bool rmtWrite(rmt_obj_t* rmt, rmt_data_t* data, size_t size);
7585

86+
/**
87+
* Sending data in one-go mode or continual mode
88+
* (more data being send while updating buffers in interrupts)
89+
* Blocking mode - only returns when data has been sent
90+
*/
91+
bool rmtWriteBlocking(rmt_obj_t* rmt, rmt_data_t* data, size_t size);
92+
7693
/**
7794
* Loop data up to the reserved memsize continuously
7895
*

libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class MyProcessor {
1212

1313
public:
1414
MyProcessor(uint8_t pin, float nanoTicks) {
15-
assert((rmt_recv = rmtInit(21, false, RMT_MEM_192)));
15+
assert((rmt_recv = rmtInit(21, RMT_RX_MODE, RMT_MEM_192)));
1616

1717
realNanoTick = rmtSetTick(rmt_recv, nanoTicks);
1818
};
@@ -61,4 +61,4 @@ void loop()
6161
{
6262
Serial.printf("GPIO 4: %08x 5: %08x 6: %08x\n", mp1.val(), mp2.val(), mp3.val());
6363
delay(500);
64-
}
64+
}

libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55

66
#include "esp32-hal.h"
77

8+
#if CONFIG_IDF_TARGET_ESP32C3
9+
// ESP32 C3 has only 2 channels for RX and 2 for TX, thus MAX RMT_MEM is 128
10+
#define RMT_TX_PIN 4
11+
#define RMT_RX_PIN 5
12+
#define RMT_MEM_RX RMT_MEM_128
13+
#else
14+
#define RMT_TX_PIN 18
15+
#define RMT_RX_PIN 21
16+
#define RMT_MEM_RX RMT_MEM_192
17+
#endif
18+
819
rmt_data_t my_data[256];
920
rmt_data_t data[256];
1021

@@ -18,18 +29,19 @@ void setup()
1829
Serial.begin(115200);
1930
events = xEventGroupCreate();
2031

21-
if ((rmt_send = rmtInit(18, true, RMT_MEM_64)) == NULL)
32+
if ((rmt_send = rmtInit(RMT_TX_PIN, RMT_TX_MODE, RMT_MEM_64)) == NULL)
2233
{
2334
Serial.println("init sender failed\n");
2435
}
25-
if ((rmt_recv = rmtInit(21, false, RMT_MEM_192)) == NULL)
36+
if ((rmt_recv = rmtInit(RMT_RX_PIN, RMT_RX_MODE, RMT_MEM_RX)) == NULL)
2637
{
2738
Serial.println("init receiver failed\n");
2839
}
2940

3041
float realTick = rmtSetTick(rmt_send, 100);
3142
printf("real tick set to: %fns\n", realTick);
32-
43+
// both will keep same tick
44+
realTick = rmtSetTick(rmt_recv, 100);
3345
}
3446

3547
void loop()

libraries/ESP32/examples/RMT/RMTReadXJT/RMTReadXJT.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void setup()
182182
Serial.begin(115200);
183183

184184
// Initialize the channel to capture up to 192 items
185-
if ((rmt_recv = rmtInit(21, false, RMT_MEM_192)) == NULL)
185+
if ((rmt_recv = rmtInit(21, RMT_RX_MODE, RMT_MEM_192)) == NULL)
186186
{
187187
Serial.println("init receiver failed\n");
188188
}

libraries/ESP32/examples/RMT/RMTWriteNeoPixel/RMTWriteNeoPixel.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void setup()
4141
{
4242
Serial.begin(115200);
4343

44-
if ((rmt_send = rmtInit(18, true, RMT_MEM_64)) == NULL)
44+
if ((rmt_send = rmtInit(18, RMT_TX_MODE, RMT_MEM_64)) == NULL)
4545
{
4646
Serial.println("init sender failed\n");
4747
}

libraries/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ arduino-esp32 includes libraries for Arduino compatibility along with some objec
4040
### ESPmDNS
4141
mDNS service advertising
4242

43+
### Ethernet
44+
Ethernet networking
45+
4346
### FFat
4447
FAT indexed filesystem on SPI flash
4548

@@ -52,6 +55,12 @@ arduino-esp32 includes libraries for Arduino compatibility along with some objec
5255
### HTTPUpdate
5356
Download a firmware update from HTTPd and apply it using Update
5457

58+
### HTTPUpdateServer
59+
Upload a firmware for the update from HTTPd
60+
61+
### LittleFS
62+
LittleFS (File System)
63+
5564
### NetBIOS
5665
NetBIOS name advertiser
5766

@@ -79,6 +88,9 @@ arduino-esp32 includes libraries for Arduino compatibility along with some objec
7988
### Update
8089
Sketch Update using ESP32 OTA functionality
8190

91+
### USB
92+
Universal Serial Bus driver (device only)
93+
8294
### WebServer
8395
A simple HTTP daemon
8496

@@ -89,4 +101,4 @@ arduino-esp32 includes libraries for Arduino compatibility along with some objec
89101
Arduino compatible WiFi client object using embedded encryption
90102

91103
### Wire
92-
Arduino compatible I2C driver (master only)
104+
Arduino compatible I2C driver

platform.txt

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

tools/platformio-build-esp32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@
303303
"UNITY_INCLUDE_CONFIG_H",
304304
"WITH_POSIX",
305305
"_GNU_SOURCE",
306-
("IDF_VER", '\\"v4.4-beta1-183-gf23dcd3555\\"'),
306+
("IDF_VER", '\\"v4.4-beta1-189-ga79dc75f0a\\"'),
307307
"ESP_PLATFORM",
308308
"_POSIX_READER_WRITER_LOCKS",
309309
"ARDUINO_ARCH_ESP32",

tools/platformio-build-esp32c3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
"UNITY_INCLUDE_CONFIG_H",
294294
"WITH_POSIX",
295295
"_GNU_SOURCE",
296-
("IDF_VER", '\\"v4.4-beta1-183-gf23dcd3555\\"'),
296+
("IDF_VER", '\\"v4.4-beta1-189-ga79dc75f0a\\"'),
297297
"ESP_PLATFORM",
298298
"_POSIX_READER_WRITER_LOCKS",
299299
"ARDUINO_ARCH_ESP32",

tools/platformio-build-esp32s2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
"UNITY_INCLUDE_CONFIG_H",
291291
"WITH_POSIX",
292292
"_GNU_SOURCE",
293-
("IDF_VER", '\\"v4.4-beta1-183-gf23dcd3555\\"'),
293+
("IDF_VER", '\\"v4.4-beta1-189-ga79dc75f0a\\"'),
294294
"ESP_PLATFORM",
295295
"_POSIX_READER_WRITER_LOCKS",
296296
"ARDUINO_ARCH_ESP32",

tools/sdk/esp32/include/config/sdkconfig.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@
406406
#define CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS 5
407407
#define CONFIG_LWIP_ICMP 1
408408
#define CONFIG_LWIP_MAX_RAW_PCBS 16
409-
#define CONFIG_LWIP_SNTP_MAX_SERVERS 1
409+
#define CONFIG_LWIP_SNTP_MAX_SERVERS 3
410+
#define CONFIG_LWIP_DHCP_GET_NTP_SRV 1
411+
#define CONFIG_LWIP_DHCP_MAX_NTP_SERVERS 1
410412
#define CONFIG_LWIP_SNTP_UPDATE_DELAY 3600000
411413
#define CONFIG_LWIP_ESP_LWIP_ASSERT 1
412414
#define CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT 1
@@ -677,5 +679,5 @@
677679
#define CONFIG_ULP_COPROC_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
678680
#define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS
679681
#define CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
680-
#define CONFIG_ARDUINO_IDF_COMMIT "f23dcd3555"
682+
#define CONFIG_ARDUINO_IDF_COMMIT "a79dc75f0a"
681683
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.4"

tools/sdk/esp32/include/esp-face/include/layer/dl_layer_expand_dims.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,18 @@ namespace dl
6666
this->output_exponent = input.exponent;
6767
if (!this->inplace)
6868
{
69-
if (this->output != NULL)
69+
if (this->output == NULL)
7070
{
7171
this->output = new Tensor<feature_t>;
7272
}
7373
this->output->set_exponent(this->output_exponent);
74-
this->output->set_shape(this->output_shape);
74+
this->output->set_shape(input.shape);
7575
this->output->expand_dims(this->axis);
7676
this->output->free_element();
7777
}
7878
else
7979
{
8080
this->output = &input;
81-
this->output->set_shape(this->output_shape);
8281
this->output->expand_dims(this->axis);
8382
}
8483
this->output_shape = this->output->shape;

tools/sdk/esp32/include/esp-face/include/layer/dl_layer_flatten.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace dl
5959
this->output_shape = {input.get_size()};
6060
if (!this->inplace)
6161
{
62-
if (this->output != NULL)
62+
if (this->output == NULL)
6363
{
6464
this->output = new Tensor<feature_t>;
6565
}

tools/sdk/esp32/include/esp-face/include/layer/dl_layer_leakyrelu.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ namespace dl
1010
namespace layer
1111
{
1212
/**
13-
* @brief LeakyReLU(input).
13+
* @brief LeakyRelu(input).
1414
*
1515
* @tparam feature_t supports int16_t and int8_t,
1616
* - int16_t: stands for operation in int16_t quantize
1717
* - int8_t: stands for operation in int8_t quantize
1818
*/
1919
template <typename feature_t>
20-
class LeakyReLU : public Layer
20+
class LeakyRelu : public Layer
2121
{
2222
private:
2323
feature_t activation_alpha; /*<! quantized alpha >*/
@@ -28,26 +28,26 @@ namespace dl
2828
std::vector<int> output_shape; /*<! output shape of leakyrelu >*/
2929
public:
3030
/**
31-
* @brief Construct a new LeakyReLU object
31+
* @brief Construct a new LeakyRelu object
3232
*
3333
* @param activation_alpha quantized alpha
3434
* @param activation_exponent exponent of quantized alpha
3535
* @param name name of leakyrelu
3636
* @param inplace true: the output will store to input0
3737
* false: the output will store to a separate memory
3838
*/
39-
LeakyReLU(const int activation_alpha, const int activation_exponent, const char *name = "LeakyReLU", bool inplace = false) : Layer(name), output(NULL), output_shape({})
39+
LeakyRelu(const int activation_alpha, const int activation_exponent, const char *name = "LeakyRelu", bool inplace = false) : Layer(name), output(NULL), output_shape({})
4040
{
4141
this->activation_alpha = activation_alpha;
4242
this->activation_exponent = activation_exponent;
4343
this->inplace = inplace;
4444
}
4545

4646
/**
47-
* @brief Destroy the LeakyReLU object
47+
* @brief Destroy the LeakyRelu object
4848
*
4949
*/
50-
~LeakyReLU()
50+
~LeakyRelu()
5151
{
5252
if ((!this->inplace) && (this->output != NULL))
5353
{
@@ -66,7 +66,7 @@ namespace dl
6666
this->output_shape = input.shape;
6767
if (!this->inplace)
6868
{
69-
if (this->output != NULL)
69+
if (this->output == NULL)
7070
{
7171
this->output = new Tensor<feature_t>;
7272
}
@@ -90,19 +90,19 @@ namespace dl
9090
/**
9191
* @brief Get the output
9292
*
93-
* @return Tensor<feature_t>& LeakyReLU result
93+
* @return Tensor<feature_t>& LeakyRelu result
9494
*/
9595
Tensor<feature_t> &get_output()
9696
{
9797
return *this->output;
9898
}
9999

100100
/**
101-
* @brief Call LeakyReLU operation.
101+
* @brief Call LeakyRelu operation.
102102
*
103103
* @param input as an input
104104
* @param assign_core not effective yet
105-
* @return LeakyReLU result
105+
* @return LeakyRelu result
106106
*/
107107
Tensor<feature_t> &call(Tensor<feature_t> &input, const std::vector<int> &assign_core = CONFIG_DEFAULT_ASSIGN_CORE)
108108
{
@@ -130,7 +130,7 @@ namespace dl
130130
{
131131
this->output->set_shape(this->output_shape);
132132
}
133-
nn::leakyrelu<true>(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core);
133+
nn::leakyrelu(*this->output, input, this->activation_alpha, this->activation_exponent, assign_core);
134134
DL_LOG_LAYER_LATENCY_END(this->name, "leakyrelu");
135135
}
136136

tools/sdk/esp32/include/esp-face/include/layer/dl_layer_max2d.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace dl
6868

6969
if (!this->inplace)
7070
{
71-
if (this->output != NULL)
71+
if (this->output == NULL)
7272
{
7373
this->output = new Tensor<feature_t>;
7474
}
@@ -132,7 +132,7 @@ namespace dl
132132
{
133133
this->output->set_shape(this->output_shape);
134134
}
135-
nn::max2d<true>(*this->output, input0, input1, assign_core);
135+
nn::max2d(*this->output, input0, input1, assign_core);
136136
DL_LOG_LAYER_LATENCY_END(this->name, "max2d");
137137
}
138138

tools/sdk/esp32/include/esp-face/include/layer/dl_layer_min2d.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace dl
6868

6969
if (!this->inplace)
7070
{
71-
if (this->output != NULL)
71+
if (this->output == NULL)
7272
{
7373
this->output = new Tensor<feature_t>;
7474
}
@@ -132,7 +132,7 @@ namespace dl
132132
{
133133
this->output->set_shape(this->output_shape);
134134
}
135-
nn::min2d<true>(*this->output, input0, input1, assign_core);
135+
nn::min2d(*this->output, input0, input1, assign_core);
136136
DL_LOG_LAYER_LATENCY_END(this->name, "min2d");
137137
}
138138

tools/sdk/esp32/include/esp-face/include/layer/dl_layer_mul2d.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace dl
7575

7676
if (!this->inplace)
7777
{
78-
if (this->output != NULL)
78+
if (this->output == NULL)
7979
{
8080
this->output = new Tensor<feature_t>;
8181
}
@@ -140,7 +140,7 @@ namespace dl
140140
{
141141
this->output->set_shape(this->output_shape);
142142
}
143-
nn::mul2d<true>(*this->output, input0, input1, this->activation, assign_core);
143+
nn::mul2d(*this->output, input0, input1, this->activation, assign_core);
144144
DL_LOG_LAYER_LATENCY_END(this->name, "mul2d");
145145
}
146146

0 commit comments

Comments
 (0)