feat(ds18b20-ds2480): добавь порт F407 и асинхронную подтяжку

This commit is contained in:
2026-09-15 22:32:30 +03:00
parent df02070cc4
commit 3020de7e0c
7 changed files with 223 additions and 9 deletions

View File

@@ -10,7 +10,7 @@ extern "C" {
typedef enum {
DS2480_OK = 0, DS2480_DONE, DS2480_NO_PRESENCE, DS2480_SHORT,
DS2480_IO, DS2480_PROTOCOL, DS2480_CRC, DS2480_ARGUMENT,
DS2480_NOT_READY, DS2480_DATA
DS2480_NOT_READY, DS2480_DATA, DS2480_BUSY
} ds2480_status;
/** Blocking UART callbacks: 0 = success, nonzero = error/timeout.
@@ -33,6 +33,7 @@ typedef struct {
ds2480_port port;
uint32_t timeout_ms;
uint8_t ready;
uint8_t power_active;
} ds2480;
/** Independent ROM search cursor. Zero-initialize before each enumeration. */
@@ -56,6 +57,14 @@ ds2480_status ds2480_byte(ds2480 *bus, uint8_t value, uint8_t *received);
* Blocks for hold_ms (1..1000), then terminates the pulse and consumes reply.
*/
ds2480_status ds2480_power_byte(ds2480 *bus, uint8_t value, uint32_t hold_ms);
/** Start indefinite strong pullup after the final bit; returns immediately
* after UART exchange. Until power_end, other bus operations return BUSY.
* Application MUST call power_end after the sensor's required hold time,
* or init to cancel/recover. No internal timer/interrupt releases the pulse.
*/
ds2480_status ds2480_power_begin(ds2480 *bus, uint8_t value);
/** Release strong pullup, consume its reply. Idempotent when ready/idle. */
ds2480_status ds2480_power_end(ds2480 *bus);
/** CRC8 Dallas/Maxim. data must address size bytes (NULL allowed for size=0). */
uint8_t ds2480_crc8(const uint8_t *data, uint32_t size);
/** Search ALL families. OK yields ROM with valid CRC; DONE ends enumeration.