mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Some max7219 updates. (#1021)
* Some max7219 updates. Disable test mode on startup and allow dynamic brightness * fix formatting
This commit is contained in:
		| @@ -12,6 +12,7 @@ static const uint8_t MAX7219_REGISTER_DECODE_MODE = 0x09; | |||||||
| static const uint8_t MAX7219_REGISTER_INTENSITY = 0x0A; | static const uint8_t MAX7219_REGISTER_INTENSITY = 0x0A; | ||||||
| static const uint8_t MAX7219_REGISTER_SCAN_LIMIT = 0x0B; | static const uint8_t MAX7219_REGISTER_SCAN_LIMIT = 0x0B; | ||||||
| static const uint8_t MAX7219_REGISTER_SHUTDOWN = 0x0C; | static const uint8_t MAX7219_REGISTER_SHUTDOWN = 0x0C; | ||||||
|  | static const uint8_t MAX7219_REGISTER_TEST = 0x0F; | ||||||
| static const uint8_t MAX7219_UNKNOWN_CHAR = 0b11111111; | static const uint8_t MAX7219_UNKNOWN_CHAR = 0b11111111; | ||||||
|  |  | ||||||
| const uint8_t MAX7219_ASCII_TO_RAW[95] PROGMEM = { | const uint8_t MAX7219_ASCII_TO_RAW[95] PROGMEM = { | ||||||
| @@ -127,6 +128,7 @@ void MAX7219Component::setup() { | |||||||
|   this->send_to_all_(MAX7219_REGISTER_INTENSITY, this->intensity_); |   this->send_to_all_(MAX7219_REGISTER_INTENSITY, this->intensity_); | ||||||
|   this->display(); |   this->display(); | ||||||
|   // power up |   // power up | ||||||
|  |   this->send_to_all_(MAX7219_REGISTER_TEST, 0); | ||||||
|   this->send_to_all_(MAX7219_REGISTER_SHUTDOWN, 1); |   this->send_to_all_(MAX7219_REGISTER_SHUTDOWN, 1); | ||||||
| } | } | ||||||
| void MAX7219Component::dump_config() { | void MAX7219Component::dump_config() { | ||||||
| @@ -210,7 +212,10 @@ uint8_t MAX7219Component::printf(const char *format, ...) { | |||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
| void MAX7219Component::set_writer(max7219_writer_t &&writer) { this->writer_ = writer; } | void MAX7219Component::set_writer(max7219_writer_t &&writer) { this->writer_ = writer; } | ||||||
| void MAX7219Component::set_intensity(uint8_t intensity) { this->intensity_ = intensity; } | void MAX7219Component::set_intensity(uint8_t intensity) { | ||||||
|  |   this->intensity_ = intensity; | ||||||
|  |   this->send_to_all_(MAX7219_REGISTER_INTENSITY, this->intensity_); | ||||||
|  | } | ||||||
| void MAX7219Component::set_num_chips(uint8_t num_chips) { this->num_chips_ = num_chips; } | void MAX7219Component::set_num_chips(uint8_t num_chips) { this->num_chips_ = num_chips; } | ||||||
|  |  | ||||||
| #ifdef USE_TIME | #ifdef USE_TIME | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user