atecc508a v0.2.1 ATECC508A.Request View Source

This module knows how to send requests to the ATECC508A.

Link to this section Summary

Types

A transaction is a tuple with the binary to send, how long to wait in milliseconds for the response and the size of payload to expect to read for the response.

Link to this section Types

Link to this type

access_data()

View Source
access_data() :: <<_::32>> | <<_::256>>
Link to this type

access_size()

View Source
access_size() :: 4 | 32
Link to this type

addr()

View Source
addr() :: 0..65535
Link to this type

block()

View Source
block() :: 0..3
Link to this type

offset()

View Source
offset() :: 0..7
Link to this type

slot()

View Source
slot() :: 0..15

A transaction is a tuple with the binary to send, how long to wait in milliseconds for the response and the size of payload to expect to read for the response.

Link to this type

zone()

View Source
zone() :: :config | :otp | :data

Link to this section Functions

Link to this function

genkey(transport, key_id, create_key?)

View Source
genkey(ATECC508A.Transport.t(), slot(), boolean()) ::
  {:ok, binary()} | {:error, atom()}

Create a genkey request message.

Link to this function

lock_slot(transport, slot)

View Source
lock_slot(ATECC508A.Transport.t(), slot()) :: :ok | {:error, atom()}

Lock a specific slot.

Link to this function

lock_zone(transport, zone, zone_crc)

View Source
lock_zone(ATECC508A.Transport.t(), zone(), ATECC508A.crc16()) ::
  :ok | {:error, atom()}

Create a message to lock a zone.

Link to this function

random(transport)

View Source
random(ATECC508A.Transport.t()) :: {:ok, binary()} | {:error, atom()}

Request a random number.

Link to this function

read_zone(transport, zone, addr, length)

View Source
read_zone(ATECC508A.Transport.t(), zone(), addr(), access_size()) ::
  {:ok, binary()} | {:error, atom()}

Create a read message

Link to this function

to_config_addr(byte_offset)

View Source
to_config_addr(0..127) :: addr()
Link to this function

to_config_addr(block, offset)

View Source
to_config_addr(block(), offset()) :: addr()
Link to this function

to_data_addr(slot, byte_offset)

View Source
to_data_addr(slot(), 0..416) :: addr()
Link to this function

to_data_addr(slot, block, offset)

View Source
to_data_addr(slot(), block(), offset()) :: addr()
Link to this function

to_otp_addr(byte_offset)

View Source
to_otp_addr(0..127) :: addr()
Link to this function

to_otp_addr(block, offset)

View Source
to_otp_addr(block(), offset()) :: addr()
Link to this function

write_zone(transport, zone, addr, data)

View Source
write_zone(ATECC508A.Transport.t(), zone(), addr(), access_data()) ::
  :ok | {:error, atom()}

Create a write message