Skip to content

Commit

Permalink
i2c: i2c1_handler used I2C0 register block by mistake (#1487)
Browse files Browse the repository at this point in the history
* i2c: i2c1_handler used I2C0 register block by mistake

* update CHANGELOG
  • Loading branch information
liebman authored Apr 22, 2024
1 parent 4d44f41 commit 5f79be6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- i2c: i2c1_handler used I2C0 register block by mistake (#1487)

### Changed

### Removed
Expand Down
16 changes: 6 additions & 10 deletions esp-hal/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,29 +705,25 @@ mod asynch {

#[handler]
pub(super) fn i2c0_handler() {
unsafe { &*crate::peripherals::I2C0::PTR }
.int_ena()
let regs = unsafe { &*crate::peripherals::I2C0::PTR };
regs.int_ena()
.modify(|_, w| w.end_detect().clear_bit().trans_complete().clear_bit());

#[cfg(not(any(esp32, esp32s2)))]
unsafe { &*crate::peripherals::I2C0::PTR }
.int_ena()
.modify(|_, w| w.txfifo_wm().clear_bit());
regs.int_ena().modify(|_, w| w.txfifo_wm().clear_bit());

WAKERS[0].wake();
}

#[cfg(i2c1)]
#[handler]
pub(super) fn i2c1_handler() {
unsafe { &*crate::peripherals::I2C1::PTR }
.int_ena()
let regs = unsafe { &*crate::peripherals::I2C1::PTR };
regs.int_ena()
.modify(|_, w| w.end_detect().clear_bit().trans_complete().clear_bit());

#[cfg(not(any(esp32, esp32s2)))]
unsafe { &*crate::peripherals::I2C0::PTR }
.int_ena()
.modify(|_, w| w.txfifo_wm().clear_bit());
regs.int_ena().modify(|_, w| w.txfifo_wm().clear_bit());

WAKERS[1].wake();
}
Expand Down

0 comments on commit 5f79be6

Please sign in to comment.