mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Add the WeiKai SPI/I2C UART/IO Expander components to esphome (#5218)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							f9ce35c894
						
					
				
				
					commit
					f8cdb087fc
				
			
							
								
								
									
										30
									
								
								esphome/components/wk2204_spi/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								esphome/components/wk2204_spi/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| import esphome.codegen as cg | ||||
| import esphome.config_validation as cv | ||||
| from esphome.components import spi, weikai | ||||
| from esphome.const import CONF_ID | ||||
|  | ||||
| CODEOWNERS = ["@DrCoolZic"] | ||||
| DEPENDENCIES = ["spi"] | ||||
| AUTO_LOAD = ["weikai", "weikai_spi"] | ||||
| MULTI_CONF = True | ||||
|  | ||||
| weikai_spi_ns = cg.esphome_ns.namespace("weikai_spi") | ||||
| WeikaiComponentSPI = weikai_spi_ns.class_( | ||||
|     "WeikaiComponentSPI", weikai.WeikaiComponent, spi.SPIDevice | ||||
| ) | ||||
|  | ||||
| CONFIG_SCHEMA = cv.All( | ||||
|     weikai.WKBASE_SCHEMA.extend( | ||||
|         { | ||||
|             cv.GenerateID(): cv.declare_id(WeikaiComponentSPI), | ||||
|         } | ||||
|     ).extend(spi.spi_device_schema()), | ||||
|     weikai.check_channel_max_4, | ||||
| ) | ||||
|  | ||||
|  | ||||
| async def to_code(config): | ||||
|     var = cg.new_Pvariable(config[CONF_ID]) | ||||
|     cg.add(var.set_name(str(config[CONF_ID]))) | ||||
|     await weikai.register_weikai(var, config) | ||||
|     await spi.register_spi_device(var, config) | ||||
		Reference in New Issue
	
	Block a user