PCA9641.Registers (pca9641 v2.0.0)
This module provides a wrapper around the PCA9641 registers described in NXP's datasheet.
Link to this section Summary
Functions
Read the contents of the control register.
Read the contents of the id register.
Read the contents of the interrupt_mask register.
Read the contents of the interrupt_status register.
Read the contents of the mailbox_lsb register.
Read the contents of the mailbox_msb register.
Read the contents of the reserve_time register.
Read the contents of the status register.
Swap the contents of the control register.
Swap the contents of the interrupt_mask register.
Swap the contents of the interrupt_status register.
Swap the contents of the mailbox_lsb register.
Swap the contents of the mailbox_msb register.
Swap the contents of the reserve_time register.
Swap the contents of the status register.
Update the contents of the control register using a
transformation function.
Update the contents of the interrupt_mask register using a
transformation function.
Update the contents of the interrupt_status register using a
transformation function.
Update the contents of the mailbox_lsb register using a
transformation function.
Update the contents of the mailbox_msb register using a
transformation function.
Update the contents of the reserve_time register using a
transformation function.
Update the contents of the status register using a
transformation function.
Write new contents to the control register.
Write new contents to the interrupt_mask register.
Write new contents to the interrupt_status register.
Write new contents to the mailbox_lsb register.
Write new contents to the mailbox_msb register.
Write new contents to the reserve_time register.
Write new contents to the status register.
Link to this section Functions
read_control(conn)
@spec read_control(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the control register.
example
Example
iex> read_control(conn)
{:ok, <<0>>}
read_id(conn)
@spec read_id(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the id register.
example
Example
iex> read_id(conn)
{:ok, <<0>>}
read_interrupt_mask(conn)
@spec read_interrupt_mask(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the interrupt_mask register.
example
Example
iex> read_interrupt_mask(conn)
{:ok, <<0>>}
read_interrupt_status(conn)
@spec read_interrupt_status(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the interrupt_status register.
example
Example
iex> read_interrupt_status(conn)
{:ok, <<0>>}
read_mailbox_lsb(conn)
@spec read_mailbox_lsb(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the mailbox_lsb register.
example
Example
iex> read_mailbox_lsb(conn)
{:ok, <<0>>}
read_mailbox_msb(conn)
@spec read_mailbox_msb(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the mailbox_msb register.
example
Example
iex> read_mailbox_msb(conn)
{:ok, <<0>>}
read_reserve_time(conn)
@spec read_reserve_time(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the reserve_time register.
example
Example
iex> read_reserve_time(conn)
{:ok, <<0>>}
read_status(conn)
@spec read_status(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the status register.
example
Example
iex> read_status(conn)
{:ok, <<0>>}
swap_control(conn, data)
@spec swap_control(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the control register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_control(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_interrupt_mask(conn, data)
@spec swap_interrupt_mask(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the interrupt_mask register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_interrupt_mask(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_interrupt_status(conn, data)
@spec swap_interrupt_status(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the interrupt_status register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_interrupt_status(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_mailbox_lsb(conn, data)
@spec swap_mailbox_lsb(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the mailbox_lsb register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_mailbox_lsb(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_mailbox_msb(conn, data)
@spec swap_mailbox_msb(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the mailbox_msb register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_mailbox_msb(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_reserve_time(conn, data)
@spec swap_reserve_time(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the reserve_time register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_reserve_time(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_status(conn, data)
@spec swap_status(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Swap the contents of the status register.
Reads the contents of the register, then replaces it, returning the previous contents. Some drivers may implement this atomically.
example
Example
iex> swap_status(conn, <<0>>)
{:ok, <<0>>, _conn}
update_control(conn, callback)
@spec update_control(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the control register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_control(conn, transform)
{:ok, _conn}
update_interrupt_mask(conn, callback)
@spec update_interrupt_mask(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the interrupt_mask register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_interrupt_mask(conn, transform)
{:ok, _conn}
update_interrupt_status(conn, callback)
@spec update_interrupt_status(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the interrupt_status register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_interrupt_status(conn, transform)
{:ok, _conn}
update_mailbox_lsb(conn, callback)
@spec update_mailbox_lsb(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the mailbox_lsb register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_mailbox_lsb(conn, transform)
{:ok, _conn}
update_mailbox_msb(conn, callback)
@spec update_mailbox_msb(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the mailbox_msb register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_mailbox_msb(conn, transform)
{:ok, _conn}
update_reserve_time(conn, callback)
@spec update_reserve_time(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the reserve_time register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_reserve_time(conn, transform)
{:ok, _conn}
update_status(conn, callback)
@spec update_status(Wafer.Conn.t(), (<<_::_*8>> -> <<_::_*8>>)) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Update the contents of the status register using a
transformation function.
example
Example
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_status(conn, transform)
{:ok, _conn}
write_control(conn, data)
@spec write_control(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the control register.
example
Example
iex> write_control(conn, <<0>>)
{:ok, _conn}
write_interrupt_mask(conn, data)
@spec write_interrupt_mask(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the interrupt_mask register.
example
Example
iex> write_interrupt_mask(conn, <<0>>)
{:ok, _conn}
write_interrupt_status(conn, data)
@spec write_interrupt_status(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the interrupt_status register.
example
Example
iex> write_interrupt_status(conn, <<0>>)
{:ok, _conn}
write_mailbox_lsb(conn, data)
@spec write_mailbox_lsb(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the mailbox_lsb register.
example
Example
iex> write_mailbox_lsb(conn, <<0>>)
{:ok, _conn}
write_mailbox_msb(conn, data)
@spec write_mailbox_msb(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the mailbox_msb register.
example
Example
iex> write_mailbox_msb(conn, <<0>>)
{:ok, _conn}
write_reserve_time(conn, data)
@spec write_reserve_time(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the reserve_time register.
example
Example
iex> write_reserve_time(conn, <<0>>)
{:ok, _conn}
write_status(conn, data)
@spec write_status(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the status register.
example
Example
iex> write_status(conn, <<0>>)
{:ok, _conn}