nrf_twim.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. /**
  2. * Copyright (c) 2015 - 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 NRF_TWIM_H__
  41. #define NRF_TWIM_H__
  42. #include <nrfx.h>
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. /**
  47. * @defgroup nrf_twim_hal TWIM HAL
  48. * @{
  49. * @ingroup nrf_twim
  50. * @brief Hardware access layer for managing the TWIM peripheral.
  51. */
  52. /**
  53. * @brief TWIM tasks.
  54. */
  55. typedef enum
  56. {
  57. /*lint -save -e30*/
  58. NRF_TWIM_TASK_STARTRX = offsetof(NRF_TWIM_Type, TASKS_STARTRX), ///< Start TWI receive sequence.
  59. NRF_TWIM_TASK_STARTTX = offsetof(NRF_TWIM_Type, TASKS_STARTTX), ///< Start TWI transmit sequence.
  60. NRF_TWIM_TASK_STOP = offsetof(NRF_TWIM_Type, TASKS_STOP), ///< Stop TWI transaction.
  61. NRF_TWIM_TASK_SUSPEND = offsetof(NRF_TWIM_Type, TASKS_SUSPEND), ///< Suspend TWI transaction.
  62. NRF_TWIM_TASK_RESUME = offsetof(NRF_TWIM_Type, TASKS_RESUME) ///< Resume TWI transaction.
  63. /*lint -restore*/
  64. } nrf_twim_task_t;
  65. /**
  66. * @brief TWIM events.
  67. */
  68. typedef enum
  69. {
  70. /*lint -save -e30*/
  71. NRF_TWIM_EVENT_STOPPED = offsetof(NRF_TWIM_Type, EVENTS_STOPPED), ///< TWI stopped.
  72. NRF_TWIM_EVENT_ERROR = offsetof(NRF_TWIM_Type, EVENTS_ERROR), ///< TWI error.
  73. NRF_TWIM_EVENT_SUSPENDED = 0x148, ///< TWI suspended.
  74. NRF_TWIM_EVENT_RXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_RXSTARTED), ///< Receive sequence started.
  75. NRF_TWIM_EVENT_TXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_TXSTARTED), ///< Transmit sequence started.
  76. NRF_TWIM_EVENT_LASTRX = offsetof(NRF_TWIM_Type, EVENTS_LASTRX), ///< Byte boundary, starting to receive the last byte.
  77. NRF_TWIM_EVENT_LASTTX = offsetof(NRF_TWIM_Type, EVENTS_LASTTX) ///< Byte boundary, starting to transmit the last byte.
  78. /*lint -restore*/
  79. } nrf_twim_event_t;
  80. /**
  81. * @brief TWIM shortcuts.
  82. */
  83. typedef enum
  84. {
  85. NRF_TWIM_SHORT_LASTTX_STARTRX_MASK = TWIM_SHORTS_LASTTX_STARTRX_Msk, ///< Shortcut between LASTTX event and STARTRX task.
  86. NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK = TWIM_SHORTS_LASTTX_SUSPEND_Msk, ///< Shortcut between LASTTX event and SUSPEND task.
  87. NRF_TWIM_SHORT_LASTTX_STOP_MASK = TWIM_SHORTS_LASTTX_STOP_Msk, ///< Shortcut between LASTTX event and STOP task.
  88. NRF_TWIM_SHORT_LASTRX_STARTTX_MASK = TWIM_SHORTS_LASTRX_STARTTX_Msk, ///< Shortcut between LASTRX event and STARTTX task.
  89. NRF_TWIM_SHORT_LASTRX_STOP_MASK = TWIM_SHORTS_LASTRX_STOP_Msk, ///< Shortcut between LASTRX event and STOP task.
  90. NRF_TWIM_ALL_SHORTS_MASK = TWIM_SHORTS_LASTTX_STARTRX_Msk |
  91. TWIM_SHORTS_LASTTX_SUSPEND_Msk |
  92. TWIM_SHORTS_LASTTX_STOP_Msk |
  93. TWIM_SHORTS_LASTRX_STARTTX_Msk |
  94. TWIM_SHORTS_LASTRX_STOP_Msk ///< All TWIM shortcuts.
  95. } nrf_twim_short_mask_t;
  96. /**
  97. * @brief TWIM interrupts.
  98. */
  99. typedef enum
  100. {
  101. NRF_TWIM_INT_STOPPED_MASK = TWIM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event.
  102. NRF_TWIM_INT_ERROR_MASK = TWIM_INTENSET_ERROR_Msk, ///< Interrupt on ERROR event.
  103. NRF_TWIM_INT_SUSPENDED_MASK = TWIM_INTENSET_SUSPENDED_Msk, ///< Interrupt on SUSPENDED event.
  104. NRF_TWIM_INT_RXSTARTED_MASK = TWIM_INTENSET_RXSTARTED_Msk, ///< Interrupt on RXSTARTED event.
  105. NRF_TWIM_INT_TXSTARTED_MASK = TWIM_INTENSET_TXSTARTED_Msk, ///< Interrupt on TXSTARTED event.
  106. NRF_TWIM_INT_LASTRX_MASK = TWIM_INTENSET_LASTRX_Msk, ///< Interrupt on LASTRX event.
  107. NRF_TWIM_INT_LASTTX_MASK = TWIM_INTENSET_LASTTX_Msk, ///< Interrupt on LASTTX event.
  108. NRF_TWIM_ALL_INTS_MASK = TWIM_INTENSET_STOPPED_Msk |
  109. TWIM_INTENSET_ERROR_Msk |
  110. TWIM_INTENSET_SUSPENDED_Msk |
  111. TWIM_INTENSET_RXSTARTED_Msk |
  112. TWIM_INTENSET_TXSTARTED_Msk |
  113. TWIM_INTENSET_LASTRX_Msk |
  114. TWIM_INTENSET_LASTTX_Msk ///< Interrupt on LASTTX event.
  115. } nrf_twim_int_mask_t;
  116. /**
  117. * @brief TWIM master clock frequency.
  118. */
  119. typedef enum
  120. {
  121. NRF_TWIM_FREQ_100K = TWIM_FREQUENCY_FREQUENCY_K100, ///< 100 kbps.
  122. NRF_TWIM_FREQ_250K = TWIM_FREQUENCY_FREQUENCY_K250, ///< 250 kbps.
  123. NRF_TWIM_FREQ_400K = TWIM_FREQUENCY_FREQUENCY_K400 ///< 400 kbps.
  124. } nrf_twim_frequency_t;
  125. /**
  126. * @brief TWIM error source.
  127. */
  128. typedef enum
  129. {
  130. NRF_TWIM_ERROR_ADDRESS_NACK = TWIM_ERRORSRC_ANACK_Msk, ///< NACK received after sending the address.
  131. NRF_TWIM_ERROR_DATA_NACK = TWIM_ERRORSRC_DNACK_Msk ///< NACK received after sending a data byte.
  132. } nrf_twim_error_t;
  133. /**
  134. * @brief Function for activating a specific TWIM task.
  135. *
  136. * @param[in] p_reg Pointer to the peripheral registers structure.
  137. * @param[in] task Task to activate.
  138. */
  139. __STATIC_INLINE void nrf_twim_task_trigger(NRF_TWIM_Type * p_reg,
  140. nrf_twim_task_t task);
  141. /**
  142. * @brief Function for getting the address of a specific TWIM task register.
  143. *
  144. * @param[in] p_reg Pointer to the peripheral registers structure.
  145. * @param[in] task Requested task.
  146. *
  147. * @return Address of the specified task register.
  148. */
  149. __STATIC_INLINE uint32_t * nrf_twim_task_address_get(NRF_TWIM_Type * p_reg,
  150. nrf_twim_task_t task);
  151. /**
  152. * @brief Function for clearing a specific TWIM event.
  153. *
  154. * @param[in] p_reg Pointer to the peripheral registers structure.
  155. * @param[in] event Event to clear.
  156. */
  157. __STATIC_INLINE void nrf_twim_event_clear(NRF_TWIM_Type * p_reg,
  158. nrf_twim_event_t event);
  159. /**
  160. * @brief Function for checking the state of a specific TWIM event.
  161. *
  162. * @param[in] p_reg Pointer to the peripheral registers structure.
  163. * @param[in] event Event to check.
  164. *
  165. * @retval true If the event is set.
  166. * @retval false If the event is not set.
  167. */
  168. __STATIC_INLINE bool nrf_twim_event_check(NRF_TWIM_Type * p_reg,
  169. nrf_twim_event_t event);
  170. /**
  171. * @brief Function for getting the address of a specific TWIM event register.
  172. *
  173. * @param[in] p_reg Pointer to the peripheral registers structure.
  174. * @param[in] event Requested event.
  175. *
  176. * @return Address of the specified event register.
  177. */
  178. __STATIC_INLINE uint32_t * nrf_twim_event_address_get(NRF_TWIM_Type * p_reg,
  179. nrf_twim_event_t event);
  180. /**
  181. * @brief Function for enabling specified shortcuts.
  182. *
  183. * @param[in] p_reg Pointer to the peripheral registers structure.
  184. * @param[in] shorts_mask Shortcuts to enable.
  185. */
  186. __STATIC_INLINE void nrf_twim_shorts_enable(NRF_TWIM_Type * p_reg,
  187. uint32_t shorts_mask);
  188. /**
  189. * @brief Function for disabling specified shortcuts.
  190. *
  191. * @param[in] p_reg Pointer to the peripheral registers structure.
  192. * @param[in] shorts_mask Shortcuts to disable.
  193. */
  194. __STATIC_INLINE void nrf_twim_shorts_disable(NRF_TWIM_Type * p_reg,
  195. uint32_t shorts_mask);
  196. /**
  197. * @brief Function for enabling specified interrupts.
  198. *
  199. * @param[in] p_reg Pointer to the peripheral registers structure.
  200. * @param[in] int_mask Interrupts to enable.
  201. */
  202. __STATIC_INLINE void nrf_twim_int_enable(NRF_TWIM_Type * p_reg,
  203. uint32_t int_mask);
  204. /**
  205. * @brief Function for disabling specified interrupts.
  206. *
  207. * @param[in] p_reg Pointer to the peripheral registers structure.
  208. * @param[in] int_mask Interrupts to disable.
  209. */
  210. __STATIC_INLINE void nrf_twim_int_disable(NRF_TWIM_Type * p_reg,
  211. uint32_t int_mask);
  212. /**
  213. * @brief Function for checking the state of a given interrupt.
  214. *
  215. * @param[in] p_reg Pointer to the peripheral registers structure.
  216. * @param[in] int_mask Interrupt to check.
  217. *
  218. * @retval true If the interrupt is enabled.
  219. * @retval false If the interrupt is not enabled.
  220. */
  221. __STATIC_INLINE bool nrf_twim_int_enable_check(NRF_TWIM_Type * p_reg,
  222. nrf_twim_int_mask_t int_mask);
  223. /**
  224. * @brief Function for enabling the TWIM peripheral.
  225. *
  226. * @param[in] p_reg Pointer to the peripheral registers structure.
  227. */
  228. __STATIC_INLINE void nrf_twim_enable(NRF_TWIM_Type * p_reg);
  229. /**
  230. * @brief Function for disabling the TWIM peripheral.
  231. *
  232. * @param[in] p_reg Pointer to the peripheral registers structure.
  233. */
  234. __STATIC_INLINE void nrf_twim_disable(NRF_TWIM_Type * p_reg);
  235. /**
  236. * @brief Function for configuring TWI pins.
  237. *
  238. *
  239. * @param[in] p_reg Pointer to the peripheral registers structure.
  240. * @param[in] scl_pin SCL pin number.
  241. * @param[in] sda_pin SDA pin number.
  242. */
  243. __STATIC_INLINE void nrf_twim_pins_set(NRF_TWIM_Type * p_reg,
  244. uint32_t scl_pin,
  245. uint32_t sda_pin);
  246. /**
  247. * @brief Function for setting the TWI master clock frequency.
  248. *
  249. * @param[in] p_reg Pointer to the peripheral registers structure.
  250. * @param[in] frequency TWI frequency.
  251. */
  252. __STATIC_INLINE void nrf_twim_frequency_set(NRF_TWIM_Type * p_reg,
  253. nrf_twim_frequency_t frequency);
  254. /**
  255. * @brief Function for checking the TWI error source.
  256. *
  257. * The error flags are cleared after reading.
  258. *
  259. * @param[in] p_reg Pointer to the peripheral registers structure.
  260. *
  261. * @return Mask with error source flags.
  262. */
  263. __STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear(NRF_TWIM_Type * p_reg);
  264. /**
  265. * @brief Function for setting the address to be used in TWI transfers.
  266. *
  267. * @param[in] p_reg Pointer to the peripheral registers structure.
  268. * @param[in] address Address to be used in transfers.
  269. */
  270. __STATIC_INLINE void nrf_twim_address_set(NRF_TWIM_Type * p_reg,
  271. uint8_t address);
  272. /**
  273. * @brief Function for setting the transmit buffer.
  274. *
  275. * @param[in] p_reg Pointer to the peripheral registers structure.
  276. * @param[in] p_buffer Pointer to the buffer with data to send.
  277. * @param[in] length Maximum number of data bytes to transmit.
  278. */
  279. __STATIC_INLINE void nrf_twim_tx_buffer_set(NRF_TWIM_Type * p_reg,
  280. uint8_t const * p_buffer,
  281. size_t length);
  282. /**
  283. * @brief Function for setting the receive buffer.
  284. *
  285. * @param[in] p_reg Pointer to the peripheral registers structure.
  286. * @param[in] p_buffer Pointer to the buffer for received data.
  287. * @param[in] length Maximum number of data bytes to receive.
  288. */
  289. __STATIC_INLINE void nrf_twim_rx_buffer_set(NRF_TWIM_Type * p_reg,
  290. uint8_t * p_buffer,
  291. size_t length);
  292. __STATIC_INLINE void nrf_twim_shorts_set(NRF_TWIM_Type * p_reg,
  293. uint32_t shorts_mask);
  294. __STATIC_INLINE size_t nrf_twim_txd_amount_get(NRF_TWIM_Type * p_reg);
  295. __STATIC_INLINE size_t nrf_twim_rxd_amount_get(NRF_TWIM_Type * p_reg);
  296. /**
  297. * @brief Function for enabling the TX list feature.
  298. *
  299. * @param[in] p_reg Pointer to the peripheral registers structure.
  300. */
  301. __STATIC_INLINE void nrf_twim_tx_list_enable(NRF_TWIM_Type * p_reg);
  302. /**
  303. * @brief Function for disabling the TX list feature.
  304. *
  305. * @param[in] p_reg Pointer to the peripheral registers structure.
  306. */
  307. __STATIC_INLINE void nrf_twim_tx_list_disable(NRF_TWIM_Type * p_reg);
  308. /**
  309. * @brief Function for enabling the RX list feature.
  310. *
  311. * @param[in] p_reg Pointer to the peripheral registers structure.
  312. */
  313. __STATIC_INLINE void nrf_twim_rx_list_enable(NRF_TWIM_Type * p_reg);
  314. /**
  315. * @brief Function for disabling the RX list feature.
  316. *
  317. * @param[in] p_reg Pointer to the peripheral registers structure.
  318. */
  319. __STATIC_INLINE void nrf_twim_rx_list_disable(NRF_TWIM_Type * p_reg);
  320. #ifndef SUPPRESS_INLINE_IMPLEMENTATION
  321. __STATIC_INLINE void nrf_twim_task_trigger(NRF_TWIM_Type * p_reg,
  322. nrf_twim_task_t task)
  323. {
  324. *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
  325. }
  326. __STATIC_INLINE uint32_t * nrf_twim_task_address_get(NRF_TWIM_Type * p_reg,
  327. nrf_twim_task_t task)
  328. {
  329. return (uint32_t *)((uint8_t *)p_reg + (uint32_t)task);
  330. }
  331. __STATIC_INLINE void nrf_twim_event_clear(NRF_TWIM_Type * p_reg,
  332. nrf_twim_event_t event)
  333. {
  334. *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
  335. #if __CORTEX_M == 0x04
  336. volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event));
  337. (void)dummy;
  338. #endif
  339. }
  340. __STATIC_INLINE bool nrf_twim_event_check(NRF_TWIM_Type * p_reg,
  341. nrf_twim_event_t event)
  342. {
  343. return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
  344. }
  345. __STATIC_INLINE uint32_t * nrf_twim_event_address_get(NRF_TWIM_Type * p_reg,
  346. nrf_twim_event_t event)
  347. {
  348. return (uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
  349. }
  350. __STATIC_INLINE void nrf_twim_shorts_enable(NRF_TWIM_Type * p_reg,
  351. uint32_t shorts_mask)
  352. {
  353. p_reg->SHORTS |= shorts_mask;
  354. }
  355. __STATIC_INLINE void nrf_twim_shorts_disable(NRF_TWIM_Type * p_reg,
  356. uint32_t shorts_mask)
  357. {
  358. p_reg->SHORTS &= ~(shorts_mask);
  359. }
  360. __STATIC_INLINE void nrf_twim_int_enable(NRF_TWIM_Type * p_reg,
  361. uint32_t int_mask)
  362. {
  363. p_reg->INTENSET = int_mask;
  364. }
  365. __STATIC_INLINE void nrf_twim_int_disable(NRF_TWIM_Type * p_reg,
  366. uint32_t int_mask)
  367. {
  368. p_reg->INTENCLR = int_mask;
  369. }
  370. __STATIC_INLINE bool nrf_twim_int_enable_check(NRF_TWIM_Type * p_reg,
  371. nrf_twim_int_mask_t int_mask)
  372. {
  373. return (bool)(p_reg->INTENSET & int_mask);
  374. }
  375. __STATIC_INLINE void nrf_twim_enable(NRF_TWIM_Type * p_reg)
  376. {
  377. p_reg->ENABLE = (TWIM_ENABLE_ENABLE_Enabled << TWIM_ENABLE_ENABLE_Pos);
  378. }
  379. __STATIC_INLINE void nrf_twim_disable(NRF_TWIM_Type * p_reg)
  380. {
  381. p_reg->ENABLE = (TWIM_ENABLE_ENABLE_Disabled << TWIM_ENABLE_ENABLE_Pos);
  382. }
  383. __STATIC_INLINE void nrf_twim_pins_set(NRF_TWIM_Type * p_reg,
  384. uint32_t scl_pin,
  385. uint32_t sda_pin)
  386. {
  387. p_reg->PSEL.SCL = scl_pin;
  388. p_reg->PSEL.SDA = sda_pin;
  389. }
  390. __STATIC_INLINE void nrf_twim_frequency_set(NRF_TWIM_Type * p_reg,
  391. nrf_twim_frequency_t frequency)
  392. {
  393. p_reg->FREQUENCY = frequency;
  394. }
  395. __STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear(NRF_TWIM_Type * p_reg)
  396. {
  397. uint32_t error_source = p_reg->ERRORSRC;
  398. // [error flags are cleared by writing '1' on their position]
  399. p_reg->ERRORSRC = error_source;
  400. return error_source;
  401. }
  402. __STATIC_INLINE void nrf_twim_address_set(NRF_TWIM_Type * p_reg,
  403. uint8_t address)
  404. {
  405. p_reg->ADDRESS = address;
  406. }
  407. __STATIC_INLINE void nrf_twim_tx_buffer_set(NRF_TWIM_Type * p_reg,
  408. uint8_t const * p_buffer,
  409. size_t length)
  410. {
  411. p_reg->TXD.PTR = (uint32_t)p_buffer;
  412. p_reg->TXD.MAXCNT = length;
  413. }
  414. __STATIC_INLINE void nrf_twim_rx_buffer_set(NRF_TWIM_Type * p_reg,
  415. uint8_t * p_buffer,
  416. size_t length)
  417. {
  418. p_reg->RXD.PTR = (uint32_t)p_buffer;
  419. p_reg->RXD.MAXCNT = length;
  420. }
  421. __STATIC_INLINE void nrf_twim_shorts_set(NRF_TWIM_Type * p_reg,
  422. uint32_t shorts_mask)
  423. {
  424. p_reg->SHORTS = shorts_mask;
  425. }
  426. __STATIC_INLINE size_t nrf_twim_txd_amount_get(NRF_TWIM_Type * p_reg)
  427. {
  428. return p_reg->TXD.AMOUNT;
  429. }
  430. __STATIC_INLINE size_t nrf_twim_rxd_amount_get(NRF_TWIM_Type * p_reg)
  431. {
  432. return p_reg->RXD.AMOUNT;
  433. }
  434. __STATIC_INLINE void nrf_twim_tx_list_enable(NRF_TWIM_Type * p_reg)
  435. {
  436. p_reg->TXD.LIST = 1;
  437. }
  438. __STATIC_INLINE void nrf_twim_tx_list_disable(NRF_TWIM_Type * p_reg)
  439. {
  440. p_reg->TXD.LIST = 0;
  441. }
  442. __STATIC_INLINE void nrf_twim_rx_list_enable(NRF_TWIM_Type * p_reg)
  443. {
  444. p_reg->RXD.LIST = 1;
  445. }
  446. __STATIC_INLINE void nrf_twim_rx_list_disable(NRF_TWIM_Type * p_reg)
  447. {
  448. p_reg->RXD.LIST = 0;
  449. }
  450. #endif // SUPPRESS_INLINE_IMPLEMENTATION
  451. /** @} */
  452. #ifdef __cplusplus
  453. }
  454. #endif
  455. #endif // NRF_TWIM_H__