From 67983c1c9884fc2042e21df897552e03fcf5556f Mon Sep 17 00:00:00 2001 From: Kilian Bracher Date: Thu, 27 Jun 2024 16:14:30 +0200 Subject: [PATCH] update readme with some basics --- README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a30060c..d4685cd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ # STM32-DS2482-HAL -A DS2482-100 HAL for the STM32F3 series \ No newline at end of file +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. +