Skip to content

Commit 0b403b9

Browse files
committed
rp2/machine_i2c_target: Fix some minor issues.
Signed-off-by: Damien George <[email protected]>
1 parent 23a4850 commit 0b403b9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ports/rp2/machine_i2c_target.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ static void i2c_target_handler(i2c_inst_t *i2c, i2c_slave_event_t event) {
106106
if (data->state == STATE_IDLE) {
107107
machine_i2c_target_data_addr_match(data, true);
108108
}
109-
//i2c_write_byte_raw(i2c, 0x12);
110-
//break;
109+
// i2c_write_byte_raw(i2c, 0x12);
110+
// break;
111111
machine_i2c_target_data_read_request(self, data);
112112
break;
113113
}
@@ -172,7 +172,7 @@ static mp_obj_t mp_machine_i2c_target_make_new(const mp_obj_type_t *type, size_t
172172

173173
// Check if the I2C bus is valid
174174
if (i2c_id < 0 || i2c_id >= MP_ARRAY_SIZE(machine_i2c_target_obj)) {
175-
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id);
175+
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2CTarget(%d) doesn't exist"), i2c_id);
176176
}
177177

178178
// Get static peripheral object.

ports/rp2/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "py/mperrno.h"
3535
#include "py/mphal.h"
3636
#include "extmod/modbluetooth.h"
37+
#include "extmod/modmachine.h"
3738
#include "extmod/modnetwork.h"
3839
#include "shared/readline/readline.h"
3940
#include "shared/runtime/gchelper.h"
@@ -257,6 +258,9 @@ int main(int argc, char **argv) {
257258
machine_pwm_deinit_all();
258259
machine_pin_deinit();
259260
machine_uart_deinit_all();
261+
#if MICROPY_PY_MACHINE_I2C_TARGET
262+
mp_machine_i2c_target_deinit_all();
263+
#endif
260264
#if MICROPY_PY_THREAD
261265
mp_thread_deinit();
262266
#endif

0 commit comments

Comments
 (0)