forked from Rahix/avr-hal
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusart_spi.rs
More file actions
104 lines (96 loc) · 2.57 KB
/
Copy pathusart_spi.rs
File metadata and controls
104 lines (96 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! USART MSPIM implimentations
//!
//! The following list details how many USARTs and if the USARTs support MSPIM for each board choosable.
//!
//! | Board | USARTs | SPI |
//! |-------|--------|-----|
//! | `atmega48p` | 1 | Yes |
//! | `atmega164pa`| 2 | Yes |
//! | `atmega168` | 1 | Yes |
//! | `atmega328p` | 1 | Yes |
//! | `atmega328pb` | 1 | Yes |
//! | `atmega32a` | 1 | No |
//! | `atmega32u4` | 1 | Yes |
//! | `atmega2560` | 4 | Yes |
//! | `atmega128a` | 2 | No |
//! | `atmega1280` | 4 | Yes |
//! | `atmega1284p` | 2 | Yes |
//! | `atmega8` | 1 | No |
// Supress warning because it doesn't recognise us using it in macros properly.
#[allow(unused_imports)]
use crate::port;
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART0,
register_suffix: 0,
sclk: port::PE2,
mosi: port::PE1,
miso: port::PE0,
cs: port::Dynamic,
}
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART1,
register_suffix: 1,
sclk: port::PD5,
mosi: port::PD3,
miso: port::PD2,
cs: port::Dynamic,
}
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART2,
register_suffix: 2,
sclk: port::PH2,
mosi: port::PH1,
miso: port::PH0,
cs: port::Dynamic,
}
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART3,
register_suffix: 3,
sclk: port::PJ2,
mosi: port::PJ1,
miso: port::PJ0,
cs: port::Dynamic,
}
#[cfg(any(
feature = "atmega168",
feature = "atmega328p",
feature = "atmega328pb",
feature = "atmega48p"
))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART0,
register_suffix: 0,
sclk: port::PD4,
mosi: port::PD1,
miso: port::PD0,
cs: port::Dynamic,
}
#[cfg(any(feature = "atmega1284p", feature = "atmega164pa",))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART0,
register_suffix: 0,
sclk: port::PB0,
mosi: port::PD1,
miso: port::PD0,
cs: port::Dynamic,
}
#[cfg(any(feature = "atmega1284p", feature = "atmega164pa",))]
avr_hal_generic::add_usart_spi! {
hal: crate::Atmega,
peripheral: crate::pac::USART1,
register_suffix: 1,
sclk: port::PD4,
mosi: port::PD3,
miso: port::PD2,
cs: port::Dynamic,
}