mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-03-22 09:36:32 +03:00
reset reason, uart adapt for C6
This commit is contained in:
@@ -34,25 +34,6 @@
|
|||||||
#include "../test/test.h"
|
#include "../test/test.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
|
|
||||||
#include "../esp32/rom/rtc.h"
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
|
||||||
#include "../esp32s2/rom/rtc.h"
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
|
||||||
#include "../esp32c3/rom/rtc.h"
|
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
|
||||||
#include "../esp32s3/rom/rtc.h"
|
|
||||||
#else
|
|
||||||
#error Target CONFIG_IDF_TARGET is not supported
|
|
||||||
#endif
|
|
||||||
#else // ESP32 Before IDF 4.0
|
|
||||||
#include "../rom/rtc.h"
|
|
||||||
#endif
|
|
||||||
#include <esp_mac.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_TLS_SUPPORT
|
#ifndef NO_TLS_SUPPORT
|
||||||
#define ENABLE_SMTP
|
#define ENABLE_SMTP
|
||||||
#define USE_ESP_SSLCLIENT
|
#define USE_ESP_SSLCLIENT
|
||||||
@@ -63,6 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
|
#include <esp_mac.h>
|
||||||
#include "esp_efuse.h"
|
#include "esp_efuse.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2642,7 +2624,7 @@ bool System::command_restart(const char * value, const int8_t id) {
|
|||||||
|
|
||||||
std::string System::reset_reason(uint8_t cpu) const {
|
std::string System::reset_reason(uint8_t cpu) const {
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
switch (rtc_get_reset_reason(cpu)) {
|
switch (esp_rom_get_reset_reason(cpu)) {
|
||||||
case 1:
|
case 1:
|
||||||
return ("Power on reset");
|
return ("Power on reset");
|
||||||
// case 2 :reset pin not on esp32
|
// case 2 :reset pin not on esp32
|
||||||
|
|||||||
@@ -68,6 +68,14 @@ void EMSuart::uart_event_task(void * pvParameters) {
|
|||||||
// initialize UART driver
|
// initialize UART driver
|
||||||
void EMSuart::start(const uint8_t tx_mode, const uint8_t rx_gpio, const uint8_t tx_gpio) {
|
void EMSuart::start(const uint8_t tx_mode, const uint8_t rx_gpio, const uint8_t tx_gpio) {
|
||||||
if (tx_mode_ == EMS_TXMODE_INIT) {
|
if (tx_mode_ == EMS_TXMODE_INIT) {
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32C6
|
||||||
|
uart_config_t uart_config = {.baud_rate = EMSUART_BAUD,
|
||||||
|
.data_bits = UART_DATA_8_BITS,
|
||||||
|
.parity = UART_PARITY_DISABLE,
|
||||||
|
.stop_bits = UART_STOP_BITS_1,
|
||||||
|
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||||
|
.rx_flow_ctrl_thresh = 0};
|
||||||
|
#else
|
||||||
uart_config_t uart_config = {.baud_rate = EMSUART_BAUD,
|
uart_config_t uart_config = {.baud_rate = EMSUART_BAUD,
|
||||||
.data_bits = UART_DATA_8_BITS,
|
.data_bits = UART_DATA_8_BITS,
|
||||||
.parity = UART_PARITY_DISABLE,
|
.parity = UART_PARITY_DISABLE,
|
||||||
@@ -76,6 +84,7 @@ void EMSuart::start(const uint8_t tx_mode, const uint8_t rx_gpio, const uint8_t
|
|||||||
.rx_flow_ctrl_thresh = 0,
|
.rx_flow_ctrl_thresh = 0,
|
||||||
.source_clk = UART_SCLK_APB,
|
.source_clk = UART_SCLK_APB,
|
||||||
.flags = {0}};
|
.flags = {0}};
|
||||||
|
#endif
|
||||||
#if defined(EMSUART_RX_INVERT)
|
#if defined(EMSUART_RX_INVERT)
|
||||||
inverse_mask |= UART_SIGNAL_RXD_INV;
|
inverse_mask |= UART_SIGNAL_RXD_INV;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user