Skip to content

Commit 3e49b80

Browse files
authored
Merge branch 'master' into patch-1
2 parents 4ebd82c + 698b78a commit 3e49b80

File tree

11 files changed

+232
-46
lines changed

11 files changed

+232
-46
lines changed

boards.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9996,7 +9996,7 @@ firebeetle32.build.target=esp32
99969996
firebeetle32.build.mcu=esp32
99979997
firebeetle32.build.core=esp32
99989998
firebeetle32.build.variant=firebeetle32
9999-
firebeetle32.build.board=ESP32_DEV
9999+
firebeetle32.build.board=DFROBOT_FIREBEETLE_ESP32
1000010000

1000110001
firebeetle32.build.f_cpu=240000000L
1000210002
firebeetle32.build.flash_mode=dio
@@ -21180,15 +21180,12 @@ heltec_wireless_stick.build.bootloader_addr=0x1000
2118021180
heltec_wireless_stick.build.target=esp32
2118121181
heltec_wireless_stick.build.mcu=esp32
2118221182
heltec_wireless_stick.build.core=esp32
21183-
heltec_wireless_stick.build.variant=heltec_wireless_stick
2118421183
heltec_wireless_stick.build.board=HELTEC_WIRELESS_STICK
2118521184

2118621185
heltec_wireless_stick.build.f_cpu=240000000L
21187-
heltec_wireless_stick.build.flash_size=8MB
2118821186
heltec_wireless_stick.build.flash_freq=80m
2118921187
heltec_wireless_stick.build.flash_mode=dio
2119021188
heltec_wireless_stick.build.boot=dio
21191-
heltec_wireless_stick.build.partitions=default_8MB
2119221189
heltec_wireless_stick.build.defines=-D{build.band} -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} {build.psram}
2119321190

2119421191
heltec_wireless_stick.menu.PSRAM.disabled=Disabled
@@ -21268,6 +21265,24 @@ heltec_wireless_stick.menu.EraseFlash.none.upload.erase_cmd=
2126821265
heltec_wireless_stick.menu.EraseFlash.all=Enabled
2126921266
heltec_wireless_stick.menu.EraseFlash.all.upload.erase_cmd=-e
2127021267

21268+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1=Heltec Wireless Stick V1 (SX1276)
21269+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.board=HELTEC_WIRELESS_STICK_V1
21270+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.variant=heltec_wireless_stick_V1
21271+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.flash_size=4MB
21272+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.partitions=default
21273+
21274+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2=Heltec Wireless Stick V2 (SX1276)
21275+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.board=HELTEC_WIRELESS_STICK_V2
21276+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.variant=heltec_wireless_stick
21277+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.flash_size=8MB
21278+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.partitions=default_8MB
21279+
21280+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3=Heltec Wireless Stick V3 (SX1262)
21281+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.board=HELTEC_WIRELESS_STICK_V3
21282+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.variant=heltec_wireless_stick
21283+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.flash_size=8MB
21284+
heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.partitions=default_8MB
21285+
2127121286
##############################################################
2127221287

2127321288
heltec_wireless_stick_lite.name=Heltec Wireless Stick Lite

