mimxrt: Enable many Python and some extmod features.

Besides Python features this includes the extmod modules which make use of
the Pin module, especially machine.softSPI, machine.SoftI2C and onewire.
This commit is contained in:
robert-hh
2021-05-26 13:19:38 +02:00
committed by Damien George
parent a40e1473dc
commit bbdc98f72e
8 changed files with 91 additions and 17 deletions

View File

@@ -27,9 +27,13 @@
#include "py/runtime.h"
#include "extmod/machine_mem.h"
#include "extmod/machine_i2c.h"
#include "extmod/machine_signal.h"
#include "extmod/machine_spi.h"
#include "led.h"
#include "pin.h"
#include "modmachine.h"
#include "fsl_clock.h"
#include CPU_HEADER_H
@@ -40,7 +44,7 @@ STATIC mp_obj_t machine_reset(void) {
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
STATIC mp_obj_t machine_freq(void) {
return MP_OBJ_NEW_SMALL_INT(0);
return MP_OBJ_NEW_SMALL_INT(CLOCK_GetFreq(kCLOCK_CpuClk));
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_freq_obj, machine_freq);
@@ -57,6 +61,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) },
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&machine_timer_type) },
{ MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&machine_rtc_type) },
{ MP_ROM_QSTR(MP_QSTR_Signal), MP_ROM_PTR(&machine_signal_type) },
{ MP_ROM_QSTR(MP_QSTR_SoftI2C), MP_ROM_PTR(&mp_machine_soft_i2c_type) },
{ MP_ROM_QSTR(MP_QSTR_SoftSPI), MP_ROM_PTR(&mp_machine_soft_spi_type) },
};
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);