ATECC508A.Configuration (atecc508a v1.4.0)

Copy Markdown View Source

This module handles operations on the configuration zone.

Summary

Functions

Convert a raw configuration to a nice map in the style of an ATECC608 chip.

Convert a raw configuration to a nice map.

Lock the configuration zone.

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.

Types

t()

@type t() :: %ATECC508A.Configuration{
  chip_mode: non_neg_integer(),
  counter0: non_neg_integer(),
  counter1: non_neg_integer(),
  i2c_address: Circuits.I2C.address(),
  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>>
}

Functions

from_raw608(raw)

@spec from_raw608(<<_::1024>>) :: ATECC508A.Configuration.Config608.t()

Convert a raw configuration to a nice map in the style of an ATECC608 chip.

from_raw(arg)

@spec from_raw(<<_::1024>>) :: t()

Convert a raw configuration to a nice map.

lock(transport, expected_contents)

@spec lock(ATECC508A.Transport.t(), t() | ATECC508A.Configuration.Config608.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.

read(transport, features \\ :atecc508)

@spec read(ATECC508A.Transport.t(), :atecc508 | :atecc608) ::
  {:ok, t() | ATECC508A.Configuration.Config608.t()} | {:error, atom()}

Read the configuration

read_all_raw(transport)

@spec read_all_raw(ATECC508A.Transport.t()) :: {:ok, <<_::1024>>} | {:error, atom()}

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

read_key_config(transport)

@spec read_key_config(ATECC508A.Transport.t()) :: {:ok, <<_::256>>} | {:error, atom()}

Read the current slot configuration

read_slot_config(transport)

@spec read_slot_config(ATECC508A.Transport.t()) ::
  {:ok, <<_::256>>} | {:error, atom()}

Read the current slot configuration

supports_volatile?(arg1)

@spec supports_volatile?(t()) :: boolean()

to_raw(info)

@spec to_raw(t() | ATECC508A.Configuration.Config608.t()) :: <<_::1024>>

Convert a nice config map back to a raw configuration

write(transport, info)

@spec write(ATECC508A.Transport.t(), t() | ATECC508A.Configuration.Config608.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.

write_key_config(transport, data)

@spec write_key_config(ATECC508A.Transport.t(), <<_::256>>) :: :ok | {:error, atom()}

Write the key configuration.

write_slot_config(transport, data)

@spec write_slot_config(ATECC508A.Transport.t(), <<_::256>>) :: :ok | {:error, atom()}

Write a slot configuration.