@@ -126,7 +126,7 @@ void rp2_pio_irq_set_exclusive_handler(PIO pio, uint irq) {
126
126
irq_handler_t current = irq_get_exclusive_handler (irq );
127
127
// If the IRQ is set and isn't our handler, or a shared handler is set, then raise an error
128
128
if ((current && current != rp2_pio_get_irq_handler (pio )) || irq_has_shared_handler (irq )) {
129
- mp_raise_ValueError ("irq claimed by external resource" );
129
+ mp_raise_ValueError (MP_ERROR_TEXT ( "irq claimed by external resource" ) );
130
130
// If the IRQ is not set, add our handler
131
131
} else if (!current ) {
132
132
irq_set_exclusive_handler (irq , rp2_pio_get_irq_handler (pio ));
@@ -304,7 +304,7 @@ static mp_obj_t rp2_pio_make_new(const mp_obj_type_t *type, size_t n_args, size_
304
304
// Get the PIO object.
305
305
int pio_id = mp_obj_get_int (args [0 ]);
306
306
if (!(0 <= pio_id && pio_id < MP_ARRAY_SIZE (rp2_pio_obj ))) {
307
- mp_raise_ValueError ("invalid PIO" );
307
+ mp_raise_ValueError (MP_ERROR_TEXT ( "invalid PIO" ) );
308
308
}
309
309
const rp2_pio_obj_t * self = & rp2_pio_obj [pio_id ];
310
310
@@ -353,7 +353,7 @@ static mp_obj_t rp2_pio_remove_program(size_t n_args, const mp_obj_t *args) {
353
353
length = bufinfo .len / 2 ;
354
354
offset = mp_obj_get_int (prog [PROG_OFFSET_PIO0 + pio_get_index (self -> pio )]);
355
355
if (offset < 0 ) {
356
- mp_raise_ValueError ("prog not in instruction memory" );
356
+ mp_raise_ValueError (MP_ERROR_TEXT ( "prog not in instruction memory" ) );
357
357
}
358
358
// Invalidate the program offset in the program object.
359
359
prog [PROG_OFFSET_PIO0 + pio_get_index (self -> pio )] = MP_OBJ_NEW_SMALL_INT (-1 );
@@ -374,7 +374,7 @@ static mp_obj_t rp2_pio_state_machine(size_t n_args, const mp_obj_t *pos_args, m
374
374
// Get and verify the state machine id.
375
375
mp_int_t sm_id = mp_obj_get_int (pos_args [1 ]);
376
376
if (!(0 <= sm_id && sm_id < 4 )) {
377
- mp_raise_ValueError ("invalid StateMachine" );
377
+ mp_raise_ValueError (MP_ERROR_TEXT ( "invalid StateMachine" ) );
378
378
}
379
379
380
380
// Return the correct StateMachine object.
@@ -400,7 +400,7 @@ static mp_obj_t rp2_pio_gpio_base(size_t n_args, const mp_obj_t *args) {
400
400
401
401
// Must be 0 for GPIOs 0 to 31 inclusive, or 16 for GPIOs 16 to 48 inclusive.
402
402
if (!(gpio_base == 0 || gpio_base == 16 )) {
403
- mp_raise_ValueError ("invalid GPIO base" );
403
+ mp_raise_ValueError (MP_ERROR_TEXT ( "invalid GPIO base" ) );
404
404
}
405
405
406
406
if (pio_set_gpio_base (self -> pio , gpio_base ) != PICO_OK ) {
@@ -556,14 +556,14 @@ static const rp2_state_machine_obj_t rp2_state_machine_obj[] = {
556
556
557
557
static const rp2_state_machine_obj_t * rp2_state_machine_get_object (mp_int_t sm_id ) {
558
558
if (!(0 <= sm_id && sm_id < MP_ARRAY_SIZE (rp2_state_machine_obj ))) {
559
- mp_raise_ValueError ("invalid StateMachine" );
559
+ mp_raise_ValueError (MP_ERROR_TEXT ( "invalid StateMachine" ) );
560
560
}
561
561
562
562
const rp2_state_machine_obj_t * sm_obj = & rp2_state_machine_obj [sm_id ];
563
563
564
564
if (!(rp2_state_machine_claimed_mask & (1 << sm_id ))) {
565
565
if (pio_sm_is_claimed (sm_obj -> pio , sm_obj -> sm )) {
566
- mp_raise_ValueError ("StateMachine claimed by external resource" );
566
+ mp_raise_ValueError (MP_ERROR_TEXT ( "StateMachine claimed by external resource" ) );
567
567
}
568
568
pio_sm_claim (sm_obj -> pio , sm_obj -> sm );
569
569
rp2_state_machine_claimed_mask |= 1 << sm_id ;
@@ -830,7 +830,7 @@ static mp_obj_t rp2_state_machine_get(size_t n_args, const mp_obj_t *args) {
830
830
* (uint32_t * )dest = value ;
831
831
dest += sizeof (uint32_t );
832
832
} else {
833
- mp_raise_ValueError ("unsupported buffer type" );
833
+ mp_raise_ValueError (MP_ERROR_TEXT ( "unsupported buffer type" ) );
834
834
}
835
835
if (dest >= dest_top ) {
836
836
return args [1 ];
@@ -868,7 +868,7 @@ static mp_obj_t rp2_state_machine_put(size_t n_args, const mp_obj_t *args) {
868
868
value = * (uint32_t * )src ;
869
869
src += sizeof (uint32_t );
870
870
} else {
871
- mp_raise_ValueError ("unsupported buffer type" );
871
+ mp_raise_ValueError (MP_ERROR_TEXT ( "unsupported buffer type" ) );
872
872
}
873
873
while (pio_sm_is_tx_fifo_full (self -> pio , self -> sm )) {
874
874
// This delay must be fast.
0 commit comments