all: Make all mp_obj_type_t defs use MP_DEFINE_CONST_OBJ_TYPE.

In preparation for upcoming rework of mp_obj_type_t layout.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2021-07-14 14:38:38 +10:00 committed by Damien George
parent cdb880789f
commit 662b9761b3
227 changed files with 2543 additions and 2184 deletions

View File

@ -730,13 +730,14 @@ STATIC const mp_machine_i2c_p_t mp_machine_soft_i2c_p = {
.transfer = mp_machine_soft_i2c_transfer, .transfer = mp_machine_soft_i2c_transfer,
}; };
const mp_obj_type_t mp_machine_soft_i2c_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_machine_soft_i2c_type,
.name = MP_QSTR_SoftI2C, MP_QSTR_SoftI2C,
.print = mp_machine_soft_i2c_print, MP_TYPE_FLAG_NONE,
.make_new = mp_machine_soft_i2c_make_new, mp_machine_soft_i2c_make_new,
.protocol = &mp_machine_soft_i2c_p, print, mp_machine_soft_i2c_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_i2c_locals_dict, protocol, &mp_machine_soft_i2c_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_i2c_locals_dict
);
#endif // MICROPY_PY_MACHINE_SOFTI2C #endif // MICROPY_PY_MACHINE_SOFTI2C

View File

@ -101,12 +101,14 @@ STATIC mp_obj_t machine_mem_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t va
} }
} }
const mp_obj_type_t machine_mem_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_mem_type,
.name = MP_QSTR_mem, MP_QSTR_mem,
.print = machine_mem_print, MP_TYPE_FLAG_NONE,
.subscr = machine_mem_subscr, MP_TYPE_NULL_MAKE_NEW,
}; print, machine_mem_print,
subscr, machine_mem_subscr
);
const machine_mem_obj_t machine_mem8_obj = {{&machine_mem_type}, 1}; const machine_mem_obj_t machine_mem8_obj = {{&machine_mem_type}, 1};
const machine_mem_obj_t machine_mem16_obj = {{&machine_mem_type}, 2}; const machine_mem_obj_t machine_mem16_obj = {{&machine_mem_type}, 2};

View File

@ -77,11 +77,12 @@ STATIC const mp_pin_p_t pinbase_pin_p = {
.ioctl = pinbase_ioctl, .ioctl = pinbase_ioctl,
}; };
const mp_obj_type_t machine_pinbase_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_pinbase_type,
.name = MP_QSTR_PinBase, MP_QSTR_PinBase,
.make_new = pinbase_make_new, MP_TYPE_FLAG_NONE,
.protocol = &pinbase_pin_p, pinbase_make_new,
}; protocol, &pinbase_pin_p
);
#endif // MICROPY_PY_MACHINE #endif // MICROPY_PY_MACHINE

View File

@ -132,12 +132,13 @@ STATIC const mp_rom_map_elem_t machine_pwm_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_pwm_locals_dict, machine_pwm_locals_dict_table);
const mp_obj_type_t machine_pwm_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_pwm_type,
.name = MP_QSTR_PWM, MP_QSTR_PWM,
.print = mp_machine_pwm_print, MP_TYPE_FLAG_NONE,
.make_new = mp_machine_pwm_make_new, mp_machine_pwm_make_new,
.locals_dict = (mp_obj_dict_t *)&machine_pwm_locals_dict, print, mp_machine_pwm_print,
}; locals_dict, &machine_pwm_locals_dict
);
#endif // MICROPY_PY_MACHINE_PWM #endif // MICROPY_PY_MACHINE_PWM

View File

@ -172,13 +172,14 @@ STATIC const mp_pin_p_t signal_pin_p = {
.ioctl = signal_ioctl, .ioctl = signal_ioctl,
}; };
const mp_obj_type_t machine_signal_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_signal_type,
.name = MP_QSTR_Signal, MP_QSTR_Signal,
.make_new = signal_make_new, MP_TYPE_FLAG_NONE,
.call = signal_call, signal_make_new,
.protocol = &signal_pin_p, call, signal_call,
.locals_dict = (void *)&signal_locals_dict, protocol, &signal_pin_p,
}; locals_dict, (void *)&signal_locals_dict
);
#endif // MICROPY_PY_MACHINE #endif // MICROPY_PY_MACHINE

View File

@ -251,13 +251,14 @@ const mp_machine_spi_p_t mp_machine_soft_spi_p = {
.transfer = mp_machine_soft_spi_transfer, .transfer = mp_machine_soft_spi_transfer,
}; };
const mp_obj_type_t mp_machine_soft_spi_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_machine_soft_spi_type,
.name = MP_QSTR_SoftSPI, MP_QSTR_SoftSPI,
.print = mp_machine_soft_spi_print, MP_TYPE_FLAG_NONE,
.make_new = mp_machine_soft_spi_make_new, mp_machine_soft_spi_make_new,
.protocol = &mp_machine_soft_spi_p, print, mp_machine_soft_spi_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_spi_locals_dict, protocol, &mp_machine_soft_spi_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_spi_locals_dict
);
#endif // MICROPY_PY_MACHINE_SOFTSPI #endif // MICROPY_PY_MACHINE_SOFTSPI

View File

@ -240,16 +240,16 @@ STATIC void ringbuf_get_uuid(ringbuf_t *ringbuf, mp_obj_bluetooth_uuid_t *uuid)
#endif // !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS #endif // !MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS
const mp_obj_type_t mp_type_bluetooth_uuid = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_bluetooth_uuid,
.name = MP_QSTR_UUID, MP_QSTR_UUID,
.make_new = bluetooth_uuid_make_new, MP_TYPE_FLAG_NONE,
.unary_op = bluetooth_uuid_unary_op, bluetooth_uuid_make_new,
.binary_op = bluetooth_uuid_binary_op, unary_op, bluetooth_uuid_unary_op,
.locals_dict = NULL, binary_op, bluetooth_uuid_binary_op,
.print = bluetooth_uuid_print, print, bluetooth_uuid_print,
.buffer = bluetooth_uuid_get_buffer, buffer, bluetooth_uuid_get_buffer
}; );
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Bluetooth object: General // Bluetooth object: General
@ -976,12 +976,13 @@ STATIC const mp_rom_map_elem_t bluetooth_ble_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(bluetooth_ble_locals_dict, bluetooth_ble_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(bluetooth_ble_locals_dict, bluetooth_ble_locals_dict_table);
STATIC const mp_obj_type_t mp_type_bluetooth_ble = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_bluetooth_ble,
.name = MP_QSTR_BLE, MP_QSTR_BLE,
.make_new = bluetooth_ble_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&bluetooth_ble_locals_dict, bluetooth_ble_make_new,
}; locals_dict, (void *)&bluetooth_ble_locals_dict
);
STATIC const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_bluetooth_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ubluetooth) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ubluetooth) },

View File

@ -319,17 +319,19 @@ STATIC const mp_rom_map_elem_t btree_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table);
STATIC const mp_obj_type_t btree_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, btree_type,
MP_QSTR_btree,
MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW,
// Save on qstr's, reuse same as for module // Save on qstr's, reuse same as for module
.name = MP_QSTR_btree, print, btree_print,
.print = btree_print, getiter, btree_getiter,
.getiter = btree_getiter, iternext, btree_iternext,
.iternext = btree_iternext, binary_op, btree_binary_op,
.binary_op = btree_binary_op, subscr, btree_subscr,
.subscr = btree_subscr, locals_dict, (void *)&btree_locals_dict
.locals_dict = (void *)&btree_locals_dict, );
};
#endif #endif
STATIC const FILEVTABLE btree_stream_fvtable = { STATIC const FILEVTABLE btree_stream_fvtable = {

View File

@ -829,13 +829,14 @@ STATIC const mp_rom_map_elem_t framebuf_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table);
STATIC const mp_obj_type_t mp_type_framebuf = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_framebuf,
.name = MP_QSTR_FrameBuffer, MP_QSTR_FrameBuffer,
.make_new = framebuf_make_new, MP_TYPE_FLAG_NONE,
.buffer = framebuf_get_buffer, framebuf_make_new,
.locals_dict = (mp_obj_dict_t *)&framebuf_locals_dict, buffer, framebuf_get_buffer,
}; locals_dict, (mp_obj_dict_t *)&framebuf_locals_dict
);
#endif #endif
// this factory function is provided for backwards compatibility with old FrameBuffer1 class // this factory function is provided for backwards compatibility with old FrameBuffer1 class

View File

@ -177,12 +177,13 @@ STATIC const mp_rom_map_elem_t lwip_slip_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(lwip_slip_locals_dict, lwip_slip_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(lwip_slip_locals_dict, lwip_slip_locals_dict_table);
STATIC const mp_obj_type_t lwip_slip_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, lwip_slip_type,
.name = MP_QSTR_slip, MP_QSTR_slip,
.make_new = lwip_slip_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&lwip_slip_locals_dict, lwip_slip_make_new,
}; locals_dict, (mp_obj_dict_t *)&lwip_slip_locals_dict
);
#endif // MICROPY_PY_LWIP_SLIP #endif // MICROPY_PY_LWIP_SLIP
@ -1594,14 +1595,15 @@ STATIC const mp_stream_p_t lwip_socket_stream_p = {
.ioctl = lwip_socket_ioctl, .ioctl = lwip_socket_ioctl,
}; };
STATIC const mp_obj_type_t lwip_socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, lwip_socket_type,
.name = MP_QSTR_socket, MP_QSTR_socket,
.print = lwip_socket_print, MP_TYPE_FLAG_NONE,
.make_new = lwip_socket_make_new, lwip_socket_make_new,
.protocol = &lwip_socket_stream_p, print, lwip_socket_print,
.locals_dict = (mp_obj_dict_t *)&lwip_socket_locals_dict, protocol, &lwip_socket_stream_p,
}; locals_dict, (mp_obj_dict_t *)&lwip_socket_locals_dict
);
/******************************************************************************/ /******************************************************************************/
// Support functions for memory protection. lwIP has its own memory management // Support functions for memory protection. lwIP has its own memory management

View File

@ -144,12 +144,13 @@ STATIC const mp_rom_map_elem_t task_queue_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(task_queue_locals_dict, task_queue_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(task_queue_locals_dict, task_queue_locals_dict_table);
STATIC const mp_obj_type_t task_queue_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, task_queue_type,
.name = MP_QSTR_TaskQueue, MP_QSTR_TaskQueue,
.make_new = task_queue_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&task_queue_locals_dict, task_queue_make_new,
}; locals_dict, (mp_obj_dict_t *)&task_queue_locals_dict
);
/******************************************************************************/ /******************************************************************************/
// Task class // Task class
@ -286,14 +287,15 @@ STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
return mp_const_none; return mp_const_none;
} }
STATIC const mp_obj_type_t task_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, task_type,
.name = MP_QSTR_Task, MP_QSTR_Task,
.make_new = task_make_new, MP_TYPE_FLAG_NONE,
.attr = task_attr, task_make_new,
.getiter = task_getiter, attr, task_attr,
.iternext = task_iternext, getiter, task_getiter,
}; iternext, task_iternext
);
/******************************************************************************/ /******************************************************************************/
// C-level uasyncio module // C-level uasyncio module

View File

@ -348,12 +348,13 @@ STATIC const mp_rom_map_elem_t ucryptolib_aes_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(ucryptolib_aes_locals_dict, ucryptolib_aes_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(ucryptolib_aes_locals_dict, ucryptolib_aes_locals_dict_table);
STATIC const mp_obj_type_t ucryptolib_aes_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, ucryptolib_aes_type,
.name = MP_QSTR_aes, MP_QSTR_aes,
.make_new = ucryptolib_aes_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&ucryptolib_aes_locals_dict, ucryptolib_aes_make_new,
}; locals_dict, (void *)&ucryptolib_aes_locals_dict
);
STATIC const mp_rom_map_elem_t mp_module_ucryptolib_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_ucryptolib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ucryptolib) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ucryptolib) },

