aboutsummaryrefslogtreecommitdiff
path: root/ports/nrf
diff options
context:
space:
mode:
authorDamien George2020-09-16 13:30:48 +1000
committerDamien George2020-10-01 12:57:10 +1000
commitc35deb2625efc877b3a0d03d5654e27232b2d101 (patch)
treee3706c52baba2498fae9db769ea5167f321ce427 /ports/nrf
parentc711c0049e5f12cae048d2b0e77bc70e68804ea5 (diff)
extmod/machine_i2c: Rename type to SoftI2C and add custom print method.
Also rename machine_i2c_type to mp_machine_soft_i2c_type. These changes make it clear that it's a soft-I2C implementation, and match SoftSPI. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/nrf')
-rw-r--r--ports/nrf/modules/machine/i2c.h2
-rw-r--r--ports/nrf/modules/machine/modmachine.c2
-rw-r--r--ports/nrf/mphalport.h2
3 files changed, 4 insertions, 2 deletions
diff --git a/ports/nrf/modules/machine/i2c.h b/ports/nrf/modules/machine/i2c.h
index 92194ce75..3c4fde983 100644
--- a/ports/nrf/modules/machine/i2c.h
+++ b/ports/nrf/modules/machine/i2c.h
@@ -27,7 +27,7 @@
#ifndef I2C_H__
#define I2C_H__
-extern const mp_obj_type_t machine_i2c_type;
+#include "extmod/machine_i2c.h"
void i2c_init0(void);
diff --git a/ports/nrf/modules/machine/modmachine.c b/ports/nrf/modules/machine/modmachine.c
index 48730c849..786abac7c 100644
--- a/ports/nrf/modules/machine/modmachine.c
+++ b/ports/nrf/modules/machine/modmachine.c
@@ -208,7 +208,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&machine_hard_spi_type) },
#endif
#if MICROPY_PY_MACHINE_I2C
- { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_i2c_type) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&mp_machine_soft_i2c_type) },
#endif
#if MICROPY_PY_MACHINE_ADC
{ MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&machine_adc_type) },
diff --git a/ports/nrf/mphalport.h b/ports/nrf/mphalport.h
index 15b37b7ef..5900559b5 100644
--- a/ports/nrf/mphalport.h
+++ b/ports/nrf/mphalport.h
@@ -54,8 +54,10 @@ void mp_hal_delay_us(mp_uint_t us);
const char *nrfx_error_code_lookup(uint32_t err_code);
+#define MP_HAL_PIN_FMT "%q"
#define mp_hal_pin_obj_t const pin_obj_t *
#define mp_hal_get_pin_obj(o) pin_find(o)
+#define mp_hal_pin_name(p) ((p)->name)
#define mp_hal_pin_high(p) nrf_gpio_pin_set(p->pin)
#define mp_hal_pin_low(p) nrf_gpio_pin_clear(p->pin)
#define mp_hal_pin_read(p) (nrf_gpio_pin_dir_get(p->pin) == NRF_GPIO_PIN_DIR_OUTPUT) ? nrf_gpio_pin_out_read(p->pin) : nrf_gpio_pin_read(p->pin)