Skip to content
Snippets Groups Projects
Commit d81b4c55 authored by A Sundbom's avatar A Sundbom
Browse files

Adds HAL for UART1

parent 38a6f667
Branches
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ pub use embedded_hal::serial::{Read, Write};
// use core::fmt::Write as SerialWrite;
use crate::{
pac,
pac::{USART0, USART2, USART3},
pac::{USART0, UART1, USART2, USART3},
};
use nb::Error::Other;
use pac::SCU;
......@@ -35,7 +35,7 @@ pub trait IntoUartRx<X, N> {
}
macro_rules! hal {
($($USART: ident ($usart: ident): {
($($USART: ident ($usart: ident, $abeoie: ident, $abtoie: ident): {
tx: [
$(($tx_x: tt ($tx_X: ty), $tx_n: tt ($tx_N: ty), $tx_sfs_mode:ident),)+
],
......@@ -154,8 +154,8 @@ macro_rules! hal {
.rbrie().bit(rx_data)
.threie().bit(tx_holding)
.rxie().bit(recv_line)
.abeointen().bit(autobaud_end)
.abtointen().bit(autobaud_timeout));
.$abeoie().bit(autobaud_end)
.$abtoie().bit(autobaud_timeout));
}
}
......@@ -284,7 +284,7 @@ macro_rules! hal {
}
hal! {
USART0 (usart0): {
USART0 (usart0, abeointen, abtointen): {
tx: [
(2 (U2), 0 (U0), function_1),
(6 (U6), 4 (U4), function_2),
......@@ -298,7 +298,24 @@ hal! {
(f (F), 11 (U11), function_1),
],
}
USART2 (usart0): {tx: [
UART1 (uart1, abeoie, abtoie): {
tx: [
(1 (U1), 13 (U13), function_1),
(3 (U3), 4 (U4), function_4),
(5 (U5), 6 (U6), function_4),
(c (C), 13 (U13), function_2),
(e (E), 11 (U11), function_2),
],
rx: [
(1 (U1), 14 (U14), function_1),
(3 (U3), 5 (U5), function_4),
(5 (U5), 7 (U7), function_4),
(c (C), 14 (U14), function_2),
(e (E), 12 (U12), function_2),
],
}
USART2 (usart0, abeointen, abtointen): {
tx: [
(1 (U1), 15 (U15), function_1),
(2 (U2), 10 (U10), function_2),
(7 (U7), 1 (U1), function_6),
......@@ -309,8 +326,9 @@ hal! {
(2 (U2), 11 (U11), function_2),
(7 (U7), 2 (U2), function_6),
(a (A), 2 (U2), function_3),
],}
USART3 (usart0): {
],
}
USART3 (usart0, abeointen, abtointen): {
tx: [
(2 (U2), 3 (U3), function_2),
(4 (U4), 1 (U1), function_6),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment