|
stm32-async-1wire 3.2.0
Non-blocking 1-Wire master for STM32 with DS18B20 temperature and DS2431 EEPROM drivers
|
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. | |
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 uint8_t(* onewire_search_sink_t) (const uint8_t *rom) |
Per-device callback invoked by the search engine.
| uint8_t onewire_search_active | ( | void | ) |
Check whether a search is currently running.
| uint8_t onewire_search_count | ( | void | ) |
Number of devices found (valid once the search finished).
| uint8_t onewire_search_poll | ( | void | ) |
Advance the non-blocking search by one hardware operation.
| 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).
| [in] | sink | Callback invoked per found device (may be NULL). A non-zero return value stops the search early. |
| [in] | max_devices | Maximum number of devices to report (0 aborts) |
| [in] | command | Search command byte (0xF0 Search ROM / 0xEC Alarm Search) |
| [in] | family | 1-Wire family code to accept, or 0 to accept every family. Only accepted devices increment the found counter and reach the sink. |