View File

@ -634,16 +634,17 @@ STATIC mp_obj_t uctypes_struct_bytes_at(mp_obj_t ptr, mp_obj_t size) {
} }
MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytes_at_obj, uctypes_struct_bytes_at); MP_DEFINE_CONST_FUN_OBJ_2(uctypes_struct_bytes_at_obj, uctypes_struct_bytes_at);
STATIC const mp_obj_type_t uctypes_struct_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, uctypes_struct_type,
.name = MP_QSTR_struct, MP_QSTR_struct,
.print = uctypes_struct_print, MP_TYPE_FLAG_NONE,
.make_new = uctypes_struct_make_new, uctypes_struct_make_new,
.attr = uctypes_struct_attr, print, uctypes_struct_print,
.subscr = uctypes_struct_subscr, attr, uctypes_struct_attr,
.unary_op = uctypes_struct_unary_op, subscr, uctypes_struct_subscr,
.buffer = uctypes_get_buffer, unary_op, uctypes_struct_unary_op,
}; buffer, uctypes_get_buffer
);
STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_uctypes_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uctypes) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uctypes) },

View File

@ -157,12 +157,13 @@ STATIC const mp_rom_map_elem_t uhashlib_sha256_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(uhashlib_sha256_locals_dict, uhashlib_sha256_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(uhashlib_sha256_locals_dict, uhashlib_sha256_locals_dict_table);
STATIC const mp_obj_type_t uhashlib_sha256_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, uhashlib_sha256_type,
.name = MP_QSTR_sha256, MP_QSTR_sha256,
.make_new = uhashlib_sha256_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&uhashlib_sha256_locals_dict, uhashlib_sha256_make_new,
}; locals_dict, (void *)&uhashlib_sha256_locals_dict
);
#endif #endif
#if MICROPY_PY_UHASHLIB_SHA1 #if MICROPY_PY_UHASHLIB_SHA1
@ -250,12 +251,13 @@ STATIC const mp_rom_map_elem_t uhashlib_sha1_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(uhashlib_sha1_locals_dict, uhashlib_sha1_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(uhashlib_sha1_locals_dict, uhashlib_sha1_locals_dict_table);
STATIC const mp_obj_type_t uhashlib_sha1_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, uhashlib_sha1_type,
.name = MP_QSTR_sha1, MP_QSTR_sha1,
.make_new = uhashlib_sha1_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&uhashlib_sha1_locals_dict, uhashlib_sha1_make_new,
}; locals_dict, (void *)&uhashlib_sha1_locals_dict
);
#endif #endif
#if MICROPY_PY_UHASHLIB_MD5 #if MICROPY_PY_UHASHLIB_MD5
@ -343,12 +345,13 @@ STATIC const mp_rom_map_elem_t uhashlib_md5_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(uhashlib_md5_locals_dict, uhashlib_md5_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(uhashlib_md5_locals_dict, uhashlib_md5_locals_dict_table);
STATIC const mp_obj_type_t uhashlib_md5_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, uhashlib_md5_type,
.name = MP_QSTR_md5, MP_QSTR_md5,
.make_new = uhashlib_md5_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&uhashlib_md5_locals_dict, uhashlib_md5_make_new,
}; locals_dict, (void *)&uhashlib_md5_locals_dict
);
#endif // MICROPY_PY_UHASHLIB_MD5 #endif // MICROPY_PY_UHASHLIB_MD5
STATIC const mp_rom_map_elem_t mp_module_uhashlib_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_uhashlib_globals_table[] = {

View File

@ -179,12 +179,14 @@ STATIC const mp_rom_map_elem_t match_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table);
STATIC const mp_obj_type_t match_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, match_type,
.name = MP_QSTR_match, MP_QSTR_match,
.print = match_print, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&match_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; print, match_print,
locals_dict, (void *)&match_locals_dict
);
#endif #endif
STATIC void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { STATIC void re_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
@ -411,12 +413,14 @@ STATIC const mp_rom_map_elem_t re_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
STATIC const mp_obj_type_t re_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, re_type,
.name = MP_QSTR_ure, MP_QSTR_ure,
.print = re_print, MP_TYPE_FLAG_NONE,
.locals_dict = (void *)&re_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; print, re_print,
locals_dict, (void *)&re_locals_dict
);
#endif #endif
STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {

View File

@ -336,13 +336,15 @@ STATIC const mp_rom_map_elem_t poll_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(poll_locals_dict, poll_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(poll_locals_dict, poll_locals_dict_table);
STATIC const mp_obj_type_t mp_type_poll = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_poll,
.name = MP_QSTR_poll, MP_QSTR_poll,
.getiter = mp_identity_getiter, MP_TYPE_FLAG_NONE,
.iternext = poll_iternext, MP_TYPE_NULL_MAKE_NEW,
.locals_dict = (void *)&poll_locals_dict, getiter, mp_identity_getiter,
}; iternext, poll_iternext,
locals_dict, (void *)&poll_locals_dict
);
// poll() // poll()
STATIC mp_obj_t select_poll(void) { STATIC mp_obj_t select_poll(void) {

View File

@ -528,14 +528,15 @@ STATIC const mp_stream_p_t socket_stream_p = {
.is_text = false, .is_text = false,
}; };
STATIC const mp_obj_type_t socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, socket_type,
.name = MP_QSTR_socket, MP_QSTR_socket,
.print = socket_print, MP_TYPE_FLAG_NONE,
.make_new = socket_make_new, socket_make_new,
.protocol = &socket_stream_p, protocol, &socket_stream_p,
.locals_dict = (mp_obj_dict_t *)&socket_locals_dict, locals_dict, (mp_obj_dict_t *)&socket_locals_dict,
}; print, socket_print
);
/******************************************************************************/ /******************************************************************************/
// usocket module // usocket module

View File

@ -314,16 +314,18 @@ STATIC const mp_stream_p_t ussl_socket_stream_p = {
.ioctl = ussl_socket_ioctl, .ioctl = ussl_socket_ioctl,
}; };
STATIC const mp_obj_type_t ussl_socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, ussl_socket_type,
MP_QSTR_ussl,
MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW,
// Save on qstr's, reuse same as for module // Save on qstr's, reuse same as for module
.name = MP_QSTR_ussl, print, ussl_socket_print,
.print = ussl_socket_print, getiter, NULL,
.getiter = NULL, iternext, NULL,
.iternext = NULL, protocol, &ussl_socket_stream_p,
.protocol = &ussl_socket_stream_p, locals_dict, (void *)&ussl_socket_locals_dict
.locals_dict = (void *)&ussl_socket_locals_dict, );
};
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO: Implement more args // TODO: Implement more args

View File

@ -392,16 +392,18 @@ STATIC const mp_stream_p_t ussl_socket_stream_p = {
.ioctl = socket_ioctl, .ioctl = socket_ioctl,
}; };
STATIC const mp_obj_type_t ussl_socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, ussl_socket_type,
MP_QSTR_ussl,
MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW,
// Save on qstr's, reuse same as for module // Save on qstr's, reuse same as for module
.name = MP_QSTR_ussl, print, socket_print,
.print = socket_print, getiter, NULL,
.getiter = NULL, iternext, NULL,
.iternext = NULL, protocol, &ussl_socket_stream_p,
.protocol = &ussl_socket_stream_p, locals_dict, (void *)&ussl_socket_locals_dict
.locals_dict = (void *)&ussl_socket_locals_dict, );
};
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO: Implement more args // TODO: Implement more args

View File

@ -209,13 +209,14 @@ STATIC const mp_rom_map_elem_t utimeq_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(utimeq_locals_dict, utimeq_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(utimeq_locals_dict, utimeq_locals_dict_table);
STATIC const mp_obj_type_t utimeq_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, utimeq_type,
.name = MP_QSTR_utimeq, MP_QSTR_utimeq,
.make_new = utimeq_make_new, MP_TYPE_FLAG_NONE,
.unary_op = utimeq_unary_op, utimeq_make_new,
.locals_dict = (void *)&utimeq_locals_dict, unary_op, utimeq_unary_op,
}; locals_dict, (void *)&utimeq_locals_dict
);
STATIC const mp_rom_map_elem_t mp_module_utimeq_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_utimeq_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utimeq) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utimeq) },

View File

@ -290,13 +290,14 @@ STATIC const mp_stream_p_t websocket_stream_p = {
.ioctl = websocket_ioctl, .ioctl = websocket_ioctl,
}; };
STATIC const mp_obj_type_t websocket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, websocket_type,
.name = MP_QSTR_websocket, MP_QSTR_websocket,
.make_new = websocket_make_new, MP_TYPE_FLAG_NONE,
.protocol = &websocket_stream_p, websocket_make_new,
.locals_dict = (void *)&websocket_locals_dict, protocol, &websocket_stream_p,
}; locals_dict, (void *)&websocket_locals_dict
);
STATIC const mp_rom_map_elem_t uwebsocket_module_globals_table[] = { STATIC const mp_rom_map_elem_t uwebsocket_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uwebsocket) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uwebsocket) },

View File

@ -140,13 +140,14 @@ STATIC const mp_stream_p_t decompio_stream_p = {
}; };
#if !MICROPY_ENABLE_DYNRUNTIME #if !MICROPY_ENABLE_DYNRUNTIME
STATIC const mp_obj_type_t decompio_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, decompio_type,
.name = MP_QSTR_DecompIO, MP_QSTR_DecompIO,
.make_new = decompio_make_new, MP_TYPE_FLAG_NONE,
.protocol = &decompio_stream_p, decompio_make_new,
.locals_dict = (void *)&decompio_locals_dict, protocol, &decompio_stream_p,
}; locals_dict, (void *)&decompio_locals_dict
);
#endif #endif
STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {

View File

@ -342,13 +342,14 @@ STATIC const mp_stream_p_t webrepl_stream_p = {
.ioctl = webrepl_ioctl, .ioctl = webrepl_ioctl,
}; };
STATIC const mp_obj_type_t webrepl_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, webrepl_type,
.name = MP_QSTR__webrepl, MP_QSTR__webrepl,
.make_new = webrepl_make_new, MP_TYPE_FLAG_NONE,
.protocol = &webrepl_stream_p, webrepl_make_new,
.locals_dict = (mp_obj_dict_t *)&webrepl_locals_dict, protocol, &webrepl_stream_p,
}; locals_dict, (mp_obj_dict_t *)&webrepl_locals_dict
);
STATIC const mp_rom_map_elem_t webrepl_module_globals_table[] = { STATIC const mp_rom_map_elem_t webrepl_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__webrepl) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__webrepl) },

View File

@ -496,12 +496,13 @@ STATIC const mp_rom_map_elem_t network_cyw43_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(network_cyw43_locals_dict, network_cyw43_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(network_cyw43_locals_dict, network_cyw43_locals_dict_table);
const mp_obj_type_t mp_network_cyw43_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_network_cyw43_type,
.name = MP_QSTR_CYW43, MP_QSTR_CYW43,
.print = network_cyw43_print, MP_TYPE_FLAG_NONE,
.make_new = network_cyw43_make_new, network_cyw43_make_new,
.locals_dict = (mp_obj_dict_t *)&network_cyw43_locals_dict, print, network_cyw43_print,
}; locals_dict, (mp_obj_dict_t *)&network_cyw43_locals_dict
);
#endif // MICROPY_PY_NETWORK_CYW43 #endif // MICROPY_PY_NETWORK_CYW43

