5 Commits

Author SHA1 Message Date
fb8cfebbd0 Version 1.0.1
Update README.
2024-07-24 13:51:35 +03:00
d006e1e40c Update README.md 2024-06-26 18:16:52 +03:00
4d1286cfb2 Updated some comments 2024-06-23 12:29:33 +03:00
c2993a5059 Added some comments 2024-06-06 19:09:15 +03:00
db08c99afe Updated README 2024-06-06 19:08:42 +03:00
4 changed files with 6 additions and 23 deletions

View File

@ -5,8 +5,6 @@
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:
@ -31,6 +29,7 @@ Search 1-Wire devices on bus:
void app_main(void) void app_main(void)
{ {
esp_log_level_set("zh_onewire", ESP_LOG_NONE);
uint8_t *rom = NULL; uint8_t *rom = NULL;
zh_onewire_init(GPIO_NUM_5); zh_onewire_init(GPIO_NUM_5);
if (zh_onewire_reset() != ESP_OK) if (zh_onewire_reset() != ESP_OK)

View File

@ -1,9 +1,3 @@
/**
* @file
* Header file for the zh_onewire component.
*
*/
#pragma once #pragma once
#include "stdio.h" #include "stdio.h"

View File

@ -1 +1 @@
1.0.0 1.0.1

View File

@ -1,12 +1,5 @@
/**
* @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.
@ -15,24 +8,21 @@
#define TIME_SLOT_DURATION 120 // Time slot. #define TIME_SLOT_DURATION 120 // Time slot.
#define VALID_DATA_DURATION 15 // Valid data duration. #define VALID_DATA_DURATION 15 // Valid data duration.
#define SKIP_ROM 0xCC #define SKIP_ROM 0xCC // Skip ROM command to address all 1-Wire devices.
#define MATCH_ROM 0x55 #define MATCH_ROM 0x55 // Match ROM command to address a specific 1-Wire device.
#define READ_ROM 0x33 #define READ_ROM 0x33 // Read ROM command for read ROM on only one 1-Wire device.
#define SEARCH_ROM 0xF0 #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";