all: Format code to add space after C++-style comment start.
Note: the uncrustify configuration is explicitly set to 'add' instead of 'force' in order not to alter the comments which use extra spaces after // as a means of indenting text for clarity.
This commit is contained in:
parent
d6243568a0
commit
84fa3312cf
|
@ -248,4 +248,4 @@ const mp_obj_module_t mp_module_ubinascii = {
|
||||||
.globals = (mp_obj_dict_t *)&mp_module_binascii_globals,
|
.globals = (mp_obj_dict_t *)&mp_module_binascii_globals,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MICROPY_PY_UBINASCII
|
#endif // MICROPY_PY_UBINASCII
|
||||||
|
|
|
@ -375,4 +375,4 @@ const mp_obj_module_t mp_module_ucryptolib = {
|
||||||
.globals = (mp_obj_dict_t *)&mp_module_ucryptolib_globals,
|
.globals = (mp_obj_dict_t *)&mp_module_ucryptolib_globals,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MICROPY_PY_UCRYPTOLIB
|
#endif // MICROPY_PY_UCRYPTOLIB
|
||||||
|
|
|
@ -431,7 +431,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
|
||||||
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
|
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
|
||||||
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
|
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
|
||||||
offset &= VALUE_MASK(VAL_TYPE_BITS);
|
offset &= VALUE_MASK(VAL_TYPE_BITS);
|
||||||
//printf("scalar type=%d offset=%x\n", val_type, offset);
|
// printf("scalar type=%d offset=%x\n", val_type, offset);
|
||||||
|
|
||||||
if (val_type <= INT64 || val_type == FLOAT32 || val_type == FLOAT64) {
|
if (val_type <= INT64 || val_type == FLOAT32 || val_type == FLOAT64) {
|
||||||
// printf("size=%d\n", GET_SCALAR_SIZE(val_type));
|
// printf("size=%d\n", GET_SCALAR_SIZE(val_type));
|
||||||
|
@ -501,7 +501,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
|
||||||
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(sub->items[0]);
|
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(sub->items[0]);
|
||||||
mp_uint_t agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
|
mp_uint_t agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
|
||||||
offset &= VALUE_MASK(AGG_TYPE_BITS);
|
offset &= VALUE_MASK(AGG_TYPE_BITS);
|
||||||
//printf("agg type=%d offset=%x\n", agg_type, offset);
|
// printf("agg type=%d offset=%x\n", agg_type, offset);
|
||||||
|
|
||||||
switch (agg_type) {
|
switch (agg_type) {
|
||||||
case STRUCT: {
|
case STRUCT: {
|
||||||
|
@ -525,7 +525,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
|
||||||
o->desc = MP_OBJ_FROM_PTR(sub);
|
o->desc = MP_OBJ_FROM_PTR(sub);
|
||||||
o->addr = self->addr + offset;
|
o->addr = self->addr + offset;
|
||||||
o->flags = self->flags;
|
o->flags = self->flags;
|
||||||
//printf("PTR/ARR base addr=%p\n", o->addr);
|
// printf("PTR/ARR base addr=%p\n", o->addr);
|
||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,4 +346,4 @@ const mp_obj_module_t mp_module_uhashlib = {
|
||||||
.globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals,
|
.globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MICROPY_PY_UHASHLIB
|
#endif // MICROPY_PY_UHASHLIB
|
||||||
|
|
|
@ -119,4 +119,4 @@ const mp_obj_module_t mp_module_uheapq = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //MICROPY_PY_UHEAPQ
|
#endif // MICROPY_PY_UHEAPQ
|
||||||
|
|
|
@ -323,4 +323,4 @@ const mp_obj_module_t mp_module_ujson = {
|
||||||
.globals = (mp_obj_dict_t *)&mp_module_ujson_globals,
|
.globals = (mp_obj_dict_t *)&mp_module_ujson_globals,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MICROPY_PY_UJSON
|
#endif // MICROPY_PY_UJSON
|
||||||
|
|
|
@ -224,4 +224,4 @@ const mp_obj_module_t mp_module_urandom = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //MICROPY_PY_URANDOM
|
#endif // MICROPY_PY_URANDOM
|
||||||
|
|
|
@ -474,4 +474,4 @@ const mp_obj_module_t mp_module_ure = {
|
||||||
#include "re1.5/recursiveloop.c"
|
#include "re1.5/recursiveloop.c"
|
||||||
#include "re1.5/charclass.c"
|
#include "re1.5/charclass.c"
|
||||||
|
|
||||||
#endif //MICROPY_PY_URE
|
#endif // MICROPY_PY_URE
|
||||||
|
|
|
@ -230,4 +230,4 @@ const mp_obj_module_t mp_module_utimeq = {
|
||||||
.globals = (mp_obj_dict_t *)&mp_module_utimeq_globals,
|
.globals = (mp_obj_dict_t *)&mp_module_utimeq_globals,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MICROPY_PY_UTIMEQ
|
#endif // MICROPY_PY_UTIMEQ
|
||||||
|
|
|
@ -200,7 +200,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//DEBUG_printf("Finished receiving ctrl message %x, ignoring\n", self->last_flags);
|
// DEBUG_printf("Finished receiving ctrl message %x, ignoring\n", self->last_flags);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
|
||||||
mp_obj_webrepl_t *self = MP_OBJ_TO_PTR(self_in);
|
mp_obj_webrepl_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
const mp_stream_p_t *sock_stream = mp_get_stream(self->sock);
|
const mp_stream_p_t *sock_stream = mp_get_stream(self->sock);
|
||||||
mp_uint_t out_sz = sock_stream->read(self->sock, buf, size, errcode);
|
mp_uint_t out_sz = sock_stream->read(self->sock, buf, size, errcode);
|
||||||
//DEBUG_printf("webrepl: Read %d initial bytes from websocket\n", out_sz);
|
// DEBUG_printf("webrepl: Read %d initial bytes from websocket\n", out_sz);
|
||||||
if (out_sz == 0 || out_sz == MP_STREAM_ERROR) {
|
if (out_sz == 0 || out_sz == MP_STREAM_ERROR) {
|
||||||
return out_sz;
|
return out_sz;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ STATIC int network_cyw43_scan_cb(void *env, const cyw43_ev_scan_result_t *res) {
|
||||||
MP_OBJ_NEW_SMALL_INT(res->channel),
|
MP_OBJ_NEW_SMALL_INT(res->channel),
|
||||||
MP_OBJ_NEW_SMALL_INT(res->rssi),
|
MP_OBJ_NEW_SMALL_INT(res->rssi),
|
||||||
MP_OBJ_NEW_SMALL_INT(res->auth_mode),
|
MP_OBJ_NEW_SMALL_INT(res->auth_mode),
|
||||||
//mp_const_false, // hidden
|
// mp_const_false, // hidden
|
||||||
MP_OBJ_NEW_SMALL_INT(1), // N
|
MP_OBJ_NEW_SMALL_INT(1), // N
|
||||||
};
|
};
|
||||||
mp_obj_list_append(list, mp_obj_new_tuple(6, tuple));
|
mp_obj_list_append(list, mp_obj_new_tuple(6, tuple));
|
||||||
|
|
|
@ -130,4 +130,4 @@ int snprintf(char *str, size_t size, const char *fmt, ...) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //MICROPY_USE_INTERNAL_PRINTF
|
#endif // MICROPY_USE_INTERNAL_PRINTF
|
||||||
|
|
|
@ -168,7 +168,7 @@ typedef struct _repl_t {
|
||||||
// but it was moved to MP_STATE_VM(repl_line) as containing
|
// but it was moved to MP_STATE_VM(repl_line) as containing
|
||||||
// root pointer. Still keep structure in case more state
|
// root pointer. Still keep structure in case more state
|
||||||
// will be added later.
|
// will be added later.
|
||||||
//vstr_t line;
|
// vstr_t line;
|
||||||
bool cont_line;
|
bool cont_line;
|
||||||
bool paste_mode;
|
bool paste_mode;
|
||||||
} repl_t;
|
} repl_t;
|
||||||
|
|
|
@ -146,4 +146,4 @@ void gc_collect(void) {
|
||||||
gc_collect_end();
|
gc_collect_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //MICROPY_ENABLE_GC
|
#endif // MICROPY_ENABLE_GC
|
||||||
|
|
|
@ -141,7 +141,7 @@ typedef long mp_off_t;
|
||||||
#else
|
#else
|
||||||
#define MP_SSIZE_MAX _I32_MAX
|
#define MP_SSIZE_MAX _I32_MAX
|
||||||
#endif
|
#endif
|
||||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)(p)) //Avoid compiler warning about different const qualifiers
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)(p)) // Avoid compiler warning about different const qualifiers
|
||||||
#define restrict
|
#define restrict
|
||||||
#define inline __inline
|
#define inline __inline
|
||||||
#define alignof(t) __alignof(t)
|
#define alignof(t) __alignof(t)
|
||||||
|
|
|
@ -283,7 +283,7 @@ STATIC void mptask_pre_init (void) {
|
||||||
// this one allocates memory for the socket semaphore
|
// this one allocates memory for the socket semaphore
|
||||||
modusocket_pre_init();
|
modusocket_pre_init();
|
||||||
|
|
||||||
//CRYPTOHASH_Init();
|
// CRYPTOHASH_Init();
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
OsiTaskHandle svTaskHandle;
|
OsiTaskHandle svTaskHandle;
|
||||||
|
|
|
@ -188,7 +188,7 @@ STATIC void machine_hw_spi_init_internal(
|
||||||
.pre_cb = NULL
|
.pre_cb = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize the SPI bus
|
// Initialize the SPI bus
|
||||||
|
|
||||||
// Select DMA channel based on the hardware SPI host
|
// Select DMA channel based on the hardware SPI host
|
||||||
int dma_chan = 0;
|
int dma_chan = 0;
|
||||||
|
|
|
@ -51,7 +51,7 @@ STATIC mp_obj_t esp32_wake_on_touch(const mp_obj_t wake) {
|
||||||
if (machine_rtc_config.ext0_pin != -1) {
|
if (machine_rtc_config.ext0_pin != -1) {
|
||||||
mp_raise_ValueError(MP_ERROR_TEXT("no resources"));
|
mp_raise_ValueError(MP_ERROR_TEXT("no resources"));
|
||||||
}
|
}
|
||||||
//mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("touchpad wakeup not available for this version of ESP-IDF"));
|
// mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("touchpad wakeup not available for this version of ESP-IDF"));
|
||||||
|
|
||||||
machine_rtc_config.wake_on_touch = mp_obj_is_true(wake);
|
machine_rtc_config.wake_on_touch = mp_obj_is_true(wake);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
//MACHINE_WAKE_IDLE=0x01,
|
// MACHINE_WAKE_IDLE=0x01,
|
||||||
MACHINE_WAKE_SLEEP=0x02,
|
MACHINE_WAKE_SLEEP=0x02,
|
||||||
MACHINE_WAKE_DEEPSLEEP=0x04
|
MACHINE_WAKE_DEEPSLEEP=0x04
|
||||||
} wake_type_t;
|
} wake_type_t;
|
||||||
|
|
|
@ -782,7 +782,7 @@ STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO0_IN), MP_ROM_INT(ETH_CLOCK_GPIO0_IN) },
|
{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO0_IN), MP_ROM_INT(ETH_CLOCK_GPIO0_IN) },
|
||||||
// Disabled at Aug 22nd 2018, reenabled Jan 28th 2019 in ESP-IDF
|
// Disabled at Aug 22nd 2018, reenabled Jan 28th 2019 in ESP-IDF
|
||||||
// Because we use older SDK, it's currently disabled
|
// Because we use older SDK, it's currently disabled
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO0_OUT), MP_ROM_INT(ETH_CLOCK_GPIO0_OUT) },
|
// { MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO0_OUT), MP_ROM_INT(ETH_CLOCK_GPIO0_OUT) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO16_OUT), MP_ROM_INT(ETH_CLOCK_GPIO16_OUT) },
|
{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO16_OUT), MP_ROM_INT(ETH_CLOCK_GPIO16_OUT) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO17_OUT), MP_ROM_INT(ETH_CLOCK_GPIO17_OUT) },
|
{ MP_ROM_QSTR(MP_QSTR_ETH_CLOCK_GPIO17_OUT), MP_ROM_INT(ETH_CLOCK_GPIO17_OUT) },
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -130,7 +130,7 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
||||||
if (args[ARG_clock_mode].u_int != -1 &&
|
if (args[ARG_clock_mode].u_int != -1 &&
|
||||||
args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO0_IN &&
|
args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO0_IN &&
|
||||||
// Disabled due ESP-IDF (see modnetwork.c note)
|
// Disabled due ESP-IDF (see modnetwork.c note)
|
||||||
//args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO0_OUT &&
|
// args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO0_OUT &&
|
||||||
args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO16_OUT &&
|
args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO16_OUT &&
|
||||||
args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO17_OUT) {
|
args[ARG_clock_mode].u_int != ETH_CLOCK_GPIO17_OUT) {
|
||||||
mp_raise_ValueError(MP_ERROR_TEXT("invalid clock mode"));
|
mp_raise_ValueError(MP_ERROR_TEXT("invalid clock mode"));
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "nimble/nimble_port_freertos.h"
|
#include "nimble/nimble_port_freertos.h"
|
||||||
|
|
||||||
STATIC void ble_host_task(void *param) {
|
STATIC void ble_host_task(void *param) {
|
||||||
nimble_port_run(); //This function will return only when nimble_port_stop() is executed.
|
nimble_port_run(); // This function will return only when nimble_port_stop() is executed.
|
||||||
nimble_port_freertos_deinit();
|
nimble_port_freertos_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ const mp_print_t mp_debug_print = {NULL, mp_hal_debug_tx_strn_cooked};
|
||||||
int uart_attached_to_dupterm;
|
int uart_attached_to_dupterm;
|
||||||
|
|
||||||
void mp_hal_init(void) {
|
void mp_hal_init(void) {
|
||||||
//ets_wdt_disable(); // it's a pain while developing
|
// ets_wdt_disable(); // it's a pain while developing
|
||||||
mp_hal_rtc_init();
|
mp_hal_rtc_init();
|
||||||
uart_init(UART_BIT_RATE_115200, UART_BIT_RATE_115200);
|
uart_init(UART_BIT_RATE_115200, UART_BIT_RATE_115200);
|
||||||
uart_attached_to_dupterm = 0;
|
uart_attached_to_dupterm = 0;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "py/mpprint.h"
|
#include "py/mpprint.h"
|
||||||
#define PWM_DBG(...)
|
#define PWM_DBG(...)
|
||||||
//#define PWM_DBG(...) mp_printf(&mp_plat_print, __VA_ARGS__)
|
// #define PWM_DBG(...) mp_printf(&mp_plat_print, __VA_ARGS__)
|
||||||
|
|
||||||
#define ICACHE_RAM_ATTR // __attribute__((section(".text")))
|
#define ICACHE_RAM_ATTR // __attribute__((section(".text")))
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ STATIC uint8_t pwm_current_channel = 0;
|
||||||
STATIC uint16_t pwm_gpio = 0;
|
STATIC uint16_t pwm_gpio = 0;
|
||||||
STATIC uint8_t pwm_channel_num = 0;
|
STATIC uint8_t pwm_channel_num = 0;
|
||||||
|
|
||||||
//XXX: 0xffffffff/(80000000/16)=35A
|
// XXX: 0xffffffff/(80000000/16)=35A
|
||||||
#define US_TO_RTC_TIMER_TICKS(t) \
|
#define US_TO_RTC_TIMER_TICKS(t) \
|
||||||
((t) ? \
|
((t) ? \
|
||||||
(((t) > 0x35A) ? \
|
(((t) > 0x35A) ? \
|
||||||
|
@ -66,7 +66,7 @@ STATIC uint8_t pwm_channel_num = 0;
|
||||||
(((t) * (APB_CLK_FREQ >> 4)) / 1000000)) : \
|
(((t) * (APB_CLK_FREQ >> 4)) / 1000000)) : \
|
||||||
0)
|
0)
|
||||||
|
|
||||||
//FRC1
|
// FRC1
|
||||||
#define FRC1_ENABLE_TIMER BIT7
|
#define FRC1_ENABLE_TIMER BIT7
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -333,7 +333,7 @@ void ICACHE_FLASH_ATTR
|
||||||
pwm_init(void) {
|
pwm_init(void) {
|
||||||
uint8 i;
|
uint8 i;
|
||||||
|
|
||||||
RTC_REG_WRITE(FRC1_CTRL_ADDRESS, //FRC2_AUTO_RELOAD|
|
RTC_REG_WRITE(FRC1_CTRL_ADDRESS, // FRC2_AUTO_RELOAD|
|
||||||
DIVDED_BY_16
|
DIVDED_BY_16
|
||||||
| FRC1_ENABLE_TIMER
|
| FRC1_ENABLE_TIMER
|
||||||
| TM_EDGE_INT);
|
| TM_EDGE_INT);
|
||||||
|
@ -379,7 +379,7 @@ pwm_add(uint8_t pin_id, uint32_t pin_mux, uint32_t pin_func) {
|
||||||
pwm.duty[i] = 0;
|
pwm.duty[i] = 0;
|
||||||
pwm_gpio |= (1 << pin_num[channel]);
|
pwm_gpio |= (1 << pin_num[channel]);
|
||||||
PIN_FUNC_SELECT(pin_mux, pin_func);
|
PIN_FUNC_SELECT(pin_mux, pin_func);
|
||||||
GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(pin_num[channel])), GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(pin_num[channel]))) & (~GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE))); //disable open drain;
|
GPIO_REG_WRITE(GPIO_PIN_ADDR(GPIO_ID_PIN(pin_num[channel])), GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(pin_num[channel]))) & (~GPIO_PIN_PAD_DRIVER_SET(GPIO_PAD_DRIVER_ENABLE))); // disable open drain;
|
||||||
pwm_channel_num++;
|
pwm_channel_num++;
|
||||||
UNLOCK_PWM(critical); // leave critical
|
UNLOCK_PWM(critical); // leave critical
|
||||||
return channel;
|
return channel;
|
||||||
|
@ -399,7 +399,7 @@ pwm_delete(uint8 channel) {
|
||||||
if (pwm_out_io_num[i] == channel) { // exist
|
if (pwm_out_io_num[i] == channel) { // exist
|
||||||
LOCK_PWM(critical); // enter critical
|
LOCK_PWM(critical); // enter critical
|
||||||
pwm_out_io_num[i] = -1;
|
pwm_out_io_num[i] = -1;
|
||||||
pwm_gpio &= ~(1 << pin_num[channel]); //clear the bit
|
pwm_gpio &= ~(1 << pin_num[channel]); // clear the bit
|
||||||
for (j = i; j < pwm_channel_num - 1; j++) {
|
for (j = i; j < pwm_channel_num - 1; j++) {
|
||||||
pwm_out_io_num[j] = pwm_out_io_num[j + 1];
|
pwm_out_io_num[j] = pwm_out_io_num[j + 1];
|
||||||
pwm.duty[j] = pwm.duty[j + 1];
|
pwm.duty[j] = pwm.duty[j + 1];
|
||||||
|
|
|
@ -101,8 +101,8 @@ bool ets_post(uint8 prio, os_signal_t sig, os_param_t param) {
|
||||||
// queue got full
|
// queue got full
|
||||||
emu_tasks[id].i_put = -1;
|
emu_tasks[id].i_put = -1;
|
||||||
}
|
}
|
||||||
//printf("after ets_post: "); dump_task(prio, &emu_tasks[id]);
|
// printf("after ets_post: "); dump_task(prio, &emu_tasks[id]);
|
||||||
//dump_tasks();
|
// dump_tasks();
|
||||||
|
|
||||||
ets_intr_unlock();
|
ets_intr_unlock();
|
||||||
|
|
||||||
|
@ -142,17 +142,17 @@ bool ets_loop_iter(void) {
|
||||||
extern uint32_t pend_flag_noise_check;
|
extern uint32_t pend_flag_noise_check;
|
||||||
uint32_t *sw_wdt = &pend_flag_noise_check - 6;
|
uint32_t *sw_wdt = &pend_flag_noise_check - 6;
|
||||||
|
|
||||||
//static unsigned cnt;
|
// static unsigned cnt;
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
for (volatile struct task_entry *t = emu_tasks; t < &emu_tasks[MP_ARRAY_SIZE(emu_tasks)]; t++) {
|
for (volatile struct task_entry *t = emu_tasks; t < &emu_tasks[MP_ARRAY_SIZE(emu_tasks)]; t++) {
|
||||||
if (!ets_loop_dont_feed_sw_wdt) {
|
if (!ets_loop_dont_feed_sw_wdt) {
|
||||||
system_soft_wdt_feed();
|
system_soft_wdt_feed();
|
||||||
}
|
}
|
||||||
ets_intr_lock();
|
ets_intr_lock();
|
||||||
//printf("etc_loop_iter: "); dump_task(t - emu_tasks + FIRST_PRIO, t);
|
// printf("etc_loop_iter: "); dump_task(t - emu_tasks + FIRST_PRIO, t);
|
||||||
if (t->i_get != t->i_put) {
|
if (t->i_get != t->i_put) {
|
||||||
progress = true;
|
progress = true;
|
||||||
//printf("#%d Calling task %d(%p) (%x, %x)\n", cnt++,
|
// printf("#%d Calling task %d(%p) (%x, %x)\n", cnt++,
|
||||||
// t - emu_tasks + FIRST_PRIO, t->task, t->queue[t->i_get].sig, t->queue[t->i_get].par);
|
// t - emu_tasks + FIRST_PRIO, t->task, t->queue[t->i_get].sig, t->queue[t->i_get].par);
|
||||||
int idx = t->i_get;
|
int idx = t->i_get;
|
||||||
if (t->i_put == -1) {
|
if (t->i_put == -1) {
|
||||||
|
@ -161,15 +161,15 @@ bool ets_loop_iter(void) {
|
||||||
if (++t->i_get == t->qlen) {
|
if (++t->i_get == t->qlen) {
|
||||||
t->i_get = 0;
|
t->i_get = 0;
|
||||||
}
|
}
|
||||||
//ets_intr_unlock();
|
// ets_intr_unlock();
|
||||||
uint32_t old_sw_wdt = *sw_wdt;
|
uint32_t old_sw_wdt = *sw_wdt;
|
||||||
t->task(&t->queue[idx]);
|
t->task(&t->queue[idx]);
|
||||||
if (ets_loop_dont_feed_sw_wdt) {
|
if (ets_loop_dont_feed_sw_wdt) {
|
||||||
// Restore previous SW WDT counter, in case task fed/cleared it
|
// Restore previous SW WDT counter, in case task fed/cleared it
|
||||||
*sw_wdt = old_sw_wdt;
|
*sw_wdt = old_sw_wdt;
|
||||||
}
|
}
|
||||||
//ets_intr_lock();
|
// ets_intr_lock();
|
||||||
//printf("Done calling task %d\n", t - emu_tasks + FIRST_PRIO);
|
// printf("Done calling task %d\n", t - emu_tasks + FIRST_PRIO);
|
||||||
}
|
}
|
||||||
ets_intr_unlock();
|
ets_intr_unlock();
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ bool ets_run(void) {
|
||||||
ets_intr_unlock();
|
ets_intr_unlock();
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!ets_loop_iter()) {
|
if (!ets_loop_iter()) {
|
||||||
//printf("idle\n");
|
// printf("idle\n");
|
||||||
ets_intr_lock();
|
ets_intr_lock();
|
||||||
if (idle_cb) {
|
if (idle_cb) {
|
||||||
idle_cb(idle_arg);
|
idle_cb(idle_arg);
|
||||||
|
@ -234,7 +234,7 @@ bool ets_run(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ets_set_idle_cb(void (*handler)(void *), void *arg) {
|
void ets_set_idle_cb(void (*handler)(void *), void *arg) {
|
||||||
//printf("ets_set_idle_cb(%p, %p)\n", handler, arg);
|
// printf("ets_set_idle_cb(%p, %p)\n", handler, arg);
|
||||||
idle_cb = handler;
|
idle_cb = handler;
|
||||||
idle_arg = arg;
|
idle_arg = arg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#define SPI_BYTE_ORDER_HIGH_TO_LOW 1
|
#define SPI_BYTE_ORDER_HIGH_TO_LOW 1
|
||||||
#define SPI_BYTE_ORDER_LOW_TO_HIGH 0
|
#define SPI_BYTE_ORDER_LOW_TO_HIGH 0
|
||||||
|
|
||||||
#ifndef CPU_CLK_FREQ //Should already be defined in eagle_soc.h
|
#ifndef CPU_CLK_FREQ // Should already be defined in eagle_soc.h
|
||||||
#define CPU_CLK_FREQ (80 * 1000000)
|
#define CPU_CLK_FREQ (80 * 1000000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
#define GPIO_PULL_NONE (0)
|
#define GPIO_PULL_NONE (0)
|
||||||
#define GPIO_PULL_UP (1)
|
#define GPIO_PULL_UP (1)
|
||||||
// Removed in SDK 1.1.0
|
// Removed in SDK 1.1.0
|
||||||
//#define GPIO_PULL_DOWN (2)
|
// #define GPIO_PULL_DOWN (2)
|
||||||
|
|
||||||
typedef struct _pin_irq_obj_t {
|
typedef struct _pin_irq_obj_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
|
@ -442,7 +442,7 @@ STATIC const mp_rom_map_elem_t pyb_pin_locals_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(GPIO_MODE_OUTPUT) },
|
{ MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(GPIO_MODE_OUTPUT) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_OPEN_DRAIN), MP_ROM_INT(GPIO_MODE_OPEN_DRAIN) },
|
{ MP_ROM_QSTR(MP_QSTR_OPEN_DRAIN), MP_ROM_INT(GPIO_MODE_OPEN_DRAIN) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PULL_UP), MP_ROM_INT(GPIO_PULL_UP) },
|
{ MP_ROM_QSTR(MP_QSTR_PULL_UP), MP_ROM_INT(GPIO_PULL_UP) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(GPIO_PULL_DOWN) },
|
// { MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(GPIO_PULL_DOWN) },
|
||||||
|
|
||||||
// IRQ triggers, can be or'd together
|
// IRQ triggers, can be or'd together
|
||||||
{ MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_PIN_INTR_POSEDGE) },
|
{ MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_PIN_INTR_POSEDGE) },
|
||||||
|
|
|
@ -121,7 +121,7 @@ STATIC mp_obj_t pyb_pwm_deinit(mp_obj_t self_in) {
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_pwm_deinit_obj, pyb_pwm_deinit);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_pwm_deinit_obj, pyb_pwm_deinit);
|
||||||
|
|
||||||
STATIC mp_obj_t pyb_pwm_freq(size_t n_args, const mp_obj_t *args) {
|
STATIC mp_obj_t pyb_pwm_freq(size_t n_args, const mp_obj_t *args) {
|
||||||
//pyb_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
|
// pyb_pwm_obj_t *self = MP_OBJ_TO_PTR(args[0]);
|
||||||
if (n_args == 1) {
|
if (n_args == 1) {
|
||||||
// get
|
// get
|
||||||
return MP_OBJ_NEW_SMALL_INT(pwm_get_freq(0));
|
return MP_OBJ_NEW_SMALL_INT(pwm_get_freq(0));
|
||||||
|
|
|
@ -158,7 +158,7 @@ void MP_FASTCODE(nlr_jump_fail)(void *val) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//void __assert(const char *file, int line, const char *func, const char *expr) {
|
// void __assert(const char *file, int line, const char *func, const char *expr) {
|
||||||
void __assert(const char *file, int line, const char *expr) {
|
void __assert(const char *file, int line, const char *expr) {
|
||||||
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
|
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
|
@ -284,7 +284,7 @@ void esp_native_code_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *esp_native_code_commit(void *buf, size_t len, void *reloc) {
|
void *esp_native_code_commit(void *buf, size_t len, void *reloc) {
|
||||||
//printf("COMMIT(buf=%p, len=%u, start=%08x, cur=%08x, end=%08x, erased=%08x)\n", buf, len, esp_native_code_start, esp_native_code_cur, esp_native_code_end, esp_native_code_erased);
|
// printf("COMMIT(buf=%p, len=%u, start=%08x, cur=%08x, end=%08x, erased=%08x)\n", buf, len, esp_native_code_start, esp_native_code_cur, esp_native_code_end, esp_native_code_erased);
|
||||||
|
|
||||||
len = (len + 3) & ~3;
|
len = (len + 3) & ~3;
|
||||||
if (esp_native_code_cur + len > esp_native_code_end) {
|
if (esp_native_code_cur + len > esp_native_code_end) {
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE
|
#if MICROPY_PY_MACHINE
|
||||||
|
|
||||||
//#define MACHINE_WAKE_IDLE (0x01)
|
// #define MACHINE_WAKE_IDLE (0x01)
|
||||||
//#define MACHINE_WAKE_SLEEP (0x02)
|
// #define MACHINE_WAKE_SLEEP (0x02)
|
||||||
#define MACHINE_WAKE_DEEPSLEEP (0x04)
|
#define MACHINE_WAKE_DEEPSLEEP (0x04)
|
||||||
|
|
||||||
extern const mp_obj_type_t esp_wdt_type;
|
extern const mp_obj_type_t esp_wdt_type;
|
||||||
|
|
|
@ -62,7 +62,7 @@ typedef struct {
|
||||||
uint8 *pRcvMsgBuff;
|
uint8 *pRcvMsgBuff;
|
||||||
uint8 *pWritePos;
|
uint8 *pWritePos;
|
||||||
uint8 *pReadPos;
|
uint8 *pReadPos;
|
||||||
uint8 TrigLvl; //JLU: may need to pad
|
uint8 TrigLvl; // JLU: may need to pad
|
||||||
RcvMsgBuffState BuffState;
|
RcvMsgBuffState BuffState;
|
||||||
} RcvMsgBuff;
|
} RcvMsgBuff;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ typedef struct {
|
||||||
TrxMsgBuff trx_buff;
|
TrxMsgBuff trx_buff;
|
||||||
RcvMsgState rcv_state;
|
RcvMsgState rcv_state;
|
||||||
int received;
|
int received;
|
||||||
int buff_uart_no; //indicate which uart use tx/rx buffer
|
int buff_uart_no; // indicate which uart use tx/rx buffer
|
||||||
} UartDevice;
|
} UartDevice;
|
||||||
|
|
||||||
extern uint8 uart_ringbuf_array[UART0_STATIC_RXBUF_LEN];
|
extern uint8 uart_ringbuf_array[UART0_STATIC_RXBUF_LEN];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//Generated at 2012-07-03 18:44:06
|
// Generated at 2012-07-03 18:44:06
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 - 2011 Espressif System
|
* Copyright (c) 2010 - 2011 Espressif System
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
#ifndef UART_REGISTER_H_INCLUDED
|
#ifndef UART_REGISTER_H_INCLUDED
|
||||||
#define UART_REGISTER_H_INCLUDED
|
#define UART_REGISTER_H_INCLUDED
|
||||||
#define REG_UART_BASE(i) (0x60000000 + (i) * 0xf00)
|
#define REG_UART_BASE(i) (0x60000000 + (i) * 0xf00)
|
||||||
//version value:32'h062000
|
// version value:32'h062000
|
||||||
|
|
||||||
#define UART_FIFO(i) (REG_UART_BASE(i) + 0x0)
|
#define UART_FIFO(i) (REG_UART_BASE(i) + 0x0)
|
||||||
#define UART_RXFIFO_RD_BYTE 0x000000FF
|
#define UART_RXFIFO_RD_BYTE 0x000000FF
|
||||||
|
|
|
@ -36,14 +36,14 @@
|
||||||
#define MICROPY_QSTR_BYTES_IN_HASH (2)
|
#define MICROPY_QSTR_BYTES_IN_HASH (2)
|
||||||
#define MICROPY_ALLOC_PATH_MAX (256)
|
#define MICROPY_ALLOC_PATH_MAX (256)
|
||||||
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
|
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
|
||||||
#define MICROPY_EMIT_X64 (0) //BROKEN
|
#define MICROPY_EMIT_X64 (0) // BROKEN
|
||||||
#define MICROPY_EMIT_THUMB (0) //BROKEN
|
#define MICROPY_EMIT_THUMB (0) // BROKEN
|
||||||
#define MICROPY_EMIT_INLINE_THUMB (0)
|
#define MICROPY_EMIT_INLINE_THUMB (0)
|
||||||
#define MICROPY_COMP_MODULE_CONST (0)
|
#define MICROPY_COMP_MODULE_CONST (0)
|
||||||
#define MICROPY_COMP_CONST (1)
|
#define MICROPY_COMP_CONST (1)
|
||||||
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
|
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
|
||||||
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (0)
|
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (0)
|
||||||
#define MICROPY_MEM_STATS (0) //BROKEN
|
#define MICROPY_MEM_STATS (0) // BROKEN
|
||||||
#define MICROPY_DEBUG_PRINTERS (0)
|
#define MICROPY_DEBUG_PRINTERS (0)
|
||||||
#define MICROPY_ENABLE_GC (1)
|
#define MICROPY_ENABLE_GC (1)
|
||||||
#define MICROPY_GC_ALLOC_THRESHOLD (1)
|
#define MICROPY_GC_ALLOC_THRESHOLD (1)
|
||||||
|
@ -131,7 +131,7 @@ extern const struct _mp_obj_module_t mp_module_utime;
|
||||||
#define MICROPY_PORT_BUILTIN_MODULES \
|
#define MICROPY_PORT_BUILTIN_MODULES \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
|
{ MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
|
||||||
|
|
||||||
//#define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
|
// #define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
|
||||||
#if MICROPY_PY_THREAD
|
#if MICROPY_PY_THREAD
|
||||||
#define MICROPY_EVENT_POLL_HOOK \
|
#define MICROPY_EVENT_POLL_HOOK \
|
||||||
do { \
|
do { \
|
||||||
|
@ -168,7 +168,7 @@ extern const struct _mp_obj_module_t mp_module_utime;
|
||||||
|
|
||||||
// type definitions for the specific machine
|
// type definitions for the specific machine
|
||||||
|
|
||||||
//#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
|
// #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
|
||||||
|
|
||||||
// This port is intended to be 32-bit, but unfortunately, int32_t for
|
// This port is intended to be 32-bit, but unfortunately, int32_t for
|
||||||
// different targets may be defined in different ways - either as int
|
// different targets may be defined in different ways - either as int
|
||||||
|
|
|
@ -66,7 +66,7 @@ void board_init(void) {
|
||||||
GPIO_PinInit(MICROPY_HW_LED_PORT, MICROPY_HW_LED_PIN, &led_config);
|
GPIO_PinInit(MICROPY_HW_LED_PORT, MICROPY_HW_LED_PIN, &led_config);
|
||||||
board_led_write(true);
|
board_led_write(true);
|
||||||
|
|
||||||
//------------- USB0 -------------//
|
// ------------- USB0 ------------- //
|
||||||
|
|
||||||
// Clock
|
// Clock
|
||||||
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U);
|
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U);
|
||||||
|
|
|
@ -51,8 +51,8 @@ int main(int argc, char **argv) {
|
||||||
#else
|
#else
|
||||||
pyexec_friendly_repl();
|
pyexec_friendly_repl();
|
||||||
#endif
|
#endif
|
||||||
//do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')", MP_PARSE_SINGLE_INPUT);
|
// do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')", MP_PARSE_SINGLE_INPUT);
|
||||||
//do_str("for i in range(10):\r\n print(i)", MP_PARSE_FILE_INPUT);
|
// do_str("for i in range(10):\r\n print(i)", MP_PARSE_FILE_INPUT);
|
||||||
#else
|
#else
|
||||||
pyexec_frozen_module("frozentest.py");
|
pyexec_frozen_module("frozentest.py");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
#if defined(NRF52840)
|
#if defined(NRF52840)
|
||||||
// for tinyusb
|
// for tinyusb
|
||||||
//#define NRFX_IRQ_IS_ENABLED 1
|
// #define NRFX_IRQ_IS_ENABLED 1
|
||||||
#define NRFX_POWER_ENABLED 1
|
#define NRFX_POWER_ENABLED 1
|
||||||
#define NRFX_POWER_CONFIG_IRQ_PRIORITY 2
|
#define NRFX_POWER_CONFIG_IRQ_PRIORITY 2
|
||||||
#define NRFX_SYSTICK_ENABLED 1
|
#define NRFX_SYSTICK_ENABLED 1
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
// The xc16 compiler doesn't seem to respect alignment (!!) so we
|
// The xc16 compiler doesn't seem to respect alignment (!!) so we
|
||||||
// need to use instead an object representation that allows for
|
// need to use instead an object representation that allows for
|
||||||
// 2-byte aligned pointers (see config setting above).
|
// 2-byte aligned pointers (see config setting above).
|
||||||
//#define MICROPY_OBJ_BASE_ALIGNMENT __attribute__((aligned(4)))
|
// #define MICROPY_OBJ_BASE_ALIGNMENT __attribute__((aligned(4)))
|
||||||
|
|
||||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
|
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p)))
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
// will still be able to execute pre-compiled scripts, compiled with mpy-cross.
|
// will still be able to execute pre-compiled scripts, compiled with mpy-cross.
|
||||||
#define MICROPY_ENABLE_COMPILER (1)
|
#define MICROPY_ENABLE_COMPILER (1)
|
||||||
|
|
||||||
//#define MICROPY_DEBUG_VERBOSE (1)
|
// #define MICROPY_DEBUG_VERBOSE (1)
|
||||||
|
|
||||||
#define MICROPY_QSTR_BYTES_IN_HASH (1)
|
#define MICROPY_QSTR_BYTES_IN_HASH (1)
|
||||||
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
|
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
|
||||||
|
|
|
@ -287,13 +287,13 @@ const dma_descr_t dma_SPI_5_TX = { DMA2_Stream4, DMA_CHANNEL_2, dma_id_12, &dma
|
||||||
const dma_descr_t dma_SPI_4_TX = { DMA2_Stream4, DMA_CHANNEL_5, dma_id_12, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_4_TX = { DMA2_Stream4, DMA_CHANNEL_5, dma_id_12, &dma_init_struct_spi_i2c };
|
||||||
const dma_descr_t dma_SPI_6_TX = { DMA2_Stream5, DMA_CHANNEL_1, dma_id_13, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_6_TX = { DMA2_Stream5, DMA_CHANNEL_1, dma_id_13, &dma_init_struct_spi_i2c };
|
||||||
const dma_descr_t dma_SPI_1_TX = { DMA2_Stream5, DMA_CHANNEL_3, dma_id_13, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_1_TX = { DMA2_Stream5, DMA_CHANNEL_3, dma_id_13, &dma_init_struct_spi_i2c };
|
||||||
//#if defined(STM32F7) && defined(SDMMC2) && ENABLE_SDIO
|
// #if defined(STM32F7) && defined(SDMMC2) && ENABLE_SDIO
|
||||||
//const dma_descr_t dma_SDMMC_2 = { DMA2_Stream5, DMA_CHANNEL_11, dma_id_13, &dma_init_struct_sdio };
|
// const dma_descr_t dma_SDMMC_2 = { DMA2_Stream5, DMA_CHANNEL_11, dma_id_13, &dma_init_struct_sdio };
|
||||||
//#endif
|
// #endif
|
||||||
const dma_descr_t dma_SPI_6_RX = { DMA2_Stream6, DMA_CHANNEL_1, dma_id_14, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_6_RX = { DMA2_Stream6, DMA_CHANNEL_1, dma_id_14, &dma_init_struct_spi_i2c };
|
||||||
//#if ENABLE_SDIO
|
// #if ENABLE_SDIO
|
||||||
//const dma_descr_t dma_SDIO_0 = { DMA2_Stream6, DMA_CHANNEL_4, dma_id_14, &dma_init_struct_sdio };
|
// const dma_descr_t dma_SDIO_0 = { DMA2_Stream6, DMA_CHANNEL_4, dma_id_14, &dma_init_struct_sdio };
|
||||||
//#endif
|
// #endif
|
||||||
/* not preferred streams
|
/* not preferred streams
|
||||||
const dma_descr_t dma_SPI_1_TX = { DMA2_Stream3, DMA_CHANNEL_3, dma_id_11, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_1_TX = { DMA2_Stream3, DMA_CHANNEL_3, dma_id_11, &dma_init_struct_spi_i2c };
|
||||||
const dma_descr_t dma_SPI_1_RX = { DMA2_Stream0, DMA_CHANNEL_3, dma_id_8, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_1_RX = { DMA2_Stream0, DMA_CHANNEL_3, dma_id_8, &dma_init_struct_spi_i2c };
|
||||||
|
@ -378,11 +378,11 @@ static const uint8_t dma_irqn[NSTREAM] = {
|
||||||
// number. The duplicate streams are ok as long as they aren't used at the same time.
|
// number. The duplicate streams are ok as long as they aren't used at the same time.
|
||||||
|
|
||||||
// DMA1 streams
|
// DMA1 streams
|
||||||
//const dma_descr_t dma_ADC_1_RX = { DMA1_Channel1, DMA_REQUEST_0, dma_id_0, NULL }; // unused
|
// const dma_descr_t dma_ADC_1_RX = { DMA1_Channel1, DMA_REQUEST_0, dma_id_0, NULL }; // unused
|
||||||
//const dma_descr_t dma_ADC_2_RX = { DMA1_Channel2, DMA_REQUEST_0, dma_id_1, NULL }; // unused
|
// const dma_descr_t dma_ADC_2_RX = { DMA1_Channel2, DMA_REQUEST_0, dma_id_1, NULL }; // unused
|
||||||
const dma_descr_t dma_SPI_1_RX = { DMA1_Channel2, DMA_REQUEST_1, dma_id_1, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_1_RX = { DMA1_Channel2, DMA_REQUEST_1, dma_id_1, &dma_init_struct_spi_i2c };
|
||||||
const dma_descr_t dma_I2C_3_TX = { DMA1_Channel2, DMA_REQUEST_3, dma_id_1, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_I2C_3_TX = { DMA1_Channel2, DMA_REQUEST_3, dma_id_1, &dma_init_struct_spi_i2c };
|
||||||
//const dma_descr_t dma_ADC_3_RX = { DMA1_Channel3, DMA_REQUEST_0, dma_id_2, NULL }; // unused
|
// const dma_descr_t dma_ADC_3_RX = { DMA1_Channel3, DMA_REQUEST_0, dma_id_2, NULL }; // unused
|
||||||
const dma_descr_t dma_SPI_1_TX = { DMA1_Channel3, DMA_REQUEST_1, dma_id_2, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_SPI_1_TX = { DMA1_Channel3, DMA_REQUEST_1, dma_id_2, &dma_init_struct_spi_i2c };
|
||||||
const dma_descr_t dma_I2C_3_RX = { DMA1_Channel3, DMA_REQUEST_3, dma_id_2, &dma_init_struct_spi_i2c };
|
const dma_descr_t dma_I2C_3_RX = { DMA1_Channel3, DMA_REQUEST_3, dma_id_2, &dma_init_struct_spi_i2c };
|
||||||
#if MICROPY_HW_ENABLE_DAC
|
#if MICROPY_HW_ENABLE_DAC
|
||||||
|
|
|
@ -90,7 +90,7 @@ void i2c_slave_ev_irq_handler(i2c_slave_t *i2c) {
|
||||||
i2c->ICR = I2C_ICR_STOPCF;
|
i2c->ICR = I2C_ICR_STOPCF;
|
||||||
i2c->OAR1 &= ~I2C_OAR1_OA1EN;
|
i2c->OAR1 &= ~I2C_OAR1_OA1EN;
|
||||||
if (i2c->ISR & I2C_ISR_DIR) {
|
if (i2c->ISR & I2C_ISR_DIR) {
|
||||||
//i2c_slave_process_tx_end();
|
// i2c_slave_process_tx_end();
|
||||||
} else {
|
} else {
|
||||||
i2c_slave_process_rx_end();
|
i2c_slave_process_rx_end();
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ void led_state(pyb_led_t led, int state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const pin_obj_t *led_pin = pyb_led_obj[led - 1].led_pin;
|
const pin_obj_t *led_pin = pyb_led_obj[led - 1].led_pin;
|
||||||
//printf("led_state(%d,%d)\n", led, state);
|
// printf("led_state(%d,%d)\n", led, state);
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
// turn LED off
|
// turn LED off
|
||||||
MICROPY_HW_LED_OFF(led_pin);
|
MICROPY_HW_LED_OFF(led_pin);
|
||||||
|
|
|
@ -110,7 +110,7 @@ mp_obj_t mod_network_find_nic(const uint8_t *ip) {
|
||||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) {
|
for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) {
|
||||||
mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i];
|
mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i];
|
||||||
// TODO check IP suitability here
|
// TODO check IP suitability here
|
||||||
//mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic);
|
// mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic);
|
||||||
return nic;
|
return nic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ STATIC int cc3k_socket_accept(mod_network_socket_obj_t *socket, mod_network_sock
|
||||||
|
|
||||||
// return ip and port
|
// return ip and port
|
||||||
// it seems CC3000 returns little endian for accept??
|
// it seems CC3000 returns little endian for accept??
|
||||||
//UNPACK_SOCKADDR(addr, ip, *port);
|
// UNPACK_SOCKADDR(addr, ip, *port);
|
||||||
*port = (addr.sa_data[1] << 8) | addr.sa_data[0];
|
*port = (addr.sa_data[1] << 8) | addr.sa_data[0];
|
||||||
ip[3] = addr.sa_data[2];
|
ip[3] = addr.sa_data[2];
|
||||||
ip[2] = addr.sa_data[3];
|
ip[2] = addr.sa_data[3];
|
||||||
|
|
|
@ -191,11 +191,11 @@ STATIC int wiznet5k_socket_accept(mod_network_socket_obj_t *socket, mod_network_
|
||||||
socket->u_param.fileno = -1;
|
socket->u_param.fileno = -1;
|
||||||
int _errno2;
|
int _errno2;
|
||||||
if (wiznet5k_socket_socket(socket, &_errno2) != 0) {
|
if (wiznet5k_socket_socket(socket, &_errno2) != 0) {
|
||||||
//printf("(bad resocket %d)\n", _errno2);
|
// printf("(bad resocket %d)\n", _errno2);
|
||||||
} else if (wiznet5k_socket_bind(socket, NULL, *port, &_errno2) != 0) {
|
} else if (wiznet5k_socket_bind(socket, NULL, *port, &_errno2) != 0) {
|
||||||
//printf("(bad rebind %d)\n", _errno2);
|
// printf("(bad rebind %d)\n", _errno2);
|
||||||
} else if (wiznet5k_socket_listen(socket, 0, &_errno2) != 0) {
|
} else if (wiznet5k_socket_listen(socket, 0, &_errno2) != 0) {
|
||||||
//printf("(bad relisten %d)\n", _errno2);
|
// printf("(bad relisten %d)\n", _errno2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -411,7 +411,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
|
||||||
/// \method regs()
|
/// \method regs()
|
||||||
/// Dump WIZNET5K registers.
|
/// Dump WIZNET5K registers.
|
||||||
STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
|
STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
|
||||||
//wiznet5k_obj_t *self = self_in;
|
// wiznet5k_obj_t *self = self_in;
|
||||||
printf("Wiz CREG:");
|
printf("Wiz CREG:");
|
||||||
for (int i = 0; i < 0x50; ++i) {
|
for (int i = 0; i < 0x50; ++i) {
|
||||||
if (i % 16 == 0) {
|
if (i % 16 == 0) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ void mp_bluetooth_nimble_hci_uart_rx(hal_uart_rx_cb_t rx_cb, void *rx_arg) {
|
||||||
|
|
||||||
int chr;
|
int chr;
|
||||||
while ((chr = mp_bluetooth_hci_uart_readchar()) >= 0) {
|
while ((chr = mp_bluetooth_hci_uart_readchar()) >= 0) {
|
||||||
//printf("UART RX: %02x\n", data);
|
// printf("UART RX: %02x\n", data);
|
||||||
rx_cb(rx_arg, chr);
|
rx_cb(rx_arg, chr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ typedef struct {
|
||||||
extern const pin_named_pin_t pin_board_pins[];
|
extern const pin_named_pin_t pin_board_pins[];
|
||||||
extern const pin_named_pin_t pin_cpu_pins[];
|
extern const pin_named_pin_t pin_cpu_pins[];
|
||||||
|
|
||||||
//extern pin_map_obj_t pin_map_obj;
|
// extern pin_map_obj_t pin_map_obj;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
|
|
|
@ -891,8 +891,8 @@ void pyb_can_handle_callback(pyb_can_obj_t *self, uint fifo_id, mp_obj_t callbac
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC const mp_stream_p_t can_stream_p = {
|
STATIC const mp_stream_p_t can_stream_p = {
|
||||||
//.read = can_read, // is read sensible for CAN?
|
// .read = can_read, // is read sensible for CAN?
|
||||||
//.write = can_write, // is write sensible for CAN?
|
// .write = can_write, // is write sensible for CAN?
|
||||||
.ioctl = can_ioctl,
|
.ioctl = can_ioctl,
|
||||||
.is_text = false,
|
.is_text = false,
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,7 +125,7 @@ void ipcc_init(uint32_t irq_pri) {
|
||||||
__HAL_RCC_IPCC_CLK_ENABLE();
|
__HAL_RCC_IPCC_CLK_ENABLE();
|
||||||
|
|
||||||
// Enable wanted IRQs
|
// Enable wanted IRQs
|
||||||
IPCC->C1CR = 0;//IPCC_C1CR_RXOIE;
|
IPCC->C1CR = 0; // IPCC_C1CR_RXOIE;
|
||||||
IPCC->C1MR = 0xffffffff;
|
IPCC->C1MR = 0xffffffff;
|
||||||
NVIC_SetPriority(IPCC_C1_RX_IRQn, irq_pri);
|
NVIC_SetPriority(IPCC_C1_RX_IRQn, irq_pri);
|
||||||
HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn);
|
HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn);
|
||||||
|
@ -219,15 +219,15 @@ STATIC void tl_parse_hci_msg(const uint8_t *buf, parse_hci_info_t *parse) {
|
||||||
// Response packet
|
// Response packet
|
||||||
// assert(buf[1] == 0x0e);
|
// assert(buf[1] == 0x0e);
|
||||||
kind = "VEND_RESP";
|
kind = "VEND_RESP";
|
||||||
//uint16_t cmd = buf[4] | buf[5] << 8;
|
// uint16_t cmd = buf[4] | buf[5] << 8;
|
||||||
//uint8_t status = buf[6];
|
// uint8_t status = buf[6];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x12: {
|
case 0x12: {
|
||||||
// Event packet
|
// Event packet
|
||||||
// assert(buf[1] == 0xff);
|
// assert(buf[1] == 0xff);
|
||||||
kind = "VEND_EVT";
|
kind = "VEND_EVT";
|
||||||
//uint16_t evt = buf[3] | buf[4] << 8;
|
// uint16_t evt = buf[3] | buf[4] << 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -227,9 +227,9 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct
|
||||||
uint32_t tickstart = HAL_GetTick();
|
uint32_t tickstart = HAL_GetTick();
|
||||||
|
|
||||||
#if defined(STM32F7) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB)
|
#if defined(STM32F7) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB)
|
||||||
//__HAL_RCC_PWR_CLK_ENABLE();
|
// __HAL_RCC_PWR_CLK_ENABLE();
|
||||||
// Enable write access to Backup domain
|
// Enable write access to Backup domain
|
||||||
//PWR->CR1 |= PWR_CR1_DBP;
|
// PWR->CR1 |= PWR_CR1_DBP;
|
||||||
// Wait for Backup domain Write protection disable
|
// Wait for Backup domain Write protection disable
|
||||||
while ((PWR->CR1 & PWR_CR1_DBP) == RESET) {
|
while ((PWR->CR1 & PWR_CR1_DBP) == RESET) {
|
||||||
if (HAL_GetTick() - tickstart > RCC_DBP_TIMEOUT_VALUE) {
|
if (HAL_GetTick() - tickstart > RCC_DBP_TIMEOUT_VALUE) {
|
||||||
|
@ -238,7 +238,7 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Enable write access to Backup domain
|
// Enable write access to Backup domain
|
||||||
//PWR->CR |= PWR_CR_DBP;
|
// PWR->CR |= PWR_CR_DBP;
|
||||||
// Wait for Backup domain Write protection disable
|
// Wait for Backup domain Write protection disable
|
||||||
while ((PWR->CR & PWR_CR_DBP) == RESET) {
|
while ((PWR->CR & PWR_CR_DBP) == RESET) {
|
||||||
if (HAL_GetTick() - tickstart > RCC_DBP_TIMEOUT_VALUE) {
|
if (HAL_GetTick() - tickstart > RCC_DBP_TIMEOUT_VALUE) {
|
||||||
|
@ -405,7 +405,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_MspInit_Finalise(RTC_HandleTypeDef *hrtc) {
|
||||||
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
|
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
|
||||||
}
|
}
|
||||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||||
//Error_Handler();
|
// Error_Handler();
|
||||||
return HAL_ERROR;
|
return HAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) {
|
||||||
NVIC_SetPriority(RTC_WKUP_IRQn, IRQ_PRI_RTC_WKUP);
|
NVIC_SetPriority(RTC_WKUP_IRQn, IRQ_PRI_RTC_WKUP);
|
||||||
HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
|
HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
|
||||||
|
|
||||||
//printf("wut=%d wucksel=%d\n", wut, wucksel);
|
// printf("wut=%d wucksel=%d\n", wut, wucksel);
|
||||||
} else {
|
} else {
|
||||||
// clear WUTIE to disable interrupts
|
// clear WUTIE to disable interrupts
|
||||||
RTC->CR &= ~RTC_CR_WUTIE;
|
RTC->CR &= ~RTC_CR_WUTIE;
|
||||||
|
|
|
@ -140,7 +140,7 @@ static void build_partition(uint8_t *buf, int boot, int type, uint32_t start_blo
|
||||||
}
|
}
|
||||||
|
|
||||||
bool storage_read_block(uint8_t *dest, uint32_t block) {
|
bool storage_read_block(uint8_t *dest, uint32_t block) {
|
||||||
//printf("RD %u\n", block);
|
// printf("RD %u\n", block);
|
||||||
if (block == 0) {
|
if (block == 0) {
|
||||||
// fake the MBR so we can decide on our own partition table
|
// fake the MBR so we can decide on our own partition table
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ bool storage_read_block(uint8_t *dest, uint32_t block) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool storage_write_block(const uint8_t *src, uint32_t block) {
|
bool storage_write_block(const uint8_t *src, uint32_t block) {
|
||||||
//printf("WR %u\n", block);
|
// printf("WR %u\n", block);
|
||||||
if (block == 0) {
|
if (block == 0) {
|
||||||
// can't write MBR, but pretend we did
|
// can't write MBR, but pretend we did
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -280,14 +280,14 @@ void SystemClock_Config(void) {
|
||||||
b1 <<= 10;
|
b1 <<= 10;
|
||||||
b2 <<= 10;
|
b2 <<= 10;
|
||||||
}
|
}
|
||||||
RCC_OscInitStruct.PLL.PLLM = m; //MICROPY_HW_CLK_PLLM;
|
RCC_OscInitStruct.PLL.PLLM = m; // MICROPY_HW_CLK_PLLM;
|
||||||
RCC_OscInitStruct.PLL.PLLN = n; //MICROPY_HW_CLK_PLLN;
|
RCC_OscInitStruct.PLL.PLLN = n; // MICROPY_HW_CLK_PLLN;
|
||||||
RCC_OscInitStruct.PLL.PLLP = p; //MICROPY_HW_CLK_PLLP;
|
RCC_OscInitStruct.PLL.PLLP = p; // MICROPY_HW_CLK_PLLP;
|
||||||
RCC_OscInitStruct.PLL.PLLQ = q; //MICROPY_HW_CLK_PLLQ;
|
RCC_OscInitStruct.PLL.PLLQ = q; // MICROPY_HW_CLK_PLLQ;
|
||||||
|
|
||||||
RCC_ClkInitStruct.AHBCLKDivider = h; //RCC_SYSCLK_DIV1;
|
RCC_ClkInitStruct.AHBCLKDivider = h; // RCC_SYSCLK_DIV1;
|
||||||
RCC_ClkInitStruct.APB1CLKDivider = b1; //RCC_HCLK_DIV4;
|
RCC_ClkInitStruct.APB1CLKDivider = b1; // RCC_HCLK_DIV4;
|
||||||
RCC_ClkInitStruct.APB2CLKDivider = b2; //RCC_HCLK_DIV2;
|
RCC_ClkInitStruct.APB2CLKDivider = b2; // RCC_HCLK_DIV2;
|
||||||
#else // defined(MICROPY_HW_CLK_LAST_FREQ) && MICROPY_HW_CLK_LAST_FREQ
|
#else // defined(MICROPY_HW_CLK_LAST_FREQ) && MICROPY_HW_CLK_LAST_FREQ
|
||||||
RCC_OscInitStruct.PLL.PLLM = MICROPY_HW_CLK_PLLM;
|
RCC_OscInitStruct.PLL.PLLM = MICROPY_HW_CLK_PLLM;
|
||||||
RCC_OscInitStruct.PLL.PLLN = MICROPY_HW_CLK_PLLN;
|
RCC_OscInitStruct.PLL.PLLN = MICROPY_HW_CLK_PLLN;
|
||||||
|
@ -393,7 +393,7 @@ void SystemClock_Config(void) {
|
||||||
|
|
||||||
#if MICROPY_HW_CLK_USE_HSE
|
#if MICROPY_HW_CLK_USE_HSE
|
||||||
PeriphClkInitStruct.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_HSE;
|
PeriphClkInitStruct.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_HSE;
|
||||||
PeriphClkInitStruct.PLLSAI1.PLLSAI1M = 1; //MICROPY_HW_CLK_PLLSAIM;
|
PeriphClkInitStruct.PLLSAI1.PLLSAI1M = 1; // MICROPY_HW_CLK_PLLSAIM;
|
||||||
PeriphClkInitStruct.PLLSAI1.PLLSAI1N = MICROPY_HW_CLK_PLLSAIN;
|
PeriphClkInitStruct.PLLSAI1.PLLSAI1N = MICROPY_HW_CLK_PLLSAIN;
|
||||||
PeriphClkInitStruct.PLLSAI1.PLLSAI1P = MICROPY_HW_CLK_PLLSAIP;
|
PeriphClkInitStruct.PLLSAI1.PLLSAI1P = MICROPY_HW_CLK_PLLSAIP;
|
||||||
PeriphClkInitStruct.PLLSAI1.PLLSAI1Q = MICROPY_HW_CLK_PLLSAIQ;
|
PeriphClkInitStruct.PLLSAI1.PLLSAI1Q = MICROPY_HW_CLK_PLLSAIQ;
|
||||||
|
|
|
@ -183,8 +183,8 @@ void HAL_FTM_IC_ConfigChannel(FTM_HandleTypeDef *hftm, FTM_IC_InitTypeDef *sConf
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_FTM_IC_Start(FTM_HandleTypeDef *hftm, uint32_t channel) {
|
void HAL_FTM_IC_Start(FTM_HandleTypeDef *hftm, uint32_t channel) {
|
||||||
//FTM_TypeDef *FTMx = hftm->Instance;
|
// FTM_TypeDef *FTMx = hftm->Instance;
|
||||||
//assert_param(IS_FTM_INSTANCE(FTMx));
|
// assert_param(IS_FTM_INSTANCE(FTMx));
|
||||||
|
|
||||||
// Nothing else to do
|
// Nothing else to do
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ void led_state(pyb_led_t led, int state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const pin_obj_t *led_pin = pyb_led_obj[led - 1].led_pin;
|
const pin_obj_t *led_pin = pyb_led_obj[led - 1].led_pin;
|
||||||
//printf("led_state(%d,%d)\n", led, state);
|
// printf("led_state(%d,%d)\n", led, state);
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
// turn LED off
|
// turn LED off
|
||||||
MICROPY_HW_LED_OFF(led_pin);
|
MICROPY_HW_LED_OFF(led_pin);
|
||||||
|
|
|
@ -150,7 +150,7 @@ mp_obj_t pyb_gc(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t pyb_gpio(int n_args, mp_obj_t *args) {
|
mp_obj_t pyb_gpio(int n_args, mp_obj_t *args) {
|
||||||
//assert(1 <= n_args && n_args <= 2);
|
// assert(1 <= n_args && n_args <= 2);
|
||||||
|
|
||||||
uint pin = mp_obj_get_int(args[0]);
|
uint pin = mp_obj_get_int(args[0]);
|
||||||
if (pin > CORE_NUM_DIGITAL) {
|
if (pin > CORE_NUM_DIGITAL) {
|
||||||
|
|
|
@ -307,13 +307,13 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&pyb_timer_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&pyb_timer_type) },
|
||||||
|
|
||||||
//#if MICROPY_HW_ENABLE_RNG
|
// #if MICROPY_HW_ENABLE_RNG
|
||||||
// { MP_ROM_QSTR(MP_QSTR_rng), MP_ROM_PTR(&pyb_rng_get_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_rng), MP_ROM_PTR(&pyb_rng_get_obj) },
|
||||||
//#endif
|
// #endif
|
||||||
|
|
||||||
//#if MICROPY_HW_ENABLE_RTC
|
// #if MICROPY_HW_ENABLE_RTC
|
||||||
// { MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&pyb_rtc_type) },
|
// { MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&pyb_rtc_type) },
|
||||||
//#endif
|
// #endif
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pin_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pin_type) },
|
||||||
// { MP_ROM_QSTR(MP_QSTR_ExtInt), MP_ROM_PTR(&extint_type) },
|
// { MP_ROM_QSTR(MP_QSTR_ExtInt), MP_ROM_PTR(&extint_type) },
|
||||||
|
@ -328,9 +328,9 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Switch), MP_ROM_PTR(&pyb_switch_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Switch), MP_ROM_PTR(&pyb_switch_type) },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#if MICROPY_HW_HAS_SDCARD
|
// #if MICROPY_HW_HAS_SDCARD
|
||||||
// { MP_ROM_QSTR(MP_QSTR_SD), MP_ROM_PTR(&pyb_sdcard_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_SD), MP_ROM_PTR(&pyb_sdcard_obj) },
|
||||||
//#endif
|
// #endif
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pyb_led_type) },
|
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pyb_led_type) },
|
||||||
// { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&pyb_i2c_type) },
|
// { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&pyb_i2c_type) },
|
||||||
|
@ -340,13 +340,13 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
|
||||||
// { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) },
|
// { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) },
|
||||||
// { MP_ROM_QSTR(MP_QSTR_ADCAll), MP_ROM_PTR(&pyb_adc_all_type) },
|
// { MP_ROM_QSTR(MP_QSTR_ADCAll), MP_ROM_PTR(&pyb_adc_all_type) },
|
||||||
|
|
||||||
//#if MICROPY_HW_ENABLE_DAC
|
// #if MICROPY_HW_ENABLE_DAC
|
||||||
// { MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&pyb_dac_type) },
|
// { MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&pyb_dac_type) },
|
||||||
//#endif
|
// #endif
|
||||||
|
|
||||||
//#if MICROPY_HW_HAS_MMA7660
|
// #if MICROPY_HW_HAS_MMA7660
|
||||||
// { MP_ROM_QSTR(MP_QSTR_Accel), MP_ROM_PTR(&pyb_accel_type) },
|
// { MP_ROM_QSTR(MP_QSTR_Accel), MP_ROM_PTR(&pyb_accel_type) },
|
||||||
//#endif
|
// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
STATIC MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
|
STATIC MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
|
||||||
|
|
|
@ -72,7 +72,7 @@ pin_error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static mp_obj_t servo_obj_detach(mp_obj_t self_in) {
|
static mp_obj_t servo_obj_detach(mp_obj_t self_in) {
|
||||||
//pyb_servo_obj_t *self = self_in;
|
// pyb_servo_obj_t *self = self_in;
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_uart_init_obj, 1, pyb_uart_init);
|
||||||
/// \method deinit()
|
/// \method deinit()
|
||||||
/// Turn off the UART bus.
|
/// Turn off the UART bus.
|
||||||
STATIC mp_obj_t pyb_uart_deinit(mp_obj_t self_in) {
|
STATIC mp_obj_t pyb_uart_deinit(mp_obj_t self_in) {
|
||||||
//pyb_uart_obj_t *self = self_in;
|
// pyb_uart_obj_t *self = self_in;
|
||||||
// TODO
|
// TODO
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ MP_NOINLINE void gc_collect_regs_and_stack(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void gc_collect(void) {
|
void gc_collect(void) {
|
||||||
//gc_dump_info();
|
// gc_dump_info();
|
||||||
|
|
||||||
gc_collect_start();
|
gc_collect_start();
|
||||||
gc_collect_regs_and_stack();
|
gc_collect_regs_and_stack();
|
||||||
|
@ -177,8 +177,8 @@ void gc_collect(void) {
|
||||||
#endif
|
#endif
|
||||||
gc_collect_end();
|
gc_collect_end();
|
||||||
|
|
||||||
//printf("-----\n");
|
// printf("-----\n");
|
||||||
//gc_dump_info();
|
// gc_dump_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //MICROPY_ENABLE_GC
|
#endif // MICROPY_ENABLE_GC
|
||||||
|
|
|
@ -699,7 +699,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
||||||
free(heap);
|
free(heap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//printf("total bytes = %d\n", m_get_total_bytes_allocated());
|
// printf("total bytes = %d\n", m_get_total_bytes_allocated());
|
||||||
return ret & 0xff;
|
return ret & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ typedef struct _mp_obj_fficallback_t {
|
||||||
ffi_type *params[];
|
ffi_type *params[];
|
||||||
} mp_obj_fficallback_t;
|
} mp_obj_fficallback_t;
|
||||||
|
|
||||||
//STATIC const mp_obj_type_t opaque_type;
|
// STATIC const mp_obj_type_t opaque_type;
|
||||||
STATIC const mp_obj_type_t ffimod_type;
|
STATIC const mp_obj_type_t ffimod_type;
|
||||||
STATIC const mp_obj_type_t ffifunc_type;
|
STATIC const mp_obj_type_t ffifunc_type;
|
||||||
STATIC const mp_obj_type_t fficallback_type;
|
STATIC const mp_obj_type_t fficallback_type;
|
||||||
|
|
|
@ -98,7 +98,7 @@ STATIC bool is_object_type(const char *jtypesig) {
|
||||||
STATIC void check_exception(void) {
|
STATIC void check_exception(void) {
|
||||||
jobject exc = JJ1(ExceptionOccurred);
|
jobject exc = JJ1(ExceptionOccurred);
|
||||||
if (exc) {
|
if (exc) {
|
||||||
//JJ1(ExceptionDescribe);
|
// JJ1(ExceptionDescribe);
|
||||||
mp_obj_t py_e = new_jobject(exc);
|
mp_obj_t py_e = new_jobject(exc);
|
||||||
JJ1(ExceptionClear);
|
JJ1(ExceptionClear);
|
||||||
if (JJ(IsInstanceOf, exc, IndexException_class)) {
|
if (JJ(IsInstanceOf, exc, IndexException_class)) {
|
||||||
|
@ -142,7 +142,7 @@ STATIC void jclass_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
|
||||||
dest[0] = new_jobject(obj);
|
dest[0] = new_jobject(obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//JJ1(ExceptionDescribe);
|
// JJ1(ExceptionDescribe);
|
||||||
JJ1(ExceptionClear);
|
JJ1(ExceptionClear);
|
||||||
|
|
||||||
mp_obj_jmethod_t *o = m_new_obj(mp_obj_jmethod_t);
|
mp_obj_jmethod_t *o = m_new_obj(mp_obj_jmethod_t);
|
||||||
|
@ -220,7 +220,7 @@ STATIC void jobject_attr(mp_obj_t self_in, qstr attr_in, mp_obj_t *dest) {
|
||||||
dest[0] = new_jobject(obj);
|
dest[0] = new_jobject(obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//JJ1(ExceptionDescribe);
|
// JJ1(ExceptionDescribe);
|
||||||
JJ1(ExceptionClear);
|
JJ1(ExceptionClear);
|
||||||
|
|
||||||
mp_obj_jmethod_t *o = m_new_obj(mp_obj_jmethod_t);
|
mp_obj_jmethod_t *o = m_new_obj(mp_obj_jmethod_t);
|
||||||
|
@ -246,7 +246,7 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
|
||||||
mp_uint_t idx = mp_obj_get_int(index);
|
mp_uint_t idx = mp_obj_get_int(index);
|
||||||
char class_name[64];
|
char class_name[64];
|
||||||
get_jclass_name(self->obj, class_name);
|
get_jclass_name(self->obj, class_name);
|
||||||
//printf("class: %s\n", class_name);
|
// printf("class: %s\n", class_name);
|
||||||
|
|
||||||
if (class_name[0] == '[') {
|
if (class_name[0] == '[') {
|
||||||
if (class_name[1] == 'L' || class_name[1] == '[') {
|
if (class_name[1] == 'L' || class_name[1] == '[') {
|
||||||
|
@ -412,7 +412,7 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
|
||||||
if (!MATCH(expected_type, "java.lang.Object")) {
|
if (!MATCH(expected_type, "java.lang.Object")) {
|
||||||
char class_name[64];
|
char class_name[64];
|
||||||
get_jclass_name(jo->obj, class_name);
|
get_jclass_name(jo->obj, class_name);
|
||||||
//printf("Arg class: %s\n", class_name);
|
// printf("Arg class: %s\n", class_name);
|
||||||
if (strcmp(class_name, expected_type) != 0) {
|
if (strcmp(class_name, expected_type) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (arg == mp_const_none) {
|
} else if (arg == mp_const_none) {
|
||||||
//printf("TODO: Check java arg type!!\n");
|
// printf("TODO: Check java arg type!!\n");
|
||||||
while (isalpha(*arg_type) || *arg_type == '.') {
|
while (isalpha(*arg_type) || *arg_type == '.') {
|
||||||
arg_type++;
|
arg_type++;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool
|
||||||
jobject name_o = JJ(CallObjectMethod, meth, Object_toString_mid);
|
jobject name_o = JJ(CallObjectMethod, meth, Object_toString_mid);
|
||||||
const char *decl = JJ(GetStringUTFChars, name_o, NULL);
|
const char *decl = JJ(GetStringUTFChars, name_o, NULL);
|
||||||
const char *arg_types = strchr(decl, '(') + 1;
|
const char *arg_types = strchr(decl, '(') + 1;
|
||||||
//const char *arg_types_end = strchr(arg_types, ')');
|
// const char *arg_types_end = strchr(arg_types, ')');
|
||||||
// printf("method[%d]=%p %s\n", i, meth, decl);
|
// printf("method[%d]=%p %s\n", i, meth, decl);
|
||||||
|
|
||||||
const char *meth_name = NULL;
|
const char *meth_name = NULL;
|
||||||
|
|
|
@ -110,7 +110,7 @@ STATIC mp_obj_t mod_time_sleep(mp_obj_t arg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mp_handle_pending(true);
|
mp_handle_pending(true);
|
||||||
//printf("select: EINTR: %ld:%ld\n", tv.tv_sec, tv.tv_usec);
|
// printf("select: EINTR: %ld:%ld\n", tv.tv_sec, tv.tv_usec);
|
||||||
#else
|
#else
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -211,7 +211,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
|
||||||
STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
|
STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
|
||||||
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
|
mp_obj_socket_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
// sockaddr_storage isn't stack-friendly (129 bytes or so)
|
// sockaddr_storage isn't stack-friendly (129 bytes or so)
|
||||||
//struct sockaddr_storage addr;
|
// struct sockaddr_storage addr;
|
||||||
byte addr[32];
|
byte addr[32];
|
||||||
socklen_t addr_len = sizeof(addr);
|
socklen_t addr_len = sizeof(addr);
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -547,7 +547,7 @@ STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
|
||||||
#ifdef __UCLIBC_MAJOR__
|
#ifdef __UCLIBC_MAJOR__
|
||||||
#if __UCLIBC_MAJOR__ == 0 && (__UCLIBC_MINOR__ < 9 || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 32))
|
#if __UCLIBC_MAJOR__ == 0 && (__UCLIBC_MINOR__ < 9 || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 32))
|
||||||
// "warning" requires -Wno-cpp which is a relatively new gcc option, so we choose not to use it.
|
// "warning" requires -Wno-cpp which is a relatively new gcc option, so we choose not to use it.
|
||||||
//#warning Working around uClibc bug with numeric service name
|
// #warning Working around uClibc bug with numeric service name
|
||||||
// Older versions og uClibc have bugs when numeric ports in service
|
// Older versions og uClibc have bugs when numeric ports in service
|
||||||
// arg require also hints.ai_socktype (or hints.ai_protocol) != 0
|
// arg require also hints.ai_socktype (or hints.ai_protocol) != 0
|
||||||
// This actually was fixed in 0.9.32.1, but uClibc doesn't allow to
|
// This actually was fixed in 0.9.32.1, but uClibc doesn't allow to
|
||||||
|
|
|
@ -93,7 +93,7 @@ STATIC void mp_thread_gc(int signo, siginfo_t *info, void *context) {
|
||||||
// We have access to the context (regs, stack) of the thread but it seems
|
// We have access to the context (regs, stack) of the thread but it seems
|
||||||
// that we don't need the extra information, enough is captured by the
|
// that we don't need the extra information, enough is captured by the
|
||||||
// gc_collect_regs_and_stack function above
|
// gc_collect_regs_and_stack function above
|
||||||
//gc_collect_root((void**)context, sizeof(ucontext_t) / sizeof(uintptr_t));
|
// gc_collect_root((void**)context, sizeof(ucontext_t) / sizeof(uintptr_t));
|
||||||
#if MICROPY_ENABLE_PYSTACK
|
#if MICROPY_ENABLE_PYSTACK
|
||||||
void **ptrs = (void **)(void *)MP_STATE_THREAD(pystack_start);
|
void **ptrs = (void **)(void *)MP_STATE_THREAD(pystack_start);
|
||||||
gc_collect_root(ptrs, (MP_STATE_THREAD(pystack_cur) - MP_STATE_THREAD(pystack_start)) / sizeof(void *));
|
gc_collect_root(ptrs, (MP_STATE_THREAD(pystack_cur) - MP_STATE_THREAD(pystack_start)) / sizeof(void *));
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define MICROPY_USE_READLINE (1)
|
#define MICROPY_USE_READLINE (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MICROPY_ALLOC_PATH_MAX (260) //see minwindef.h for msvc or limits.h for mingw
|
#define MICROPY_ALLOC_PATH_MAX (260) // see minwindef.h for msvc or limits.h for mingw
|
||||||
#define MICROPY_PERSISTENT_CODE_LOAD (1)
|
#define MICROPY_PERSISTENT_CODE_LOAD (1)
|
||||||
#define MICROPY_EMIT_X64 (0)
|
#define MICROPY_EMIT_X64 (0)
|
||||||
#define MICROPY_EMIT_THUMB (0)
|
#define MICROPY_EMIT_THUMB (0)
|
||||||
|
@ -220,7 +220,7 @@ extern const struct _mp_obj_module_t mp_module_time;
|
||||||
#define MP_NOINLINE __declspec(noinline)
|
#define MP_NOINLINE __declspec(noinline)
|
||||||
#define MP_LIKELY(x) (x)
|
#define MP_LIKELY(x) (x)
|
||||||
#define MP_UNLIKELY(x) (x)
|
#define MP_UNLIKELY(x) (x)
|
||||||
#define MICROPY_PORT_CONSTANTS { "dummy", 0 } //can't have zero-sized array
|
#define MICROPY_PORT_CONSTANTS { "dummy", 0 } // can't have zero-sized array
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#define MP_SSIZE_MAX _I64_MAX
|
#define MP_SSIZE_MAX _I64_MAX
|
||||||
#else
|
#else
|
||||||
|
@ -259,7 +259,7 @@ typedef mp_off_t off_t;
|
||||||
|
|
||||||
// System headers (needed e.g. for nlr.h)
|
// System headers (needed e.g. for nlr.h)
|
||||||
|
|
||||||
#include <stddef.h> //for NULL
|
#include <stddef.h> // for NULL
|
||||||
#include <assert.h> //for assert
|
#include <assert.h> // for assert
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -150,7 +150,7 @@ STATIC item_t keyCodeMap[] = {
|
||||||
{VK_HOME, "[H"},
|
{VK_HOME, "[H"},
|
||||||
{VK_END, "[F"},
|
{VK_END, "[F"},
|
||||||
{VK_DELETE, "[3~"},
|
{VK_DELETE, "[3~"},
|
||||||
{0, ""} //sentinel
|
{0, ""} // sentinel
|
||||||
};
|
};
|
||||||
|
|
||||||
// likewise, but with Ctrl key down
|
// likewise, but with Ctrl key down
|
||||||
|
@ -159,7 +159,7 @@ STATIC item_t ctrlKeyCodeMap[] = {
|
||||||
{VK_RIGHT, "f"},
|
{VK_RIGHT, "f"},
|
||||||
{VK_DELETE, "d"},
|
{VK_DELETE, "d"},
|
||||||
{VK_BACK, "\x7F"},
|
{VK_BACK, "\x7F"},
|
||||||
{0, ""} //sentinel
|
{0, ""} // sentinel
|
||||||
};
|
};
|
||||||
|
|
||||||
STATIC const char *cur_esc_seq = NULL;
|
STATIC const char *cur_esc_seq = NULL;
|
||||||
|
|
|
@ -174,7 +174,7 @@ void gc_collect(void) {
|
||||||
gc_collect_start();
|
gc_collect_start();
|
||||||
gc_collect_root(&dummy, ((mp_uint_t)MP_STATE_THREAD(stack_top) - (mp_uint_t)&dummy) / sizeof(mp_uint_t));
|
gc_collect_root(&dummy, ((mp_uint_t)MP_STATE_THREAD(stack_top) - (mp_uint_t)&dummy) / sizeof(mp_uint_t));
|
||||||
gc_collect_end();
|
gc_collect_end();
|
||||||
//gc_dump_info();
|
// gc_dump_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !MICROPY_READER_VFS
|
#if !MICROPY_READER_VFS
|
||||||
|
|
|
@ -94,7 +94,7 @@ STATIC mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
|
||||||
tuple->items[0] = mp_obj_new_str(buf, strlen(buf));
|
tuple->items[0] = mp_obj_new_str(buf, strlen(buf));
|
||||||
// We employ the fact that port offset is the same for IPv4 & IPv6
|
// We employ the fact that port offset is the same for IPv4 & IPv6
|
||||||
// not filled in
|
// not filled in
|
||||||
//tuple->items[1] = mp_obj_new_int(ntohs(((struct sockaddr_in*)addr)->sin_port));
|
// tuple->items[1] = mp_obj_new_int(ntohs(((struct sockaddr_in*)addr)->sin_port));
|
||||||
tuple->items[1] = port;
|
tuple->items[1] = port;
|
||||||
|
|
||||||
if (addr->sa_family == AF_INET6) {
|
if (addr->sa_family == AF_INET6) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_stacks_analyze_obj, mod_stacks_analyze);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_SHELL
|
#ifdef CONFIG_NET_SHELL
|
||||||
|
|
||||||
//int net_shell_cmd_iface(int argc, char *argv[]);
|
// int net_shell_cmd_iface(int argc, char *argv[]);
|
||||||
|
|
||||||
STATIC mp_obj_t mod_shell_net_iface(void) {
|
STATIC mp_obj_t mod_shell_net_iface(void) {
|
||||||
net_shell_cmd_iface(0, NULL);
|
net_shell_cmd_iface(0, NULL);
|
||||||
|
|
|
@ -143,4 +143,4 @@ const mp_obj_module_t mp_module_zsensor = {
|
||||||
.globals = (mp_obj_dict_t *)&mp_module_zsensor_globals,
|
.globals = (mp_obj_dict_t *)&mp_module_zsensor_globals,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //MICROPY_PY_UHASHLIB
|
#endif // MICROPY_PY_UHASHLIB
|
||||||
|
|
12
py/asmx64.c
12
py/asmx64.c
|
@ -63,15 +63,15 @@
|
||||||
#define OPCODE_SUB_R64_FROM_RM64 (0x29)
|
#define OPCODE_SUB_R64_FROM_RM64 (0x29)
|
||||||
#define OPCODE_SUB_I32_FROM_RM64 (0x81) /* /5 */
|
#define OPCODE_SUB_I32_FROM_RM64 (0x81) /* /5 */
|
||||||
#define OPCODE_SUB_I8_FROM_RM64 (0x83) /* /5 */
|
#define OPCODE_SUB_I8_FROM_RM64 (0x83) /* /5 */
|
||||||
//#define OPCODE_SHL_RM32_BY_I8 (0xc1) /* /4 */
|
// #define OPCODE_SHL_RM32_BY_I8 (0xc1) /* /4 */
|
||||||
//#define OPCODE_SHR_RM32_BY_I8 (0xc1) /* /5 */
|
// #define OPCODE_SHR_RM32_BY_I8 (0xc1) /* /5 */
|
||||||
//#define OPCODE_SAR_RM32_BY_I8 (0xc1) /* /7 */
|
// #define OPCODE_SAR_RM32_BY_I8 (0xc1) /* /7 */
|
||||||
#define OPCODE_SHL_RM64_CL (0xd3) /* /4 */
|
#define OPCODE_SHL_RM64_CL (0xd3) /* /4 */
|
||||||
#define OPCODE_SAR_RM64_CL (0xd3) /* /7 */
|
#define OPCODE_SAR_RM64_CL (0xd3) /* /7 */
|
||||||
//#define OPCODE_CMP_I32_WITH_RM32 (0x81) /* /7 */
|
// #define OPCODE_CMP_I32_WITH_RM32 (0x81) /* /7 */
|
||||||
//#define OPCODE_CMP_I8_WITH_RM32 (0x83) /* /7 */
|
// #define OPCODE_CMP_I8_WITH_RM32 (0x83) /* /7 */
|
||||||
#define OPCODE_CMP_R64_WITH_RM64 (0x39) /* /r */
|
#define OPCODE_CMP_R64_WITH_RM64 (0x39) /* /r */
|
||||||
//#define OPCODE_CMP_RM32_WITH_R32 (0x3b)
|
// #define OPCODE_CMP_RM32_WITH_R32 (0x3b)
|
||||||
#define OPCODE_TEST_R8_WITH_RM8 (0x84) /* /r */
|
#define OPCODE_TEST_R8_WITH_RM8 (0x84) /* /r */
|
||||||
#define OPCODE_TEST_R64_WITH_RM64 (0x85) /* /r */
|
#define OPCODE_TEST_R64_WITH_RM64 (0x85) /* /r */
|
||||||
#define OPCODE_JMP_REL8 (0xeb)
|
#define OPCODE_JMP_REL8 (0xeb)
|
||||||
|
|
20
py/asmx86.c
20
py/asmx86.c
|
@ -41,13 +41,13 @@
|
||||||
|
|
||||||
#define OPCODE_NOP (0x90)
|
#define OPCODE_NOP (0x90)
|
||||||
#define OPCODE_PUSH_R32 (0x50)
|
#define OPCODE_PUSH_R32 (0x50)
|
||||||
//#define OPCODE_PUSH_I32 (0x68)
|
// #define OPCODE_PUSH_I32 (0x68)
|
||||||
//#define OPCODE_PUSH_M32 (0xff) /* /6 */
|
// #define OPCODE_PUSH_M32 (0xff) /* /6 */
|
||||||
#define OPCODE_POP_R32 (0x58)
|
#define OPCODE_POP_R32 (0x58)
|
||||||
#define OPCODE_RET (0xc3)
|
#define OPCODE_RET (0xc3)
|
||||||
//#define OPCODE_MOV_I8_TO_R8 (0xb0) /* +rb */
|
// #define OPCODE_MOV_I8_TO_R8 (0xb0) /* +rb */
|
||||||
#define OPCODE_MOV_I32_TO_R32 (0xb8)
|
#define OPCODE_MOV_I32_TO_R32 (0xb8)
|
||||||
//#define OPCODE_MOV_I32_TO_RM32 (0xc7)
|
// #define OPCODE_MOV_I32_TO_RM32 (0xc7)
|
||||||
#define OPCODE_MOV_R8_TO_RM8 (0x88) /* /r */
|
#define OPCODE_MOV_R8_TO_RM8 (0x88) /* /r */
|
||||||
#define OPCODE_MOV_R32_TO_RM32 (0x89) /* /r */
|
#define OPCODE_MOV_R32_TO_RM32 (0x89) /* /r */
|
||||||
#define OPCODE_MOV_RM32_TO_R32 (0x8b) /* /r */
|
#define OPCODE_MOV_RM32_TO_R32 (0x8b) /* /r */
|
||||||
|
@ -63,15 +63,15 @@
|
||||||
#define OPCODE_SUB_R32_FROM_RM32 (0x29)
|
#define OPCODE_SUB_R32_FROM_RM32 (0x29)
|
||||||
#define OPCODE_SUB_I32_FROM_RM32 (0x81) /* /5 */
|
#define OPCODE_SUB_I32_FROM_RM32 (0x81) /* /5 */
|
||||||
#define OPCODE_SUB_I8_FROM_RM32 (0x83) /* /5 */
|
#define OPCODE_SUB_I8_FROM_RM32 (0x83) /* /5 */
|
||||||
//#define OPCODE_SHL_RM32_BY_I8 (0xc1) /* /4 */
|
// #define OPCODE_SHL_RM32_BY_I8 (0xc1) /* /4 */
|
||||||
//#define OPCODE_SHR_RM32_BY_I8 (0xc1) /* /5 */
|
// #define OPCODE_SHR_RM32_BY_I8 (0xc1) /* /5 */
|
||||||
//#define OPCODE_SAR_RM32_BY_I8 (0xc1) /* /7 */
|
// #define OPCODE_SAR_RM32_BY_I8 (0xc1) /* /7 */
|
||||||
#define OPCODE_SHL_RM32_CL (0xd3) /* /4 */
|
#define OPCODE_SHL_RM32_CL (0xd3) /* /4 */
|
||||||
#define OPCODE_SAR_RM32_CL (0xd3) /* /7 */
|
#define OPCODE_SAR_RM32_CL (0xd3) /* /7 */
|
||||||
//#define OPCODE_CMP_I32_WITH_RM32 (0x81) /* /7 */
|
// #define OPCODE_CMP_I32_WITH_RM32 (0x81) /* /7 */
|
||||||
//#define OPCODE_CMP_I8_WITH_RM32 (0x83) /* /7 */
|
// #define OPCODE_CMP_I8_WITH_RM32 (0x83) /* /7 */
|
||||||
#define OPCODE_CMP_R32_WITH_RM32 (0x39)
|
#define OPCODE_CMP_R32_WITH_RM32 (0x39)
|
||||||
//#define OPCODE_CMP_RM32_WITH_R32 (0x3b)
|
// #define OPCODE_CMP_RM32_WITH_R32 (0x3b)
|
||||||
#define OPCODE_TEST_R8_WITH_RM8 (0x84) /* /r */
|
#define OPCODE_TEST_R8_WITH_RM8 (0x84) /* /r */
|
||||||
#define OPCODE_TEST_R32_WITH_RM32 (0x85) /* /r */
|
#define OPCODE_TEST_R32_WITH_RM32 (0x85) /* /r */
|
||||||
#define OPCODE_JMP_REL8 (0xeb)
|
#define OPCODE_JMP_REL8 (0xeb)
|
||||||
|
|
2
py/bc.h
2
py/bc.h
|
@ -216,7 +216,7 @@ typedef struct _mp_code_state_t {
|
||||||
// Variable-length
|
// Variable-length
|
||||||
mp_obj_t state[0];
|
mp_obj_t state[0];
|
||||||
// Variable-length, never accessed by name, only as (void*)(state + n_state)
|
// Variable-length, never accessed by name, only as (void*)(state + n_state)
|
||||||
//mp_exc_stack_t exc_state[0];
|
// mp_exc_stack_t exc_state[0];
|
||||||
} mp_code_state_t;
|
} mp_code_state_t;
|
||||||
|
|
||||||
mp_uint_t mp_decode_uint(const byte **ptr);
|
mp_uint_t mp_decode_uint(const byte **ptr);
|
||||||
|
|
|
@ -440,7 +440,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
|
||||||
vstr_add_char(&path, PATH_SEP_CHAR);
|
vstr_add_char(&path, PATH_SEP_CHAR);
|
||||||
vstr_add_str(&path, "__init__.py");
|
vstr_add_str(&path, "__init__.py");
|
||||||
if (stat_file_py_or_mpy(&path) != MP_IMPORT_STAT_FILE) {
|
if (stat_file_py_or_mpy(&path) != MP_IMPORT_STAT_FILE) {
|
||||||
//mp_warning("%s is imported as namespace package", vstr_str(&path));
|
// mp_warning("%s is imported as namespace package", vstr_str(&path));
|
||||||
} else {
|
} else {
|
||||||
do_load(module_obj, &path);
|
do_load(module_obj, &path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -682,7 +682,7 @@ STATIC void compile_funcdef_lambdef_param(compiler_t *comp, mp_parse_node_t pn)
|
||||||
|
|
||||||
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t *)pn;
|
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t *)pn;
|
||||||
pn_id = pns->nodes[0];
|
pn_id = pns->nodes[0];
|
||||||
//pn_colon = pns->nodes[1]; // unused
|
// pn_colon = pns->nodes[1]; // unused
|
||||||
pn_equal = pns->nodes[2];
|
pn_equal = pns->nodes[2];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -2874,7 +2874,7 @@ STATIC void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn
|
||||||
if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
|
if (MP_PARSE_NODE_IS_NULL(pns->nodes[0])) {
|
||||||
// bare star
|
// bare star
|
||||||
// TODO see http://www.python.org/dev/peps/pep-3102/
|
// TODO see http://www.python.org/dev/peps/pep-3102/
|
||||||
//assert(comp->scope_cur->num_dict_params == 0);
|
// assert(comp->scope_cur->num_dict_params == 0);
|
||||||
pns = NULL;
|
pns = NULL;
|
||||||
} else if (MP_PARSE_NODE_IS_ID(pns->nodes[0])) {
|
} else if (MP_PARSE_NODE_IS_ID(pns->nodes[0])) {
|
||||||
// named star
|
// named star
|
||||||
|
@ -3192,7 +3192,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
|
||||||
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t *)scope->pn;
|
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t *)scope->pn;
|
||||||
assert(MP_PARSE_NODE_STRUCT_KIND(pns) == PN_funcdef);
|
assert(MP_PARSE_NODE_STRUCT_KIND(pns) == PN_funcdef);
|
||||||
|
|
||||||
//qstr f_id = MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]); // function name
|
// qstr f_id = MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]); // function name
|
||||||
|
|
||||||
// parameters are in pns->nodes[1]
|
// parameters are in pns->nodes[1]
|
||||||
if (comp->pass == MP_PASS_CODE_SIZE) {
|
if (comp->pass == MP_PASS_CODE_SIZE) {
|
||||||
|
|
|
@ -940,4 +940,4 @@ const mp_emit_method_table_id_ops_t mp_emit_bc_method_table_delete_id_ops = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //MICROPY_ENABLE_COMPILER
|
#endif // MICROPY_ENABLE_COMPILER
|
||||||
|
|
4
py/gc.c
4
py/gc.c
|
@ -834,7 +834,7 @@ void gc_dump_alloc_table(void) {
|
||||||
}
|
}
|
||||||
// print header for new line of blocks
|
// print header for new line of blocks
|
||||||
// (the cast to uint32_t is for 16-bit ports)
|
// (the cast to uint32_t is for 16-bit ports)
|
||||||
//mp_printf(&mp_plat_print, "\n%05x: ", (uint)(PTR_FROM_BLOCK(bl) & (uint32_t)0xfffff));
|
// mp_printf(&mp_plat_print, "\n%05x: ", (uint)(PTR_FROM_BLOCK(bl) & (uint32_t)0xfffff));
|
||||||
mp_printf(&mp_plat_print, "\n%05x: ", (uint)((bl * BYTES_PER_BLOCK) & (uint32_t)0xfffff));
|
mp_printf(&mp_plat_print, "\n%05x: ", (uint)((bl * BYTES_PER_BLOCK) & (uint32_t)0xfffff));
|
||||||
}
|
}
|
||||||
int c = ' ';
|
int c = ' ';
|
||||||
|
@ -956,7 +956,7 @@ void gc_test(void) {
|
||||||
mp_uint_t *p = gc_alloc(i, false);
|
mp_uint_t *p = gc_alloc(i, false);
|
||||||
printf("p=%p\n", p);
|
printf("p=%p\n", p);
|
||||||
if (i & 3) {
|
if (i & 3) {
|
||||||
//ptrs[i] = p;
|
// ptrs[i] = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,21 +125,21 @@ STATIC const mp_rom_map_elem_t mp_module_cmath_globals_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_log10), MP_ROM_PTR(&mp_cmath_log10_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_log10), MP_ROM_PTR(&mp_cmath_log10_obj) },
|
||||||
#endif
|
#endif
|
||||||
{ MP_ROM_QSTR(MP_QSTR_sqrt), MP_ROM_PTR(&mp_cmath_sqrt_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_sqrt), MP_ROM_PTR(&mp_cmath_sqrt_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_acos), MP_ROM_PTR(&mp_cmath_acos_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_acos), MP_ROM_PTR(&mp_cmath_acos_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_asin), MP_ROM_PTR(&mp_cmath_asin_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_asin), MP_ROM_PTR(&mp_cmath_asin_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_atan), MP_ROM_PTR(&mp_cmath_atan_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_atan), MP_ROM_PTR(&mp_cmath_atan_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_cos), MP_ROM_PTR(&mp_cmath_cos_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_cos), MP_ROM_PTR(&mp_cmath_cos_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_sin), MP_ROM_PTR(&mp_cmath_sin_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_sin), MP_ROM_PTR(&mp_cmath_sin_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_tan), MP_ROM_PTR(&mp_cmath_tan_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_tan), MP_ROM_PTR(&mp_cmath_tan_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_acosh), MP_ROM_PTR(&mp_cmath_acosh_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_acosh), MP_ROM_PTR(&mp_cmath_acosh_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_asinh), MP_ROM_PTR(&mp_cmath_asinh_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_asinh), MP_ROM_PTR(&mp_cmath_asinh_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_atanh), MP_ROM_PTR(&mp_cmath_atanh_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_atanh), MP_ROM_PTR(&mp_cmath_atanh_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_cosh), MP_ROM_PTR(&mp_cmath_cosh_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_cosh), MP_ROM_PTR(&mp_cmath_cosh_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_sinh), MP_ROM_PTR(&mp_cmath_sinh_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_sinh), MP_ROM_PTR(&mp_cmath_sinh_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_tanh), MP_ROM_PTR(&mp_cmath_tanh_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_tanh), MP_ROM_PTR(&mp_cmath_tanh_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_isfinite), MP_ROM_PTR(&mp_cmath_isfinite_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_isfinite), MP_ROM_PTR(&mp_cmath_isfinite_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_isinf), MP_ROM_PTR(&mp_cmath_isinf_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_isinf), MP_ROM_PTR(&mp_cmath_isinf_obj) },
|
||||||
//{ MP_ROM_QSTR(MP_QSTR_isnan), MP_ROM_PTR(&mp_cmath_isnan_obj) },
|
// { MP_ROM_QSTR(MP_QSTR_isnan), MP_ROM_PTR(&mp_cmath_isnan_obj) },
|
||||||
};
|
};
|
||||||
|
|
||||||
STATIC MP_DEFINE_CONST_DICT(mp_module_cmath_globals, mp_module_cmath_globals_table);
|
STATIC MP_DEFINE_CONST_DICT(mp_module_cmath_globals, mp_module_cmath_globals_table);
|
||||||
|
|
|
@ -146,7 +146,7 @@ STATIC mp_float_t MICROPY_FLOAT_C_FUN(fabs_func)(mp_float_t x) {
|
||||||
}
|
}
|
||||||
MATH_FUN_1(fabs, fabs_func)
|
MATH_FUN_1(fabs, fabs_func)
|
||||||
// floor(x)
|
// floor(x)
|
||||||
MATH_FUN_1_TO_INT(floor, floor) //TODO: delegate to x.__floor__() if x is not a float
|
MATH_FUN_1_TO_INT(floor, floor) // TODO: delegate to x.__floor__() if x is not a float
|
||||||
// fmod(x, y)
|
// fmod(x, y)
|
||||||
MATH_FUN_2(fmod, fmod)
|
MATH_FUN_2(fmod, fmod)
|
||||||
// isfinite(x)
|
// isfinite(x)
|
||||||
|
@ -169,7 +169,7 @@ MATH_FUN_1(gamma, tgamma)
|
||||||
// lgamma(x): return the natural logarithm of the gamma function of x
|
// lgamma(x): return the natural logarithm of the gamma function of x
|
||||||
MATH_FUN_1(lgamma, lgamma)
|
MATH_FUN_1(lgamma, lgamma)
|
||||||
#endif
|
#endif
|
||||||
//TODO: fsum
|
// TODO: fsum
|
||||||
|
|
||||||
#if MICROPY_PY_MATH_ISCLOSE
|
#if MICROPY_PY_MATH_ISCLOSE
|
||||||
STATIC mp_obj_t mp_math_isclose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
STATIC mp_obj_t mp_math_isclose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||||
|
|
|
@ -119,4 +119,4 @@ qstr mp_errno_to_str(mp_obj_t errno_val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //MICROPY_PY_UERRNO
|
#endif // MICROPY_PY_UERRNO
|
||||||
|
|
|
@ -1556,7 +1556,7 @@ typedef double mp_float_t;
|
||||||
#define UINT_FMT "%u"
|
#define UINT_FMT "%u"
|
||||||
#define INT_FMT "%d"
|
#define INT_FMT "%d"
|
||||||
#endif
|
#endif
|
||||||
#endif //INT_FMT
|
#endif // INT_FMT
|
||||||
|
|
||||||
// Modifier for function which doesn't return
|
// Modifier for function which doesn't return
|
||||||
#ifndef NORETURN
|
#ifndef NORETURN
|
||||||
|
|
2
py/mpz.c
2
py/mpz.c
|
@ -852,7 +852,7 @@ size_t mpz_set_from_str(mpz_t *z, const char *str, size_t len, bool neg, unsigne
|
||||||
|
|
||||||
z->len = 0;
|
z->len = 0;
|
||||||
for (; cur < top; ++cur) { // XXX UTF8 next char
|
for (; cur < top; ++cur) { // XXX UTF8 next char
|
||||||
//mp_uint_t v = char_to_numeric(cur#); // XXX UTF8 get char
|
// mp_uint_t v = char_to_numeric(cur#); // XXX UTF8 get char
|
||||||
mp_uint_t v = *cur;
|
mp_uint_t v = *cur;
|
||||||
if ('0' <= v && v <= '9') {
|
if ('0' <= v && v <= '9') {
|
||||||
v -= '0';
|
v -= '0';
|
||||||
|
|
|
@ -48,7 +48,7 @@ STATIC mp_obj_t namedtuple_asdict(mp_obj_t self_in) {
|
||||||
mp_obj_namedtuple_t *self = MP_OBJ_TO_PTR(self_in);
|
mp_obj_namedtuple_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
const qstr *fields = ((mp_obj_namedtuple_type_t *)self->tuple.base.type)->fields;
|
const qstr *fields = ((mp_obj_namedtuple_type_t *)self->tuple.base.type)->fields;
|
||||||
mp_obj_t dict = mp_obj_new_dict(self->tuple.len);
|
mp_obj_t dict = mp_obj_new_dict(self->tuple.len);
|
||||||
//make it an OrderedDict
|
// make it an OrderedDict
|
||||||
mp_obj_dict_t *dictObj = MP_OBJ_TO_PTR(dict);
|
mp_obj_dict_t *dictObj = MP_OBJ_TO_PTR(dict);
|
||||||
dictObj->base.type = &mp_type_ordereddict;
|
dictObj->base.type = &mp_type_ordereddict;
|
||||||
dictObj->map.is_ordered = 1;
|
dictObj->map.is_ordered = 1;
|
||||||
|
|
|
@ -284,11 +284,11 @@ const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle,
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (memcmp(&haystack[str_index], needle, nlen) == 0) {
|
if (memcmp(&haystack[str_index], needle, nlen) == 0) {
|
||||||
//found
|
// found
|
||||||
return haystack + str_index;
|
return haystack + str_index;
|
||||||
}
|
}
|
||||||
if (str_index == str_index_end) {
|
if (str_index == str_index_end) {
|
||||||
//not found
|
// not found
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
str_index += direction;
|
str_index += direction;
|
||||||
|
@ -396,7 +396,7 @@ mp_obj_t mp_obj_str_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
|
||||||
case MP_BINARY_OP_CONTAINS:
|
case MP_BINARY_OP_CONTAINS:
|
||||||
return mp_obj_new_bool(find_subbytes(lhs_data, lhs_len, rhs_data, rhs_len, 1) != NULL);
|
return mp_obj_new_bool(find_subbytes(lhs_data, lhs_len, rhs_data, rhs_len, 1) != NULL);
|
||||||
|
|
||||||
//case MP_BINARY_OP_NOT_EQUAL: // This is never passed here
|
// case MP_BINARY_OP_NOT_EQUAL: // This is never passed here
|
||||||
case MP_BINARY_OP_EQUAL: // This will be passed only for bytes, str is dealt with in mp_obj_equal()
|
case MP_BINARY_OP_EQUAL: // This will be passed only for bytes, str is dealt with in mp_obj_equal()
|
||||||
case MP_BINARY_OP_LESS:
|
case MP_BINARY_OP_LESS:
|
||||||
case MP_BINARY_OP_LESS_EQUAL:
|
case MP_BINARY_OP_LESS_EQUAL:
|
||||||
|
@ -849,7 +849,7 @@ STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(last_good_char_pos >= first_good_char_pos);
|
assert(last_good_char_pos >= first_good_char_pos);
|
||||||
//+1 to accommodate the last character
|
// +1 to accommodate the last character
|
||||||
size_t stripped_len = last_good_char_pos - first_good_char_pos + 1;
|
size_t stripped_len = last_good_char_pos - first_good_char_pos + 1;
|
||||||
if (stripped_len == orig_str_len) {
|
if (stripped_len == orig_str_len) {
|
||||||
// If nothing was stripped, don't bother to dup original string
|
// If nothing was stripped, don't bother to dup original string
|
||||||
|
|
|
@ -1137,7 +1137,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
|
||||||
o->attr = mp_obj_instance_attr;
|
o->attr = mp_obj_instance_attr;
|
||||||
o->subscr = instance_subscr;
|
o->subscr = instance_subscr;
|
||||||
o->getiter = mp_obj_instance_getiter;
|
o->getiter = mp_obj_instance_getiter;
|
||||||
//o->iternext = ; not implemented
|
// o->iternext = ; not implemented
|
||||||
o->buffer_p.get_buffer = instance_get_buffer;
|
o->buffer_p.get_buffer = instance_get_buffer;
|
||||||
|
|
||||||
if (bases_len > 0) {
|
if (bases_len > 0) {
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#define RULE_ARG_OPT_RULE (0x3000)
|
#define RULE_ARG_OPT_RULE (0x3000)
|
||||||
|
|
||||||
// (un)comment to use rule names; for debugging
|
// (un)comment to use rule names; for debugging
|
||||||
//#define USE_RULE_NAME (1)
|
// #define USE_RULE_NAME (1)
|
||||||
|
|
||||||
// *FORMAT-OFF*
|
// *FORMAT-OFF*
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,8 @@ void mp_deinit(void) {
|
||||||
MICROPY_PORT_DEINIT_FUNC;
|
MICROPY_PORT_DEINIT_FUNC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//mp_obj_dict_free(&dict_main);
|
// mp_obj_dict_free(&dict_main);
|
||||||
//mp_map_deinit(&MP_STATE_VM(mp_loaded_modules_map));
|
// mp_map_deinit(&MP_STATE_VM(mp_loaded_modules_map));
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_obj_t mp_load_name(qstr qst) {
|
mp_obj_t mp_load_name(qstr qst) {
|
||||||
|
|
|
@ -853,7 +853,7 @@ sp_extern_paren = ignore # ignore/add/remove/force
|
||||||
|
|
||||||
# Add or remove space after the opening of a C++ comment,
|
# Add or remove space after the opening of a C++ comment,
|
||||||
# i.e. '// A' vs. '//A'.
|
# i.e. '// A' vs. '//A'.
|
||||||
sp_cmt_cpp_start = ignore # ignore/add/remove/force
|
sp_cmt_cpp_start = add # ignore/add/remove/force
|
||||||
|
|
||||||
# If true, space is added with sp_cmt_cpp_start will be added after doxygen
|
# If true, space is added with sp_cmt_cpp_start will be added after doxygen
|
||||||
# sequences like '///', '///<', '//!' and '//!<'.
|
# sequences like '///', '///<', '//!' and '//!<'.
|
||||||
|
|
Loading…
Reference in New Issue