Skip to content

Commit 1e0a5b3

Browse files
authored
Added UartInterrupt::RxTimeout support (#3493)
* feat: add UartInterrupt::RxTimeout listen support * add missing RxTimeout checking in `fn interrupts()` * update changelog * fix PR id
1 parent 466dcc2 commit 1e0a5b3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

esp-hal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2929
- Implemented `embedded_io::ReadReady` for `Uart` and `UartRx` (#3423)
3030
- Implemented `embedded_io::WriteReady` for `Uart` and `UartTx` (#3423)
3131
- ESP32-H2: Support for ADC calibration (#3414)
32+
- Added `UartInterrupt::RxTimeout` support (#3493)
3233

3334
### Changed
3435

esp-hal/src/uart.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,10 @@ pub enum UartInterrupt {
14021402
/// The receiver has received more data than what
14031403
/// [`RxConfig::fifo_full_threshold`] specifies.
14041404
RxFifoFull,
1405+
1406+
/// The receiver has not received any data for the time
1407+
/// [`RxConfig::with_timeout`] specifies.
1408+
RxTimeout,
14051409
}
14061410

14071411
impl<'d, Dm> Uart<'d, Dm>
@@ -2444,6 +2448,7 @@ impl Info {
24442448
UartInterrupt::AtCmd => w.at_cmd_char_det().bit(enable),
24452449
UartInterrupt::TxDone => w.tx_done().bit(enable),
24462450
UartInterrupt::RxFifoFull => w.rxfifo_full().bit(enable),
2451+
UartInterrupt::RxTimeout => w.rxfifo_tout().bit(enable),
24472452
};
24482453
}
24492454
w
@@ -2465,6 +2470,9 @@ impl Info {
24652470
if ints.rxfifo_full().bit_is_set() {
24662471
res.insert(UartInterrupt::RxFifoFull);
24672472
}
2473+
if ints.rxfifo_tout().bit_is_set() {
2474+
res.insert(UartInterrupt::RxTimeout);
2475+
}
24682476

24692477
res
24702478
}
@@ -2478,6 +2486,7 @@ impl Info {
24782486
UartInterrupt::AtCmd => w.at_cmd_char_det().clear_bit_by_one(),
24792487
UartInterrupt::TxDone => w.tx_done().clear_bit_by_one(),
24802488
UartInterrupt::RxFifoFull => w.rxfifo_full().clear_bit_by_one(),
2489+
UartInterrupt::RxTimeout => w.rxfifo_tout().clear_bit_by_one(),
24812490
};
24822491
}
24832492
w

0 commit comments

Comments
 (0)