Skip to content

Commit c28e6bd

Browse files
committed
codal_port: Use new core-provided mp_sched_exception() function.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 346b173 commit c28e6bd

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

src/codal_port/drv_display.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static void draw_object(mp_obj_t obj) {
9393
async_stop();
9494
}
9595
} else {
96-
mp_sched_schedule_exception(mp_obj_new_exception_msg(&mp_type_TypeError, MP_ERROR_TEXT("not an image")));
96+
mp_sched_exception(mp_obj_new_exception_msg(&mp_type_TypeError, MP_ERROR_TEXT("not an image")));
9797
async_stop();
9898
}
9999
}
@@ -126,7 +126,7 @@ void microbit_display_update(void) {
126126
if (mp_obj_get_type(nlr.ret_val) == &mp_type_MemoryError) {
127127
mp_printf(&mp_plat_print, "Allocation in interrupt handler");
128128
}
129-
mp_sched_schedule_exception(MP_OBJ_FROM_PTR(nlr.ret_val));
129+
mp_sched_exception(MP_OBJ_FROM_PTR(nlr.ret_val));
130130
}
131131
obj = MP_OBJ_STOP_ITERATION;
132132
}

src/codal_port/modaudio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ STATIC void audio_data_fetcher(void) {
7777
} else {
7878
if (!mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t*)nlr.ret_val)->type),
7979
MP_OBJ_FROM_PTR(&mp_type_StopIteration))) {
80-
mp_sched_schedule_exception(MP_OBJ_FROM_PTR(nlr.ret_val));
80+
mp_sched_exception(MP_OBJ_FROM_PTR(nlr.ret_val));
8181
}
8282
buffer_obj = MP_OBJ_STOP_ITERATION;
8383
}
@@ -89,7 +89,7 @@ STATIC void audio_data_fetcher(void) {
8989
// Audio iterator did not return an AudioFrame
9090
audio_source_iter = NULL;
9191
microbit_audio_stop();
92-
mp_sched_schedule_exception(mp_obj_new_exception_msg(&mp_type_TypeError, MP_ERROR_TEXT("not an AudioFrame")));
92+
mp_sched_exception(mp_obj_new_exception_msg(&mp_type_TypeError, MP_ERROR_TEXT("not an AudioFrame")));
9393
} else {
9494
microbit_audio_frame_obj_t *buffer = (microbit_audio_frame_obj_t *)buffer_obj;
9595
uint8_t *dest = &audio_output_buffer[0];

src/codal_port/mphalport.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@
2727
#include "py/runtime.h"
2828
#include "py/mphal.h"
2929

30-
void mp_sched_schedule_exception(mp_obj_t exc) {
31-
MP_STATE_VM(mp_pending_exception) = exc;
32-
if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
33-
MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
34-
}
35-
}
36-
3730
void mp_hal_delay_us(mp_uint_t us) {
3831
if (us <= 0) {
3932
return;

src/codal_port/mphalport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
// Not implemented and not exposed in utime module.
3131
#define mp_hal_ticks_cpu() (0)
3232

33-
void mp_sched_schedule_exception(mp_obj_t exc);
3433
void mp_hal_set_interrupt_char(int c);
3534

3635
static inline uint64_t mp_hal_time_ns(void) {

0 commit comments

Comments
 (0)