lis2dh12.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. /**
  2. * Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef LIS2DH12_H
  41. #define LIS2DH12_H
  42. #include "nrf_twi_sensor.h"
  43. #include "lis2dh12_internal.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /**
  48. * @brief Possible sensor addresses.
  49. */
  50. #define LIS2DH12_BASE_ADDRESS_LOW 0x18U
  51. #define LIS2DH12_BASE_ADDRESS_HIGH 0x19U
  52. // WHO_AM_I register value.
  53. #define LIS2DH12_WHO_AM_I 0x33
  54. /**
  55. * @brief Sensor driver usage.
  56. *
  57. * Sensor instance has to be defined first in global context using @ref LIS2DH12_INSTANCE DEF.
  58. * After that it has to be initialized using @ref lis2dh12_init.
  59. * At this point sensor instance is ready and all other functions can be used.
  60. *
  61. * Sensor settings are modified using asynchronous macros, using them does not change
  62. * real sensor settings until @ref lis2dh12_cfg_commit is called.
  63. * Example:
  64. * LIS2DH12_DATA_CFG(m_sensor, LIS2DH12_ODR_200HZ, false, true, true, true, LIS2DH12_SCALE_2G, 1);
  65. * lis2dh12_cfg_commit(&m_sensor);
  66. *
  67. * There are designated functions to read status sensor registers e.g. @ref lis2dh12_status_read
  68. * As parameters they receive function to be called after register is read, and pointer where
  69. * register value should be stored. From that value specific parameters can be extracted
  70. * using @ref NRF_TWI_SENSOR_REG_VAL_GET macro. For specific bitmasks, check lis2dh12_internal.h
  71. * Example:
  72. * bool zyxor = NRF_TWI_SENSOR_REG_VAL_GET(status_reg, LIS2DH12_ZYXOR_MASK, LIS2DH12_ZYXOR_POS);
  73. *
  74. * Other functions are self-explanatory or have description on their usage.
  75. */
  76. /**
  77. * @brief Output data rate settings.
  78. */
  79. typedef enum
  80. {
  81. LIS2DH12_ODR_POWERDOWN,
  82. LIS2DH12_ODR_1HZ,
  83. LIS2DH12_ODR_10HZ,
  84. LIS2DH12_ODR_25HZ,
  85. LIS2DH12_ODR_50HZ,
  86. LIS2DH12_ODR_100HZ,
  87. LIS2DH12_ODR_200HZ,
  88. LIS2DH12_ODR_400HZ,
  89. LIS2DH12_ODR_1620HZ,
  90. LIS2DH12_ODR_1344_5376HZ
  91. } lis2dh12_odr_t;
  92. /**
  93. * @brief Fifo mode settings.
  94. */
  95. typedef enum
  96. {
  97. LIS2DH12_BYPASS,
  98. LIS2DH12_FIFO,
  99. LIS2DH12_STREAM,
  100. LIS2DH12_STREAM_TO_FIFO
  101. } lis2dh12_fifo_mode_t;
  102. /**
  103. * @brief Filter mode setting.
  104. */
  105. typedef enum
  106. {
  107. LIS2DH12_FILTER_MODE_NORMAL_W_RESET,
  108. LIS2DH12_FILTER_MODE_REFERENCE,
  109. LIS2DH12_FILTER_MODE_NORMAL,
  110. LIS2DH12_FILTER_MODE_AUTO_RESET
  111. } lis2dh12_filter_mode_t;
  112. /**
  113. * @brief Filter frequency setting.
  114. */
  115. typedef enum
  116. {
  117. LIS2DH12_FILTER_FREQ_1,
  118. LIS2DH12_FILTER_FREQ_2,
  119. LIS2DH12_FILTER_FREQ_3,
  120. LIS2DH12_FILTER_FREQ_4
  121. } lis2dh12_filter_freq_t;
  122. /**
  123. * @brief Accelerometer scale setting.
  124. */
  125. typedef enum
  126. {
  127. LIS2DH12_SCALE_2G,
  128. LIS2DH12_SCALE_4G,
  129. LIS2DH12_SCALE_8G,
  130. LIS2DH12_SCALE_16G
  131. } lis2dh12_scale_t;
  132. /**
  133. * @brief Structure containing accelerometer data.
  134. */
  135. typedef struct
  136. {
  137. int16_t x;
  138. int16_t y;
  139. int16_t z;
  140. } lis2dh12_data_t;
  141. /**
  142. * @brief Data callback prototype.
  143. *
  144. * @param[in] result Result of operation (NRF_SUCCESS on success,
  145. * otherwise a relevant error code).
  146. * @param[in] p_data Pointer to raw sensor data structure.
  147. */
  148. typedef void (* lis2dh12_data_cb_t)(ret_code_t result, lis2dh12_data_t * p_data);
  149. /**
  150. * @brief Temperature callback prototype.
  151. *
  152. * @param[in] result Result of operation (NRF_SUCCESS on success,
  153. * otherwise a relevant error code).
  154. * @param[in] p_temp Temperature value.
  155. */
  156. typedef void (* lis2dh12_temp_cb_t)(ret_code_t result, int16_t * p_temp);
  157. /**
  158. * @brief Macro for defining sensor instance.
  159. *
  160. * @param[in] _lis2dh12_inst_name Sensor instance name.
  161. * @param[in] _p_twi_sensor Pointer to common TWI sensor instance.
  162. * @param[in] _sensor_address Sensor base address.
  163. */
  164. #define LIS2DH12_INSTANCE_DEF(_lis2dh12_inst_name, _p_twi_sensor, _sensor_address) \
  165. LIS2DH12_INTERNAL_INSTANCE_DEF(_lis2dh12_inst_name, _p_twi_sensor, _sensor_address)
  166. /**
  167. * @brief Macro for setting data acquisition configuration.
  168. *
  169. * @param[in] _s Sensor instance.
  170. * @param[in] _odr Data rate. @ref lis2dh12_odr_t
  171. * @param[in] _lp Power mode. True if low power mode is enabled.
  172. * @param[in] _z_en Enable measure in z-axis. True if enabled.
  173. * @param[in] _y_en Enable measure in y-axis. True if enabled.
  174. * @param[in] _x_en Enable measure in x-axis. True if enabled.
  175. * @param[in] _scale Measurement scale. @ref lis2dh12_scale_t
  176. * @param[in] _high_res High resolution mode. True if enabled.
  177. * Low power can't be enabled when in high resolution mode.
  178. */
  179. #define LIS2DH12_DATA_CFG(_s, _odr, _lp, _z_en, _y_en, _x_en, _scale, _high_res) \
  180. LIS2DH12_INTERNAL_DATA_CFG(_s, _odr, _lp, _z_en, _y_en, _x_en, _scale, _high_res)
  181. /**
  182. * @brief Function for setting filter configuration.
  183. *
  184. * @param[in] _s Sensor instance.
  185. * @param[in] _mode Filter mode. @ref lis2dh12_filter_mode_t
  186. * @param[in] _freq Filter frequency. @ref lis2dh12_filter_freq_t
  187. * @param[in] _d_en Enable filter for data acquisition.
  188. * @param[in] _c_en Enable filter for click interrupt.
  189. * @param[in] _i1_en Enable filter for interrupt 1 aoi.
  190. * @param[in] _i2_en Enable filter for interrupt 2 aoi.
  191. */
  192. #define LIS2DH12_FILTER_CFG(_s, _mode, _freq, _d_en, _c_en, _i1_en, _i2_en) \
  193. LIS2DH12_INTERNAL_FILTER_CFG(_s, _mode, _freq, _d_en, _c_en, _i1_en, _i2_en)
  194. /**
  195. * @brief Macro for configuring INT1 pin.
  196. *
  197. * @param[in] _s Sensor instance.
  198. * @param[in] _cl Enable CLICK interrupt on pin.
  199. * @param[in] _ia1 Enable IA1 interrupt on pin.
  200. * @param[in] _ia2 Enable IA2 interrupt on pin.
  201. * @param[in] _zyxda Enable ZYXDA interrupt on pin.
  202. * @param[in] _wtm Enable FIFO watermark interrupt on pin.
  203. * @param[in] _ovr Enable FIFO overrun interrupt on pin.
  204. * @param[in] _pol Pin active state. Affects also int2 pin.
  205. * @arg true Pin is active low.
  206. * @arg false Pin is active high
  207. * @param[in] _d4d Enable 4D detection on INT1 pin when 6D is enabled on interrupt 1.
  208. */
  209. #define LIS2DH12_INT1_PIN_CFG(_s, _cl, _ia1, _ia2, _zyxda, _wtm, _ovr, _pol, _d4d) \
  210. LIS2DH12_INTERNAL_INT1_PIN_CFG(_s, _cl, _ia1, _ia2, _zyxda, _wtm, _ovr, _pol, _d4d)
  211. /**
  212. * @brief Macro for configuring INT2 pin.
  213. *
  214. * @param[in] _s Sensor instance.
  215. * @param[in] _cl Enable CLICK interrupt on pin.
  216. * @param[in] _ia1 Enable IA1 interrupt on pin.
  217. * @param[in] _ia2 Enable IA2 interrupt on pin.
  218. * @param[in] _boot Enable boot on pin.
  219. * @param[in] _avt Enable activity interrupt on pin.
  220. * @param[in] _pol Pin active state. Affects also int1 pin.
  221. * @arg true Pin is active low.
  222. * @arg false Pin is active high
  223. * @param[in] _d4d Enable 4D detection on INT2 pin when 6D is enabled on interrupt 2.
  224. */
  225. #define LIS2DH12_INT2_PIN_CFG(_s, _cl, _ia1, _ia2, _boot, _act, _pol, _d4d) \
  226. LIS2DH12_INTERNAL_INT2_PIN_CFG(_s, _cl, _ia1, _ia2, _boot, _act, _pol, _d4d)
  227. /**
  228. * @brief Macro for configuring interrupt 1.
  229. *
  230. * @param[in] _s Sensor instance.
  231. * @param[in] _thr Interrupt threshold.
  232. * @param[in] _dur Interrupt duration.
  233. * @param[in] _aoi And/Or combination of interrupt events. True if and.
  234. * @param[in] _6d 6-direction detection enable. True if enabled.
  235. * @param[in] _zh Enable interrupt on Z high event or direction recognition.
  236. * @param[in] _zl Enable interrupt on Z low event or direction recognition.
  237. * @param[in] _yh Enable interrupt on Y high event or direction recognition.
  238. * @param[in] _yl Enable interrupt on Y low event or direction recognition.
  239. * @param[in] _xh Enable interrupt on X high event or direction recognition.
  240. * @param[in] _xl Enable interrupt on X low event or direction recognition.
  241. * @param[in] _lir Latch interrupt 1 request. True if enabled.
  242. */
  243. #define LIS2DH12_INT1_CFG(_s, _thr, _dur, _aoi, _6d, _zh, _zl, _yh, yl, _xh, _xl, _lir) \
  244. LIS2DH12_INTERNAL_INT1_CFG(_s, _thr, _dur, _aoi, _6d, _zh, _zl, _yh, yl, _xh, _xl, _lir)
  245. /**
  246. * @brief Macro for configuring interrupt 2.
  247. *
  248. * @param[in] _s Sensor instance.
  249. * @param[in] _thr Interrupt threshold.
  250. * @param[in] _dur Interrupt duration.
  251. * @param[in] _aoi And/Or combination of interrupt events. True if and.
  252. * @param[in] _6d 6-direction detection enable. True if enabled.
  253. * @param[in] _zh Enable interrupt on Z high event or direction recognition.
  254. * @param[in] _zl Enable interrupt on Z low event or direction recognition.
  255. * @param[in] _yh Enable interrupt on Y high event or direction recognition.
  256. * @param[in] _yl Enable interrupt on Y low event or direction recognition.
  257. * @param[in] _xh Enable interrupt on X high event or direction recognition.
  258. * @param[in] _xl Enable interrupt on X low event or direction recognition.
  259. * @param[in] _lir Latch interrupt 1 request. True if enabled.
  260. */
  261. #define LIS2DH12_INT2_CFG(_s, _thr, _dur, _aoi, _6d, _zh, _zl, _yh, yl, _xh, _xl, _lir) \
  262. LIS2DH12_INTERNAL_INT2_CFG(_s, _thr, _dur, _aoi, _6d, _zh, _zl, _yh, yl, _xh, _xl, _lir)
  263. /**
  264. * @brief Function for setting click configuration.
  265. *
  266. * @param[in] _s Sensor instance.
  267. * @param[in] _zd Enable interrupt double-click on Z-axis.
  268. * @param[in] _zs Enable interrupt single-click on Z-axis.
  269. * @param[in] _yd Enable interrupt double-click on Y-axis.
  270. * @param[in] _ys Enable interrupt single-click on Y-axis.
  271. * @param[in] _xd Enable interrupt double-click on X-axis.
  272. * @param[in] _xs Enable interrupt single-click on X-axis.
  273. * @param[in] _lir Keep high until CLICK_SRC is read.
  274. * @arg true Interrupt is kept high until CLICK_SRC is read.
  275. * @arg false Interrupt is kept high for the duration of latency window.
  276. * @param[in] _ths Click threshold.
  277. * @param[in] _lim Click time limit.
  278. * @param[in] _ltc Click time latency.
  279. * @param[in] _win Click time window.
  280. */
  281. #define LIS2DH12_CLICK_CFG(_s, _zd, _zs, _yd, _ys, _xd, _xs, _lir, _ths, _lim, _ltc, _win) \
  282. LIS2DH12_INTERNAL_CLICK_CFG(_s, _zd, _zs, _yd, _ys, _xd, _xs, _lir, _ths, _lim, _ltc, _win)
  283. /**
  284. * @brief Macro for setting sleep configuration.
  285. *
  286. * @param[in] _s Sensor instance.
  287. * @param[in] _ths Sleep-to-wake, return-to-sleep activation threshold in low-power mode.
  288. * @param[in] _dur Sleep-to-wake, return-to-sleep duration.
  289. */
  290. #define LIS2DH12_SLEEP_CFG(_s, _ths, _dur) \
  291. LIS2DH12_INTERNAL_SLEEP_CFG(_s, _ths, _dur)
  292. /**
  293. * @brief Macro for setting reference value for interrupt generation.
  294. *
  295. * @param[in] _s Sensor instance.
  296. * @param[in] _ref Reference value.
  297. */
  298. #define LIS2DH_REF_SET(_s, _ref) \
  299. LIS2DH_INTERNAL_REF_SET(_s, _ref)
  300. /**
  301. * @brief Macro for setting FIFO configuration.
  302. *
  303. * @param[in] _s Sensor instance.
  304. * @param[in] _en Enables FIFO. True if enabled. False clears FIFO setting.
  305. * @param[in] _mode FIFO mode. @ref lis2dh12_fifo_mode_t
  306. * @param[in] _t_sel Trigger event pin selection. True if int2 pin, false if int1 pin.
  307. * @param[in] _t_thr Trigger threshold.
  308. */
  309. #define LIS2DH12_FIFO_CFG(_s, _en, _mode, _t_sel, _t_thr) \
  310. LIS2DH12_INTERNAL_FIFO_CFG(_s, _en, _mode, _t_sel, _t_thr)
  311. /**
  312. * @brief Function for initializing LIS2DH12 instance.
  313. *
  314. * @param[in] p_inst Pointer to sensor instance defined by macro. @ref LIS2DH12_INSTANCE_DEF
  315. *
  316. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_write
  317. */
  318. ret_code_t lis2dh12_init(lis2dh12_instance_t * p_inst);
  319. /**
  320. * @brief Function for writing configuration to sensor.
  321. *
  322. * @param[in] p_inst Pointer to sensor instance.
  323. *
  324. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_write
  325. */
  326. ret_code_t lis2dh12_cfg_commit(lis2dh12_instance_t * p_inst);
  327. /**
  328. * @brief Function for reading accelerometer data.
  329. *
  330. * @param[in] p_inst Pointer to sensor instance.
  331. * @param[in] user_cb Function to be called after data read is complete.
  332. * @param[in] p_data Pointer to data structure.
  333. * @param[in] samples Number of samples to read.
  334. *
  335. * @note When trying to read more than one sample and FIFO is disabled,
  336. * current output value will be copied to all read samples.
  337. * When trying to read more samples than there is currently in FIFO,
  338. * excess samples will be equal to 0.
  339. *
  340. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  341. */
  342. ret_code_t lis2dh12_data_read(lis2dh12_instance_t * p_inst,
  343. lis2dh12_data_cb_t user_cb,
  344. lis2dh12_data_t * p_data,
  345. uint8_t samples);
  346. /**
  347. * @brief Function for enabling temperature measurement.
  348. *
  349. * @param[in] p_inst Pointer to sensor instance.
  350. * @param[in] temp_en Temperature measure enable. True if enabled.
  351. *
  352. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_write
  353. */
  354. ret_code_t lis2dh12_temp_enable(lis2dh12_instance_t * p_inst, bool temp_en);
  355. /**
  356. * @brief Function for reading temperature data.
  357. *
  358. * @param[in] p_inst Pointer to sensor instance.
  359. * @param[in] user_cb Function to be called after temperature read is complete.
  360. * @param[in] p_temp Temperature value. Pointer to single int16_t.
  361. *
  362. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  363. */
  364. ret_code_t lis2dh12_temp_read(lis2dh12_instance_t * p_inst,
  365. lis2dh12_temp_cb_t user_cb,
  366. int16_t * p_temp);
  367. /**
  368. * @brief Function for reading temperature status register.
  369. *
  370. * @param[in] p_inst Pointer to sensor instance.
  371. * @param[in] user_cb Function to be called after register read.
  372. * @param[in] p_data Pointer to register data. Single uint8_t.
  373. *
  374. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  375. */
  376. __STATIC_INLINE ret_code_t lis2dh12_temp_status_read(lis2dh12_instance_t * p_inst,
  377. nrf_twi_sensor_reg_cb_t user_cb,
  378. uint8_t * p_data);
  379. /**
  380. * @brief Function for reading WHO_AM_I register.
  381. *
  382. * @param[in] p_inst Pointer to sensor instance.
  383. * @param[in] user_cb Function to be called after register read.
  384. * @param[in] p_data Pointer to register data. Single uint8_t.
  385. *
  386. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  387. */
  388. __STATIC_INLINE ret_code_t lis2dh12_who_am_i_read(lis2dh12_instance_t * p_inst,
  389. nrf_twi_sensor_reg_cb_t user_cb,
  390. uint8_t * p_data);
  391. /**
  392. * @brief Function for reading status register.
  393. *
  394. * @param[in] p_inst Pointer to sensor instance.
  395. * @param[in] user_cb Function to be called after register read.
  396. * @param[in] p_data Pointer to register data. Single uint8_t.
  397. *
  398. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  399. */
  400. __STATIC_INLINE ret_code_t lis2dh12_status_read(lis2dh12_instance_t * p_inst,
  401. nrf_twi_sensor_reg_cb_t user_cb,
  402. uint8_t * p_data);
  403. /**
  404. * @brief Function for reading FIFO source register.
  405. *
  406. * @param[in] p_inst Pointer to sensor instance.
  407. * @param[in] user_cb Function to be called after register read.
  408. * @param[in] p_data Pointer to register data. Single uint8_t.
  409. *
  410. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  411. */
  412. __STATIC_INLINE ret_code_t lis2dh12_fifo_src_read(lis2dh12_instance_t * p_inst,
  413. nrf_twi_sensor_reg_cb_t user_cb,
  414. uint8_t * p_data);
  415. /**
  416. * @brief Function for reading interrupt 1 source register.
  417. *
  418. * @param[in] p_inst Pointer to sensor instance.
  419. * @param[in] user_cb Function to be called after register read.
  420. * @param[in] p_data Pointer to register data. Single uint8_t.
  421. *
  422. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  423. */
  424. __STATIC_INLINE ret_code_t lis2dh12_int1_src_read(lis2dh12_instance_t * p_inst,
  425. nrf_twi_sensor_reg_cb_t user_cb,
  426. uint8_t * p_data);
  427. /**
  428. * @brief Function for reading interrupt 2 source register.
  429. *
  430. * @param[in] p_inst Pointer to sensor instance.
  431. * @param[in] user_cb Function to be called after register read.
  432. * @param[in] p_data Pointer to register data. Single uint8_t.
  433. *
  434. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  435. */
  436. __STATIC_INLINE ret_code_t lis2dh12_int2_src_read(lis2dh12_instance_t * p_inst,
  437. nrf_twi_sensor_reg_cb_t user_cb,
  438. uint8_t * p_data);
  439. /**
  440. * @brief Function for reading click source register.
  441. *
  442. * @param[in] p_inst Pointer to sensor instance.
  443. * @param[in] user_cb Function to be called after register read.
  444. * @param[in] p_data Pointer to register data. Single uint8_t.
  445. *
  446. * @return Return error code from nrf_twi_sensor @ref nrf_twi_sensor_reg_read
  447. */
  448. __STATIC_INLINE ret_code_t lis2dh12_click_src_read(lis2dh12_instance_t * p_inst,
  449. nrf_twi_sensor_reg_cb_t user_cb,
  450. uint8_t * p_data);
  451. #ifdef __cplusplus
  452. }
  453. #endif
  454. #endif // LIS2DH12_H