cores/esp32/esp32-hal-rmt.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct rmt_obj_s {
6161
bool rmt_ch_is_looping; // Is this RMT TX Channel in LOOPING MODE?
6262
size_t *num_symbols_read; // Pointer to the number of RMT symbol read by IDF RMT RX Done
6363
uint32_t frequency_Hz; // RMT Frequency
64+
uint8_t rmt_EOT_Level; // RMT End of Transmission Level - default is LOW
6465

6566
#if !CONFIG_DISABLE_HAL_LOCKS
6667
SemaphoreHandle_t g_rmt_objlocks; // Channel Semaphore Lock
@@ -185,6 +186,20 @@ static bool _rmtDetachBus(void *busptr)
185186
Public method definitions
186187
*/
187188

189+
bool rmtSetEOT(int pin, uint8_t EOT_Level)
190+
{
191+
rmt_bus_handle_t bus = _rmtGetBus(pin, __FUNCTION__);
192+
if (bus == NULL) {
193+
return false;
194+
}
195+
if (!_rmtCheckDirection(pin, RMT_TX_MODE, __FUNCTION__)) {
196+
return false;
197+
}
198+
199+
bus->rmt_EOT_Level = EOT_Level > 0 ? 1 : 0;
200+
return true;
201+
}
202+
188203
bool rmtSetCarrier(int pin, bool carrier_en, bool carrier_level, uint32_t frequency_Hz, float duty_percent)
189204
{
190205
rmt_bus_handle_t bus = _rmtGetBus(pin, __FUNCTION__);
@@ -316,6 +331,10 @@ static bool _rmtWrite(int pin, rmt_data_t* data, size_t num_rmt_symbols, bool bl
316331
rmt_enable(bus->rmt_channel_h);
317332
bus->rmt_ch_is_looping = false; // not looping anymore
318333
}
334+
// sets the End of Transmission level to HIGH if the user has requested so
335+
if (bus->rmt_EOT_Level) {
336+
transmit_cfg.flags.eot_level = 1; // EOT is HIGH
337+
}
319338
if (loopCancel) {
320339
// just resets and releases the channel, maybe, already done above, then exits
321340
bus->rmt_ch_is_looping = false;
@@ -487,7 +506,7 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_
487506
// store the RMT Freq to check Filter and Idle valid values in the RMT API
488507
bus->frequency_Hz = frequency_Hz;
489508
// pulses with width smaller than min_ns will be ignored (as a glitch)
490-
bus->signal_range_min_ns = 0; // disabled
509+
//bus->signal_range_min_ns = 0; // disabled --> not necessary CALLOC set all to ZERO.
491510
// RMT stops reading if the input stays idle for longer than max_ns
492511
bus->signal_range_max_ns = (1000000000 / frequency_Hz) * RMT_LL_MAX_IDLE_VALUE; // maximum possible
493512
// creates the event group to control read_done and write_done

cores/esp32/esp32-hal-rmt.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ typedef union {
7676
*/
7777
bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t memsize, uint32_t frequency_Hz);
7878

79+
/**
80+
Sets the End of Transmission level to be set for the <pin> when the RMT transmission ends.
81+
This function affects how rmtWrite(), rmtWriteAsync() or rmtWriteLooping() will set the pin after writing the data.
82+
The default EOT level is LOW, in case this function isn't used before RMT Writing.
83+
This level can be set for each RMT pin and can be changed between writings to the same pin.
84+
85+
<EOT_Level> shall be Zero (LOW) or non-zero (HIGH) value.
86+
It only affects the transmission process, therefore, it doesn't affect any IDLE LEVEL before starting the RMT transmission.
87+
The pre-transmission idle level can be set manually calling, for instance, digitalWrite(pin, Level).
88+
89+
Returns <true> when EOT has been correctly set for <pin>, <false> otherwise.
90+
*/
91+
bool rmtSetEOT(int pin, uint8_t EOT_Level);
92+
7993
/**
8094
Sending data in Blocking Mode.
8195
<rmt_symbol> is a 32 bits structure as defined by rmt_data_t type.

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static TaskHandle_t _spp_task_handle = NULL;
5555
static EventGroupHandle_t _spp_event_group = NULL;
5656
static EventGroupHandle_t _bt_event_group = NULL;
5757
static boolean secondConnectionAttempt;
58-
static esp_spp_cb_t * custom_spp_callback = NULL;
58+
static esp_spp_cb_t custom_spp_callback = NULL;
5959
static BluetoothSerialDataCb custom_data_callback = NULL;
6060
static esp_bd_addr_t current_bd_addr;
6161
static ConfirmRequestCb confirm_request_callback = NULL;
@@ -945,7 +945,7 @@ void BluetoothSerial::confirmReply(boolean confirm)
945945
}
946946

947947

948-
esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t * callback)
948+
esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback)
949949
{
950950
custom_spp_callback = callback;
951951
return ESP_OK;

libraries/BluetoothSerial/src/BluetoothSerial.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "BTScan.h"
2929
#include "BTAdvertisedDevice.h"
3030

31-
3231
typedef std::function<void(const uint8_t *buffer, size_t size)> BluetoothSerialDataCb;
3332
typedef std::function<void(uint32_t num_val)> ConfirmRequestCb;
3433
typedef std::function<void()> KeyRequestCb;
@@ -57,7 +56,7 @@ class BluetoothSerial: public Stream
5756
void memrelease();
5857
void setTimeout(int timeoutMS);
5958
void onData(BluetoothSerialDataCb cb);
60-
esp_err_t register_callback(esp_spp_cb_t * callback);
59+
esp_err_t register_callback(esp_spp_cb_t callback);
6160

6261
#ifdef CONFIG_BT_SSP_ENABLED
6362
void onConfirmRequest(ConfirmRequestCb cb);
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#define BLINK_GPIO 2
2+
#define EOT_INITIAL_STATE_TIME_MS 1000
3+
4+
// BLINK_GPIO shall start at RMT_EOT (HIGH or LOW) as initial state for EOT_INITIAL_STATE_TIME_MS,
5+
// BLINK: 1 second ON, 1 second OFF and then return/stay to RMT_EOT level at the end.
6+
#define RMT_EOT HIGH
7+
8+
// RMT is at 400KHz with a 2.5us tick
9+
// This RMT data sends a 0.5Hz pulse with 1s High and 1s Low signal
10+
rmt_data_t blink_1s_rmt_data[] = {
11+
// 400,000 x 2.5us = 1 second ON
12+
{25000, 1, 25000, 1,},
13+
{25000, 1, 25000, 1,},
14+
{25000, 1, 25000, 1,},
15+
{25000, 1, 25000, 1,},
16+
{25000, 1, 25000, 1,},
17+
{25000, 1, 25000, 1,},
18+
{25000, 1, 25000, 1,},
19+
{25000, 1, 25000, 1,},
20+
// 400,000 x 2.5us = 1 second OFF
21+
{25000, 0, 25000, 0,},
22+
{25000, 0, 25000, 0,},
23+
{25000, 0, 25000, 0,},
24+
{25000, 0, 25000, 0,},
25+
{25000, 0, 25000, 0,},
26+
{25000, 0, 25000, 0,},
27+
{25000, 0, 25000, 0,},
28+
{25000, 0, 25000, 0,},
29+
// Looping mode needs a Zero ending data to mark the EOF
30+
{0, 0, 0, 0}
31+
};
32+
33+
void setup() {
34+
Serial.begin(115200);
35+
Serial.println("Starting Blink testing...");
36+
Serial.flush();
37+
38+
// 1 RMT Block has 64 RMT_SYMBOLS (ESP32|ESP32S2) or 48 RMT_SYMBOLS (ESP32C3|ESP32S3)
39+
if (!rmtInit(BLINK_GPIO, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 400000)) { //2.5us tick
40+
Serial.println("===> rmtInit Error!");
41+
}
42+
43+
// sets the End of Transmission Level to HIGH, after writing to the pin. DEFAULT is LOW.
44+
rmtSetEOT(BLINK_GPIO, RMT_EOT);
45+
// set initial RMT state by writing a single RMT data
46+
rmt_data_t initStateSetup_rmt_data[] = { {1, RMT_EOT, 0, 0} };
47+
rmtWrite(BLINK_GPIO, initStateSetup_rmt_data, RMT_SYMBOLS_OF(initStateSetup_rmt_data), RMT_WAIT_FOR_EVER);
48+
Serial.printf("\nLED GPIO%d start in the inital level %s\n", BLINK_GPIO, RMT_EOT == LOW ? "LOW" : "HIGH");
49+
delay(EOT_INITIAL_STATE_TIME_MS); // set initial state of the LED is set by RMT_EOT.
50+
51+
// Send the data and wait until it is done - set EOT level to HIGH
52+
Serial.printf("\nLED GPIO%d Blinks 1 second HIGH - 1 second LOW.\n", BLINK_GPIO);
53+
if (!rmtWrite(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 2, RMT_WAIT_FOR_EVER)) {
54+
Serial.println("===> rmtWrite Blink 1s Error!");
55+
}
56+
Serial.printf("\nLED GPIO%d goes to the EOT level %s\n", BLINK_GPIO, RMT_EOT == LOW ? "LOW" : "HIGH");
57+
}
58+
59+
void loop(){}

libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
// Important to be defined BEFORE including ETH.h for ETH.begin() to work.
77
// Example RMII LAN8720 (Olimex, etc.)
8+
#ifndef ETH_PHY_TYPE
89
#define ETH_PHY_TYPE ETH_PHY_LAN8720
910
#define ETH_PHY_ADDR 0
1011
#define ETH_PHY_MDC 23
1112
#define ETH_PHY_MDIO 18
1213
#define ETH_PHY_POWER -1
1314
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
15+
#endif
1416

1517
#include <ETH.h>
1618

libraries/Ethernet/examples/ETH_TLK110/ETH_TLK110.ino

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
#include <ETH.h>
77

8-
#define ETH_TYPE ETH_PHY_TLK110
9-
#define ETH_ADDR 31
10-
#define ETH_MDC_PIN 23
11-
#define ETH_MDIO_PIN 18
12-
#define ETH_POWER_PIN 17
8+
#ifndef ETH_PHY_TYPE
9+
#define ETH_PHY_TYPE ETH_PHY_TLK110
10+
#define ETH_PHY_ADDR 31
11+
#define ETH_PHY_MDC 23
12+
#define ETH_PHY_MDIO 18
13+
#define ETH_PHY_POWER 17
1314
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
15+
#endif
1416

1517
static bool eth_connected = false;
1618

@@ -73,7 +75,7 @@ void setup()
7375
{
7476
Serial.begin(115200);
7577
WiFi.onEvent(WiFiEvent); // Will call WiFiEvent() from another thread.
76-
ETH.begin(ETH_TYPE, ETH_ADDR, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_POWER_PIN, ETH_CLK_MODE);
78+
ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_POWER, ETH_CLK_MODE);
7779
}
7880

7981

libraries/Ethernet/examples/ETH_W5500_Arduino_SPI/ETH_W5500_Arduino_SPI.ino

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,28 @@
99
// Set this to 1 to enable dual Ethernet support
1010
#define USE_TWO_ETH_PORTS 0
1111

12-
#define ETH_TYPE ETH_PHY_W5500
13-
#define ETH_ADDR 1
14-
#define ETH_CS 15
15-
#define ETH_IRQ 4
16-
#define ETH_RST 5
12+
#ifndef ETH_PHY_TYPE
13+
#define ETH_PHY_TYPE ETH_PHY_W5500
14+
#define ETH_PHY_ADDR 1
15+
#define ETH_PHY_CS 15
16+
#define ETH_PHY_IRQ 4
17+
#define ETH_PHY_RST 5
18+
#endif
1719

1820
// SPI pins
19-
#define ETH_SPI_SCK 14
20-
#define ETH_SPI_MISO 12
21-
#define ETH_SPI_MOSI 13
21+
#define ETH_SPI_SCK 14
22+
#define ETH_SPI_MISO 12
23+
#define ETH_SPI_MOSI 13
2224

2325
#if USE_TWO_ETH_PORTS
2426
// Second port on shared SPI bus
25-
#define ETH1_TYPE ETH_PHY_W5500
26-
#define ETH1_ADDR 1
27-
#define ETH1_CS 32
28-
#define ETH1_IRQ 33
29-
#define ETH1_RST 18
27+
#ifndef ETH1_PHY_TYPE
28+
#define ETH1_PHY_TYPE ETH_PHY_W5500
29+
#define ETH1_PHY_ADDR 1
30+
#define ETH1_PHY_CS 32
31+
#define ETH1_PHY_IRQ 33
32+
#define ETH1_PHY_RST 18
33+
#endif
3034
ETHClass ETH1(1);
3135
#endif
3236

@@ -94,9 +98,9 @@ void setup()
9498
WiFi.onEvent(onEvent);
9599

96100
SPI.begin(ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI);
97-
ETH.begin(ETH_TYPE, ETH_ADDR, ETH_CS, ETH_IRQ, ETH_RST, SPI);
101+
ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI);
98102
#if USE_TWO_ETH_PORTS
99-
ETH1.begin(ETH1_TYPE, ETH1_ADDR, ETH1_CS, ETH1_IRQ, ETH1_RST, SPI);
103+
ETH1.begin(ETH1_PHY_TYPE, ETH1_PHY_ADDR, ETH1_PHY_CS, ETH1_PHY_IRQ, ETH1_PHY_RST, SPI);
100104
#endif
101105
}
102106

libraries/Ethernet/examples/ETH_W5500_IDF_SPI/ETH_W5500_IDF_SPI.ino

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,27 @@
88
// Set this to 1 to enable dual Ethernet support
99
#define USE_TWO_ETH_PORTS 0
1010

11-
#define ETH_TYPE ETH_PHY_W5500
12-
#define ETH_ADDR 1
13-
#define ETH_CS 15
14-
#define ETH_IRQ 4
15-
#define ETH_RST 5
16-
#define ETH_SPI_HOST SPI2_HOST
17-
#define ETH_SPI_SCK 14
18-
#define ETH_SPI_MISO 12
19-
#define ETH_SPI_MOSI 13
11+
#ifndef ETH_PHY_TYPE
12+
#define ETH_PHY_TYPE ETH_PHY_W5500
13+
#define ETH_PHY_ADDR 1
14+
#define ETH_PHY_CS 15
15+
#define ETH_PHY_IRQ 4
16+
#define ETH_PHY_RST 5
17+
#define ETH_PHY_SPI_HOST SPI2_HOST
18+
#define ETH_PHY_SPI_SCK 14
19+
#define ETH_PHY_SPI_MISO 12
20+
#define ETH_PHY_SPI_MOSI 13
21+
#endif
2022

2123
#if USE_TWO_ETH_PORTS
2224
// Second port on shared SPI bus
23-
#define ETH1_TYPE ETH_PHY_W5500
24-
#define ETH1_ADDR 1
25-
#define ETH1_CS 32
26-
#define ETH1_IRQ 33
27-
#define ETH1_RST 18
25+
#ifndef ETH1_PHY_TYPE
26+
#define ETH1_PHY_TYPE ETH_PHY_W5500
27+
#define ETH1_PHY_ADDR 1
28+
#define ETH1_PHY_CS 32
29+
#define ETH1_PHY_IRQ 33
30+
#define ETH1_PHY_RST 18
31+
#endif
2832
ETHClass ETH1(1);
2933
#endif
3034

@@ -90,10 +94,10 @@ void setup()
9094
{
9195
Serial.begin(115200);
9296
WiFi.onEvent(onEvent);
93-
ETH.begin(ETH_TYPE, ETH_ADDR, ETH_CS, ETH_IRQ, ETH_RST, ETH_SPI_HOST, ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI);
97+
ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, ETH_PHY_SPI_HOST, ETH_PHY_SPI_SCK, ETH_PHY_SPI_MISO, ETH_PHY_SPI_MOSI);
9498
#if USE_TWO_ETH_PORTS
9599
// Since SPI bus is shared, we should skip the SPI pins when calling ETH1.begin()
96-
ETH1.begin(ETH1_TYPE, ETH1_ADDR, ETH1_CS, ETH1_IRQ, ETH1_RST, ETH_SPI_HOST);
100+
ETH1.begin(ETH1_PHY_TYPE, ETH1_PHY_ADDR, ETH1_PHY_CS, ETH1_PHY_IRQ, ETH1_PHY_RST, ETH_PHY_SPI_HOST);
97101
#endif
98102
}
99103

0 commit comments

Comments
 (0)