View File

@ -774,13 +774,16 @@ static const mp_rom_map_elem_t nina_locals_dict_table[] = {
static MP_DEFINE_CONST_DICT(nina_locals_dict, nina_locals_dict_table); static MP_DEFINE_CONST_DICT(nina_locals_dict, nina_locals_dict_table);
STATIC MP_DEFINE_CONST_OBJ_TYPE(
mod_network_nic_type_nina_base,
MP_QSTR_nina,
MP_TYPE_FLAG_NONE,
network_ninaw10_make_new,
locals_dict, &nina_locals_dict
);
const mod_network_nic_type_t mod_network_nic_type_nina = { const mod_network_nic_type_t mod_network_nic_type_nina = {
.base = { .base = mod_network_nic_type_nina_base,
{ &mp_type_type },
.name = MP_QSTR_nina,
.make_new = network_ninaw10_make_new,
.locals_dict = (mp_obj_t)&nina_locals_dict,
},
.gethostbyname = network_ninaw10_gethostbyname, .gethostbyname = network_ninaw10_gethostbyname,
.socket = network_ninaw10_socket_socket, .socket = network_ninaw10_socket_socket,
.close = network_ninaw10_socket_close, .close = network_ninaw10_socket_close,

View File

@ -1016,20 +1016,24 @@ STATIC const mp_rom_map_elem_t wiznet5k_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(wiznet5k_locals_dict, wiznet5k_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(wiznet5k_locals_dict, wiznet5k_locals_dict_table);
#if WIZNET5K_WITH_LWIP_STACK #if WIZNET5K_WITH_LWIP_STACK
const mp_obj_type_t mod_network_nic_type_wiznet5k = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mod_network_nic_type_wiznet5k,
.name = MP_QSTR_WIZNET5K, MP_QSTR_WIZNET5K,
.make_new = wiznet5k_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&wiznet5k_locals_dict, wiznet5k_make_new,
}; locals_dict, &wiznet5k_locals_dict
);
#else // WIZNET5K_PROVIDED_STACK #else // WIZNET5K_PROVIDED_STACK
STATIC MP_DEFINE_CONST_OBJ_TYPE(
mod_network_nic_type_wiznet5k_base,
MP_QSTR_WIZNET5K,
MP_TYPE_FLAG_NONE,
wiznet5k_make_new,
locals_dict, &wiznet5k_locals_dict
);
const mod_network_nic_type_t mod_network_nic_type_wiznet5k = { const mod_network_nic_type_t mod_network_nic_type_wiznet5k = {
.base = { .base = mod_network_nic_type_wiznet5k_base,
{ &mp_type_type },
.name = MP_QSTR_WIZNET5K,
.make_new = wiznet5k_make_new,
.locals_dict = (mp_obj_dict_t *)&wiznet5k_locals_dict,
},
.gethostbyname = wiznet5k_gethostbyname, .gethostbyname = wiznet5k_gethostbyname,
.socket = wiznet5k_socket_socket, .socket = wiznet5k_socket_socket,
.close = wiznet5k_socket_close, .close = wiznet5k_socket_close,

View File

@ -431,12 +431,13 @@ STATIC const mp_vfs_proto_t fat_vfs_proto = {
.import_stat = fat_vfs_import_stat, .import_stat = fat_vfs_import_stat,
}; };
const mp_obj_type_t mp_fat_vfs_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_fat_vfs_type,
.name = MP_QSTR_VfsFat, MP_QSTR_VfsFat,
.make_new = fat_vfs_make_new, MP_TYPE_FLAG_NONE,
.protocol = &fat_vfs_proto, fat_vfs_make_new,
.locals_dict = (mp_obj_dict_t *)&fat_vfs_locals_dict, protocol, &fat_vfs_proto,
}; locals_dict, (mp_obj_dict_t *)&fat_vfs_locals_dict
);
#endif // MICROPY_VFS_FAT #endif // MICROPY_VFS_FAT

View File

@ -176,15 +176,17 @@ STATIC const mp_stream_p_t vfs_fat_fileio_stream_p = {
.ioctl = file_obj_ioctl, .ioctl = file_obj_ioctl,
}; };
const mp_obj_type_t mp_type_vfs_fat_fileio = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_vfs_fat_fileio,
.name = MP_QSTR_FileIO, MP_QSTR_FileIO,
.print = file_obj_print, MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, MP_TYPE_NULL_MAKE_NEW,
.iternext = mp_stream_unbuffered_iter, print, file_obj_print,
.protocol = &vfs_fat_fileio_stream_p, getiter, mp_identity_getiter,
.locals_dict = (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict, iternext, mp_stream_unbuffered_iter,
}; protocol, &vfs_fat_fileio_stream_p,
locals_dict, (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict
);
STATIC const mp_stream_p_t vfs_fat_textio_stream_p = { STATIC const mp_stream_p_t vfs_fat_textio_stream_p = {
.read = file_obj_read, .read = file_obj_read,
@ -193,15 +195,17 @@ STATIC const mp_stream_p_t vfs_fat_textio_stream_p = {
.is_text = true, .is_text = true,
}; };
const mp_obj_type_t mp_type_vfs_fat_textio = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_vfs_fat_textio,
.name = MP_QSTR_TextIOWrapper, MP_QSTR_TextIOWrapper,
.print = file_obj_print, MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, MP_TYPE_NULL_MAKE_NEW,
.iternext = mp_stream_unbuffered_iter, print, file_obj_print,
.protocol = &vfs_fat_textio_stream_p, getiter, mp_identity_getiter,
.locals_dict = (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict, iternext, mp_stream_unbuffered_iter,
}; protocol, &vfs_fat_textio_stream_p,
locals_dict, (mp_obj_dict_t *)&vfs_fat_rawfile_locals_dict
);
// Factory function for I/O stream classes // Factory function for I/O stream classes
STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) { STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_in) {

View File

@ -502,14 +502,15 @@ STATIC const mp_vfs_proto_t MP_VFS_LFSx(proto) = {
.import_stat = MP_VFS_LFSx(import_stat), .import_stat = MP_VFS_LFSx(import_stat),
}; };
const mp_obj_type_t MP_TYPE_VFS_LFSx = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, MP_TYPE_VFS_LFSx,
#if LFS_BUILD_VERSION == 1 #if LFS_BUILD_VERSION == 1
.name = MP_QSTR_VfsLfs1, MP_QSTR_VfsLfs1,
#else #else
.name = MP_QSTR_VfsLfs2, MP_QSTR_VfsLfs2,
#endif #endif
.make_new = MP_VFS_LFSx(make_new), MP_TYPE_FLAG_NONE,
.protocol = &MP_VFS_LFSx(proto), MP_VFS_LFSx(make_new),
.locals_dict = (mp_obj_dict_t *)&MP_VFS_LFSx(locals_dict), protocol, &MP_VFS_LFSx(proto),
}; locals_dict, (mp_obj_dict_t *)&MP_VFS_LFSx(locals_dict)
);

View File

@ -220,15 +220,17 @@ STATIC const mp_stream_p_t MP_VFS_LFSx(fileio_stream_p) = {
.ioctl = MP_VFS_LFSx(file_ioctl), .ioctl = MP_VFS_LFSx(file_ioctl),
}; };
const mp_obj_type_t MP_TYPE_VFS_LFSx_(_fileio) = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, MP_TYPE_VFS_LFSx_(_fileio),
.name = MP_QSTR_FileIO, MP_QSTR_FileIO,
.print = MP_VFS_LFSx(file_print), MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, MP_TYPE_NULL_MAKE_NEW,
.iternext = mp_stream_unbuffered_iter, print, MP_VFS_LFSx(file_print),
.protocol = &MP_VFS_LFSx(fileio_stream_p), getiter, mp_identity_getiter,
.locals_dict = (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict), iternext, mp_stream_unbuffered_iter,
}; protocol, &MP_VFS_LFSx(fileio_stream_p),
locals_dict, (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict)
);
STATIC const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = { STATIC const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = {
.read = MP_VFS_LFSx(file_read), .read = MP_VFS_LFSx(file_read),
@ -237,12 +239,14 @@ STATIC const mp_stream_p_t MP_VFS_LFSx(textio_stream_p) = {
.is_text = true, .is_text = true,
}; };
const mp_obj_type_t MP_TYPE_VFS_LFSx_(_textio) = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, MP_TYPE_VFS_LFSx_(_textio),
.name = MP_QSTR_TextIOWrapper, MP_QSTR_TextIOWrapper,
.print = MP_VFS_LFSx(file_print), MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, MP_TYPE_NULL_MAKE_NEW,
.iternext = mp_stream_unbuffered_iter, print, MP_VFS_LFSx(file_print),
.protocol = &MP_VFS_LFSx(textio_stream_p), getiter, mp_identity_getiter,
.locals_dict = (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict), iternext, mp_stream_unbuffered_iter,
}; protocol, &MP_VFS_LFSx(textio_stream_p),
locals_dict, (mp_obj_dict_t *)&MP_VFS_LFSx(file_locals_dict)
);

View File

@ -398,12 +398,13 @@ STATIC const mp_vfs_proto_t vfs_posix_proto = {
.import_stat = mp_vfs_posix_import_stat, .import_stat = mp_vfs_posix_import_stat,
}; };
const mp_obj_type_t mp_type_vfs_posix = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_vfs_posix,
.name = MP_QSTR_VfsPosix, MP_QSTR_VfsPosix,
.make_new = vfs_posix_make_new, MP_TYPE_FLAG_NONE,
.protocol = &vfs_posix_proto, vfs_posix_make_new,
.locals_dict = (mp_obj_dict_t *)&vfs_posix_locals_dict, protocol, &vfs_posix_proto,
}; locals_dict, (mp_obj_dict_t *)&vfs_posix_locals_dict
);
#endif // MICROPY_VFS_POSIX #endif // MICROPY_VFS_POSIX

View File

@ -249,15 +249,17 @@ STATIC const mp_stream_p_t vfs_posix_fileio_stream_p = {
.ioctl = vfs_posix_file_ioctl, .ioctl = vfs_posix_file_ioctl,
}; };
const mp_obj_type_t mp_type_vfs_posix_fileio = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_vfs_posix_fileio,
.name = MP_QSTR_FileIO, MP_QSTR_FileIO,
.print = vfs_posix_file_print, MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, MP_TYPE_NULL_MAKE_NEW,
.iternext = mp_stream_unbuffered_iter, print, vfs_posix_file_print,
.protocol = &vfs_posix_fileio_stream_p, getiter, mp_identity_getiter,
.locals_dict = (mp_obj_dict_t *)&vfs_posix_rawfile_locals_dict, iternext, mp_stream_unbuffered_iter,
}; protocol, &vfs_posix_fileio_stream_p,
locals_dict, (mp_obj_dict_t *)&vfs_posix_rawfile_locals_dict
);
STATIC const mp_stream_p_t vfs_posix_textio_stream_p = { STATIC const mp_stream_p_t vfs_posix_textio_stream_p = {
.read = vfs_posix_file_read, .read = vfs_posix_file_read,
@ -266,15 +268,17 @@ STATIC const mp_stream_p_t vfs_posix_textio_stream_p = {
.is_text = true, .is_text = true,
}; };
const mp_obj_type_t mp_type_vfs_posix_textio = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_type_vfs_posix_textio,
.name = MP_QSTR_TextIOWrapper, MP_QSTR_TextIOWrapper,
.print = vfs_posix_file_print, MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, MP_TYPE_NULL_MAKE_NEW,
.iternext = mp_stream_unbuffered_iter, print, vfs_posix_file_print,
.protocol = &vfs_posix_textio_stream_p, getiter, mp_identity_getiter,
.locals_dict = (mp_obj_dict_t *)&vfs_posix_rawfile_locals_dict, iternext, mp_stream_unbuffered_iter,
}; protocol, &vfs_posix_textio_stream_p,
locals_dict, (mp_obj_dict_t *)&vfs_posix_rawfile_locals_dict
);
const mp_obj_vfs_posix_file_t mp_sys_stdin_obj = {{&mp_type_vfs_posix_textio}, STDIN_FILENO}; const mp_obj_vfs_posix_file_t mp_sys_stdin_obj = {{&mp_type_vfs_posix_textio}, STDIN_FILENO};
const mp_obj_vfs_posix_file_t mp_sys_stdout_obj = {{&mp_type_vfs_posix_textio}, STDOUT_FILENO}; const mp_obj_vfs_posix_file_t mp_sys_stdout_obj = {{&mp_type_vfs_posix_textio}, STDOUT_FILENO};

