Compare commits
2 Commits
main
...
b25849c9b0
Author | SHA1 | Date | |
---|---|---|---|
b25849c9b0 | |||
93dca546b6 |
@@ -5,6 +5,8 @@
|
|||||||
1. ESP8266 RTOS_SDK v3.4
|
1. ESP8266 RTOS_SDK v3.4
|
||||||
2. ESP32 ESP-IDF v5.2
|
2. ESP32 ESP-IDF v5.2
|
||||||
|
|
||||||
|
## [Function description](http://zh-onewire.zh.com.ru)
|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
|
|
||||||
In an existing project, run the following command to install the component:
|
In an existing project, run the following command to install the component:
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Header file for the zh_onewire component.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
@@ -1 +1 @@
|
|||||||
1.0.1
|
1.0.0
|
10
zh_onewire.c
10
zh_onewire.c
@@ -1,5 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* The main code of the zh_onewire component.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "zh_onewire.h"
|
#include "zh_onewire.h"
|
||||||
|
|
||||||
|
/// \cond
|
||||||
#define MASTER_RESET_PULSE_DURATION 480 // Reset time high. Reset time low.
|
#define MASTER_RESET_PULSE_DURATION 480 // Reset time high. Reset time low.
|
||||||
#define RESPONSE_MAX_DURATION 60 // Presence detect high.
|
#define RESPONSE_MAX_DURATION 60 // Presence detect high.
|
||||||
#define PRESENCE_PULSE_MAX_DURATION 240 // Presence detect low.
|
#define PRESENCE_PULSE_MAX_DURATION 240 // Presence detect low.
|
||||||
@@ -14,15 +21,18 @@
|
|||||||
#define SEARCH_ROM 0xF0 // Read ROM on all 1-Wire devices.
|
#define SEARCH_ROM 0xF0 // Read ROM on all 1-Wire devices.
|
||||||
|
|
||||||
#define pgm_read_byte(addr) (*(const uint8_t *)(addr))
|
#define pgm_read_byte(addr) (*(const uint8_t *)(addr))
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
static uint8_t _read_bit(void);
|
static uint8_t _read_bit(void);
|
||||||
static void _send_bit(const uint8_t bit);
|
static void _send_bit(const uint8_t bit);
|
||||||
|
|
||||||
|
/// \cond
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP8266
|
#ifdef CONFIG_IDF_TARGET_ESP8266
|
||||||
#define esp_delay_us(x) os_delay_us(x)
|
#define esp_delay_us(x) os_delay_us(x)
|
||||||
#else
|
#else
|
||||||
#define esp_delay_us(x) esp_rom_delay_us(x)
|
#define esp_delay_us(x) esp_rom_delay_us(x)
|
||||||
#endif
|
#endif
|
||||||
|
/// \endcond
|
||||||
|
|
||||||
static const char *TAG = "zh_onewire";
|
static const char *TAG = "zh_onewire";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user