hi ExXec,
Sorry I'm not entirely sure I understand the question you're asking, but it looks like the tm4c123 has hardware SPI so I'll assume you want to match the STM32 functionality where you get hardware SPI if you pass an id to the constructor, or software SPI if you pass miso/mosi/clk instead.
In which case, you want to do exactly what the STM32 port does -- set
Code: Select all
.make_new = mp_machine_spi_make_new
and in mpconfigport.h
Code: Select all
#define MICROPY_PY_MACHINE_SPI_MAKE_NEW machine_hard_spi_make_new
and in your modmachine.c
Code: Select all
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&machine_hard_spi_type) },
If all you want is software SPI, ignoring the hardware peripheral, then don't set MICROPY_PY_MACHINE_SPI_MAKE_NEW and use machine_soft_spi_type in your modmachine.c (see ESP32).
You're going to have trouble with the locals dict, because there's no externs for the existing members (and duplicating the table would be fragile anyway). Not sure the best option there... I wonder if you could create a subclass which adds your additional locals (and then register that subclass in modmachine.c instead).