mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 14:43:51 +00:00 
			
		
		
		
	Add gp8403 output component (#4495)
Co-authored-by: Samuel Sieb <samuel-github@sieb.net>
This commit is contained in:
		
							
								
								
									
										21
									
								
								esphome/components/gp8403/gp8403.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								esphome/components/gp8403/gp8403.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| #include "gp8403.h" | ||||
|  | ||||
| #include "esphome/core/log.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace gp8403 { | ||||
|  | ||||
| static const char *const TAG = "gp8403"; | ||||
|  | ||||
| static const uint8_t RANGE_REGISTER = 0x01; | ||||
|  | ||||
| void GP8403::setup() { this->write_register(RANGE_REGISTER, (uint8_t *) (&this->voltage_), 1); } | ||||
|  | ||||
| void GP8403::dump_config() { | ||||
|   ESP_LOGCONFIG(TAG, "GP8403:"); | ||||
|   ESP_LOGCONFIG(TAG, "  Voltage: %dV", this->voltage_ == GP8403_VOLTAGE_5V ? 5 : 10); | ||||
|   LOG_I2C_DEVICE(this); | ||||
| } | ||||
|  | ||||
| }  // namespace gp8403 | ||||
| }  // namespace esphome | ||||
		Reference in New Issue
	
	Block a user