Update MP Modules

* Update all modules for new API
* Move modules to built-in
This commit is contained in:
iabdalkader 2014-08-26 20:32:43 +02:00
parent 590bd22e2e
commit 0aeab28640
12 changed files with 100 additions and 132 deletions

View File

@ -131,7 +131,8 @@ OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/img/,\
point.o \ point.o \
ppm.o \ ppm.o \
rectangle.o \ rectangle.o \
surf.o \ fast.o \
freak.o \
template.o \ template.o \
) )
@ -230,8 +231,20 @@ export TOP_DIR
export BUILD export BUILD
export TARGET export TARGET
################################################### ###################################################
all: $(BUILD)/$(BIN).elf
all: | $(BUILD) $(BUILD):
$(MKDIR) -p $@
objs: | $(BUILD)
$(MAKE) -C $(CMSIS_DIR) BUILD=$(BUILD)/$(CMSIS_DIR)
$(MAKE) -C $(STHAL_DIR) BUILD=$(BUILD)/$(STHAL_DIR)
$(MAKE) -C $(FATFS_DIR) BUILD=$(BUILD)/$(FATFS_DIR)
$(MAKE) -C $(CC3K_DIR) BUILD=$(BUILD)/$(CC3K_DIR)
$(MAKE) -C $(MICROPY_DIR)/stmhal BUILD=$(BUILD)/$(MICROPY_DIR) BOARD=$(TARGET)
$(MAKE) -C $(OMV_DIR) BUILD=$(BUILD)/$(OMV_DIR)
$(BUILD)/$(BIN).elf: objs
$(CCP) -P -E -D$(TARGET) $(OMV_DIR)/stm32f4xx.ld.S > $(BUILD)/stm32f4xx.lds $(CCP) -P -E -D$(TARGET) $(OMV_DIR)/stm32f4xx.ld.S > $(BUILD)/stm32f4xx.lds
$(CC) $(LDFLAGS) $(OBJ) $(LIB) -o $(BUILD)/$(BIN).elf $(CC) $(LDFLAGS) $(OBJ) $(LIB) -o $(BUILD)/$(BIN).elf
$(OBJCOPY) -Obinary $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).bin $(OBJCOPY) -Obinary $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).bin
@ -240,15 +253,6 @@ all: | $(BUILD)
size: size:
$(SIZE) $(BUILD)/$(BIN).elf $(SIZE) $(BUILD)/$(BIN).elf
$(BUILD):
$(MKDIR) -p $@
$(MAKE) -C $(CMSIS_DIR) BUILD=$(BUILD)/$(CMSIS_DIR)
$(MAKE) -C $(STHAL_DIR) BUILD=$(BUILD)/$(STHAL_DIR)
$(MAKE) -C $(FATFS_DIR) BUILD=$(BUILD)/$(FATFS_DIR)
$(MAKE) -C $(CC3K_DIR) BUILD=$(BUILD)/$(CC3K_DIR)
$(MAKE) -C $(MICROPY_DIR)/stmhal BUILD=$(BUILD)/$(MICROPY_DIR) BOARD=$(TARGET)
$(MAKE) -C $(OMV_DIR) BUILD=$(BUILD)/$(OMV_DIR)
clean: clean:
$(RM) -fr $(BUILD) $(RM) -fr $(BUILD)

@ -1 +1 @@
Subproject commit a7b367bc39e6bef9c5e26e99f859264675fb3417 Subproject commit 686ad5b151b1a50bb98b716fb5f7ad6c4c1f3e1b

View File

