ATECC508A.Request (atecc508a v0.2.2) 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

Specs

access_data() :: <<_::32>> | <<_::256>>

Specs

access_size() :: 4 | 32

Specs

addr() :: 0..65535

Specs

block() :: 0..3

Specs

offset() :: 0..7

Specs

slot() :: 0..15

Specs

transaction() :: {binary(), non_neg_integer(), non_neg_integer()}

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.

Specs

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

Link to this section Functions

Link to this function

genkey(transport, key_id, create_key?)

View Source

Specs

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

Specs

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

Specs

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

Create a message to lock a zone.

Specs

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

Request a random number.

Link to this function

read_zone(transport, zone, addr, length)

View Source

Specs

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

Specs

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

to_config_addr(block, offset)

View Source

Specs

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

to_data_addr(slot, byte_offset)

View Source

Specs

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

to_data_addr(slot, block, offset)

View Source

Specs

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

to_otp_addr(byte_offset)

View Source

Specs

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

to_otp_addr(block, offset)

View Source

Specs

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

write_zone(transport, zone, addr, data)

View Source

Specs

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

Create a write message