Esp32 c3 support (#2035)

This commit is contained in:
Stefan Agner 2021-07-20 11:12:22 +02:00 committed by GitHub
parent 01a4b4e82f
commit 9f2b2f51ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View file

@ -9,7 +9,6 @@
#include "util.h"
#include "list_entities.h"
#include "subscribe_state.h"
#include "homeassistant_service.h"
#include "user_services.h"
#ifdef ARDUINO_ARCH_ESP32

View file

@ -15,7 +15,7 @@ template<> std::string get_execute_arg_value<std::string>(const ExecuteServiceAr
template<> std::vector<bool> get_execute_arg_value<std::vector<bool>>(const ExecuteServiceArgument &arg) {
return arg.bool_array;
}
template<> std::vector<int> get_execute_arg_value<std::vector<int>>(const ExecuteServiceArgument &arg) {
template<> std::vector<int32_t> get_execute_arg_value<std::vector<int32_t>>(const ExecuteServiceArgument &arg) {
return arg.int_array;
}
template<> std::vector<float> get_execute_arg_value<std::vector<float>>(const ExecuteServiceArgument &arg) {

View file

@ -27,11 +27,16 @@ GPIOPin::GPIOPin(uint8_t pin, uint8_t mode, bool inverted)
#ifdef ARDUINO_ARCH_ESP8266
gpio_read_(pin < 16 ? &GPI : &GP16I),
gpio_mask_(pin < 16 ? (1UL << pin) : 1)
#endif
#ifdef ARDUINO_ARCH_ESP32
gpio_set_(pin < 32 ? &GPIO.out_w1ts : &GPIO.out1_w1ts.val),
#elif ARDUINO_ARCH_ESP32
#ifdef CONFIG_IDF_TARGET_ESP32C3
gpio_set_(&GPIO.out_w1ts.val),
gpio_clear_(&GPIO.out_w1tc.val),
gpio_read_(&GPIO.in.val),
#else
gpio_set_(pin < 32 ? &GPIO.out_w1ts : &GPIO.out1_w1ts.val),
gpio_clear_(pin < 32 ? &GPIO.out_w1tc : &GPIO.out1_w1tc.val),
gpio_read_(pin < 32 ? &GPIO.in : &GPIO.in1.val),
#endif
gpio_mask_(pin < 32 ? (1UL << pin) : (1UL << (pin - 32)))
#endif
{
@ -194,12 +199,16 @@ void ICACHE_RAM_ATTR ISRInternalGPIOPin::clear_interrupt() {
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, this->gpio_mask_);
#endif
#ifdef ARDUINO_ARCH_ESP32
#ifdef CONFIG_IDF_TARGET_ESP32C3
GPIO.status_w1tc.val = this->gpio_mask_;
#else
if (this->pin_ < 32) {
GPIO.status_w1tc = this->gpio_mask_;
} else {
GPIO.status1_w1tc.intr_st = this->gpio_mask_;
}
#endif
#endif
}
void ICACHE_RAM_ATTR HOT GPIOPin::pin_mode(uint8_t mode) {