ds1624.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. #ifndef DS1624_H
  13. #define DS1624_H
  14. /*lint ++flb "Enter library region" */
  15. #include <stdbool.h>
  16. #include <stdint.h>
  17. /** @file
  18. * @brief DS1624 digital temperature sensor driver.
  19. *
  20. *
  21. * @defgroup nrf_drivers_ds1624 DS1624 digital temperature sensor driver
  22. * @{
  23. * @ingroup nrf_drivers
  24. * @brief DS1624 digital temperature sensor driver.
  25. */
  26. /**
  27. * @brief Function for initializing DS1624 temperature sensor to 1-shot mode.
  28. *
  29. * @note Before calling this function, you must initialize twi_master first.
  30. *
  31. * @param device_address Bits [2:0] for the device address. All other bits must be zero.
  32. * @return
  33. * @retval true If communication succeeded with the device.
  34. * @retval false If communication failed with the device.
  35. */
  36. bool ds1624_init(uint8_t device_address);
  37. /**
  38. * @brief Function for reading temperature from the sensor.
  39. *
  40. * @param temperature_in_celcius Memory location to store temperature in full celcius degrees.
  41. * @param temperature_fraction Memory location to store temperature's fraction part in 0.03125 celcius degree increments.
  42. * @return
  43. * @retval true Temperature was successfully read
  44. * @retval false Temperature reading failed or conversion was not yet complete
  45. */
  46. bool ds1624_temp_read(int8_t *temperature_in_celcius, int8_t *temperature_fraction);
  47. /**
  48. * @brief Function for starting temperature conversion. Valid data will be available 400-1000 milliseconds after exiting this function.
  49. *
  50. * @return
  51. * @retval true Temperature conversion started.
  52. * @retval false Temperature converion failed to start.
  53. */
  54. bool ds1624_start_temp_conversion(void);
  55. /**
  56. * @brief Function for checking if temperature conversion is done.
  57. *
  58. * @return
  59. * @retval true Temperature conversion done.
  60. * @retval false Temperature converion still in progress.
  61. */
  62. bool ds1624_is_temp_conversion_done(void);
  63. /**
  64. *@}
  65. **/
  66. /*lint --flb "Leave library region" */
  67. #endif