41 lines
807 B
Markdown
41 lines
807 B
Markdown
# STM32-DS2482-HAL
|
|
|
|
A DS2482-100 HAL for the STM32F3/F4/H7 series
|
|
|
|
## Usage
|
|
|
|
Define the target chip, and set the compiler to C23+:
|
|
|
|
`gcc [...] --std=gnu2x -DSTM32[F3/F4/H7]`
|
|
|
|
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
|
|
```
|
|
|
|
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
|
|
```
|
|
|
|
To use the DS2482:
|
|
- Call `ds2482_create()` with the I2C handle and address
|
|
- Call `ds2482_init()` with the handle
|
|
- The HAL is ready
|
|
|
|
Be sure to check the return values for error handling.
|
|
|