[−][src]Struct Rusty_CryptoAuthLib::packet::ATCAPacket
Security commands are sent (over i2c) to the device and responses received from the device This struct holds 'input commands'. It does not include the 'data payload' section
Fields
pkt_id: u8
pkt_id: 1 byte value of 0x03 for normal operation
txsize: u8
1 byte value that represents the number of bytes to be transferred to the device
opcode: u8
Command Opcode
param1: u8
An additional 1 byte command parameter that must always be present. Value depends on the command being sent
param2: [u8; 2]
An additional 2 byte Command parameter that must always be present. Vlaue depends on the command being sent
req_data: &'a [u8]
data bytes
crc16: [u8; 2]
2 byte CRC
Implementations
impl<'a, '_> ATCAPacket<'_>
[src]
pub fn make_packet(
&mut self,
txsize: Option<u8>,
opcode: Option<u8>,
param1: Option<u8>,
param2: Option<[u8; 2]>
) -> &mut Self
[src]
&mut self,
txsize: Option<u8>,
opcode: Option<u8>,
param1: Option<u8>,
param2: Option<[u8; 2]>
) -> &mut Self
This methods constructs an input command packet. An input security command is sent after transmitting the 'i2c device address' and is broken down as follows
- pkt_id: 1 byte value of 0x03 for normal operation
- txsize: 1 byte value that represents the number of bytes to be transferred to the device, including count byte, packet bytes, and checksum bytes. The count byte should therefore always have a value of (N+1), where N is equal to the number of bytes in the packet plus the two checksum bytes.
- Param1: An additional 1 byte command parameter that must always be present. Value depends on the command being sent
- Param2: An additional 2 byte Command parameter that must always be present. Vlaue depends on the command being sent
pub fn crc(self, src: &[u8], length: usize) -> [u8; 2]
[src]
A method to calculate a 2 byte checksum value. The input to this method is a fully constructed input command packet along with its length.
Trait Implementations
impl<'a> Clone for ATCAPacket<'a>
[src]
fn clone(&self) -> ATCAPacket<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Copy for ATCAPacket<'a>
[src]
impl<'a> Debug for ATCAPacket<'a>
[src]
impl<'de: 'a, 'a> Deserialize<'de> for ATCAPacket<'a>
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> Eq for ATCAPacket<'a>
[src]
impl<'a> PartialEq<ATCAPacket<'a>> for ATCAPacket<'a>
[src]
fn eq(&self, other: &ATCAPacket<'a>) -> bool
[src]
fn ne(&self, other: &ATCAPacket<'a>) -> bool
[src]
impl<'a> Serialize for ATCAPacket<'a>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'a> StructuralEq for ATCAPacket<'a>
[src]
impl<'a> StructuralPartialEq for ATCAPacket<'a>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,