Merge #991
991: usb: remove all "Direction as u8" casts. r=Dirbaio a=Dirbaio Alternative fix for #989 , see comment there for rationale. bors r+ Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
This commit is contained in:
		
						commit
						1d6f5493e7
					
				@ -54,12 +54,16 @@ impl From<EndpointAddress> for u8 {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl EndpointAddress {
 | 
					impl EndpointAddress {
 | 
				
			||||||
    const INBITS: u8 = Direction::In as u8;
 | 
					    const INBITS: u8 = 0x80;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Constructs a new EndpointAddress with the given index and direction.
 | 
					    /// Constructs a new EndpointAddress with the given index and direction.
 | 
				
			||||||
    #[inline]
 | 
					    #[inline]
 | 
				
			||||||
    pub fn from_parts(index: usize, dir: Direction) -> Self {
 | 
					    pub fn from_parts(index: usize, dir: Direction) -> Self {
 | 
				
			||||||
        EndpointAddress(index as u8 | dir as u8)
 | 
					        let dir_u8 = match dir {
 | 
				
			||||||
 | 
					            Direction::Out => 0x00,
 | 
				
			||||||
 | 
					            Direction::In => Self::INBITS,
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        EndpointAddress(index as u8 | dir_u8)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Gets the direction part of the address.
 | 
					    /// Gets the direction part of the address.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user