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
|
|
|
|
|
|
|
|
Be sure to have the target chip defined:
|
|
|
|
|
|
|
|
`gcc [...] -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
|
|
|
|
```
|
|
|
|
|
|
|
|
Then, configure the HAL:
|
|
|
|
|
|
|
|
```c
|
|
|
|
// (in DS2482_HAL.h)
|
|
|
|
#define DS2482_I2C_ADDR 0x30 //change to desired values
|
|
|
|
#define DS2482_TIMEOUT_1W 100 //how long we wait for 1-Wire operations to complete
|
|
|
|
#define DS2482_TIMEOUT_I2C 100
|
|
|
|
```
|
|
|
|
|
|
|
|
Call `ds2482_init()` with the I2C handle, and the HAL is ready.
|
|
|
|
|
|
|
|
Be sure to check the return values for error handling.
|
|
|
|
|