added lodepng and cleaned up string0

This commit is contained in:
prolomb 2020-05-13 13:06:16 +02:00 committed by Amir Gonnen
parent 16691dc7dd
commit 344eb95625
3 changed files with 10 additions and 16 deletions

View File

@ -169,22 +169,6 @@ char *strcpy(char *dest, const char *src) {
return dest;
}
// added for littlevgl
char *strncpy(char * dest, const char * src, size_t n){
if (n != 0) {
char *d = dest;
const char *s = src;
do {
if ((*d++ = *s++) == '\0') {
while (--n != 0)
*d++ = '\0';
break;
}
} while (--n != 0);
}
return (dest);
}
// needed because gcc optimises strcpy + strcat to this
char *stpcpy(char *dest, const char *src) {
while (*src) {

View File

@ -462,6 +462,7 @@ endif
ifeq ($(MICROPY_PY_LVGL),1)
CFLAGS += -DMICROPY_PY_LVGL
SRC_LIB += $(shell find $(LVGL_BINDING_DIR)/driver/stm32/$(BOARD)/*.c)
SRC_LIB += $(shell find $(LVGL_BINDING_DIR)/driver/stm32/string1.c)
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f7))
SRC_HAL += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\
hal_ltdc.c \

View File

@ -174,6 +174,7 @@
#define MICROPY_PY_NETWORK (1)
#endif
//#define MICROPY_PY_LVGL (1)
#define MICROPY_PY_LODEPNG (1)
// fatfs configuration used in ffconf.h
#define MICROPY_FATFS_ENABLE_LFN (1)
@ -211,6 +212,7 @@ extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t mp_module_network;
extern const struct _mp_obj_module_t mp_module_onewire;
extern const struct _mp_obj_module_t mp_module_lvgl;
extern const struct _mp_obj_module_t mp_module_lodepng;
#if MICROPY_PY_LVGL
#define MICROPY_PORT_LVGL_DEF \
@ -220,6 +222,12 @@ extern const struct _mp_obj_module_t mp_module_lvgl;
#define MICROPY_PORT_LVGL_DEF
#endif
#if MICROPY_PY_LODEPNG
#define MICROPY_PORT_LODEPNG_DEF { MP_OBJ_NEW_QSTR(MP_QSTR_lodepng), (mp_obj_t)&mp_module_lodepng },
#else
#define MICROPY_PORT_LODEPNG_DEF
#endif
#if MICROPY_PY_STM
#define STM_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_stm), MP_ROM_PTR(&stm_module) },
#else
@ -252,6 +260,7 @@ extern const struct _mp_obj_module_t mp_module_lvgl;
SOCKET_BUILTIN_MODULE \
NETWORK_BUILTIN_MODULE \
MICROPY_PORT_LVGL_DEF \
MICROPY_PORT_LODEPNG_DEF \
{ MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \
// extra constants