/**
* @file DS18B20_ATY.h
*
* @param Project DEVICE_GENERAL_ATY_LIB
*
* @author ATY
*
* @copyright
* - Copyright 2017 - 2023 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 Familiar functions of DS18B20 for all embedded device
*
* @version
* - 1_01_220927 > ATY
* -# Preliminary version, first Release
********************************************************************************
*/
#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)
#ifndef DS18B20_H
#define DS18B20_H
#include "stm32f10x.h"
#include "sys.h"
#define DS18B20_OutPut_Mode() {GPIOB->CRL &= 0x0FFFFFFF;GPIOB->CRL |= 0x30000000;}
#define DS18B20_InPut_Mode() {GPIOB->CRL &= 0x0FFFFFFF;GPIOB->CRL |= 0x80000000;}
#define DS18B20_IN PBin(7)
#define DS18B20_OUT PBout(7)
extern u8 Refresh_OLED_Data;
void DS18B20_Init(void);
u8 DS18B20_CheckDevice(void);
void DS18B20_SendRestSingle(void);
u8 DS18B20_CheckReadySingle(void);
u8 BS18B20_WriteByte(u8 cmd);
u8 BS18B20_ReadByte(void);
u16 DS18B20_GetTemperature(void);
u8 DS18B20_ReadRomInfo(void);
u8 DS18B20_MatchROM(void);
#endif
#endif /* __DS18B20_ATY_H */
/******************************** End Of File *********************************/