@@ -40,11 +40,12 @@ typedef struct _Hub75_obj_t {
40
40
void *buf;
41
41
} _Hub75_obj_t;
42
42
43
- _Hub75_obj_t *hub75_obj;
43
+ _Hub75_obj_t *hub75_obj[ 2 ] ;
44
44
45
45
46
46
void __isr dma_complete () {
47
- if (hub75_obj) hub75_obj->hub75 ->dma_complete ();
47
+ if (hub75_obj[0 ]) hub75_obj[0 ]->hub75 ->dma_complete ();
48
+ if (hub75_obj[1 ]) hub75_obj[1 ]->hub75 ->dma_complete ();
48
49
}
49
50
50
51
/* **** Print *****/
@@ -86,7 +87,8 @@ mp_obj_t Hub75_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c
86
87
ARG_buffer,
87
88
ARG_panel_type,
88
89
ARG_stb_invert,
89
- ARG_color_order
90
+ ARG_color_order,
91
+ ARG_duo
90
92
};
91
93
static const mp_arg_t allowed_args[] = {
92
94
{ MP_QSTR_width, MP_ARG_REQUIRED | MP_ARG_INT },
@@ -95,6 +97,7 @@ mp_obj_t Hub75_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c
95
97
{ MP_QSTR_panel_type, MP_ARG_INT, {.u_int = 0 } },
96
98
{ MP_QSTR_stb_invert, MP_ARG_INT, {.u_int = 0 } },
97
99
{ MP_QSTR_color_order, MP_ARG_INT, {.u_int = (uint8_t )Hub75::COLOR_ORDER::RGB} },
100
+ { MP_QSTR_duo, MP_ARG_INT, {.u_int = 0 } },
98
101
};
99
102
100
103
// Parse args.
@@ -106,6 +109,7 @@ mp_obj_t Hub75_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c
106
109
PanelType paneltype = (PanelType)args[ARG_panel_type].u_int ;
107
110
bool stb_invert = args[ARG_stb_invert].u_int ;
108
111
Hub75::COLOR_ORDER color_order = (Hub75::COLOR_ORDER)args[ARG_color_order].u_int ;
112
+ bool duo_mode = args[ARG_duo].u_int ;
109
113
110
114
Pixel *buffer = nullptr ;
111
115
@@ -120,11 +124,11 @@ mp_obj_t Hub75_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, c
120
124
buffer = m_new (Pixel, width * height);
121
125
}
122
126
123
- hub75_obj = mp_obj_malloc_with_finaliser (_Hub75_obj_t, &Hub75_type);
124
- hub75_obj->buf = buffer;
125
- hub75_obj->hub75 = m_new_class (Hub75, width, height, buffer, paneltype, stb_invert, color_order);
127
+ hub75_obj[duo_mode] = mp_obj_malloc_with_finaliser (_Hub75_obj_t, &Hub75_type);
128
+ hub75_obj[duo_mode] ->buf = buffer;
129
+ hub75_obj[duo_mode] ->hub75 = m_new_class (Hub75, width, height, buffer, paneltype, stb_invert, color_order, duo_mode );
126
130
127
- return MP_OBJ_FROM_PTR (hub75_obj);
131
+ return MP_OBJ_FROM_PTR (hub75_obj[duo_mode] );
128
132
}
129
133
130
134
mp_obj_t Hub75_clear (mp_obj_t self_in) {
0 commit comments