View File

@ -190,11 +190,13 @@ STATIC const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
const mp_obj_type_t mp_irq_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mp_irq_type,
.name = MP_QSTR_irq, MP_QSTR_irq,
.call = mp_irq_call, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&mp_irq_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; call, mp_irq_call,
locals_dict, (mp_obj_t)&mp_irq_locals_dict
);
MP_REGISTER_ROOT_POINTER(mp_obj_list_t mp_irq_obj_list); MP_REGISTER_ROOT_POINTER(mp_obj_list_t mp_irq_obj_list);

View File

@ -171,10 +171,11 @@ STATIC const mp_rom_map_elem_t network_server_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(network_server_locals_dict, network_server_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(network_server_locals_dict, network_server_locals_dict_table);
STATIC const mp_obj_type_t network_server_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, network_server_type,
.name = MP_QSTR_Server, MP_QSTR_Server,
.make_new = network_server_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&network_server_locals_dict, network_server_make_new,
}; locals_dict, (mp_obj_t)&network_server_locals_dict
);
#endif #endif

View File

@ -177,19 +177,21 @@ STATIC MP_DEFINE_CONST_DICT(hash_locals_dict, hash_locals_dict_table);
// .locals_dict = (mp_obj_t)&hash_locals_dict, // .locals_dict = (mp_obj_t)&hash_locals_dict,
//}; //};
STATIC const mp_obj_type_t sha1_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, sha1_type,
.name = MP_QSTR_sha1, MP_QSTR_sha1,
.make_new = hash_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&hash_locals_dict, hash_make_new,
}; locals_dict, (mp_obj_t)&hash_locals_dict
);
STATIC const mp_obj_type_t sha256_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, sha256_type,
.name = MP_QSTR_sha256, MP_QSTR_sha256,
.make_new = hash_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&hash_locals_dict, hash_make_new,
}; locals_dict, (mp_obj_t)&hash_locals_dict
);
STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uhashlib) }, { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uhashlib) },

View File

@ -759,13 +759,14 @@ const mp_stream_p_t socket_stream_p = {
.is_text = false, .is_text = false,
}; };
STATIC const mp_obj_type_t socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, socket_type,
.name = MP_QSTR_socket, MP_QSTR_socket,
.make_new = socket_make_new, MP_TYPE_FLAG_NONE,
.protocol = &socket_stream_p, socket_make_new,
.locals_dict = (mp_obj_t)&socket_locals_dict, protocol, &socket_stream_p,
}; locals_dict, (mp_obj_t)&socket_locals_dict
);
/******************************************************************************/ /******************************************************************************/
// usocket module // usocket module

View File

@ -60,14 +60,16 @@ STATIC const mp_obj_type_t ssl_socket_type;
// ssl sockets inherit from normal socket, so we take its // ssl sockets inherit from normal socket, so we take its
// locals and stream methods // locals and stream methods
STATIC const mp_obj_type_t ssl_socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, ssl_socket_type,
.name = MP_QSTR_ussl, MP_QSTR_ussl,
.getiter = NULL, MP_TYPE_FLAG_NONE,
.iternext = NULL, MP_TYPE_NULL_MAKE_NEW,
.protocol = &socket_stream_p, getiter, NULL,
.locals_dict = (mp_obj_t)&socket_locals_dict, iternext, NULL,
}; protocol, &socket_stream_p,
locals_dict, (mp_obj_t)&socket_locals_dict
);
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
STATIC const mp_arg_t allowed_args[] = { STATIC const mp_arg_t allowed_args[] = {

View File

@ -1285,13 +1285,16 @@ STATIC const mp_rom_map_elem_t wlan_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(wlan_locals_dict, wlan_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(wlan_locals_dict, wlan_locals_dict_table);
STATIC MP_DEFINE_CONST_OBJ_TYPE(
mod_network_nic_type_wlan_base,
MP_QSTR_WLAN,
MP_TYPE_FLAG_NONE,
wlan_make_new,
locals_dict, (mp_obj_t)&wlan_locals_dict
);
const mod_network_nic_type_t mod_network_nic_type_wlan = { const mod_network_nic_type_t mod_network_nic_type_wlan = {
.base = { .base = mod_network_nic_type_wlan_base,
{ &mp_type_type },
.name = MP_QSTR_WLAN,
.make_new = wlan_make_new,
.locals_dict = (mp_obj_t)&wlan_locals_dict,
},
}; };
STATIC const mp_irq_methods_t wlan_irq_methods = { STATIC const mp_irq_methods_t wlan_irq_methods = {

View File

@ -233,13 +233,14 @@ STATIC const mp_rom_map_elem_t adc_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
const mp_obj_type_t pyb_adc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_adc_type,
.name = MP_QSTR_ADC, MP_QSTR_ADC,
.print = adc_print, MP_TYPE_FLAG_NONE,
.make_new = adc_make_new, adc_make_new,
.locals_dict = (mp_obj_t)&adc_locals_dict, print, adc_print,
}; locals_dict, (mp_obj_t)&adc_locals_dict
);
STATIC void adc_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { STATIC void adc_channel_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_adc_channel_obj_t *self = self_in; pyb_adc_channel_obj_t *self = self_in;
@ -300,10 +301,12 @@ STATIC const mp_rom_map_elem_t adc_channel_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(adc_channel_locals_dict, adc_channel_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(adc_channel_locals_dict, adc_channel_locals_dict_table);
STATIC const mp_obj_type_t pyb_adc_channel_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_adc_channel_type,
.name = MP_QSTR_ADCChannel, MP_QSTR_ADCChannel,
.print = adc_channel_print, MP_TYPE_FLAG_NONE,
.call = adc_channel_call, MP_TYPE_NULL_MAKE_NEW,
.locals_dict = (mp_obj_t)&adc_channel_locals_dict, print, adc_channel_print,
}; call, adc_channel_call,
locals_dict, (mp_obj_t)&adc_channel_locals_dict
);

View File

@ -84,12 +84,13 @@ STATIC const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
const mp_obj_type_t pyb_flash_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_flash_type,
.name = MP_QSTR_Flash, MP_QSTR_Flash,
.make_new = pyb_flash_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&pyb_flash_locals_dict, pyb_flash_make_new,
}; locals_dict, (mp_obj_t)&pyb_flash_locals_dict
);
void pyb_flash_init_vfs(fs_user_mount_t *vfs) { void pyb_flash_init_vfs(fs_user_mount_t *vfs) {
vfs->base.type = &mp_fat_vfs_type; vfs->base.type = &mp_fat_vfs_type;

View File

@ -521,10 +521,11 @@ STATIC const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table);
const mp_obj_type_t pyb_i2c_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_i2c_type,
.name = MP_QSTR_I2C, MP_QSTR_I2C,
.print = pyb_i2c_print, MP_TYPE_FLAG_NONE,
.make_new = pyb_i2c_make_new, pyb_i2c_make_new,
.locals_dict = (mp_obj_t)&pyb_i2c_locals_dict, print, pyb_i2c_print,
}; locals_dict, (mp_obj_t)&pyb_i2c_locals_dict
);

View File

@ -931,14 +931,15 @@ STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
const mp_obj_type_t pin_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pin_type,
.name = MP_QSTR_Pin, MP_QSTR_Pin,
.print = pin_print, MP_TYPE_FLAG_NONE,
.make_new = pin_make_new, pin_make_new,
.call = pin_call, print, pin_print,
.locals_dict = (mp_obj_t)&pin_locals_dict, call, pin_call,
}; locals_dict, (mp_obj_t)&pin_locals_dict
);
STATIC const mp_irq_methods_t pin_irq_methods = { STATIC const mp_irq_methods_t pin_irq_methods = {
.init = pin_irq, .init = pin_irq,
@ -952,10 +953,12 @@ STATIC void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in,
mp_printf(print, "<Pin.%q>", self->name); mp_printf(print, "<Pin.%q>", self->name);
} }
const mp_obj_type_t pin_board_pins_obj_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pin_board_pins_obj_type,
.name = MP_QSTR_board, MP_QSTR_board,
.print = pin_named_pins_obj_print, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&pin_board_pins_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; print, pin_named_pins_obj_print,
locals_dict, (mp_obj_t)&pin_board_pins_locals_dict
);

View File

@ -469,12 +469,13 @@ STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
const mp_obj_type_t pyb_rtc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_rtc_type,
.name = MP_QSTR_RTC, MP_QSTR_RTC,
.make_new = pyb_rtc_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&pyb_rtc_locals_dict, pyb_rtc_make_new,
}; locals_dict, (mp_obj_t)&pyb_rtc_locals_dict
);
STATIC const mp_irq_methods_t pyb_rtc_irq_methods = { STATIC const mp_irq_methods_t pyb_rtc_irq_methods = {
.init = pyb_rtc_irq, .init = pyb_rtc_irq,

View File

@ -212,9 +212,10 @@ STATIC const mp_rom_map_elem_t pyb_sd_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pyb_sd_locals_dict, pyb_sd_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_sd_locals_dict, pyb_sd_locals_dict_table);
const mp_obj_type_t pyb_sd_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_sd_type,
.name = MP_QSTR_SD, MP_QSTR_SD,
.make_new = pyb_sd_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&pyb_sd_locals_dict, pyb_sd_make_new,
}; locals_dict, (mp_obj_t)&pyb_sd_locals_dict
);

View File

