mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
all: Use MP_ERROR_TEXT for all error messages.
This commit is contained in:
committed by
Damien George
parent
85858e72df
commit
def76fe4d9
@@ -327,7 +327,7 @@ STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, s
|
||||
extern mp_obj_t MICROPY_PY_MACHINE_I2C_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
||||
return MICROPY_PY_MACHINE_I2C_MAKE_NEW(type, n_args, n_kw, args);
|
||||
#else
|
||||
mp_raise_ValueError("invalid I2C peripheral");
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("invalid I2C peripheral"));
|
||||
#endif
|
||||
}
|
||||
--n_args;
|
||||
@@ -367,7 +367,7 @@ STATIC mp_obj_t machine_i2c_start(mp_obj_t self_in) {
|
||||
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
|
||||
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)self->type->protocol;
|
||||
if (i2c_p->start == NULL) {
|
||||
mp_raise_msg(&mp_type_OSError, "I2C operation not supported");
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("I2C operation not supported"));
|
||||
}
|
||||
int ret = i2c_p->start(self);
|
||||
if (ret != 0) {
|
||||
@@ -381,7 +381,7 @@ STATIC mp_obj_t machine_i2c_stop(mp_obj_t self_in) {
|
||||
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
|
||||
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)self->type->protocol;
|
||||
if (i2c_p->stop == NULL) {
|
||||
mp_raise_msg(&mp_type_OSError, "I2C operation not supported");
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("I2C operation not supported"));
|
||||
}
|
||||
int ret = i2c_p->stop(self);
|
||||
if (ret != 0) {
|
||||
@@ -395,7 +395,7 @@ STATIC mp_obj_t machine_i2c_readinto(size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
|
||||
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)self->type->protocol;
|
||||
if (i2c_p->read == NULL) {
|
||||
mp_raise_msg(&mp_type_OSError, "I2C operation not supported");
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("I2C operation not supported"));
|
||||
}
|
||||
|
||||
// get the buffer to read into
|
||||
@@ -419,7 +419,7 @@ STATIC mp_obj_t machine_i2c_write(mp_obj_t self_in, mp_obj_t buf_in) {
|
||||
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
|
||||
mp_machine_i2c_p_t *i2c_p = (mp_machine_i2c_p_t *)self->type->protocol;
|
||||
if (i2c_p->write == NULL) {
|
||||
mp_raise_msg(&mp_type_OSError, "I2C operation not supported");
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("I2C operation not supported"));
|
||||
}
|
||||
|
||||
// get the buffer to write from
|
||||
|
||||
Reference in New Issue
Block a user