File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ volatile sd_flash_operation_status_t sd_flash_operation_status;
31
31
__attribute__((aligned (4 )))
32
32
static uint8_t m_ble_evt_buf [sizeof (ble_evt_t ) + (BLE_GATTS_VAR_ATTR_LEN_MAX )];
33
33
34
- void ble_drv_reset () {
34
+ void ble_drv_reset (void ) {
35
35
// Linked list items will be gc'd.
36
36
MP_STATE_VM (ble_drv_evt_handler_entries ) = NULL ;
37
37
sd_flash_operation_status = SD_FLASH_OPERATION_DONE ;
@@ -136,7 +136,7 @@ void SD_EVT_IRQHandler(void) {
136
136
const uint32_t err_code = sd_ble_evt_get (m_ble_evt_buf , & evt_len );
137
137
if (err_code != NRF_SUCCESS ) {
138
138
if (err_code == NRF_ERROR_DATA_SIZE ) {
139
- printf ( "NRF_ERROR_DATA_SIZE\n" );
139
+ mp_printf ( & mp_plat_print , "NRF_ERROR_DATA_SIZE\n" );
140
140
}
141
141
142
142
break ;
@@ -177,4 +177,12 @@ void SD_EVT_IRQHandler(void) {
177
177
#endif
178
178
}
179
179
180
+ void ble_drv_gc_collect (void ) {
181
+ ble_drv_evt_handler_entry_t * it = MP_STATE_VM (ble_drv_evt_handler_entries );
182
+ while (it != NULL ) {
183
+ gc_collect_ptr (it );
184
+ it = it -> next ;
185
+ }
186
+ }
187
+
180
188
MP_REGISTER_ROOT_POINTER (ble_drv_evt_handler_entry_t * ble_drv_evt_handler_entries );
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ void ble_drv_reset(void);
49
49
void ble_drv_remove_heap_handlers (void );
50
50
void ble_drv_add_event_handler (ble_drv_evt_handler_t func , void * param );
51
51
void ble_drv_remove_event_handler (ble_drv_evt_handler_t func , void * param );
52
+ void ble_drv_gc_collect (void );
52
53
53
54
// Allow for user provided entries to prevent allocations outside the VM.
54
55
void ble_drv_add_event_handler_entry (ble_drv_evt_handler_entry_t * entry , ble_drv_evt_handler_t func , void * param );
Original file line number Diff line number Diff line change @@ -248,4 +248,5 @@ void bleio_background(void) {
248
248
249
249
void common_hal_bleio_gc_collect (void ) {
250
250
bleio_adapter_gc_collect (& common_hal_bleio_adapter_obj );
251
+ ble_drv_gc_collect ();
251
252
}
You can’t perform that action at this time.
0 commit comments