/**
* @file DS18B20_ATY.h
*
* @param Project DEVICE_GENERAL_ATY_LIB
*
* @author ATY
*
* @copyright
* - Copyright 2017 - 2026 MZ-ATY
* - This code follows:
* - MZ-ATY Various Contents Joint Statement -
*
* https://mengze.top/MZ-ATY_VCJS
* - CC 4.0 BY-NC-SA -
*
* https://creativecommons.org/licenses/by-nc-sa/4.0/
* - Your use will be deemed to have accepted the terms of this statement.
*
* @brief functions of DS18B20 for C platform (Dev-style)
*
* @version
* - 1_01_251112 > ATY
* -# Refactor to Dev-style; remove legacy STM32-specific interfaces
********************************************************************************
*/
#ifndef __DS18B20_ATY_H
#define __DS18B20_ATY_H
#include "INCLUDE_ATY.h"
/******************************* For user *************************************/
// Set AD0 voltage level for device address
#define AD5245_AD0 1
#define __DEBUG_DS18B20_ATY
/******************************************************************************/
// 0 1 0 1 1 0 AD0 R/W
#define AD5245_ADDRESS (0x2C | AD5245_AD0)
struct DS18B20_ATY_Dev
{
void (*drive_low)(void);
void (*release_bus)(void);
uint8_t (*read_bus)(void);
void (*delay_us)(uint16_t us);
uint8_t lock;
uint8_t debugEnable;
void (*LOG)(const char* s);
};
uint8_t DS18B20_InitDev(struct DS18B20_ATY_Dev* dev);
void DS18B20_ResetDev(struct DS18B20_ATY_Dev* dev);
uint8_t DS18B20_CheckReadyDev(struct DS18B20_ATY_Dev* dev);
void DS18B20_WriteByteDev(struct DS18B20_ATY_Dev* dev, uint8_t cmd);
uint8_t DS18B20_ReadByteDev(struct DS18B20_ATY_Dev* dev);
uint16_t DS18B20_GetTemperatureDev(struct DS18B20_ATY_Dev* dev);
uint8_t DS18B20_ReadRomInfoDev(struct DS18B20_ATY_Dev* dev, uint8_t rom8[8]);
#endif /* __DS18B20_ATY_H */
/******************************** End Of File *********************************/