Rename eveL to _eve, EVEL to _EVE
This commit is contained in:
parent
a9b34f45dc
commit
acef93a253
@ -11,4 +11,4 @@ EXTERNAL_FLASH_DEVICE_COUNT = 3
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CIRCUITPY_EVEL = 1
|
||||
CIRCUITPY__EVE = 1
|
||||
|
@ -9,4 +9,4 @@ QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q16C"
|
||||
|
||||
CIRCUITPY_EVEL = 1
|
||||
CIRCUITPY__EVE = 1
|
||||
|
@ -157,8 +157,8 @@ endif
|
||||
ifeq ($(CIRCUITPY_MATH),1)
|
||||
SRC_PATTERNS += math/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_EVEL),1)
|
||||
SRC_PATTERNS += eveL/%
|
||||
ifeq ($(CIRCUITPY__EVE),1)
|
||||
SRC_PATTERNS += _eve/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_MICROCONTROLLER),1)
|
||||
SRC_PATTERNS += microcontroller/%
|
||||
@ -301,7 +301,7 @@ $(filter $(SRC_PATTERNS), \
|
||||
fontio/Glyph.c \
|
||||
microcontroller/RunMode.c \
|
||||
math/__init__.c \
|
||||
eveL/__init__.c \
|
||||
_eve/__init__.c \
|
||||
)
|
||||
|
||||
SRC_BINDINGS_ENUMS += \
|
||||
|
@ -384,11 +384,11 @@ extern const struct _mp_obj_module_t math_module;
|
||||
#define MATH_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_EVEL
|
||||
extern const struct _mp_obj_module_t eveL_module;
|
||||
#define EVEL_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_eveL), (mp_obj_t)&eveL_module },
|
||||
#if CIRCUITPY__EVE
|
||||
extern const struct _mp_obj_module_t _eve_module;
|
||||
#define _EVE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__eve), (mp_obj_t)&_eve_module },
|
||||
#else
|
||||
#define EVEL_MODULE
|
||||
#define _EVE_MODULE
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_MICROCONTROLLER
|
||||
@ -624,7 +624,7 @@ extern const struct _mp_obj_module_t ustack_module;
|
||||
I2CSLAVE_MODULE \
|
||||
JSON_MODULE \
|
||||
MATH_MODULE \
|
||||
EVEL_MODULE \
|
||||
_EVE_MODULE \
|
||||
MICROCONTROLLER_MODULE \
|
||||
NEOPIXEL_WRITE_MODULE \
|
||||
NETWORK_MODULE \
|
||||
|
@ -174,10 +174,10 @@ CIRCUITPY_MATH = $(CIRCUITPY_ALWAYS_BUILD)
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
|
||||
|
||||
ifndef CIRCUITPY_EVEL
|
||||
CIRCUITPY_EVEL = 0
|
||||
ifndef CIRCUITPY__EVE
|
||||
CIRCUITPY__EVE = 0
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_EVEL=$(CIRCUITPY_EVEL)
|
||||
CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE)
|
||||
|
||||
ifndef CIRCUITPY_MICROCONTROLLER
|
||||
CIRCUITPY_MICROCONTROLLER = $(CIRCUITPY_DEFAULT_BUILD)
|
||||
|
@ -31,72 +31,72 @@
|
||||
#include "py/runtime.h"
|
||||
#include "py/binary.h"
|
||||
|
||||
//| :mod:`eveL` --- low-level BridgeTek EVE bindings
|
||||
//| :mod:`_eve` --- low-level BridgeTek EVE bindings
|
||||
//| ================================================
|
||||
//|
|
||||
//| .. module:: eveL
|
||||
//| .. module:: _eve
|
||||
//| :synopsis: low-level BridgeTek EVE bindings
|
||||
//| :platform: SAMD21/SAMD51
|
||||
//|
|
||||
//| The `eveL` module provides a class EVEL which
|
||||
//| The `_eve` module provides a class _EVE which
|
||||
//| contains methods for constructing EVE command
|
||||
//| buffers and appending basic graphics commands.
|
||||
//|
|
||||
|
||||
typedef struct _mp_obj_EVEL_t {
|
||||
typedef struct _mp_obj__EVE_t {
|
||||
mp_obj_base_t base;
|
||||
mp_obj_t dest[3];
|
||||
size_t n;
|
||||
uint8_t buf[512];
|
||||
} mp_obj_EVEL_t;
|
||||
} mp_obj__EVE_t;
|
||||
|
||||
STATIC const mp_obj_type_t EVEL_type;
|
||||
STATIC const mp_obj_type_t _EVE_type;
|
||||
|
||||
STATIC void _write(mp_obj_EVEL_t *EVEL, mp_obj_t b) {
|
||||
EVEL->dest[2] = b;
|
||||
mp_call_method_n_kw(1, 0, EVEL->dest);
|
||||
STATIC void _write(mp_obj__EVE_t *_EVE, mp_obj_t b) {
|
||||
_EVE->dest[2] = b;
|
||||
mp_call_method_n_kw(1, 0, _EVE->dest);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) {
|
||||
mp_obj_EVEL_t *EVEL = mp_instance_cast_to_native_base(self, &EVEL_type);
|
||||
EVEL->n = 0;
|
||||
mp_load_method(o, MP_QSTR_write, EVEL->dest);
|
||||
mp_obj__EVE_t *_EVE = mp_instance_cast_to_native_base(self, &_EVE_type);
|
||||
_EVE->n = 0;
|
||||
mp_load_method(o, MP_QSTR_write, _EVE->dest);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
|
||||
|
||||
STATIC mp_obj_t _flush(mp_obj_t self) {
|
||||
mp_obj_EVEL_t *EVEL = mp_instance_cast_to_native_base(self, &EVEL_type);
|
||||
if (EVEL->n != 0) {
|
||||
_write(EVEL, mp_obj_new_bytearray_by_ref(EVEL->n, EVEL->buf));
|
||||
EVEL->n = 0;
|
||||
mp_obj__EVE_t *_EVE = mp_instance_cast_to_native_base(self, &_EVE_type);
|
||||
if (_EVE->n != 0) {
|
||||
_write(_EVE, mp_obj_new_bytearray_by_ref(_EVE->n, _EVE->buf));
|
||||
_EVE->n = 0;
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
|
||||
|
||||
STATIC void *append(mp_obj_t self, size_t m) {
|
||||
mp_obj_EVEL_t *EVEL = mp_instance_cast_to_native_base(self, &EVEL_type);
|
||||
if ((EVEL->n + m) > sizeof(EVEL->buf))
|
||||
_flush((mp_obj_t)EVEL);
|
||||
uint8_t *r = EVEL->buf + EVEL->n;
|
||||
EVEL->n += m;
|
||||
mp_obj__EVE_t *_EVE = mp_instance_cast_to_native_base(self, &_EVE_type);
|
||||
if ((_EVE->n + m) > sizeof(_EVE->buf))
|
||||
_flush((mp_obj_t)_EVE);
|
||||
uint8_t *r = _EVE->buf + _EVE->n;
|
||||
_EVE->n += m;
|
||||
return (void*)r;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t _cc(mp_obj_t self, mp_obj_t b) {
|
||||
mp_obj_EVEL_t *EVEL = mp_instance_cast_to_native_base(self, &EVEL_type);
|
||||
mp_obj__EVE_t *_EVE = mp_instance_cast_to_native_base(self, &_EVE_type);
|
||||
mp_buffer_info_t buffer_info;
|
||||
mp_get_buffer_raise(b, &buffer_info, MP_BUFFER_READ);
|
||||
if (buffer_info.len <= sizeof(EVEL->buf)) {
|
||||
uint8_t *p = (uint8_t*)append(EVEL, buffer_info.len);
|
||||
if (buffer_info.len <= sizeof(_EVE->buf)) {
|
||||
uint8_t *p = (uint8_t*)append(_EVE, buffer_info.len);
|
||||
// memcpy(p, buffer_info.buf, buffer_info.len);
|
||||
uint8_t *s = buffer_info.buf;
|
||||
for (size_t i = 0; i < buffer_info.len; i++)
|
||||
*p++ = *s++;
|
||||
} else {
|
||||
_flush(self);
|
||||
_write(EVEL, b);
|
||||
_write(_EVE, b);
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
@ -105,7 +105,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc);
|
||||
|
||||
#define C4(self, u) (*(uint32_t*)append((self), sizeof(uint32_t)) = (u))
|
||||
|
||||
#include "modeveL-gen.h"
|
||||
#include "mod_eve-gen.h"
|
||||
|
||||
// Hand-written functions {
|
||||
|
||||
@ -175,7 +175,7 @@ STATIC mp_obj_t _cmd(size_t n_args, const mp_obj_t *args) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(cmd_obj, 4, 4, _cmd);
|
||||
|
||||
STATIC const mp_rom_map_elem_t EVEL_locals_dict_table[] = {
|
||||
STATIC const mp_rom_map_elem_t _EVE_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_register), MP_ROM_PTR(®ister_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_cc), MP_ROM_PTR(&cc_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&flush_obj) },
|
||||
@ -184,40 +184,40 @@ STATIC const mp_rom_map_elem_t EVEL_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_cmd0), MP_ROM_PTR(&cmd0_obj) },
|
||||
ROM_DECLS
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(EVEL_locals_dict, EVEL_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(_EVE_locals_dict, _EVE_locals_dict_table);
|
||||
|
||||
STATIC void EVEL_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
STATIC void _EVE_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
(void)self_in;
|
||||
(void)kind;
|
||||
mp_printf(print, "<EVEL>");
|
||||
mp_printf(print, "<_EVE>");
|
||||
}
|
||||
|
||||
STATIC mp_obj_t EVEL_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t _EVE_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
// mp_arg_check_num(n_args, kw_args, 1, 1, false);
|
||||
mp_obj_EVEL_t *o = m_new_obj(mp_obj_EVEL_t);
|
||||
mp_printf(&mp_plat_print, "EVEL %p make_new\n", o);
|
||||
o->base.type = &EVEL_type;
|
||||
mp_obj__EVE_t *o = m_new_obj(mp_obj__EVE_t);
|
||||
mp_printf(&mp_plat_print, "_EVE %p make_new\n", o);
|
||||
o->base.type = &_EVE_type;
|
||||
return MP_OBJ_FROM_PTR(o);
|
||||
}
|
||||
|
||||
STATIC const mp_obj_type_t EVEL_type = {
|
||||
STATIC const mp_obj_type_t _EVE_type = {
|
||||
{ &mp_type_type },
|
||||
// Save on qstr's, reuse same as for module
|
||||
.name = MP_QSTR_EVEL,
|
||||
.print = EVEL_print,
|
||||
.make_new = EVEL_make_new,
|
||||
// .attr = EVEL_attr,
|
||||
.locals_dict = (void*)&EVEL_locals_dict,
|
||||
.name = MP_QSTR__EVE,
|
||||
.print = _EVE_print,
|
||||
.make_new = _EVE_make_new,
|
||||
// .attr = _EVE_attr,
|
||||
.locals_dict = (void*)&_EVE_locals_dict,
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t mp_module_eveL_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_eveL) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_EVEL), MP_OBJ_FROM_PTR(&EVEL_type) },
|
||||
STATIC const mp_rom_map_elem_t mp_module__eve_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__eve) },
|
||||
{ MP_ROM_QSTR(MP_QSTR__EVE), MP_OBJ_FROM_PTR(&_EVE_type) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_eveL_globals, mp_module_eveL_globals_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module__eve_globals, mp_module__eve_globals_table);
|
||||
|
||||
const mp_obj_module_t eveL_module = {
|
||||
const mp_obj_module_t _eve_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t*)&mp_module_eveL_globals,
|
||||
.globals = (mp_obj_dict_t*)&mp_module__eve_globals,
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user