8 namespace max7219digit {
10 static const char *
const TAG =
"max7219DIGIT";
12 static const uint8_t MAX7219_REGISTER_NOOP = 0x00;
13 static const uint8_t MAX7219_REGISTER_DECODE_MODE = 0x09;
14 static const uint8_t MAX7219_REGISTER_INTENSITY = 0x0A;
15 static const uint8_t MAX7219_REGISTER_SCAN_LIMIT = 0x0B;
16 static const uint8_t MAX7219_REGISTER_SHUTDOWN = 0x0C;
17 static const uint8_t MAX7219_REGISTER_DISPLAY_TEST = 0x0F;
26 ESP_LOGCONFIG(TAG,
"Setting up MAX7219_DIGITS...");
29 for (
int chip_line = 0; chip_line < this->
num_chip_lines_; chip_line++) {
30 std::vector<uint8_t> vec(1);
40 this->
send_to_all_(MAX7219_REGISTER_DISPLAY_TEST, MAX7219_NO_DISPLAY_TEST);
50 ESP_LOGCONFIG(TAG,
"MAX7219DIGIT:");
51 ESP_LOGCONFIG(TAG,
" Number of Chips: %u", this->
num_chips_);
52 ESP_LOGCONFIG(TAG,
" Number of Chips Lines: %u", this->
num_chip_lines_);
54 ESP_LOGCONFIG(TAG,
" Intensity: %u", this->
intensity_);
55 ESP_LOGCONFIG(TAG,
" Scroll Mode: %u", this->
scroll_mode_);
59 LOG_PIN(
" CS Pin: ", this->
cs_);
60 LOG_UPDATE_INTERVAL(
this);
116 for (uint8_t chip_line = 0; chip_line < this->
num_chip_lines_; chip_line++) {
117 for (uint8_t j = 0; j < 8; j++) {
159 for (
int chip_line = 0; chip_line < this->
num_chip_lines_; chip_line++) {
183 for (uint8_t i = 0; i < this->
num_chips_; i++)
189 for (
int chip_line = 0; chip_line < this->
num_chip_lines_; chip_line++) {
229 for (
int chip_line = 0; chip_line < this->
num_chip_lines_; chip_line++) {
232 for (uint16_t i = 0; i < this->
stepsleft_; i++) {
247 for (uint8_t i = 0; i < 8; i++)
254 for (uint8_t col = 0; col < 8; col++) {
256 for (uint8_t i = 0; i < chip; i++) {
258 MAX7219_REGISTER_NOOP);
262 for (uint8_t i = 0; i < 8; i++) {
265 b |= ((pixels[i] >> col) & 1) << i;
267 b |= ((pixels[i] >> col) & 1) << (7 - i);
273 for (uint8_t i = 0; i < 8; i++) {
275 b |= ((pixels[i] >> (7 - col)) & 1) << (7 - i);
277 b |= ((pixels[i] >> (7 - col)) & 1) << i;
281 for (uint8_t i = 0; i < 8; i++) {
282 b |= ((pixels[7 - col] >> i) & 1) << (7 - i);
291 for (
int i = 0; i < this->
num_chips_ - chip - 1; i++)
292 this->
send_byte_(MAX7219_REGISTER_NOOP, MAX7219_REGISTER_NOOP);
300 uint8_t chip = start_pos;
311 va_start(arg, format);
313 int ret = vsnprintf(buffer,
sizeof(buffer), format, arg);
321 va_start(arg, format);
323 int ret = vsnprintf(buffer,
sizeof(buffer), format, arg);
332 size_t ret = time.
strftime(buffer,
sizeof(buffer), format);
constexpr uint8_t MAX7219_SHUTDOWN
void intensity(uint8_t intensity)
void draw_absolute_pixel_internal(int x, int y, Color color) override
void dump_config() override
constexpr uint8_t MAX7219_DISPLAY_TEST
size_t strftime(char *buffer, size_t buffer_len, const char *format)
Convert this ESPTime struct to a null-terminated c string buffer as specified by the format argument...
void set_scroll(bool on_off)
void spi_setup() override
void send64pixels(uint8_t chip, const uint8_t pixels[8])
A more user-friendly version of struct tm from time.h.
void send_to_all_(uint8_t a_register, uint8_t data)
optional< max7219_writer_t > writer_local_
constexpr uint8_t MAX7219_NO_DISPLAY_TEST
void write_byte(uint8_t data)
void set_scroll_mode(ScrollMode mode)
void set_scroll_speed(uint16_t speed)
bool is_on() ESPHOME_ALWAYS_INLINE
uint32_t IRAM_ATTR HOT millis()
void set_scroll_delay(uint16_t delay)
uint8_t strftimedigit(uint8_t pos, const char *format, ESPTime time) __attribute__((format(strftime
Evaluate the strftime-format and print the result at the given position.
ChipLinesStyle chip_lines_style_
int get_height_internal() override
void send_char(uint8_t chip, uint8_t data)
std::vector< std::vector< uint8_t > > max_displaybuffer_
BedjetMode mode
BedJet operating mode.
float get_setup_priority() const override
int get_width_internal() override
const float PROCESSOR
For components that use data from sensors like displays.
void turn_on_off(bool on_off)
uint16_t old_buffer_size_
uint8_t uint8_t uint8_t printdigit(uint8_t pos, const char *str)
Print str at the given position.
void scroll(bool on_off, ScrollMode mode, uint16_t speed, uint16_t delay, uint16_t dwell)
uint8_t num_chips_
Intensity of the display from 0 to 15 (most)
uint8_t printdigitf(uint8_t pos, const char *format,...) __attribute__((format(printf
Evaluate the printf-format and print the result at the given position.
void send_byte_(uint8_t a_register, uint8_t data)
uint8_t progmem_read_byte(const uint8_t *addr)
uint8_t orientation_180_()
void set_scroll_dwell(uint16_t dwell)
Implementation of SPI Controller mode.
constexpr uint8_t MAX7219_NO_SHUTDOWN
void IRAM_ATTR HOT delay(uint32_t ms)