HardFOC Core
API reference
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
HalI2cSe050Comm Class Reference

CRTP adapter mapping BaseI2c primitives to se050::I2cTransceiveInterface. More...

#include <Se050Handler.h>

Inheritance diagram for HalI2cSe050Comm:

Public Member Functions

 HalI2cSe050Comm (BaseI2c &i2c, BaseGpio *reset_gpio) noexcept
 Construct the CRTP I²C adapter.
 
bool EnsureInitialized () noexcept
 
se050::Error I2cWrite (const std::uint8_t *tx, std::size_t tx_len, std::uint32_t timeout_ms) noexcept
 Write bytes on I²C.
 
se050::Error I2cRead (std::uint8_t *rx, std::size_t rx_len, std::uint32_t timeout_ms) noexcept
 Read bytes on I²C.
 
se050::Error Transceive (const std::uint8_t *tx, std::size_t tx_len, std::uint8_t *rx, std::size_t rx_cap, std::size_t *rx_len_out, std::uint32_t timeout_ms) noexcept
 Combined write-then-read (T=1oI2C frame).
 
se050::Error HardwareReset () noexcept
 
void delay_ms_impl (std::uint32_t ms) noexcept
 
bool HoldBus (std::uint32_t timeout_ms) noexcept
 Hold the I²C bus across a T=1 APDU (Write/Read pairs). Nested I2cWrite/Read skip lock.
 
void ReleaseBus () noexcept
 
bool BusHeld () const noexcept
 

Private Attributes

BaseI2c & i2c_
 
BaseGpio * reset_gpio_
 
bool bus_held_ {false}
 

Detailed Description

CRTP adapter mapping BaseI2c primitives to se050::I2cTransceiveInterface.

Reset GPIO
When reset_gpio is non-null, HardwareReset() asserts reset with **SetInactive()**, waits 2 ms, then releases with **SetActive()** and waits 10 ms (same cadence as the ESP-IDF reference transport). Configure **BaseGpio** polarity so this sequence matches your SE_RESET wiring (typical nRESET: assert = drive low = logical inactive on an active-high GPIO).

Constructor & Destructor Documentation

◆ HalI2cSe050Comm()

HalI2cSe050Comm::HalI2cSe050Comm ( BaseI2c &  i2c,
BaseGpio *  reset_gpio 
)
inlinenoexcept

Construct the CRTP I²C adapter.

Parameters
i2cHost I²C device (typically 7-bit address 0x48).
reset_gpioOptional SE_RESET line; nullptr if unused.

Member Function Documentation

◆ BusHeld()

bool HalI2cSe050Comm::BusHeld ( ) const
inlinenoexcept

◆ delay_ms_impl()

void HalI2cSe050Comm::delay_ms_impl ( std::uint32_t  ms)
noexcept

◆ EnsureInitialized()

bool HalI2cSe050Comm::EnsureInitialized ( )
inlinenoexcept

◆ HardwareReset()

se050::Error HalI2cSe050Comm::HardwareReset ( )
noexcept

◆ HoldBus()

bool HalI2cSe050Comm::HoldBus ( std::uint32_t  timeout_ms)
noexcept

Hold the I²C bus across a T=1 APDU (Write/Read pairs). Nested I2cWrite/Read skip lock.

Parameters
timeout_msHow long to wait for the bus lock.

◆ I2cRead()

se050::Error HalI2cSe050Comm::I2cRead ( std::uint8_t *  rx,
std::size_t  rx_len,
std::uint32_t  timeout_ms 
)
noexcept

Read bytes on I²C.

Parameters
rxReceive buffer.
rx_lenByte count to read.
timeout_msTransfer deadline.

◆ I2cWrite()

se050::Error HalI2cSe050Comm::I2cWrite ( const std::uint8_t *  tx,
std::size_t  tx_len,
std::uint32_t  timeout_ms 
)
noexcept

Write bytes on I²C.

Parameters
txTransmit payload.
tx_lenByte count.
timeout_msTransfer deadline.

◆ ReleaseBus()

void HalI2cSe050Comm::ReleaseBus ( )
noexcept

◆ Transceive()

se050::Error HalI2cSe050Comm::Transceive ( const std::uint8_t *  tx,
std::size_t  tx_len,
std::uint8_t *  rx,
std::size_t  rx_cap,
std::size_t *  rx_len_out,
std::uint32_t  timeout_ms 
)
noexcept

Combined write-then-read (T=1oI2C frame).

Parameters
txTransmit payload.
tx_lenTransmit length.
rxReceive buffer.
rx_capReceive capacity.
rx_len_outActual bytes received.
timeout_msTransfer deadline.

Member Data Documentation

◆ bus_held_

bool HalI2cSe050Comm::bus_held_ {false}
private

◆ i2c_

BaseI2c& HalI2cSe050Comm::i2c_
private

◆ reset_gpio_

BaseGpio* HalI2cSe050Comm::reset_gpio_
private

The documentation for this class was generated from the following files: