mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Esp32 c3 support (#2035)
This commit is contained in:
		| @@ -9,7 +9,6 @@ | |||||||
| #include "util.h" | #include "util.h" | ||||||
| #include "list_entities.h" | #include "list_entities.h" | ||||||
| #include "subscribe_state.h" | #include "subscribe_state.h" | ||||||
| #include "homeassistant_service.h" |  | ||||||
| #include "user_services.h" | #include "user_services.h" | ||||||
|  |  | ||||||
| #ifdef ARDUINO_ARCH_ESP32 | #ifdef ARDUINO_ARCH_ESP32 | ||||||
|   | |||||||
| @@ -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) { | template<> std::vector<bool> get_execute_arg_value<std::vector<bool>>(const ExecuteServiceArgument &arg) { | ||||||
|   return arg.bool_array; |   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; |   return arg.int_array; | ||||||
| } | } | ||||||
| template<> std::vector<float> get_execute_arg_value<std::vector<float>>(const ExecuteServiceArgument &arg) { | template<> std::vector<float> get_execute_arg_value<std::vector<float>>(const ExecuteServiceArgument &arg) { | ||||||
|   | |||||||
| @@ -27,11 +27,16 @@ GPIOPin::GPIOPin(uint8_t pin, uint8_t mode, bool inverted) | |||||||
| #ifdef ARDUINO_ARCH_ESP8266 | #ifdef ARDUINO_ARCH_ESP8266 | ||||||
|       gpio_read_(pin < 16 ? &GPI : &GP16I), |       gpio_read_(pin < 16 ? &GPI : &GP16I), | ||||||
|       gpio_mask_(pin < 16 ? (1UL << pin) : 1) |       gpio_mask_(pin < 16 ? (1UL << pin) : 1) | ||||||
| #endif | #elif ARDUINO_ARCH_ESP32 | ||||||
| #ifdef 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_set_(pin < 32 ? &GPIO.out_w1ts : &GPIO.out1_w1ts.val), | ||||||
|       gpio_clear_(pin < 32 ? &GPIO.out_w1tc : &GPIO.out1_w1tc.val), |       gpio_clear_(pin < 32 ? &GPIO.out_w1tc : &GPIO.out1_w1tc.val), | ||||||
|       gpio_read_(pin < 32 ? &GPIO.in : &GPIO.in1.val), |       gpio_read_(pin < 32 ? &GPIO.in : &GPIO.in1.val), | ||||||
|  | #endif | ||||||
|       gpio_mask_(pin < 32 ? (1UL << pin) : (1UL << (pin - 32))) |       gpio_mask_(pin < 32 ? (1UL << pin) : (1UL << (pin - 32))) | ||||||
| #endif | #endif | ||||||
| { | { | ||||||
| @@ -194,12 +199,16 @@ void ICACHE_RAM_ATTR ISRInternalGPIOPin::clear_interrupt() { | |||||||
|   GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, this->gpio_mask_); |   GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, this->gpio_mask_); | ||||||
| #endif | #endif | ||||||
| #ifdef ARDUINO_ARCH_ESP32 | #ifdef ARDUINO_ARCH_ESP32 | ||||||
|  | #ifdef CONFIG_IDF_TARGET_ESP32C3 | ||||||
|  |   GPIO.status_w1tc.val = this->gpio_mask_; | ||||||
|  | #else | ||||||
|   if (this->pin_ < 32) { |   if (this->pin_ < 32) { | ||||||
|     GPIO.status_w1tc = this->gpio_mask_; |     GPIO.status_w1tc = this->gpio_mask_; | ||||||
|   } else { |   } else { | ||||||
|     GPIO.status1_w1tc.intr_st = this->gpio_mask_; |     GPIO.status1_w1tc.intr_st = this->gpio_mask_; | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| void ICACHE_RAM_ATTR HOT GPIOPin::pin_mode(uint8_t mode) { | void ICACHE_RAM_ATTR HOT GPIOPin::pin_mode(uint8_t mode) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user