Skip to content

Commit d2e730b

Browse files
committed
nrf/i2c: Add support for TWIM (EasyDMA).
1 parent 4102320 commit d2e730b

File tree

1 file changed

+23
-1
lines changed
  • ports/nrf/modules/machine

1 file changed

+23
-1
lines changed

ports/nrf/modules/machine/i2c.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,33 @@
3131
#include "py/runtime.h"
3232
#include "py/mperrno.h"
3333
#include "py/mphal.h"
34+
35+
#if MICROPY_PY_MACHINE_I2C
36+
3437
#include "extmod/machine_i2c.h"
3538
#include "i2c.h"
39+
#if NRFX_TWI_ENABLED
3640
#include "nrfx_twi.h"
41+
#else
42+
#include "nrfx_twim.h"
43+
#endif
3744

38-
#if MICROPY_PY_MACHINE_I2C
45+
#if NRFX_TWIM_ENABLED
46+
47+
#define nrfx_twi_t nrfx_twim_t
48+
#define nrfx_twi_config_t nrfx_twim_config_t
49+
50+
#define nrfx_twi_init nrfx_twim_init
51+
#define nrfx_twi_enable nrfx_twim_enable
52+
#define nrfx_twi_rx nrfx_twim_rx
53+
#define nrfx_twi_tx nrfx_twim_tx
54+
#define nrfx_twi_disable nrfx_twim_disable
55+
56+
#define NRFX_TWI_INSTANCE NRFX_TWIM_INSTANCE
57+
58+
#define NRF_TWI_FREQ_400K NRF_TWIM_FREQ_400K
59+
60+
#endif
3961

4062
STATIC const mp_obj_type_t machine_hard_i2c_type;
4163

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy