extmod/modmachine: Make I2C/SPI defns available when soft impl enabled.

Signed-off-by: Damien George <damien@micropython.org>
pull/13045/head
Damien George 2023-11-24 14:43:40 +11:00
rodzic 7b2f13fb69
commit 14432b5da0
1 zmienionych plików z 10 dodań i 6 usunięć

Wyświetl plik

@ -114,7 +114,7 @@
} \
} while (0)
#if MICROPY_PY_MACHINE_I2C
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SOFTI2C
#define MP_MACHINE_I2C_FLAG_READ (0x01) // if not set then it's a write
#define MP_MACHINE_I2C_FLAG_STOP (0x02)
@ -139,7 +139,7 @@ typedef struct _machine_mem_obj_t {
unsigned elem_size; // in bytes
} machine_mem_obj_t;
#if MICROPY_PY_MACHINE_I2C
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SOFTI2C
typedef struct _mp_machine_i2c_buf_t {
size_t len;
@ -175,7 +175,7 @@ typedef struct _mp_machine_soft_i2c_obj_t {
#endif
#if MICROPY_PY_MACHINE_SPI
#if MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_SOFTSPI
// SPI protocol.
typedef struct _mp_machine_spi_p_t {
@ -215,16 +215,20 @@ extern const mp_obj_type_t machine_timer_type;
extern const mp_obj_type_t machine_uart_type;
extern const mp_obj_type_t machine_wdt_type;
#if MICROPY_PY_MACHINE_I2C
#if MICROPY_PY_MACHINE_SOFTI2C
extern const mp_obj_type_t mp_machine_soft_i2c_type;
#endif
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SOFTI2C
extern const mp_obj_dict_t mp_machine_i2c_locals_dict;
#endif
#if MICROPY_PY_MACHINE_SPI
#if MICROPY_PY_MACHINE_SOFTSPI
extern const mp_obj_type_t mp_machine_soft_spi_type;
extern const mp_obj_dict_t mp_machine_spi_locals_dict;
extern const mp_machine_spi_p_t mp_machine_soft_spi_p;
#endif
#if MICROPY_PY_MACHINE_SPI || MICROPY_PY_MACHINE_SOFTSPI
extern const mp_obj_dict_t mp_machine_spi_locals_dict;
#endif
#if defined(MICROPY_MACHINE_MEM_GET_READ_ADDR)
uintptr_t MICROPY_MACHINE_MEM_GET_READ_ADDR(mp_obj_t addr_o, uint align);