2 * QEMU DM163 8x3-channel constant current led driver
3 * driving columns of associated 8x8 RGB matrix.
5 * Copyright (C) 2024 Samuel Tardieu <sam@rfc1149.net>
6 * Copyright (C) 2024 Arnaud Minier <arnaud.minier@telecom-paris.fr>
7 * Copyright (C) 2024 Inès Varhol <ines.varhol@telecom-paris.fr>
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef HW_DISPLAY_DM163_H
13 #define HW_DISPLAY_DM163_H
15 #include "qom/object.h"
16 #include "hw/qdev-core.h"
18 #define TYPE_DM163 "dm163"
19 OBJECT_DECLARE_SIMPLE_TYPE(DM163State
, DM163
);
21 #define RGB_MATRIX_NUM_ROWS 8
22 #define RGB_MATRIX_NUM_COLS 8
23 #define DM163_NUM_LEDS (RGB_MATRIX_NUM_COLS * 3)
24 /* The last row is filled with 0 (turned off row) */
25 #define COLOR_BUFFER_SIZE (RGB_MATRIX_NUM_ROWS + 1)
27 typedef struct DM163State
{
28 DeviceState parent_obj
;
31 uint64_t bank0_shift_register
[3];
32 uint64_t bank1_shift_register
[3];
33 uint16_t latched_outputs
[DM163_NUM_LEDS
];
34 uint16_t outputs
[DM163_NUM_LEDS
];
44 /* IM120417002 colors shield */
45 uint8_t activated_rows
;
50 /* Rows currently being displayed on the matrix. */
51 /* The last row is filled with 0 (turned off row) */
52 uint32_t buffer
[COLOR_BUFFER_SIZE
][RGB_MATRIX_NUM_COLS
];
53 uint8_t last_buffer_idx
;
54 uint8_t buffer_idx_of_row
[RGB_MATRIX_NUM_ROWS
];
55 /* Used to simulate retinal persistence of rows */
56 uint8_t row_persistence_delay
[RGB_MATRIX_NUM_ROWS
];
59 #endif /* HW_DISPLAY_DM163_H */