update readme with some basics
This commit is contained in:
parent
64545e5ebd
commit
67983c1c98
31
README.md
31
README.md
@ -1,3 +1,32 @@
|
|||||||
# STM32-DS2482-HAL
|
# STM32-DS2482-HAL
|
||||||
|
|
||||||
A DS2482-100 HAL for the STM32F3 series
|
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.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user