You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1 KiB

3 years ago
#ifndef __DS18B20_H
#define __DS18B20_H
#include "sys.h"
//////////////////////////////////////////////////////////////////////////////////
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>ѧϰʹ<EFBFBD>ã<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><EFBFBD><EFBFBD>;
//ALIENTEKս<EFBFBD><EFBFBD>STM32<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//DS18B20<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>@ALIENTEK
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳:www.openedv.com
//<EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:2012/9/12
//<EFBFBD><EFBFBD><EFBFBD>V1.0
//<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD><EFBFBD><EFBFBD>
//Copyright(C) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾ 2009-2019
//All rights reserved
//////////////////////////////////////////////////////////////////////////////////
//IO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DS18B20_IO_IN() {GPIOA->CRH&=0XFFFF0FFF;GPIOA->CRH|=8<<12;}
#define DS18B20_IO_OUT() {GPIOA->CRH&=0XFFFF0FFF;GPIOA->CRH|=3<<12;}
////IO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DS18B20_DQ_OUT PAout(11) //<EFBFBD><EFBFBD><EFBFBD>ݶ˿<EFBFBD> PA0
#define DS18B20_DQ_IN PAin(11) //<EFBFBD><EFBFBD><EFBFBD>ݶ˿<EFBFBD> PA0
u8 DS18B20_Init(void);//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>DS18B20
short DS18B20_Get_Temp(void);//<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>
void DS18B20_Start(void);//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>
void DS18B20_Write_Byte(u8 dat);//д<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
u8 DS18B20_Read_Byte(void);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
u8 DS18B20_Read_Bit(void);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>λ
u8 DS18B20_Check(void);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DS18B20
void DS18B20_Rst(void);//<EFBFBD><EFBFBD>λDS18B20
#endif