diff --git a/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c b/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c index 85ed096..cb27647 100644 --- a/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c +++ b/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.c @@ -16,14 +16,15 @@ void DS18B20_Init(void) { + /* Pull up 2 seconds for possible capacitor charging */ DS18B20_DQ_PULLUP(); DS18B20_DQ_OUTPUT(); DS18B20_DQ = SET; - SYS_DelayUs(1000); + SYS_Delay(1000); DS18B20_DQ = RESET; - SYS_DelayUs(1000); + SYS_Delay(1); DS18B20_DQ = SET; - SYS_DelayUs(2000); + SYS_Delay(1000); } __BIT DS18B20_Reset(void) @@ -238,7 +239,7 @@ void DS18B20_ReadScratchpadFromAddr(const uint8_t *addr, uint8_t *buf) } } -uint8_t DS18B20_Detect(uint8_t *buff, uint8_t *stack, uint8_t split_point) +uint8_t DS18B20_Search(uint8_t *buff, uint8_t *stack, uint8_t split_point) { uint8_t len = 64, pos = 0; /* Start from deepest point */ diff --git a/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.h b/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.h index e4a3654..aa73216 100644 --- a/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.h +++ b/demo/gpio/ds18b20/multiple-ds18b20/ds18b20.h @@ -163,6 +163,6 @@ void DS18B20_ReadScratchpadFromAddr(const uint8_t *addr, uint8_t *buf); * @param split_point deepest split point of last search * @return new split point */ -uint8_t DS18B20_Detect(uint8_t *buff, uint8_t *stack, uint8_t split_point); +uint8_t DS18B20_Search(uint8_t *buff, uint8_t *stack, uint8_t split_point); #endif // __DS18B20_H_ diff --git a/demo/gpio/ds18b20/multiple-ds18b20/main.c b/demo/gpio/ds18b20/multiple-ds18b20/main.c index 7f533f7..d68fdfa 100644 --- a/demo/gpio/ds18b20/multiple-ds18b20/main.c +++ b/demo/gpio/ds18b20/multiple-ds18b20/main.c @@ -52,7 +52,7 @@ int main(void) do { // ROM search and store ROM bytes to addr - sp = DS18B20_Detect(addr, Search_Stack, sp); + sp = DS18B20_Search(addr, Search_Stack, sp); // Print the new split point and address UART1_TxHex(sp); UART1_TxChar(' '); @@ -74,6 +74,7 @@ int main(void) UART1_TxString("\r\n"); } while (sp); + UART1_TxString("\r\n"); SYS_Delay(1000); } } diff --git a/demo/gpio/ds18b20/single-ds18b20/ds18b20.c b/demo/gpio/ds18b20/single-ds18b20/ds18b20.c index 85ed096..cb27647 100644 --- a/demo/gpio/ds18b20/single-ds18b20/ds18b20.c +++ b/demo/gpio/ds18b20/single-ds18b20/ds18b20.c @@ -16,14 +16,15 @@ void DS18B20_Init(void) { + /* Pull up 2 seconds for possible capacitor charging */ DS18B20_DQ_PULLUP(); DS18B20_DQ_OUTPUT(); DS18B20_DQ = SET; - SYS_DelayUs(1000); + SYS_Delay(1000); DS18B20_DQ = RESET; - SYS_DelayUs(1000); + SYS_Delay(1); DS18B20_DQ = SET; - SYS_DelayUs(2000); + SYS_Delay(1000); } __BIT DS18B20_Reset(void) @@ -238,7 +239,7 @@ void DS18B20_ReadScratchpadFromAddr(const uint8_t *addr, uint8_t *buf) } } -uint8_t DS18B20_Detect(uint8_t *buff, uint8_t *stack, uint8_t split_point) +uint8_t DS18B20_Search(uint8_t *buff, uint8_t *stack, uint8_t split_point) { uint8_t len = 64, pos = 0; /* Start from deepest point */ diff --git a/demo/gpio/ds18b20/single-ds18b20/ds18b20.h b/demo/gpio/ds18b20/single-ds18b20/ds18b20.h index e4a3654..aa73216 100644 --- a/demo/gpio/ds18b20/single-ds18b20/ds18b20.h +++ b/demo/gpio/ds18b20/single-ds18b20/ds18b20.h @@ -163,6 +163,6 @@ void DS18B20_ReadScratchpadFromAddr(const uint8_t *addr, uint8_t *buf); * @param split_point deepest split point of last search * @return new split point */ -uint8_t DS18B20_Detect(uint8_t *buff, uint8_t *stack, uint8_t split_point); +uint8_t DS18B20_Search(uint8_t *buff, uint8_t *stack, uint8_t split_point); #endif // __DS18B20_H_