MAX30102.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /** \file max30102.h ******************************************************
  2. *
  3. * Project: MAXREFDES117#
  4. * Filename: max30102.h
  5. * Description: This module is an embedded controller driver header file for MAX30102
  6. *
  7. *
  8. * --------------------------------------------------------------------
  9. *
  10. * This code follows the following naming conventions:
  11. *
  12. * char ch_pmod_value
  13. * char (array) s_pmod_s_string[16]
  14. * float f_pmod_value
  15. * int32_t n_pmod_value
  16. * int32_t (array) an_pmod_value[16]
  17. * int16_t w_pmod_value
  18. * int16_t (array) aw_pmod_value[16]
  19. * uint16_t uw_pmod_value
  20. * uint16_t (array) auw_pmod_value[16]
  21. * uint8_t uch_pmod_value
  22. * uint8_t (array) auch_pmod_buffer[16]
  23. * uint32_t un_pmod_value
  24. * int32_t * pn_pmod_value
  25. *
  26. * ------------------------------------------------------------------------- */
  27. /*******************************************************************************
  28. * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
  29. *
  30. * Permission is hereby granted, free of charge, to any person obtaining a
  31. * copy of this software and associated documentation files (the "Software"),
  32. * to deal in the Software without restriction, including without limitation
  33. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  34. * and/or sell copies of the Software, and to permit persons to whom the
  35. * Software is furnished to do so, subject to the following conditions:
  36. *
  37. * The above copyright notice and this permission notice shall be included
  38. * in all copies or substantial portions of the Software.
  39. *
  40. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  41. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  42. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  43. * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
  44. * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  45. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  46. * OTHER DEALINGS IN THE SOFTWARE.
  47. *
  48. * Except as contained in this notice, the name of Maxim Integrated
  49. * Products, Inc. shall not be used except as stated in the Maxim Integrated
  50. * Products, Inc. Branding Policy.
  51. *
  52. * The mere transfer of this software does not imply any licenses
  53. * of trade secrets, proprietary technology, copyrights, patents,
  54. * trademarks, maskwork rights, or any other form of intellectual
  55. * property whatsoever. Maxim Integrated Products, Inc. retains all
  56. * ownership rights.
  57. *******************************************************************************
  58. */
  59. #ifndef MAX30102_H_
  60. #define MAX30102_H_
  61. #include <stdint.h>
  62. #include <stdbool.h>
  63. #define MAX30102_I2C_ADDR 0x57
  64. // #define I2C_WRITE_ADDR 0xAE
  65. // #define I2C_READ_ADDR 0xAF
  66. //register addresses
  67. #define REG_INTR_STATUS_1 0x00
  68. #define REG_INTR_STATUS_2 0x01
  69. #define REG_INTR_ENABLE_1 0x02
  70. #define REG_INTR_ENABLE_2 0x03
  71. #define REG_FIFO_WR_PTR 0x04
  72. #define REG_OVF_COUNTER 0x05
  73. #define REG_FIFO_RD_PTR 0x06
  74. #define REG_FIFO_DATA 0x07
  75. #define REG_FIFO_CONFIG 0x08
  76. #define REG_MODE_CONFIG 0x09
  77. #define REG_SPO2_CONFIG 0x0A
  78. #define REG_LED1_PA 0x0C
  79. #define REG_LED2_PA 0x0D
  80. #define REG_PILOT_PA 0x10
  81. #define REG_MULTI_LED_CTRL1 0x11
  82. #define REG_MULTI_LED_CTRL2 0x12
  83. #define REG_TEMP_INTR 0x1F
  84. #define REG_TEMP_FRAC 0x20
  85. #define REG_TEMP_CONFIG 0x21
  86. #define REG_PROX_INT_THRESH 0x30
  87. #define REG_REV_ID 0xFE
  88. #define REG_PART_ID 0xFF
  89. bool maxim_max30102_init(void);
  90. bool maxim_max30102_read_fifo(uint32_t *pun_red_led, uint32_t *pun_ir_led);
  91. bool maxim_max30102_write_reg(uint8_t uch_addr, uint8_t uch_data);
  92. bool maxim_max30102_read_reg(uint8_t uch_addr, uint8_t *puch_data);
  93. bool maxim_max30102_reset(void);
  94. bool maxim_max30102_shutdown(void);
  95. #endif /* MAX30102_H_ */