SPI communication functions for the ST25R100. Separates pure binary payload construction from side-effecting hardware execution.
Summary
Functions
Builds the SPI packet to execute the direct command cmd.
Uses write format (Bit 7 = 0) with command ID.
Builds the SPI packet to read length bytes from the FIFO buffer.
Uses pseudo-register 0x5F read format.
Builds the SPI packet to read length bytes starting from register reg.
Address format: Bit 7 = 1 (read), Bits 6:0 = register address.
Builds the SPI packet to write data into the FIFO buffer.
Uses pseudo-register 0x5F write format.
Builds the SPI packet to write val to register reg.
Address format: Bit 7 = 0 (write), Bits 6:0 = register address.
Modifies specific bits in register reg using a mask and value.
new_value = (current_value & ~mask) | (value & mask)
Clears the specified bit flags in register reg.
Executes a direct command on the chip.
Reads length bytes from the chip's FIFO.
Reads length multiple registers sequentially (auto-increment read).
Reads a single byte from register reg.
Sets the specified bit flags in register reg.
Writes raw binary payload data into the chip's FIFO.
Writes a single byte val to register reg.
Functions
Builds the SPI packet to execute the direct command cmd.
Uses write format (Bit 7 = 0) with command ID.
@spec build_read_fifo(pos_integer()) :: binary()
Builds the SPI packet to read length bytes from the FIFO buffer.
Uses pseudo-register 0x5F read format.
@spec build_read_register(byte(), pos_integer()) :: binary()
Builds the SPI packet to read length bytes starting from register reg.
Address format: Bit 7 = 1 (read), Bits 6:0 = register address.
Builds the SPI packet to write data into the FIFO buffer.
Uses pseudo-register 0x5F write format.
Builds the SPI packet to write val to register reg.
Address format: Bit 7 = 0 (write), Bits 6:0 = register address.
Modifies specific bits in register reg using a mask and value.
new_value = (current_value & ~mask) | (value & mask)
Clears the specified bit flags in register reg.
Executes a direct command on the chip.
Reads length bytes from the chip's FIFO.
Reads length multiple registers sequentially (auto-increment read).
Reads a single byte from register reg.
Sets the specified bit flags in register reg.
Writes raw binary payload data into the chip's FIFO.
Writes a single byte val to register reg.