DS18B20_ATY.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @file DS18B20_ATY.h
  3. *
  4. * @param Project DEVICE_GENERAL_ATY_LIB
  5. *
  6. * @author ATY
  7. *
  8. * @copyright
  9. * - Copyright 2017 - 2023 MZ-ATY
  10. * - This code follows:
  11. * - MZ-ATY Various Contents Joint Statement -
  12. * <a href="https://mengze.top/MZ-ATY_VCJS">
  13. * https://mengze.top/MZ-ATY_VCJS</a>
  14. * - CC 4.0 BY-NC-SA -
  15. * <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
  16. * https://creativecommons.org/licenses/by-nc-sa/4.0/</a>
  17. * - Your use will be deemed to have accepted the terms of this statement.
  18. *
  19. * @brief Familiar functions of DS18B20 for all embedded device
  20. *
  21. * @version
  22. * - 1_01_220927 > ATY
  23. * -# Preliminary version, first Release
  24. ********************************************************************************
  25. */
  26. #ifndef __DS18B20_ATY_H
  27. #define __DS18B20_ATY_H
  28. #include "INCLUDE_ATY.h"
  29. /******************************* For user *************************************/
  30. // Set AD0 voltage level for device address
  31. #define AD5245_AD0 1
  32. #define __DEBUG_DS18B20_ATY
  33. /******************************************************************************/
  34. // 0 1 0 1 1 0 AD0 R/W
  35. #define AD5245_ADDRESS (0x2C | AD5245_AD0)
  36. #ifndef DS18B20_H
  37. #define DS18B20_H
  38. #include "stm32f10x.h"
  39. #include "sys.h"
  40. #define DS18B20_OutPut_Mode() {GPIOB->CRL &= 0x0FFFFFFF;GPIOB->CRL |= 0x30000000;}
  41. #define DS18B20_InPut_Mode() {GPIOB->CRL &= 0x0FFFFFFF;GPIOB->CRL |= 0x80000000;}
  42. #define DS18B20_IN PBin(7)
  43. #define DS18B20_OUT PBout(7)
  44. extern u8 Refresh_OLED_Data;
  45. void DS18B20_Init(void);
  46. u8 DS18B20_CheckDevice(void);
  47. void DS18B20_SendRestSingle(void);
  48. u8 DS18B20_CheckReadySingle(void);
  49. u8 BS18B20_WriteByte(u8 cmd);
  50. u8 BS18B20_ReadByte(void);
  51. u16 DS18B20_GetTemperature(void);
  52. u8 DS18B20_ReadRomInfo(void);
  53. u8 DS18B20_MatchROM(void);
  54. #endif
  55. #endif /* __DS18B20_ATY_H */
  56. /******************************** End Of File *********************************/