@ -125,10 +125,12 @@ STATIC pybsleep_data_t pybsleep_data = {NULL, NULL, NULL};
volatile arm_cm4_core_regs_t vault_arm_registers; volatile arm_cm4_core_regs_t vault_arm_registers;
STATIC pybsleep_reset_cause_t pybsleep_reset_cause = PYB_SLP_PWRON_RESET; STATIC pybsleep_reset_cause_t pybsleep_reset_cause = PYB_SLP_PWRON_RESET;
STATIC pybsleep_wake_reason_t pybsleep_wake_reason = PYB_SLP_WAKED_PWRON; STATIC pybsleep_wake_reason_t pybsleep_wake_reason = PYB_SLP_WAKED_PWRON;
STATIC const mp_obj_type_t pyb_sleep_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_sleep_type,
.name = MP_QSTR_sleep, MP_QSTR_sleep,
}; MP_TYPE_FLAG_NONE,
MP_TYPE_NULL_MAKE_NEW
);
/****************************************************************************** /******************************************************************************
DECLARE PRIVATE FUNCTIONS DECLARE PRIVATE FUNCTIONS

View File

@ -377,10 +377,11 @@ STATIC const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
const mp_obj_type_t pyb_spi_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_spi_type,
.name = MP_QSTR_SPI, MP_QSTR_SPI,
.print = pyb_spi_print, MP_TYPE_FLAG_NONE,
.make_new = pyb_spi_make_new, pyb_spi_make_new,
.locals_dict = (mp_obj_t)&pyb_spi_locals_dict, print, pyb_spi_print,
}; locals_dict, (mp_obj_t)&pyb_spi_locals_dict
);

View File

@ -459,13 +459,14 @@ STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
const mp_obj_type_t pyb_timer_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_timer_type,
.name = MP_QSTR_Timer, MP_QSTR_Timer,
.print = pyb_timer_print, MP_TYPE_FLAG_NONE,
.make_new = pyb_timer_make_new, pyb_timer_make_new,
.locals_dict = (mp_obj_t)&pyb_timer_locals_dict, print, pyb_timer_print,
}; locals_dict, (mp_obj_t)&pyb_timer_locals_dict
);
STATIC const mp_irq_methods_t pyb_timer_channel_irq_methods = { STATIC const mp_irq_methods_t pyb_timer_channel_irq_methods = {
.init = pyb_timer_channel_irq, .init = pyb_timer_channel_irq,
@ -721,11 +722,13 @@ STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
STATIC const mp_obj_type_t pyb_timer_channel_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_timer_channel_type,
.name = MP_QSTR_TimerChannel, MP_QSTR_TimerChannel,
.print = pyb_timer_channel_print, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&pyb_timer_channel_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; print, pyb_timer_channel_print,
locals_dict, (mp_obj_t)&pyb_timer_channel_locals_dict
);
MP_REGISTER_ROOT_POINTER(mp_obj_list_t pyb_timer_channel_obj_list); MP_REGISTER_ROOT_POINTER(mp_obj_list_t pyb_timer_channel_obj_list);

View File

@ -685,15 +685,16 @@ STATIC const mp_irq_methods_t uart_irq_methods = {
.flags = uart_irq_flags .flags = uart_irq_flags
}; };
const mp_obj_type_t pyb_uart_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_uart_type,
.name = MP_QSTR_UART, MP_QSTR_UART,
.print = pyb_uart_print, MP_TYPE_FLAG_NONE,
.make_new = pyb_uart_make_new, pyb_uart_make_new,
.getiter = mp_identity_getiter, print, pyb_uart_print,
.iternext = mp_stream_unbuffered_iter, getiter, mp_identity_getiter,
.protocol = &uart_stream_p, iternext, mp_stream_unbuffered_iter,
.locals_dict = (mp_obj_t)&pyb_uart_locals_dict, protocol, &uart_stream_p,
}; locals_dict, (mp_obj_t)&pyb_uart_locals_dict
);
MP_REGISTER_ROOT_POINTER(struct _pyb_uart_obj_t *pyb_uart_objs[2]); MP_REGISTER_ROOT_POINTER(struct _pyb_uart_obj_t *pyb_uart_objs[2]);

View File

@ -150,10 +150,11 @@ STATIC const mp_rom_map_elem_t pybwdt_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(pybwdt_locals_dict, pybwdt_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pybwdt_locals_dict, pybwdt_locals_dict_table);
const mp_obj_type_t pyb_wdt_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_wdt_type,
.name = MP_QSTR_WDT, MP_QSTR_WDT,
.make_new = pyb_wdt_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&pybwdt_locals_dict, pyb_wdt_make_new,
}; locals_dict, (mp_obj_t)&pybwdt_locals_dict
);

View File

@ -141,10 +141,11 @@ STATIC const mp_rom_map_elem_t esp32_nvs_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(esp32_nvs_locals_dict, esp32_nvs_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(esp32_nvs_locals_dict, esp32_nvs_locals_dict_table);
const mp_obj_type_t esp32_nvs_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, esp32_nvs_type,
.name = MP_QSTR_NVS, MP_QSTR_NVS,
.print = esp32_nvs_print, MP_TYPE_FLAG_NONE,
.make_new = esp32_nvs_make_new, esp32_nvs_make_new,
.locals_dict = (mp_obj_dict_t *)&esp32_nvs_locals_dict, print, esp32_nvs_print,
}; locals_dict, (mp_obj_dict_t *)&esp32_nvs_locals_dict
);

View File

@ -284,10 +284,11 @@ STATIC const mp_rom_map_elem_t esp32_partition_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(esp32_partition_locals_dict, esp32_partition_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(esp32_partition_locals_dict, esp32_partition_locals_dict_table);
const mp_obj_type_t esp32_partition_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, esp32_partition_type,
.name = MP_QSTR_Partition, MP_QSTR_Partition,
.print = esp32_partition_print, MP_TYPE_FLAG_NONE,
.make_new = esp32_partition_make_new, esp32_partition_make_new,
.locals_dict = (mp_obj_dict_t *)&esp32_partition_locals_dict, print, esp32_partition_print,
}; locals_dict, (mp_obj_dict_t *)&esp32_partition_locals_dict
);

View File

@ -372,10 +372,11 @@ STATIC const mp_rom_map_elem_t esp32_rmt_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(esp32_rmt_locals_dict, esp32_rmt_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(esp32_rmt_locals_dict, esp32_rmt_locals_dict_table);
const mp_obj_type_t esp32_rmt_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, esp32_rmt_type,
.name = MP_QSTR_RMT, MP_QSTR_RMT,
.print = esp32_rmt_print, MP_TYPE_FLAG_NONE,
.make_new = esp32_rmt_make_new, esp32_rmt_make_new,
.locals_dict = (mp_obj_dict_t *)&esp32_rmt_locals_dict, print, esp32_rmt_print,
}; locals_dict, (mp_obj_dict_t *)&esp32_rmt_locals_dict
);

View File

@ -91,11 +91,12 @@ STATIC const mp_rom_map_elem_t esp32_ulp_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(esp32_ulp_locals_dict, esp32_ulp_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(esp32_ulp_locals_dict, esp32_ulp_locals_dict_table);
const mp_obj_type_t esp32_ulp_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, esp32_ulp_type,
.name = MP_QSTR_ULP, MP_QSTR_ULP,
.make_new = esp32_ulp_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&esp32_ulp_locals_dict, esp32_ulp_make_new,
}; locals_dict, (mp_obj_t)&esp32_ulp_locals_dict
);
#endif // CONFIG_IDF_TARGET_ESP32 #endif // CONFIG_IDF_TARGET_ESP32

View File

@ -256,10 +256,11 @@ STATIC const mp_rom_map_elem_t madc_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(madc_locals_dict, madc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(madc_locals_dict, madc_locals_dict_table);
const mp_obj_type_t machine_adc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_adc_type,
.name = MP_QSTR_ADC, MP_QSTR_ADC,
.print = madc_print, MP_TYPE_FLAG_NONE,
.make_new = madc_make_new, madc_make_new,
.locals_dict = (mp_obj_t)&madc_locals_dict, print, madc_print,
}; locals_dict, (mp_obj_t)&madc_locals_dict
);

View File

@ -194,10 +194,11 @@ STATIC const mp_rom_map_elem_t madcblock_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(madcblock_locals_dict, madcblock_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(madcblock_locals_dict, madcblock_locals_dict_table);
const mp_obj_type_t machine_adcblock_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_adcblock_type,
.name = MP_QSTR_ADCBlock, MP_QSTR_ADCBlock,
.print = madcblock_print, MP_TYPE_FLAG_NONE,
.make_new = madcblock_make_new, madcblock_make_new,
.locals_dict = (mp_obj_t)&madcblock_locals_dict, print, madcblock_print,
}; locals_dict, (mp_obj_dict_t *)&madcblock_locals_dict
);

View File

@ -104,12 +104,13 @@ STATIC const mp_rom_map_elem_t mdac_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(mdac_locals_dict, mdac_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(mdac_locals_dict, mdac_locals_dict_table);
const mp_obj_type_t machine_dac_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_dac_type,
.name = MP_QSTR_DAC, MP_QSTR_DAC,
.print = mdac_print, MP_TYPE_FLAG_NONE,
.make_new = mdac_make_new, mdac_make_new,
.locals_dict = (mp_obj_t)&mdac_locals_dict, print, mdac_print,
}; locals_dict, (mp_obj_t)&mdac_locals_dict
);
#endif // MICROPY_PY_MACHINE_DAC #endif // MICROPY_PY_MACHINE_DAC

View File

@ -545,11 +545,12 @@ STATIC const mp_machine_spi_p_t machine_hw_spi_p = {
.transfer = machine_hw_spi_transfer, .transfer = machine_hw_spi_transfer,
}; };
const mp_obj_type_t machine_hw_spi_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_hw_spi_type,
.name = MP_QSTR_SPI, MP_QSTR_SPI,
.print = machine_hw_spi_print, MP_TYPE_FLAG_NONE,
.make_new = machine_hw_spi_make_new, machine_hw_spi_make_new,
.protocol = &machine_hw_spi_p, print, machine_hw_spi_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_spi_locals_dict, protocol, &machine_hw_spi_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_spi_locals_dict
);

View File

@ -192,11 +192,12 @@ STATIC const mp_machine_i2c_p_t machine_hw_i2c_p = {
.transfer = machine_hw_i2c_transfer, .transfer = machine_hw_i2c_transfer,
}; };
const mp_obj_type_t machine_hw_i2c_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_hw_i2c_type,
.name = MP_QSTR_I2C, MP_QSTR_I2C,
.print = machine_hw_i2c_print, MP_TYPE_FLAG_NONE,
.make_new = machine_hw_i2c_make_new, machine_hw_i2c_make_new,
.protocol = &machine_hw_i2c_p, print, machine_hw_i2c_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_i2c_locals_dict, protocol, &machine_hw_i2c_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_i2c_locals_dict
);

View File

@ -829,16 +829,17 @@ STATIC const mp_stream_p_t i2s_stream_p = {
.is_text = false, .is_text = false,
}; };
const mp_obj_type_t machine_i2s_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_i2s_type,
.name = MP_QSTR_I2S, MP_QSTR_I2S,
.print = machine_i2s_print, MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, machine_i2s_make_new,
.iternext = mp_stream_unbuffered_iter, print, machine_i2s_print,
.protocol = &i2s_stream_p, getiter, mp_identity_getiter,
.make_new = machine_i2s_make_new, iternext, mp_stream_unbuffered_iter,
.locals_dict = (mp_obj_dict_t *)&machine_i2s_locals_dict, protocol, &i2s_stream_p,
}; locals_dict, (mp_obj_dict_t *)&machine_i2s_locals_dict
);
MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]); MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]);

View File

@ -529,15 +529,16 @@ STATIC const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl, .ioctl = pin_ioctl,
}; };
const mp_obj_type_t machine_pin_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_pin_type,
.name = MP_QSTR_Pin, MP_QSTR_Pin,
.print = machine_pin_print, MP_TYPE_FLAG_NONE,
.make_new = mp_pin_make_new, mp_pin_make_new,
.call = machine_pin_call, print, machine_pin_print,
.protocol = &pin_pin_p, call, machine_pin_call,
.locals_dict = (mp_obj_t)&machine_pin_locals_dict, protocol, &pin_pin_p,
}; locals_dict, (mp_obj_t)&machine_pin_locals_dict
);
/******************************************************************************/ /******************************************************************************/
// Pin IRQ object // Pin IRQ object
@ -723,11 +724,13 @@ STATIC const mp_rom_map_elem_t machine_pin_irq_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_pin_irq_locals_dict, machine_pin_irq_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_pin_irq_locals_dict, machine_pin_irq_locals_dict_table);
STATIC const mp_obj_type_t machine_pin_irq_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_pin_irq_type,
.name = MP_QSTR_IRQ, MP_QSTR_IRQ,
.call = machine_pin_irq_call, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&machine_pin_irq_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; call, machine_pin_irq_call,
locals_dict, (mp_obj_dict_t *)&machine_pin_irq_locals_dict
);
MP_REGISTER_ROOT_POINTER(mp_obj_t machine_pin_irq_handler[40]); MP_REGISTER_ROOT_POINTER(mp_obj_t machine_pin_irq_handler[40]);

