8000 initial ESP32-C2 support by Jason2866 · Pull Request #226 · tasmota/arduino-esp32 · GitHub
[go: up one dir, main page]

Skip to content

initial ESP32-C2 support #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 23, 2023
Merged
Prev Previous commit
c2 fixes
  • Loading branch information
Jason2866 committed Jul 23, 2023
commit 6b5a734d039124946f3e4d7f9d7044eaa38f6789
4 changes: 3 additions & 1 deletion cores/esp32/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void serialEvent(void) {}
#define RX1 9
#elif CONFIG_IDF_TARGET_ESP32S2
#define RX1 18
#elif CONFIG_IDF_TARGET_ESP32C2
#define RX1 9
#elif CONFIG_IDF_TARGET_ESP32C3
#define RX1 18
#elif CONFIG_IDF_TARGET_ESP32S3
Expand All @@ -80,7 +82,7 @@ void serialEvent(void) {}
#elif CONFIG_IDF_TARGET_ESP32S2
#define TX1 17
#elif CONFIG_IDF_TARGET_ESP32C2
#define TX1 18
#define TX1 10
#elif CONFIG_IDF_TARGET_ESP32C3
#define TX1 19
#elif CONFIG_IDF_TARGET_ESP32S3
Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#endif //CONFIG_BT_ENABLED
#include <sys/time.h>
#include "soc/rtc.h"
#if !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
#include "soc/rtc_cntl_reg.h"
#include "soc/apb_ctrl_reg.h"
#endif
Expand All @@ -45,7 +45,7 @@
#include "esp32s2/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#elif CONFIG_IDF_TARGET_ESP32C2
#include "esp32c2/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/rtc.h"
Expand Down
5 changes: 5 additions & 0 deletions cores/esp32/esp32-hal-rgb-led.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "soc/soc_caps.h"
#if SOC_RMT_SUPPORTED

#include "esp32-hal-rgb-led.h"


Expand Down Expand Up @@ -42,3 +45,5 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue
}
rmtWrite(_pin, led_data, RMT_SYMBOLS_OF(led_data), RMT_WAIT_FOR_EVER);
}

#endif /* SOC_RMT_SUPPORTED */
4 changes: 2 additions & 2 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ void uartStartDetectBaudrate(uart_t *uart) {
return;
}

#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2

// ESP32-C3 requires further testing
// Baud rate detection returns wrong values
Expand Down Expand Up @@ -849,7 +849,7 @@ uartDetectBaudrate(uart_t *uart)

return default_rates[i];
#else
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
log_e("ESP32-C3 baud rate detection is not supported.");
#else
log_e("ESP32-S3 baud rate detection is not supported.");
Expand Down
6 changes: 5 additions & 1 deletion libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ TwoWire::TwoWire(uint8_t bus_num)
,nonStopTask(NULL)
,lock(NULL)
#endif
#if SOC_I2C_SUPPORT_SLAVE
,is_slave(false)
,user_onRequest(NULL)
,user_onReceive(NULL)
#endif
{}

TwoWire::~TwoWire()
Expand Down Expand Up @@ -338,10 +340,12 @@ bool TwoWire::end()
}
#endif
if(is_slave){
#if SOC_I2C_SUPPORT_SLAVE
err = i2cSlaveDeinit(num);
if(err == ESP_OK){
is_slave = false;
}
#endif
} else if(i2cIsInit(num)){
err = i2cDeinit(num);
}
Expand Down Expand Up @@ -704,4 +708,4 @@ void TwoWire::onRequest( void (*function)(void) )
TwoWire Wire = TwoWire(0);
TwoWire Wire1 = TwoWire(1);

#endif /* SOC_I2C_SUPPORTED */
#endif /* SOC_I2C_SUPPORTED */
11 changes: 5 additions & 6 deletions variants/esp32c2/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ static const uint8_t MOSI = 7;
static const uint8_t MISO = 5;
static const uint8_t SCK = 6;

static const uint8_t A0 = 0;
static const uint8_t A1 = 1;
static const uint8_t A2 = 2;
static const uint8_t A3 = 3;
static const uint8_t A4 = 4;
static const uint8_t A5 = 5;
static const uint8_t A0 = 1;
static const uint8_t A1 = 2;
static const uint8_t A2 = 3;
static const uint8_t A3 = 4;
static const uint8_t A4 = 5;

#endif /* Pins_Arduino_h */
0