stm32/i2c: Fully support peripheral I2C4.

This commit is contained in:
Damien George 2018-04-10 14:33:18 +10:00
parent 69bf23c9cf
commit 22f1414abb
2 changed files with 5 additions and 0 deletions

View File

@ -650,6 +650,10 @@ STATIC mp_obj_t pyb_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_
} else if (strcmp(port, MICROPY_HW_I2C3_NAME) == 0) { } else if (strcmp(port, MICROPY_HW_I2C3_NAME) == 0) {
i2c_id = 3; i2c_id = 3;
#endif #endif
#ifdef MICROPY_HW_I2C4_NAME
} else if (strcmp(port, MICROPY_HW_I2C4_NAME) == 0) {
i2c_id = 4;
#endif
} else { } else {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
"I2C(%s) doesn't exist", port)); "I2C(%s) doesn't exist", port));

View File

@ -42,6 +42,7 @@ typedef struct _pyb_i2c_obj_t {
extern I2C_HandleTypeDef I2CHandle1; extern I2C_HandleTypeDef I2CHandle1;
extern I2C_HandleTypeDef I2CHandle2; extern I2C_HandleTypeDef I2CHandle2;
extern I2C_HandleTypeDef I2CHandle3; extern I2C_HandleTypeDef I2CHandle3;
extern I2C_HandleTypeDef I2CHandle4;
extern const mp_obj_type_t pyb_i2c_type; extern const mp_obj_type_t pyb_i2c_type;
extern const pyb_i2c_obj_t pyb_i2c_obj[4]; extern const pyb_i2c_obj_t pyb_i2c_obj[4];