View File

@ -173,9 +173,10 @@ STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
const mp_obj_type_t machine_rtc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_rtc_type,
.name = MP_QSTR_RTC, MP_QSTR_RTC,
.make_new = machine_rtc_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&machine_rtc_locals_dict, machine_rtc_make_new,
}; locals_dict, (mp_obj_t)&machine_rtc_locals_dict
);

View File

@ -399,11 +399,12 @@ STATIC const mp_rom_map_elem_t machine_sdcard_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(machine_sdcard_locals_dict, machine_sdcard_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_sdcard_locals_dict, machine_sdcard_locals_dict_table);
const mp_obj_type_t machine_sdcard_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_sdcard_type,
.name = MP_QSTR_SDCard, MP_QSTR_SDCard,
.make_new = machine_sdcard_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&machine_sdcard_locals_dict, machine_sdcard_make_new,
}; locals_dict, (mp_obj_dict_t *)&machine_sdcard_locals_dict
);
#endif // MICROPY_HW_ENABLE_SDCARD #endif // MICROPY_HW_ENABLE_SDCARD

View File

@ -277,12 +277,13 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
const mp_obj_type_t machine_timer_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_timer_type,
.name = MP_QSTR_Timer, MP_QSTR_Timer,
.print = machine_timer_print, MP_TYPE_FLAG_NONE,
.make_new = machine_timer_make_new, machine_timer_make_new,
.locals_dict = (mp_obj_t)&machine_timer_locals_dict, print, machine_timer_print,
}; locals_dict, (mp_obj_t)&machine_timer_locals_dict
);
MP_REGISTER_ROOT_POINTER(struct _machine_timer_obj_t *machine_timer_obj_head); MP_REGISTER_ROOT_POINTER(struct _machine_timer_obj_t *machine_timer_obj_head);

View File

@ -134,11 +134,12 @@ STATIC const mp_rom_map_elem_t mtp_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(mtp_locals_dict, mtp_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(mtp_locals_dict, mtp_locals_dict_table);
const mp_obj_type_t machine_touchpad_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_touchpad_type,
.name = MP_QSTR_TouchPad, MP_QSTR_TouchPad,
.make_new = mtp_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&mtp_locals_dict, mtp_make_new,
}; locals_dict, (mp_obj_t)&mtp_locals_dict
);
#endif // CONFIG_IDF_TARGET_ESP32 #endif // CONFIG_IDF_TARGET_ESP32

View File

@ -530,13 +530,14 @@ STATIC const mp_stream_p_t uart_stream_p = {
.is_text = false, .is_text = false,
}; };
const mp_obj_type_t machine_uart_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_uart_type,
.name = MP_QSTR_UART, MP_QSTR_UART,
.print = machine_uart_print, MP_TYPE_FLAG_NONE,
.make_new = machine_uart_make_new, machine_uart_make_new,
.getiter = mp_identity_getiter, print, machine_uart_print,
.iternext = mp_stream_unbuffered_iter, getiter, mp_identity_getiter,
.protocol = &uart_stream_p, iternext, mp_stream_unbuffered_iter,
.locals_dict = (mp_obj_dict_t *)&machine_uart_locals_dict, protocol, &uart_stream_p,
}; locals_dict, (mp_obj_dict_t *)&machine_uart_locals_dict
);

View File

@ -83,9 +83,10 @@ STATIC const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
const mp_obj_type_t machine_wdt_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_wdt_type,
.name = MP_QSTR_WDT, MP_QSTR_WDT,
.make_new = machine_wdt_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&machine_wdt_locals_dict, machine_wdt_make_new,
}; locals_dict, (mp_obj_t)&machine_wdt_locals_dict
);

View File

@ -785,13 +785,14 @@ STATIC const mp_stream_p_t socket_stream_p = {
.ioctl = socket_stream_ioctl .ioctl = socket_stream_ioctl
}; };
STATIC const mp_obj_type_t socket_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, socket_type,
.name = MP_QSTR_socket, MP_QSTR_socket,
.make_new = socket_make_new, MP_TYPE_FLAG_NONE,
.protocol = &socket_stream_p, socket_make_new,
.locals_dict = (mp_obj_t)&socket_locals_dict, protocol, &socket_stream_p,
}; locals_dict, (mp_obj_t)&socket_locals_dict
);
STATIC mp_obj_t esp_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t esp_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
// TODO support additional args beyond the first two // TODO support additional args beyond the first two

View File

@ -302,10 +302,12 @@ STATIC const mp_rom_map_elem_t lan_if_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(lan_if_locals_dict, lan_if_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(lan_if_locals_dict, lan_if_locals_dict_table);
const mp_obj_type_t lan_if_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, lan_if_type,
.name = MP_QSTR_LAN, MP_QSTR_LAN,
.locals_dict = (mp_obj_dict_t *)&lan_if_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_dict_t *)&lan_if_locals_dict
);
#endif #endif

View File

@ -278,8 +278,10 @@ STATIC const mp_rom_map_elem_t ppp_if_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(ppp_if_locals_dict, ppp_if_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(ppp_if_locals_dict, ppp_if_locals_dict_table);
const mp_obj_type_t ppp_if_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, ppp_if_type,
.name = MP_QSTR_PPP, MP_QSTR_PPP,
.locals_dict = (mp_obj_dict_t *)&ppp_if_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_dict_t *)&ppp_if_locals_dict
);

View File

@ -47,9 +47,8 @@
#error WIFI_MODE_STA and WIFI_MODE_AP are supposed to be bitfields! #error WIFI_MODE_STA and WIFI_MODE_AP are supposed to be bitfields!
#endif #endif
STATIC const mp_obj_type_t wlan_if_type; STATIC const wlan_if_obj_t wlan_sta_obj;
STATIC const wlan_if_obj_t wlan_sta_obj = {{&wlan_if_type}, WIFI_IF_STA}; STATIC const wlan_if_obj_t wlan_ap_obj;
STATIC const wlan_if_obj_t wlan_ap_obj = {{&wlan_if_type}, WIFI_IF_AP};
// Set to "true" if esp_wifi_start() was called // Set to "true" if esp_wifi_start() was called
static bool wifi_started = false; static bool wifi_started = false;
@ -616,10 +615,15 @@ STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
STATIC const mp_obj_type_t wlan_if_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, wlan_if_type,
.name = MP_QSTR_WLAN, MP_QSTR_WLAN,
.locals_dict = (mp_obj_t)&wlan_if_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_dict_t *)&wlan_if_locals_dict
);
STATIC const wlan_if_obj_t wlan_sta_obj = {{&wlan_if_type}, WIFI_IF_STA};
STATIC const wlan_if_obj_t wlan_ap_obj = {{&wlan_if_type}, WIFI_IF_AP};
#endif // MICROPY_PY_NETWORK_WLAN #endif // MICROPY_PY_NETWORK_WLAN

View File

@ -89,10 +89,11 @@ STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table);
const mp_obj_type_t machine_adc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_adc_type,
.name = MP_QSTR_ADC, MP_QSTR_ADC,
.print = machine_adc_print, MP_TYPE_FLAG_NONE,
.make_new = machine_adc_make_new, machine_adc_make_new,
.locals_dict = (mp_obj_dict_t *)&machine_adc_locals_dict, print, machine_adc_print,
}; locals_dict, (mp_obj_dict_t *)&machine_adc_locals_dict
);

View File

@ -175,13 +175,14 @@ STATIC const mp_machine_spi_p_t machine_hspi_p = {
.transfer = machine_hspi_transfer, .transfer = machine_hspi_transfer,
}; };
const mp_obj_type_t machine_hspi_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_hspi_type,
.name = MP_QSTR_HSPI, MP_QSTR_HSPI,
.print = machine_hspi_print, MP_TYPE_FLAG_NONE,
.make_new = machine_hspi_make_new, machine_hspi_make_new,
.protocol = &machine_hspi_p, print, machine_hspi_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_spi_locals_dict, protocol, &machine_hspi_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_spi_locals_dict
);
#endif // MICROPY_PY_MACHINE_SPI #endif // MICROPY_PY_MACHINE_SPI

View File

@ -450,15 +450,16 @@ STATIC const mp_pin_p_t pin_pin_p = {
.ioctl = pin_ioctl, .ioctl = pin_ioctl,
}; };
const mp_obj_type_t pyb_pin_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_pin_type,
.name = MP_QSTR_Pin, MP_QSTR_Pin,
.print = pyb_pin_print, MP_TYPE_FLAG_NONE,
.make_new = mp_pin_make_new, mp_pin_make_new,
.call = pyb_pin_call, print, pyb_pin_print,
.protocol = &pin_pin_p, call, pyb_pin_call,
.locals_dict = (mp_obj_dict_t *)&pyb_pin_locals_dict, protocol, &pin_pin_p,
}; locals_dict, (mp_obj_dict_t *)&pyb_pin_locals_dict
);
/******************************************************************************/ /******************************************************************************/
// Pin IRQ object // Pin IRQ object
@ -509,11 +510,13 @@ STATIC const mp_rom_map_elem_t pin_irq_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pin_irq_locals_dict, pin_irq_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pin_irq_locals_dict, pin_irq_locals_dict_table);
STATIC const mp_obj_type_t pin_irq_type = { STATIC MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pin_irq_type,
.name = MP_QSTR_IRQ, MP_QSTR_IRQ,
.call = pin_irq_call, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&pin_irq_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; call, pin_irq_call,
locals_dict, (mp_obj_dict_t *)&pin_irq_locals_dict
);
MP_REGISTER_ROOT_POINTER(mp_obj_t pin_irq_handler[16]); MP_REGISTER_ROOT_POINTER(mp_obj_t pin_irq_handler[16]);

View File

@ -262,9 +262,10 @@ STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
const mp_obj_type_t pyb_rtc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_rtc_type,
.name = MP_QSTR_RTC, MP_QSTR_RTC,
.make_new = pyb_rtc_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&pyb_rtc_locals_dict, pyb_rtc_make_new,
}; locals_dict, (mp_obj_dict_t *)&pyb_rtc_locals_dict
);

View File

@ -343,15 +343,16 @@ STATIC const mp_stream_p_t uart_stream_p = {
.is_text = false, .is_text = false,
}; };
const mp_obj_type_t pyb_uart_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pyb_uart_type,
.name = MP_QSTR_UART, MP_QSTR_UART,
.print = pyb_uart_print, MP_TYPE_FLAG_NONE,
.make_new = pyb_uart_make_new, pyb_uart_make_new,
.getiter = mp_identity_getiter, print, pyb_uart_print,
.iternext = mp_stream_unbuffered_iter, getiter, mp_identity_getiter,
.protocol = &uart_stream_p, iternext, mp_stream_unbuffered_iter,
.locals_dict = (mp_obj_dict_t *)&pyb_uart_locals_dict, protocol, &uart_stream_p,
}; locals_dict, (mp_obj_dict_t *)&pyb_uart_locals_dict
);
MP_REGISTER_ROOT_POINTER(byte * uart0_rxbuf); MP_REGISTER_ROOT_POINTER(byte * uart0_rxbuf);

View File

