atecc508a v0.1.0 ATECC508A.Configuration

This module handles operations on the configuration zone.

Link to this section Summary

Functions

Convert a raw configuration to a nice map

Lock the configuration zone

Read the configuration

Read the entire contents of the configuration zone and don’t interpret them

Read the current slot configuration

Read the current slot configuration

Convert a nice config map back to a raw configuration

Write the configuration

Write the key configuration

Write a slot configuration

Link to this section Types

Link to this type t()
t() :: %ATECC508A.Configuration{
  chip_mode: non_neg_integer(),
  counter0: non_neg_integer(),
  counter1: non_neg_integer(),
  i2c_address: non_neg_integer(),
  i2c_enable: byte(),
  key_config: <<_::256>>,
  last_key_use: binary(),
  lock_config: non_neg_integer(),
  lock_value: non_neg_integer(),
  otp_mode: non_neg_integer(),
  reserved0: byte(),
  reserved1: byte(),
  reserved2: byte(),
  rev_num: atom() | binary(),
  rfu: <<_::16>>,
  selector: non_neg_integer(),
  serial_number: binary(),
  slot_config: <<_::256>>,
  slot_locked: non_neg_integer(),
  user_extra: non_neg_integer(),
  x509_format: <<_::32>>
}

Link to this section Functions

Link to this function from_raw(arg)
from_raw(<<_::1024>>) :: t()

Convert a raw configuration to a nice map.

Link to this function lock(transport, expected_contents)
lock(ATECC508A.Transport.t(), t()) :: :ok | {:error, atom()}

Lock the configuration zone.

The expected contents need to be passed for a CRC calculation. They are not written by design. The logic is that this is a final chance before it’s too late to check that the device is programmed correctly.

Link to this function read(transport)
read(ATECC508A.Transport.t()) :: {:ok, t()} | {:error, atom()}

Read the configuration

Link to this function read_all_raw(transport)
read_all_raw(ATECC508A.Transport.t()) :: {:ok, <<_::1024>>} | {:error, atom()}

Read the entire contents of the configuration zone and don’t interpret them

Link to this function read_key_config(transport)
read_key_config(ATECC508A.Transport.t()) :: {:ok, <<_::256>>} | {:error, atom()}

Read the current slot configuration

Link to this function read_slot_config(transport)
read_slot_config(ATECC508A.Transport.t()) ::
  {:ok, <<_::256>>} | {:error, atom()}

Read the current slot configuration

Link to this function to_raw(info)
to_raw(t()) :: <<_::1024>>

Convert a nice config map back to a raw configuration

Link to this function write(transport, info)
write(ATECC508A.Transport.t(), t()) :: :ok | {:error, atom()}

Write the configuration.

This only works when the ATECC508A is unlocked and only bytes not all bytes can be changed. This only writes the ones that can.

Link to this function write_key_config(transport, data)
write_key_config(ATECC508A.Transport.t(), <<_::256>>) :: :ok | {:error, atom()}

Write the key configuration.

Link to this function write_slot_config(transport, data)
write_slot_config(ATECC508A.Transport.t(), <<_::256>>) :: :ok | {:error, atom()}

Write a slot configuration.