stm32: can: fd: fix SID read/write from buf elems
This commit is contained in:
		
							parent
							
								
									d5a2b3be58
								
							
						
					
					
						commit
						e63b0d7a2f
					
				@ -721,13 +721,15 @@ fn make_id(id: u32, extended: bool) -> embedded_can::Id {
 | 
				
			|||||||
    if extended {
 | 
					    if extended {
 | 
				
			||||||
        embedded_can::Id::from(unsafe { embedded_can::ExtendedId::new_unchecked(id & 0x1FFFFFFF) })
 | 
					        embedded_can::Id::from(unsafe { embedded_can::ExtendedId::new_unchecked(id & 0x1FFFFFFF) })
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        embedded_can::Id::from(unsafe { embedded_can::StandardId::new_unchecked((id & 0x000007FF) as u16) })
 | 
					        // A standard identifier is stored into ID[28:18].
 | 
				
			||||||
 | 
					        embedded_can::Id::from(unsafe { embedded_can::StandardId::new_unchecked(((id >> 18) & 0x000007FF) as u16) })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn put_tx_header(mailbox: &mut TxBufferElement, header: &Header) {
 | 
					fn put_tx_header(mailbox: &mut TxBufferElement, header: &Header) {
 | 
				
			||||||
    let (id, id_type) = match header.id() {
 | 
					    let (id, id_type) = match header.id() {
 | 
				
			||||||
        embedded_can::Id::Standard(id) => (id.as_raw() as u32, IdType::StandardId),
 | 
					        // A standard identifier has to be written to ID[28:18].
 | 
				
			||||||
 | 
					        embedded_can::Id::Standard(id) => ((id.as_raw() as u32) << 18, IdType::StandardId),
 | 
				
			||||||
        embedded_can::Id::Extended(id) => (id.as_raw() as u32, IdType::ExtendedId),
 | 
					        embedded_can::Id::Extended(id) => (id.as_raw() as u32, IdType::ExtendedId),
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user