@ -69,9 +69,10 @@ STATIC const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
const mp_obj_type_t esp_wdt_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, esp_wdt_type,
.name = MP_QSTR_WDT, MP_QSTR_WDT,
.make_new = machine_wdt_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&machine_wdt_locals_dict, machine_wdt_make_new,
}; locals_dict, (mp_obj_dict_t *)&machine_wdt_locals_dict
);

View File

@ -337,13 +337,14 @@ STATIC const mp_rom_map_elem_t esp_timer_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(esp_timer_locals_dict, esp_timer_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(esp_timer_locals_dict, esp_timer_locals_dict_table);
const mp_obj_type_t esp_timer_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, esp_timer_type,
.name = MP_QSTR_Timer, MP_QSTR_Timer,
.print = esp_timer_print, MP_TYPE_FLAG_NONE,
.make_new = esp_timer_make_new, esp_timer_make_new,
.locals_dict = (mp_obj_dict_t *)&esp_timer_locals_dict, print, esp_timer_print,
}; locals_dict, (mp_obj_dict_t *)&esp_timer_locals_dict
);
// this bit is unused in the Xtensa PS register // this bit is unused in the Xtensa PS register
#define ETS_LOOP_ITER_BIT (12) #define ETS_LOOP_ITER_BIT (12)

View File

@ -510,11 +510,13 @@ STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
const mp_obj_type_t wlan_if_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, wlan_if_type,
.name = MP_QSTR_WLAN, MP_QSTR_WLAN,
.locals_dict = (mp_obj_dict_t *)&wlan_if_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_dict_t *)&wlan_if_locals_dict
);
STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) { STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) { if (n_args == 0) {

View File

@ -117,13 +117,14 @@ STATIC const mp_rom_map_elem_t adc_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
const mp_obj_type_t machine_adc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{&mp_type_type}, machine_adc_type,
.name = MP_QSTR_ADC, MP_QSTR_ADC,
.print = adc_obj_print, MP_TYPE_FLAG_NONE,
.make_new = adc_obj_make_new, adc_obj_make_new,
.locals_dict = (mp_obj_dict_t *)&adc_locals_dict, print, adc_obj_print,
}; locals_dict, (mp_obj_dict_t *)&adc_locals_dict
);
void machine_adc_init(void) { void machine_adc_init(void) {
for (int i = 1; i < sizeof(adc_bases) / sizeof(ADC_Type *); ++i) { for (int i = 1; i < sizeof(adc_bases) / sizeof(ADC_Type *); ++i) {

View File

@ -197,11 +197,12 @@ STATIC const mp_machine_i2c_p_t machine_i2c_p = {
.transfer_single = machine_i2c_transfer_single, .transfer_single = machine_i2c_transfer_single,
}; };
const mp_obj_type_t machine_i2c_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_i2c_type,
.name = MP_QSTR_I2C, MP_QSTR_I2C,
.print = machine_i2c_print, MP_TYPE_FLAG_NONE,
.make_new = machine_i2c_make_new, machine_i2c_make_new,
.protocol = &machine_i2c_p, print, machine_i2c_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_i2c_locals_dict, protocol, &machine_i2c_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_i2c_locals_dict
);

View File

@ -1213,16 +1213,17 @@ STATIC const mp_stream_p_t i2s_stream_p = {
.is_text = false, .is_text = false,
}; };
const mp_obj_type_t machine_i2s_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_i2s_type,
.name = MP_QSTR_I2S, MP_QSTR_I2S,
.print = machine_i2s_print, MP_TYPE_FLAG_NONE,
.getiter = mp_identity_getiter, machine_i2s_make_new,
.iternext = mp_stream_unbuffered_iter, print, machine_i2s_print,
.protocol = &i2s_stream_p, getiter, mp_identity_getiter,
.make_new = machine_i2s_make_new, iternext, mp_stream_unbuffered_iter,
.locals_dict = (mp_obj_dict_t *)&machine_i2s_locals_dict, protocol, &i2s_stream_p,
}; locals_dict, (mp_obj_dict_t *)&machine_i2s_locals_dict
);
MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]); MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]);

View File

@ -80,12 +80,13 @@ STATIC const mp_rom_map_elem_t led_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
const mp_obj_type_t machine_led_type = { MP_DEFINE_CONST_OBJ_TYPE(
{&mp_type_type}, machine_led_type,
.name = MP_QSTR_LED, MP_QSTR_LED,
.print = led_obj_print, MP_TYPE_FLAG_NONE,
.make_new = led_obj_make_new, led_obj_make_new,
.locals_dict = (mp_obj_dict_t *)&led_locals_dict, print, led_obj_print,
}; locals_dict, (mp_obj_dict_t *)&led_locals_dict
);
#endif #endif

View File

@ -58,17 +58,21 @@ enum {
}; };
// Pin mapping dictionaries // Pin mapping dictionaries
const mp_obj_type_t machine_pin_cpu_pins_obj_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_pin_cpu_pins_obj_type,
.name = MP_QSTR_cpu, MP_QSTR_cpu,
.locals_dict = (mp_obj_t)&machine_pin_cpu_pins_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_t)&machine_pin_cpu_pins_locals_dict
);
const mp_obj_type_t machine_pin_board_pins_obj_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_pin_board_pins_obj_type,
.name = MP_QSTR_board, MP_QSTR_board,
.locals_dict = (mp_obj_t)&machine_pin_board_pins_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_t)&machine_pin_board_pins_locals_dict
);
STATIC const mp_irq_methods_t machine_pin_irq_methods; STATIC const mp_irq_methods_t machine_pin_irq_methods;
@ -396,7 +400,6 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table);
STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) { STATIC mp_uint_t machine_pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
(void)errcode; (void)errcode;
machine_pin_obj_t *self = self_in; machine_pin_obj_t *self = self_in;
@ -417,24 +420,26 @@ STATIC const mp_pin_p_t machine_pin_obj_protocol = {
.ioctl = machine_pin_ioctl, .ioctl = machine_pin_ioctl,
}; };
const mp_obj_type_t machine_pin_type = { MP_DEFINE_CONST_OBJ_TYPE(
{&mp_type_type}, machine_pin_type,
.name = MP_QSTR_Pin, MP_QSTR_Pin,
.print = machine_pin_obj_print, MP_TYPE_FLAG_NONE,
.call = machine_pin_obj_call, mp_pin_make_new,
.make_new = mp_pin_make_new, print, machine_pin_obj_print,
.protocol = &machine_pin_obj_protocol, call, machine_pin_obj_call,
.locals_dict = (mp_obj_dict_t *)&machine_pin_locals_dict, protocol, &machine_pin_obj_protocol,
}; locals_dict, (mp_obj_dict_t *)&machine_pin_locals_dict
);
// FIXME: Create actual pin_af type!!! // FIXME: Create actual pin_af type!!!
const mp_obj_type_t machine_pin_af_type = { MP_DEFINE_CONST_OBJ_TYPE(
{&mp_type_type}, machine_pin_af_type,
.name = MP_QSTR_PinAF, MP_QSTR_PinAF,
.print = machine_pin_obj_print, MP_TYPE_FLAG_NONE,
.make_new = mp_pin_make_new, mp_pin_make_new,
.locals_dict = (mp_obj_dict_t *)&machine_pin_locals_dict, print, machine_pin_obj_print,
}; locals_dict, (mp_obj_dict_t *)&machine_pin_locals_dict
);
STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) { STATIC mp_uint_t machine_pin_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger) {
machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in); machine_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -166,9 +166,10 @@ STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
const mp_obj_type_t machine_rtc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_rtc_type,
.name = MP_QSTR_RTC, MP_QSTR_RTC,
.make_new = machine_rtc_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_t)&machine_rtc_locals_dict, machine_rtc_make_new,
}; locals_dict, (mp_obj_t)&machine_rtc_locals_dict
);

View File

@ -208,12 +208,13 @@ STATIC const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table);
const mp_obj_type_t machine_sdcard_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_sdcard_type,
.name = MP_QSTR_SDCard, MP_QSTR_SDCard,
.make_new = sdcard_obj_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&sdcard_locals_dict, sdcard_obj_make_new,
}; locals_dict, (mp_obj_dict_t *)&sdcard_locals_dict
);
void machine_sdcard_init0(void) { void machine_sdcard_init0(void) {
return; return;

View File

@ -251,11 +251,12 @@ STATIC const mp_machine_spi_p_t machine_spi_p = {
.transfer = machine_spi_transfer, .transfer = machine_spi_transfer,
}; };
const mp_obj_type_t machine_spi_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_spi_type,
.name = MP_QSTR_SPI, MP_QSTR_SPI,
.print = machine_spi_print, MP_TYPE_FLAG_NONE,
.make_new = machine_spi_make_new, machine_spi_make_new,
.protocol = &machine_spi_p, print, machine_spi_print,
.locals_dict = (mp_obj_dict_t *)&mp_machine_spi_locals_dict, protocol, &machine_spi_p,
}; locals_dict, (mp_obj_dict_t *)&mp_machine_spi_locals_dict
);

View File

@ -211,12 +211,13 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
const mp_obj_type_t machine_timer_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_timer_type,
.name = MP_QSTR_Timer, MP_QSTR_Timer,
.print = machine_timer_print, MP_TYPE_FLAG_NONE,
.make_new = machine_timer_make_new, machine_timer_make_new,
.locals_dict = (mp_obj_dict_t *)&machine_timer_locals_dict, print, machine_timer_print,
}; locals_dict, (mp_obj_dict_t *)&machine_timer_locals_dict
);
MP_REGISTER_ROOT_POINTER(struct _machine_timer_obj_t *timer_table[MICROPY_HW_PIT_NUM_CHANNELS]); MP_REGISTER_ROOT_POINTER(struct _machine_timer_obj_t *timer_table[MICROPY_HW_PIT_NUM_CHANNELS]);

View File

@ -469,13 +469,14 @@ STATIC const mp_stream_p_t uart_stream_p = {
.is_text = false, .is_text = false,
}; };
const mp_obj_type_t machine_uart_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_uart_type,
.name = MP_QSTR_UART, MP_QSTR_UART,
.print = machine_uart_print, MP_TYPE_FLAG_NONE,
.make_new = machine_uart_make_new, machine_uart_make_new,
.getiter = mp_identity_getiter, print, machine_uart_print,
.iternext = mp_stream_unbuffered_iter, getiter, mp_identity_getiter,
.protocol = &uart_stream_p, iternext, mp_stream_unbuffered_iter,
.locals_dict = (mp_obj_dict_t *)&machine_uart_locals_dict, protocol, &uart_stream_p,
}; locals_dict, (mp_obj_dict_t *)&machine_uart_locals_dict
);

View File

@ -99,9 +99,10 @@ STATIC const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
const mp_obj_type_t machine_wdt_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_wdt_type,
.name = MP_QSTR_WDT, MP_QSTR_WDT,
.make_new = machine_wdt_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&machine_wdt_locals_dict, machine_wdt_make_new,
}; locals_dict, (mp_obj_dict_t *)&machine_wdt_locals_dict
);

View File

@ -215,9 +215,10 @@ STATIC const mp_rom_map_elem_t mimxrt_flash_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(mimxrt_flash_locals_dict, mimxrt_flash_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(mimxrt_flash_locals_dict, mimxrt_flash_locals_dict_table);
const mp_obj_type_t mimxrt_flash_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, mimxrt_flash_type,
.name = MP_QSTR_Flash, MP_QSTR_Flash,
.make_new = mimxrt_flash_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t *)&mimxrt_flash_locals_dict, mimxrt_flash_make_new,
}; locals_dict, (mp_obj_dict_t *)&mimxrt_flash_locals_dict
);

View File

