nrf/i2c: Add support for TWIM (EasyDMA).

This commit is contained in:
Glenn Ruben Bakke 2018-12-23 16:22:00 +01:00
parent 4102320e90
commit d2e730b727
1 changed files with 25 additions and 3 deletions

View File

@ -31,12 +31,34 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "py/mperrno.h" #include "py/mperrno.h"
#include "py/mphal.h" #include "py/mphal.h"
#include "extmod/machine_i2c.h"
#include "i2c.h"
#include "nrfx_twi.h"
#if MICROPY_PY_MACHINE_I2C #if MICROPY_PY_MACHINE_I2C
#include "extmod/machine_i2c.h"
#include "i2c.h"
#if NRFX_TWI_ENABLED
#include "nrfx_twi.h"
#else
#include "nrfx_twim.h"
#endif
#if NRFX_TWIM_ENABLED
#define nrfx_twi_t nrfx_twim_t
#define nrfx_twi_config_t nrfx_twim_config_t
#define nrfx_twi_init nrfx_twim_init
#define nrfx_twi_enable nrfx_twim_enable
#define nrfx_twi_rx nrfx_twim_rx
#define nrfx_twi_tx nrfx_twim_tx
#define nrfx_twi_disable nrfx_twim_disable
#define NRFX_TWI_INSTANCE NRFX_TWIM_INSTANCE
#define NRF_TWI_FREQ_400K NRF_TWIM_FREQ_400K
#endif
STATIC const mp_obj_type_t machine_hard_i2c_type; STATIC const mp_obj_type_t machine_hard_i2c_type;
typedef struct _machine_hard_i2c_obj_t { typedef struct _machine_hard_i2c_obj_t {