From b7c33775c0cdc12ecb212861da30b3fee5f2efd7 Mon Sep 17 00:00:00 2001 From: IOsetting Date: Mon, 6 Jun 2022 02:03:01 +0800 Subject: [PATCH] docs: add comments for parasite power mode --- demo/gpio/ds18b20/single-ds18b20/main.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/demo/gpio/ds18b20/single-ds18b20/main.c b/demo/gpio/ds18b20/single-ds18b20/main.c index 707c8af..5dd87c5 100644 --- a/demo/gpio/ds18b20/single-ds18b20/main.c +++ b/demo/gpio/ds18b20/single-ds18b20/main.c @@ -17,9 +17,19 @@ * * Board: STC8H3K32 * - * P35 -> DQ - * GND -> GND - * 3.3V -> VCC + * Normal Power Mode: + * P35 -> DQ + * GND -> GND + * 5V/3.3V -> VDD + * + * Parasite Power Mode: + * Parasite power mode requires both DS18B20 GND and Vdd to be + * connected to ground. The DQ pin is the data/parasite power line, + * which requires a pull-up resistor (set by PxPU command) + * + * P35 -> DQ + * GND -> GND -> VDD + * 5V */ #include "fw_hal.h" @@ -46,6 +56,10 @@ int main(void) while(1) { DS18B20_StartAll(); + /* + In Parasite Power Mode, replace the while block below with + SYS_Delay(x), x can be [500, 1000] + */ while (!DS18B20_AllDone()) { UART1_TxChar('.');