@@ -170,14 +170,20 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
170
170
mp_raise_ValueError (translate ("Display rotation must be in 90 degree increments" ));
171
171
}
172
172
173
+ const bool sh1107_addressing = args [ARG_SH1107_addressing ].u_bool ;
174
+ const mp_int_t color_depth = args [ARG_color_depth ].u_int ;
175
+ if (sh1107_addressing && color_depth != 1 ) {
176
+ mp_raise_ValueError_varg (translate ("%q must be 1 when %q is True" ), MP_QSTR_color_depth , MP_QSTR_SH1107_addressing );
177
+ }
178
+
173
179
primary_display_t * disp = allocate_display_or_raise ();
174
180
displayio_display_obj_t * self = & disp -> display ;
175
181
176
182
self -> base .type = & displayio_display_type ;
177
183
common_hal_displayio_display_construct (
178
184
self ,
179
185
display_bus , args [ARG_width ].u_int , args [ARG_height ].u_int , args [ARG_colstart ].u_int , args [ARG_rowstart ].u_int , rotation ,
180
- args [ ARG_color_depth ]. u_int , args [ARG_grayscale ].u_bool ,
186
+ color_depth , args [ARG_grayscale ].u_bool ,
181
187
args [ARG_pixels_in_byte_share_row ].u_bool ,
182
188
args [ARG_bytes_per_cell ].u_bool ,
183
189
args [ARG_reverse_pixels_in_byte ].u_bool ,
@@ -194,7 +200,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
194
200
args [ARG_auto_refresh ].u_bool ,
195
201
args [ARG_native_frames_per_second ].u_int ,
196
202
args [ARG_backlight_on_high ].u_bool ,
197
- args [ ARG_SH1107_addressing ]. u_bool
203
+ sh1107_addressing
198
204
);
199
205
200
206
return self ;
0 commit comments