STM32-DS2482-HAL/README.md

41 lines
807 B
Markdown
Raw Normal View History

2024-06-26 03:37:27 +02:00
# STM32-DS2482-HAL
2024-06-27 16:14:30 +02:00
A DS2482-100 HAL for the STM32F3/F4/H7 series
## Usage
Define the target chip, and set the compiler to C23+:
2024-06-27 16:14:30 +02:00
`gcc [...] --std=gnu2x -DSTM32[F3/F4/H7]`
2024-06-27 16:14:30 +02:00
or
```yaml
# (in STM32-for-VSCode.config.yaml)
# Compiler definitions. The -D prefix for the compiler will be automatically added.
cDefinitions:
- STM32[F3/F4/H7]
- USE_HAL_DRIVER
# ...
# Compiler flags
cFlags:
- --std=gnu2x
2024-06-27 16:14:30 +02:00
```
Then, configure the HAL:
```c
// (in DS2482_HAL.h)
#define DS2482_TIMEOUT_1W 100 //timeout in ms for 1-wire operations
#define DS2482_TIMEOUT_I2C 100 //timeout in ms for I2C operations
2024-06-27 16:14:30 +02:00
```
To use the DS2482:
- Call `ds2482_create()` with the I2C handle and address
- Call `ds2482_init()` with the handle
- The HAL is ready
2024-06-27 16:14:30 +02:00
Be sure to check the return values for error handling.