File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -437,25 +437,28 @@ void TwoWire::end(void) {
437
437
if (init_ok) {
438
438
if (is_master) {
439
439
if (m_close != nullptr ) {
440
- m_close (&m_i2c_ctrl);
441
440
R_BSP_IrqDisable (m_i2c_cfg.txi_irq );
442
441
R_BSP_IrqDisable (m_i2c_cfg.rxi_irq );
443
442
R_BSP_IrqDisable (m_i2c_cfg.tei_irq );
444
443
R_BSP_IrqDisable (m_i2c_cfg.eri_irq );
445
-
444
+ m_close (&m_i2c_ctrl);
446
445
}
447
446
}
448
447
else {
449
448
if (s_close != nullptr ) {
450
- s_close (&s_i2c_ctrl);
451
449
R_BSP_IrqDisable (s_i2c_cfg.txi_irq );
452
450
R_BSP_IrqDisable (s_i2c_cfg.rxi_irq );
453
451
R_BSP_IrqDisable (s_i2c_cfg.tei_irq );
454
452
R_BSP_IrqDisable (s_i2c_cfg.eri_irq );
453
+ s_close (&s_i2c_ctrl);
455
454
456
455
}
457
456
}
458
457
}
458
+ /* fix for slave that create a sort of lock on the I2C bus when end is called and the master
459
+ is not more able to get the I2C buse working */
460
+ R_IOPORT_PinCfg (NULL , g_pin_cfg[sda_pin].pin , IOPORT_CFG_PORT_DIRECTION_INPUT | IOPORT_CFG_PULLUP_ENABLE);
461
+ R_IOPORT_PinCfg (NULL , g_pin_cfg[scl_pin].pin , IOPORT_CFG_PORT_DIRECTION_INPUT | IOPORT_CFG_PULLUP_ENABLE);
459
462
init_ok = false ;
460
463
}
461
464
You can’t perform that action at this time.
0 commit comments