LinuxI2cNciPacketIo

class LinuxI2cNciPacketIo(val i2cDevicePath: String = defaultI2cDevicePath(), val i2cAddress: Int = defaultI2cAddress(), val gpioChipPath: String = defaultGpioChipPath(), val irqGpioPin: Int = defaultIrqGpioPin(), val venGpioPin: Int = defaultVenGpioPin()) : NciPacketIo

Linux I2C (/dev/i2c-*) + GPIO character device v2 (/dev/gpiochip*) implementation of NciPacketIo for NXP PN7160 / PN7150 NFC controllers (such as the NXP OM27160A1EVK board on Raspberry Pi 5).

Requires net.java.dev.jna:jna on the runtime classpath and read/write access to the configured /dev/i2c-* and /dev/gpiochip* device nodes (on Raspberry Pi OS, add the user to the i2c and gpio groups).

Parameters

i2cDevicePath

Path to the Linux I2C controller character device (e.g. "/dev/i2c-1").

i2cAddress

7-bit I2C target address of the NFC controller (e.g. 0x28 for NXP PN7160).

gpioChipPath

Path to the Linux GPIO chip character device (e.g. "/dev/gpiochip0").

irqGpioPin

GPIO line offset for the active-high IRQ pin (e.g. 23 on OM27160A1EVK).

venGpioPin

GPIO line offset for the active-high VEN reset/enable pin (e.g. 24 on OM27160A1EVK).

Constructors

Link copied to clipboard
constructor(i2cDevicePath: String = defaultI2cDevicePath(), i2cAddress: Int = defaultI2cAddress(), gpioChipPath: String = defaultGpioChipPath(), irqGpioPin: Int = defaultIrqGpioPin(), venGpioPin: Int = defaultVenGpioPin())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()

Closes the underlying transport, powers down the controller if applicable, and unblocks any pending readPacket call.

Link copied to clipboard
open suspend override fun readPacket(): ByteArray?

Reads the next complete NCI packet from the controller, or returns null if closed.

Link copied to clipboard
open suspend override fun resetHardware()

Performs a hardware power-cycle / reset of the NFC controller (for example, toggling the VEN GPIO pin low and then high).

Link copied to clipboard
open suspend override fun writePacket(packet: ByteArray)

Writes a complete NCI packet to the controller.