2424#![ cfg_attr( feature = "trinket-pro" , doc = "**Trinket Pro**." ) ]
2525#![ cfg_attr( feature = "trinket" , doc = "**Trinket**." ) ]
2626#![ cfg_attr( feature = "nano168" , doc = "**Nano clone (ATmega168)**." ) ]
27+ #![ cfg_attr( feature = "attiny402" , doc = "**ATtiny402**." ) ]
28+ #![ cfg_attr( feature = "attiny1614" , doc = "**ATtiny1614**." ) ]
29+ // #![cfg_attr(feature = "attiny3224", doc = "**ATtiny3224**.")]
30+ // #![cfg_attr(feature = "avr128db28", doc = "**avr128db28**.")]
2731//! This means that only items which are available for this board are visible. If you are using a
2832//! different board, try building the documentation locally with
2933//!
@@ -72,6 +76,8 @@ compile_error!(
7276 * trinket-pro
7377 * trinket
7478 * nano168
79+ * attiny402
80+ * attiny1614
7581 "
7682) ;
7783
@@ -101,6 +107,13 @@ pub use atmega_hal as hal;
101107#[ cfg( feature = "mcu-atmega" ) ]
102108pub use atmega_hal:: pac;
103109
110+ #[ doc( no_inline) ]
111+ #[ cfg( feature = "mcu-avrmodern" ) ]
112+ pub use avrmodern_hal as hal;
113+ #[ doc( no_inline) ]
114+ #[ cfg( feature = "mcu-avrmodern" ) ]
115+ pub use avrmodern_hal:: pac;
116+
104117#[ doc( no_inline) ]
105118#[ cfg( feature = "mcu-attiny" ) ]
106119pub use attiny_hal as hal;
@@ -165,7 +178,7 @@ pub mod spi {
165178#[ cfg( feature = "mcu-atmega" ) ]
166179pub use spi:: Spi ;
167180
168- #[ cfg( feature = "mcu-atmega" ) ]
181+ #[ cfg( any ( feature = "mcu-atmega" , feature = "mcu-avrmodern" ) ) ]
169182pub mod usart {
170183 pub use crate :: hal:: usart:: { Baudrate , UsartOps } ;
171184
@@ -177,15 +190,15 @@ pub mod usart {
177190}
178191
179192#[ doc( no_inline) ]
180- #[ cfg( feature = "mcu-atmega" ) ]
193+ #[ cfg( any ( feature = "mcu-atmega" , feature = "mcu-avrmodern" ) ) ]
181194pub use usart:: Usart ;
182195
183- #[ cfg( feature = "board-selected" ) ]
196+ #[ cfg( any ( feature = "mcu-atmega" , feature = "mcu-attiny" ) ) ]
184197pub mod eeprom {
185198 pub use crate :: hal:: eeprom:: { Eeprom , EepromOps , OutOfBoundsError } ;
186199}
187200#[ doc( no_inline) ]
188- #[ cfg( feature = "board-selected" ) ]
201+ #[ cfg( any ( feature = "mcu-atmega" , feature = "mcu-attiny" ) ) ]
189202pub use eeprom:: Eeprom ;
190203
191204#[ cfg( feature = "board-selected" ) ]
@@ -197,7 +210,7 @@ pub mod simple_pwm {
197210 pub use attiny_hal:: simple_pwm:: * ;
198211}
199212
200- #[ cfg( feature = "mcu-atmega" ) ]
213+ #[ cfg( any ( feature = "mcu-atmega" , feature = "mcu-avrmodern" ) ) ]
201214pub mod prelude {
202215 pub use crate :: hal:: prelude:: * ;
203216
@@ -340,3 +353,37 @@ macro_rules! default_serial {
340353 )
341354 } ;
342355}
356+
357+ /// Convenience macro to instantiate the [`Usart`] driver for this board.
358+ ///
359+ /// # Example
360+ /// ```no_run
361+ /// let dp = arduino_hal::Peripherals::take().unwrap();
362+ /// let pins = arduino_hal::pins!(dp);
363+ /// let serial = arduino_hal::default_serial!(dp, pins, 57600);
364+ /// ```
365+ #[ cfg( any( feature = "attiny402" ) ) ]
366+ #[ macro_export]
367+ macro_rules! default_serial {
368+ ( $p: expr, $pins: expr, $baud: expr) => {
369+ $crate:: Usart :: new(
370+ $p. USART0 ,
371+ $pins. a7,
372+ $pins. a6. into_output( ) ,
373+ $crate:: hal:: usart:: BaudrateExt :: into_baudrate( $baud) ,
374+ )
375+ } ;
376+ }
377+
378+ #[ cfg( any( feature = "attiny1614" ) ) ]
379+ #[ macro_export]
380+ macro_rules! default_serial {
381+ ( $p: expr, $pins: expr, $baud: expr) => {
382+ $crate:: Usart :: new(
383+ $p. USART0 ,
384+ $pins. b3,
385+ $pins. b2. into_output( ) ,
386+ $crate:: hal:: usart:: BaudrateExt :: into_baudrate( $baud) ,
387+ )
388+ } ;
389+ }
0 commit comments