stm32-async-1wire 3.2.0
Non-blocking 1-Wire master for STM32 with DS18B20 temperature and DS2431 EEPROM drivers
Loading...
Searching...
No Matches
ds2431.h
Go to the documentation of this file.
1
55
56#ifndef DS2431_H
57#define DS2431_H
58
59#include "ow_config.h"
60#include "ow_version.h"
61#include <stdint.h>
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
71
77#define DS2431_FAMILY_CODE 0x2D
78
82#define DS2431_BITS_PER_BYTE 8
83
87#define DS2431_ROM_BYTES 8
88
92#define DS2431_EEPROM_SIZE 128
93
97#define DS2431_PAGE_SIZE 32
98
102#define DS2431_PAGE_COUNT (DS2431_EEPROM_SIZE / DS2431_PAGE_SIZE)
103
109#define DS2431_SCRATCH_SIZE 8
110
119#define DS2431_SCRATCH_FRAME (DS2431_SCRATCH_SIZE + 3)
120
130#define DS2431_SCRATCH_FRAME_CRC (DS2431_SCRATCH_FRAME + 2)
131
138#define DS2431_READ_MEMORY 0xF0
139
146#define DS2431_WRITE_SCRATCHPAD 0x0F
147
161#define DS2431_READ_SCRATCHPAD 0xAA
162
176#define DS2431_COPY_SCRATCHPAD 0x55
177
182#define DS2431_MATCH_ROM 0x55
183
187#define DS2431_SKIP_ROM 0xCC
188
194#define DS2431_TPROG_US 11000
195
202#define DS2431_READ_PASS 8
203
207
212
227void ds2431_init(void);
228
242void ds2431_select(const uint8_t* rom);
243
254void ds2431_set_parasite(uint8_t parasite);
255
262
272
283void ds2431_read_memory(uint8_t* dst, uint16_t addr, uint8_t len);
284
290
310uint8_t ds2431_write_scratchpad(uint16_t addr, const uint8_t* data, uint8_t len);
311
317
334void ds2431_read_scratchpad(uint8_t* buf);
335
341
353
359
363
364#ifdef __cplusplus
365}
366#endif
367
368#endif // DS2431_H
void ds2431_init(void)
Initialize DS2431 driver hardware and peripherals.
uint8_t ds2431_write_scratchpad(uint16_t addr, const uint8_t *data, uint8_t len)
Write up to 8 bytes into the scratchpad (non-blocking).
uint8_t ds2431_parasite_mode(void)
Current parasite-power configuration of the driver.
uint8_t ds2431_read_memory_poll(void)
Advance the non-blocking Read Memory operation.
uint8_t ds2431_copy_scratchpad_poll(void)
Advance the non-blocking Copy Scratchpad operation.
uint8_t ds2431_read_scratchpad_poll(void)
Advance the non-blocking scratchpad frame read.
void ds2431_set_parasite(uint8_t parasite)
Declare the bus as parasite-powered.
void ds2431_read_memory(uint8_t *dst, uint16_t addr, uint8_t len)
Read up to DS2431_READ_PASS bytes of EEPROM (non-blocking).
uint8_t ds2431_write_scratchpad_poll(void)
Advance the non-blocking Write Scratchpad operation.
uint8_t ds2431_last_command_ok(void)
Result of the last completed DS2431 operation.
void ds2431_select(const uint8_t *rom)
Select which DS2431 device to address by its ROM address.
void ds2431_copy_scratchpad(void)
Copy the scratchpad into the EEPROM (non-blocking).
void ds2431_read_scratchpad(uint8_t *buf)
Read the scratchpad frame (non-blocking).
Central compile-time configuration for the 1-Wire stack.
Library version (semantic versioning).