@@ -134,19 +134,20 @@ static mp_obj_t mp_lcd_bus_init(size_t n_args, const mp_obj_t *pos_args, mp_map_
134
134
return mp_const_none ;
135
135
}
136
136
137
- if (mp_lcd_start_rotate_task (self )) {
138
- if ((self -> sw_rotate || self -> sw_rot .data .rgb565_swap ) && self -> sw_rot .buffers .active == NULL ) {
139
- ret = mp_lcd_allocate_rotation_buffers (self );
140
- if (ret == LCD_ERR_NO_MEM ) {
141
- mp_raise_msg (& mp_type_MemoryError , MP_ERROR_TEXT ("Not enough memory to allocate frame buffers" ));
142
- return mp_const_none ;
143
- }
137
+ if ((self -> sw_rotate || self -> sw_rot .data .rgb565_swap ) && self -> sw_rot .buffers .active == NULL ) {
138
+ ret = mp_lcd_allocate_rotation_buffers (self );
139
+ if (ret == LCD_ERR_NO_MEM ) {
140
+ mp_raise_msg (& mp_type_MemoryError , MP_ERROR_TEXT ("Not enough memory to allocate frame buffers" ));
141
+ return mp_const_none ;
144
142
}
145
143
}
146
144
147
- running_bus_count += 1 ;
148
- running_busses = realloc (running_busses , running_bus_count * (sizeof (mp_lcd_bus_obj_t * )));
149
- running_busses [running_bus_count - 1 ] = self ;
145
+ if (mp_lcd_start_rotate_task (self )) {
146
+ LCD_DEBUG_PRINT ("mp_lcd_sw_rotate_task, running...\n" )
147
+ running_bus_count += 1 ;
148
+ running_busses = realloc (running_busses , running_bus_count * (sizeof (mp_lcd_bus_obj_t * )));
149
+ running_busses [running_bus_count - 1 ] = self ;
150
+ }
150
151
151
152
return mp_const_none ;
152
153
}
@@ -191,7 +192,10 @@ static mp_obj_t mp_lcd_bus_tx_param(size_t n_args, const mp_obj_t *pos_args, mp_
191
192
mp_get_buffer_raise (args [ARG_params ].u_obj , & bufinfo , MP_BUFFER_READ );
192
193
193
194
tx_params -> params [tx_params -> len - 1 ].cmd = (int )args [ARG_cmd ].u_int ;
194
- tx_params -> params [tx_params -> len - 1 ].params = (uint8_t * )bufinfo .buf ;
195
+
196
+ tx_params -> params [tx_params -> len - 1 ].params = (uint8_t * )malloc (bufinfo .len );
197
+ memcpy (tx_params -> params [tx_params -> len - 1 ].params , bufinfo .buf , bufinfo .len );
198
+
195
199
tx_params -> params [tx_params -> len - 1 ].params_len = (size_t )bufinfo .len ;
196
200
tx_params -> params [tx_params -> len - 1 ].flush_next = (bool )args [ARG_flush_next ].u_bool ;
197
201
} else {
0 commit comments