@ -1,10 +1,10 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stm32f4xx_hal.h> #include <stm32f4xx_hal.h>
#include "mpconfig.h"
#include "misc.h" #include "misc.h"
#include "systick.h" #include "systick.h"
#include "pendsv.h" #include "pendsv.h"
#include "mpconfig.h"
#include "qstr.h" #include "qstr.h"
#include "misc.h" #include "misc.h"
#include "nlr.h" #include "nlr.h"
@ -14,11 +14,12 @@
#include "objmodule.h" #include "objmodule.h"
#include "runtime.h" #include "runtime.h"
#include "gc.h" #include "gc.h"
#include "stackctrl.h"
#include "gccollect.h" #include "gccollect.h"
#include "uart.h"
#include "pybstdio.h" #include "pybstdio.h"
#include "readline.h" #include "readline.h"
#include "pyexec.h" #include "pyexec.h"
#include "uart.h"
#include "timer.h" #include "timer.h"
#include "pin.h" #include "pin.h"
#include "extint.h" #include "extint.h"
@ -51,6 +52,7 @@
int errno; int errno;
static FATFS fatfs0; static FATFS fatfs0;
static FATFS fatfs1; static FATFS fatfs1;
extern char _stack_size;
void flash_error(int n) { void flash_error(int n) {
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
@ -127,18 +129,21 @@ STATIC mp_obj_t py_random(mp_obj_t min, mp_obj_t max) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_random_obj, py_random); STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_random_obj, py_random);
STATIC mp_obj_t py_gc_collect() {
gc_collect();
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_gc_collect_obj, py_gc_collect);
extern uint32_t SystemCoreClock; extern uint32_t SystemCoreClock;
STATIC mp_obj_t py_cpu_freq(void ) { STATIC mp_obj_t py_cpu_freq(void ) {
return mp_obj_new_int(SystemCoreClock); return mp_obj_new_int(SystemCoreClock);
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_cpu_freq_obj, py_cpu_freq); STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_cpu_freq_obj, py_cpu_freq);
static NORETURN mp_obj_t mp_sys_exit(uint n_args, const mp_obj_t *args) {
int rc = 0;
if (n_args > 0) {
rc = mp_obj_get_int(args[0]);
}
nlr_raise(mp_obj_new_exception_arg1(&mp_type_SystemExit, mp_obj_new_int(rc)));
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);
static const char fresh_main_py[] = static const char fresh_main_py[] =
"# main.py -- put your code here!\n" "# main.py -- put your code here!\n"
"import led, time\n" "import led, time\n"
@ -173,26 +178,30 @@ static const char fresh_readme_txt[] =
; ;
typedef struct { typedef struct {
qstr name;
const mp_obj_module_t *(*init)(void); const mp_obj_module_t *(*init)(void);
} module_t; } module_t;
static const module_t exported_modules[] ={ static const module_t init_modules[] ={
{MP_QSTR_sensor, py_sensor_init}, {py_sensor_init},
{MP_QSTR_led, py_led_init}, {py_led_init},
{MP_QSTR_time, py_time_init}, {py_time_init},
// {MP_QSTR_wlan, py_wlan_init}, // {py_wlan_init},
// {MP_QSTR_socket, py_socket_init}, // {py_socket_init},
// {MP_QSTR_select, py_select_init}, // {py_select_init},
{MP_QSTR_spi, py_spi_init}, {py_spi_init},
{MP_QSTR_gpio, py_gpio_init}, {py_gpio_init},
#ifdef OPENMV2 #ifdef OPENMV2
{MP_QSTR_mlx, py_mlx90620_init}, {py_mlx90620_init},
#endif #endif
{0, NULL} {NULL}
}; };
int main(void) { int main(void)
{
// Stack limit should be less than real stack size, so we
// had chance to recover from limit hit.
mp_stack_set_limit((mp_uint_t) (&_stack_size - 512));
/* STM32F4xx HAL library initialization: /* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches - Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec - Configure the Systick to generate an interrupt each 1 msec
@ -211,6 +220,7 @@ int main(void) {
} }
#endif #endif
#endif #endif
// basic sub-system init // basic sub-system init
pendsv_init(); pendsv_init();
timer_tim3_init(); timer_tim3_init();
@ -242,81 +252,77 @@ soft_reset:
// GC init // GC init
gc_init(&_heap_start, &_heap_end); gc_init(&_heap_start, &_heap_end);
xalloc_init();
#if 0
// Change #if 0 to #if 1 if you want REPL on UART_6 (or another uart)
// as well as on USB VCP
mp_obj_t args[2] = {
MP_OBJ_NEW_SMALL_INT(PYB_UART_6),
MP_OBJ_NEW_SMALL_INT(115200),
};
pyb_uart_global_debug = pyb_uart_type.make_new((mp_obj_t)&pyb_uart_type,
ARRAY_SIZE(args),
0, args);
#else
pyb_uart_global_debug = NULL;
#endif
// Micro Python init // Micro Python init
qstr_init();
mp_init(); mp_init();
mp_obj_list_init(mp_sys_path, 0); mp_obj_list_init(mp_sys_path, 0);
mp_obj_list_init(mp_sys_argv, 0);
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_)); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_));
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib)); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib));
mp_obj_list_init(mp_sys_argv, 0);
readline_init(); readline_init0();
pin_init0();
extint_init0();
timer_init0();
pyb_usb_init0();
pin_init(); xalloc_init();
extint_init(); rng_init();
usbdbg_init();
/* init built-in modules */
for (const module_t *p = init_modules; p->init; p++) {
const mp_obj_module_t *module = p->init();
if (module == NULL) {
__fatal_error("failed to init module");
}
}
/* Export functions to the global python namespace */
mp_store_global(qstr_from_str("vcp_is_connected"), (mp_obj_t)&py_vcp_is_connected_obj);
mp_store_global(qstr_from_str("Image"), (mp_obj_t)&py_image_load_image);
mp_store_global(qstr_from_str("HaarCascade"), (mp_obj_t)&py_image_load_cascade);
mp_store_global(qstr_from_str("cpu_freq"), (mp_obj_t)&py_cpu_freq);
mp_store_global(qstr_from_str("random"), (mp_obj_t)&py_random);
pyb_stdio_uart = NULL;
// local filesystem init
// try to mount the flash // try to mount the flash
FRESULT res = f_mount(&fatfs0, "0:", 1); FRESULT res = f_mount(&fatfs0, "0:", 1);
if (reset_mode == 3 || res == FR_NO_FILESYSTEM) { if (reset_mode == 3 || res == FR_NO_FILESYSTEM) {
// no filesystem, or asked to reset it, so create a fresh one // no filesystem, or asked to reset it, so create a fresh one
// LED on to indicate creation of LFS // LED on to indicate creation of LFS
led_state(LED_RED, 1); led_state(LED_RED, 1);
res = f_mkfs("0:", 0, 0); if (f_mkfs("0:", 0, 0) != FR_OK) {
if (res == FR_OK) {
// success creating fresh LFS
} else {
__fatal_error("could not create LFS"); __fatal_error("could not create LFS");
} }
// create empty main.py // create empty main.py
FIL fp; FIL fp;
f_open(&fp, "0:/main.py", FA_WRITE | FA_CREATE_ALWAYS);
UINT n; UINT n;
f_open(&fp, "main.py", FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fp, fresh_main_py, sizeof(fresh_main_py) - 1 /* don't count null terminator */, &n); f_write(&fp, fresh_main_py, sizeof(fresh_main_py) - 1 /* don't count null terminator */, &n);
// TODO check we could write n bytes
f_close(&fp); f_close(&fp);
// create .inf driver file // create .inf driver file
f_open(&fp, "0:/pybcdc.inf", FA_WRITE | FA_CREATE_ALWAYS); f_open(&fp, "pybcdc.inf", FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fp, fresh_pybcdc_inf, sizeof(fresh_pybcdc_inf) - 1 /* don't count null terminator */, &n); f_write(&fp, fresh_pybcdc_inf, sizeof(fresh_pybcdc_inf) - 1 /* don't count null terminator */, &n);
f_close(&fp); f_close(&fp);
// create readme file // create readme file
f_open(&fp, "0:/README.txt", FA_WRITE | FA_CREATE_ALWAYS); f_open(&fp, "README.txt", FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fp, fresh_readme_txt, sizeof(fresh_readme_txt) - 1 /* don't count null terminator */, &n); f_write(&fp, fresh_readme_txt, sizeof(fresh_readme_txt) - 1 /* don't count null terminator */, &n);
f_close(&fp); f_close(&fp);
// keep LED on for at least 200ms
led_state(LED_RED, 0); led_state(LED_RED, 0);
} else if (res != FR_OK) { } else if (res != FR_OK) {
__fatal_error("could not access LFS"); __fatal_error("could not access LFS");
} }
// root device defaults to internal flash filesystem // Set CWD and USB medium to flash
uint root_device = 0; f_chdrive("0:");
#if defined(USE_DEVICE_MODE)
usb_storage_medium_t usb_medium = USB_STORAGE_MEDIUM_FLASH; usb_storage_medium_t usb_medium = USB_STORAGE_MEDIUM_FLASH;
#endif
// if an SD card is present then mount it on 1:/ // if an SD card is present then mount it on 1:/
if (reset_mode == 1 && sdcard_is_present()) { if (reset_mode == 1 && sdcard_is_present()) {
@ -325,7 +331,7 @@ soft_reset:
printf("[SD] could not mount SD card\n"); printf("[SD] could not mount SD card\n");
} else { } else {
// use SD card as root device // use SD card as root device
root_device = 1; f_chdrive("1:");
if (first_soft_reset) { if (first_soft_reset) {
// use SD card as medium for the USB MSD // use SD card as medium for the USB MSD
@ -360,51 +366,17 @@ soft_reset:
} }
#endif #endif
timer_init0(); // Run the main script from the current directory.
rng_init();
usbdbg_init();
/* Add functions to the global python namespace */
mp_store_global(qstr_from_str("vcp_is_connected"), mp_make_function_n(0, py_vcp_is_connected));
mp_store_global(qstr_from_str("Image"), mp_make_function_n(1, py_image_load_image));
mp_store_global(qstr_from_str("HaarCascade"), mp_make_function_n(1, py_image_load_cascade));
mp_store_global(qstr_from_str("cpu_freq"), mp_make_function_n(0, py_cpu_freq));
mp_store_global(qstr_from_str("random"), mp_make_function_n(2, py_random));
mp_store_global(qstr_from_str("gc_collect"), mp_make_function_n(0, py_gc_collect));
//mp_store_global(qstr_from_str("info"), mp_make_function_var(0, py_info));
/* Export Python modules to the global python namespace */
for (const module_t *p = exported_modules; p->name; p++) {
const mp_obj_module_t *module = p->init();
if (module == NULL) {
__fatal_error("failed to init module");
} else {
mp_module_register(p->name, (mp_obj_t)module);
}
}
// now that everything is initialised, run main script
if (reset_mode == 1 && pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) { if (reset_mode == 1 && pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL) {
vstr_t *vstr = vstr_new(); FRESULT res = f_stat("main.py", NULL);
vstr_printf(vstr, "%d:/", root_device);
if (pyb_config_main == MP_OBJ_NULL) {
vstr_add_str(vstr, "main.py");
} else {
vstr_add_str(vstr, mp_obj_str_get_str(pyb_config_main));
}
FRESULT res = f_stat(vstr_str(vstr), NULL);
if (res == FR_OK) { if (res == FR_OK) {
if (!pyexec_file(vstr_str(vstr))) { if (!pyexec_file("main.py")) {
flash_error(3); flash_error(3);
} }
} }
vstr_free(vstr);
} }
// Enter REPL // Enter REPL
// REPL mode can change, or it can request a soft reset
nlr_buf_t nlr; nlr_buf_t nlr;
for (;;) { for (;;) {
if (nlr_push(&nlr) == 0) { if (nlr_push(&nlr) == 0) {
@ -429,12 +401,3 @@ soft_reset:
first_soft_reset = false; first_soft_reset = false;
goto soft_reset; goto soft_reset;
} }
static NORETURN mp_obj_t mp_sys_exit(uint n_args, const mp_obj_t *args) {
int rc = 0;
if (n_args > 0) {
rc = mp_obj_get_int(args[0]);
}
nlr_raise(mp_obj_new_exception_arg1(&mp_type_SystemExit, mp_obj_new_int(rc)));
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);

View File

@ -233,7 +233,7 @@ static const mp_map_elem_t globals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
static const mp_obj_module_t mlx_module = { const mp_obj_module_t mlx_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_mlx, .name = MP_QSTR_mlx,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,

View File

@ -18,6 +18,7 @@
#include "stream.h" #include "stream.h"
#include "gc.h" #include "gc.h"
#include "gccollect.h" #include "gccollect.h"
#include "uart.h"
#include "pybstdio.h" #include "pybstdio.h"
#include "readline.h" #include "readline.h"
#include "pyexec.h" #include "pyexec.h"

View File

@ -78,7 +78,7 @@ static const mp_map_elem_t globals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
const mp_obj_module_t py_gpio_module = { const mp_obj_module_t gpio_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_gpio, .name = MP_QSTR_gpio,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
@ -87,5 +87,5 @@ const mp_obj_module_t py_gpio_module = {
const mp_obj_module_t *py_gpio_init() const mp_obj_module_t *py_gpio_init()
{ {
/* no init required */ /* no init required */
return &py_gpio_module; return &gpio_module;
} }

View File

@ -61,7 +61,7 @@ static const mp_map_elem_t globals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
static const mp_obj_module_t py_led_module = { const mp_obj_module_t led_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_led, .name = MP_QSTR_led,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
@ -71,5 +71,5 @@ const mp_obj_module_t *py_led_init()
{ {
/* Init LED */ /* Init LED */
led_init(LED_BLUE); led_init(LED_BLUE);
return &py_led_module; return &led_module;
} }

View File

@ -188,7 +188,7 @@ STATIC const mp_map_elem_t globals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
static const mp_obj_module_t py_sensor_module = { const mp_obj_module_t sensor_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_sensor, .name = MP_QSTR_sensor,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
@ -212,5 +212,5 @@ const mp_obj_module_t *py_sensor_init()
sensor_set_contrast(0); sensor_set_contrast(0);
sensor_set_brightness(0); sensor_set_brightness(0);
return &py_sensor_module; return &sensor_module;
} }

View File

@ -28,7 +28,7 @@ void socket_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_
printf("<%s %p>", mp_obj_get_type_str(self_in), self_in); printf("<%s %p>", mp_obj_get_type_str(self_in), self_in);
} }
static machine_int_t socket_send(mp_obj_t self_in, const void *buf, machine_uint_t size, int *errcode) static mp_uint_t socket_send(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode)
{ {
int bytes = 0; int bytes = 0;
socket_t *self = self_in; socket_t *self = self_in;
@ -54,7 +54,7 @@ static machine_int_t socket_send(mp_obj_t self_in, const void *buf, machine_uint
return bytes; return bytes;
} }
static machine_int_t socket_recv(mp_obj_t self_in, void *buf, machine_uint_t size, int *errcode) static mp_uint_t socket_recv(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode)
{ {
int bytes = 0; int bytes = 0;
socket_t *self = self_in; socket_t *self = self_in;

View File

@ -20,7 +20,7 @@ SPI_HandleTypeDef SPIHandle;
static DMA_HandleTypeDef hdma_tx; static DMA_HandleTypeDef hdma_tx;
static DMA_HandleTypeDef hdma_rx; static DMA_HandleTypeDef hdma_rx;
static machine_int_t py_spi_read(mp_obj_t obj) static mp_int_t py_spi_read(mp_obj_t obj)
{ {
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
@ -43,7 +43,7 @@ static machine_int_t py_spi_read(mp_obj_t obj)
return bufinfo.len; return bufinfo.len;
} }
static machine_int_t py_spi_write(mp_obj_t obj) static mp_int_t py_spi_write(mp_obj_t obj)
{ {
byte buf[1]; byte buf[1];
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
@ -85,7 +85,7 @@ static const mp_map_elem_t globals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
static const mp_obj_module_t py_spi_module = { const mp_obj_module_t spi_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_spi, .name = MP_QSTR_spi,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
@ -152,5 +152,5 @@ const mp_obj_module_t *py_spi_init()
/* dummy read */ /* dummy read */
HAL_SPI_Receive(&SPIHandle, buf, sizeof(buf), SPI_TIMEOUT); HAL_SPI_Receive(&SPIHandle, buf, sizeof(buf), SPI_TIMEOUT);
return &py_spi_module; return &spi_module;
} }

View File

@ -32,7 +32,7 @@ static const mp_map_elem_t globals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
static const mp_obj_module_t py_time_module = { const mp_obj_module_t time_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_time, .name = MP_QSTR_time,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
@ -40,5 +40,5 @@ static const mp_obj_module_t py_time_module = {
const mp_obj_module_t *py_time_init() const mp_obj_module_t *py_time_init()
{ {
return &py_time_module; return &time_module;
} }

View File

@ -188,7 +188,7 @@ static const mp_map_elem_t globals_dict_table[] = {
static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
static const mp_obj_module_t wlan_module = { const mp_obj_module_t wlan_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.name = MP_QSTR_wlan, .name = MP_QSTR_wlan,
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,