You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
+1
-1
@@ -16,5 +16,5 @@ const byte mp_hal_status_to_errno_table[4] = {
|
||||
};
|
||||
|
||||
NORETURN void mp_hal_raise(HAL_StatusTypeDef status) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, (mp_obj_t)(mp_uint_t)mp_hal_status_to_errno_table[status]));
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(mp_hal_status_to_errno_table[status])));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# test hal errors
|
||||
|
||||
import pyb
|
||||
|
||||
i2c = pyb.I2C(2, pyb.I2C.MASTER)
|
||||
try:
|
||||
i2c.recv(1, 1)
|
||||
except OSError as e:
|
||||
print(repr(e))
|
||||
|
||||
can = pyb.CAN(1, pyb.CAN.NORMAL)
|
||||
try:
|
||||
can.send('1', 1, timeout=50)
|
||||
except OSError as e:
|
||||
print(repr(e))
|
||||
@@ -0,0 +1,2 @@
|
||||
OSError(5,)
|
||||
OSError(116,)
|
||||
Reference in New Issue
Block a user