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;
3131__attribute__((aligned (4 )))
3232static uint8_t m_ble_evt_buf [sizeof (ble_evt_t ) + (BLE_GATTS_VAR_ATTR_LEN_MAX )];
3333
34- void ble_drv_reset () {
34+ void ble_drv_reset (void ) {
3535 // Linked list items will be gc'd.
3636 MP_STATE_VM (ble_drv_evt_handler_entries ) = NULL ;
3737 sd_flash_operation_status = SD_FLASH_OPERATION_DONE ;
@@ -136,7 +136,7 @@ void SD_EVT_IRQHandler(void) {
136136 const uint32_t err_code = sd_ble_evt_get (m_ble_evt_buf , & evt_len );
137137 if (err_code != NRF_SUCCESS ) {
138138 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" );
140140 }
141141
142142 break ;
@@ -177,4 +177,12 @@ void SD_EVT_IRQHandler(void) {
177177 #endif
178178}
179179
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+
180188MP_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);
4949void ble_drv_remove_heap_handlers (void );
5050void ble_drv_add_event_handler (ble_drv_evt_handler_t func , void * param );
5151void ble_drv_remove_event_handler (ble_drv_evt_handler_t func , void * param );
52+ void ble_drv_gc_collect (void );
5253
5354// Allow for user provided entries to prevent allocations outside the VM.
5455void 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) {
248248
249249void common_hal_bleio_gc_collect (void ) {
250250 bleio_adapter_gc_collect (& common_hal_bleio_adapter_obj );
251+ ble_drv_gc_collect ();
251252}
You can’t perform that action at this time.
0 commit comments