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

Thread-safe AT25040B EEPROM façade (BaseSpi + optional /WP GPIO). More...

#include <At25040Handler.h>

Public Types

enum class  ProbeResult : uint8_t { NotBound = 0 , Absent = 1 , Present = 2 }
 Result of a non-destructive presence probe. More...
 

Public Member Functions

 At25040Handler (BaseSpi &spi, BaseGpio *wp=nullptr) noexcept
 
ProbeResult Probe () noexcept
 SPI probe; does not parse product identity.
 
uint8_t LastRdsr () const noexcept
 
bool Read (uint16_t addr, uint8_t *dst, uint16_t len) noexcept
 Read len bytes starting at addr.
 
bool Write (uint16_t addr, const uint8_t *src, uint16_t len) noexcept
 Page-loop write. Caller owns identity / calibration policy.
 
void ReleaseWriteProtect () noexcept
 Drive /WP inactive so page writes can proceed.
 
void ParkWriteProtect () noexcept
 Drive /WP active (protect) after a write burst.
 

Private Attributes

At25040SpiAdapter adapter_
 
at25040::Device< At25040SpiAdapter > device_
 
BaseGpio * wp_ {nullptr}
 
RtosMutex mutex_ {}
 

Detailed Description

Thread-safe AT25040B EEPROM façade (BaseSpi + optional /WP GPIO).

Member Enumeration Documentation

◆ ProbeResult

enum class At25040Handler::ProbeResult : uint8_t
strong

Result of a non-destructive presence probe.

Enumerator
NotBound 

SPI not attached / constructor-only state.

Absent 

Bus answered with no device.

Present 

RDSR / identity bytes look like AT25040.

Constructor & Destructor Documentation

◆ At25040Handler()

At25040Handler::At25040Handler ( BaseSpi &  spi,
BaseGpio *  wp = nullptr 
)
inlineexplicitnoexcept
Parameters
spiHost SPI (CS already bound on the BaseSpi instance).
wpOptional write-protect GPIO; nullptr if /WP is hard-wired.

Member Function Documentation

◆ LastRdsr()

uint8_t At25040Handler::LastRdsr ( ) const
inlinenoexcept
Returns
Last RDSR byte captured by the driver.

◆ ParkWriteProtect()

void At25040Handler::ParkWriteProtect ( )
noexcept

Drive /WP active (protect) after a write burst.

◆ Probe()

At25040Handler::ProbeResult At25040Handler::Probe ( )
noexcept

SPI probe; does not parse product identity.

◆ Read()

bool At25040Handler::Read ( uint16_t  addr,
uint8_t *  dst,
uint16_t  len 
)
noexcept

Read len bytes starting at addr.

Parameters
addrEEPROM address.
dstDestination buffer (must hold len bytes).
lenByte count.
Returns
true on a complete read.

◆ ReleaseWriteProtect()

void At25040Handler::ReleaseWriteProtect ( )
noexcept

Drive /WP inactive so page writes can proceed.

◆ Write()

bool At25040Handler::Write ( uint16_t  addr,
const uint8_t *  src,
uint16_t  len 
)
noexcept

Page-loop write. Caller owns identity / calibration policy.

Parameters
addrEEPROM address.
srcSource buffer.
lenByte count.
Returns
true when every page was written and its write cycle ended (the driver waits up to 10 ms per page); /WP is parked again on every path.

Member Data Documentation

◆ adapter_

At25040SpiAdapter At25040Handler::adapter_
private

◆ device_

at25040::Device<At25040SpiAdapter> At25040Handler::device_
private

◆ mutex_

RtosMutex At25040Handler::mutex_ {}
mutableprivate

◆ wp_

BaseGpio* At25040Handler::wp_ {nullptr}
private

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