stm32-async-1wire 3.2.0
Non-blocking 1-Wire master for STM32 with DS18B20 temperature and DS2431 EEPROM drivers
Loading...
Searching...
No Matches
Generic Non-Blocking Search ROM Engine

Implements the Maxim Search ROM (0xF0) / Alarm Search (0xEC) algorithm as a polled state machine. The direction bit written at position i determines which devices keep participating at position i+1, so the transaction cannot be batched into one DMA pass; the linear loop is decomposed into states with loop counters kept in the context. Every state performs exactly one hardware-timed operation, and no search stage is long enough to become a low-power wait, so a poll call returns straight away. More...

Typedefs

typedef uint8_t(* onewire_search_sink_t) (const uint8_t *rom)
 Per-device callback invoked by the search engine.

Functions

void onewire_search_start (onewire_search_sink_t sink, uint8_t max_devices, uint8_t command, uint8_t family)
 Start a non-blocking search (Search ROM or Alarm Search).
uint8_t onewire_search_poll (void)
 Advance the non-blocking search by one hardware operation.
uint8_t onewire_search_count (void)
 Number of devices found (valid once the search finished).
uint8_t onewire_search_active (void)
 Check whether a search is currently running.

Detailed Description

Implements the Maxim Search ROM (0xF0) / Alarm Search (0xEC) algorithm as a polled state machine. The direction bit written at position i determines which devices keep participating at position i+1, so the transaction cannot be batched into one DMA pass; the linear loop is decomposed into states with loop counters kept in the context. Every state performs exactly one hardware-timed operation, and no search stage is long enough to become a low-power wait, so a poll call returns straight away.

Typedef Documentation

◆ onewire_search_sink_t

typedef uint8_t(* onewire_search_sink_t) (const uint8_t *rom)

Per-device callback invoked by the search engine.

Function Documentation

◆ onewire_search_active()

uint8_t onewire_search_active ( void )

Check whether a search is currently running.

Returns
1 while the search owns the timer, 0 when it is idle

◆ onewire_search_count()

uint8_t onewire_search_count ( void )

Number of devices found (valid once the search finished).

Returns
Count of found devices

◆ onewire_search_poll()

uint8_t onewire_search_poll ( void )

Advance the non-blocking search by one hardware operation.

Returns
1 when the search is finished, 0 while still running

◆ onewire_search_start()

void onewire_search_start ( onewire_search_sink_t sink,
uint8_t max_devices,
uint8_t command,
uint8_t family )

Start a non-blocking search (Search ROM or Alarm Search).

Parameters
[in]sinkCallback invoked per found device (may be NULL). A non-zero return value stops the search early.
[in]max_devicesMaximum number of devices to report (0 aborts)
[in]commandSearch command byte (0xF0 Search ROM / 0xEC Alarm Search)
[in]family1-Wire family code to accept, or 0 to accept every family. Only accepted devices increment the found counter and reach the sink.
Note
Ignores the call while a search pass is already running. Arbitration of the shared bus/timer against other 1-Wire operations lives in the ds18b20_* layer, not here.