pca9641 v1.0.0 PCA9641.Registers
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)
read_control(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the control register.
Example
iex> read_control(conn)
{:ok, <<0>>}
read_id(conn)
read_id(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the id register.
Example
iex> read_id(conn)
{:ok, <<0>>}
read_interrupt_mask(conn)
read_interrupt_mask(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the interrupt_mask register.
Example
iex> read_interrupt_mask(conn)
{:ok, <<0>>}
read_interrupt_status(conn)
read_interrupt_status(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the interrupt_status register.
Example
iex> read_interrupt_status(conn)
{:ok, <<0>>}
read_mailbox_lsb(conn)
read_mailbox_lsb(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the mailbox_lsb register.
Example
iex> read_mailbox_lsb(conn)
{:ok, <<0>>}
read_mailbox_msb(conn)
read_mailbox_msb(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the mailbox_msb register.
Example
iex> read_mailbox_msb(conn)
{:ok, <<0>>}
read_reserve_time(conn)
read_reserve_time(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the reserve_time register.
Example
iex> read_reserve_time(conn)
{:ok, <<0>>}
read_status(conn)
read_status(Wafer.Conn.t()) :: {:ok, binary()} | {:error, reason :: any()}
Read the contents of the status register.
Example
iex> read_status(conn)
{:ok, <<0>>}
swap_control(conn, data)
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
iex> swap_control(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_interrupt_mask(conn, data)
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
iex> swap_interrupt_mask(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_interrupt_status(conn, data)
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
iex> swap_interrupt_status(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_mailbox_lsb(conn, data)
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
iex> swap_mailbox_lsb(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_mailbox_msb(conn, data)
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
iex> swap_mailbox_msb(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_reserve_time(conn, data)
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
iex> swap_reserve_time(conn, <<0>>)
{:ok, <<0>>, _conn}
swap_status(conn, data)
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
iex> swap_status(conn, <<0>>)
{:ok, <<0>>, _conn}
update_control(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_control(conn, transform)
{:ok, _conn}
update_interrupt_mask(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_interrupt_mask(conn, transform)
{:ok, _conn}
update_interrupt_status(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_interrupt_status(conn, transform)
{:ok, _conn}
update_mailbox_lsb(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_mailbox_lsb(conn, transform)
{:ok, _conn}
update_mailbox_msb(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_mailbox_msb(conn, transform)
{:ok, _conn}
update_reserve_time(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_reserve_time(conn, transform)
{:ok, _conn}
update_status(conn, callback)
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
iex> transform = fn <<data::size(8)>> -> <<(data * 2)::size(8)>> end
...> update_status(conn, transform)
{:ok, _conn}
write_control(conn, data)
write_control(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the control register.
Example
iex> write_control(conn, <<0>>)
{:ok, _conn}
write_interrupt_mask(conn, data)
write_interrupt_mask(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the interrupt_mask register.
Example
iex> write_interrupt_mask(conn, <<0>>)
{:ok, _conn}
write_interrupt_status(conn, data)
write_interrupt_status(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the interrupt_status register.
Example
iex> write_interrupt_status(conn, <<0>>)
{:ok, _conn}
write_mailbox_lsb(conn, data)
write_mailbox_lsb(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the mailbox_lsb register.
Example
iex> write_mailbox_lsb(conn, <<0>>)
{:ok, _conn}
write_mailbox_msb(conn, data)
write_mailbox_msb(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the mailbox_msb register.
Example
iex> write_mailbox_msb(conn, <<0>>)
{:ok, _conn}
write_reserve_time(conn, data)
write_reserve_time(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the reserve_time register.
Example
iex> write_reserve_time(conn, <<0>>)
{:ok, _conn}
write_status(conn, data)
write_status(Wafer.Conn.t(), data :: binary()) :: {:ok, Wafer.Conn.t()} | {:error, reason :: any()}
Write new contents to the status register.
Example
iex> write_status(conn, <<0>>)
{:ok, _conn}