@ -220,12 +220,14 @@ STATIC const mp_rom_map_elem_t network_lan_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(network_lan_locals_dict, network_lan_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(network_lan_locals_dict, network_lan_locals_dict_table);
const mp_obj_type_t network_lan_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, network_lan_type,
.name = MP_QSTR_LAN, MP_QSTR_LAN,
.print = network_lan_print, MP_TYPE_FLAG_NONE,
.make_new = network_lan_make_new, network_lan_make_new,
.locals_dict = (mp_obj_dict_t *)&network_lan_locals_dict, print, network_lan_print,
}; locals_dict, (mp_obj_dict_t *)&network_lan_locals_dict
);
#endif // defined(MICROPY_HW_ETH_MDC) #endif // defined(MICROPY_HW_ETH_MDC)

View File

@ -43,12 +43,14 @@ static mp_obj_t microbit_repeat_iter_next(mp_obj_t iter_in) {
return mp_obj_subscr(iter->iterable, MP_OBJ_NEW_SMALL_INT(iter->index), MP_OBJ_SENTINEL); return mp_obj_subscr(iter->iterable, MP_OBJ_NEW_SMALL_INT(iter->index), MP_OBJ_SENTINEL);
} }
const mp_obj_type_t microbit_repeat_iterator_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, microbit_repeat_iterator_type,
.name = MP_QSTR_iterator, MP_QSTR_iterator,
.getiter = mp_identity_getiter, MP_TYPE_FLAG_NONE,
.iternext = microbit_repeat_iter_next, MP_TYPE_NULL_MAKE_NEW,
}; getiter, mp_identity_getiter,
iternext, microbit_repeat_iter_next
);
mp_obj_t microbit_repeat_iterator(mp_obj_t iterable) { mp_obj_t microbit_repeat_iterator(mp_obj_t iterable) {
repeat_iterator_t *result = mp_obj_malloc(repeat_iterator_t, &microbit_repeat_iterator_type); repeat_iterator_t *result = mp_obj_malloc(repeat_iterator_t, &microbit_repeat_iterator_type);

View File

@ -542,11 +542,13 @@ STATIC const mp_rom_map_elem_t microbit_display_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(microbit_display_locals_dict, microbit_display_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(microbit_display_locals_dict, microbit_display_locals_dict_table);
const mp_obj_type_t microbit_display_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, microbit_display_type,
.name = MP_QSTR_MicroBitDisplay, MP_QSTR_MicroBitDisplay,
.locals_dict = (mp_obj_dict_t*)&microbit_display_locals_dict, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
locals_dict, (mp_obj_dict_t*)&microbit_display_locals_dict
);
microbit_display_obj_t microbit_display_obj = { microbit_display_obj_t microbit_display_obj = {
{&microbit_display_type}, {&microbit_display_type},

View File

@ -678,14 +678,15 @@ STATIC mp_obj_t image_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
} }
const mp_obj_type_t microbit_image_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, microbit_image_type,
.name = MP_QSTR_MicroBitImage, MP_QSTR_MicroBitImage,
.print = microbit_image_print, MP_TYPE_FLAG_NONE,
.make_new = microbit_image_make_new, microbit_image_make_new,
.binary_op = image_binary_op, print, microbit_image_print,
.locals_dict = (mp_obj_dict_t*)&microbit_image_locals_dict, binary_op, image_binary_op,
}; locals_dict, (mp_obj_dict_t*)&microbit_image_locals_dict
);
typedef struct _scrolling_string_t { typedef struct _scrolling_string_t {
mp_obj_base_t base; mp_obj_base_t base;
@ -820,18 +821,22 @@ STATIC mp_obj_t microbit_scrolling_string_iter_next(mp_obj_t o_in) {
return iter->img; return iter->img;
} }
const mp_obj_type_t microbit_scrolling_string_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, microbit_scrolling_string_type,
.name = MP_QSTR_ScrollingString, MP_QSTR_ScrollingString,
.getiter = get_microbit_scrolling_string_iter, MP_TYPE_FLAG_NONE,
}; MP_TYPE_NULL_MAKE_NEW,
getiter, get_microbit_scrolling_string_iter
);
const mp_obj_type_t microbit_scrolling_string_iterator_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, microbit_scrolling_string_iterator_type,
.name = MP_QSTR_iterator, MP_QSTR_iterator,
.getiter = mp_identity_getiter, MP_TYPE_FLAG_NONE,
.iternext = microbit_scrolling_string_iter_next, MP_TYPE_NULL_MAKE_NEW,
}; getiter, mp_identity_getiter,
iternext, microbit_scrolling_string_iter_next
);
/** Facade types to present a string as a sequence of images. /** Facade types to present a string as a sequence of images.
* These are necessary to avoid allocation during iteration, * These are necessary to avoid allocation during iteration,
@ -869,13 +874,15 @@ static mp_obj_t facade_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
static mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t *iter_buf); static mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t *iter_buf);
const mp_obj_type_t string_image_facade_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, string_image_facade_type,
.name = MP_QSTR_Facade, MP_QSTR_Facade,
.unary_op = facade_unary_op, MP_TYPE_FLAG_NONE,
.subscr = string_image_facade_subscr, MP_TYPE_NULL_MAKE_NEW,
.getiter = microbit_facade_iterator, unary_op, facade_unary_op,
}; subscr, string_image_facade_subscr,
getiter, microbit_facade_iterator
);
typedef struct _facade_iterator_t { typedef struct _facade_iterator_t {
@ -904,12 +911,14 @@ static mp_obj_t microbit_facade_iter_next(mp_obj_t iter_in) {
return iter->image; return iter->image;
} }
const mp_obj_type_t microbit_facade_iterator_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, microbit_facade_iterator_type,
.name = MP_QSTR_iterator, MP_QSTR_iterator,
.getiter = mp_identity_getiter, MP_TYPE_FLAG_NONE,
.iternext = microbit_facade_iter_next, MP_TYPE_NULL_MAKE_NEW,
}; getiter, mp_identity_getiter,
iternext, microbit_facade_iter_next
);
mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t *iter_buf) { mp_obj_t microbit_facade_iterator(mp_obj_t iterable_in, mp_obj_iter_buf_t *iter_buf) {
(void)iter_buf; (void)iter_buf;

View File

@ -194,13 +194,14 @@ STATIC const mp_rom_map_elem_t led_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(led_locals_dict, led_locals_dict_table);
const mp_obj_type_t board_led_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, board_led_type,
.name = MP_QSTR_LED, MP_QSTR_LED,
.print = led_obj_print, MP_TYPE_FLAG_NONE,
.make_new = led_obj_make_new, led_obj_make_new,
.locals_dict = (mp_obj_dict_t*)&led_locals_dict, print, led_obj_print,
}; locals_dict, (mp_obj_dict_t*)&led_locals_dict
);
#else #else
// For boards with no LEDs, we leave an empty function here so that we don't // For boards with no LEDs, we leave an empty function here so that we don't

View File

@ -294,12 +294,13 @@ STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table);
const mp_obj_type_t machine_adc_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_adc_type,
.name = MP_QSTR_ADC, MP_QSTR_ADC,
.make_new = machine_adc_make_new, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t*)&machine_adc_locals_dict, machine_adc_make_new,
.print = machine_adc_print, locals_dict, (mp_obj_dict_t*)&machine_adc_locals_dict,
}; print, machine_adc_print
);
#endif // MICROPY_PY_MACHINE_ADC #endif // MICROPY_PY_MACHINE_ADC

View File

@ -161,13 +161,14 @@ STATIC const mp_machine_i2c_p_t machine_hard_i2c_p = {
.transfer_single = machine_hard_i2c_transfer_single, .transfer_single = machine_hard_i2c_transfer_single,
}; };
const mp_obj_type_t machine_hard_i2c_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_hard_i2c_type,
.name = MP_QSTR_I2C, MP_QSTR_I2C,
.print = machine_hard_i2c_print, MP_TYPE_FLAG_NONE,
.make_new = machine_hard_i2c_make_new, machine_hard_i2c_make_new,
.protocol = &machine_hard_i2c_p, print, machine_hard_i2c_print,
.locals_dict = (mp_obj_dict_t*)&mp_machine_i2c_locals_dict, protocol, &machine_hard_i2c_p,
}; locals_dict, (mp_obj_dict_t*)&mp_machine_i2c_locals_dict
);
#endif // MICROPY_PY_MACHINE_I2C #endif // MICROPY_PY_MACHINE_I2C

View File

@ -596,14 +596,15 @@ STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
const mp_obj_type_t pin_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pin_type,
.name = MP_QSTR_Pin, MP_QSTR_Pin,
.print = pin_print, MP_TYPE_FLAG_NONE,
.make_new = pin_make_new, pin_make_new,
.call = pin_call, print, pin_print,
.locals_dict = (mp_obj_dict_t*)&pin_locals_dict, call, pin_call,
}; locals_dict, (mp_obj_dict_t*)&pin_locals_dict
);
/// \moduleref machine /// \moduleref machine
/// \class PinAF - Pin Alternate Functions /// \class PinAF - Pin Alternate Functions
@ -671,12 +672,14 @@ STATIC const mp_rom_map_elem_t pin_af_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(pin_af_locals_dict, pin_af_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(pin_af_locals_dict, pin_af_locals_dict_table);
const mp_obj_type_t pin_af_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, pin_af_type,
.name = MP_QSTR_PinAF, MP_QSTR_PinAF,
.print = pin_af_obj_print, MP_TYPE_FLAG_NONE,
.locals_dict = (mp_obj_dict_t*)&pin_af_locals_dict, MP_TYPE_NULL_MAKE_NEW,
}; print, pin_af_obj_print,
locals_dict, (mp_obj_dict_t*)&pin_af_locals_dict
);
MP_REGISTER_ROOT_POINTER(mp_obj_t pin_class_mapper); MP_REGISTER_ROOT_POINTER(mp_obj_t pin_class_mapper);
MP_REGISTER_ROOT_POINTER(mp_obj_t pin_class_map_dict); MP_REGISTER_ROOT_POINTER(mp_obj_t pin_class_map_dict);

View File

@ -339,12 +339,13 @@ STATIC mp_obj_t machine_hard_pwm_freq(mp_obj_t self_in, mp_arg_val_t *args) {
return mp_const_none; return mp_const_none;
} }
const mp_obj_type_t machine_hard_pwm_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_hard_pwm_type,
.name = MP_QSTR_PWM, MP_QSTR_PWM,
.print = machine_pwm_print, MP_TYPE_FLAG_NONE,
.make_new = machine_pwm_make_new, machine_pwm_make_new,
.locals_dict = (mp_obj_dict_t*)&machine_pwm_locals_dict, print, machine_pwm_print,
}; locals_dict, (mp_obj_dict_t*)&machine_pwm_locals_dict
);
#endif // MICROPY_PY_MACHINE_HW_PWM #endif // MICROPY_PY_MACHINE_HW_PWM

View File

@ -262,12 +262,13 @@ STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
const mp_obj_type_t machine_rtcounter_type = { MP_DEFINE_CONST_OBJ_TYPE(
{ &mp_type_type }, machine_rtcounter_type,
.name = MP_QSTR_RTCounter, MP_QSTR_RTCounter,
.print = rtc_print, MP_TYPE_FLAG_NONE,
.make_new = machine_rtc_make_new, machine_rtc_make_new,
.locals_dict = (mp_obj_dict_t*)&machine_rtc_locals_dict print, rtc_print,
}; locals_dict, (mp_obj_dict_t*)&machine_rtc_locals_dict
);
#endif // MICROPY_PY_MACHINE_RTCOUNTER #endif // MICROPY_PY_MACHINE_RTCOUNTER

Some files were not shown because too many files have changed in this diff Show More