Skip to content

Commit

Permalink
Fix panics for UART
Browse files Browse the repository at this point in the history
- Default rx/tx_buffer_size in uart_driver_install
- Make not covered ResetReason as Unknown
  • Loading branch information
Volkalex28 committed Jun 15, 2024
1 parent d290357 commit 8072933
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/reset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ impl From<esp_reset_reason_t> for ResetReason {
esp_reset_reason_t_ESP_RST_PANIC => Self::Panic,
esp_reset_reason_t_ESP_RST_INT_WDT => Self::InterruptWatchdog,
esp_reset_reason_t_ESP_RST_POWERON => Self::PowerOn,
esp_reset_reason_t_ESP_RST_UNKNOWN => Self::Unknown,
esp_reset_reason_t_ESP_RST_BROWNOUT => Self::Brownout,
esp_reset_reason_t_ESP_RST_TASK_WDT => Self::TaskWatchdog,
esp_reset_reason_t_ESP_RST_DEEPSLEEP => Self::DeepSleep,
_ => unreachable!(),
_ => Self::Unknown,
}
}
}
Expand Down
12 changes: 2 additions & 10 deletions src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1898,16 +1898,8 @@ fn new_common<UART: Uart>(
esp!(unsafe {
uart_driver_install(
UART::port(),
if rx.is_some() {
config.rx_fifo_size as _
} else {
0
},
if tx.is_some() {
config.tx_fifo_size as _
} else {
0
},
if rx.is_some() { config.rx_fifo_size } else { UART_FIFO_SIZE * 2 } as _,
if tx.is_some() { config.tx_fifo_size } else { UART_FIFO_SIZE * 2 } as _,
config.queue_size as _,
queue.map(|q| q as *mut _).unwrap_or(ptr::null_mut()),
InterruptType::to_native(config.intr_flags) as i32,
Expand Down

0 comments on commit 8072933

Please sign in to comment.