@@ -37,9 +37,9 @@ use crate::gpio::gpiod;
3737) ) ]
3838use crate :: gpio:: gpioe;
3939
40- #[ cfg( feature = "stm32f303" ) ]
40+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
4141use crate :: dma;
42- #[ cfg( feature = "stm32f303" ) ]
42+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
4343use cortex_m:: interrupt;
4444
4545/// Interrupt event
@@ -363,7 +363,7 @@ macro_rules! hal {
363363
364364 impl blocking:: serial:: write:: Default <u8 > for Tx <$USARTX> { }
365365
366- #[ cfg( feature = "stm32f303" ) ]
366+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
367367 impl Rx <$USARTX> {
368368 /// Fill the buffer with received data using DMA.
369369 pub fn read_exact<B , C >(
@@ -384,7 +384,7 @@ macro_rules! hal {
384384 }
385385 }
386386
387- #[ cfg( feature = "stm32f303" ) ]
387+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
388388 impl Tx <$USARTX> {
389389 /// Transmit all data in the buffer using DMA.
390390 pub fn write_all<B , C >(
@@ -405,7 +405,7 @@ macro_rules! hal {
405405 }
406406 }
407407
408- #[ cfg( feature = "stm32f303" ) ]
408+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
409409 impl dma:: Target for Rx <$USARTX> {
410410 fn enable_dma( & mut self ) {
411411 // NOTE(unsafe) critical section prevents races
@@ -424,7 +424,7 @@ macro_rules! hal {
424424 }
425425 }
426426
427- #[ cfg( feature = "stm32f303" ) ]
427+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
428428 impl dma:: Target for Tx <$USARTX> {
429429 fn enable_dma( & mut self ) {
430430 // NOTE(unsafe) critical section prevents races
@@ -446,24 +446,8 @@ macro_rules! hal {
446446 }
447447}
448448
449- #[ cfg( any(
450- feature = "stm32f301" ,
451- feature = "stm32f318" ,
452- feature = "stm32f303" ,
453- feature = "stm32f373" ,
454- feature = "stm32f378" ,
455- feature = "stm32f328" ,
456- feature = "stm32f358" ,
457- feature = "stm32f398"
458- ) ) ]
459449hal ! {
460450 USART1 : ( usart1, APB2 , usart1en, usart1rst, pclk2) ,
461451 USART2 : ( usart2, APB1 , usart2en, usart2rst, pclk1) ,
462452 USART3 : ( usart3, APB1 , usart3en, usart3rst, pclk1) ,
463453}
464-
465- #[ cfg( any( feature = "stm32f302" , feature = "stm32f334" ) ) ]
466- hal ! {
467- USART1 : ( usart1, APB2 , usart1en, usart1rst, pclk2) ,
468- USART2 : ( usart2, APB1 , usart2en, usart2rst, pclk1) ,
469- }
0 commit comments