diff --git a/Makefile b/Makefile index bba8baa1..042c3b5c 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:= IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=VOSS -VERSION:=0.1.1 +VERSION:=0.1.2 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) diff --git a/VOSS@0.1.2.zip b/VOSS@0.1.2.zip new file mode 100644 index 00000000..492f59a5 Binary files /dev/null and b/VOSS@0.1.2.zip differ diff --git a/common.mk b/common.mk index f6dbfcb8..33efe871 100644 --- a/common.mk +++ b/common.mk @@ -21,7 +21,7 @@ SPACE := $() $() COMMA := , C_STANDARD?=gnu11 -CXX_STANDARD?=gnu++2a +CXX_STANDARD?=gnu++20 DEPDIR := .d $(shell mkdir -p $(DEPDIR)) diff --git a/firmware/liblvgl.a b/firmware/liblvgl.a index 1d4151b4..81e5f1a9 100644 Binary files a/firmware/liblvgl.a and b/firmware/liblvgl.a differ diff --git a/firmware/libpros.a b/firmware/libpros.a index 878ffc3c..956b8ad2 100644 Binary files a/firmware/libpros.a and b/firmware/libpros.a differ diff --git a/include/api.h b/include/api.h index 36daaa4c..017b5226 100644 --- a/include/api.h +++ b/include/api.h @@ -41,8 +41,8 @@ #define PROS_VERSION_MAJOR 4 #define PROS_VERSION_MINOR 0 -#define PROS_VERSION_PATCH 5 -#define PROS_VERSION_STRING "4.0.5" +#define PROS_VERSION_PATCH 7 +#define PROS_VERSION_STRING "4.0.7" #include "pros/adi.h" #include "pros/colors.h" diff --git a/include/liblvgl/core/lv_core.mk b/include/liblvgl/core/lv_core.mk deleted file mode 100644 index 677a9f6b..00000000 --- a/include/liblvgl/core/lv_core.mk +++ /dev/null @@ -1,20 +0,0 @@ -CSRCS += lv_disp.c -CSRCS += lv_group.c -CSRCS += lv_indev.c -CSRCS += lv_indev_scroll.c -CSRCS += lv_obj.c -CSRCS += lv_obj_class.c -CSRCS += lv_obj_draw.c -CSRCS += lv_obj_pos.c -CSRCS += lv_obj_scroll.c -CSRCS += lv_obj_style.c -CSRCS += lv_obj_style_gen.c -CSRCS += lv_obj_tree.c -CSRCS += lv_event.c -CSRCS += lv_refr.c -CSRCS += lv_theme.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/core -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/core - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/core" diff --git a/include/liblvgl/core/lv_disp.h b/include/liblvgl/core/lv_disp.h index 7854cb7f..cd6efcc2 100644 --- a/include/liblvgl/core/lv_disp.h +++ b/include/liblvgl/core/lv_disp.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../hal/lv_hal.h" +#include "liblvgl/hal/lv_hal.h" #include "lv_obj.h" #include "lv_theme.h" diff --git a/include/liblvgl/core/lv_group.h b/include/liblvgl/core/lv_group.h index 09105973..85df325a 100644 --- a/include/liblvgl/core/lv_group.h +++ b/include/liblvgl/core/lv_group.h @@ -14,12 +14,12 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include -#include "../misc/lv_ll.h" -#include "../misc/lv_types.h" +#include "liblvgl/misc/lv_ll.h" +#include "liblvgl/misc/lv_types.h" /********************* * DEFINES diff --git a/include/liblvgl/core/lv_indev.h b/include/liblvgl/core/lv_indev.h index a98df86e..4692ef37 100644 --- a/include/liblvgl/core/lv_indev.h +++ b/include/liblvgl/core/lv_indev.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ #include "lv_obj.h" -#include "../hal/lv_hal_indev.h" +#include "liblvgl/hal/lv_hal_indev.h" #include "lv_group.h" /********************* diff --git a/include/liblvgl/core/lv_obj_draw.h b/include/liblvgl/core/lv_obj_draw.h index 3f9d0f30..a107e556 100644 --- a/include/liblvgl/core/lv_obj_draw.h +++ b/include/liblvgl/core/lv_obj_draw.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../draw/lv_draw.h" +#include "liblvgl/draw/lv_draw.h" /********************* * DEFINES diff --git a/include/liblvgl/core/lv_obj_pos.h b/include/liblvgl/core/lv_obj_pos.h index d20ee965..fdc64767 100644 --- a/include/liblvgl/core/lv_obj_pos.h +++ b/include/liblvgl/core/lv_obj_pos.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_area.h" +#include "liblvgl/misc/lv_area.h" /********************* * DEFINES diff --git a/include/liblvgl/core/lv_obj_scroll.h b/include/liblvgl/core/lv_obj_scroll.h index e1da245b..3717dec4 100644 --- a/include/liblvgl/core/lv_obj_scroll.h +++ b/include/liblvgl/core/lv_obj_scroll.h @@ -13,9 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_area.h" -#include "../misc/lv_anim.h" -#include "../misc/lv_types.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_anim.h" +#include "liblvgl/misc/lv_types.h" /********************* * DEFINES diff --git a/include/liblvgl/core/lv_obj_style.h b/include/liblvgl/core/lv_obj_style.h index 5d122ca6..18e530a6 100644 --- a/include/liblvgl/core/lv_obj_style.h +++ b/include/liblvgl/core/lv_obj_style.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include #include -#include "../misc/lv_bidi.h" +#include "liblvgl/misc/lv_bidi.h" /********************* * DEFINES diff --git a/include/liblvgl/core/lv_theme.h b/include/liblvgl/core/lv_theme.h index ef46336c..80da522c 100644 --- a/include/liblvgl/core/lv_theme.h +++ b/include/liblvgl/core/lv_theme.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/arm2d/lv_draw_arm2d.mk b/include/liblvgl/draw/arm2d/lv_draw_arm2d.mk deleted file mode 100644 index 17219b07..00000000 --- a/include/liblvgl/draw/arm2d/lv_draw_arm2d.mk +++ /dev/null @@ -1,6 +0,0 @@ -CSRCS += lv_gpu_arm2d.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d" diff --git a/include/liblvgl/draw/arm2d/lv_gpu_arm2d.h b/include/liblvgl/draw/arm2d/lv_gpu_arm2d.h index 50fa5a89..cc669901 100644 --- a/include/liblvgl/draw/arm2d/lv_gpu_arm2d.h +++ b/include/liblvgl/draw/arm2d/lv_gpu_arm2d.h @@ -13,9 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_color.h" -#include "../../hal/lv_hal_disp.h" -#include "../sw/lv_draw_sw.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/hal/lv_hal_disp.h" +#include "liblvgl/draw/sw/lv_draw_sw.h" #if LV_USE_GPU_ARM2D diff --git a/include/liblvgl/draw/lv_draw.h b/include/liblvgl/draw/lv_draw.h index ffe1d4e2..c8aed722 100644 --- a/include/liblvgl/draw/lv_draw.h +++ b/include/liblvgl/draw/lv_draw.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" -#include "../misc/lv_style.h" -#include "../misc/lv_txt.h" +#include "liblvgl/misc/lv_style.h" +#include "liblvgl/misc/lv_txt.h" #include "lv_img_decoder.h" #include "lv_img_cache.h" @@ -72,7 +72,6 @@ typedef struct _lv_draw_ctx_t { */ const lv_area_t * clip_area; - void (*init_buf)(struct _lv_draw_ctx_t * draw_ctx); void (*draw_rect)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords); diff --git a/include/liblvgl/draw/lv_draw.mk b/include/liblvgl/draw/lv_draw.mk deleted file mode 100644 index f48f48fe..00000000 --- a/include/liblvgl/draw/lv_draw.mk +++ /dev/null @@ -1,25 +0,0 @@ -CSRCS += lv_draw_arc.c -CSRCS += lv_draw.c -CSRCS += lv_draw_img.c -CSRCS += lv_draw_label.c -CSRCS += lv_draw_line.c -CSRCS += lv_draw_mask.c -CSRCS += lv_draw_rect.c -CSRCS += lv_draw_transform.c -CSRCS += lv_draw_layer.c -CSRCS += lv_draw_triangle.c -CSRCS += lv_img_buf.c -CSRCS += lv_img_cache.c -CSRCS += lv_img_decoder.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw" - -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/arm2d/lv_draw_arm2d.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/lv_draw_nxp.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl/lv_draw_sdl.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d/lv_draw_stm32_dma2d.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sw/lv_draw_sw.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/swm341_dma2d/lv_draw_swm341_dma2d.mk diff --git a/include/liblvgl/draw/lv_draw_arc.h b/include/liblvgl/draw/lv_draw_arc.h index 8783f131..8633af5f 100644 --- a/include/liblvgl/draw/lv_draw_arc.h +++ b/include/liblvgl/draw/lv_draw_arc.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_style.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_draw_img.h b/include/liblvgl/draw/lv_draw_img.h index a88a33ca..dcb71136 100644 --- a/include/liblvgl/draw/lv_draw_img.h +++ b/include/liblvgl/draw/lv_draw_img.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include "lv_img_decoder.h" #include "lv_img_buf.h" -#include "../misc/lv_style.h" +#include "liblvgl/misc/lv_style.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_draw_label.h b/include/liblvgl/draw/lv_draw_label.h index de72eddf..736aa728 100644 --- a/include/liblvgl/draw/lv_draw_label.h +++ b/include/liblvgl/draw/lv_draw_label.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../misc/lv_bidi.h" -#include "../misc/lv_txt.h" -#include "../misc/lv_color.h" -#include "../misc/lv_style.h" +#include "liblvgl/misc/lv_bidi.h" +#include "liblvgl/misc/lv_txt.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_style.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_draw_layer.h b/include/liblvgl/draw/lv_draw_layer.h index cd64149c..1280d33a 100644 --- a/include/liblvgl/draw/lv_draw_layer.h +++ b/include/liblvgl/draw/lv_draw_layer.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_draw_line.h b/include/liblvgl/draw/lv_draw_line.h index d82ea51b..79ca0dcf 100644 --- a/include/liblvgl/draw/lv_draw_line.h +++ b/include/liblvgl/draw/lv_draw_line.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_style.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_draw_mask.h b/include/liblvgl/draw/lv_draw_mask.h index b7e4e1cd..f3c49e5d 100644 --- a/include/liblvgl/draw/lv_draw_mask.h +++ b/include/liblvgl/draw/lv_draw_mask.h @@ -15,9 +15,9 @@ extern "C" { * INCLUDES *********************/ #include -#include "../misc/lv_area.h" -#include "../misc/lv_color.h" -#include "../misc/lv_math.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_math.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_draw_rect.h b/include/liblvgl/draw/lv_draw_rect.h index 1583e3e6..e259446e 100644 --- a/include/liblvgl/draw/lv_draw_rect.h +++ b/include/liblvgl/draw/lv_draw_rect.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_style.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_style.h" #include "sw/lv_draw_sw_gradient.h" /********************* diff --git a/include/liblvgl/draw/lv_draw_transform.h b/include/liblvgl/draw/lv_draw_transform.h index 1926c2fc..6e6236ca 100644 --- a/include/liblvgl/draw/lv_draw_transform.h +++ b/include/liblvgl/draw/lv_draw_transform.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#include "../misc/lv_area.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/misc/lv_area.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_img_buf.h b/include/liblvgl/draw/lv_img_buf.h index 1be7bb65..8998839b 100644 --- a/include/liblvgl/draw/lv_img_buf.h +++ b/include/liblvgl/draw/lv_img_buf.h @@ -14,8 +14,8 @@ extern "C" { * INCLUDES *********************/ #include -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/lv_img_decoder.h b/include/liblvgl/draw/lv_img_decoder.h index 9dc84dd5..c0c5860e 100644 --- a/include/liblvgl/draw/lv_img_decoder.h +++ b/include/liblvgl/draw/lv_img_decoder.h @@ -13,13 +13,13 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include "lv_img_buf.h" -#include "../misc/lv_fs.h" -#include "../misc/lv_types.h" -#include "../misc/lv_area.h" +#include "liblvgl/misc/lv_fs.h" +#include "liblvgl/misc/lv_types.h" +#include "liblvgl/misc/lv_area.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/nxp/lv_draw_nxp.mk b/include/liblvgl/draw/nxp/lv_draw_nxp.mk deleted file mode 100644 index 18a751ea..00000000 --- a/include/liblvgl/draw/nxp/lv_draw_nxp.mk +++ /dev/null @@ -1,7 +0,0 @@ -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp" - -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp/lv_draw_nxp_pxp.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite/lv_draw_nxp_vglite.mk diff --git a/include/liblvgl/draw/nxp/pxp/lv_draw_nxp_pxp.mk b/include/liblvgl/draw/nxp/pxp/lv_draw_nxp_pxp.mk deleted file mode 100644 index 5c684bcd..00000000 --- a/include/liblvgl/draw/nxp/pxp/lv_draw_nxp_pxp.mk +++ /dev/null @@ -1,9 +0,0 @@ -CSRCS += lv_draw_pxp.c -CSRCS += lv_draw_pxp_blend.c -CSRCS += lv_gpu_nxp_pxp_osa.c -CSRCS += lv_gpu_nxp_pxp.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/pxp" diff --git a/include/liblvgl/draw/nxp/pxp/lv_draw_pxp.h b/include/liblvgl/draw/nxp/pxp/lv_draw_pxp.h deleted file mode 100644 index 1ace3bca..00000000 --- a/include/liblvgl/draw/nxp/pxp/lv_draw_pxp.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file lv_draw_pxp.h - * - */ - -/** - * MIT License - * - * Copyright 2022, 2023 NXP - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next paragraph) - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef LV_DRAW_PXP_H -#define LV_DRAW_PXP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" - -#if LV_USE_GPU_NXP_PXP -#include "../../sw/lv_draw_sw.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef lv_draw_sw_ctx_t lv_draw_pxp_ctx_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void lv_draw_pxp_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx); - -void lv_draw_pxp_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx); - -/********************** - * MACROS - **********************/ -#endif /*LV_USE_GPU_NXP_PXP*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_PXP_H*/ diff --git a/include/liblvgl/draw/nxp/pxp/lv_draw_pxp_blend.h b/include/liblvgl/draw/nxp/pxp/lv_draw_pxp_blend.h index 9fe9192f..acce8713 100644 --- a/include/liblvgl/draw/nxp/pxp/lv_draw_pxp_blend.h +++ b/include/liblvgl/draw/nxp/pxp/lv_draw_pxp_blend.h @@ -6,7 +6,7 @@ /** * MIT License * - * Copyright 2020-2023 NXP + * Copyright 2020-2022 NXP * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,7 +38,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_NXP_PXP #include "lv_gpu_nxp_pxp.h" @@ -48,6 +48,31 @@ extern "C" { * DEFINES *********************/ +#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT +/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP*/ +#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT +/** Minimum area (in pixels) for image copy with transparency to be handled by PXP*/ +#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT +/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */ +#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT +/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/ +#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT +/** Minimum area (in pixels) to be filled by PXP with transparency*/ +#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 5000 +#endif + /********************** * TYPEDEFS **********************/ @@ -59,49 +84,51 @@ extern "C" { /** * Fill area, with optional opacity. * - * @param[in/out] dest_buf Destination buffer - * @param[in] dest_area Area with relative coordinates of destination buffer - * @param[in] dest_stride Stride of destination buffer in pixels - * @param[in] color Color - * @param[in] opa Opacity + * @param[in/out] dest_buf destination buffer + * @param[in] dest_stride width (stride) of destination buffer in pixels + * @param[in] fill_area area to fill + * @param[in] color color + * @param[in] opa transparency of the color + * @retval LV_RES_OK Fill completed + * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS) */ -void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, - lv_color_t color, lv_opa_t opa); +lv_res_t lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area, + lv_color_t color, lv_opa_t opa); /** * BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects. * By default, image is copied directly, with optional opacity. This function can also * rotate the display output buffer to a specified angle (90x step). * - * @param[in/out] dest_buf Destination buffer - * @param[in] dest_area Area with relative coordinates of destination buffer - * @param[in] dest_stride Stride of destination buffer in pixels - * @param[in] src_buf Source buffer - * @param[in] src_area Source area with relative coordinates of source buffer - * @param[in] src_stride Stride of source buffer in pixels - * @param[in] opa Opacity - * @param[in] angle Display rotation angle (90x) + * @param[in/out] dest_buf destination buffer + * @param[in] dest_area destination area + * @param[in] dest_stride width (stride) of destination buffer in pixels + * @param[in] src_buf source buffer + * @param[in] src_area source area with absolute coordinates to draw on destination buffer + * @param[in] opa opacity of the result + * @param[in] angle display rotation angle (90x) + * @retval LV_RES_OK Fill completed + * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS) */ -void lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, - const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride, - lv_opa_t opa, lv_disp_rot_t angle); +lv_res_t lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, + const lv_color_t * src_buf, const lv_area_t * src_area, lv_opa_t opa, lv_disp_rot_t angle); /** * BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation. * * - * @param[in/out] dest_buf Destination buffer - * @param[in] dest_area Area with relative coordinates of destination buffer - * @param[in] dest_stride Stride of destination buffer in pixels - * @param[in] src_buf Source buffer - * @param[in] src_area Area with relative coordinates of source buffer - * @param[in] src_stride Stride of source buffer in pixels - * @param[in] dsc Image descriptor - * @param[in] cf Color format + * @param[in/out] dest_buf destination buffer + * @param[in] dest_area destination area + * @param[in] dest_stride width (stride) of destination buffer in pixels + * @param[in] src_buf source buffer + * @param[in] src_area source area with absolute coordinates to draw on destination buffer + * @param[in] dsc image descriptor + * @param[in] cf color format + * @retval LV_RES_OK Fill completed + * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS) */ -void lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, - const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride, - const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf); +lv_res_t lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, + const lv_color_t * src_buf, const lv_area_t * src_area, const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf); /********************** * MACROS diff --git a/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp.h b/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp.h index 10a67215..aeb9d6c0 100644 --- a/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp.h +++ b/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp.h @@ -6,7 +6,7 @@ /** * MIT License * - * Copyright 2020-2023 NXP + * Copyright 2020-2022 NXP * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,7 +38,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_NXP_PXP #include "fsl_cache.h" @@ -81,11 +81,8 @@ typedef struct { /** Callback for PXP interrupt de-initialization*/ void (*pxp_interrupt_deinit)(void); - /** Callback for PXP start*/ + /** Callback that should start PXP and wait for operation complete*/ void (*pxp_run)(void); - - /** Callback for waiting of PXP completion*/ - void (*pxp_wait)(void); } lv_nxp_pxp_cfg_t; /********************** @@ -107,20 +104,10 @@ lv_res_t lv_gpu_nxp_pxp_init(void); void lv_gpu_nxp_pxp_deinit(void); /** - * Reset PXP device. - */ -void lv_gpu_nxp_pxp_reset(void); - -/** - * Clear cache and start PXP. + * Start PXP job and wait for completion. */ void lv_gpu_nxp_pxp_run(void); -/** - * Wait for PXP completion. - */ -void lv_gpu_nxp_pxp_wait(void); - /********************** * MACROS **********************/ diff --git a/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp_osa.h b/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp_osa.h index 5c87824a..d9074472 100644 --- a/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp_osa.h +++ b/include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp_osa.h @@ -38,7 +38,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT #include "lv_gpu_nxp_pxp.h" diff --git a/include/liblvgl/draw/nxp/vglite/lv_draw_nxp_vglite.mk b/include/liblvgl/draw/nxp/vglite/lv_draw_nxp_vglite.mk deleted file mode 100644 index c9473cc1..00000000 --- a/include/liblvgl/draw/nxp/vglite/lv_draw_nxp_vglite.mk +++ /dev/null @@ -1,12 +0,0 @@ -CSRCS += lv_draw_vglite.c -CSRCS += lv_draw_vglite_arc.c -CSRCS += lv_draw_vglite_blend.c -CSRCS += lv_draw_vglite_line.c -CSRCS += lv_draw_vglite_rect.c -CSRCS += lv_vglite_buf.c -CSRCS += lv_vglite_utils.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/nxp/vglite" diff --git a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite.h b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite.h deleted file mode 100644 index c44cb8fc..00000000 --- a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file lv_draw_vglite.h - * - */ - -/** - * MIT License - * - * Copyright 2022, 2023 NXP - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next paragraph) - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef LV_DRAW_VGLITE_H -#define LV_DRAW_VGLITE_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -#include "../../../lv_conf_internal.h" - -#if LV_USE_GPU_NXP_VG_LITE -#include "../../sw/lv_draw_sw.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ -typedef lv_draw_sw_ctx_t lv_draw_vglite_ctx_t; - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void lv_draw_vglite_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx); - -void lv_draw_vglite_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx); - -/********************** - * MACROS - **********************/ -#endif /*LV_USE_GPU_NXP_VG_LITE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_VGLITE_H*/ diff --git a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_arc.h b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_arc.h index 0fbff3d9..e2da4190 100644 --- a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_arc.h +++ b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_arc.h @@ -6,7 +6,7 @@ /** * MIT License * - * Copyright 2021-2023 NXP + * Copyright 2021, 2022 NXP * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -37,10 +37,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_NXP_VG_LITE -#include "lv_vglite_utils.h" +#include "lv_gpu_nxp_vglite.h" /********************* * DEFINES @@ -54,21 +54,17 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -/** +/*** * Draw arc shape with effects - * - * @param[in] center Arc center with relative coordinates - * @param[in] radius Radius of external arc - * @param[in] start_angle Starting angle in degrees - * @param[in] end_angle Ending angle in degrees - * @param[in] clip_area Clipping area with relative coordinates to dest buff - * @param[in] dsc Arc description structure (width, rounded ending, opacity) - * - * @retval LV_RES_OK Draw completed - * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) + * @param draw_ctx drawing context + * @param dsc the arc description structure (width, rounded ending, opacity) + * @param center the coordinates of the arc center + * @param radius the radius of external arc + * @param start_angle the starting angle in degrees + * @param end_angle the ending angle in degrees */ -lv_res_t lv_gpu_nxp_vglite_draw_arc(const lv_point_t * center, int32_t radius, int32_t start_angle, int32_t end_angle, - const lv_area_t * clip_area, const lv_draw_arc_dsc_t * dsc); +lv_res_t lv_gpu_nxp_vglite_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center, + int32_t radius, int32_t start_angle, int32_t end_angle); /********************** * MACROS diff --git a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_blend.h b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_blend.h index 025d2b5c..1726dcd9 100644 --- a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_blend.h +++ b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_blend.h @@ -6,7 +6,7 @@ /** * MIT License * - * Copyright 2020-2023 NXP + * Copyright 2020-2022 NXP * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,19 +38,67 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_NXP_VG_LITE -#include "lv_vglite_utils.h" +#include "lv_gpu_nxp_vglite.h" /********************* * DEFINES *********************/ +#ifndef LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT +/** Minimum area (in pixels) to be filled by VG-Lite with 100% opacity*/ +#define LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT +/** Minimum area (in pixels) to be filled by VG-Lite with transparency*/ +#define LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT +/** Minimum area (in pixels) for image copy with 100% opacity to be handled by VG-Lite*/ +#define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT +/** Minimum invalidated area (in pixels) to be synchronized by VG-Lite during buffer sync */ +#define LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT 5000 +#endif + +#ifndef LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT +/** Minimum area (in pixels) for image copy with transparency to be handled by VG-Lite*/ +#define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 5000 +#endif + /********************** * TYPEDEFS **********************/ +/** + * BLock Image Transfer descriptor structure + */ +typedef struct { + + const lv_color_t * src; /**< Source buffer pointer (must be aligned on 32 bytes)*/ + lv_area_t src_area; /**< Area to be copied from source*/ + lv_coord_t src_width; /**< Source buffer width*/ + lv_coord_t src_height; /**< Source buffer height*/ + int32_t src_stride; /**< Source buffer stride in bytes (must be aligned on 16 px)*/ + + const lv_color_t * dst; /**< Destination buffer pointer (must be aligned on 32 bytes)*/ + lv_area_t dst_area; /**< Target area in destination buffer (must be the same as src_area)*/ + lv_coord_t dst_width; /**< Destination buffer width*/ + lv_coord_t dst_height; /**< Destination buffer height*/ + int32_t dst_stride; /**< Destination buffer stride in bytes (must be aligned on 16 px)*/ + + lv_opa_t opa; /**< Opacity - alpha mix (0 = source not copied, 255 = 100% opaque)*/ + uint32_t angle; /**< Rotation angle (1/10 of degree)*/ + uint32_t zoom; /**< 256 = no zoom (1:1 scale ratio)*/ + lv_point_t pivot; /**< The coordinates of rotation pivot in source image buffer*/ +} lv_gpu_nxp_vglite_blit_info_t; + /********************** * GLOBAL PROTOTYPES **********************/ @@ -58,52 +106,35 @@ extern "C" { /** * Fill area, with optional opacity. * - * @param[in] dest_area Area with relative coordinates of destination buffer - * @param[in] color Color + * @param[in/out] dest_buf Destination buffer pointer (must be aligned on 32 bytes) + * @param[in] dest_width Destination buffer width in pixels (must be aligned on 16 px) + * @param[in] dest_height Destination buffer height in pixels + * @param[in] fill_area Area to be filled + * @param[in] color Fill color * @param[in] opa Opacity (255 = full, 128 = 50% background/50% color, 0 = no fill) - * * @retval LV_RES_OK Fill completed * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) */ -lv_res_t lv_gpu_nxp_vglite_fill(const lv_area_t * dest_area, lv_color_t color, lv_opa_t opa); +lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height, + const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa); /** - * BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects. - * By default, image is copied directly, with optional opacity. - * - * @param[in/out] dest_buf Destination buffer - * @param[in] dest_area Area with relative coordinates of destination buffer - * @param[in] dest_stride Stride of destination buffer in pixels - * @param[in] src_buf Source buffer - * @param[in] src_area Source area with relative coordinates of source buffer - * @param[in] src_stride Stride of source buffer in pixels - * @param[in] opa Opacity + * BLock Image Transfer. * + * @param[in] blit Description of the transfer * @retval LV_RES_OK Transfer complete * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) */ -lv_res_t lv_gpu_nxp_vglite_blit(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride, - const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride, - lv_opa_t opa); +lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit); /** - * BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation. - * By default, image is copied directly, with optional opacity. - * - * @param[in/out] dest_buf Destination buffer - * @param[in] dest_area Area with relative coordinates of destination buffer - * @param[in] dest_stride Stride of destination buffer in pixels - * @param[in] src_buf Source buffer - * @param[in] src_area Source area with relative coordinates of source buffer - * @param[in] src_stride Stride of source buffer in pixels - * @param[in] dsc Image descriptor + * BLock Image Transfer with transformation. * + * @param[in] blit Description of the transfer * @retval LV_RES_OK Transfer complete * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) */ -lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride, - const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride, - const lv_draw_img_dsc_t * dsc); +lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_gpu_nxp_vglite_blit_info_t * blit); /********************** * MACROS diff --git a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_line.h b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_line.h deleted file mode 100644 index cbd4b95e..00000000 --- a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_line.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @file lv_draw_vglite_line.h - * - */ - -/** - * MIT License - * - * Copyright 2022, 2023 NXP - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next paragraph) - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef LV_DRAW_VGLITE_LINE_H -#define LV_DRAW_VGLITE_LINE_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../lv_conf_internal.h" - -#if LV_USE_GPU_NXP_VG_LITE -#include "lv_vglite_utils.h" -#include "../../lv_draw_line.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Draw line shape with effects - * - * @param[in] point1 Starting point with relative coordinates - * @param[in] point2 Ending point with relative coordinates - * @param[in] clip_area Clipping area with relative coordinates to dest buff - * @param[in] dsc Line description structure (width, rounded ending, opacity, ...) - * - * @retval LV_RES_OK Draw completed - * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) - */ -lv_res_t lv_gpu_nxp_vglite_draw_line(const lv_point_t * point1, const lv_point_t * point2, - const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GPU_NXP_VG_LITE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_DRAW_VGLITE_RECT_H*/ diff --git a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_rect.h b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_rect.h index 79582274..8a641707 100644 --- a/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_rect.h +++ b/include/liblvgl/draw/nxp/vglite/lv_draw_vglite_rect.h @@ -6,7 +6,7 @@ /** * MIT License * - * Copyright 2021-2023 NXP + * Copyright 2021, 2022 NXP * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -37,10 +37,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_NXP_VG_LITE -#include "lv_vglite_utils.h" +#include "lv_gpu_nxp_vglite.h" #include "../../lv_draw_rect.h" /********************* @@ -56,33 +56,13 @@ extern "C" { **********************/ /** - * Draw rectangle background with effects (rounded corners, gradient) - * - * @param[in] coords Coordinates of the rectangle background (relative to dest buff) - * @param[in] clip_area Clipping area with relative coordinates to dest buff - * @param[in] dsc Description of the rectangle background - * - * @retval LV_RES_OK Draw completed - * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) - * - */ -lv_res_t lv_gpu_nxp_vglite_draw_bg(const lv_area_t * coords, const lv_area_t * clip_area, - const lv_draw_rect_dsc_t * dsc); - -/** - * Draw rectangle border/outline shape with effects (rounded corners, opacity) - * - * @param[in] coords Coordinates of the rectangle border/outline (relative to dest buff) - * @param[in] clip_area Clipping area with relative coordinates to dest buff - * @param[in] dsc Description of the rectangle border/outline - * @param[in] border True for border, False for outline - * - * @retval LV_RES_OK Draw completed - * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) + * Draw rectangle shape with effects (rounded corners, gradient) * + * @param draw_ctx drawing context + * @param dsc description of the rectangle + * @param coords the area where rectangle is clipped */ -lv_res_t lv_gpu_nxp_vglite_draw_border_generic(const lv_area_t * coords, const lv_area_t * clip_area, - const lv_draw_rect_dsc_t * dsc, bool border); +lv_res_t lv_gpu_nxp_vglite_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords); /********************** * MACROS diff --git a/include/liblvgl/draw/nxp/vglite/lv_vglite_buf.h b/include/liblvgl/draw/nxp/vglite/lv_vglite_buf.h deleted file mode 100644 index 9219dca0..00000000 --- a/include/liblvgl/draw/nxp/vglite/lv_vglite_buf.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @file lv_vglite_buf.h - * - */ - -/** - * MIT License - * - * Copyright 2023 NXP - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next paragraph) - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef LV_VGLITE_BUF_H -#define LV_VGLITE_BUF_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../lv_conf_internal.h" - -#if LV_USE_GPU_NXP_VG_LITE -#include "vg_lite.h" -#include "../../sw/lv_draw_sw.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -/** - * Init vglite destination buffer. It will be done once per frame. - * - * @param[in] buf Destination buffer address (does not require alignment for VG_LITE_LINEAR mode) - * @param[in] area Destination buffer area (for width and height) - * @param[in] stride Stride of destination buffer - */ -void lv_gpu_nxp_vglite_init_buf(const lv_color_t * buf, const lv_area_t * area, lv_coord_t stride); - -/** - * Get vglite destination buffer pointer. - * - * @retval The vglite destination buffer - */ -vg_lite_buffer_t * lv_vglite_get_dest_buf(void); - -/** - * Get vglite source buffer pointer. - * - * @retval The vglite source buffer - */ -vg_lite_buffer_t * lv_vglite_get_src_buf(void); - -/** - * Set vglite destination buffer address only. - * - * @param[in] buf Destination buffer address (does not require alignment for VG_LITE_LINEAR mode) - */ -void lv_vglite_set_dest_buf_ptr(const lv_color_t * buf); - -/** - * Set vglite source buffer address only. - * - * @param[in] buf Source buffer address - */ -void lv_vglite_set_src_buf_ptr(const lv_color_t * buf); - -/** - * Set vglite source buffer. It will be done only if buffer addreess is different. - * - * @param[in] buf Source buffer address - * @param[in] area Source buffer area (for width and height) - * @param[in] stride Stride of source buffer - */ -void lv_vglite_set_src_buf(const lv_color_t * buf, const lv_area_t * area, lv_coord_t stride); - -/********************** - * MACROS - **********************/ - -#endif /*LV_USE_GPU_NXP_VG_LITE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_VGLITE_BUF_H*/ diff --git a/include/liblvgl/draw/nxp/vglite/lv_vglite_utils.h b/include/liblvgl/draw/nxp/vglite/lv_vglite_utils.h deleted file mode 100644 index 9ff4de02..00000000 --- a/include/liblvgl/draw/nxp/vglite/lv_vglite_utils.h +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @file lv_vglite_utils.h - * - */ - -/** - * MIT License - * - * Copyright 2022, 2023 NXP - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next paragraph) - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef LV_VGLITE_UTILS_H -#define LV_VGLITE_UTILS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../../../lv_conf_internal.h" - -#if LV_USE_GPU_NXP_VG_LITE -#include "vg_lite.h" -#include "../../sw/lv_draw_sw.h" -#include "../../../misc/lv_log.h" - -/********************* - * DEFINES - *********************/ - -#ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS -/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR)*/ -#define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1 -#endif - -#ifndef LV_GPU_NXP_VG_LITE_LOG_TRACES -/** Enable logging of VG-Lite traces (\see LV_LOG_ERROR)*/ -#define LV_GPU_NXP_VG_LITE_LOG_TRACES 0 -#endif - - -/* The optimal Bezier control point offset for radial unit - * see: https://spencermortensen.com/articles/bezier-circle/ - **/ -#define BEZIER_OPTIM_CIRCLE 0.551915024494f - -/* Draw lines for control points of Bezier curves */ -#define BEZIER_DBG_CONTROL_POINTS 0 - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/** - * Premultiplies and swizzles given LVGL 32bit color to obtain vglite color. - * - * @param[in/out] vg_col32 The obtained vglite color - * @param[in] lv_col32 The initial LVGL 32bit color - * @param[in] opa The opacity to premultiply with - * @param[in] vg_col_format The format of the resulting vglite color - * - * @retval LV_RES_OK Operation completed - * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) - */ -lv_res_t lv_vglite_premult_and_swizzle(vg_lite_color_t * vg_col32, lv_color32_t lv_col32, lv_opa_t opa, - vg_lite_buffer_format_t vg_col_format); - -/** - * Get vglite blend mode. - * - * @param[in] lv_blend_mode The LVGL blend mode - * - * @retval The vglite blend mode - */ -vg_lite_blend_t lv_vglite_get_blend_mode(lv_blend_mode_t lv_blend_mode); - -/** - * Clear cache and flush command to VG-Lite. - * - * @retval LV_RES_OK Run completed - * @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS) - */ -lv_res_t lv_vglite_run(void); - -/********************** - * MACROS - **********************/ - -#define VG_LITE_COND_STOP(cond, txt) \ - do { \ - if (cond) { \ - LV_LOG_ERROR("%s. STOP!", txt); \ - for ( ; ; ); \ - } \ - } while(0) - -#if LV_GPU_NXP_VG_LITE_LOG_ERRORS -#define VG_LITE_ERR_RETURN_INV(err, fmt, ...) \ - do { \ - if(err != VG_LITE_SUCCESS) { \ - LV_LOG_ERROR(fmt" (err = %d)", \ - err, ##__VA_ARGS__); \ - return LV_RES_INV; \ - } \ - } while (0) -#else -#define VG_LITE_ERR_RETURN_INV(err, fmt, ...) \ - do { \ - if(err != VG_LITE_SUCCESS) { \ - return LV_RES_INV; \ - } \ - }while(0) -#endif /*LV_GPU_NXP_VG_LITE_LOG_ERRORS*/ - -#if LV_GPU_NXP_VG_LITE_LOG_TRACES -#define VG_LITE_LOG_TRACE(fmt, ...) \ - do { \ - LV_LOG(fmt, ##__VA_ARGS__); \ - } while (0) - -#define VG_LITE_RETURN_INV(fmt, ...) \ - do { \ - LV_LOG_ERROR(fmt, ##__VA_ARGS__); \ - return LV_RES_INV; \ - } while (0) -#else -#define VG_LITE_LOG_TRACE(fmt, ...) \ - do { \ - } while (0) -#define VG_LITE_RETURN_INV(fmt, ...) \ - do { \ - return LV_RES_INV; \ - }while(0) -#endif /*LV_GPU_NXP_VG_LITE_LOG_TRACES*/ - -#endif /*LV_USE_GPU_NXP_VG_LITE*/ - -#ifdef __cplusplus -} /*extern "C"*/ -#endif - -#endif /*LV_VGLITE_UTILS_H*/ diff --git a/include/liblvgl/draw/sdl/README.md b/include/liblvgl/draw/sdl/README.md deleted file mode 100644 index 4415ffac..00000000 --- a/include/liblvgl/draw/sdl/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# SDL_Renderer Based Drawing Functions - -In LVGL, drawing was performed by CPU. To improve drawing performance on platforms with GPU, -we should perform drawing operations on GPU if possible. - -This implementation has moved most bitmap blending and drawing procedures to utilize SDL_Renderer, -which takes advantages of hardware acceleration APIs like DirectX or OpenGL. - -This implementation can be also considered as a reference implementation, for contributors wants to -develop accelerated drawing functions with other APIs such as OpenGL/OpenGL ES. - -## Caveats -`lv_draw_arc`, `lv_draw_line` is not enabled, due to incomplete implementation. So lines and arcs will -have significant impact to drawing performances. - -Performance of this implementation still has room to improve. Or we should use more powerful APIs -such as OpenGL. - -## Notices for files - -### `lv_draw_sdl_stack_blur.c` - -Contains modified code from [android-stackblur](https://github.com/kikoso/android-stackblur) project. -Apache License 2.0 - -### `lv_draw_sdl_lru.c`/`lv_draw_sdl_lru.h` - -Contains modified code from [C-LRU-Cache](https://github.com/willcannings/C-LRU-Cache) project. No license defined. \ No newline at end of file diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl.h b/include/liblvgl/draw/sdl/lv_draw_sdl.h index 9b44a7b2..7708d5b7 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl.h @@ -14,7 +14,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl.mk b/include/liblvgl/draw/sdl/lv_draw_sdl.mk deleted file mode 100644 index c5c28b66..00000000 --- a/include/liblvgl/draw/sdl/lv_draw_sdl.mk +++ /dev/null @@ -1,19 +0,0 @@ -CSRCS += lv_draw_sdl.c -CSRCS += lv_draw_sdl_arc.c -CSRCS += lv_draw_sdl_bg.c -CSRCS += lv_draw_sdl_composite.c -CSRCS += lv_draw_sdl_img.c -CSRCS += lv_draw_sdl_label.c -CSRCS += lv_draw_sdl_line.c -CSRCS += lv_draw_sdl_mask.c -CSRCS += lv_draw_sdl_polygon.c -CSRCS += lv_draw_sdl_rect.c -CSRCS += lv_draw_sdl_stack_blur.c -CSRCS += lv_draw_sdl_texture_cache.c -CSRCS += lv_draw_sdl_utils.c -CSRCS += lv_draw_sdl_layer.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sdl" diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_composite.h b/include/liblvgl/draw/sdl/lv_draw_sdl_composite.h index 72a2daef..3a598d76 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_composite.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_composite.h @@ -14,13 +14,13 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include LV_GPU_SDL_INCLUDE_PATH #include "lv_draw_sdl.h" -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_color.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_img.h b/include/liblvgl/draw/sdl/lv_draw_sdl_img.h index 0e270277..d6e3758c 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_img.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_img.h @@ -14,7 +14,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_mask.h b/include/liblvgl/draw/sdl/lv_draw_sdl_mask.h index a562d73d..aa4dd2b8 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_mask.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_mask.h @@ -14,13 +14,13 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include LV_GPU_SDL_INCLUDE_PATH #include "lv_draw_sdl.h" -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_color.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_priv.h b/include/liblvgl/draw/sdl/lv_draw_sdl_priv.h index 24a87621..736fe89f 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_priv.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_priv.h @@ -14,7 +14,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_rect.h b/include/liblvgl/draw/sdl/lv_draw_sdl_rect.h index 3472af31..fc968945 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_rect.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_rect.h @@ -14,7 +14,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL @@ -59,11 +59,6 @@ typedef struct lv_draw_sdl_rect_header_t { SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius); -SDL_Texture * lv_draw_sdl_rect_grad_frag_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad, lv_coord_t w, - lv_coord_t h, lv_coord_t radius); - -SDL_Texture * lv_draw_sdl_rect_grad_strip_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad); - void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture * frag, lv_coord_t frag_size, const lv_area_t * coords, const lv_area_t * clip, bool full); diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_stack_blur.h b/include/liblvgl/draw/sdl/lv_draw_sdl_stack_blur.h index 413b1c94..3d854e3a 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_stack_blur.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_stack_blur.h @@ -13,7 +13,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_texture_cache.h b/include/liblvgl/draw/sdl/lv_draw_sdl_texture_cache.h index 1bbf17cd..0b54246f 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_texture_cache.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_texture_cache.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL @@ -50,7 +50,6 @@ typedef enum { LV_GPU_CACHE_KEY_MAGIC_RECT_BG = 0x31, LV_GPU_CACHE_KEY_MAGIC_RECT_SHADOW = 0x32, LV_GPU_CACHE_KEY_MAGIC_RECT_BORDER = 0x33, - LV_GPU_CACHE_KEY_MAGIC_RECT_GRAD = 0x34, LV_GPU_CACHE_KEY_MAGIC_FONT_GLYPH = 0x41, LV_GPU_CACHE_KEY_MAGIC_MASK = 0x51, } lv_sdl_cache_key_magic_t; diff --git a/include/liblvgl/draw/sdl/lv_draw_sdl_utils.h b/include/liblvgl/draw/sdl/lv_draw_sdl_utils.h index 9afae687..943bda3b 100644 --- a/include/liblvgl/draw/sdl/lv_draw_sdl_utils.h +++ b/include/liblvgl/draw/sdl/lv_draw_sdl_utils.h @@ -13,7 +13,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_GPU_SDL #include "lv_draw_sdl.h" diff --git a/include/liblvgl/draw/stm32_dma2d/lv_draw_stm32_dma2d.mk b/include/liblvgl/draw/stm32_dma2d/lv_draw_stm32_dma2d.mk deleted file mode 100644 index 8ed00b01..00000000 --- a/include/liblvgl/draw/stm32_dma2d/lv_draw_stm32_dma2d.mk +++ /dev/null @@ -1,6 +0,0 @@ -CSRCS += lv_gpu_stm32_dma2d.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/stm32_dma2d" diff --git a/include/liblvgl/draw/stm32_dma2d/lv_gpu_stm32_dma2d.h b/include/liblvgl/draw/stm32_dma2d/lv_gpu_stm32_dma2d.h index 5ecce6de..f2bcdbea 100644 --- a/include/liblvgl/draw/stm32_dma2d/lv_gpu_stm32_dma2d.h +++ b/include/liblvgl/draw/stm32_dma2d/lv_gpu_stm32_dma2d.h @@ -10,83 +10,52 @@ extern "C" { #endif -#include "../../misc/lv_color.h" -#include "../../hal/lv_hal_disp.h" -#include "../sw/lv_draw_sw.h" - -#if LV_USE_GPU_STM32_DMA2D - /********************* * INCLUDES *********************/ -#include LV_GPU_DMA2D_CMSIS_INCLUDE +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/hal/lv_hal_disp.h" +#include "liblvgl/draw/sw/lv_draw_sw.h" + +#if LV_USE_GPU_STM32_DMA2D /********************* * DEFINES *********************/ -#if defined(LV_STM32_DMA2D_TEST) -// removes "static" modifier for some internal methods in order to test them -#define LV_STM32_DMA2D_STATIC -#else -#define LV_STM32_DMA2D_STATIC static -#endif + +#define LV_DMA2D_ARGB8888 0 +#define LV_DMA2D_RGB888 1 +#define LV_DMA2D_RGB565 2 +#define LV_DMA2D_ARGB1555 3 +#define LV_DMA2D_ARGB4444 4 /********************** * TYPEDEFS **********************/ -enum dma2d_color_format { - ARGB8888 = 0x0, - RGB888 = 0x01, - RGB565 = 0x02, - ARGB1555 = 0x03, - ARGB4444 = 0x04, - A8 = 0x09, - UNSUPPORTED = 0xff, -}; -typedef enum dma2d_color_format dma2d_color_format_t; typedef lv_draw_sw_ctx_t lv_draw_stm32_dma2d_ctx_t; + struct _lv_disp_drv_t; /********************** * GLOBAL PROTOTYPES **********************/ + +/** + * Turn on the peripheral and set output color mode, this only needs to be done once + */ void lv_draw_stm32_dma2d_init(void); + void lv_draw_stm32_dma2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx); + void lv_draw_stm32_dma2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx); -static void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc); -static void lv_draw_stm32_dma2d_buffer_copy(lv_draw_ctx_t * draw_ctx, - void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area, - void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area); -static lv_res_t lv_draw_stm32_dma2d_img(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * img_dsc, - const lv_area_t * src_area, const void * src); -static void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx); -static void lv_draw_stm32_dma2d_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * img_dsc, - const lv_area_t * coords, const uint8_t * src_buf, lv_img_cf_t color_format); -static dma2d_color_format_t lv_color_format_to_dma2d_color_format(lv_img_cf_t color_format); -static lv_point_t lv_area_get_offset(const lv_area_t * area1, const lv_area_t * area2); -/********************** - * STATIC PROTOTYPES - **********************/ -LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_fill(const lv_color_t * dst_buf, lv_coord_t dst_stride, - const lv_area_t * draw_area, lv_color_t color, lv_opa_t opa); -LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_map(const lv_color_t * dest_buf, lv_coord_t dest_stride, - const lv_area_t * draw_area, const void * src_buf, lv_coord_t src_stride, const lv_point_t * src_offset, lv_opa_t opa, - dma2d_color_format_t src_color_format, bool ignore_src_alpha); -LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_paint(const lv_color_t * dst_buf, lv_coord_t dst_stride, - const lv_area_t * draw_area, const lv_opa_t * mask_buf, lv_coord_t mask_stride, const lv_point_t * mask_offset, - lv_color_t color, lv_opa_t opa); -LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * dest_buf, lv_coord_t dest_stride, - const lv_area_t * draw_area, const lv_color_t * src_buf, lv_coord_t src_stride, const lv_point_t * src_offset); -LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_await_dma_transfer_finish(lv_disp_drv_t * disp_drv); -LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_start_dma_transfer(void); -LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address, lv_coord_t offset, - lv_coord_t width, lv_coord_t height, uint8_t pixel_size); -LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_clean_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, - lv_coord_t height, uint8_t pixel_size); -LV_STM32_DMA2D_STATIC bool _lv_gpu_stm32_dwt_init(void); -LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dwt_reset(void); -LV_STM32_DMA2D_STATIC uint32_t _lv_gpu_stm32_dwt_get_us(void); +void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc); + +void lv_draw_stm32_dma2d_buffer_copy(lv_draw_ctx_t * draw_ctx, + void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area, + void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area); + +void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx); /********************** * MACROS diff --git a/include/liblvgl/draw/sw/lv_draw_sw.h b/include/liblvgl/draw/sw/lv_draw_sw.h index 1618649c..4496612d 100644 --- a/include/liblvgl/draw/sw/lv_draw_sw.h +++ b/include/liblvgl/draw/sw/lv_draw_sw.h @@ -14,10 +14,10 @@ extern "C" { * INCLUDES *********************/ #include "lv_draw_sw_blend.h" -#include "../lv_draw.h" -#include "../../misc/lv_area.h" -#include "../../misc/lv_color.h" -#include "../../hal/lv_hal_disp.h" +#include "liblvgl/draw/lv_draw.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/hal/lv_hal_disp.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/sw/lv_draw_sw.mk b/include/liblvgl/draw/sw/lv_draw_sw.mk deleted file mode 100644 index 4625cbcf..00000000 --- a/include/liblvgl/draw/sw/lv_draw_sw.mk +++ /dev/null @@ -1,17 +0,0 @@ -CSRCS += lv_draw_sw.c -CSRCS += lv_draw_sw_arc.c -CSRCS += lv_draw_sw_blend.c -CSRCS += lv_draw_sw_dither.c -CSRCS += lv_draw_sw_gradient.c -CSRCS += lv_draw_sw_img.c -CSRCS += lv_draw_sw_letter.c -CSRCS += lv_draw_sw_line.c -CSRCS += lv_draw_sw_polygon.c -CSRCS += lv_draw_sw_rect.c -CSRCS += lv_draw_sw_transform.c -CSRCS += lv_draw_sw_layer.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sw -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sw - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/sw" diff --git a/include/liblvgl/draw/sw/lv_draw_sw_blend.h b/include/liblvgl/draw/sw/lv_draw_sw_blend.h index 9a00e533..6fa859c9 100644 --- a/include/liblvgl/draw/sw/lv_draw_sw_blend.h +++ b/include/liblvgl/draw/sw/lv_draw_sw_blend.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_color.h" -#include "../../misc/lv_area.h" -#include "../../misc/lv_style.h" -#include "../lv_draw_mask.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_style.h" +#include "liblvgl/draw/lv_draw_mask.h" /********************* * DEFINES diff --git a/include/liblvgl/draw/sw/lv_draw_sw_dither.h b/include/liblvgl/draw/sw/lv_draw_sw_dither.h index 6362c5ac..9785e187 100644 --- a/include/liblvgl/draw/sw/lv_draw_sw_dither.h +++ b/include/liblvgl/draw/sw/lv_draw_sw_dither.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../core/lv_obj_pos.h" +#include "liblvgl/core/lv_obj_pos.h" /********************* diff --git a/include/liblvgl/draw/sw/lv_draw_sw_gradient.h b/include/liblvgl/draw/sw/lv_draw_sw_gradient.h index f5f3215c..0860d50d 100644 --- a/include/liblvgl/draw/sw/lv_draw_sw_gradient.h +++ b/include/liblvgl/draw/sw/lv_draw_sw_gradient.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_color.h" -#include "../../misc/lv_style.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_style.h" #include "lv_draw_sw_dither.h" /********************* diff --git a/include/liblvgl/draw/swm341_dma2d/lv_draw_swm341_dma2d.mk b/include/liblvgl/draw/swm341_dma2d/lv_draw_swm341_dma2d.mk deleted file mode 100644 index bc19e380..00000000 --- a/include/liblvgl/draw/swm341_dma2d/lv_draw_swm341_dma2d.mk +++ /dev/null @@ -1,6 +0,0 @@ -CSRCS += lv_gpu_swm341_dma2d.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/swm341_dma2d -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/swm341_dma2d - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/swm341_dma2d" diff --git a/include/liblvgl/draw/swm341_dma2d/lv_gpu_swm341_dma2d.h b/include/liblvgl/draw/swm341_dma2d/lv_gpu_swm341_dma2d.h index 20b89226..baec7fea 100644 --- a/include/liblvgl/draw/swm341_dma2d/lv_gpu_swm341_dma2d.h +++ b/include/liblvgl/draw/swm341_dma2d/lv_gpu_swm341_dma2d.h @@ -13,9 +13,9 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../misc/lv_color.h" -#include "../../hal/lv_hal_disp.h" -#include "../sw/lv_draw_sw.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/hal/lv_hal_disp.h" +#include "liblvgl/draw/sw/lv_draw_sw.h" #if LV_USE_GPU_SWM341_DMA2D diff --git a/include/liblvgl/extra/README.md b/include/liblvgl/extra/README.md deleted file mode 100644 index 80bb49d4..00000000 --- a/include/liblvgl/extra/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Extra components - -This directory contains extra (optional) components to lvgl. -It's a good place for contributions as there are less strict expectations about the completeness and flexibility of the components here. - -In other words, if you have created a complex widget from other widgets, or modified an existing widget with special events, styles or animations, or have a new feature that could work as a plugin to lvgl feel free to the share it here. - -## How to contribute -- Create a [Pull request](https://docs.lvgl.io/8.0/CONTRIBUTING.html#pull-request) with your new content -- Please and follow the [Coding style](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md) of LVGL -- Add setter/getter functions in pair -- Update [lv_conf_template.h](https://github.com/lvgl/lvgl/blob/master/lv_conf_template.h) -- Add description in the [docs](https://github.com/lvgl/lvgl/tree/master/docs) -- Add [examples](https://github.com/lvgl/lvgl/tree/master/examples) -- Update the [changelog](https://github.com/lvgl/lvgl/tree/master/docs/CHANGELOG.md) -- Add yourself to the [Contributors](#contributors) section below. - -## Ideas -Here some ideas as inspiration feel free to contribute with ideas too. -- New [Calendar headers](https://github.com/lvgl/lvgl/tree/master/src/extra/widgets/calendar) -- Color picker with RGB and or HSV bars -- Ruler, horizontal or vertical with major and minor ticks and labels -- New [List items types](https://github.com/lvgl/lvgl/tree/master/src/extra/widgets/list) -- [Preloaders](https://www.google.com/search?q=preloader&sxsrf=ALeKk01ddA4YB0WEgLLN1bZNSm8YER7pkg:1623080551559&source=lnms&tbm=isch&sa=X&ved=2ahUKEwiwoN6d7oXxAhVuw4sKHVedBB4Q_AUoAXoECAEQAw&biw=952&bih=940) -- Drop-down list with a container to which content can be added -- 9 patch button: Similar to [lv_imgbtn](https://docs.lvgl.io/8.0/widgets/extra/imgbtn.html) but 9 images for 4 corner, 4 sides and the center - -## Contributors -- lv_animimg: @ZhaoQiang-b45475 -- lv_span: @guoweilkd -- lv_menu: @HX2003 \ No newline at end of file diff --git a/include/liblvgl/extra/layouts/flex/lv_flex.h b/include/liblvgl/extra/layouts/flex/lv_flex.h index 58c3221e..d9619610 100644 --- a/include/liblvgl/extra/layouts/flex/lv_flex.h +++ b/include/liblvgl/extra/layouts/flex/lv_flex.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_FLEX /********************* diff --git a/include/liblvgl/extra/layouts/grid/lv_grid.h b/include/liblvgl/extra/layouts/grid/lv_grid.h index 5c4f7672..8e57fd9c 100644 --- a/include/liblvgl/extra/layouts/grid/lv_grid.h +++ b/include/liblvgl/extra/layouts/grid/lv_grid.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_GRID /********************* diff --git a/include/liblvgl/extra/libs/bmp/lv_bmp.h b/include/liblvgl/extra/libs/bmp/lv_bmp.h index db1e5409..3d9e9484 100644 --- a/include/liblvgl/extra/libs/bmp/lv_bmp.h +++ b/include/liblvgl/extra/libs/bmp/lv_bmp.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_BMP /********************* diff --git a/include/liblvgl/extra/libs/ffmpeg/lv_ffmpeg.h b/include/liblvgl/extra/libs/ffmpeg/lv_ffmpeg.h index 8c7fc26b..f3a365c3 100644 --- a/include/liblvgl/extra/libs/ffmpeg/lv_ffmpeg.h +++ b/include/liblvgl/extra/libs/ffmpeg/lv_ffmpeg.h @@ -12,7 +12,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_FFMPEG != 0 /********************* diff --git a/include/liblvgl/extra/libs/freetype/arial.ttf b/include/liblvgl/extra/libs/freetype/arial.ttf deleted file mode 100644 index 886789b8..00000000 Binary files a/include/liblvgl/extra/libs/freetype/arial.ttf and /dev/null differ diff --git a/include/liblvgl/extra/libs/freetype/lv_freetype.h b/include/liblvgl/extra/libs/freetype/lv_freetype.h index 247a7fb7..e576c2e1 100644 --- a/include/liblvgl/extra/libs/freetype/lv_freetype.h +++ b/include/liblvgl/extra/libs/freetype/lv_freetype.h @@ -12,7 +12,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_FREETYPE /********************* diff --git a/include/liblvgl/extra/libs/fsdrv/lv_fsdrv.h b/include/liblvgl/extra/libs/fsdrv/lv_fsdrv.h index 285d598f..2b0adfd0 100644 --- a/include/liblvgl/extra/libs/fsdrv/lv_fsdrv.h +++ b/include/liblvgl/extra/libs/fsdrv/lv_fsdrv.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" /********************* * DEFINES diff --git a/include/liblvgl/extra/libs/gif/gifdec.h b/include/liblvgl/extra/libs/gif/gifdec.h index b68fab5d..eaa4cadd 100644 --- a/include/liblvgl/extra/libs/gif/gifdec.h +++ b/include/liblvgl/extra/libs/gif/gifdec.h @@ -2,7 +2,7 @@ #define GIFDEC_H #include -#include "../../../misc/lv_fs.h" +#include "liblvgl/misc/lv_fs.h" #if LV_USE_GIF @@ -29,7 +29,7 @@ typedef struct gd_GIF { int32_t anim_start; uint16_t width, height; uint16_t depth; - int32_t loop_count; + uint16_t loop_count; gd_GCE gce; gd_Palette *palette; gd_Palette lct, gct; diff --git a/include/liblvgl/extra/libs/gif/lv_gif.h b/include/liblvgl/extra/libs/gif/lv_gif.h index d8c93dbc..b40b690a 100644 --- a/include/liblvgl/extra/libs/gif/lv_gif.h +++ b/include/liblvgl/extra/libs/gif/lv_gif.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_GIF #include "gifdec.h" diff --git a/include/liblvgl/extra/libs/png/lodepng.h b/include/liblvgl/extra/libs/png/lodepng.h index dbfed72e..4068d4b1 100644 --- a/include/liblvgl/extra/libs/png/lodepng.h +++ b/include/liblvgl/extra/libs/png/lodepng.h @@ -28,7 +28,7 @@ freely, subject to the following restrictions: #include /*for size_t*/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_PNG extern const char* LODEPNG_VERSION_STRING; diff --git a/include/liblvgl/extra/libs/png/lv_png.h b/include/liblvgl/extra/libs/png/lv_png.h index 43804723..ef634540 100644 --- a/include/liblvgl/extra/libs/png/lv_png.h +++ b/include/liblvgl/extra/libs/png/lv_png.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_PNG /********************* diff --git a/include/liblvgl/extra/libs/qrcode/lv_qrcode.h b/include/liblvgl/extra/libs/qrcode/lv_qrcode.h index b0752ace..c8db4e5e 100644 --- a/include/liblvgl/extra/libs/qrcode/lv_qrcode.h +++ b/include/liblvgl/extra/libs/qrcode/lv_qrcode.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_QRCODE /********************* diff --git a/include/liblvgl/extra/libs/rlottie/lv_rlottie.h b/include/liblvgl/extra/libs/rlottie/lv_rlottie.h index d66dc22c..a8aca7bc 100644 --- a/include/liblvgl/extra/libs/rlottie/lv_rlottie.h +++ b/include/liblvgl/extra/libs/rlottie/lv_rlottie.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_RLOTTIE /********************* diff --git a/include/liblvgl/extra/libs/sjpg/tjpgd.h b/include/liblvgl/extra/libs/sjpg/tjpgd.h index b255ccfc..866e6b32 100644 --- a/include/liblvgl/extra/libs/sjpg/tjpgd.h +++ b/include/liblvgl/extra/libs/sjpg/tjpgd.h @@ -8,7 +8,7 @@ extern "C" { #endif -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_SJPG #include "tjpgdcnf.h" diff --git a/include/liblvgl/extra/lv_extra.mk b/include/liblvgl/extra/lv_extra.mk deleted file mode 100644 index 1afcc7b7..00000000 --- a/include/liblvgl/extra/lv_extra.mk +++ /dev/null @@ -1 +0,0 @@ -CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra -name \*.c) diff --git a/include/liblvgl/extra/others/fragment/README.md b/include/liblvgl/extra/others/fragment/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/include/liblvgl/extra/others/fragment/lv_fragment.h b/include/liblvgl/extra/others/fragment/lv_fragment.h index da30b39a..9b7312f8 100644 --- a/include/liblvgl/extra/others/fragment/lv_fragment.h +++ b/include/liblvgl/extra/others/fragment/lv_fragment.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_FRAGMENT -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/extra/others/gridnav/lv_gridnav.h b/include/liblvgl/extra/others/gridnav/lv_gridnav.h index f480ded4..89391208 100644 --- a/include/liblvgl/extra/others/gridnav/lv_gridnav.h +++ b/include/liblvgl/extra/others/gridnav/lv_gridnav.h @@ -53,7 +53,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_GRIDNAV diff --git a/include/liblvgl/extra/others/ime/lv_ime_pinyin.h b/include/liblvgl/extra/others/ime/lv_ime_pinyin.h index 3ff7bb98..2d70d293 100644 --- a/include/liblvgl/extra/others/ime/lv_ime_pinyin.h +++ b/include/liblvgl/extra/others/ime/lv_ime_pinyin.h @@ -12,7 +12,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_IME_PINYIN != 0 diff --git a/include/liblvgl/extra/others/imgfont/lv_imgfont.h b/include/liblvgl/extra/others/imgfont/lv_imgfont.h index 5069b62f..4fb6f78b 100644 --- a/include/liblvgl/extra/others/imgfont/lv_imgfont.h +++ b/include/liblvgl/extra/others/imgfont/lv_imgfont.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_IMGFONT diff --git a/include/liblvgl/extra/others/monkey/lv_monkey.h b/include/liblvgl/extra/others/monkey/lv_monkey.h index bf5e13c6..589daf1d 100644 --- a/include/liblvgl/extra/others/monkey/lv_monkey.h +++ b/include/liblvgl/extra/others/monkey/lv_monkey.h @@ -12,7 +12,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "liblvgl/lvgl.h" #if LV_USE_MONKEY != 0 diff --git a/include/liblvgl/extra/others/msg/lv_msg.h b/include/liblvgl/extra/others/msg/lv_msg.h index 0ac2f77d..64dc0d45 100644 --- a/include/liblvgl/extra/others/msg/lv_msg.h +++ b/include/liblvgl/extra/others/msg/lv_msg.h @@ -13,14 +13,12 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_MSG /********************* * DEFINES *********************/ -#define LV_MSG_ID_ANY UINT32_MAX -LV_EXPORT_CONST_INT(LV_MSG_ID_ANY); /********************** * TYPEDEFS @@ -72,14 +70,6 @@ void * lv_msg_subsribe_obj(uint32_t msg_id, lv_obj_t * obj, void * user_data); */ void lv_msg_unsubscribe(void * s); -/** - * Unsubscribe an object from a message ID - * @param msg_id the message ID to unsubcribe from or `LV_MSG_ID_ANY` for any message ID - * @param obj the object to unsubscribe or NULL for any object - * @return number of unsubscriptions - */ -uint32_t lv_msg_unsubscribe_obj(uint32_t msg_id, lv_obj_t * obj); - /** * Send a message with a given ID and payload * @param msg_id ID of the message to send @@ -115,17 +105,6 @@ void * lv_msg_get_user_data(lv_msg_t * m); */ lv_msg_t * lv_event_get_msg(lv_event_t * e); -/*Fix typo*/ -static inline void * lv_msg_subscribe(uint32_t msg_id, lv_msg_subscribe_cb_t cb, void * user_data) -{ - return lv_msg_subsribe(msg_id, cb, user_data); -} - -static inline void * lv_msg_subscribe_obj(uint32_t msg_id, lv_obj_t * obj, void * user_data) -{ - return lv_msg_subsribe_obj(msg_id, obj, user_data); -} - /********************** * GLOBAL VARIABLES **********************/ diff --git a/include/liblvgl/extra/others/snapshot/lv_snapshot.h b/include/liblvgl/extra/others/snapshot/lv_snapshot.h index 64519263..33d97412 100644 --- a/include/liblvgl/extra/others/snapshot/lv_snapshot.h +++ b/include/liblvgl/extra/others/snapshot/lv_snapshot.h @@ -16,8 +16,8 @@ extern "C" { #include #include -#include "../../../lv_conf_internal.h" -#include "../../../core/lv_obj.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/extra/themes/basic/lv_theme_basic.h b/include/liblvgl/extra/themes/basic/lv_theme_basic.h index 93a8fa84..06d6828b 100644 --- a/include/liblvgl/extra/themes/basic/lv_theme_basic.h +++ b/include/liblvgl/extra/themes/basic/lv_theme_basic.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_THEME_BASIC diff --git a/include/liblvgl/extra/themes/default/lv_theme_default.h b/include/liblvgl/extra/themes/default/lv_theme_default.h index 5b1fd918..7fab5be4 100644 --- a/include/liblvgl/extra/themes/default/lv_theme_default.h +++ b/include/liblvgl/extra/themes/default/lv_theme_default.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_THEME_DEFAULT diff --git a/include/liblvgl/extra/themes/mono/lv_theme_mono.h b/include/liblvgl/extra/themes/mono/lv_theme_mono.h index 10b8f186..3d907fff 100644 --- a/include/liblvgl/extra/themes/mono/lv_theme_mono.h +++ b/include/liblvgl/extra/themes/mono/lv_theme_mono.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../../../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_THEME_MONO diff --git a/include/liblvgl/extra/widgets/animimg/lv_animimg.h b/include/liblvgl/extra/widgets/animimg/lv_animimg.h index 5b17f0a3..9ffe6217 100644 --- a/include/liblvgl/extra/widgets/animimg/lv_animimg.h +++ b/include/liblvgl/extra/widgets/animimg/lv_animimg.h @@ -37,7 +37,7 @@ typedef struct { lv_img_t img; lv_anim_t anim; /*picture sequence */ - const void ** dsc; + lv_img_dsc_t ** dsc; int8_t pic_count; } lv_animimg_t; @@ -69,7 +69,7 @@ lv_obj_t * lv_animimg_create(lv_obj_t * parent); * @param dsc pointer to a series images * @param num images' number */ -void lv_animimg_set_src(lv_obj_t * img, const void * dsc[], uint8_t num); +void lv_animimg_set_src(lv_obj_t * img, lv_img_dsc_t * dsc[], uint8_t num); /** * Startup the image animation. diff --git a/include/liblvgl/extra/widgets/list/lv_list.h b/include/liblvgl/extra/widgets/list/lv_list.h index 6142aac8..e9bb6266 100644 --- a/include/liblvgl/extra/widgets/list/lv_list.h +++ b/include/liblvgl/extra/widgets/list/lv_list.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ #include "liblvgl/core/lv_obj.h" -#include "../../layouts/flex/lv_flex.h" +#include "liblvgl/extra/layouts/flex/lv_flex.h" #if LV_USE_LIST diff --git a/include/liblvgl/font/korean.ttf b/include/liblvgl/font/korean.ttf deleted file mode 100644 index e0ec117a..00000000 Binary files a/include/liblvgl/font/korean.ttf and /dev/null differ diff --git a/include/liblvgl/font/lv_font.h b/include/liblvgl/font/lv_font.h index d32902d1..3c0a689e 100644 --- a/include/liblvgl/font/lv_font.h +++ b/include/liblvgl/font/lv_font.h @@ -271,11 +271,6 @@ LV_FONT_DECLARE(pros_font_dejavu_mono_40); LV_FONT_DECLARE(pros_font_dejavu_mono_40_latin_sup); #endif -/*Declare the custom (user defined) fonts*/ -#ifdef LV_FONT_CUSTOM_DECLARE -LV_FONT_CUSTOM_DECLARE -#endif - /** * Just a wrapper around LV_FONT_DEFAULT because it might be more convenient to use a function in some cases * @return pointer to LV_FONT_DEFAULT diff --git a/include/liblvgl/font/lv_font.mk b/include/liblvgl/font/lv_font.mk deleted file mode 100644 index 2201b73f..00000000 --- a/include/liblvgl/font/lv_font.mk +++ /dev/null @@ -1,36 +0,0 @@ -CSRCS += lv_font.c -CSRCS += lv_font_fmt_txt.c -CSRCS += lv_font_loader.c - -CSRCS += lv_font_dejavu_16_persian_hebrew.c -CSRCS += lv_font_montserrat_8.c -CSRCS += lv_font_montserrat_10.c -CSRCS += lv_font_montserrat_12.c -CSRCS += lv_font_montserrat_12_subpx.c -CSRCS += lv_font_montserrat_14.c -CSRCS += lv_font_montserrat_16.c -CSRCS += lv_font_montserrat_18.c -CSRCS += lv_font_montserrat_20.c -CSRCS += lv_font_montserrat_22.c -CSRCS += lv_font_montserrat_24.c -CSRCS += lv_font_montserrat_26.c -CSRCS += lv_font_montserrat_28.c -CSRCS += lv_font_montserrat_28_compressed.c -CSRCS += lv_font_montserrat_30.c -CSRCS += lv_font_montserrat_32.c -CSRCS += lv_font_montserrat_34.c -CSRCS += lv_font_montserrat_36.c -CSRCS += lv_font_montserrat_38.c -CSRCS += lv_font_montserrat_40.c -CSRCS += lv_font_montserrat_42.c -CSRCS += lv_font_montserrat_44.c -CSRCS += lv_font_montserrat_46.c -CSRCS += lv_font_montserrat_48.c -CSRCS += lv_font_simsun_16_cjk.c -CSRCS += lv_font_unscii_8.c -CSRCS += lv_font_unscii_16.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font" diff --git a/include/liblvgl/font/lv_symbol_def.h b/include/liblvgl/font/lv_symbol_def.h index 696daf18..1055392d 100644 --- a/include/liblvgl/font/lv_symbol_def.h +++ b/include/liblvgl/font/lv_symbol_def.h @@ -5,7 +5,7 @@ extern "C" { #endif -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" /*------------------------------- * Symbols from "normal" font diff --git a/include/liblvgl/hal/lv_hal.mk b/include/liblvgl/hal/lv_hal.mk deleted file mode 100644 index c35ec2d7..00000000 --- a/include/liblvgl/hal/lv_hal.mk +++ /dev/null @@ -1,8 +0,0 @@ -CSRCS += lv_hal_disp.c -CSRCS += lv_hal_indev.c -CSRCS += lv_hal_tick.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/hal -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/hal - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/hal" diff --git a/include/liblvgl/hal/lv_hal_disp.h b/include/liblvgl/hal/lv_hal_disp.h index d3425fe4..5b36916c 100644 --- a/include/liblvgl/hal/lv_hal_disp.h +++ b/include/liblvgl/hal/lv_hal_disp.h @@ -18,11 +18,11 @@ extern "C" { #include #include #include "lv_hal.h" -#include "../draw/lv_draw.h" -#include "../misc/lv_color.h" -#include "../misc/lv_area.h" -#include "../misc/lv_ll.h" -#include "../misc/lv_timer.h" +#include "liblvgl/draw/lv_draw.h" +#include "liblvgl/misc/lv_color.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_ll.h" +#include "liblvgl/misc/lv_timer.h" /********************* * DEFINES diff --git a/include/liblvgl/hal/lv_hal_indev.h b/include/liblvgl/hal/lv_hal_indev.h index 5bbcf530..630d471a 100644 --- a/include/liblvgl/hal/lv_hal_indev.h +++ b/include/liblvgl/hal/lv_hal_indev.h @@ -15,12 +15,12 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include -#include "../misc/lv_area.h" -#include "../misc/lv_timer.h" +#include "liblvgl/misc/lv_area.h" +#include "liblvgl/misc/lv_timer.h" /********************* * DEFINES @@ -141,7 +141,6 @@ typedef struct _lv_indev_proc_t { struct { /*Pointer and button data*/ lv_point_t act_point; /**< Current point of input device.*/ - lv_point_t indev_point; lv_point_t last_point; /**< Last point of input device.*/ lv_point_t last_raw_point; /**< Last point read from read_cb. */ lv_point_t vect; /**< Difference between `act_point` and `last_point`.*/ diff --git a/include/liblvgl/hal/lv_hal_tick.h b/include/liblvgl/hal/lv_hal_tick.h index 949f56b8..407fa427 100644 --- a/include/liblvgl/hal/lv_hal_tick.h +++ b/include/liblvgl/hal/lv_hal_tick.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include diff --git a/include/liblvgl/lv_conf.h b/include/liblvgl/lv_conf.h index d4763fd0..a7b8bf08 100644 --- a/include/liblvgl/lv_conf.h +++ b/include/liblvgl/lv_conf.h @@ -383,25 +383,25 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i * https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 0 #define LV_FONT_MONTSERRAT_10 1 -#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_14 1 -#define LV_FONT_MONTSERRAT_16 0 -#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_16 1 +#define LV_FONT_MONTSERRAT_18 1 #define LV_FONT_MONTSERRAT_20 1 #define LV_FONT_MONTSERRAT_22 0 -#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_24 1 #define LV_FONT_MONTSERRAT_26 0 #define LV_FONT_MONTSERRAT_28 0 #define LV_FONT_MONTSERRAT_30 1 #define LV_FONT_MONTSERRAT_32 0 #define LV_FONT_MONTSERRAT_34 0 -#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_36 1 #define LV_FONT_MONTSERRAT_38 0 #define LV_FONT_MONTSERRAT_40 1 -#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_42 1 #define LV_FONT_MONTSERRAT_44 0 #define LV_FONT_MONTSERRAT_46 0 -#define LV_FONT_MONTSERRAT_48 0 +#define LV_FONT_MONTSERRAT_48 1 /* Demonstrate special features */ #define LV_FONT_MONTSERRAT_12_SUBPX 0 @@ -495,6 +495,8 @@ typedef void * lv_font_user_data_t; #define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_10 #define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_30 +#define CONFIG_LV_THEME_DEFAULT_DARK 1 + /*================= * Text settings *=================*/ diff --git a/include/liblvgl/lv_conf.old.h b/include/liblvgl/lv_conf.old.h new file mode 100644 index 00000000..16deedde --- /dev/null +++ b/include/liblvgl/lv_conf.old.h @@ -0,0 +1,341 @@ +/** + * @file lv_conf.h + * + */ + +#ifndef LV_CONF_H +#define LV_CONF_H + +/*---------------- + * Dynamic memory + *----------------*/ + +/* Memory size which will be used by the library + * to store the graphical objects and other data */ +#define LV_MEM_CUSTOM \ + 0 /*1: use custom malloc/free, 0: use the built-in \ + lv_mem_alloc/lv_mem_free*/ +#if LV_MEM_CUSTOM == 0 +#define LV_MEM_SIZE \ + (32U * 1024U) /*Size memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ +#define LV_MEM_ATTR /*Complier prefix for big array declaration*/ +#define LV_MEM_AUTO_DEFRAG 1 /*Automatically defrag on free*/ +#else /*LV_MEM_CUSTOM*/ +#define LV_MEM_CUSTOM_INCLUDE \ + /*Header for the dynamic memory function*/ +#define LV_MEM_CUSTOM_ALLOC kmalloc /*Wrapper to malloc*/ +#define LV_MEM_CUSTOM_FREE kfree /*Wrapper to free*/ +#endif /*LV_MEM_CUSTOM*/ +#define LV_ENABLE_GC 0 + +/*=================== + Graphical settings + *===================*/ + +/* Horizontal and vertical resolution of the library.*/ +#define LV_HOR_RES (480) +#define LV_VER_RES (240) +#define LV_DPI 126 + +/* Size of VDB (Virtual Display Buffer: the internal graphics buffer). + * Required for buffered drawing, opacity and anti-aliasing + * VDB makes the double buffering, you don't need to deal with it! + * Typical size: ~1/10 screen */ +#define LV_VDB_SIZE \ + (LV_VER_RES * \ + LV_HOR_RES) /*Size of VDB in pixel count (1/10 screen size is good for \ + first)*/ +#define LV_VDB_ADR \ + 0 /*Place VDB to a specific address (e.g. in external RAM) (0: allocate \ + automatically into RAM)*/ + +/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing + * (optional) + * The flushing should use DMA to write the frame buffer in the background*/ +#define LV_VDB_DOUBLE 0 /*1: Enable the use of 2 VDBs*/ +#define LV_VDB2_ADR \ + 0 /*Place VDB2 to a specific address (e.g. in external RAM) (0: allocate \ + automatically into RAM)*/ + +/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ +#define LV_ANTIALIAS 1 /*1: Enable anti-aliasing*/ + +/*Screen refresh settings*/ +#define LV_REFR_PERIOD 40 /*Screen refresh period in milliseconds*/ +#define LV_INV_FIFO_SIZE 32 /*The average count of objects on a screen */ + +/*================= + Misc. setting + *=================*/ + +/*Input device settings*/ +#define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/ +#define LV_INDEV_POINT_MARKER \ + 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/ +#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */ +#define LV_INDEV_DRAG_THROW \ + 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ +#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ +#define LV_INDEV_LONG_PRESS_REP_TIME \ + 100 /*Repeated trigger period in long press [ms] */ + +/*Color settings*/ +#define LV_COLOR_DEPTH 32 /*Color depth: 1/8/16/24*/ +#define LV_COLOR_TRANSP \ + LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma \ + keying)*/ + +/*Text settings*/ +#define LV_TXT_UTF8 1 /*Enable UTF-8 coded Unicode character usage */ +#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/ +#define LV_TXT_LINE_BREAK_LONG_LEN 12 +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 1 + +/*Graphics feature usage*/ +#define USE_LV_ANIMATION 1 /*1: Enable all animations*/ +#define USE_LV_SHADOW 1 /*1: Enable shadows*/ +#define USE_LV_GROUP 1 /*1: Enable object groups (for keyboards)*/ +#define USE_LV_GPU 0 /*1: Enable GPU interface*/ +#define USE_LV_REAL_DRAW \ + 1 /*1: Enable function which draw directly to the frame buffer instead of \ + VDB (required if LV_VDB_SIZE = 0)*/ +#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/ +#define USE_LV_MULTI_LANG 1 + +/*Compiler attributes*/ +#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment \ + function */ +#define LV_ATTRIBUTE_TASK_HANDLER +#define LV_ATTRIBUTE_MEM_ALIGN +#define LV_COMPILER_VLA_SUPPORTED 1 +#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 + +#define USE_LV_LOG 0 +/*================ + * THEME USAGE + *================*/ +#define LV_THEME_LIVE_UPDATE 1 +#define USE_LV_THEME_TEMPL 0 /*Just for test*/ +#define USE_LV_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/ +#define USE_LV_THEME_ALIEN 1 /*Dark futuristic theme*/ +#define USE_LV_THEME_NIGHT 1 /*Dark elegant theme*/ +#define USE_LV_THEME_MONO 1 /*Mono color theme for monochrome displays*/ +#define USE_LV_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/ +#define USE_LV_THEME_ZEN 1 /*Peaceful, mainly light theme */ + +/*================== + * FONT USAGE + *===================*/ + +/* More info about fonts: https://littlevgl.com/basics#fonts + * To enable a built-in font use 1,2,4 or 8 values + * which will determine the bit-per-pixel */ +#define LV_FONT_DEFAULT \ + &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/ + +#define USE_LV_FONT_DEJAVU_10 4 +#define USE_LV_FONT_DEJAVU_10_LATIN_SUP 4 +#define USE_LV_FONT_DEJAVU_10_CYRILLIC 4 +#define USE_LV_FONT_SYMBOL_10 4 + +#define USE_LV_FONT_DEJAVU_20 4 +#define USE_LV_FONT_DEJAVU_20_LATIN_SUP 4 +#define USE_LV_FONT_DEJAVU_20_CYRILLIC 4 +#define USE_LV_FONT_SYMBOL_20 4 + +#define USE_LV_FONT_DEJAVU_30 0 +#define USE_LV_FONT_DEJAVU_30_LATIN_SUP 0 +#define USE_LV_FONT_DEJAVU_30_CYRILLIC 0 +#define USE_LV_FONT_SYMBOL_30 0 + +#define USE_LV_FONT_DEJAVU_40 0 +#define USE_LV_FONT_DEJAVU_40_LATIN_SUP 0 +#define USE_LV_FONT_DEJAVU_40_CYRILLIC 0 +#define USE_LV_FONT_SYMBOL_40 0 + +/* PROS adds the mono variant of DejaVu sans */ +#define USE_PROS_FONT_DEJAVU_MONO_10 4 +#define USE_PROS_FONT_DEJAVU_MONO_10_LATIN_SUP 4 + +#define USE_PROS_FONT_DEJAVU_MONO_20 4 +#define USE_PROS_FONT_DEJAVU_MONO_LATIN_SUP_20 4 + +#define USE_PROS_FONT_DEJAVU_MONO_30 0 +#define USE_PROS_FONT_DEJAVU_MONO_30_LATIN_SUP 0 + +#define USE_PROS_FONT_DEJAVU_MONO_40 0 +#define USE_PROS_FONT_DEJAVU_MONO_40_LATIN_SUP 0 + +/*=================== + * LV_OBJ SETTINGS + *==================*/ +#define LV_OBJ_FREE_NUM_TYPE \ + uint32_t /*Type of free number attribute (comment out disable free number)*/ +#define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/ + +/*================== + * LV OBJ X USAGE + *================*/ +/* + * Documentation of the object types: https://littlevgl.com/object-types + */ + +/***************** + * Simple object + *****************/ + +/*Label (dependencies: -*/ +#define USE_LV_LABEL 1 +#if USE_LV_LABEL != 0 +#define LV_LABEL_SCROLL_SPEED \ + 25 /*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_SCROLL/ROLL' \ + mode*/ +#endif + +/*Image (dependencies: lv_label*/ +#define USE_LV_IMG 1 +#if USE_LV_IMG != 0 +# define LV_IMG_CF_INDEXED 1 +# define LV_IMG_CF_ALPHA 1 +#endif + +/*Line (dependencies: -*/ +#define USE_LV_LINE 1 +#define USE_LV_ARC 1 + +/******************* + * Container objects + *******************/ + +/*Container (dependencies: -*/ +#define USE_LV_CONT 1 + +/*Page (dependencies: lv_cont)*/ +#define USE_LV_PAGE 1 + +/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ +#define USE_LV_WIN 1 + +/*Tab (dependencies: lv_page, lv_btnm)*/ +#define USE_LV_TABVIEW 1 +#if USE_LV_TABVIEW != 0 +#define LV_TABVIEW_ANIM_TIME \ + 300 /*Time of slide animation [ms] (0: no animation)*/ +#endif +#define USE_LV_TILEVIEW 1 +#if USE_LV_TILEVIEW +# define LV_TILEVIEW_ANIM_TIME 300 +#endif + + +/************************* + * Data visualizer objects + *************************/ + +/*Bar (dependencies: -)*/ +#define USE_LV_BAR 1 + +/*Line meter (dependencies: *;)*/ +#define USE_LV_LMETER 1 + +/*Gauge (dependencies:bar, lmeter)*/ +#define USE_LV_GAUGE 1 + +/*Chart (dependencies: -)*/ +#define USE_LV_CHART 1 + +#define USE_LV_TABLE 1 +#if USE_LV_TABLE +# define LV_TABLE_COL_MAX 12 +#endif + +/*LED (dependencies: -)*/ +#define USE_LV_LED 1 + +/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ +#define USE_LV_MBOX 1 + +/*Text area (dependencies: lv_label, lv_page)*/ +#define USE_LV_TA 1 +#if USE_LV_TA != 0 +#define LV_TA_CURSOR_BLINK_TIME 400 /*ms*/ +#define LV_TA_PWD_SHOW_TIME 1500 /*ms*/ +#endif + +#define USE_LV_SPINBOX 1 +#define USE_LV_CALENDAR 1 + +#define USE_PRELOAD 1 +#if USE_LV_PRELOAD != 0 +# define LV_PRELOAD_DEF_ARC_LENGTH 60 +# define LV_PRELOAD_DEF_SPIN_TIME 1000 +# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC +#endif + +#define USE_LV_CANVAS 1 +/************************* + * User input objects + *************************/ + +/*Button (dependencies: lv_cont*/ +#define USE_LV_BTN 1 +#if USE_LV_BTN != 0 +# define LV_BTN_INK_EFFECT 1 +#endif + +#define USE_LV_IMGBTN 1 +#if USE_LV_IMGBTN +# define LV_IMGBTN_TILED 0 +#endif + +/*Button matrix (dependencies: -)*/ +#define USE_LV_BTNM 1 + +/*Keyboard (dependencies: lv_btnm)*/ +#define USE_LV_KB 1 + +/*Check box (dependencies: lv_btn, lv_label)*/ +#define USE_LV_CB 1 + +/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons + * ))*/ +#define USE_LV_LIST 1 +#if USE_LV_LIST != 0 +#define LV_LIST_FOCUS_TIME \ + 100 /*Default animation time of focusing to a list element [ms] (0: no \ + animation) */ +#endif + +/*Drop down list (dependencies: lv_page, lv_label)*/ +#define USE_LV_DDLIST 1 +#if USE_LV_DDLIST != 0 +#define LV_DDLIST_ANIM_TIME \ + 200 /*Open and close default animation time [ms] (0: no animation)*/ +#endif + +/*Roller (dependencies: lv_ddlist)*/ +#define USE_LV_ROLLER 1 +#if USE_LV_ROLLER != 0 +#define LV_ROLLER_ANIM_TIME \ + 200 /*Focus animation time [ms] (0: no \ + animation)*/ +#endif + +/*Slider (dependencies: lv_bar)*/ +#define USE_LV_SLIDER 1 + +/*Switch (dependencies: lv_slider)*/ +#define USE_LV_SW 1 + +#if LV_INDEV_DRAG_THROW <= 0 +#warning "LV_INDEV_DRAG_THROW must be greater than 0" +#undef LV_INDEV_DRAG_THROW +#define LV_INDEV_DRAG_THROW 1 +#endif + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif +#include "liblvgl/lv_conf_checker.h" +#endif /*LV_CONF_H*/ diff --git a/include/liblvgl/lv_conf_checker.h b/include/liblvgl/lv_conf_checker.h new file mode 100644 index 00000000..3a8ead51 --- /dev/null +++ b/include/liblvgl/lv_conf_checker.h @@ -0,0 +1,664 @@ +/** + * GENERATED FILE, DO NOT EDIT IT! + * @file lv_conf_checker.h + * Make sure all the defines of lv_conf.h have a default value +**/ + +#ifndef LV_CONF_CHECKER_H +#define LV_CONF_CHECKER_H +/*=================== + Dynamic memory + *===================*/ + +/* Memory size which will be used by the library + * to store the graphical objects and other data */ +#ifndef LV_MEM_CUSTOM +#define LV_MEM_CUSTOM 0 /*1: use custom malloc/free, 0: use the built-in lv_mem_alloc/lv_mem_free*/ +#endif +#if LV_MEM_CUSTOM == 0 +#ifndef LV_MEM_SIZE +# define LV_MEM_SIZE (64U * 1024U) /*Size memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ +#endif +#ifndef LV_MEM_ATTR +# define LV_MEM_ATTR /*Complier prefix for big array declaration*/ +#endif +#ifndef LV_MEM_ADR +# define LV_MEM_ADR 0 /*Set an address for memory pool instead of allocation it as an array. Can be in external SRAM too.*/ +#endif +#ifndef LV_MEM_AUTO_DEFRAG +# define LV_MEM_AUTO_DEFRAG 1 /*Automatically defrag on free*/ +#endif +#else /*LV_MEM_CUSTOM*/ +#ifndef LV_MEM_CUSTOM_INCLUDE +# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ +#endif +#ifndef LV_MEM_CUSTOM_ALLOC +# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ +#endif +#ifndef LV_MEM_CUSTOM_FREE +# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ +#endif +#endif /*LV_MEM_CUSTOM*/ + +/* Garbage Collector settings + * Used if lvgl is binded to higher language and the memory is managed by that language */ +#ifndef LV_ENABLE_GC +#define LV_ENABLE_GC 0 +#endif +#if LV_ENABLE_GC != 0 +#ifndef LV_MEM_CUSTOM_REALLOC +# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ +#endif +#ifndef LV_MEM_CUSTOM_GET_SIZE +# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ +#endif +#ifndef LV_GC_INCLUDE +# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +#endif +#endif /* LV_ENABLE_GC */ + +/*=================== + Graphical settings + *===================*/ + +/* Horizontal and vertical resolution of the library.*/ +#ifndef LV_HOR_RES +#define LV_HOR_RES (480) +#endif +#ifndef LV_VER_RES +#define LV_VER_RES (320) +#endif + +/* Dot Per Inch: used to initialize default sizes. E.g. a button with width = LV_DPI / 2 -> half inch wide + * (Not so important, you can adjust it to modify default sizes and spaces)*/ +#ifndef LV_DPI +#define LV_DPI 100 +#endif + +/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ +#ifndef LV_ANTIALIAS +#define LV_ANTIALIAS 1 /*1: Enable anti-aliasing*/ +#endif + +/*Screen refresh period in milliseconds*/ +#ifndef LV_REFR_PERIOD +#define LV_REFR_PERIOD 30 +#endif + +/*----------------- + * VDB settings + *----------------*/ + +/* VDB (Virtual Display Buffer) is an internal graphics buffer. + * The GUI will be drawn into this buffer first and then + * the buffer will be passed to your `disp_drv.disp_flush` function to + * copy it to your frame buffer. + * VDB is required for: buffered drawing, opacity, anti-aliasing and shadows + * Learn more: https://docs.littlevgl.com/#Drawing*/ + +/* Size of the VDB in pixels. Typical size: ~1/10 screen. Must be >= LV_HOR_RES + * Setting it to 0 will disable VDB and `disp_drv.disp_fill` and `disp_drv.disp_map` functions + * will be called to draw to the frame buffer directly*/ +#ifndef LV_VDB_SIZE +#define LV_VDB_SIZE ((LV_VER_RES * LV_HOR_RES) / 10) +#endif + + /* Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays. + * Special formats are handled with `disp_drv.vdb_wr`)*/ +#ifndef LV_VDB_PX_BPP +#define LV_VDB_PX_BPP LV_COLOR_SIZE /*LV_COLOR_SIZE comes from LV_COLOR_DEPTH below to set 8, 16 or 32 bit pixel size automatically */ +#endif + + /* Place VDB to a specific address (e.g. in external RAM) + * 0: allocate automatically into RAM + * LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/ +#ifndef LV_VDB_ADR +#define LV_VDB_ADR 0 +#endif + +/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing + * The flushing should use DMA to write the frame buffer in the background */ +#ifndef LV_VDB_DOUBLE +#define LV_VDB_DOUBLE 0 +#endif + +/* Place VDB2 to a specific address (e.g. in external RAM) + * 0: allocate automatically into RAM + * LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/ +#ifndef LV_VDB2_ADR +#define LV_VDB2_ADR 0 +#endif + +/* Using true double buffering in `disp_drv.disp_flush` you will always get the image of the whole screen. + * Your only task is to set the rendered image (`color_p` parameter) as frame buffer address or send it to your display. + * The best if you do in the blank period of you display to avoid tearing effect. + * Requires: + * - LV_VDB_SIZE = LV_HOR_RES * LV_VER_RES + * - LV_VDB_DOUBLE = 1 + */ +#ifndef LV_VDB_TRUE_DOUBLE_BUFFERED +#define LV_VDB_TRUE_DOUBLE_BUFFERED 0 +#endif + +/*================= + Misc. setting + *=================*/ + +/*Input device settings*/ +#ifndef LV_INDEV_READ_PERIOD +#define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/ +#endif +#ifndef LV_INDEV_POINT_MARKER +#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/ +#endif +#ifndef LV_INDEV_DRAG_LIMIT +#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */ +#endif +#ifndef LV_INDEV_DRAG_THROW +#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%] (must be > 0). Greater value means faster slow-down */ +#endif +#ifndef LV_INDEV_LONG_PRESS_TIME +#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ +#endif +#ifndef LV_INDEV_LONG_PRESS_REP_TIME +#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ +#endif + +/*Color settings*/ +#ifndef LV_COLOR_DEPTH +#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/ +#endif +#ifndef LV_COLOR_16_SWAP +#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/ +#endif +#ifndef LV_COLOR_SCREEN_TRANSP +#define LV_COLOR_SCREEN_TRANSP 0 /*1: Enable screen transparency. Useful for OSD or other overlapping GUIs. Requires ARGB8888 colors*/ +#endif +#ifndef LV_COLOR_TRANSP +#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma keying)*/ +#endif + +/*Text settings*/ +#ifndef LV_TXT_UTF8 +#define LV_TXT_UTF8 1 /*Enable UTF-8 coded Unicode character usage */ +#endif +#ifndef LV_TXT_BREAK_CHARS +#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/ +#endif +#ifndef LV_TXT_LINE_BREAK_LONG_LEN +#define LV_TXT_LINE_BREAK_LONG_LEN 12 /* If a character is at least this long, will break wherever "prettiest" */ +#endif +#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 /* Minimum number of characters of a word to put on a line before a break */ +#endif +#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 1 /* Minimum number of characters of a word to put on a line after a break */ +#endif + +/*Feature usage*/ +#ifndef USE_LV_ANIMATION +#define USE_LV_ANIMATION 1 /*1: Enable all animations*/ +#endif +#ifndef USE_LV_SHADOW +#define USE_LV_SHADOW 1 /*1: Enable shadows*/ +#endif +#ifndef USE_LV_GROUP +#define USE_LV_GROUP 1 /*1: Enable object groups (for keyboards)*/ +#endif +#ifndef USE_LV_GPU +#define USE_LV_GPU 1 /*1: Enable GPU interface*/ +#endif +#ifndef USE_LV_REAL_DRAW +#define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/ +#endif +#ifndef USE_LV_FILESYSTEM +#define USE_LV_FILESYSTEM 1 /*1: Enable file system (might be required for images*/ +#endif +#ifndef USE_LV_MULTI_LANG +#define USE_LV_MULTI_LANG 0 /* Number of languages for labels to store (0: to disable this feature)*/ +#endif + +/*Compiler settings*/ +#ifndef LV_ATTRIBUTE_TICK_INC +#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */ +#endif +#ifndef LV_ATTRIBUTE_TASK_HANDLER +#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ +#endif +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/ +#endif +#ifndef LV_COMPILER_VLA_SUPPORTED +#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ +#endif +#ifndef LV_COMPILER_NON_CONST_INIT_SUPPORTED +#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 /* 1: Initialization with non constant values are supported */ +#endif + +/*HAL settings*/ +#ifndef LV_TICK_CUSTOM +#define LV_TICK_CUSTOM 0 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */ +#endif +#if LV_TICK_CUSTOM == 1 +#ifndef LV_TICK_CUSTOM_INCLUDE +#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ +#endif +#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ +#endif +#endif /*LV_TICK_CUSTOM*/ + + +/*Log settings*/ +#ifndef USE_LV_LOG +#define USE_LV_LOG 1 /*Enable/disable the log module*/ +#endif +#if USE_LV_LOG +/* How important log should be added: + * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + * LV_LOG_LEVEL_INFO Log important events + * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't caused problem + * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + */ +#ifndef LV_LOG_LEVEL +# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN +#endif +/* 1: Print the log with 'printf'; 0: user need to register a callback*/ + +#ifndef LV_LOG_PRINTF +# define LV_LOG_PRINTF 0 +#endif +#endif /*USE_LV_LOG*/ + +/*================ + * THEME USAGE + *================*/ +#ifndef LV_THEME_LIVE_UPDATE +#define LV_THEME_LIVE_UPDATE 1 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/ +#endif + +#ifndef USE_LV_THEME_TEMPL +#define USE_LV_THEME_TEMPL 0 /*Just for test*/ +#endif +#ifndef USE_LV_THEME_DEFAULT +#define USE_LV_THEME_DEFAULT 1 /*Built mainly from the built-in styles. Consumes very few RAM*/ +#endif +#ifndef USE_LV_THEME_ALIEN +#define USE_LV_THEME_ALIEN 1 /*Dark futuristic theme*/ +#endif +#ifndef USE_LV_THEME_NIGHT +#define USE_LV_THEME_NIGHT 1 /*Dark elegant theme*/ +#endif +#ifndef USE_LV_THEME_MONO +#define USE_LV_THEME_MONO 1 /*Mono color theme for monochrome displays*/ +#endif +#ifndef USE_LV_THEME_MATERIAL +#define USE_LV_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/ +#endif +#ifndef USE_LV_THEME_ZEN +#define USE_LV_THEME_ZEN 1 /*Peaceful, mainly light theme */ +#endif +#ifndef USE_LV_THEME_NEMO +#define USE_LV_THEME_NEMO 1 /*Water-like theme based on the movie "Finding Nemo"*/ +#endif + +/*================== + * FONT USAGE + *===================*/ + +/* More info about fonts: https://docs.littlevgl.com/#Fonts + * To enable a built-in font use 1,2,4 or 8 values + * which will determine the bit-per-pixel. Higher value means smoother fonts */ +#ifndef USE_LV_FONT_DEJAVU_10 +#define USE_LV_FONT_DEJAVU_10 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_10_LATIN_SUP +#define USE_LV_FONT_DEJAVU_10_LATIN_SUP 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_10_CYRILLIC +#define USE_LV_FONT_DEJAVU_10_CYRILLIC 4 +#endif +#ifndef USE_LV_FONT_SYMBOL_10 +#define USE_LV_FONT_SYMBOL_10 4 +#endif + +#ifndef USE_LV_FONT_DEJAVU_20 +#define USE_LV_FONT_DEJAVU_20 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_20_LATIN_SUP +#define USE_LV_FONT_DEJAVU_20_LATIN_SUP 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_20_CYRILLIC +#define USE_LV_FONT_DEJAVU_20_CYRILLIC 4 +#endif +#ifndef USE_LV_FONT_SYMBOL_20 +#define USE_LV_FONT_SYMBOL_20 4 +#endif + +#ifndef USE_LV_FONT_DEJAVU_30 +#define USE_LV_FONT_DEJAVU_30 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_30_LATIN_SUP +#define USE_LV_FONT_DEJAVU_30_LATIN_SUP 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_30_CYRILLIC +#define USE_LV_FONT_DEJAVU_30_CYRILLIC 4 +#endif +#ifndef USE_LV_FONT_SYMBOL_30 +#define USE_LV_FONT_SYMBOL_30 4 +#endif + +#ifndef USE_LV_FONT_DEJAVU_40 +#define USE_LV_FONT_DEJAVU_40 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_40_LATIN_SUP +#define USE_LV_FONT_DEJAVU_40_LATIN_SUP 4 +#endif +#ifndef USE_LV_FONT_DEJAVU_40_CYRILLIC +#define USE_LV_FONT_DEJAVU_40_CYRILLIC 4 +#endif +#ifndef USE_LV_FONT_SYMBOL_40 +#define USE_LV_FONT_SYMBOL_40 4 +#endif + +#ifndef USE_LV_FONT_MONOSPACE_8 +#define USE_LV_FONT_MONOSPACE_8 1 +#endif + +/* Optionally declare your custom fonts here. + * You can use these fonts as default font too + * and they will be available globally. E.g. + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ + * LV_FONT_DECLARE(my_font_2) \ + */ +#ifndef LV_FONT_CUSTOM_DECLARE +#define LV_FONT_CUSTOM_DECLARE +#endif + + +#ifndef LV_FONT_DEFAULT +#define LV_FONT_DEFAULT &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/ +#endif + +/*=================== + * LV_OBJ SETTINGS + *==================*/ +#ifndef LV_OBJ_FREE_NUM_TYPE +#define LV_OBJ_FREE_NUM_TYPE uint32_t /*Type of free number attribute (comment out disable free number)*/ +#endif +#ifndef LV_OBJ_FREE_PTR +#define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/ +#endif +#ifndef LV_OBJ_REALIGN +#define LV_OBJ_REALIGN 1 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ +#endif + +/*================== + * LV OBJ X USAGE + *================*/ +/* + * Documentation of the object types: https://docs.littlevgl.com/#Object-types + */ + +/***************** + * Simple object + *****************/ + +/*Label (dependencies: -*/ +#ifndef USE_LV_LABEL +#define USE_LV_LABEL 1 +#endif +#if USE_LV_LABEL != 0 +#ifndef LV_LABEL_SCROLL_SPEED +# define LV_LABEL_SCROLL_SPEED 25 /*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/ +#endif +#endif + +/*Image (dependencies: lv_label*/ +#ifndef USE_LV_IMG +#define USE_LV_IMG 1 +#endif +#if USE_LV_IMG != 0 +#ifndef LV_IMG_CF_INDEXED +# define LV_IMG_CF_INDEXED 1 /*Enable indexed (palette) images*/ +#endif +#ifndef LV_IMG_CF_ALPHA +# define LV_IMG_CF_ALPHA 1 /*Enable alpha indexed images*/ +#endif +#endif + +/*Line (dependencies: -*/ +#ifndef USE_LV_LINE +#define USE_LV_LINE 1 +#endif + +/*Arc (dependencies: -)*/ +#ifndef USE_LV_ARC +#define USE_LV_ARC 1 +#endif + +/******************* + * Container objects + *******************/ + +/*Container (dependencies: -*/ +#ifndef USE_LV_CONT +#define USE_LV_CONT 1 +#endif + +/*Page (dependencies: lv_cont)*/ +#ifndef USE_LV_PAGE +#define USE_LV_PAGE 1 +#endif + +/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ +#ifndef USE_LV_WIN +#define USE_LV_WIN 1 +#endif + +/*Tab (dependencies: lv_page, lv_btnm)*/ +#ifndef USE_LV_TABVIEW +#define USE_LV_TABVIEW 1 +#endif +# if USE_LV_TABVIEW != 0 +#ifndef LV_TABVIEW_ANIM_TIME +# define LV_TABVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/ +#endif +#endif + +/*Tileview (dependencies: lv_page) */ +#ifndef USE_LV_TILEVIEW +#define USE_LV_TILEVIEW 1 +#endif +#if USE_LV_TILEVIEW +#ifndef LV_TILEVIEW_ANIM_TIME +# define LV_TILEVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/ +#endif +#endif + +/************************* + * Data visualizer objects + *************************/ + +/*Bar (dependencies: -)*/ +#ifndef USE_LV_BAR +#define USE_LV_BAR 1 +#endif + +/*Line meter (dependencies: *;)*/ +#ifndef USE_LV_LMETER +#define USE_LV_LMETER 1 +#endif + +/*Gauge (dependencies:lv_bar, lv_lmeter)*/ +#ifndef USE_LV_GAUGE +#define USE_LV_GAUGE 1 +#endif + +/*Chart (dependencies: -)*/ +#ifndef USE_LV_CHART +#define USE_LV_CHART 1 +#endif + +/*Table (dependencies: lv_label)*/ +#ifndef USE_LV_TABLE +#define USE_LV_TABLE 1 +#endif +#if USE_LV_TABLE +#ifndef LV_TABLE_COL_MAX +# define LV_TABLE_COL_MAX 12 +#endif +#endif + +/*LED (dependencies: -)*/ +#ifndef USE_LV_LED +#define USE_LV_LED 1 +#endif + +/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ +#ifndef USE_LV_MBOX +#define USE_LV_MBOX 1 +#endif + +/*Text area (dependencies: lv_label, lv_page)*/ +#ifndef USE_LV_TA +#define USE_LV_TA 1 +#endif +#if USE_LV_TA != 0 +#ifndef LV_TA_CURSOR_BLINK_TIME +# define LV_TA_CURSOR_BLINK_TIME 400 /*ms*/ +#endif +#ifndef LV_TA_PWD_SHOW_TIME +# define LV_TA_PWD_SHOW_TIME 1500 /*ms*/ +#endif +#endif + +/*Spinbox (dependencies: lv_ta)*/ +#ifndef USE_LV_SPINBOX +#define USE_LV_SPINBOX 1 +#endif + +/*Calendar (dependencies: -)*/ +#ifndef USE_LV_CALENDAR +#define USE_LV_CALENDAR 1 +#endif + +/*Preload (dependencies: lv_arc)*/ +#ifndef USE_LV_PRELOAD +#define USE_LV_PRELOAD 1 +#endif +#if USE_LV_PRELOAD != 0 +#ifndef LV_PRELOAD_DEF_ARC_LENGTH +# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/ +#endif +#ifndef LV_PRELOAD_DEF_SPIN_TIME +# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/ +#endif +#ifndef LV_PRELOAD_DEF_ANIM +# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC +#endif +#endif + +/*Canvas (dependencies: lv_img)*/ +#ifndef USE_LV_CANVAS +#define USE_LV_CANVAS 1 +#endif +/************************* + * User input objects + *************************/ + +/*Button (dependencies: lv_cont*/ +#ifndef USE_LV_BTN +#define USE_LV_BTN 1 +#endif +#if USE_LV_BTN != 0 +#ifndef LV_BTN_INK_EFFECT +# define LV_BTN_INK_EFFECT 1 /*Enable button-state animations - draw a circle on click (dependencies: USE_LV_ANIMATION)*/ +#endif +#endif + +/*Image Button (dependencies: lv_btn*/ +#ifndef USE_LV_IMGBTN +#define USE_LV_IMGBTN 1 +#endif +#if USE_LV_IMGBTN +#ifndef LV_IMGBTN_TILED +# define LV_IMGBTN_TILED 0 /*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ +#endif +#endif + +/*Button matrix (dependencies: -)*/ +#ifndef USE_LV_BTNM +#define USE_LV_BTNM 1 +#endif + +/*Keyboard (dependencies: lv_btnm)*/ +#ifndef USE_LV_KB +#define USE_LV_KB 1 +#endif + +/*Check box (dependencies: lv_btn, lv_label)*/ +#ifndef USE_LV_CB +#define USE_LV_CB 1 +#endif + +/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ +#ifndef USE_LV_LIST +#define USE_LV_LIST 1 +#endif +#if USE_LV_LIST != 0 +#ifndef LV_LIST_FOCUS_TIME +# define LV_LIST_FOCUS_TIME 100 /*Default animation time of focusing to a list element [ms] (0: no animation) */ +#endif +#endif + +/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ +#ifndef USE_LV_DDLIST +#define USE_LV_DDLIST 1 +#endif +#if USE_LV_DDLIST != 0 +#ifndef LV_DDLIST_ANIM_TIME +# define LV_DDLIST_ANIM_TIME 200 /*Open and close default animation time [ms] (0: no animation)*/ +#endif +#endif + +/*Roller (dependencies: lv_ddlist)*/ +#ifndef USE_LV_ROLLER +#define USE_LV_ROLLER 1 +#endif +#if USE_LV_ROLLER != 0 +#ifndef LV_ROLLER_ANIM_TIME +# define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/ +#endif +#endif + +/*Slider (dependencies: lv_bar)*/ +#ifndef USE_LV_SLIDER +#define USE_LV_SLIDER 1 +#endif + +/*Switch (dependencies: lv_slider)*/ +#ifndef USE_LV_SW +#define USE_LV_SW 1 +#endif + +/************************* + * Non-user section + *************************/ + +#if LV_INDEV_DRAG_THROW <= 0 +#warning "LV_INDEV_DRAG_THROW must be greater than 0" +#undef LV_INDEV_DRAG_THROW +#ifndef LV_INDEV_DRAG_THROW +#define LV_INDEV_DRAG_THROW 1 +#endif +#endif + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif +#endif + + +#endif /*LV_CONF_CHECKER_H*/ diff --git a/include/liblvgl/lv_conf_internal.h b/include/liblvgl/lv_conf_internal.h index c694dd60..97807fe3 100644 --- a/include/liblvgl/lv_conf_internal.h +++ b/include/liblvgl/lv_conf_internal.h @@ -38,7 +38,7 @@ #elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/ #include "lv_conf.h" #else - #include "liblvgl/lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder*/ + #include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder*/ #endif #if !defined(LV_CONF_H) && !defined(LV_CONF_SUPPRESS_DEFINE_CHECK) /* #include will sometimes silently fail when __has_include is used */ @@ -253,9 +253,6 @@ #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ #endif #endif - /*If using lvgl as ESP32 component*/ - // #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h" - // #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL)) #endif /*LV_TICK_CUSTOM*/ /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. @@ -435,7 +432,7 @@ #endif #if LV_USE_GPU_STM32_DMA2D /*Must be defined to include path of CMSIS header of target processor - e.g. "stm32f7xx.h" or "stm32f4xx.h"*/ + e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ #ifndef LV_GPU_DMA2D_CMSIS_INCLUDE #ifdef CONFIG_LV_GPU_DMA2D_CMSIS_INCLUDE #define LV_GPU_DMA2D_CMSIS_INCLUDE CONFIG_LV_GPU_DMA2D_CMSIS_INCLUDE diff --git a/include/liblvgl/lvgl.h b/include/liblvgl/lvgl.h index c178c9e9..60d29f5d 100644 --- a/include/liblvgl/lvgl.h +++ b/include/liblvgl/lvgl.h @@ -15,8 +15,8 @@ extern "C" { ***************************/ #define LVGL_VERSION_MAJOR 8 #define LVGL_VERSION_MINOR 3 -#define LVGL_VERSION_PATCH 6 -#define LVGL_VERSION_INFO "" +#define LVGL_VERSION_PATCH 4 +#define LVGL_VERSION_INFO "dev" /********************* * INCLUDES diff --git a/include/liblvgl/misc/lv_anim.h b/include/liblvgl/misc/lv_anim.h index faef7278..cb460ab8 100644 --- a/include/liblvgl/misc/lv_anim.h +++ b/include/liblvgl/misc/lv_anim.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include diff --git a/include/liblvgl/misc/lv_area.h b/include/liblvgl/misc/lv_area.h index 137931a2..036767b8 100644 --- a/include/liblvgl/misc/lv_area.h +++ b/include/liblvgl/misc/lv_area.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include diff --git a/include/liblvgl/misc/lv_assert.h b/include/liblvgl/misc/lv_assert.h index 48db7443..4625297d 100644 --- a/include/liblvgl/misc/lv_assert.h +++ b/include/liblvgl/misc/lv_assert.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include "lv_log.h" #include "lv_mem.h" #include LV_ASSERT_HANDLER_INCLUDE diff --git a/include/liblvgl/misc/lv_bidi.h b/include/liblvgl/misc/lv_bidi.h index a27b5808..fafb4a28 100644 --- a/include/liblvgl/misc/lv_bidi.h +++ b/include/liblvgl/misc/lv_bidi.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include diff --git a/include/liblvgl/misc/lv_color.h b/include/liblvgl/misc/lv_color.h index 2cc92f27..8e80a616 100644 --- a/include/liblvgl/misc/lv_color.h +++ b/include/liblvgl/misc/lv_color.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include "lv_assert.h" #include "lv_math.h" #include "lv_types.h" diff --git a/include/liblvgl/misc/lv_fs.h b/include/liblvgl/misc/lv_fs.h index 9f65e1b2..13b2eeb5 100644 --- a/include/liblvgl/misc/lv_fs.h +++ b/include/liblvgl/misc/lv_fs.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include diff --git a/include/liblvgl/misc/lv_gc.h b/include/liblvgl/misc/lv_gc.h index 9d7d1bb9..7a98d107 100644 --- a/include/liblvgl/misc/lv_gc.h +++ b/include/liblvgl/misc/lv_gc.h @@ -13,15 +13,15 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include "lv_mem.h" #include "lv_ll.h" #include "lv_timer.h" #include "lv_types.h" -#include "../draw/lv_img_cache.h" -#include "../draw/lv_draw_mask.h" -#include "../core/lv_obj_pos.h" +#include "liblvgl/draw/lv_img_cache.h" +#include "liblvgl/draw/lv_draw_mask.h" +#include "liblvgl/core/lv_obj_pos.h" /********************* * DEFINES diff --git a/include/liblvgl/misc/lv_log.h b/include/liblvgl/misc/lv_log.h index 9a009930..cd61905d 100644 --- a/include/liblvgl/misc/lv_log.h +++ b/include/liblvgl/misc/lv_log.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include "lv_types.h" diff --git a/include/liblvgl/misc/lv_lru.h b/include/liblvgl/misc/lv_lru.h index 2d0134e5..3e9729e0 100644 --- a/include/liblvgl/misc/lv_lru.h +++ b/include/liblvgl/misc/lv_lru.h @@ -14,7 +14,7 @@ extern "C" { * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include "lv_types.h" diff --git a/include/liblvgl/misc/lv_math.h b/include/liblvgl/misc/lv_math.h index 4b2860a9..24f9ea6c 100644 --- a/include/liblvgl/misc/lv_math.h +++ b/include/liblvgl/misc/lv_math.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include /********************* diff --git a/include/liblvgl/misc/lv_mem.h b/include/liblvgl/misc/lv_mem.h index 7a83b3d5..fd202aba 100644 --- a/include/liblvgl/misc/lv_mem.h +++ b/include/liblvgl/misc/lv_mem.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include diff --git a/include/liblvgl/misc/lv_misc.mk b/include/liblvgl/misc/lv_misc.mk deleted file mode 100644 index 1dfd4eec..00000000 --- a/include/liblvgl/misc/lv_misc.mk +++ /dev/null @@ -1,26 +0,0 @@ -CSRCS += lv_anim.c -CSRCS += lv_anim_timeline.c -CSRCS += lv_area.c -CSRCS += lv_async.c -CSRCS += lv_bidi.c -CSRCS += lv_color.c -CSRCS += lv_fs.c -CSRCS += lv_gc.c -CSRCS += lv_ll.c -CSRCS += lv_log.c -CSRCS += lv_lru.c -CSRCS += lv_math.c -CSRCS += lv_mem.c -CSRCS += lv_printf.c -CSRCS += lv_style.c -CSRCS += lv_style_gen.c -CSRCS += lv_timer.c -CSRCS += lv_tlsf.c -CSRCS += lv_txt.c -CSRCS += lv_txt_ap.c -CSRCS += lv_utils.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/misc -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/misc - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/misc" diff --git a/include/liblvgl/misc/lv_style.h b/include/liblvgl/misc/lv_style.h index 5cf0b19c..44a542dc 100644 --- a/include/liblvgl/misc/lv_style.h +++ b/include/liblvgl/misc/lv_style.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include #include -#include "../font/lv_font.h" +#include "liblvgl/font/lv_font.h" #include "lv_color.h" #include "lv_area.h" #include "lv_anim.h" diff --git a/include/liblvgl/misc/lv_timer.h b/include/liblvgl/misc/lv_timer.h index a9a8e50d..16572d3d 100644 --- a/include/liblvgl/misc/lv_timer.h +++ b/include/liblvgl/misc/lv_timer.h @@ -12,8 +12,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#include "../hal/lv_hal_tick.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/hal/lv_hal_tick.h" #include #include diff --git a/include/liblvgl/misc/lv_txt.h b/include/liblvgl/misc/lv_txt.h index 46050dc3..ae60e8b8 100644 --- a/include/liblvgl/misc/lv_txt.h +++ b/include/liblvgl/misc/lv_txt.h @@ -13,12 +13,12 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #include #include #include "lv_area.h" -#include "../font/lv_font.h" +#include "liblvgl/font/lv_font.h" #include "lv_printf.h" #include "lv_types.h" diff --git a/include/liblvgl/misc/lv_txt_ap.h b/include/liblvgl/misc/lv_txt_ap.h index e2d94b8d..3519bb60 100644 --- a/include/liblvgl/misc/lv_txt_ap.h +++ b/include/liblvgl/misc/lv_txt_ap.h @@ -15,7 +15,7 @@ extern "C" { *********************/ #include #include "lv_txt.h" -#include "../draw/lv_draw.h" +#include "liblvgl/draw/lv_draw.h" #if LV_USE_ARABIC_PERSIAN_CHARS == 1 diff --git a/include/liblvgl/widgets/lv_arc.h b/include/liblvgl/widgets/lv_arc.h index fd53fc15..96f4629b 100644 --- a/include/liblvgl/widgets/lv_arc.h +++ b/include/liblvgl/widgets/lv_arc.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_ARC != 0 -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_bar.h b/include/liblvgl/widgets/lv_bar.h index 1726425b..55d17119 100644 --- a/include/liblvgl/widgets/lv_bar.h +++ b/include/liblvgl/widgets/lv_bar.h @@ -13,12 +13,12 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_BAR != 0 -#include "../core/lv_obj.h" -#include "../misc/lv_anim.h" +#include "liblvgl/core/lv_obj.h" +#include "liblvgl/misc/lv_anim.h" #include "lv_btn.h" #include "lv_label.h" diff --git a/include/liblvgl/widgets/lv_btn.h b/include/liblvgl/widgets/lv_btn.h index 1d471f97..893e6a05 100644 --- a/include/liblvgl/widgets/lv_btn.h +++ b/include/liblvgl/widgets/lv_btn.h @@ -13,10 +13,10 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_BTN != 0 -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_btnmatrix.h b/include/liblvgl/widgets/lv_btnmatrix.h index 780d57b6..31d62bb3 100644 --- a/include/liblvgl/widgets/lv_btnmatrix.h +++ b/include/liblvgl/widgets/lv_btnmatrix.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_BTNMATRIX != 0 -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_canvas.h b/include/liblvgl/widgets/lv_canvas.h index 71f05161..f92a1c5c 100644 --- a/include/liblvgl/widgets/lv_canvas.h +++ b/include/liblvgl/widgets/lv_canvas.h @@ -13,13 +13,13 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_CANVAS != 0 -#include "../core/lv_obj.h" -#include "../widgets/lv_img.h" -#include "../draw/lv_draw_img.h" +#include "liblvgl/core/lv_obj.h" +#include "liblvgl/widgets/lv_img.h" +#include "liblvgl/draw/lv_draw_img.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_checkbox.h b/include/liblvgl/widgets/lv_checkbox.h index 772f500d..6b2bdc39 100644 --- a/include/liblvgl/widgets/lv_checkbox.h +++ b/include/liblvgl/widgets/lv_checkbox.h @@ -13,8 +13,8 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" -#include "../core/lv_obj.h" +#include "liblvgl/lv_conf_internal.h" +#include "liblvgl/core/lv_obj.h" #if LV_USE_CHECKBOX != 0 diff --git a/include/liblvgl/widgets/lv_dropdown.h b/include/liblvgl/widgets/lv_dropdown.h index 0c55e862..9848b145 100644 --- a/include/liblvgl/widgets/lv_dropdown.h +++ b/include/liblvgl/widgets/lv_dropdown.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_DROPDOWN != 0 diff --git a/include/liblvgl/widgets/lv_img.h b/include/liblvgl/widgets/lv_img.h index eb76c8d9..5513a26c 100644 --- a/include/liblvgl/widgets/lv_img.h +++ b/include/liblvgl/widgets/lv_img.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_IMG != 0 @@ -22,9 +22,9 @@ extern "C" { #error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif -#include "../core/lv_obj.h" -#include "../misc/lv_fs.h" -#include "../draw/lv_draw.h" +#include "liblvgl/core/lv_obj.h" +#include "liblvgl/misc/lv_fs.h" +#include "liblvgl/draw/lv_draw.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_label.h b/include/liblvgl/widgets/lv_label.h index b31a63e5..39a68db0 100644 --- a/include/liblvgl/widgets/lv_label.h +++ b/include/liblvgl/widgets/lv_label.h @@ -18,11 +18,11 @@ extern "C" { #if LV_USE_LABEL != 0 #include -#include "../core/lv_obj.h" -#include "../font/lv_font.h" -#include "../font/lv_symbol_def.h" -#include "../misc/lv_txt.h" -#include "../draw/lv_draw.h" +#include "liblvgl/core/lv_obj.h" +#include "liblvgl/font/lv_font.h" +#include "liblvgl/font/lv_symbol_def.h" +#include "liblvgl/misc/lv_txt.h" +#include "liblvgl/draw/lv_draw.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_line.h b/include/liblvgl/widgets/lv_line.h index 54fa248b..622ef810 100644 --- a/include/liblvgl/widgets/lv_line.h +++ b/include/liblvgl/widgets/lv_line.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_LINE != 0 -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_objx_templ.h b/include/liblvgl/widgets/lv_objx_templ.h index 9de5285b..f363df4e 100644 --- a/include/liblvgl/widgets/lv_objx_templ.h +++ b/include/liblvgl/widgets/lv_objx_templ.h @@ -20,11 +20,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_TEMPL != 0 -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_roller.h b/include/liblvgl/widgets/lv_roller.h index 14411dea..4984c262 100644 --- a/include/liblvgl/widgets/lv_roller.h +++ b/include/liblvgl/widgets/lv_roller.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_ROLLER != 0 @@ -22,7 +22,7 @@ extern "C" { #error "lv_roller: lv_label is required. Enable it in lv_conf.h (LV_USE_ROLLER 1)" #endif -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #include "lv_label.h" /********************* diff --git a/include/liblvgl/widgets/lv_slider.h b/include/liblvgl/widgets/lv_slider.h index 386950ce..20c940f8 100644 --- a/include/liblvgl/widgets/lv_slider.h +++ b/include/liblvgl/widgets/lv_slider.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_SLIDER != 0 @@ -22,7 +22,7 @@ extern "C" { #error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)" #endif -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #include "lv_bar.h" /********************* diff --git a/include/liblvgl/widgets/lv_switch.h b/include/liblvgl/widgets/lv_switch.h index 83ca81bc..63ec4276 100644 --- a/include/liblvgl/widgets/lv_switch.h +++ b/include/liblvgl/widgets/lv_switch.h @@ -13,11 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_SWITCH != 0 -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" /********************* * DEFINES diff --git a/include/liblvgl/widgets/lv_table.h b/include/liblvgl/widgets/lv_table.h index 91062708..311d9149 100644 --- a/include/liblvgl/widgets/lv_table.h +++ b/include/liblvgl/widgets/lv_table.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_TABLE != 0 @@ -22,7 +22,7 @@ extern "C" { #error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #include "lv_label.h" /********************* diff --git a/include/liblvgl/widgets/lv_textarea.h b/include/liblvgl/widgets/lv_textarea.h index 4b3289b4..cfa47e47 100644 --- a/include/liblvgl/widgets/lv_textarea.h +++ b/include/liblvgl/widgets/lv_textarea.h @@ -13,7 +13,7 @@ extern "C" { /********************* * INCLUDES *********************/ -#include "../lv_conf_internal.h" +#include "liblvgl/lv_conf_internal.h" #if LV_USE_TEXTAREA != 0 @@ -22,7 +22,7 @@ extern "C" { #error "lv_ta: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif -#include "../core/lv_obj.h" +#include "liblvgl/core/lv_obj.h" #include "lv_label.h" /********************* diff --git a/include/liblvgl/widgets/lv_widgets.mk b/include/liblvgl/widgets/lv_widgets.mk deleted file mode 100644 index 4e62dc58..00000000 --- a/include/liblvgl/widgets/lv_widgets.mk +++ /dev/null @@ -1,20 +0,0 @@ -CSRCS += lv_arc.c -CSRCS += lv_bar.c -CSRCS += lv_btn.c -CSRCS += lv_btnmatrix.c -CSRCS += lv_canvas.c -CSRCS += lv_checkbox.c -CSRCS += lv_dropdown.c -CSRCS += lv_img.c -CSRCS += lv_label.c -CSRCS += lv_line.c -CSRCS += lv_roller.c -CSRCS += lv_slider.c -CSRCS += lv_switch.c -CSRCS += lv_table.c -CSRCS += lv_textarea.c - -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/widgets -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/widgets - -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/widgets" diff --git a/include/main.h b/include/main.h index 288056ef..9407e1ea 100644 --- a/include/main.h +++ b/include/main.h @@ -22,7 +22,7 @@ * * For instance, E_CONTROLLER_MASTER has a shorter name: CONTROLLER_MASTER. * E_CONTROLLER_MASTER is pedantically correct within the PROS styleguide, but - * not convenient for most student programmers. + * not convienent for most student programmers. */ #define PROS_USE_SIMPLE_NAMES @@ -40,7 +40,6 @@ * You should add more #includes here */ //#include "okapi/api.hpp" -//#include "pros/api_legacy.h" /** * If you find doing pros::Motor() to be tedious and you'd prefer just to do diff --git a/include/pros/abstract_motor.hpp b/include/pros/abstract_motor.hpp index 1468f35f..d2a3e31f 100644 --- a/include/pros/abstract_motor.hpp +++ b/include/pros/abstract_motor.hpp @@ -31,7 +31,7 @@ namespace pros { inline namespace v5 { /** - * \enum motor_brake + * \enum MotorBrake * Indicates the current 'brake mode' of a motor. */ enum class MotorBrake { @@ -42,7 +42,7 @@ enum class MotorBrake { }; /** - * \enum Motor_Encoder_Units + * \enum MotorEncoderUnits * Indicates the units used by the motor encoders. */ enum class MotorEncoderUnits { @@ -53,7 +53,7 @@ enum class MotorEncoderUnits { invalid = INT32_MAX ///< Invalid motor encoder units }; -// Alias for Motor_Encoder_Units +// Alias for MotorEncoderUnits using MotorUnits = MotorEncoderUnits; enum class MotorGears { @@ -70,7 +70,7 @@ enum class MotorGears { }; -// Provide Aliases for Motor_Gears +// Provide Aliases for MotorGears using MotorGearset = MotorGears; using MotorCart = MotorGears; using MotorCartridge = MotorGears; @@ -89,25 +89,6 @@ class AbstractMotor { /// These functions allow programmers to make motors move ///@{ - /** - * Sets the voltage for the motor from -127 to 127. - * - * This is designed to map easily to the input from the controller's analog - * stick for simple opcontrol use. The actual behavior of the motor is - * analogous to use of pros::Motor::move(). - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \param voltage - * The new motor voltage from -127 to 127 - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - */ - virtual std::int32_t operator=(std::int32_t voltage) const = 0; - /** * Sets the voltage for the motor from -127 to 127. * @@ -778,7 +759,7 @@ class AbstractMotor { * The index of the motor to get the target position of. * By default index is 0, and will return an error for an out of bounds index * - * \return One of Motor_Brake, according to what was set for the + * \return One of MotorBrake, according to what was set for the * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. */ virtual MotorBrake get_brake_mode(const std::uint8_t index = 0) const = 0; @@ -794,7 +775,7 @@ class AbstractMotor { * The index of the motor to get the target position of. * By default index is 0, and will return an error for an out of bounds index * - * \return A vector containing Motor_Brake(s), according to what was set for the + * \return A vector containing MotorBrake(s), according to what was set for the * motor(s), or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. */ virtual std::vector get_brake_mode_all(void) const = 0; @@ -846,7 +827,7 @@ class AbstractMotor { * The index of the motor to get the target position of. * By default index is 0, and will return an error for an out of bounds index * - * \return One of Motor_Units according to what is set for the + * \return One of MotorUnits according to what is set for the * motor or E_MOTOR_ENCODER_INVALID if the operation failed. */ virtual MotorUnits get_encoder_units(const std::uint8_t index = 0) const = 0; @@ -862,7 +843,7 @@ class AbstractMotor { * The index of the motor to get the target position of. * By default index is 0, and will return an error for an out of bounds index * - * \return A vector of Motor_Units according to what is set for the + * \return A vector of MotorUnits according to what is set for the * motor(s) or E_MOTOR_ENCODER_INVALID if the operation failed. */ virtual std::vector get_encoder_units_all(void) const = 0; @@ -878,8 +859,8 @@ class AbstractMotor { * The index of the motor to get the target position of. * By default index is 0, and will return an error for an out of bounds index * - * \return One of Motor_Gears according to what is set for the motor, - * or pros::Motor_Gears::invalid if the operation failed. + * \return One of MotorGears according to what is set for the motor, + * or pros::MotorGears::invalid if the operation failed. */ virtual MotorGears get_gearing(const std::uint8_t index = 0) const = 0; @@ -894,8 +875,8 @@ class AbstractMotor { * The index of the motor to get the target position of. * By default index is 0, and will return an error for an out of bounds index * - * \return A vector of Motor_Gears according to what is set for the motor(s), - * or pros::Motor_Gears::invalid if the operation failed. + * \return A vector of MotorGears according to what is set for the motor(s), + * or pros::MotorGears::invalid if the operation failed. */ virtual std::vector get_gearing_all(void) const = 0; @@ -977,7 +958,7 @@ class AbstractMotor { virtual std::vector is_reversed_all(void) const = 0; /** - * Sets one of Motor_Brake to the motor. Works with the C enum + * Sets one of MotorBrake to the motor. Works with the C enum * and the C++ enum class. * * This function uses the following values of errno when an error state is @@ -985,7 +966,7 @@ class AbstractMotor { * ENODEV - The port cannot be configured as a motor * * \param mode - * The Motor_Brake to set for the motor + * The MotorBrake to set for the motor * * \param index Optional parameter. * The index of the motor to get the target position of. @@ -1018,7 +999,7 @@ class AbstractMotor { virtual std::int32_t set_current_limit(const std::int32_t limit, const std::uint8_t index = 0) const = 0; virtual std::int32_t set_current_limit_all(const std::int32_t limit) const = 0; /** - * Sets one of Motor_Units for the motor encoder. Works with the C + * Sets one of MotorUnits for the motor encoder. Works with the C * enum and the C++ enum class. * * This function uses the following values of errno when an error state is diff --git a/include/pros/adi.hpp b/include/pros/adi.hpp index a12bd4ac..75429c98 100644 --- a/include/pros/adi.hpp +++ b/include/pros/adi.hpp @@ -190,6 +190,33 @@ class Port { */ std::int32_t set_value(std::int32_t value) const; + /** + * Gets the port of the sensor. + * + * \return returns a tuple of integer ports. + * + * \note The parts of the tuple are {smart port, adi port, second adi port (when applicable)}. + * + * + * \b Example + * \code + * #define DIGITAL_SENSOR_PORT 1 // 'A' + * + * void initialize() { + * pros::adi::AnalogIn sensor (DIGITAL_SENSOR_PORT); + * + * // Getting values from the tuple using std::get + * int sensorSmartPort = std::get<0>(sensor.get_port()); // First value + * int sensorAdiPort = std::get<1>(sensor.get_port()); // Second value + * + * // Prints the first and second value from the port tuple (The Adi Port. The first value is the Smart Port) + * printf("Sensor Smart Port: %d\n", sensorSmartPort); + * printf("Sensor Adi Port: %d\n", sensorAdiPort); + * } + * \endcode + */ + virtual ext_adi_port_tuple_t get_port() const; + protected: std::uint8_t _smart_port; std::uint8_t _adi_port; @@ -396,6 +423,8 @@ class AnalogIn : protected Port { * value calibrated HR: (16 bit calibrated value), value: (12 bit value)] */ friend std::ostream& operator<<(std::ostream& os, pros::adi::AnalogIn& analog_in); + + using Port::get_port; }; ///@} @@ -484,6 +513,8 @@ class AnalogOut : private Port { * \endcode */ using Port::set_value; + + using Port::get_port; /** * This is the overload for the << operator for printing to streams @@ -595,6 +626,8 @@ class DigitalOut : private Port { */ using Port::set_value; + using Port::get_port; + /** * This is the overload for the << operator for printing to streams * @@ -731,6 +764,8 @@ class DigitalIn : private Port { * value: (value)] */ friend std::ostream& operator<<(std::ostream& os, pros::adi::DigitalIn& digital_in); + + using Port::get_port; }; ///@} @@ -875,6 +910,8 @@ class Motor : private Port { * \endcode */ using Port::get_value; + + using Port::get_port; }; ///@} @@ -1004,6 +1041,11 @@ class Encoder : private Port { * value: (value)] */ friend std::ostream& operator<<(std::ostream& os, pros::adi::Encoder& encoder); + ext_adi_port_tuple_t get_port() const override; + + private: + ext_adi_port_pair_t _port_pair; + }; ///@} @@ -1108,6 +1150,8 @@ class Ultrasonic : private Port { * \endcode */ std::int32_t get_value() const; + + using Port::get_port; }; ///@} @@ -1259,6 +1303,8 @@ class Gyro : private Port { * \endcode */ std::int32_t reset() const; + + using Port::get_port; }; ///@} @@ -1419,6 +1465,9 @@ class Potentiometer : public AnalogIn { * Prints in format(this below is all in one line with no new line): */ friend std::ostream& operator<<(std::ostream& os, pros::adi::Potentiometer& potentiometer); + + using Port::get_port; + }; ///@} @@ -1710,6 +1759,8 @@ class Led : protected Port { */ std::int32_t length(); + using Port::get_port; + protected: std::vector _buffer; }; diff --git a/include/pros/device.hpp b/include/pros/device.hpp index 7fcee80c..6c21e0c1 100644 --- a/include/pros/device.hpp +++ b/include/pros/device.hpp @@ -90,7 +90,7 @@ class Device { * } * \endcode */ - std::uint8_t get_port(void); + std::uint8_t get_port(void) const; /** * Checks if the device is installed. @@ -137,6 +137,9 @@ class Device { */ pros::DeviceType get_plugged_type() const; + static pros::DeviceType get_plugged_type(std::uint8_t port); + + static std::vector get_all_devices(pros::DeviceType device_type = pros::DeviceType::undefined); protected: /** diff --git a/include/pros/distance.hpp b/include/pros/distance.hpp index 288dff10..f1b866e6 100644 --- a/include/pros/distance.hpp +++ b/include/pros/distance.hpp @@ -56,7 +56,10 @@ class Distance : public Device { * } * \endcode */ - explicit Distance(const std::uint8_t port); + Distance(const std::uint8_t port); + + Distance(const Device& device) + : Distance(device.get_port()) {}; /** * Get the currently measured distance from the sensor in mm @@ -67,7 +70,7 @@ class Distance : public Device { * ENODEV - The port cannot be configured as an Distance Sensor * * \return The distance value or PROS_ERR if the operation failed, setting - * errno. + * errno. Will return 9999 if the sensor can not detect an object. * * \b Example * \code @@ -84,6 +87,35 @@ class Distance : public Device { */ virtual std::int32_t get(); + static std::vector get_all_devices(); + + /** + * Get the currently measured distance from the sensor in mm. + * \note This function is identical to get(). + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Distance Sensor + * + * \return The distance value or PROS_ERR if the operation failed, setting + * errno. Will return 9999 if the sensor can not detect an object. + * + * \b Example + * \code + * #define DISTANCE_PORT 1 + * + * void opcontrol() { + Distance distance(DISTANCE_PORT); + * while (true) { + * printf("Distance confidence: %d\n", distance.get_distance()); + * delay(20); + * } + * } + * \endcode + */ + virtual std::int32_t get_distance(); + /** * Get the confidence in the distance reading * @@ -127,7 +159,7 @@ class Distance : public Device { * ENODEV - The port cannot be configured as an Distance Sensor * * \return The size value or PROS_ERR if the operation failed, setting - * errno. + * errno. Will return -1 if the sensor is not able to determine object size. * * \b Example * \code diff --git a/include/pros/gps.h b/include/pros/gps.h index 9304e0f9..c4d4fdfe 100644 --- a/include/pros/gps.h +++ b/include/pros/gps.h @@ -26,7 +26,7 @@ #ifdef __cplusplus extern "C" { namespace pros { -#endif +#endif /** * \ingroup c-gps @@ -55,23 +55,36 @@ typedef struct __attribute__((__packed__)) gps_status_s { double x; /// Y Position (meters) double y; - /// Percieved Pitch based on GPS + IMU + /// Perceived Pitch based on GPS + IMU double pitch; - /// Percieved Roll based on GPS + IMU + /// Perceived Roll based on GPS + IMU double roll; - /// Percieved Yaw based on GPS + IMU + /// Perceived Yaw based on GPS + IMU double yaw; } gps_status_s_t; +/** + * \struct gps_orientation_s_t + */ +typedef struct __attribute__((__packed__)) gps_orientation_s { + /// Perceived Pitch based on GPS + IMU + double pitch; + /// Perceived Roll based on GPS + IMU + double roll; + /// Perceived Yaw based on GPS + IMU + double yaw; +} gps_orientation_s_t; + + /** * \struct gps_raw_s */ struct gps_raw_s { - /// Percieved Pitch based on GPS + IMU + /// Perceived Pitch based on GPS + IMU double x; - /// Percieved Roll based on GPS + IMU + /// Perceived Roll based on GPS + IMU double y; - /// Percieved Yaw based on GPS + IMU + /// Perceived Yaw based on GPS + IMU double z; }; @@ -166,7 +179,7 @@ int32_t gps_initialize_full(uint8_t port, double xInitial, double yInitial, doub int32_t gps_set_offset(uint8_t port, double xOffset, double yOffset); /** - * Gets the position and roll, yaw, and pitch of the GPS. + * Get the GPS's cartesian location relative to the center of turning/origin in meters. * * This function uses the following values of errno when an error state is * reached: @@ -176,30 +189,93 @@ int32_t gps_set_offset(uint8_t port, double xOffset, double yOffset); * * \param port * The V5 GPS port number from 1-21 + * \return A struct (gps_position_s_t) containing the X and Y values if the operation + * failed, setting errno. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * gps_position_s_t pos; + * + * while (true) { + * pos = gps_get_offset(GPS_PORT); + * screen_print(TEXT_MEDIUM, 1, "X Offset: %4d, Y Offset: %4d", pos.x, pos.y); + * delay(20); + * } + * } + * \endcode + */ +gps_position_s_t gps_get_offset(uint8_t port); + +/** + * Sets the robot's location relative to the center of the field in meters. * - * \return A struct (gps_status_s_t) containing values mentioned above. - * If the operation failed, all the structure's members are filled with - * PROS_ERR_F and errno is set. + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating * + * \param port + * The V5 GPS port number from 1-21 + * \param xInitial + * Initial 4-Quadrant X Position, with (0,0) being at the center of the field (meters) + * \param yInitial + * Initial 4-Quadrant Y Position, with (0,0) being at the center of the field (meters) + * \param headingInitial + * Heading with 0 being north on the field, in degrees [0,360) going clockwise + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + * * \b Example * \code * #define GPS_PORT 1 + * #define X_INITIAL -1.15 + * #define Y_INITIAL 1.45 + * #define HEADING_INITIAL 90 + * + * void initialize() { + * gps_set_position(GPS_PORT, X_INITIAL, Y_INITIAL, HEADING_INITIAL); + * } + * \endcode + */ +int32_t gps_set_position(uint8_t port, double xInitial, double yInitial, double headingInitial); + +/** + * Set the GPS sensor's data rate in milliseconds, only applies to IMU on GPS. * - * void opcontrol() { - * gps_status_s_t status; + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating * + * \param port + * The V5 GPS port number from 1-21 + * \param rate + * Data rate in milliseconds (Minimum: 5 ms) + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + * + * \b Example + * \code + * #define GPS_PORT 1 + * #define GPS_DATA_RATE 5 + * + * void initialize() { + * gps_set_data_rate(GPS_PORT, GPS_DATA_RATE); * while (true) { - * status = gps_get_status(GPS_PORT); - * printf("X: %f, Y: %f, Pitch: %f, Roll: %f, Yaw: %f\n", status.x, status.y, status.pitch, status.roll, status.yaw); - * delay(20); + * // Do something * } * } * \endcode */ -gps_status_s_t gps_get_status(uint8_t port); +int32_t gps_set_data_rate(uint8_t port, uint32_t rate); /** - * Gets the x and y position on the field of the GPS in meters. + * Get the possible RMS (Root Mean Squared) error in meters for GPS position. * * This function uses the following values of errno when an error state is * reached: @@ -210,29 +286,57 @@ gps_status_s_t gps_get_status(uint8_t port); * \param port * The V5 GPS port number from 1-21 * - * \return A struct (gps_position_s_t) containing values mentioned above. + * \return Possible RMS (Root Mean Squared) error in meters for GPS position. + * If the operation failed, returns PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * double error; + * error = gps_get_error(GPS_PORT); + * screen_print(TEXT_MEDIUM, 1, "Error: %4d", error); + * } + * \endcode + */ +double gps_get_error(uint8_t port); + +/** + * Gets the position and roll, yaw, and pitch of the GPS. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return A struct (gps_status_s_t) containing values mentioned above. * If the operation failed, all the structure's members are filled with * PROS_ERR_F and errno is set. - * + * * \b Example * \code * #define GPS_PORT 1 * * void opcontrol() { - * gps_position_s_t position; + * gps_status_s_t status; * * while (true) { - * position = gps_get_position(GPS_PORT); - * printf("X: %f, Y: %f\n", position.x, position.y); + * status = gps_get_position_and_orientation(GPS_PORT); + * printf("X: %f, Y: %f, Pitch: %f, Roll: %f, Yaw: %f\n", status.x, status.y, status.pitch, status.roll, status.yaw); * delay(20); * } * } * \endcode */ -gps_position_s_t gps_get_position(uint8_t port); +gps_status_s_t gps_get_position_and_orientation(uint8_t port); /** - * Get the GPS's raw gyroscope values + * Gets the x and y position on the field of the GPS in meters. * * This function uses the following values of errno when an error state is * reached: @@ -242,60 +346,63 @@ gps_position_s_t gps_get_position(uint8_t port); * * \param port * The V5 GPS port number from 1-21 - * \return The raw gyroscope values. If the operation failed, all the - * structure's members are filled with PROS_ERR_F and errno is set. * + * \return A struct (gps_position_s_t) containing values mentioned above. + * If the operation failed, all the structure's members are filled with + * PROS_ERR_F and errno is set. + * * \b Example * \code * #define GPS_PORT 1 * * void opcontrol() { - * gps_gyro_s_t gyro; + * gps_position_s_t position; * * while (true) { - * gyro = gps_get_gyro(GPS_PORT); - * printf("Gyro: %f %f %f\n", gyro.x, gyro.y, gyro.z); + * position = gps_get_position(GPS_PORT); + * printf("X: %f, Y: %f\n", position.x, position.y); * delay(20); * } * } * \endcode */ -gps_gyro_s_t gps_get_gyro_rate(uint8_t port); +gps_position_s_t gps_get_position(uint8_t port); /** - * Get the GPS's raw accelerometer values + * Gets the X position in meters of the robot relative to the starting position. * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an GPS + * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating * * \param port - * The V5 GPS's port number from 1-21 - * \return The raw accelerometer values. If the operation failed, all the - * structure's members are filled with PROS_ERR_F and errno is set. + * The V5 GPS port number from 1-21 + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 * * void opcontrol() { - * gps_accel_s_t accel; + * double pos_x; * * while (true) { - * accel = gps_get_accel(GPS_PORT); - * printf("X: %f, Y: %f, Z: %f\n", accel.x, accel.y, accel.z); + * pos_x = gps_get_position_x(GPS_PORT); + * printf("X: %f\n", pos_x); * delay(20); * } * } * \endcode */ -gps_accel_s_t gps_get_accel(uint8_t port); +double gps_get_position_x(uint8_t port); /** - * Get the GPS's cartesian location relative to the center of turning/origin in meters. - * + * Gets the Y position in meters of the robot relative to the starting position. + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -304,28 +411,29 @@ gps_accel_s_t gps_get_accel(uint8_t port); * * \param port * The V5 GPS port number from 1-21 - * \return A struct (gps_position_s_t) containing the X and Y values if the operation - * failed, setting errno. + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * gps_position_s_t pos; - * + * double pos_y; + * * while (true) { - * pos = gps_get_offset(GPS_PORT, x, y); - * screen_print(TEXT_MEDIUM, 1, "X Offset: %4d, Y Offset: %4d", pos.x, pos.y); + * pos_y = gps_get_position_y(GPS_PORT); + * printf("Y: %f\n", pos_y); * delay(20); * } * } * \endcode */ -gps_position_s_t gps_get_offset(uint8_t port); +double gps_get_position_y(uint8_t port); /** - * Sets the robot's location relative to the center of the field in meters. + * Gets the pitch, roll, and yaw of the GPS relative to the starting orientation. * * This function uses the following values of errno when an error state is * reached: @@ -335,31 +443,30 @@ gps_position_s_t gps_get_offset(uint8_t port); * * \param port * The V5 GPS port number from 1-21 - * \param xInitial - * Initial 4-Quadrant X Position, with (0,0) being at the center of the field (meters) - * \param yInitial - * Initial 4-Quadrant Y Position, with (0,0) being at the center of the field (meters) - * \param headingInitial - * Heading with 0 being north on the field, in degrees [0,360) going clockwise - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * + * \return A struct (gps_orientation_s_t) containing values mentioned above. + * If the operation failed, all the structure's members are filled with + * PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * #define X_INITIAL -1.15 - * #define Y_INITIAL 1.45 - * #define HEADING_INITIAL 90 - * - * void initialize() { - * gps_set_position(GPS_PORT, X_INITIAL, Y_INITIAL, HEADING_INITIAL); + * + * void opcontrol() { + * gps_orientation_s_t orientation; + * + * while (true) { + * orientation = gps_get_orientation(GPS_PORT); + * printf("pitch: %f, roll: %f, yaw: %f\n", orientation.pitch, orientation.roll, orientation.yaw); + * delay(20); + * } * } * \endcode - */ -int32_t gps_set_position(uint8_t port, double xInitial, double yInitial, double headingInitial); +*/ +gps_orientation_s_t gps_get_orientation(uint8_t port); /** - * Set the GPS sensor's data rate in milliseconds, only applies to IMU on GPS. + * Gets the pitch of the robot in degrees relative to the starting oreintation. * * This function uses the following values of errno when an error state is * reached: @@ -369,28 +476,29 @@ int32_t gps_set_position(uint8_t port, double xInitial, double yInitial, double * * \param port * The V5 GPS port number from 1-21 - * \param rate - * Data rate in milliseconds (Minimum: 5 ms) - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * + * \return The pitch in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * #define GPS_DATA_RATE 5 - * - * void initialize() { - * gps_set_data_rate(GPS_PORT, GPS_DATA_RATE); + * + * void opcontrol() { + * double pitch; + * * while (true) { - * // Do something + * pitch = gps_get_pitch(GPS_PORT); + * printf("pitch: %f\n", pitch); + * delay(20); * } * } * \endcode */ -int32_t gps_set_data_rate(uint8_t port, uint32_t rate); +double gps_get_pitch(uint8_t port); /** - * Get the possible RMS (Root Mean Squared) error in meters for GPS position. + * Gets the roll of the robot in degrees relative to the starting oreintation. * * This function uses the following values of errno when an error state is * reached: @@ -400,25 +508,29 @@ int32_t gps_set_data_rate(uint8_t port, uint32_t rate); * * \param port * The V5 GPS port number from 1-21 - * - * \return Possible RMS (Root Mean Squared) error in meters for GPS position. - * If the operation failed, returns PROS_ERR_F and errno is set. + * + * \return The roll in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * double error; - * error = gps_get_error(GPS_PORT); - * screen_print(TEXT_MEDIUM, 1, "Error: %4d", error); + * double roll; + * + * while (true) { + * roll = gps_get_roll(GPS_PORT); + * printf("roll: %f\n", roll); + * delay(20); + * } * } * \endcode */ -double gps_get_error(uint8_t port); +double gps_get_roll(uint8_t port); /** - * Gets the position and roll, yaw, and pitch of the GPS. + * Gets the yaw of the robot in degrees relative to the starting oreintation. * * This function uses the following values of errno when an error state is * reached: @@ -428,29 +540,26 @@ double gps_get_error(uint8_t port); * * \param port * The V5 GPS port number from 1-21 - * - * \return A struct (gps_status_s_t) containing values mentioned above. - * If the operation failed, all the structure's members are filled with - * PROS_ERR_F and errno is set. + * + * \return The yaw in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * struct gps_status_s_t status; - * + * double yaw; + * * while (true) { - * status = gps_get_status(GPS_PORT); - * screen_print(TEXT_MEDIUM, 1, "x: %3f, y: %3f, pitch: %3f", status.x, status.y); - * screen_print(TEXT_MEDIUM, 2, "yaw: %3f, roll: %3f", status.pitch, status.yaw); - * screen_print(TEXT_MEDIUM, 3, "roll: %3f", status.roll); + * yaw = gps_get_yaw(GPS_PORT); + * printf("yaw: %f\n", yaw); * delay(20); * } * } * \endcode */ -gps_status_s_t gps_get_status(uint8_t port); +double gps_get_yaw(uint8_t port); /** * Get the heading in [0,360) degree values. @@ -470,12 +579,13 @@ gps_status_s_t gps_get_status(uint8_t port); * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { * double heading; - * + * * while (true) { * heading = gps_get_heading(GPS_PORT); + * printf("heading: %f\n", heading); * delay(20); * } * } @@ -501,12 +611,13 @@ double gps_get_heading(uint8_t port); * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * double heading; - * + * double heading_raw; + * * while (true) { - * heading = gps_get_heading_raw(GPS_PORT); + * heading_raw = gps_get_heading_raw(GPS_PORT); + * printf("heading_raw: %f\n", heading_raw); * delay(20); * } * } @@ -515,7 +626,7 @@ double gps_get_heading(uint8_t port); double gps_get_heading_raw(uint8_t port); /** - * Gets the GPS sensor's elapsed rotation value + * Get the GPS's raw gyroscope values * * This function uses the following values of errno when an error state is * reached: @@ -525,107 +636,119 @@ double gps_get_heading_raw(uint8_t port); * * \param port * The V5 GPS port number from 1-21 - * \return The elased heading in degrees. If the operation fails, returns - * PROS_ERR_F and errno is set. - * + * \return A struct (gps_gyro_s_t) containing values mentioned above. + * If the operation failed, all the + * structure's members are filled with PROS_ERR_F and errno is set. + * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * double elapsed_rotation; - * - * elapsed_rotation = gps_get_rotation(GPS_PORT); - * printf("Elapsed rotation: %3f", elapsed_rotation); + * gps_gyro_s_t gyro; + * + * while (true) { + * gyro = gps_get_gyro(GPS_PORT); + * printf("Gyro: %f %f %f\n", gyro.x, gyro.y, gyro.z); + * delay(20); + * } * } * \endcode */ -double gps_get_rotation(uint8_t port); +gps_gyro_s_t gps_get_gyro_rate(uint8_t port); /** - * Set the GPS sensor's rotation value to target value - * + * Get the GPS's raw gyroscope value in x-axis + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating - * + * * \param port * The V5 GPS port number from 1-21 - * \param target - * Target rotation value to set rotation value to - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return The raw gyroscope value in x-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * gps_set_rotation(GPS_PORT, 60); - * printf("Elapsed rotation: %3f", gps_get_rotation(GPS_PORT)); + * double gyro_x; + * + * while (true) { + * gyro_x = gps_get_gyro_x(GPS_PORT); + * printf("gyro_x: %f\n", gyro_x); + * delay(20); + * } * } * \endcode - */ -int32_t gps_set_rotation(uint8_t port, double target); +*/ +double gps_get_gyro_rate_x(uint8_t port); /** - * Tare the GPS sensor's rotation value - * + * Get the GPS's raw gyroscope value in y-axis + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating - * + * * \param port * The V5 GPS port number from 1-21 - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return The raw gyroscope value in y-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * - * void initialize() { - * gps_tare_rotation(GPS_PORT); - * printf("Elapsed rotation: %3f", gps_get_rotation(GPS_PORT)); // should be 0 + * + * void opcontrol() { + * double gyro_y; + * + * while (true) { + * gyro_y = gps_get_gyro_y(GPS_PORT); + * printf("gyro_y: %f\n", gyro_y); + * delay(20); + * } * } * \endcode - */ -int32_t gps_tare_rotation(uint8_t port); +*/ +double gps_get_gyro_rate_y(uint8_t port); /** - * Get the GPS's raw gyroscope values - * + * Get the GPS's raw gyroscope value in z-axis + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating - * + * * \param port * The V5 GPS port number from 1-21 - * \return The raw gyroscope values. If the operation failed, all the - * structure's members are filled with PROS_ERR_F and errno is set. + * \return The raw gyroscope value in z-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * struct gps_gyro_s_t gyro; - * + * double gyro_z; + * * while (true) { - * gyro = gps_get_gyro_rate(GPS_PORT); - * screen_print(TEXT_MEDIUM, 1, "gyroscope- x: %3f, y: %3f, z: %3f", gyro.x, gyro.y, gyro.z); + * gyro_z = gps_get_gyro_z(GPS_PORT); + * printf("gyro_z: %f\n", gyro_z); * delay(20); * } * } * \endcode - */ -gps_gyro_s_t gps_get_gyro_rate(uint8_t port); +*/ +double gps_get_gyro_rate_z(uint8_t port); /** * Get the GPS's raw accelerometer values @@ -638,26 +761,119 @@ gps_gyro_s_t gps_get_gyro_rate(uint8_t port); * * \param port * The V5 GPS's port number from 1-21 - * \return The raw accelerometer values. If the operation failed, all the + * \return A struct (gps_accel_s_t) containing values mentioned above. + * If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. * * \b Example * \code * #define GPS_PORT 1 - * + * * void opcontrol() { - * struct gps_accel_s_t accel; - * + * gps_accel_s_t accel; + * * while (true) { * accel = gps_get_accel(GPS_PORT); - * screen_print(TEXT_MEDIUM, 1, "accleration- x: %3f, y: %3f, z: %3f", accel.x, accel.y, accel.z); + * printf("X: %f, Y: %f, Z: %f\n", accel.x, accel.y, accel.z); + * delay(20); * } * } * \endcode */ gps_accel_s_t gps_get_accel(uint8_t port); -///@} +/** + * Get the GPS's raw accelerometer value in x-axis + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS's port number from 1-21 + * \return The raw accelerometer value in x-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * double accel_x; + * + * while (true) { + * accel_x = gps_get_accel_x(GPS_PORT); + * printf("accel_x: %f\n", accel_x); + * delay(20); + * } + * } + * \endcode +*/ +double gps_get_accel_x(uint8_t port); + +/** + * Get the GPS's raw accelerometer value in y-axis + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS's port number from 1-21 + * \return The raw accelerometer value in y-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * double accel_y; + * + * while (true) { + * accel_y = gps_get_accel_y(GPS_PORT); + * printf("accel_y: %f\n", accel_y); + * delay(20); + * } + * } + * \endcode +*/ +double gps_get_accel_y(uint8_t port); + +/** + * Get the GPS's raw accelerometer value in z-axis + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS's port number from 1-21 + * \return The raw accelerometer value in z-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * double accel_z; + * + * while (true) { + * accel_z = gps_get_accel_z(GPS_PORT); + * printf("accel_z: %f\n", accel_z); + * delay(20); + * } + * } + * \endcode +*/ +double gps_get_accel_z(uint8_t port); #ifdef __cplusplus } diff --git a/include/pros/gps.hpp b/include/pros/gps.hpp index d081d619..1d5a0015 100644 --- a/include/pros/gps.hpp +++ b/include/pros/gps.hpp @@ -12,7 +12,7 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * + * * \defgroup cpp-gps VEX GPS Sensor C API * \note For a pros-specific usage guide on the GPS, please check out our article [here.](@ref gps) */ @@ -25,8 +25,8 @@ #include #include -#include "pros/gps.h" #include "pros/device.hpp" +#include "pros/gps.h" namespace pros { inline namespace v5 { @@ -41,7 +41,6 @@ class Gps : public Device { */ public: - /** * Creates a GPS object for the given port. * @@ -59,7 +58,9 @@ class Gps : public Device { * \endcode * */ - explicit Gps(const std::uint8_t port) : Device(port, DeviceType::gps){}; + Gps(const std::uint8_t port) : Device(port, DeviceType::gps){}; + + Gps(const Device& device) : Gps(device.get_port()){}; /** * Creates a GPS object for the given port. @@ -85,7 +86,8 @@ class Gps : public Device { * \endcode * */ - explicit Gps(const std::uint8_t port, double xInitial, double yInitial, double headingInitial) : Device(port, DeviceType::gps){ + explicit Gps(const std::uint8_t port, double xInitial, double yInitial, double headingInitial) + : Device(port, DeviceType::gps) { pros::c::gps_set_position(port, xInitial, yInitial, headingInitial); }; @@ -105,19 +107,19 @@ class Gps : public Device { * \param yOffset * Cartesian 4-Quadrant Y offset from center of turning (meters) * - * \b Example: + * \b Example: * \code * pros::Gps gps(1, 1.30, 1.20); * \endcode * */ - explicit Gps(const std::uint8_t port, double xOffset, double yOffset) : Device(port, DeviceType::gps){ + explicit Gps(const std::uint8_t port, double xOffset, double yOffset) : Device(port, DeviceType::gps) { pros::c::gps_set_offset(port, xOffset, yOffset); }; /** * Creates a GPS object for the given port. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -143,8 +145,9 @@ class Gps : public Device { * \endcode * */ - explicit Gps(const std::uint8_t port, double xInitial, double yInitial, double headingInitial, double xOffset, double yOffset) - : Device(port, DeviceType::gps){ + explicit Gps(const std::uint8_t port, double xInitial, double yInitial, double headingInitial, double xOffset, + double yOffset) + : Device(port, DeviceType::gps) { pros::c::gps_initialize_full(port, xInitial, yInitial, headingInitial, xOffset, yOffset); }; @@ -220,35 +223,37 @@ class Gps : public Device { */ virtual std::int32_t set_offset(double xOffset, double yOffset) const; + static std::vector get_all_devices(); + /** - * Get the GPS's cartesian location relative to the center of turning/origin in meters. - * - * This function uses the following values of errno when an error state is - * reached: - * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating - * - * \param port - * The V5 GPS port number from 1-21 - * \return A struct (gps_position_s_t) containing the X and Y values if the operation - * failed, setting errno. - * - * \b Example - * \code - * #define GPS_PORT 1 - * - * void opcontrol() { - * gps_position_s_t pos; - * Gps gps(GPS_PORT); - * while (true) { - * pos = gps.get_offset(); - * screen_print(TEXT_MEDIUM, 1, "X Offset: %4d, Y Offset: %4d", pos.x, pos.y); - * delay(20); - * } - * } - * \endcode - */ + * Get the GPS's cartesian location relative to the center of turning/origin in meters. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * \return A struct (gps_position_s_t) containing the X and Y values if the operation + * failed, setting errno. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * gps_position_s_t pos; + * Gps gps(GPS_PORT); + * while (true) { + * pos = gps.get_offset(); + * screen_print(TEXT_MEDIUM, 1, "X Offset: %4d, Y Offset: %4d", pos.x, pos.y); + * delay(20); + * } + * } + * \endcode + */ virtual pros::gps_position_s_t get_offset() const; /** @@ -268,7 +273,7 @@ class Gps : public Device { * Heading with 0 being north on the field, in degrees [0,360) going clockwise * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * #define GPS_PORT 1 @@ -277,7 +282,7 @@ class Gps : public Device { * Gps gps(GPS_PORT); * gps.set_position(1.3, 1.4, 180); * while (true) { - * printf("X: %f, Y: %f, Heading: %f\n", gps.get_position().x, + * printf("X: %f, Y: %f, Heading: %f\n", gps.get_position().x, * gps.get_position().y, gps.get_position().heading); * delay(20); * } @@ -356,7 +361,7 @@ class Gps : public Device { * \return A struct (gps_status_s_t) containing values mentioned above. * If the operation failed, all the structure's members are filled with * PROS_ERR_F and errno is set. - * + * * \b Example * \code * #define GPS_PORT 1 @@ -365,15 +370,15 @@ class Gps : public Device { * Gps gps(GPS_PORT); * gps_status_s_t status; * while (true) { - * status = gps.get_status(); - * printf("X: %f, Y: %f, Heading: %f, Roll: %f, Pitch: %f, Yaw: %f\n", - * status.x, status.y, status.heading, status.roll, status.pitch, status.yaw); + * status = gps.get_position_and_orientation(); + * printf("X: %f, Y: %f, Roll: %f, Pitch: %f, Yaw: %f\n", + * status.x, status.y, status.roll, status.pitch, status.yaw); * delay(20); * } * } * \endcode */ - virtual pros::gps_status_s_t get_status() const; + virtual pros::gps_status_s_t get_position_and_orientation() const; /** * Gets the x and y position on the field of the GPS in meters. @@ -397,8 +402,7 @@ class Gps : public Device { * gps_position_s_t position; * while (true) { * position = gps.get_position(); - * printf("X: %f, Y: %f, Heading: %f\n", position.x, position.y, - * position.heading); + * printf("X: %f, Y: %f\n", position.x, position.y); * delay(20); * } * } @@ -406,6 +410,177 @@ class Gps : public Device { */ virtual pros::gps_position_s_t get_position() const; + /** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * double pos_x = gps.get_position_x(); + * printf("X: %f\n", pos_x); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_position_x() const; + + /** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * double pos_y = gps.get_position_y(); + * printf("Y: %f\n", pos_y); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_position_y() const; + + /** + * Gets the pitch, roll, and yaw of the GPS relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \return A struct (gps_orientation_s_t) containing values mentioned above. + * If the operation failed, all the structure's members are filled with + * PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * gps_orientation_s_t orientation; + * while (true) { + * orientation = gps.get_orientation(); + * printf("pitch: %f, roll: %f, yaw: %f\n", orientation.pitch, + * orientation.roll, orientation.yaw); + * delay(20); + * } + * } + * \endcode + */ + virtual pros::gps_orientation_s_t get_orientation() const; + + /** + * Gets the pitch of the robot in degrees relative to the starting oreintation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \return The pitch in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * double pitch = gps.get_pitch(); + * printf("pitch: %f\n", pitch); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_pitch() const; + + /** + * Gets the roll of the robot in degrees relative to the starting oreintation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \return The roll in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * double roll = gps.get_roll(); + * printf("roll: %f\n", roll); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_roll() const; + + /** + * Gets the yaw of the robot in degrees relative to the starting oreintation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \return The yaw in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * double yaw = gps.get_yaw(); + * printf("yaw: %f\n", yaw); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_yaw() const; + /** * Get the heading in [0,360) degree values. * @@ -464,7 +639,7 @@ class Gps : public Device { virtual double get_heading_raw() const; /** - * Gets the GPS sensor's elapsed rotation value + * Get the GPS's raw gyroscope value in z-axis * * This function uses the following values of errno when an error state is * reached: @@ -472,27 +647,27 @@ class Gps : public Device { * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating * - * \return The elased heading in degrees. If the operation fails, returns + * \return The raw gyroscope value in z-axis. If the operation fails, returns * PROS_ERR_F and errno is set. * - * \b Example + \b Example * \code * #define GPS_PORT 1 * * void opcontrol() { * Gps gps(GPS_PORT); * while(true) { - double rotation = gps.get_rotation(); - * printf("Rotation: %f\n", rotation); + * double gyro_z = gps.get_gyro_z(); + * printf("gyro_z: %f\n", gyro_z); * pros::delay(20); * } * } * \endcode */ - virtual double get_rotation() const; + virtual pros::gps_gyro_s_t get_gyro_rate() const; /** - * Set the GPS sensor's rotation value to target value + * Get the GPS's raw gyroscope value in x-axis * * This function uses the following values of errno when an error state is * reached: @@ -500,10 +675,8 @@ class Gps : public Device { * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating * - * \param target - * Target rotation value to set rotation value to - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return The raw gyroscope value in x-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. * * \b Example * \code @@ -511,18 +684,18 @@ class Gps : public Device { * * void opcontrol() { * Gps gps(GPS_PORT); - * double rotation = gps.set_rotation(90); * while(true) { - * printf("Rotation: %f\n", rotation); + * double gyro_x = gps.get_gyro_x(); + * printf("gyro_x: %f\n", gyro_x); * pros::delay(20); * } * } * \endcode */ - virtual std::int32_t set_rotation(double target) const; + virtual double get_gyro_rate_x() const; /** - * Tare the GPS sensor's rotation value + * Get the GPS's raw gyroscope value in y-axis * * This function uses the following values of errno when an error state is * reached: @@ -530,28 +703,27 @@ class Gps : public Device { * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example: + * \return The raw gyroscope value in y-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. + * + * \b Example * \code * #define GPS_PORT 1 * * void opcontrol() { * Gps gps(GPS_PORT); - * gps.tare_rotation(); * while(true) { - * Should be around 0 on first call since it was tared. - * printf("Rotation: %f\n", rotation); + * double gyro_y = gps.get_gyro_y(); + * printf("gyro_y: %f\n", gyro_y); * pros::delay(20); * } * } * \endcode */ - virtual std::int32_t tare_rotation() const; + virtual double get_gyro_rate_y() const; /** - * Get the GPS's raw gyroscope values + * Get the GPS's raw gyroscope value in z-axis * * This function uses the following values of errno when an error state is * reached: @@ -559,24 +731,24 @@ class Gps : public Device { * ENODEV - The port cannot be configured as a GPS * EAGAIN - The sensor is still calibrating * - * \return The raw gyroscope values. If the operation failed, all the - * structure's members are filled with PROS_ERR_F and errno is set. + * \return The raw gyroscope value in z-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. * - * \b Example + \b Example * \code * #define GPS_PORT 1 * * void opcontrol() { * Gps gps(GPS_PORT); * while(true) { - * pros::gps_gyro_s_t gyro = gps.get_gyro_rate(); - * printf("Gyro: %f, %f, %f\n", gyro.x, gyro.y, gyro.z); + * double gyro_z = gps.get_gyro_z(); + * printf("gyro_z: %f\n", gyro_z); * pros::delay(20); * } * } * \endcode - */ - virtual pros::gps_gyro_s_t get_gyro_rate() const; + */ + virtual double get_gyro_rate_z() const; /** * Get the GPS's raw accelerometer values @@ -587,18 +759,22 @@ class Gps : public Device { * ENODEV - The port cannot be configured as an GPS * EAGAIN - The sensor is still calibrating * - * \param port - * The V5 GPS's port number from 1-21 * \return The raw accelerometer values. If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. */ virtual pros::gps_accel_s_t get_accel() const; /** - * This is the overload for the << operator for printing to streams - * - * Prints in format: - * Gps [port: gps._port, x: (x position), y: (y position), heading: (gps heading), rotation: (gps rotation)] + * Get the GPS's raw accelerometer value in x-axis + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an GPS + * EAGAIN - The sensor is still calibrating + * + * \return The raw accelerometer value in x-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. * * \b Example * \code @@ -607,43 +783,142 @@ class Gps : public Device { * void opcontrol() { * Gps gps(GPS_PORT); * while(true) { - * std::cout << gps << std::endl; + * double accel_x = gps.get_accel_x(); + * printf("accel_x: %f\n", accel_x); * pros::delay(20); * } * } * \endcode */ - friend std::ostream& operator<<(std::ostream& os, const pros::Gps& gps); + virtual double get_accel_x() const; -///@} -}; // Gps Class + /** + * Get the GPS's raw accelerometer value in y-axis + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an GPS + * EAGAIN - The sensor is still calibrating + * + * \return The raw accelerometer value in y-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * double accel_y = gps.get_accel_y(); + * printf("accel_y: %f\n", accel_y); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_accel_y() const; -namespace literals { /** - * Constructs a Gps object with the given port number - * + * Get the GPS's raw accelerometer value in z-axis + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an GPS + * EAGAIN - The sensor is still calibrating + * + * \return The raw accelerometer value in z-axis. If the operation fails, returns + * PROS_ERR_F and errno is set. + * * \b Example * \code - * using namespace literals; - * + * #define GPS_PORT 1 + * * void opcontrol() { - * pros::Gps gps = 1_gps; - * while (true) { - * pos = gps.get_position(); - * screen_print(TEXT_MEDIUM, 1, "X Position: %4d, Y Position: %4d", pos.x, pos.y); - * delay(20); - * } + * Gps gps(GPS_PORT); + * while(true) { + * double accel_z = gps.get_accel_z(); + * printf("accel_z: %f\n", accel_z); + * pros::delay(20); + * } + * } + * \endcode + */ + virtual double get_accel_z() const; + + /** + * This is the overload for the << operator for printing to streams + * + * Prints in format: + * Gps [port: gps._port, x: (x position), y: (y position), heading: (gps heading), rotation: (gps rotation)] + * + * \b Example + * \code + * #define GPS_PORT 1 + * + * void opcontrol() { + * Gps gps(GPS_PORT); + * while(true) { + * std::cout << gps << std::endl; + * pros::delay(20); + * } * } * \endcode */ - const pros::Gps operator""_gps(const unsigned long long int g); + friend std::ostream& operator<<(std::ostream& os, const pros::Gps& gps); + + /** + * Gets a gps sensor that is plugged in to the brain + * + * \note The first time this function is called it returns the gps sensor at the lowest port + * If this function is called multiple times, it will cycle through all the ports. + * For example, if you have 1 gps sensor on the robot + * this function will always return a gps sensor object for that port. + * If you have 2 gps sensors, all the odd numered calls to this function will return objects + * for the lower port number, + * all the even number calls will return gps objects for the higher port number + * + * + * This functions uses the following values of errno when an error state is + * reached: + * ENODEV - No gps sensor is plugged into the brain + * + * \return A gps object corresponding to a port that a gps sensor is connected to the brain + * If no gps sensor is plugged in, it returns a gps sensor on port PROS_ERR_BYTE + * + */ + static Gps get_gps(); + ///@} +}; // Gps Class + +namespace literals { +/** + * Constructs a Gps object with the given port number + * + * \b Example + * \code + * using namespace literals; + * + * void opcontrol() { + * pros::Gps gps = 1_gps; + * while (true) { + * pos = gps.get_position(); + * screen_print(TEXT_MEDIUM, 1, "X Position: %4d, Y Position: %4d", pos.x, pos.y); + * delay(20); + * } + * } + * \endcode + */ +const pros::Gps operator""_gps(const unsigned long long int g); } // namespace literals /// @brief /// Alias for Gps is GPS for user convenience. using GPS = Gps; -} // namespace v5 -} // namespace pros +} // namespace v5 +} // namespace pros #endif diff --git a/include/pros/imu.h b/include/pros/imu.h index bf724ab0..63cc7384 100644 --- a/include/pros/imu.h +++ b/include/pros/imu.h @@ -41,13 +41,25 @@ namespace pros { * @brief Indicates IMU status. */ typedef enum imu_status_e { + E_IMU_STATUS_READY = 0, // IMU is connected but not currently calibrating /** The IMU is calibrating */ - E_IMU_STATUS_CALIBRATING = 0x01, + E_IMU_STATUS_CALIBRATING = 1, /** Used to indicate that an error state was reached in the imu_get_status function,\ not that the IMU is necessarily in an error state */ E_IMU_STATUS_ERROR = 0xFF, } imu_status_e_t; +typedef enum imu_orientation_e { + E_IMU_Z_UP = 0, // IMU has the Z axis UP (VEX Logo facing DOWN) + E_IMU_Z_DOWN = 1, // IMU has the Z axis DOWN (VEX Logo facing UP) + E_IMU_X_UP = 2, // IMU has the X axis UP + E_IMU_X_DOWN = 3, // IMU has the X axis DOWN + E_IMU_Y_UP = 4, // IMU has the Y axis UP + E_IMU_Y_DOWN = 5, // IMU has the Y axis DOWN + E_IMU_ORIENTATION_ERROR = 0xFF // NOTE: used for returning an error from the get_physical_orientation function, not + // that the IMU is necessarily in an error state +} imu_orientation_e_t; + /** * \struct quaternion_s_t */ @@ -934,6 +946,21 @@ int32_t imu_set_roll(uint8_t port, double target); */ int32_t imu_set_yaw(uint8_t port, double target); +/** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ +imu_orientation_e_t imu_get_physical_orientation(uint8_t port); + /** @} */ /** @} */ diff --git a/include/pros/imu.hpp b/include/pros/imu.hpp index cb141ecc..0cee565c 100644 --- a/include/pros/imu.hpp +++ b/include/pros/imu.hpp @@ -19,10 +19,10 @@ #define _PROS_IMU_HPP_ #include +#include -#include "pros/imu.h" #include "pros/device.hpp" -#include +#include "pros/imu.h" namespace pros { /** @@ -40,8 +40,9 @@ namespace pros { */ enum class ImuStatus { + ready = 0, /** The IMU is calibrating */ - calibrating = 0x01, + calibrating = 19, /** Used to indicate that an error state was reached in the imu_get_status function,\ not that the IMU is necessarily in an error state */ error = 0xFF, @@ -56,7 +57,6 @@ class Imu : public Device { * \addtogroup cpp-imu * ///@{ */ - public: /** @@ -68,22 +68,47 @@ class Imu : public Device { * * \param port * The V5 Inertial Sensor port number from 1-21 - * + * * \b Example * \code * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Do something with the sensor data * } * } * \endcode */ - explicit Imu(const std::uint8_t port) : Device(port, DeviceType::imu) {}; + + Imu(const std::uint8_t port) : Device(port, DeviceType::imu) {}; + + + Imu(const Device& device) : Imu(device.get_port()){}; + /** + * Gets a IMU sensor that is plugged in to the brain + * + * \note The first time this function is called it returns the IMU sensor at the lowest port + * If this function is called multiple times, it will cycle through all the ports. + * For example, if you have 1 IMU sensor on the robot + * this function will always return a IMU sensor object for that port. + * If you have 2 IMU sensors, all the odd numered calls to this function will return objects + * for the lower port number, + * all the even number calls will return IMU objects for the higher port number + * + * + * This functions uses the following values of errno when an error state is + * reached: + * ENODEV - No IMU sensor is plugged into the brain + * + * \return A IMU object corresponding to a port that a IMU sensor is connected to the brain + * If no IMU sensor is plugged in, it returns a IMU sensor on port PROS_ERR_BYTE + * + */ + static Imu get_imu(); /** * Calibrate IMU * @@ -103,12 +128,12 @@ class Imu : public Device { * Whether this function blocks during calibration. * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); * imu.calibrate(); @@ -139,31 +164,34 @@ class Imu : public Device { * \param rate The data refresh interval in milliseconds * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the refresh rate to 5ms * std::int32_t status = imu.set_data_rate(5); * delay(20); - * + * * // Check if the operation was successful * if (status == PROS_ERR) { * // Do something with the error * } - * + * * // Do something with the sensor data * } * } * \endcode */ virtual std::int32_t set_data_rate(std::uint32_t rate) const; + + static std::vector get_all_devices(); + /** * Get the total number of degrees the Inertial Sensor has spun about the z-axis * @@ -181,15 +209,15 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return The degree value or PROS_ERR_F if the operation failed, setting * errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the total number of degrees the sensor has spun * printf("Total rotation: %f\n", imu.get_rotation()); @@ -217,15 +245,15 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return The degree value or PROS_ERR_F if the operation failed, setting * errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's heading * printf("Heading: %f\n", imu.get_heading()); @@ -249,15 +277,15 @@ class Imu : public Device { * \return The quaternion representing the sensor's orientation. If the * operation failed, all the quaternion's members are filled with PROS_ERR_F and * errno is set. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's quaternion * pros::quaternion_s_t quat = imu.get_quaternion(); @@ -282,15 +310,15 @@ class Imu : public Device { * \return The Euler angles representing the sensor's orientation. If the * operation failed, all the structure's members are filled with PROS_ERR_F and * errno is set. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's Euler angles * pros::euler_s_t euler = imu.get_euler(); @@ -314,15 +342,15 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return The pitch angle, or PROS_ERR_F if the operation failed, setting * errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's pitch * printf("Pitch: %f\n", imu.get_pitch()); @@ -344,15 +372,15 @@ class Imu : public Device { * \param port * The V5 Inertial Sensor port number from 1-21 * \return The roll angle, or PROS_ERR_F if the operation failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's roll * printf("Roll: %f\n", imu.get_roll()); @@ -374,15 +402,15 @@ class Imu : public Device { * \param port * The V5 Inertial Sensor port number from 1-21 * \return The yaw angle, or PROS_ERR_F if the operation failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's yaw * printf("Yaw: %f\n", imu.get_yaw()); @@ -405,15 +433,15 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return The raw gyroscope values. If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's raw gyroscope values * pros::imu_gyro_s_t gyro = imu.get_gyro_rate(); @@ -437,22 +465,22 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's rotation value to 10 * imu.set_rotation(10); * delay(20); - * + * * // Do something with sensor - * + * * // Reset the sensor's rotation value to 0 * imu.tare_rotation(); * delay(20); @@ -474,22 +502,22 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's heading value to 10 * imu.set_heading(10); * delay(20); - * + * * // Do something with sensor - * + * * // Reset the sensor's heading value to 0 * imu.tare_heading(); * delay(20); @@ -511,22 +539,22 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's pitch value to 10 * imu.set_pitch(10); * delay(20); - * + * * // Do something with sensor - * + * * // Reset the sensor's pitch value to 0 * imu.tare_pitch(); * delay(20); @@ -548,22 +576,22 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's yaw value to 10 * imu.set_yaw(10); * delay(20); - * + * * // Do something with sensor - * + * * // Reset the sensor's yaw value to 0 * imu.tare_yaw(); * delay(20); @@ -585,22 +613,22 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's roll value to 10 * imu.set_roll(10); * delay(20); - * + * * // Do something with sensor - * + * * // Reset the sensor's roll value to 0 * imu.tare_roll(); * delay(20); @@ -622,15 +650,15 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Reset all values of the sensor to 0 * imu.tare(); @@ -653,22 +681,22 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Reset all euler values of the sensor to 0 * imu.tare_euler(); * delay(20); * } * } - * \endcode + * \endcode */ virtual std::int32_t tare_euler() const; /** @@ -687,20 +715,20 @@ class Imu : public Device { * Target value for the heading value to be set to * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's heading value to 10 * imu.set_heading(10); * delay(20); - * + * * // Do something with sensor * } * } @@ -722,20 +750,20 @@ class Imu : public Device { * Target value for the rotation value to be set to * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's rotation value to 10 * imu.set_rotation(10); * delay(20); - * + * * // Do something with sensor * } * } @@ -758,20 +786,20 @@ class Imu : public Device { * Target value for yaw value to be set to * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's yaw value to 10 * imu.set_yaw(10); * delay(20); - * + * * // Do something with sensor * } * } @@ -793,20 +821,20 @@ class Imu : public Device { * Target value for the pitch value to be set to * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's pitch value to 10 * imu.set_pitch(10); * delay(20); - * + * * // Do something with sensor * } * } @@ -829,20 +857,20 @@ class Imu : public Device { * Target euler values for the euler values to be set to * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's roll value to 100 * imu.set_roll(100); * delay(20); - * + * * // Do something with sensor * } * } @@ -865,20 +893,20 @@ class Imu : public Device { * Target euler values for the euler values to be set to * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Set the sensor's euler values to 50 * imu.set_euler(50); * delay(20); - * + * * // Do something with sensor * } * } @@ -898,25 +926,25 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return The raw accelerometer values. If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's raw accelerometer values * pros::imu_accel_s_t accel = imu.get_accel(); * printf("x: %f, y: %f, z: %f\n", accel.x, accel.y, accel.z); * delay(20); - * + * * // Do something with sensor * } * } - * \endcode + * \endcode */ virtual pros::imu_accel_s_t get_accel() const; /** @@ -932,21 +960,21 @@ class Imu : public Device { * The V5 Inertial Sensor port number from 1-21 * \return The Inertial Sensor's status code, or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Get the sensor's status * pros::ImuStatus status = imu.get_status(); * cout << "Status: " << status << endl; * delay(20); - * + * * // Do something with sensor * } * } @@ -958,38 +986,52 @@ class Imu : public Device { * * \return true if the V5 Inertial Sensor is calibrating or false * false if it is not. - * + * * \b Example * \code - * + * * #define IMU_PORT 1 - * + * * void opcontrol() { * pros::Imu imu(IMU_PORT); - * + * * while (true) { * // Calibrate the sensor * imu.calibrate(); * delay(20); - * + * * // Check if the sensor is calibrating * if (imu.is_calibrating()) { * printf("Calibrating...\n"); * } - * + * * // Do something with sensor * } * } * \endcode */ virtual bool is_calibrating() const; + /** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The physical orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ + virtual imu_orientation_e_t get_physical_orientation() const; /** - * This is the overload for the << operator for printing to streams - * - * Prints in format(this below is all in one line with no new line): - * Imu [port: imu._port, rotation: (rotation), heading: (heading), - * pitch: (pitch angle), roll: (roll angle), yaw: (yaw angle), + * This is the overload for the << operator for printing to streams + * + * Prints in format(this below is all in one line with no new line): + * Imu [port: imu._port, rotation: (rotation), heading: (heading), + * pitch: (pitch angle), roll: (roll angle), yaw: (yaw angle), * gyro rate: {x,y,z}, get accel: {x,y,z}, calibrating: (calibrating boolean)] */ friend std::ostream& operator<<(std::ostream& os, const pros::Imu& imu); diff --git a/include/pros/link.h b/include/pros/link.h index bd02a17e..9cd6eead 100644 --- a/include/pros/link.h +++ b/include/pros/link.h @@ -41,9 +41,9 @@ namespace pros { * \brief Enum for the type of link (TX or RX) */ typedef enum link_type_e { - E_LINK_RECEIVER = 0, ///< Indicates that the radio is a receiver. + E_LINK_RECIEVER = 0, ///< Indicates that the radio is a reciever. E_LINK_TRANSMITTER, ///< Indicates that the link is a transmitter. - E_LINK_RX = E_LINK_RECEIVER, ///< Alias for E_LINK_RECEIVER + E_LINK_RX = E_LINK_RECIEVER, ///< Alias for E_LINK_RECIEVER E_LINK_TX = E_LINK_TRANSMITTER ///< Alias for E_LINK_TRANSMITTER } link_type_e_t; diff --git a/include/pros/link.hpp b/include/pros/link.hpp index 45d98df8..68bb5e51 100644 --- a/include/pros/link.hpp +++ b/include/pros/link.hpp @@ -56,7 +56,7 @@ class Link : public Device { * with the transmitter having double the transmitting bandwidth as the receiving * end (1040 bytes/s vs 520 bytes/s). * \param ov - * Indicates if the radio on the given port needs vexlink to override the controller radio + * Indicates if the radio on the given port needs vexlink to override the controller radio. Defualts to True. * * \return PROS_ERR if initialization fails, 1 if the initialization succeeds. * @@ -65,7 +65,7 @@ class Link : public Device { * pros::Link link(1, "my_link", pros::E_LINK_TX); * \endcode */ - explicit Link(const std::uint8_t port, const std::string link_id, link_type_e_t type, bool ov = false); + explicit Link(const std::uint8_t port, const std::string link_id, link_type_e_t type, bool ov = true); /** * Checks if a radio link on a port is active or not. diff --git a/include/pros/misc.h b/include/pros/misc.h index d0ad6764..677dad81 100644 --- a/include/pros/misc.h +++ b/include/pros/misc.h @@ -14,7 +14,7 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * + * * \defgroup c-misc Miscellaneous C API * \note Additional example code for this module can be found in its [Tutorial.](@ref controller) */ @@ -38,9 +38,16 @@ /// \name V5 Competition //@{ -#define COMPETITION_DISABLED (1 << 0) +/*#define COMPETITION_DISABLED (1 << 0) #define COMPETITION_AUTONOMOUS (1 << 1) #define COMPETITION_CONNECTED (1 << 2) +#define COMPETITION_SYSTEM (1 << 3)*/ +typedef enum { + COMPETITION_DISABLED = 1 << 0, + COMPETITION_CONNECTED = 1 << 2, + COMPETITION_AUTONOMOUS = 1 << 1, + COMPETITION_SYSTEM = 1 << 3, +} competition_status; #ifdef __cplusplus extern "C" { @@ -54,7 +61,7 @@ namespace c { * * \return The competition control status as a mask of bits with * COMPETITION_{ENABLED,AUTONOMOUS,CONNECTED}. - * + * * \b Example * \code * void initialize() { @@ -67,17 +74,11 @@ namespace c { */ uint8_t competition_get_status(void); -#ifdef __cplusplus -} -} -} -#endif - /** * \fn competition_is_disabled() - * + * * \return True if the V5 Brain is disabled, false otherwise. - * + * * \b Example * \code * void my_task_fn(void* ignore) { @@ -85,17 +86,17 @@ uint8_t competition_get_status(void); * // Run competition tasks (like Lift Control or similar) * } * } - * + * * void initialize() { * task_t my_task = task_create(my_task_fn, NULL, TASK_PRIO_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "My Task"); * } * \endcode */ -#define competition_is_disabled() ((competition_get_status() & COMPETITION_DISABLED) != 0) +uint8_t competition_is_disabled(void); /** * \return True if the V5 Brain is connected to competition control, false otherwise. - * + * * \b Example * \code * void initialize() { @@ -106,11 +107,11 @@ uint8_t competition_get_status(void); * } * \endcode */ -#define competition_is_connected() ((competition_get_status() & COMPETITION_CONNECTED) != 0) +uint8_t competition_is_connected(void); /** * \return True if the V5 Brain is in autonomous mode, false otherwise. - * + * * \b Example * \code * void my_task_fn(void* ignore) { @@ -122,14 +123,46 @@ uint8_t competition_get_status(void); * // Run whatever code is desired to just execute in autonomous * } * } - * + * * void initialize() { * task_t my_task = task_create(my_task_fn, NULL, TASK_PRIO_DEFAULT, TASK_STACK_DEPTH_DEFAULT, "My Task"); * } * \endcode */ -#define competition_is_autonomous() ((competition_get_status() & COMPETITION_AUTONOMOUS) != 0) +uint8_t competition_is_autonomous(void); + +/** + * \return True if the V5 Brain is connected to VEXnet Field Controller, false otherwise. + * + * \b Example + * \code + * void initialize() { + * if (competition_is_field()) { + * // connected to VEXnet Field Controller + * } + * } + * \endcode + */ +uint8_t competition_is_field(void); +/** + * \return True if the V5 Brain is connected to VEXnet Competition Switch, false otherwise. + * + * \b Example + * \code + * void initialize() { + * if (competition_is_switch()) { + * // connected to VEXnet Competition Switch + * } + * } + */ +uint8_t competition_is_switch(void); + +#ifdef __cplusplus +} +} +} +#endif ///@} /// \name V5 Controller @@ -143,22 +176,23 @@ namespace pros { * \enum */ typedef enum { - ///The master controller. + /// The master controller. E_CONTROLLER_MASTER = 0, - ///The partner controller. - E_CONTROLLER_PARTNER } controller_id_e_t; + /// The partner controller. + E_CONTROLLER_PARTNER +} controller_id_e_t; /** * \enum */ typedef enum { - ///The horizontal axis of the controller’s left analog stick. + /// The horizontal axis of the controller’s left analog stick. E_CONTROLLER_ANALOG_LEFT_X = 0, - ///The vertical axis of the controller’s left analog stick. + /// The vertical axis of the controller’s left analog stick. E_CONTROLLER_ANALOG_LEFT_Y, - ///The horizontal axis of the controller’s right analog stick. + /// The horizontal axis of the controller’s right analog stick. E_CONTROLLER_ANALOG_RIGHT_X, - ///The vertical axis of the controller’s right analog stick. + /// The vertical axis of the controller’s right analog stick. E_CONTROLLER_ANALOG_RIGHT_Y } controller_analog_e_t; @@ -166,29 +200,29 @@ typedef enum { * \enum */ typedef enum { - ///The first trigger on the left side of the controller. + /// The first trigger on the left side of the controller. E_CONTROLLER_DIGITAL_L1 = 6, - ///The second trigger on the left side of the controller. + /// The second trigger on the left side of the controller. E_CONTROLLER_DIGITAL_L2, - ///The first trigger on the right side of the controller. + /// The first trigger on the right side of the controller. E_CONTROLLER_DIGITAL_R1, - ///The second trigger on the right side of the controller. + /// The second trigger on the right side of the controller. E_CONTROLLER_DIGITAL_R2, - ///The up arrow on the left arrow pad of the controller. + /// The up arrow on the left arrow pad of the controller. E_CONTROLLER_DIGITAL_UP, - ///The down arrow on the left arrow pad of the controller. + /// The down arrow on the left arrow pad of the controller. E_CONTROLLER_DIGITAL_DOWN, - ///The left arrow on the left arrow pad of the controller. + /// The left arrow on the left arrow pad of the controller. E_CONTROLLER_DIGITAL_LEFT, - ///The right arrow on the left arrow pad of the controller. + /// The right arrow on the left arrow pad of the controller. E_CONTROLLER_DIGITAL_RIGHT, - ///The ‘X’ button on the right button pad of the controller. + /// The ‘X’ button on the right button pad of the controller. E_CONTROLLER_DIGITAL_X, - ///The ‘B’ button on the right button pad of the controller. + /// The ‘B’ button on the right button pad of the controller. E_CONTROLLER_DIGITAL_B, - ///The ‘Y’ button on the right button pad of the controller. + /// The ‘Y’ button on the right button pad of the controller. E_CONTROLLER_DIGITAL_Y, - ///The ‘A’ button on the right button pad of the controller. + /// The ‘A’ button on the right button pad of the controller. E_CONTROLLER_DIGITAL_A } controller_digital_e_t; @@ -235,26 +269,27 @@ typedef enum { #endif /** - * \def Given an id and a port, this macro sets the port variable based on the id and allows the mutex to take that port. - * + * \def Given an id and a port, this macro sets the port variable based on the id and allows the mutex to take that + * port. + * * \returns error (in the function/scope it's in) if the controller failed to connect or an invalid id is given. -*/ + */ #define CONTROLLER_PORT_MUTEX_TAKE(id, port) \ - switch (id) { \ - case E_CONTROLLER_MASTER: \ - port = V5_PORT_CONTROLLER_1; \ - break; \ - case E_CONTROLLER_PARTNER: \ - port = V5_PORT_CONTROLLER_2; \ - break; \ - default: \ - errno = EINVAL; \ - return PROS_ERR; \ - } \ - if (!internal_port_mutex_take(port)) { \ - errno = EACCES; \ - return PROS_ERR; \ - } \ + switch (id) { \ + case E_CONTROLLER_MASTER: \ + port = V5_PORT_CONTROLLER_1; \ + break; \ + case E_CONTROLLER_PARTNER: \ + port = V5_PORT_CONTROLLER_2; \ + break; \ + default: \ + errno = EINVAL; \ + return PROS_ERR; \ + } \ + if (!internal_port_mutex_take(port)) { \ + errno = EACCES; \ + return PROS_ERR; \ + } #ifdef __cplusplus namespace c { @@ -274,7 +309,7 @@ namespace c { * Must be one of CONTROLLER_MASTER or CONTROLLER_PARTNER * * \return 1 if the controller is connected, 0 otherwise - * + * * \b Example * \code * void initialize() { @@ -306,7 +341,7 @@ int32_t controller_is_connected(controller_id_e_t id); * * \return The current reading of the analog channel: [-127, 127]. * If the controller was not connected, then 0 is returned - * + * * \b Example * \code * void opcontrol() { @@ -333,7 +368,7 @@ int32_t controller_get_analog(controller_id_e_t id, controller_analog_e_t channe * Must be one of E_CONTROLLER_MASTER or E_CONTROLLER_PARTNER * * \return The controller's battery capacity - * + * * \b Example * \code * void initialize() { @@ -357,7 +392,7 @@ int32_t controller_get_battery_capacity(controller_id_e_t id); * Must be one of E_CONTROLLER_MASTER or E_CONTROLLER_PARTNER * * \return The controller's battery level - * + * * \b Example * \code * void initialize() { @@ -385,7 +420,7 @@ int32_t controller_get_battery_level(controller_id_e_t id); * * \return 1 if the button on the controller is pressed. * If the controller was not connected, then 0 is returned - * + * * \b Example * \code * void opcontrol() { @@ -430,7 +465,7 @@ int32_t controller_get_digital(controller_id_e_t id, controller_digital_e_t butt * * \return 1 if the button on the controller is pressed and had not been pressed * the last time this function was called, 0 otherwise. - * + * * \b Example * \code * void opcontrol() { @@ -438,7 +473,7 @@ int32_t controller_get_digital(controller_id_e_t id, controller_digital_e_t butt * if (controller_get_digital_new_press(E_CONTROLLER_MASTER, E_CONTROLLER_DIGITAL_A)) { * // Toggle pneumatics or other similar actions * } - * + * * delay(2); * } * } @@ -473,7 +508,7 @@ int32_t controller_get_digital_new_press(controller_id_e_t id, controller_digita * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * void opcontrol() { @@ -516,7 +551,7 @@ int32_t controller_print(controller_id_e_t id, uint8_t line, uint8_t col, const * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * void opcontrol() { @@ -554,7 +589,7 @@ int32_t controller_set_text(controller_id_e_t id, uint8_t line, uint8_t col, con * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * void opcontrol() { @@ -585,7 +620,7 @@ int32_t controller_clear_line(controller_id_e_t id, uint8_t line); * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * void opcontrol() { @@ -619,7 +654,7 @@ int32_t controller_clear(controller_id_e_t id); * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * void opcontrol() { @@ -645,7 +680,7 @@ int32_t controller_rumble(controller_id_e_t id, const char* rumble_pattern); * EACCES - Another resource is currently trying to access the battery port. * * \return The current voltage of the battery - * + * * \b Example * \code * void initialize() { @@ -663,7 +698,7 @@ int32_t battery_get_voltage(void); * EACCES - Another resource is currently trying to access the battery port. * * \return The current current of the battery - * + * * \b Example * \code * void initialize() { @@ -681,7 +716,7 @@ int32_t battery_get_current(void); * EACCES - Another resource is currently trying to access the battery port. * * \return The current temperature of the battery - * + * * \b Example * \code * void initialize() { @@ -699,7 +734,7 @@ double battery_get_temperature(void); * EACCES - Another resource is currently trying to access the battery port. * * \return The current capacity of the battery - * + * * \b Example * \code * void initialize() { @@ -713,7 +748,7 @@ double battery_get_capacity(void); * Checks if the SD card is installed. * * \return 1 if the SD card is installed, 0 otherwise - * + * * \b Example * \code * void opcontrol() { @@ -723,6 +758,49 @@ double battery_get_capacity(void); */ int32_t usd_is_installed(void); +/** + * Lists the files in a directory specified by the path + * Puts the list of file names (NOT DIRECTORIES) into the buffer seperated by newlines + * + * This function uses the following values of errno when an error state is + * reached: + * + * EIO - Hard error occured in the low level disk I/O layer + * EINVAL - file or directory is invalid, or length is invalid + * EBUSY - THe physical drinve cannot work + * ENOENT - cannot find the path or file + * EINVAL - the path name format is invalid + * EACCES - Access denied or directory full + * EEXIST - Access denied + * EROFS - SD card is write protected + * ENXIO - drive number is invalid or not a FAT32 drive + * ENOBUFS - drive has no work area + * ENFILE - too many open files + * + * + * + * \note use a path of "\" to list the files in the main directory NOT "/usd/" + * DO NOT PREPEND YOUR PATHS WITH "/usd/" + * + * \return 1 on success or PROS_ERR on failure setting errno + * + * \b Example + * \code + * void opcontrol() { + * char* test = (char*) malloc(128); + * pros::c::usd_list_files("/", test, 128); + * pros::delay(200); + * printf("%s\n", test); //Prints the file names in the root directory seperated by newlines + * pros::delay(100); + * pros::c::usd_list_files("/test", test, 128); + * pros::delay(200); + * printf("%s\n", test); //Prints the names of files in the folder named test seperated by newlines + * pros::delay(100); + * } + * \endcode + */ +int32_t usd_list_files(const char* path, char* buffer, int32_t len); + /******************************************************************************/ /** Date and Time **/ /******************************************************************************/ @@ -731,16 +809,16 @@ extern const char* baked_date; extern const char* baked_time; typedef struct { - uint16_t year; // Year - 1980 + uint16_t year; // Year - 1980 uint8_t day; - uint8_t month; // 1 = January + uint8_t month; // 1 = January } date_s_t; typedef struct { uint8_t hour; uint8_t min; uint8_t sec; - uint8_t sec_hund; // hundredths of a second + uint8_t sec_hund; // hundredths of a second } time_s_t; ///@} @@ -749,7 +827,7 @@ typedef struct { #ifdef __cplusplus } -} // namespace pros +} // namespace pros } #endif diff --git a/include/pros/misc.hpp b/include/pros/misc.hpp index 8ade055a..25ad31a1 100644 --- a/include/pros/misc.hpp +++ b/include/pros/misc.hpp @@ -509,6 +509,8 @@ std::uint8_t get_status(void); std::uint8_t is_autonomous(void); std::uint8_t is_connected(void); std::uint8_t is_disabled(void); +std::uint8_t is_field_control(void); +std::uint8_t is_competition_switch(void); } // namespace competition namespace usd { @@ -525,6 +527,48 @@ namespace usd { * \endcode */ std::int32_t is_installed(void); +/** +Lists the files in a directory specified by the path + * Puts the list of file names (NOT DIRECTORIES) into the buffer seperated by newlines + * + * This function uses the following values of errno when an error state is + * reached: + * + * EIO - Hard error occured in the low level disk I/O layer + * EINVAL - file or directory is invalid, or length is invalid + * EBUSY - THe physical drinve cannot work + * ENOENT - cannot find the path or file + * EINVAL - the path name format is invalid + * EACCES - Access denied or directory full + * EEXIST - Access denied + * EROFS - SD card is write protected + * ENXIO - drive number is invalid or not a FAT32 drive + * ENOBUFS - drive has no work area + * ENFILE - too many open files + * + * + * + * \note use a path of "\" to list the files in the main directory NOT "/usd/" + * DO NOT PREPEND YOUR PATHS WITH "/usd/" + * + * \return 1 on success or PROS_ERR on failure setting errno + * + * \b Example + * \code + * void opcontrol() { + * char* test = (char*) malloc(128); + * pros::usd::list_files("/", test, 128); + * pros::delay(200); + * printf("%s\n", test); //Prints the file names in the root directory seperated by newlines + * pros::delay(100); + * pros::list_files("/test", test, 128); + * pros::delay(200); + * printf("%s\n", test); //Prints the names of files in the folder named test seperated by newlines + * pros::delay(100); + * } + * \endcode +*/ +std::int32_t list_files(const char* path, char* buffer, std::int32_t len); } // namespace usd } // namespace pros diff --git a/include/pros/motor_group.hpp b/include/pros/motor_group.hpp index 71423d63..4ff73e46 100644 --- a/include/pros/motor_group.hpp +++ b/include/pros/motor_group.hpp @@ -41,143 +41,111 @@ class MotorGroup : public virtual AbstractMotor { * @{ */ public: - /** * Constructs a new MotorGroup object. - * + * * This function uses the following values of errno when an error state is - * reached: - * ENXIO - The given value is not within the range of V5 ports |1-21|. - * ENODEV - The port cannot be configured as a motor - * + * reached: + * ENXIO - The given value is not within the range of V5 ports |1-21|. + * ENODEV - The port cannot be configured as a motor + * * \param port - * A initializer list of V5 port numbers from 1 to 21, or from -21 to -1 for reversed motors. + * A initializer list of V5 port numbers from 1 to 21, or from -21 to -1 for reversed motors. * A reversed motor will reverse the input or output movement functions and movement related * telemetry in order to produce consistant behavior with non-reversed motors - * - * \param gearset = pros::v5::MotorGears::green + * + * \param gearset = pros::v5::MotorGears::invalid * Optional parameter for the gearset for the motor. - * set to pros::v5::MotorGears::green if not specifed. - * - * \param encoder_units = pros::v5::MotorUnits::degrees + * Does not explicitly set the motor gearset if it is invalid or not specified + * + * \param encoder_units = pros::v5::MotorUnits::invalid * Optional parameter for the encoder units of the motor - * set to pros::v5::MotorUnits::degrees if not specified by the user - * + * Does not explicitly set the motor units if it is invalid or not specified + * * \b Example - * \code - * void opcontrol() { - * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with - * with both motors using the green gearset and degrees as the encoder units + * \code + * void opcontrol() { + * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 * MotorGroup rotations_mg({4, 5}, pros::v5::MotorGears::blue, pros::v5::MotorUnits::rotations); - * //Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units - * } + * //Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units + * } * \endcode */ - explicit MotorGroup(std::initializer_list, const pros::v5::MotorGears gearset = pros::v5::MotorGears::green, - const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::degrees); + MotorGroup(const std::initializer_list, + const pros::v5::MotorGears gearset = pros::v5::MotorGears::invalid, + const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::invalid); /** * Constructs a new MotorGroup object. - * + * * This function uses the following values of errno when an error state is - * reached: - * + * reached: + * * ENXIO - The given value is not within the range of V5 ports |1-21|. - * + * * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * + * * \param port - * A initializer list of V5 port numbers from 1 to 21, or from -21 to -1 for reversed motors. + * A initializer list of V5 port numbers from 1 to 21, or from -21 to -1 for reversed motors. * A reversed motor will reverse the input or output movement functions and movement related * telemetry in order to produce consistant behavior with non-reversed motors - * - * \param gearset = pros::v5::MotorGears::green + * + * \param gearset = pros::v5::MotorGears::invalid + * \param gearset = pros::v5::MotorGears::green * Optional parameter for the gearset for the motor. - * set to pros::v5::MotorGears::green if not specifed. - * - * \param encoder_units = pros::v5::MotorUnits::degrees + * Does not explicitly set the motor gearset if it is invalid or not specified + * + * \param encoder_units = pros::v5::MotorUnits::invalid * Optional parameter for the encoder units of the motor - * set to pros::v5::MotorUnits::degrees if not specified by the user - * + * Does not explicitly set the motor units if it is invalid or not specified + * * \b Example - * \code - * void opcontrol() { - * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with + * \code + * void opcontrol() { + * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with * with both motors using the green gearset and degrees as the encoder units * MotorGroup rotations_mg({4, 5}, pros::v5::MotorGears::blue, pros::v5::MotorUnits::rotations); - * //Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units - * } + * //Creates a motor group on ports 4 and 5 with blue motors using rotaions as the encoder units + * } * \endcode */ - explicit MotorGroup(const std::vector& ports, const pros::v5::MotorGears gearset = pros::v5::MotorGears::green, - const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::degrees); + MotorGroup(const std::vector& ports, const pros::v5::MotorGears gearset = pros::v5::MotorGears::invalid, + const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::invalid); - /** + /** * Constructs a new MotorGroup object from an abstract motor. - * + * * This function uses the following values of errno when an error state is - * reached: - * + * reached: + * * ENXIO - The given value is not within the range of V5 ports |1-21|. - * + * * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * + * * \param abstract_motor * THe abstract motor to turn into a motor group * Uses abstract_motor.get_port_all() to get the vector of ports - * - * + * + * * \b Example - * \code - * void opcontrol() { - * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with + * \code + * void opcontrol() { + * MotorGroup first_mg({1, -2}); //Creates a motor on port 1 and a reversed motor on port 2 with * with both motors using the green gearset and degrees as the encoder units * AbstractMotor abs_mtr_group = first_mg; * MotorGroup new_mg = (MotorGroup) abs_mtr_group; - * } + * } * \endcode */ - - MotorGroup(AbstractMotor& abstract_motor); + + MotorGroup(MotorGroup& motor_group); /// \name Motor movement functions /// These functions allow programmers to make motors move ///@{ - /** - * Sets the voltage for the motor group from -128 to 127. - * - * This is designed to map easily to the input from the controller's analog - * stick for simple opcontrol use. The actual behavior of the motor is - * analogous to use of pros::Motor::move() - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * EDOM - the motor group is empty - * - * \param voltage - * The new voltage from -127 to 127 - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::MotorGroup MotorGroup ({1,3}, E_MOTOR_GEARSET_18); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * mg = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * pros::delay(2); - * } - * } - * \endcode - */ - std::int32_t operator=(std::int32_t voltage) const; - /** * Sets the voltage for the motor group from -127 to 127. * @@ -355,10 +323,9 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t move_voltage(const std::int32_t voltage) const; - /** * Stops the motor group using the currently configured brake mode. - * + * * This function sets motor velocity to zero, which will cause it to act * according to the set brake mode. If brake mode is set to MOTOR_BRAKE_HOLD, * this function may behave differently than calling move_absolute(0) @@ -367,22 +334,22 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example - * \code - * void autonomous() { - * Motor motor(1); - * mg.move_voltage(12000); - * pros::delay(1000); // Move at max voltage for 1 second - * motor.brake(); - * } - * \endcode - */ + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + * + * \b Example + * \code + * void autonomous() { + * Motor motor(1); + * mg.move_voltage(12000); + * pros::delay(1000); // Move at max voltage for 1 second + * motor.brake(); + * } + * \endcode + */ std::int32_t brake(void) const; /** @@ -401,7 +368,7 @@ class MotorGroup : public virtual AbstractMotor { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * void autonomous() { @@ -413,7 +380,7 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ std::int32_t modify_profiled_velocity(const std::int32_t velocity) const; - + /** * Gets the target position set for a motor in the motor group, with a parameter * for the motor index. @@ -423,7 +390,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group @@ -469,16 +436,16 @@ class MotorGroup : public virtual AbstractMotor { /** * Gets the velocity commanded to the motor by the user at the index specified. - * + * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * EDOM - The motor group was empty - * - * \param index Optional parameter. + * + * \param index Optional parameter. * The zero indexed index of the motor in the motor group - * + * * \return The commanded motor velocity from +-100, +-200, or +-600, or * PROS_ERR if the operation failed, setting errno. * @@ -490,7 +457,7 @@ class MotorGroup : public virtual AbstractMotor { * while (true) { * mg.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); * // get the target velocity from motor at index 1. (port 3) - * std::cout << "Motor Velocity: " << mg.get_target_velocity(1); + * std::cout << "Motor Velocity: " << mg.get_target_velocity(1); * pros::delay(2); * } * } @@ -500,12 +467,12 @@ class MotorGroup : public virtual AbstractMotor { /** * Gets a vector of the velocity commanded to the motor by the user - * + * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EDOM - THe motor group is empty - * + * * \return A vector of the commanded motor velocity from +-100, +-200, or +-600, or * PROS_ERR if the operation failed, setting errno. * @@ -516,7 +483,7 @@ class MotorGroup : public virtual AbstractMotor { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * mg.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); - * std::cout << "Motor Velocity: " << mg.get_target_velocity_all(); + * std::cout << "Motor Velocity: " << mg.get_target_velocity_all(); * pros::delay(2); * } * } @@ -536,13 +503,13 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - THe motor group is empty * * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * - * \param index Optional parameter. - * The zero indexed index of the motor in the motor group + * + * \param index Optional parameter. + * The zero indexed index of the motor in the motor group * * \return The motor's actual velocity in RPM or PROS_ERR_F if the operation * failed, setting errno. @@ -561,14 +528,14 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ double get_actual_velocity(const std::uint8_t index = 0) const; - + /** * Gets a vector of the the actual velocity of each motor the motor group. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - THe motor group is empty * * \return A vector of the each motor's actual velocity in RPM or PROS_ERR_F if the operation @@ -595,13 +562,13 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty * * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * - * \param index Optional parameter. - * The zero indexed index of the motor in the motor group + * + * \param index Optional parameter. + * The zero indexed index of the motor in the motor group * * \return The motor's current in mA or PROS_ERR if the operation failed, * setting errno. @@ -627,7 +594,7 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty * * @@ -655,14 +622,14 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * + * * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 for moving in the positive direction, -1 for moving in the * negative direction, and PROS_ERR if the operation failed, setting errno. * @@ -689,7 +656,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * * EDOM - The motor group is empty - * + * * \return 1 for moving in the positive direction, -1 for moving in the * negative direction, and PROS_ERR if the operation failed, setting errno. * @@ -718,12 +685,12 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * + * * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * - * + * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -755,10 +722,10 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - THe motor group is empty * - * \return A vecotr containing each motor's efficiency in percent or PROS_ERR_F if the operation + * \return A vector containing each motor's efficiency in percent or PROS_ERR_F if the operation * failed, setting errno. * * \b Example @@ -784,9 +751,9 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * + * * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param index Optional parameter, 0 by default. @@ -816,9 +783,9 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * + * * EDOM - The motor group is empty - * + * * * \return A vector containing the bitfields containing each motor's faults. * @@ -866,7 +833,7 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ std::uint32_t get_flags(const std::uint8_t index = 0) const; - + /** * Gets a vector of the flags set by each motor in the motor groups's operation. * @@ -902,7 +869,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -957,7 +924,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -1011,13 +978,13 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * - * + * + * * \param timestamp * A pointer to a time in milliseconds for which the encoder count * will be returned. If NULL, the timestamp at which the encoder * count was read will not be supplied - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -1081,7 +1048,7 @@ class MotorGroup : public virtual AbstractMotor { * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return The motor's temperature in degrees Celsius or PROS_ERR_F if the * operation failed, setting errno. * @@ -1107,7 +1074,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * - * \return A vecotr of each motor's temperature in degrees Celsius or PROS_ERR_F if the + * \return A vector of each motor's temperature in degrees Celsius or PROS_ERR_F if the * operation failed, setting errno. * * \b Example @@ -1135,7 +1102,7 @@ class MotorGroup : public virtual AbstractMotor { * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return The motor's torque in Nm or PROS_ERR_F if the operation failed, * setting errno. * @@ -1186,10 +1153,10 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return The motor's voltage in mV or PROS_ERR_F if the operation failed, * setting errno. * @@ -1241,10 +1208,10 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 if the motor's current limit is being exceeded and 0 if the * current limit is not exceeded, or PROS_ERR if the operation failed, setting * errno. @@ -1271,9 +1238,8 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * - * \return A vector containing the following for each motor: 1 if the motor's current limit is being exceeded and 0 if the - * current limit is not exceeded, or PROS_ERR if the operation failed, setting - * errno. + * \return A vector containing the following for each motor: 1 if the motor's current limit is being exceeded and 0 if + * the current limit is not exceeded, or PROS_ERR if the operation failed, setting errno. * * \b Example * \code @@ -1298,7 +1264,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -1320,7 +1286,7 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t is_over_temp(const std::uint8_t index = 0) const; /** - * Gets a vecotr with the temperature limit flag for each motor in the motor group. + * Gets a vector with the temperature limit flag for each motor in the motor group. * * This function uses the following values of errno when an error state is * reached: @@ -1359,11 +1325,11 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * - * \return One of Motor_Brake, according to what was set for the + * \return One of MotorBrake, according to what was set for the * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example @@ -1377,14 +1343,14 @@ class MotorGroup : public virtual AbstractMotor { */ MotorBrake get_brake_mode(const std::uint8_t index = 0) const; /** - * Gets a vecotr with the brake mode that was set for each motor in the motor group. + * Gets a vector with the brake mode that was set for each motor in the motor group. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * - * \return A vector with one of Motor_Brake for each motor in the motor group, according to what was set for the + * \return A vector with one of MotorBrake for each motor in the motor group, according to what was set for the * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example @@ -1408,7 +1374,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -1427,7 +1393,7 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ std::int32_t get_current_limit(const std::uint8_t index = 0) const; - + /** * Gets a vector of the current limit for each motor in the motor group in mA. * @@ -1462,11 +1428,11 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * - * \return One of Motor_Units according to what is set for the + * \return One of MotorUnits according to what is set for the * motor or E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example @@ -1478,7 +1444,7 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ MotorUnits get_encoder_units(const std::uint8_t index = 0) const; - + /** * Gets a vector of the encoder units that were set for each motor in the motor group. * @@ -1487,7 +1453,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * - * \return A vector with the following for each motor, One of Motor_Units according to what is set for the + * \return A vector with the following for each motor, One of MotorUnits according to what is set for the * motor or E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example @@ -1508,12 +1474,12 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * *\param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * - * \return One of Motor_Gears according to what is set for the motor, - * or pros::Motor_Gears::invalid if the operation failed. + * \return One of MotorGears according to what is set for the motor, + * or pros::MotorGears::invalid if the operation failed. * * \b Example * \code @@ -1533,8 +1499,8 @@ class MotorGroup : public virtual AbstractMotor { * EDOM - The motor group is empty * * - * \return A vector with one of Motor_Gears according to what is set for the motor, - * or pros::Motor_Gears::invalid if the operation failed for each motor. + * \return A vector with one of MotorGears according to what is set for the motor, + * or pros::MotorGears::invalid if the operation failed for each motor. * * \b Example * \code @@ -1549,7 +1515,7 @@ class MotorGroup : public virtual AbstractMotor { /** * Gets a vector with all the port numbers in the motor group. * A port will be negative if the motor in the motor group is reversed - * + * * @return a vector with all the port numbers for the motor group */ std::vector get_port_all(void) const; @@ -1565,7 +1531,7 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * *\param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -1583,7 +1549,7 @@ class MotorGroup : public virtual AbstractMotor { std::int32_t get_voltage_limit(const std::uint8_t index = 0) const; /** - * Gets a vector of the voltage limit of each motor in the motor group + * Gets a vector of the voltage limit of each motor in the motor group * * Default value is 0V, which means that there is no software limitation * imposed on the voltage. @@ -1611,10 +1577,10 @@ class MotorGroup : public virtual AbstractMotor { * * This function uses the following values of errno when an error state is * reached: - * + * * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * *\param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -1638,8 +1604,8 @@ class MotorGroup : public virtual AbstractMotor { * reached: * EDOM - The motor group is empty * - * \return A vector conatining the following for each motor: 1 if the motor has been reversed and 0 if the motor was not - * reversed, or PROS_ERR if the operation failed, setting errno. + * \return A vector conatining the following for each motor: 1 if the motor has been reversed and 0 if the motor was + * not reversed, or PROS_ERR if the operation failed, setting errno. * * \b Example * \code @@ -1653,7 +1619,7 @@ class MotorGroup : public virtual AbstractMotor { std::vector is_reversed_all(void) const; /** - * Sets one of Motor_Brake to a motor in the motor group. Works with the C enum + * Sets one of MotorBrake to a motor in the motor group. Works with the C enum * and the C++ enum class. * * This function uses the following values of errno when an error state is @@ -1661,13 +1627,13 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param mode - * The Motor_Brake to set for the motor + * The MotorBrake to set for the motor * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -1683,7 +1649,7 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_brake_mode(const MotorBrake mode, const std::uint8_t index = 0) const; /** - * Sets one of Motor_Brake to a motor in the motor group. Works with the C enum + * Sets one of MotorBrake to a motor in the motor group. Works with the C enum * and the C++ enum class. * * This function uses the following values of errno when an error state is @@ -1691,13 +1657,13 @@ class MotorGroup : public virtual AbstractMotor { * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * * \param mode - * The Motor_Brake to set for the motor + * The MotorBrake to set for the motor * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -1713,16 +1679,16 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_brake_mode(const pros::motor_brake_mode_e_t mode, const std::uint8_t index = 0) const; /** - * Sets one of Motor_Brake all the motors in the motor group. Works with the C enum + * Sets one of MotorBrake all the motors in the motor group. Works with the C enum * and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * + * * \param mode - * The Motor_Brake to set for the motor + * The MotorBrake to set for the motor * * * \return 1 if the operation was successful or PROS_ERR if the operation @@ -1739,18 +1705,18 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_brake_mode_all(const MotorBrake mode) const; /** - * Sets one of Motor_Brake to a motor in the motor group. Works with the C enum + * Sets one of MotorBrake to a motor in the motor group. Works with the C enum * and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * + * * \param mode - * The Motor_Brake to set for the motor + * The MotorBrake to set for the motor + * * - * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1775,11 +1741,11 @@ class MotorGroup : public virtual AbstractMotor { * * \param limit * The new current limit in mA - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * - * + * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1830,20 +1796,20 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_current_limit_all(const std::int32_t limit) const; /** - * Sets one of Motor_Units for one motor in the motor group's motor encoder. Works with the C + * Sets one of MotorUnits for one motor in the motor group's motor encoder. Works with the C * enum and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param units * The new motor encoder units * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1858,20 +1824,20 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_encoder_units(const MotorUnits units, const std::uint8_t index = 0) const; /** - * Sets one of Motor_Units for one motor in the motor group's motor encoder. Works with the C + * Sets one of MotorUnits for one motor in the motor group's motor encoder. Works with the C * enum and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param units * The new motor encoder units * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1886,17 +1852,17 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_encoder_units(const pros::motor_encoder_units_e_t units, const std::uint8_t index = 0) const; /** - * Sets one of Motor_Units for every motor in the motor group's motor encoder. Works with the C + * Sets one of MotorUnits for every motor in the motor group's motor encoder. Works with the C * enum and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * EDOM - The motor group is empty + * EDOM - The motor group is empty * * \param units * The new motor encoder units - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1911,17 +1877,17 @@ class MotorGroup : public virtual AbstractMotor { */ std::int32_t set_encoder_units_all(const MotorUnits units) const; /** - * Sets one of Motor_Units for every motor in the motor group's motor encoder. Works with the C + * Sets one of MotorUnits for every motor in the motor group's motor encoder. Works with the C * enum and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor - * EDOM - The motor group is empty + * EDOM - The motor group is empty * * \param units * The new motor encoder units - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1935,6 +1901,7 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const; + /** * Sets one of the gear cartridge (red, green, blue) for one motor in the motor group. Usable with * the C++ enum class and the C enum. @@ -1943,14 +1910,20 @@ class MotorGroup : public virtual AbstractMotor { * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * E2BIG - The size of the vector mismatches the number of motors in the motor group + * + * \note If there are more motors than gearsets passed in, + * only the first n motors will have their gearsets changed where n is the number of gearsets passed in. + * If there are more gearsets passed in than motors, then the only the first m gearsets will be used, + * where m is the number of motors. In either case, errno will be set to E2BIG, but the operation still occurs + * * * \param gearset * The new geatset of the motor - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1963,7 +1936,7 @@ class MotorGroup : public virtual AbstractMotor { * } * \endcode */ - std::int32_t set_gearing(const MotorGears gearset, const std::uint8_t index = 0) const; + std::int32_t set_gearing(std::vector gearsets) const; /** * Sets one of the gear cartridge (red, green, blue) for one motor in the motor group. Usable with * the C++ enum class and the C enum. @@ -1972,14 +1945,14 @@ class MotorGroup : public virtual AbstractMotor { * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param gearset * The new geatset of the motor - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -1993,6 +1966,38 @@ class MotorGroup : public virtual AbstractMotor { * \endcode */ std::int32_t set_gearing(const pros::motor_gearset_e_t gearset, const std::uint8_t index = 0) const; + + /** + * Sets the gear cartridge (red, green, blue) for each motor in the motor group by taking in a vector of the + * cartridges. Usable with the C++ enum class and the C enum. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * EDOM - The motor group is empty + * E2BIG - The size of the vector mismatches the number of motors in the motor group + * + * \note If there are more motors than gearsets passed in, + * only the first n motors will have their gearsets changed where n is the number of gearsets passed in. + * If there are more gearsets passed in than motors, then the only the first m gearsets will be used, + * where m is the number of motors. In either case, errno will be set to E2BIG, but the operation still occurs + * + * \param gearset + * The a vector containing the new geatsets of the motors + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + * + * \b Example + * \code + * void initialize() { + * pros::MotorGroup mg({1,3}); + * mg.set_gearing(pros::MotorGears::blue, 1); + * std::cout << "Gearset: " << mg.get_gearing(); + * } + * \endcode + */ + std::int32_t set_gearing(std::vector gearsets) const; /** * Sets one of the gear cartridge (red, green, blue) for one motor in the motor group. Usable with * the C++ enum class and the C enum. @@ -2001,10 +2006,39 @@ class MotorGroup : public virtual AbstractMotor { * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param gearset * The new geatset of the motor - * + * + * \param index Optional parameter, 0 by default. + * The zero indexed index of the motor in the motor group + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + * + * \b Example + * \code + * void initialize() { + * pros::MotorGroup mg({1,3}); + * mg.set_gearing(E_MOTOR_GEARSET_06, 1); + * std::cout << "Gearset: " << mg.get_gearing(); + * } + * \endcode + */ + std::int32_t set_gearing(const MotorGears gearset, const std::uint8_t index = 0) const; + /** + * Sets one of the gear cartridge (red, green, blue) for one motor in the motor group. Usable with + * the C++ enum class and the C enum. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * EDOM - The motor group is empty + * + * \param gearset + * The new geatset of the motor + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -2029,7 +2063,7 @@ class MotorGroup : public virtual AbstractMotor { * * \param gearset * The new geatset of the motor - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -2052,8 +2086,8 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * * \param reverse * True reverses the motor, false is default * @@ -2083,7 +2117,7 @@ class MotorGroup : public virtual AbstractMotor { * This function uses the following values of errno when an error state is * reached: * EDOM - The motor group is empty - * + * * \param reverse * True reverses the motor, false is default * @@ -2108,11 +2142,11 @@ class MotorGroup : public virtual AbstractMotor { * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param limit * The new voltage limit in Volts - * + * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group * @@ -2177,8 +2211,8 @@ class MotorGroup : public virtual AbstractMotor { * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() - * + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * * \param position * The new reference position in its encoder units * \param index Optional parameter, 0 by default. @@ -2240,11 +2274,11 @@ class MotorGroup : public virtual AbstractMotor { * reached: * ENODEV - The port cannot be configured as a motor * EDOM - The motor group is empty - * EOVERFLOW - The index is greater than or equal to MotorGroup::size() + * EOVERFLOW - The index is greater than or equal to MotorGroup::size() * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * + * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -2256,14 +2290,14 @@ class MotorGroup : public virtual AbstractMotor { * mg.move_absolute(100, 100); // This does not cause a movement * * mg.tare_position(); - * mg.tare_position(1); - * + * mg.tare_position(1); + * * mg.move_absolute(100, 100); // Moves 100 units forward * } * \endcode */ std::int32_t tare_position(const std::uint8_t index = 0) const; - + /** * Sets the "absolute" zero position of every motor in the motor group to its current position. * @@ -2296,18 +2330,18 @@ class MotorGroup : public virtual AbstractMotor { /** * Gets the port of a motor in the motor group - * + * * * \param index Optional parameter, 0 by default. * The zero indexed index of the motor in the motor group - * - * \return The port of the motor at the specified index. + * + * \return The port of the motor at the specified index. * The return value is negative if the corresponding motor is reversed - */ + */ std::int8_t get_port(const std::uint8_t index = 0) const; /** * Appends all the motors in the other motor group reference to this motor group - * + * * Maintains the order of the other motor group * */ @@ -2315,7 +2349,7 @@ class MotorGroup : public virtual AbstractMotor { /** * Appends all the motors in the other motor group reference to this motor group - * + * * Maintains the order of the other motor group * */ @@ -2325,7 +2359,7 @@ class MotorGroup : public virtual AbstractMotor { * Removes the all motors on the port (regardless of reversal) from the motor group * * \param port The port to remove from the motor group - * + * */ void erase_port(std::int8_t port); @@ -2333,7 +2367,7 @@ class MotorGroup : public virtual AbstractMotor { private: /** * The ordered vector of ports used by the motor group - */ + */ std::vector _ports; mutable pros::Mutex _MotorGroup_mutex; }; diff --git a/include/pros/motors.h b/include/pros/motors.h index ad6ef34a..acf61e7a 100644 --- a/include/pros/motors.h +++ b/include/pros/motors.h @@ -241,7 +241,7 @@ int32_t motor_move_relative(int8_t port, double position, const int32_t velocity int32_t motor_move_velocity(int8_t port, const int32_t velocity); /** - * Sets the output voltage for the motor from -12000 to 12000 in millivolts + * Sets the output voltage for the motor from -12000 to 12000 in millivolts. * * \note A negative port negates the voltage * diff --git a/include/pros/motors.hpp b/include/pros/motors.hpp index 850779a1..26beb484 100644 --- a/include/pros/motors.hpp +++ b/include/pros/motors.hpp @@ -51,91 +51,31 @@ class Motor : public AbstractMotor, public Device { * A reversed motor will reverse the input or output movement functions and movement related * telemetry in order to produce consistant behavior with non-reversed motors * - * \param gearset = pros::v5::MotorGears::green + * \param gearset = pros::v5::MotorGears::green * Optional parameter for the gearset for the motor. - * set to pros::v5::MotorGears::green if not specifed. + * Does not explicitly set the gearset if not specified or if the gearset is invalid * * \param encoder_units = pros::v5::MotorUnits::degrees * Optional parameter for the encoder units of the motor - * set to pros::v5::MotorUnits::degrees if not specified by the user + * Does not explicitly set the gearset if not specified or if the gearset is invalid * - * \b Example + * \b Example * \code * void opcontrol() { - * Motor first_motor(1); //Creates a motor on port 1 with green gearset and degrees as the encoder units - * Motor reversed_motor(-2); //Creates a reversed motor on port 1 with standard gearset and encoder units - * Motor blue_motor(3, pros::v5::MotorGears::blue); //Creates a motor on port 3 with blue gear set and degrees + * Motor first_motor(1); //Creates a motor on port 1 without altering gearset or encoder units + * Motor reversed_motor(-2); //Creates a reversed motor on port 1 port 1 without altering gearset or encoder units + * Motor blue_motor(3, pros::v5::MotorGears::blue); //Creates a motor on port 3 with blue gear set * Motor rotations_motor(4, pros::v5::MotorGears::green, pros::v5::MotorUnits::rotations); port 4 w/ rotations * * } * \endcode * */ - explicit Motor(const std::int8_t port, const pros::v5::MotorGears gearset = pros::v5::MotorGears::green, - const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::degrees); - - - - /** - * Constructs a new Motor object. - * - * This function uses the following values of errno when an error state is - * reached: - * ENXIO - The given value is not within the range of V5 ports |1-21|. - * ENODEV - The port cannot be configured as a motor - * - * \param The abstract motor to create into a motor - * Creates a new motor on the port of abstract_motor.get_port(), maintaining it's reversal status. - * - * - * \b Example - * \code - * void opcontrol() { - * Motor first_motor(1); //Creates a motor on port 1 with green gearset and degrees as the encoder units - * AbstractMotor abs_motor = first_motor; - * Motor new_motor = (Motor) abs_motor; - * - * } - * \endcode - * - */ - Motor(AbstractMotor& abstract_motor); - - - /// \name Motor movement functions - /// These functions allow programmers to make motors move - ///@{ + Motor(const std::int8_t port, const pros::v5::MotorGears gearset = pros::v5::MotorGears::invalid, + const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::invalid); - /** - * Sets the voltage for the motor from -128 to 127. - * - * This is designed to map easily to the input from the controller's analog - * stick for simple opcontrol use. The actual behavior of the motor is - * analogous to use of pros::Motor::move(). - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \param voltage - * The new motor voltage from -127 to 127 - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1, E_MOTOR_GEARSET_18); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * pros::delay(2); - * } - * } - * \endcode - */ - std::int32_t operator=(std::int32_t voltage) const; + Motor(const Device& device) + : Motor(device.get_port()) {}; /** * Sets the voltage for the motor from -127 to 127. @@ -399,29 +339,6 @@ class Motor : public AbstractMotor, public Device { */ double get_target_position(const std::uint8_t index = 0) const; - /** - * Gets a vector containing the target position set for the motor by the user - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * - * \return A vector containing the target position in its encoder units or PROS_ERR_F if the - * operation failed, setting errno. - * - * \b Example - * \code - * void autonomous() { - * pros::Motor motor (1); - * motor.move_absolute(100, 100); - * std::cout << "Motor Target: " << motor.get_target_position_all()[0]; - * // Prints 100 - * } - * \endcode - */ - std::vector get_target_position_all(void) const; - /** * Gets the velocity commanded to the motor by the user at the index specified. * @@ -457,32 +374,6 @@ class Motor : public AbstractMotor, public Device { */ std::int32_t get_target_velocity(const std::uint8_t index = 0) const; - /** - * Gets a vector containing the velocity commanded to the motor by the user - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \return A vector containing the commanded motor velocity from +-100, - * +-200, or +-600, or PROS_ERR if the operation failed, setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); - * std::cout << "Motor Velocity: " << motor.get_target_velocity_all()[0]; - * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y - * pros::delay(2); - * } - * } - * \endcode - */ - std::vector get_target_velocity_all(void) const; - ///@} /// \name Motor telemetry functions @@ -522,33 +413,6 @@ class Motor : public AbstractMotor, public Device { */ double get_actual_velocity(const std::uint8_t index = 0) const; - - /** - * Gets a vector containing the actual velocity commanded of the motor - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \return A vector containing the motor's actual velocity in RPM or PROS_ERR_F - * if the operation failed, setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); - * std::cout << "Motor Velocity: " << motor.get_actual_velocity_all()[0]; - * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y - * pros::delay(2); - * } - * } - * \endcode - */ - std::vector get_actual_velocity_all(void) const; - /** * Gets the current drawn by the motor in mA. * @@ -585,34 +449,6 @@ class Motor : public AbstractMotor, public Device { */ std::int32_t get_current_draw(const std::uint8_t index = 0) const; - - /** - * Gets a vector containing the current drawn by the motor in mA. - * - * This function uses the following values of errno when an error state is - * reached: - * - * ENODEV - The port cannot be configured as a motor - * - * - * \return A vector conatining the motor's current in mA or PROS_ERR if the operation failed, - * setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Current Draw: " << motor.get_current_draw_all()[0]; - * pros::delay(2); - * } - * } - * \endcode - */ - std::vector get_current_draw_all(void) const; - /** * Gets the direction of movement for the motor. * @@ -649,34 +485,6 @@ class Motor : public AbstractMotor, public Device { */ std::int32_t get_direction(const std::uint8_t index = 0) const; - /** - * Gets a vector containing the direction of movement for the motor. - * - * - * This function uses the following values of errno when an error state is - * reached: - * - * ENODEV - The port cannot be configured as a motor - * - * - * \return A vecotr containing 1 for moving in the positive direction, -1 for moving in the - * negative direction, and PROS_ERR if the operation failed, setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Direction: " << motor.get_direction_all()[0]; - * pros::delay(2); - * } - * } - * \endcode - */ - std::vector get_direction_all(void) const; - /** * Gets the efficiency of the motor in percent. * @@ -719,20 +527,27 @@ class Motor : public AbstractMotor, public Device { double get_efficiency(const std::uint8_t index = 0) const; /** - * Gets a vector containing the efficiency of the motor in percent. + * Gets the faults experienced by the motor. * - * An efficiency of 100% means that the motor is moving electrically while - * drawing no electrical power, and an efficiency of 0% means that the motor - * is drawing power but not moving. + * Compare this bitfield to the bitmasks in pros::motor_fault_e_t. + * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor * + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * - * \return A vector containing The motor's efficiency in percent or PROS_ERR_F if the operation - * failed, setting errno. + * + * \return A bitfield containing the motor's faults. * * \b Example * \code @@ -741,18 +556,17 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Efficiency: " << motor.get_efficiency(); - * pros::delay(2); + * std::cout << "Motor Faults: " << motor.get_faults();pros::delay(2); * } * } * \endcode */ - std::vector get_efficiency_all(void) const; - + std::uint32_t get_faults(const std::uint8_t index = 0) const; + /** - * Gets the faults experienced by the motor. + * Gets the flags set by the motor's operation. * - * Compare this bitfield to the bitmasks in pros::motor_fault_e_t. + * Compare this bitfield to the bitmasks in pros::motor_flag_e_t. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -769,8 +583,7 @@ class Motor : public AbstractMotor, public Device { * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * - * \return A bitfield containing the motor's faults. + * \return A bitfield containing the motor's flags. * * \b Example * \code @@ -779,24 +592,34 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Faults: " << motor.get_faults();pros::delay(2); + * std::cout << "Motor Faults: " << motor.get_faults(); + * pros::delay(2); * } * } * \endcode */ - std::uint32_t get_faults(const std::uint8_t index = 0) const; + std::uint32_t get_flags(const std::uint8_t index = 0) const; /** - * Gets a vector of the faults experienced by the motor. + * Gets the absolute position of the motor in its encoder units. * - * Compare this bitfield to the bitmasks in pros::motor_fault_e_t. + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor + * + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * - * \return A bitfield containing the motor's faults. + * \return The motor's absolute position in its encoder units or PROS_ERR_F + * if the operation failed, setting errno. * * \b Example * \code @@ -805,18 +628,16 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Faults: " << motor.get_faults_all()[0]; - * pros::delay(2); + * std::cout << "Motor Position: " << motor.get_position(); + * pros::delay(2); * } * } * \endcode */ - std::vector get_faults_all(void) const; - + double get_position(const std::uint8_t index = 0) const; + /** - * Gets the flags set by the motor's operation. - * - * Compare this bitfield to the bitmasks in pros::motor_flag_e_t. + * Gets the power drawn by the motor in Watts. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -832,8 +653,9 @@ class Motor : public AbstractMotor, public Device { * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * \return A bitfield containing the motor's flags. + * + * \return The motor's power draw in Watts or PROS_ERR_F if the operation + * failed, setting errno. * * \b Example * \code @@ -842,45 +664,62 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Faults: " << motor.get_faults(); + * std::cout << "Motor Power: " << motor.get_power(); * pros::delay(2); * } * } * \endcode */ - std::uint32_t get_flags(const std::uint8_t index = 0) const; + double get_power(const std::uint8_t index = 0) const; /** - * Gets a vector of the flags set by the motor's operation. + * Gets the raw encoder count of the motor at a given timestamp. * - * Compare this bitfield to the bitmasks in pros::motor_flag_e_t. + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor + * + * EOVERFLOW - The index is non 0 + * + * + * \param timestamp + * A pointer to a time in milliseconds for which the encoder count + * will be returned. If NULL, the timestamp at which the encoder + * count was read will not be supplied + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * + * * - * \return A bitfield containing the motor's flags. + * \return The raw encoder count at the given timestamp or PROS_ERR if the + * operation failed. * * \b Example * \code * void opcontrol() { + * std::uint32_t now = pros::millis(); * pros::Motor motor (1); * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Faults: " << motor.get_faults_all()[0]; + * std::cout << "Motor Position: " << motor.get_raw_position(&now); * pros::delay(2); * } * } * \endcode */ - std::vector get_flags_all(void) const; + std::int32_t get_raw_position(std::uint32_t* const timestamp, const std::uint8_t index = 0) const; /** - * Gets the absolute position of the motor in its encoder units. - * + * Gets the temperature of the motor in degrees Celsius. + * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class * for motors and motor groups @@ -896,8 +735,8 @@ class Motor : public AbstractMotor, public Device { * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * \return The motor's absolute position in its encoder units or PROS_ERR_F - * if the operation failed, setting errno. + * \return The motor's temperature in degrees Celsius or PROS_ERR_F if the + * operation failed, setting errno. * * \b Example * \code @@ -906,25 +745,34 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Position: " << motor.get_position(); + * std::cout << "Motor Temperature: " << motor.get_temperature(); * pros::delay(2); * } * } * \endcode */ - double get_position(const std::uint8_t index = 0) const; + double get_temperature(const std::uint8_t index = 0) const; /** - * Gets a vector containing the absolute position of the motor in its encoder units. + * Gets the torque generated by the motor in Newton Meters (Nm). + * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor - + * + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * - * \return A vector containing the motor's absolute position in its encoder units or PROS_ERR_F - * if the operation failed, setting errno. + * \return The motor's torque in Nm or PROS_ERR_F if the operation failed, + * setting errno. * * \b Example * \code @@ -933,16 +781,16 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Position: " << motor.get_position_all()[0]; + * std::cout << "Motor Torque: " << motor.get_torque(); * pros::delay(2); * } * } * \endcode */ - std::vector get_position_all(void) const; + double get_torque(const std::uint8_t index = 0) const; /** - * Gets the power drawn by the motor in Watts. + * Gets the voltage delivered to the motor in millivolts. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -959,8 +807,8 @@ class Motor : public AbstractMotor, public Device { * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * \return The motor's power draw in Watts or PROS_ERR_F if the operation - * failed, setting errno. + * \return The motor's voltage in mV or PROS_ERR_F if the operation failed, + * setting errno. * * \b Example * \code @@ -969,24 +817,35 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Power: " << motor.get_power(); + * std::cout << "Motor Voltage: " << motor.get_voltage(); * pros::delay(2); * } * } * \endcode */ - double get_power(const std::uint8_t index = 0) const; + std::int32_t get_voltage(const std::uint8_t index = 0) const; /** - * Gets a vector containing the power drawn by the motor in Watts. + * Checks if the motor is drawing over its current limit. + * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor * - * \return A vector containing the motor's power draw in Watts or PROS_ERR_F if the operation - * failed, setting errno. + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index + * + * \return 1 if the motor's current limit is being exceeded and 0 if the + * current limit is not exceeded, or PROS_ERR if the operation failed, setting + * errno. * * \b Example * \code @@ -995,16 +854,16 @@ class Motor : public AbstractMotor, public Device { * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Power: " << motor.get_power_all()[0]; + * std::cout << "Is the motor over its current limit?: " << motor.is_over_current(); * pros::delay(2); * } * } * \endcode */ - std::vector get_power_all(void) const; + std::int32_t is_over_current(const std::uint8_t index = 0) const; /** - * Gets the raw encoder count of the motor at a given timestamp. + * Gets the temperature limit flag for the motor. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1017,72 +876,69 @@ class Motor : public AbstractMotor, public Device { * * EOVERFLOW - The index is non 0 * - * - * \param timestamp - * A pointer to a time in milliseconds for which the encoder count - * will be returned. If NULL, the timestamp at which the encoder - * count was read will not be supplied - * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * - * - * \return The raw encoder count at the given timestamp or PROS_ERR if the - * operation failed. + * + * \return 1 if the temperature limit is exceeded and 0 if the temperature is + * below the limit, or PROS_ERR if the operation failed, setting errno. * * \b Example * \code * void opcontrol() { - * std::uint32_t now = pros::millis(); * pros::Motor motor (1); * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Position: " << motor.get_raw_position(&now); + * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp(); * pros::delay(2); * } * } * \endcode */ - std::int32_t get_raw_position(std::uint32_t* const timestamp, const std::uint8_t index = 0) const; + std::int32_t is_over_temp(const std::uint8_t index = 0) const; + + ///@} + + /// \name Motor configuration functions + /// These functions allow programmers to configure the behavior of motors + ///@{ + /** - * Gets a vector of the raw encoder count of the motor at a given timestamp. + * Gets the brake mode that was set for the motor. * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor * - * \param timestamp - * A pointer to a time in milliseconds for which the encoder count - * will be returned. If NULL, the timestamp at which the encoder - * count was read will not be supplied + * EOVERFLOW - The index is non 0 * - * \return A vector containing the raw encoder count at the given timestamp or PROS_ERR if the - * operation failed. + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index + * + * \return One of MotorBrake, according to what was set for the + * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example * \code - * void opcontrol() { - * std::uint32_t now = pros::millis(); + * void initialize() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Position: " << motor.get_raw_position(&now); - * pros::delay(2); - * } + * motor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD); + * std::cout << "Brake Mode: " << motor.get_brake_mode(); * } * \endcode */ - std::vector get_raw_position_all(std::uint32_t* const timestamp) const; + MotorBrake get_brake_mode(const std::uint8_t index = 0) const; /** - * Gets the temperature of the motor in degrees Celsius. - + * Gets the current limit for the motor in mA. + * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class * for motors and motor groups @@ -1097,52 +953,56 @@ class Motor : public AbstractMotor, public Device { * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * \return The motor's temperature in degrees Celsius or PROS_ERR_F if the - * operation failed, setting errno. + * + * \return The motor's current limit in mA or PROS_ERR if the operation failed, + * setting errno. * * \b Example * \code * void opcontrol() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Temperature: " << motor.get_temperature(); + * std::cout << "Motor Current Limit: " << motor.get_current_limit(); * pros::delay(2); * } * } * \endcode */ - double get_temperature(const std::uint8_t index = 0) const; + std::int32_t get_current_limit(const std::uint8_t index = 0) const; /** - * Gets a vector of the temperature of the motor in degrees Celsius. + * Gets the encoder units that were set for the motor. * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups + * * This function uses the following values of errno when an error state is * reached: + * * ENODEV - The port cannot be configured as a motor + * + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * - * \return A vector contaioning the motor's temperature in degrees Celsius - * or PROS_ERR_F if the operation failed, setting errno. + * \return One of MotorUnits according to what is set for the + * motor or E_MOTOR_ENCODER_INVALID if the operation failed. * * \b Example * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Temperature: " << motor.get_temperature_all()[0]; - * pros::delay(2); - * } + * void initialize() { + * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * std::cout << "Motor Encoder Units: " << motor.get_encoder_units(); * } * \endcode */ - std::vector get_temperature_all(void) const; + MotorUnits get_encoder_units(const std::uint8_t index = 0) const; /** - * Gets the torque generated by the motor in Newton Meters (Nm). + * Gets the gearset that was set for the motor. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1159,51 +1019,52 @@ class Motor : public AbstractMotor, public Device { * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * \return The motor's torque in Nm or PROS_ERR_F if the operation failed, - * setting errno. + * \return One of MotorGears according to what is set for the motor, + * or pros::MotorGears::invalid if the operation failed. * * \b Example * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Torque: " << motor.get_torque(); - * pros::delay(2); - * } + * void initialize() { + * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * std::cout << "Motor Gearing: " << motor.get_gearing(); * } * \endcode */ - double get_torque(const std::uint8_t index = 0) const; + MotorGears get_gearing(const std::uint8_t index = 0) const; /** - * Gets a vector of the torque generated by the motor in Newton Meters (Nm). + * Gets the voltage limit set by the user. + * + * Default value is 0V, which means that there is no software limitation + * imposed on the voltage. * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups + * * This function uses the following values of errno when an error state is * reached: + * * ENODEV - The port cannot be configured as a motor * - * \return A vector containing the motor's torque in Nm or PROS_ERR_F if the operation failed, - * setting errno. + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * * \b Example * \code - * void opcontrol() { + * void initialize() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Torque: " << motor.get_torque(); - * pros::delay(2); - * } + * std::cout << "Motor Voltage Limit: " << motor.get_voltage_limit(); * } * \endcode */ - std::vector get_torque_all(void) const; - + std::int32_t get_voltage_limit(const std::uint8_t index = 0) const; + /** - * Gets the voltage delivered to the motor in millivolts. + * Gets whether the motor is reversed or not * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1211,62 +1072,63 @@ class Motor : public AbstractMotor, public Device { * * This function uses the following values of errno when an error state is * reached: - * - * ENODEV - The port cannot be configured as a motor - * + * * EOVERFLOW - The index is non 0 * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * \return The motor's voltage in mV or PROS_ERR_F if the operation failed, - * setting errno. + * + * \return 1 if the motor has been reversed and 0 if the motor was not + * reversed, or PROS_ERR if the operation failed, setting errno. * * \b Example * \code - * void opcontrol() { + * void initialize() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Voltage: " << motor.get_voltage(); - * pros::delay(2); - * } + * std::cout << "Is the motor reversed? " << motor.is_reversed(); + * // Prints "0" * } * \endcode */ - std::int32_t get_voltage(const std::uint8_t index = 0) const; + std::int32_t is_reversed(const std::uint8_t index = 0) const; /** - * Gets a vector of the voltage delivered to the motor in millivolts. - * + * Sets one of Motor_Brake to the motor. + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups + * * This function uses the following values of errno when an error state is * reached: + * * ENODEV - The port cannot be configured as a motor * + * EOVERFLOW - The index is non 0 + * + * + * \param mode + * The MotorBrake to set for the motor + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index * - * \return A vector of the motor's voltage in mV or PROS_ERR_F if the operation failed, - * setting errno. + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void opcontrol() { + * void initialize() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Motor Voltage: " << motor.get_voltage_all()[0]; - * pros::delay(2); - * } + * motor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD); + * std::cout << "Brake Mode: " << motor.get_brake_mode(); * } * \endcode */ - std::vector get_voltage_all(void) const; - + std::int32_t set_brake_mode(const MotorBrake mode, const std::uint8_t index = 0) const; /** - * Checks if the motor is drawing over its current limit. - * + * Sets one of MotorBrake to the motor. * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class * for motors and motor groups @@ -1278,57 +1140,29 @@ class Motor : public AbstractMotor, public Device { * * EOVERFLOW - The index is non 0 * + * + * \param mode + * The MotorBrake to set for the motor + * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * \return 1 if the motor's current limit is being exceeded and 0 if the - * current limit is not exceeded, or PROS_ERR if the operation failed, setting - * errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its current limit?: " << motor.is_over_current(); - * pros::delay(2); - * } - * } - * \endcode - */ - std::int32_t is_over_current(const std::uint8_t index = 0) const; - - /** - * Checks if the motor is drawing over its current limit. - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \return A vector containing 1 if the motor's current limit is being exceeded and 0 if the - * current limit is not exceeded, or PROS_ERR if the operation failed, setting - * errno. + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void opcontrol() { + * void initialize() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its current limit?: " << motor.is_over_current_all()[0]; - * pros::delay(2); - * } + * motor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD); + * std::cout << "Brake Mode: " << motor.get_brake_mode(); * } * \endcode */ - std::vector is_over_current_all(void) const; - + std::int32_t set_brake_mode(const pros::motor_brake_mode_e_t mode, const std::uint8_t index = 0) const; /** - * Gets the temperature limit flag for the motor. + * Sets the current limit for the motor in mA. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1341,61 +1175,60 @@ class Motor : public AbstractMotor, public Device { * * EOVERFLOW - The index is non 0 * + * \param limit + * The new current limit in mA + * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * \return 1 if the temperature limit is exceeded and 0 if the temperature is - * below the limit, or PROS_ERR if the operation failed, setting errno. + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code * void opcontrol() { * pros::Motor motor (1); * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp(); - * pros::delay(2); + * + * motor.set_current_limit(1000); + * while (true) { + * motor = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * // The motor will reduce its output at 1000 mA instead of the default 2500 mA + * pros::delay(2); * } * } * \endcode */ - std::int32_t is_over_temp(const std::uint8_t index = 0) const; - + std::int32_t set_current_limit(const std::int32_t limit, const std::uint8_t index = 0) const; + /** - * Gets the temperature limit flag for the motor. + * Sets one of MotorUnits for the motor encoder. Works with the C + * enum and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: - * ENODEV - The port cannot be configured as a motor - * - * \return A vector containing 1 if the temperature limit is exceeded and 0 if the temperature is - * below the limit, or PROS_ERR if the operation failed, setting errno. + * ENODEV - The port cannot be configured as a motor + * + * \param units + * The new motor encoder units + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void opcontrol() { + * void initialize() { * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp_all(); - * pros::delay(2); - * } + * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); + * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode */ - std::vector is_over_temp_all(void) const; - - ///@} - - /// \name Motor configuration functions - /// These functions allow programmers to configure the behavior of motors - ///@{ - + std::int32_t set_encoder_units(const MotorUnits units, const std::uint8_t index = 0) const; /** - * Gets the brake mode that was set for the motor. + * Sets one of MotorUnits for the motor encoder. Works with the C + * enum and the C++ enum class. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1411,45 +1244,62 @@ class Motor : public AbstractMotor, public Device { * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index + * + * * \param units + * The new motor encoder units * - * \return One of Motor_Brake, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code * void initialize() { * pros::Motor motor (1); - * motor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD); - * std::cout << "Brake Mode: " << motor.get_brake_mode(); + * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); + * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode */ - MotorBrake get_brake_mode(const std::uint8_t index = 0) const; - + std::int32_t set_encoder_units(const pros::motor_encoder_units_e_t units, const std::uint8_t index = 0) const; /** - * Gets a vector containing the brake mode that was set for the motor. + * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with + * the C++ enum class and the C enum. * + * \note This is one of many Motor functions that takes in an optional index parameter. + * This parameter can be ignored by most users but exists to give a shared base class + * for motors and motor groups + * * This function uses the following values of errno when an error state is * reached: + * * ENODEV - The port cannot be configured as a motor + * + * EOVERFLOW - The index is non 0 + * + * \param index Optional parameter. + * The zero-indexed index of the motor to get the target position of. + * By default index is 0, and will return an error for a non-zero index + * \param gearset + * The new motor gearset * - * \return One of Motor_Brake, according to what was set for the - * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code * void initialize() { * pros::Motor motor (1); - * motor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD); - * std::cout << "Brake Mode: " << motor.get_brake_mode(); + * motor.set_gearing(E_MOTOR_GEARSET_06); + * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode */ - std::vector get_brake_mode_all(void) const; - + std::int32_t set_gearing(const MotorGears gearset, const std::uint8_t index = 0) const; + /** - * Gets the current limit for the motor in mA. - * + * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with + * the C++ enum class and the C enum. + * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class * for motors and motor groups @@ -1461,53 +1311,32 @@ class Motor : public AbstractMotor, public Device { * * EOVERFLOW - The index is non 0 * + * \param gearset + * The new motor gearset + * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * \return The motor's current limit in mA or PROS_ERR if the operation failed, - * setting errno. - * - * \b Example - * \code - * void opcontrol() { - * pros::Motor motor (1); - * while (true) { - * std::cout << "Motor Current Limit: " << motor.get_current_limit(); - * pros::delay(2); - * } - * } - * \endcode - */ - std::int32_t get_current_limit(const std::uint8_t index = 0) const; - - /** - * Gets a vector containing the current limit for the motor in mA. - * - * The default value is 2500 mA. * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor * - * \return A vector containing the motor's current limit in mA or PROS_ERR if the operation failed, - * setting errno. + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void opcontrol() { + * void initialize() { * pros::Motor motor (1); - * while (true) { - * std::cout << "Motor Current Limit: " << motor.get_current_limit_all()[0]; - * pros::delay(2); - * } + * motor.set_gearing(E_MOTOR_GEARSET_06); + * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode */ - std::vector get_current_limit_all(void) const; + std::int32_t set_gearing(const pros::motor_gearset_e_t gearset, const std::uint8_t index = 0) const; /** - * Gets the encoder units that were set for the motor. + * Sets the reverse flag for the motor. + * + * This will invert its movements and the values returned for its position. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1516,49 +1345,64 @@ class Motor : public AbstractMotor, public Device { * This function uses the following values of errno when an error state is * reached: * - * ENODEV - The port cannot be configured as a motor - * * EOVERFLOW - The index is non 0 * + * \param reverse + * True reverses the motor, false is default direction + * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * \return One of Motor_Units according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); - * std::cout << "Motor Encoder Units: " << motor.get_encoder_units(); + * pros::Motor motor (1); + * motor.set_reversed(true); + * std::cout << "Is this motor reversed? " << motor.is_reversed(); * } * \endcode */ - MotorUnits get_encoder_units(const std::uint8_t index = 0) const; + std::int32_t set_reversed(const bool reverse, const std::uint8_t index = 0); /** - * Gets a vector containing the encoder units that were set for the motor. + * Sets the voltage limit for the motor in Volts. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * - * \return A vector containing One of Motor_Units according to what is set for the - * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * \param limit + * The new voltage limit in Volts + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); - * std::cout << "Motor Encoder Units: " << motor.get_encoder_units_all()[0]; + * void autonomous() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * + * motor.set_voltage_limit(10000); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * // The motor will not output more than 10 V + * pros::delay(2); + * } * } * \endcode */ - std::vector get_encoder_units_all(void) const; + std::int32_t set_voltage_limit(const std::int32_t limit, const std::uint8_t index = 0) const; /** - * Gets the gearset that was set for the motor. + * Sets the position for the motor in its encoder units. + * + * This will be the future reference point for the motor's "absolute" + * position. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1571,55 +1415,34 @@ class Motor : public AbstractMotor, public Device { * * EOVERFLOW - The index is non 0 * + * \param position + * The new reference position in its encoder units + * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index - * - * \return One of Motor_Gears according to what is set for the motor, - * or pros::Motor_Gears::invalid if the operation failed. + * + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); - * std::cout << "Motor Gearing: " << motor.get_gearing(); - * } - * \endcode - */ - MotorGears get_gearing(const std::uint8_t index = 0) const; - - /** - * Gets a vector containing the gearset that was set for the motor. - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \return A vector containing one of Motor_Gears according to what is set for the motor, - * or pros::Motor_Gears::invalid if the operation failed. + * void autonomous() { + * pros::Motor motor (1); + * motor.move_absolute(100, 100); // Moves 100 units forward + * motor.move_absolute(100, 100); // This does not cause a movement * - * \b Example - * \code - * void initialize() { - * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); - * std::cout << "Motor Gearing: " << motor.get_gearing_all()[0]; + * motor.set_zero_position(80); + * motor.move_absolute(100, 100); // Moves 80 units forward * } * \endcode - */ - std::vector get_gearing_all(void) const; - - /** - * Gets returns a vector with all the port numbers in the motor group. * - * \return A vector containing the signed port of the motor. (negaitve if the motor is reversed) */ - std::vector get_port_all(void) const; + std::int32_t set_zero_position(const double position, const std::uint8_t index = 0) const; /** - * Gets the voltage limit set by the user. - * - * Default value is 0V, which means that there is no software limitation - * imposed on the voltage. + * Sets the "absolute" zero position of the motor to its current position. * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class @@ -1635,224 +1458,299 @@ class Motor : public AbstractMotor, public Device { * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index + * + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. * * \b Example * \code - * void initialize() { + * void autonomous() { * pros::Motor motor (1); - * std::cout << "Motor Voltage Limit: " << motor.get_voltage_limit(); + * motor.move_absolute(100, 100); // Moves 100 units forward + * motor.move_absolute(100, 100); // This does not cause a movement + * + * motor.tare_position(); + * motor.move_absolute(100, 100); // Moves 100 units forward * } * \endcode */ - std::int32_t get_voltage_limit(const std::uint8_t index = 0) const; - + std::int32_t tare_position(const std::uint8_t index = 0) const; + /** - * Gets a vector of the voltage limit set by the user. + * Gets the number of motors. + * + * \return Always returns 1 + * + */ + std::int8_t size(void) const; + + static std::vector get_all_devices(); + + /** + * gets the port number of the motor * - * Default value is 0V, which means that there is no software limitation - * imposed on the voltage. + * \return The signed port of the motor. (negative if the motor is reversed) + * + */ + std::int8_t get_port(const std::uint8_t index = 0) const; + + ///@} + + /// \name Additional motor functions + /// These functions allow for motors and motor groups to be used interchangeably + ///@{ + /** + * Gets a vector containing the target position set for the motor by the user * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * - * \return A vector containing the motor's voltage limit in V or PROS_ERR if the operation failed, - * setting errno. + * + * \return A vector containing the target position in its encoder units or PROS_ERR_F if the + * operation failed, setting errno. * * \b Example * \code - * void initialize() { + * void autonomous() { * pros::Motor motor (1); - * std::cout << "Motor Voltage Limit: " << motor.get_voltage_limit_all()[0]; + * motor.move_absolute(100, 100); + * std::cout << "Motor Target: " << motor.get_target_position_all()[0]; + * // Prints 100 * } * \endcode */ - std::vector get_voltage_limit_all(void) const; + std::vector get_target_position_all(void) const; /** - * Gets whether the motor is reversed or not + * Gets a vector containing the velocity commanded to the motor by the user * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * * This function uses the following values of errno when an error state is * reached: - * - * EOVERFLOW - The index is non 0 - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index + * ENODEV - The port cannot be configured as a motor * - * \return 1 if the motor has been reversed and 0 if the motor was not - * reversed, or PROS_ERR if the operation failed, setting errno. + * \return A vector containing the commanded motor velocity from +-100, + * +-200, or +-600, or PROS_ERR if the operation failed, setting errno. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * std::cout << "Is the motor reversed? " << motor.is_reversed(); - * // Prints "0" + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Motor Velocity: " << motor.get_target_velocity_all()[0]; + * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y + * pros::delay(2); + * } * } * \endcode */ - std::int32_t is_reversed(const std::uint8_t index = 0) const; + std::vector get_target_velocity_all(void) const; /** - * Gets a vector containg whether the motor is reversed or not + * Gets a vector containing the actual velocity commanded of the motor * - * \return A vector containing 1 if the motor has been reversed and 0 if the motor was not - * reversed, or PROS_ERR if the operation failed, setting errno. + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return A vector containing the motor's actual velocity in RPM or PROS_ERR_F + * if the operation failed, setting errno. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * std::cout << "Is the motor reversed? " << motor.is_reversed_all()[0]; - * // Prints "0" + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor.move_velocity(master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); + * std::cout << "Motor Velocity: " << motor.get_actual_velocity_all()[0]; + * // Prints the value of E_CONTROLLER_ANALOG_LEFT_Y + * pros::delay(2); + * } * } * \endcode - */ - std::vector is_reversed_all(void) const; + */ + std::vector get_actual_velocity_all(void) const; /** - * Sets one of Motor_Brake to the motor. - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups + * Gets a vector containing the current drawn by the motor in mA. * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor * - * EOVERFLOW - The index is non 0 - * - * - * \param mode - * The Motor_Brake to set for the motor * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return A vector containing the motor's current in mA or PROS_ERR if the operation failed, + * setting errno. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * motor.set_brake_mode_all(pros::E_MOTOR_BRAKE_HOLD); - * std::cout << "Brake Mode: " << motor.get_brake_mode(); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Current Draw: " << motor.get_current_draw_all()[0]; + * pros::delay(2); + * } * } * \endcode */ - std::int32_t set_brake_mode(const MotorBrake mode, const std::uint8_t index = 0) const; + std::vector get_current_draw_all(void) const; + /** - * Sets one of Motor_Brake to the motor. - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups + * Gets a vector containing the direction of movement for the motor. + * * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor * - * EOVERFLOW - The index is non 0 - * * - * \param mode - * The Motor_Brake to set for the motor - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return A vector containing 1 for moving in the positive direction, -1 for moving in the + * negative direction, and PROS_ERR if the operation failed, setting errno. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * motor.set_brake_mode_all(pros::E_MOTOR_BRAKE_HOLD); - * std::cout << "Brake Mode: " << motor.get_brake_mode(); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Direction: " << motor.get_direction_all()[0]; + * pros::delay(2); + * } * } * \endcode */ - std::int32_t set_brake_mode(const pros::motor_brake_mode_e_t mode, const std::uint8_t index = 0) const; - + std::vector get_direction_all(void) const; + /** - * Sets one of Motor_Brake to the motor. + * Gets a vector containing the efficiency of the motor in percent. * + * An efficiency of 100% means that the motor is moving electrically while + * drawing no electrical power, and an efficiency of 0% means that the motor + * is drawing power but not moving. + * * This function uses the following values of errno when an error state is * reached: + * * ENODEV - The port cannot be configured as a motor + * * - * \param mode - * The Motor_Brake to set for the motor + * \return A vector containing The motor's efficiency in percent or PROS_ERR_F if the operation + * failed, setting errno. * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Efficiency: " << motor.get_efficiency(); + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector get_efficiency_all(void) const; + + /** + * Gets a vector of the faults experienced by the motor. + * + * Compare this bitfield to the bitmasks in pros::motor_fault_e_t. + * + * This function uses the following values of errno when an error state is + * reached: + * + * ENODEV - The port cannot be configured as a motor + * + * \return A bitfield containing the motor's faults. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * motor.set_brake_mode_all(pros::E_MOTOR_BRAKE_HOLD); - * std::cout << "Brake Mode: " << motor.get_brake_mode(); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Faults: " << motor.get_faults_all()[0]; + * pros::delay(2); + * } * } * \endcode */ - std::int32_t set_brake_mode_all(const MotorBrake mode) const; + std::vector get_faults_all(void) const; + /** - * Sets one of Motor_Brake to the motor. + * Gets a vector of the flags set by the motor's operation. * + * Compare this bitfield to the bitmasks in pros::motor_flag_e_t. + * * This function uses the following values of errno when an error state is * reached: + * * ENODEV - The port cannot be configured as a motor * - * \param mode - * The Motor_Brake to set for the motor * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return A bitfield containing the motor's flags. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * motor.set_brake_mode_all(pros::E_MOTOR_BRAKE_HOLD); - * std::cout << "Brake Mode: " << motor.get_brake_mode(); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Faults: " << motor.get_faults_all()[0]; + * pros::delay(2); + * } * } * \endcode */ - std::int32_t set_brake_mode_all(const pros::motor_brake_mode_e_t mode) const; + std::vector get_flags_all(void) const; + /** - * Sets the current limit for the motor in mA. - * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups + * Gets a vector containing the absolute position of the motor in its encoder units. * * This function uses the following values of errno when an error state is * reached: * * ENODEV - The port cannot be configured as a motor + + * + * \return A vector containing the motor's absolute position in its encoder units or PROS_ERR_F + * if the operation failed, setting errno. + * + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Position: " << motor.get_position_all()[0]; + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector get_position_all(void) const; + + /** + * Gets a vector containing the power drawn by the motor in Watts. * - * EOVERFLOW - The index is non 0 + * This function uses the following values of errno when an error state is + * reached: * - * * \param limit - * The new current limit in mA + * ENODEV - The port cannot be configured as a motor * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * - * \return 1 if the operation was successful or PROS_ERR if the operation + * \return A vector containing the motor's power draw in Watts or PROS_ERR_F if the operation * failed, setting errno. * * \b Example @@ -1860,126 +1758,318 @@ class Motor : public AbstractMotor, public Device { * void opcontrol() { * pros::Motor motor (1); * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Power: " << motor.get_power_all()[0]; + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector get_power_all(void) const; + + /** + * Gets a vector of the raw encoder count of the motor at a given timestamp. * - * motor.set_current_limit(1000); - * while (true) { - * motor = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * // The motor will reduce its output at 1000 mA instead of the default 2500 mA - * pros::delay(2); + * + * This function uses the following values of errno when an error state is + * reached: + * + * ENODEV - The port cannot be configured as a motor + * + * \param timestamp + * A pointer to a time in milliseconds for which the encoder count + * will be returned. If NULL, the timestamp at which the encoder + * count was read will not be supplied + * + * \return A vector containing the raw encoder count at the given timestamp or PROS_ERR if the + * operation failed. + * + * \b Example + * \code + * void opcontrol() { + * std::uint32_t now = pros::millis(); + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Position: " << motor.get_raw_position(&now); + * pros::delay(2); * } * } * \endcode */ - std::int32_t set_current_limit(const std::int32_t limit, const std::uint8_t index = 0) const; + std::vector get_raw_position_all(std::uint32_t* const timestamp) const; + /** - * Sets the current limit for the motor in mA. + * Gets a vector of the temperature of the motor in degrees Celsius. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * - * \param limit - * The new current limit in mA + * \return A vector contaioning the motor's temperature in degrees Celsius + * or PROS_ERR_F if the operation failed, setting errno. * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Temperature: " << motor.get_temperature_all()[0]; + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector get_temperature_all(void) const; + + /** + * Gets a vector of the torque generated by the motor in Newton Meters (Nm). + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return A vector containing the motor's torque in Nm or PROS_ERR_F if the operation failed, + * setting errno. * * \b Example * \code * void opcontrol() { * pros::Motor motor (1); * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Torque: " << motor.get_torque(); + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector get_torque_all(void) const; + + /** + * Gets a vector of the voltage delivered to the motor in millivolts. * - * motor.set_current_limit(1000); - * while (true) { - * motor = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * // The motor will reduce its output at 1000 mA instead of the default 2500 mA - * pros::delay(2); + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * + * \return A vector of the motor's voltage in mV or PROS_ERR_F if the operation failed, + * setting errno. + * + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Motor Voltage: " << motor.get_voltage_all()[0]; + * pros::delay(2); * } * } * \endcode */ - std::int32_t set_current_limit_all(const std::int32_t limit) const; + std::vector get_voltage_all(void) const; + /** - * Sets one of Motor_Units for the motor encoder. Works with the C - * enum and the C++ enum class. + * Checks if the motor is drawing over its current limit. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * - * \param units - * The new motor encoder units + * \return A vector containing 1 if the motor's current limit is being exceeded and 0 if the + * current limit is not exceeded, or PROS_ERR if the operation failed, setting + * errno. * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Is the motor over its current limit?: " << motor.is_over_current_all()[0]; + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector is_over_current_all(void) const; + + /** + * Gets the temperature limit flag for the motor. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return A vector containing 1 if the temperature limit is exceeded and 0 if the temperature is + * below the limit, or PROS_ERR if the operation failed, setting errno. + * + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * pros::Controller master (E_CONTROLLER_MASTER); + * while (true) { + * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * std::cout << "Is the motor over its temperature limit?: " << motor.is_over_temp_all(); + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector is_over_temp_all(void) const; + + /** + * Gets a vector containing the brake mode that was set for the motor. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return One of Motor_Brake, according to what was set for the + * motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. * * \b Example * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); - * std::cout << "Encoder Units: " << motor.get_encoder_units(); + * motor.set_brake_mode(pros::E_MOTOR_BRAKE_HOLD); + * std::cout << "Brake Mode: " << motor.get_brake_mode(); * } * \endcode */ - std::int32_t set_encoder_units(const MotorUnits units, const std::uint8_t index = 0) const; + std::vector get_brake_mode_all(void) const; + /** - * Sets one of Motor_Units for the motor encoder. Works with the C - * enum and the C++ enum class. + * Gets a vector containing the current limit for the motor in mA. + * + * The default value is 2500 mA. * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * * This function uses the following values of errno when an error state is * reached: - * * ENODEV - The port cannot be configured as a motor - * - * EOVERFLOW - The index is non 0 - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * - * * \param units - * The new motor encoder units * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. + * \return A vector containing the motor's current limit in mA or PROS_ERR if the operation failed, + * setting errno. + * + * \b Example + * \code + * void opcontrol() { + * pros::Motor motor (1); + * while (true) { + * std::cout << "Motor Current Limit: " << motor.get_current_limit_all()[0]; + * pros::delay(2); + * } + * } + * \endcode + */ + std::vector get_current_limit_all(void) const; + + /** + * Gets a vector containing the encoder units that were set for the motor. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return A vector containing One of Motor_Units according to what is set for the + * motor or E_MOTOR_ENCODER_INVALID if the operation failed. + * + * \b Example + * \code + * void initialize() { + * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * std::cout << "Motor Encoder Units: " << motor.get_encoder_units_all()[0]; + * } + * \endcode + */ + std::vector get_encoder_units_all(void) const; + + /** + * Gets a vector containing the gearset that was set for the motor. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return A vector containing one of Motor_Gears according to what is set for the motor, + * or pros::Motor_Gears::invalid if the operation failed. + * + * \b Example + * \code + * void initialize() { + * pros::Motor motor (1, E_MOTOR_GEARSET_06, E_MOTOR_ENCODER_COUNTS); + * std::cout << "Motor Gearing: " << motor.get_gearing_all()[0]; + * } + * \endcode + */ + std::vector get_gearing_all(void) const; + + /** + * Gets returns a vector with all the port numbers in the motor group. + * + * \return A vector containing the signed port of the motor. (negative if the motor is reversed) + */ + std::vector get_port_all(void) const; + + /** + * Gets a vector of the voltage limit set by the user. + * + * Default value is 0V, which means that there is no software limitation + * imposed on the voltage. + * + * This function uses the following values of errno when an error state is + * reached: + * ENODEV - The port cannot be configured as a motor + * + * \return A vector containing the motor's voltage limit in V or PROS_ERR if the operation failed, + * setting errno. * * \b Example * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); - * std::cout << "Encoder Units: " << motor.get_encoder_units(); + * std::cout << "Motor Voltage Limit: " << motor.get_voltage_limit_all()[0]; * } * \endcode */ - std::int32_t set_encoder_units(const pros::motor_encoder_units_e_t units, const std::uint8_t index = 0) const; + std::vector get_voltage_limit_all(void) const; + /** - * Sets one of Motor_Units for the motor encoder. Works with the C - * enum and the C++ enum class. + * Gets a vector containg whether the motor is reversed or not + * + * \return A vector containing 1 if the motor has been reversed and 0 if the motor was not + * reversed, or PROS_ERR if the operation failed, setting errno. + * + * \b Example + * \code + * void initialize() { + * pros::Motor motor (1); + * std::cout << "Is the motor reversed? " << motor.is_reversed_all()[0]; + * // Prints "0" + * } + * \endcode + */ + std::vector is_reversed_all(void) const; + + /** + * Sets one of Motor_Brake to the motor. * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * * This function uses the following values of errno when an error state is * reached: - * * ENODEV - The port cannot be configured as a motor - * - * EOVERFLOW - The index is non 0 - * - * * \param units - * The new motor encoder units - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index + * + * \param mode + * The Motor_Brake to set for the motor * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -1988,23 +2078,22 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); - * std::cout << "Encoder Units: " << motor.get_encoder_units(); + * motor.set_brake_mode_all(pros::E_MOTOR_BRAKE_HOLD); + * std::cout << "Brake Mode: " << motor.get_brake_mode(); * } * \endcode */ - std::int32_t set_encoder_units_all(const MotorUnits units) const; + std::int32_t set_brake_mode_all(const MotorBrake mode) const; /** - * Sets one of Motor_Units for the motor encoder. Works with the C - * enum and the C++ enum class. + * Sets one of Motor_Brake to the motor. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * - * \param units - * The new motor encoder units + * \param mode + * The Motor_Brake to set for the motor * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -2013,52 +2102,47 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_encoder_units(E_MOTOR_ENCODER_DEGREES); - * std::cout << "Encoder Units: " << motor.get_encoder_units(); + * motor.set_brake_mode_all(pros::E_MOTOR_BRAKE_HOLD); + * std::cout << "Brake Mode: " << motor.get_brake_mode(); * } * \endcode */ - std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const; - + std::int32_t set_brake_mode_all(const pros::motor_brake_mode_e_t mode) const; + /** - * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with - * the C++ enum class and the C enum. + * Sets the current limit for the motor in mA. * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * * This function uses the following values of errno when an error state is * reached: - * * ENODEV - The port cannot be configured as a motor - * - * EOVERFLOW - The index is non 0 - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * \param gearset - * The new motor gearset + * + * \param limit + * The new current limit in mA * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * * \b Example * \code - * void initialize() { + * void opcontrol() { * pros::Motor motor (1); - * motor.set_gearing(E_MOTOR_GEARSET_06); - * std::cout << "Gearset: " << motor.get_gearing(); + * pros::Controller master (E_CONTROLLER_MASTER); + * + * motor.set_current_limit_all(1000); + * while (true) { + * motor = controller_get_analog(E_CONTROLLER_ANALOG_LEFT_Y); + * // The motor will reduce its output at 1000 mA instead of the default 2500 mA + * pros::delay(2); + * } * } * \endcode */ - std::int32_t set_gearing(const MotorGears gearset, const std::uint8_t index = 0) const; - + std::int32_t set_current_limit_all(const std::int32_t limit) const; + /** - * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with - * the C++ enum class and the C enum. - + * Sets one of Motor_Units for the motor encoder. Works with the C + * enum and the C++ enum class. + * * \note This is one of many Motor functions that takes in an optional index parameter. * This parameter can be ignored by most users but exists to give a shared base class * for motors and motor groups @@ -2070,14 +2154,13 @@ class Motor : public AbstractMotor, public Device { * * EOVERFLOW - The index is non 0 * - * \param gearset - * The new motor gearset + * * \param units + * The new motor encoder units * * \param index Optional parameter. * The zero-indexed index of the motor to get the target position of. * By default index is 0, and will return an error for a non-zero index * - * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. * @@ -2085,23 +2168,23 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_gearing(E_MOTOR_GEARSET_06); - * std::cout << "Gearset: " << motor.get_gearing(); + * motor.set_encoder_units_all(E_MOTOR_ENCODER_DEGREES); + * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode */ - std::int32_t set_gearing(const pros::motor_gearset_e_t gearset, const std::uint8_t index = 0) const; + std::int32_t set_encoder_units_all(const MotorUnits units) const; /** - * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with - * the C++ enum class and the C enum. + * Sets one of Motor_Units for the motor encoder. Works with the C + * enum and the C++ enum class. * * This function uses the following values of errno when an error state is * reached: * ENODEV - The port cannot be configured as a motor * - * \param gearset - * The new motor gearset + * \param units + * The new motor encoder units * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -2110,13 +2193,14 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_gearing_all(E_MOTOR_GEARSET_06); - * std::cout << "Gearset: " << motor.get_gearing(); + * motor.set_encoder_units_all(E_MOTOR_ENCODER_DEGREES); + * std::cout << "Encoder Units: " << motor.get_encoder_units(); * } * \endcode */ - std::int32_t set_gearing_all(const MotorGears gearset) const; + std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const; + /** * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with * the C++ enum class and the C enum. @@ -2140,29 +2224,18 @@ class Motor : public AbstractMotor, public Device { * } * \endcode */ - std::int32_t set_gearing_all(const pros::motor_gearset_e_t gearset) const; - - + std::int32_t set_gearing_all(const MotorGears gearset) const; + /** - * Sets the reverse flag for the motor. - * - * This will invert its movements and the values returned for its position. + * Sets one of the gear cartridge (red, green, blue) for the motor. Usable with + * the C++ enum class and the C enum. * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * * This function uses the following values of errno when an error state is * reached: - * - * EOVERFLOW - The index is non 0 - * - * \param reverse - * True reverses the motor, false is default direction - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index + * ENODEV - The port cannot be configured as a motor + * + * \param gearset + * The new motor gearset * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -2171,12 +2244,13 @@ class Motor : public AbstractMotor, public Device { * \code * void initialize() { * pros::Motor motor (1); - * motor.set_reversed(true); - * std::cout << "Is this motor reversed? " << motor.is_reversed(); + * motor.set_gearing_all(E_MOTOR_GEARSET_06); + * std::cout << "Gearset: " << motor.get_gearing(); * } * \endcode */ - std::int32_t set_reversed(const bool reverse, const std::uint8_t index = 0); + std::int32_t set_gearing_all(const pros::motor_gearset_e_t gearset) const; + /** * Sets the reverse flag for the motor. * @@ -2198,36 +2272,6 @@ class Motor : public AbstractMotor, public Device { * \endcode */ std::int32_t set_reversed_all(const bool reverse); - - /** - * Sets the voltage limit for the motor in Volts. - * - * This function uses the following values of errno when an error state is - * reached: - * ENODEV - The port cannot be configured as a motor - * - * \param limit - * The new voltage limit in Volts - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example - * \code - * void autonomous() { - * pros::Motor motor (1); - * pros::Controller master (E_CONTROLLER_MASTER); - * - * motor.set_voltage_limit(10000); - * while (true) { - * motor = master.get_analog(E_CONTROLLER_ANALOG_LEFT_Y); - * // The motor will not output more than 10 V - * pros::delay(2); - * } - * } - * \endcode - */ - std::int32_t set_voltage_limit(const std::int32_t limit, const std::uint8_t index = 0) const; /** * Sets the voltage limit for the motor in Volts. @@ -2269,49 +2313,6 @@ class Motor : public AbstractMotor, public Device { * \endcode */ std::int32_t set_voltage_limit_all(const std::int32_t limit) const; - - /** - * Sets the position for the motor in its encoder units. - * - * This will be the future reference point for the motor's "absolute" - * position. - * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * - * This function uses the following values of errno when an error state is - * reached: - * - * ENODEV - The port cannot be configured as a motor - * - * EOVERFLOW - The index is non 0 - * - * \param position - * The new reference position in its encoder units - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example - * \code - * void autonomous() { - * pros::Motor motor (1); - * motor.move_absolute(100, 100); // Moves 100 units forward - * motor.move_absolute(100, 100); // This does not cause a movement - * - * motor.set_zero_position(80); - * motor.move_absolute(100, 100); // Moves 80 units forward - * } - * \endcode - * - */ - std::int32_t set_zero_position(const double position, const std::uint8_t index = 0) const; /** * Sets the position for the motor in its encoder units. @@ -2344,41 +2345,6 @@ class Motor : public AbstractMotor, public Device { */ std::int32_t set_zero_position_all(const double position) const; - /** - * Sets the "absolute" zero position of the motor to its current position. - * - * \note This is one of many Motor functions that takes in an optional index parameter. - * This parameter can be ignored by most users but exists to give a shared base class - * for motors and motor groups - * - * This function uses the following values of errno when an error state is - * reached: - * - * ENODEV - The port cannot be configured as a motor - * - * EOVERFLOW - The index is non 0 - * - * \param index Optional parameter. - * The zero-indexed index of the motor to get the target position of. - * By default index is 0, and will return an error for a non-zero index - * - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - * - * \b Example - * \code - * void autonomous() { - * pros::Motor motor (1); - * motor.move_absolute(100, 100); // Moves 100 units forward - * motor.move_absolute(100, 100); // This does not cause a movement - * - * motor.tare_position(); - * motor.move_absolute(100, 100); // Moves 100 units forward - * } - * \endcode - */ - std::int32_t tare_position(const std::uint8_t index = 0) const; - /** * Sets the "absolute" zero position of the motor to its current position. * @@ -2403,21 +2369,7 @@ class Motor : public AbstractMotor, public Device { */ std::int32_t tare_position_all(void) const; - /** - * Gets the number of motors. - * - * \return Always returns 1 - * - */ - std::int8_t size(void) const; - - /** - * gets the port number of the motor - * - * \return A vector containing the signed port of the motor. (negaitve if the motor is reversed) - * - */ - std::int8_t get_port(const std::uint8_t index = 0) const; + ///@} private: std::int8_t _port; diff --git a/include/pros/optical.hpp b/include/pros/optical.hpp index 3f700d41..787bcd2b 100644 --- a/include/pros/optical.hpp +++ b/include/pros/optical.hpp @@ -54,7 +54,12 @@ class Optical : public Device { * pros::Optical optical(1); * \endcode */ - explicit Optical(const std::uint8_t port); + Optical(const std::uint8_t port); + + Optical(const Device& device) + : Optical(device.get_port()) {}; + + static std::vector get_all_devices(); /** * Get the detected color hue @@ -124,6 +129,7 @@ class Optical : public Device { * pros::Optical optical(1); * std::cout << "Brightness: " << optical.get_brightness() << std::endl; * } + * \endcode */ virtual double get_brightness(); @@ -235,6 +241,21 @@ class Optical : public Device { * * \return raw rgb value if the operation was successful or an optical_raw_s_t * with all fields set to PROS_ERR if the operation failed, setting errno. + * + * \b Example: + * \code{.cpp} + * void opcontrol() { + * pros::Optical optical(1); + * pros::c::optical_raw_s_t raw = optical.get_raw(); + * while (1) { + * std::cout << "Red: " << raw.red << std::endl; + * std::cout << "Green: " << raw.green << std::endl; + * std::cout << "Blue: " << raw.blue << std::endl; + * std::cout << "Clear: " << raw.clear << std::endl; + * pros::delay(20); + * } + * } + * \endcode */ virtual pros::c::optical_raw_s_t get_raw(); @@ -242,10 +263,11 @@ class Optical : public Device { * Get the most recent gesture data from the sensor * * Gestures will be cleared after 500mS - * 0 = no gesture - * 1 = up (towards cable) - * 2 = down - * 3 = right + * + * 0 = no gesture, + * 1 = up (towards cable), + * 2 = down, + * 3 = right, * 4 = left * * This function uses the following values of errno when an error state is @@ -331,6 +353,7 @@ class Optical : public Device { * pros::delay(20); * } * } + * \endcode */ virtual std::int32_t enable_gesture(); diff --git a/include/pros/rotation.hpp b/include/pros/rotation.hpp index b58ad912..2947300c 100644 --- a/include/pros/rotation.hpp +++ b/include/pros/rotation.hpp @@ -53,27 +53,10 @@ class Rotation : public Device { * } * \endcode */ - explicit Rotation(const std::uint8_t port) : Device(port, DeviceType::rotation) {}; + Rotation(const std::int8_t port); - /** - * Constructs a new Rotation Sensor object - * - * ENXIO - The given value is not within the range of V5 ports |1-21|. - * ENODEV - The port cannot be configured as a Rotation Sensor - * - * \param port - * The V5 port number from 1 to 21, or from -21 to -1 for reversed Rotation Sensors. - * \param reverse_flag - * Determines if the Rotation Sensor is reversed or not. - * - * \b Example - * \code - * void opcontrol() { - * pros::Rotation rotation_sensor(1, true); //Creates a reversed Rotation Sensor on port 1 - * } - * \endcode - */ - explicit Rotation(const std::uint8_t port, const bool reverse_flag); + Rotation(const Device& device) + : Rotation(device.get_port()) {}; /** * Reset the Rotation Sensor diff --git a/include/pros/screen.h b/include/pros/screen.h index 2e1592b7..71c28570 100644 --- a/include/pros/screen.h +++ b/include/pros/screen.h @@ -79,16 +79,11 @@ typedef enum { * Struct representing screen touch status, screen last x, screen last y, press count, release count. */ typedef struct screen_touch_status_s { - /// Represents if the screen is being held, released, or pressed. - last_touch_e_t touch_status; - /// Represents the x value of the location of the touch. - int16_t x; - /// Represents the y value of the location of the touch. - int16_t y; - /// Represents how many times the screen has be pressed. - int32_t press_count; - /// Represents how many times the user released after a touch on the screen. - int32_t release_count; + last_touch_e_t touch_status; ///< Represents if the screen is being held, released, or pressed. + int16_t x; ///< Represents the x value of the location of the touch. + int16_t y; ///< Represents the y value of the location of the touch. + int32_t press_count; ///< Represents how many times the screen has be pressed. + int32_t release_count; ///< Represents how many times the user released after a touch on the screen. } screen_touch_status_s_t; #ifdef PROS_USE_SIMPLE_NAMES @@ -97,7 +92,7 @@ typedef struct screen_touch_status_s { #define TEXT_MEDIUM pros::E_TEXT_MEDIUM #define TEXT_LARGE pros::E_TEXT_LARGE #define TEXT_MEDIUM_CENTER pros::E_TEXT_MEDIUM_CENTER -#define TEXT_LARGE_CENTER pros::E_LARGE_CENTER +#define TEXT_LARGE_CENTER pros::E_TEXT_LARGE_CENTER #define TOUCH_RELEASED pros::E_TOUCH_RELEASED #define TOUCH_PRESSED pros::E_TOUCH_PRESSED #define TOUCH_HELD pros::E_TOUCH_HELD diff --git a/include/pros/vision.hpp b/include/pros/vision.hpp index b8676794..e24eec10 100644 --- a/include/pros/vision.hpp +++ b/include/pros/vision.hpp @@ -23,6 +23,7 @@ #include +#include "pros/device.hpp" #include "pros/vision.h" namespace pros { @@ -48,7 +49,7 @@ class Vision : public Device { * The V5 port number from 1-21 * \param zero_point * One of vision_zero_e_t to set the (0,0) coordinate for the FOV - * + * * \b Example * \code * void opcontrol() { @@ -56,7 +57,10 @@ class Vision : public Device { * } * \endcode */ - explicit Vision(std::uint8_t port, vision_zero_e_t zero_point = E_VISION_ZERO_TOPLEFT); + Vision(std::uint8_t port, vision_zero_e_t zero_point = E_VISION_ZERO_TOPLEFT); + + Vision(const Device& device) + : Vision(device.get_port()) {}; /** * Clears the vision sensor LED color, reseting it back to its default @@ -68,14 +72,14 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example - * \code - * void initialize() { + * \code + * void initialize() { * pros::Vision vision_sensor(1); - * vision_sensor.clear_led(); - * } - * \endcode + * vision_sensor.clear_led(); + * } + * \endcode */ std::int32_t clear_led(void) const; @@ -102,27 +106,27 @@ class Vision : public Device { * Signature type * * \return A vision_signature_s_t that can be set using Vision::set_signature - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define EXAMPLE_SIG 1 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define EXAMPLE_SIG 1 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * // values acquired from the vision utility - * vision_signature_s_t RED_SIG = - * vision_signature_from_utility(EXAMPLE_SIG, 8973, 11143, 10058, -2119, -1053, -1586, 5.4, 0); - * vision_sensor.set_signature(EXAMPLE_SIG, &RED_SIG); - * while (true) { - * vision_signature_s_t rtn = vision_sensor.get_by_sig(VISION_PORT, 0, EXAMPLE_SIG); - * // Gets the largest object of the EXAMPLE_SIG signature - * printf("sig: %d", rtn.signature); - * // Prints "sig: 1" - * delay(2); - * } - * } - * \endcode + * // values acquired from the vision utility + * vision_signature_s_t RED_SIG = + * vision_signature_from_utility(EXAMPLE_SIG, 8973, 11143, 10058, -2119, -1053, -1586, 5.4, 0); + * vision_sensor.set_signature(EXAMPLE_SIG, &RED_SIG); + * while (true) { + * vision_signature_s_t rtn = vision_sensor.get_by_sig(VISION_PORT, 0, EXAMPLE_SIG); + * // Gets the largest object of the EXAMPLE_SIG signature + * printf("sig: %d", rtn.signature); + * // Prints "sig: 1" + * delay(2); + * } + * } + * \endcode */ static vision_signature_s_t signature_from_utility(const std::int32_t id, const std::int32_t u_min, const std::int32_t u_max, const std::int32_t u_mean, @@ -151,23 +155,25 @@ class Vision : public Device { * The fifth signature id [1-7] to add to the color code * * \return A vision_color_code_t object containing the color code information. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define EXAMPLE_SIG 1 - * #define OTHER_SIG 2 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define EXAMPLE_SIG 1 + * #define OTHER_SIG 2 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG); - * } - * \endcode + * vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG); + * } + * \endcode */ vision_color_code_t create_color_code(const std::uint32_t sig_id1, const std::uint32_t sig_id2, const std::uint32_t sig_id3 = 0, const std::uint32_t sig_id4 = 0, const std::uint32_t sig_id5 = 0) const; + static std::vector get_all_devices(); + /** * Gets the nth largest object according to size_id. * @@ -183,21 +189,21 @@ class Vision : public Device { * * \return The vision_object_s_t object corresponding to the given size id, or * PROS_ERR if an error occurred. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * while (true) { - * vision_object_s_t rtn = vision_sensor.get_by_size(0); - * // Gets the largest object - * printf("sig: %d", rtn.signature); - * delay(2); - * } - * } - * \endcode + * while (true) { + * vision_object_s_t rtn = vision_sensor.get_by_size(0); + * // Gets the largest object + * printf("sig: %d", rtn.signature); + * delay(2); + * } + * } + * \endcode */ vision_object_s_t get_by_size(const std::uint32_t size_id) const; @@ -220,23 +226,23 @@ class Vision : public Device { * * \return The vision_object_s_t object corresponding to the given signature * and size_id, or PROS_ERR if an error occurred. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define EXAMPLE_SIG 1 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define EXAMPLE_SIG 1 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * while (true) { - * vision_object_s_t rtn = vision_sensor.get_by_sig(0, EXAMPLE_SIG); - * // Gets the largest object of the EXAMPLE_SIG signature - * printf("sig: %d", rtn.signature); - * // Prints "sig: 1" - * delay(2); - * } - * } - * \endcode + * while (true) { + * vision_object_s_t rtn = vision_sensor.get_by_sig(0, EXAMPLE_SIG); + * // Gets the largest object of the EXAMPLE_SIG signature + * printf("sig: %d", rtn.signature); + * // Prints "sig: 1" + * delay(2); + * } + * } + * \endcode */ vision_object_s_t get_by_sig(const std::uint32_t size_id, const std::uint32_t sig_id) const; @@ -256,29 +262,29 @@ class Vision : public Device { * * \return The vision_object_s_t object corresponding to the given color code * and size_id, or PROS_ERR if an error occurred. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define EXAMPLE_SIG 1 - * #define OTHER_SIG 2 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define EXAMPLE_SIG 1 + * #define OTHER_SIG 2 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG); - * while (true) { - * vision_object_s_t rtn = vision_sensor.get_by_code(0, code1); - * // Gets the largest object - * printf("sig: %d", rtn.signature); - * delay(2); - * } - * } - * \endcode + * vision_color_code_t code1 = vision_sensor.create_color_code(EXAMPLE_SIG, OTHER_SIG); + * while (true) { + * vision_object_s_t rtn = vision_sensor.get_by_code(0, code1); + * // Gets the largest object + * printf("sig: %d", rtn.signature); + * delay(2); + * } + * } + * \endcode */ vision_object_s_t get_by_code(const std::uint32_t size_id, const vision_color_code_t color_code) const; /** - * Gets the exposure parameter of the Vision Sensor. + * Gets the exposure parameter of the Vision Sensor. * * This function uses the following values of errno when an error state is * reached: @@ -286,17 +292,17 @@ class Vision : public Device { * * \return The current exposure parameter from [0,150], * PROS_ERR if an error occurred - * + * * \b Example - * \code - * #define VISION_PORT 1 - * - * void initialize() { + * \code + * #define VISION_PORT 1 + * + * void initialize() { * pros::Vision vision_sensor(VISION_PORT); - * if (vision_sensor.get_exposure() < 50) - * vision_sensor.set_exposure(50); - * } - * \endcode + * if (vision_sensor.get_exposure() < 50) + * vision_sensor.set_exposure(50); + * } + * \endcode */ std::int32_t get_exposure(void) const; @@ -309,19 +315,19 @@ class Vision : public Device { * * \return The number of objects detected on the specified vision sensor. * Returns PROS_ERR if the port was invalid or an error occurred. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * while (true) { - * printf("Number of Objects Detected: %d\n", vision_sensor.get_object_count()); - * delay(2); - * } - * } - * \endcode + * while (true) { + * printf("Number of Objects Detected: %d\n", vision_sensor.get_object_count()); + * delay(2); + * } + * } + * \endcode */ std::int32_t get_object_count(void) const; @@ -336,18 +342,18 @@ class Vision : public Device { * The signature id to read * * \return A vision_signature_s_t containing information about the signature. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define EXAMPLE_SIG 1 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define EXAMPLE_SIG 1 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_signature_s_t sig = vision_sensor.get_signature(EXAMPLE_SIG); - * vision_sensor.print_signature(sig); - * } - * \endcode + * vision_signature_s_t sig = vision_sensor.get_signature(EXAMPLE_SIG); + * vision_sensor.print_signature(sig); + * } + * \endcode */ vision_signature_s_t get_signature(const std::uint8_t signature_id) const; @@ -359,22 +365,21 @@ class Vision : public Device { * ENODEV - The port cannot be configured as a vision sensor * * \return The current RGB white balance setting of the sensor - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define VISION_WHITE 0xff - * - * void initialize() { + * \code + * #define VISION_PORT 1 + * #define VISION_WHITE 0xff + * + * void initialize() { * pros::Vision vision_sensor(VISION_PORT); - * if (vision_sensor.get_white_balance() != VISION_WHITE) - * vision_sensor.set_white_balance(VISION_WHITE); - * } - * \endcode + * if (vision_sensor.get_white_balance() != VISION_WHITE) + * vision_sensor.set_white_balance(VISION_WHITE); + * } + * \endcode */ std::int32_t get_white_balance(void) const; - /** * Reads up to object_count object descriptors into object_arr. * @@ -397,23 +402,23 @@ class Vision : public Device { * Returns PROS_ERR if the port was invalid, an error occurred, or fewer objects * than size_id were found. All objects in object_arr that were not found are * given VISION_OBJECT_ERR_SIG as their signature. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define NUM_VISION_OBJECTS 4 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define NUM_VISION_OBJECTS 4 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; - * while (true) { - * vision_sensor.read_by_size(0, NUM_VISION_OBJECTS, object_arr); - * printf("sig: %d", object_arr[0].signature); - * // Prints the signature of the largest object found - * delay(2); - * } - * } - * \endcode + * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; + * while (true) { + * vision_sensor.read_by_size(0, NUM_VISION_OBJECTS, object_arr); + * printf("sig: %d", object_arr[0].signature); + * // Prints the signature of the largest object found + * delay(2); + * } + * } + * \endcode */ std::int32_t read_by_size(const std::uint32_t size_id, const std::uint32_t object_count, vision_object_s_t* const object_arr) const; @@ -444,19 +449,19 @@ class Vision : public Device { * Returns PROS_ERR if the port was invalid, an error occurred, or fewer objects * than size_id were found. All objects in object_arr that were not found are * given VISION_OBJECT_ERR_SIG as their signature. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * #define EXAMPLE_SIG 1 - * #define NUM_VISION_OBJECTS 4 - * - * void opcontrol() { + * \code + * #define VISION_PORT 1 + * #define EXAMPLE_SIG 1 + * #define NUM_VISION_OBJECTS 4 + * + * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); - * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; - * while (true) { - * vision_sensor.read_by_sig(0, EXAMPLE_SIG, NUM_VISION_OBJECTS, object_arr); - * printf("sig: %d", object_arr[0].signature); + * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; + * while (true) { + * vision_sensor.read_by_sig(0, EXAMPLE_SIG, NUM_VISION_OBJECTS, object_arr); + * printf("sig: %d", object_arr[0].signature); * // Prints "sig: 1" * delay(2); * } @@ -490,14 +495,14 @@ class Vision : public Device { * Returns PROS_ERR if the port was invalid, an error occurred, or fewer objects * than size_id were found. All objects in object_arr that were not found are * given VISION_OBJECT_ERR_SIG as their signature. - * + * * \b Example - * \code + * \code * #define VISION_PORT 1 * #define EXAMPLE_SIG 1 * #define OTHER_SIG 2 * #define NUM_VISION_OBJECTS 4 - * + * * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); * vision_object_s_t object_arr[NUM_VISION_OBJECTS]; @@ -521,12 +526,12 @@ class Vision : public Device { * The signature for which the contents will be printed * * \return 1 if no errors occured, PROS_ERR otherwise - * + * * \b Example * \code - * #define VISION_PORT 1 + * #define VISION_PORT 1 * #define EXAMPLE_SIG 1 - * + * * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); * vision_signature_s_t sig = visionsensor.get_signature(EXAMPLE_SIG); @@ -548,11 +553,11 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * + * \code + * #define VISION_PORT 1 + * * void initialize() { * pros::Vision vision_sensor(VISION_PORT); * vision_sensor.set_auto_white_balance(true); @@ -562,7 +567,7 @@ class Vision : public Device { std::int32_t set_auto_white_balance(const std::uint8_t enable) const; /** - * Sets the exposure parameter of the Vision Sensor. + * Sets the exposure parameter of the Vision Sensor. * * This function uses the following values of errno when an error state is * reached: @@ -573,11 +578,11 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * #define VISION_PORT 1 - * + * * void initialize() { * pros::Vision vision_sensor(VISION_PORT); * if (vision_sensor.get_exposure() < 50) @@ -599,11 +604,11 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example * \code * #define VISION_PORT 1 - * + * * void initialize() { * pros::Vision vision_sensor(VISION_PORT); * vision_sensor.set_led(COLOR_BLANCHED_ALMOND); @@ -629,12 +634,12 @@ class Vision : public Device { * A pointer to the signature to save * * \return 1 if no errors occured, PROS_ERR otherwise - * + * * \b Example * \code * #define VISION_PORT 1 * #define EXAMPLE_SIG 1 - * + * * void opcontrol() { * pros::Vision vision_sensor(VISION_PORT); * vision_signature_s_t sig = vision_sensor.get_signature(EXAMPLE_SIG); @@ -657,12 +662,12 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example - * \code + * \code * #define VISION_PORT 1 * #define VISION_WHITE 0xff - * + * * void initialize() { * pros::Vision vision_sensor(VISION_PORT); * vision_sensor.set_white_balance(VISION_WHITE); @@ -687,11 +692,11 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example - * \code + * \code * #define VISION_PORT 1 - * + * * void initialize() { * pros::Vision vision_sensor(VISION_PORT); * vision_sensor.set_zero_point(E_VISION_ZERO_CENTER); @@ -712,19 +717,41 @@ class Vision : public Device { * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. - * + * * \b Example - * \code - * #define VISION_PORT 1 - * - * void initialize() { + * \code + * #define VISION_PORT 1 + * + * void initialize() { * pros::Vision vision_sensor(VISION_PORT); - * vision_sensor.set_wifi_mode(0); - * } - * \endcode + * vision_sensor.set_wifi_mode(0); + * } + * \endcode */ std::int32_t set_wifi_mode(const std::uint8_t enable) const; - + + /** + * Gets a vision sensor that is plugged in to the brain + * + * \note The first time this function is called it returns the vision sensor at the lowest port + * If this function is called multiple times, it will cycle through all the ports. + * For example, if you have 1 vision sensor on the robot + * this function will always return a vision sensor object for that port. + * If you have 2 vision sensors, all the odd numered calls to this function will return objects + * for the lower port number, + * all the even number calls will return vision objects for the higher port number + * + * + * This functions uses the following values of errno when an error state is + * reached: + * ENODEV - No vision sensor is plugged into the brain + * + * \return A vision object corresponding to a port that a vision sensor is connected to the brain + * If no vision sensor is plugged in, it returns a vision sensor on port PROS_ERR_BYTE + * + */ + static Vision get_vision(); + private: ///@} }; diff --git a/project.pros b/project.pros index 0a9fcbb8..17c08ae0 100644 --- a/project.pros +++ b/project.pros @@ -1,284 +1,261 @@ -{ - "py/object": "pros.conductor.project.Project", - "py/state": { - "project_name": "VOSS", - "target": "v5", - "templates": { - "kernel": { - "location": "C:\\Users\\mihir\\AppData\\Roaming\\PROS\\templates\\kernel@4.0.5", - "metadata": { - "cold_addr": "58720256", - "cold_output": "bin/cold.package.bin", - "hot_addr": "125829120", - "hot_output": "bin/hot.package.bin", - "origin": "kernel-beta-mainline", - "output": "bin/monolith.bin" - }, - "name": "kernel", - "py/object": "pros.conductor.templates.local_template.LocalTemplate", - "supported_kernels": null, - "system_files": [ - "include\\pros\\adi.h", - "include\\pros\\rtos.h", - "include\\pros\\llemu.h", - "firmware\\libm.a", - "firmware\\libpros.a", - "include\\pros\\gps.h", - "include\\pros\\llemu.hpp", - "include\\pros\\rotation.hpp", - "include\\pros\\motors.hpp", - "include\\pros\\motor_group.hpp", - "include\\pros\\imu.hpp", - "include\\pros\\error.h", - "firmware\\v5-common.ld", - "firmware\\v5-hot.ld", - "include\\pros\\colors.hpp", - "include\\pros\\optical.h", - "include\\pros\\ext_adi.h", - "include\\pros\\rotation.h", - "include\\pros\\vision.h", - "include\\pros\\distance.hpp", - "include\\pros\\apix.h", - "include\\pros\\misc.h", - "include\\pros\\vision.hpp", - "include\\pros\\optical.hpp", - "include\\pros\\imu.h", - "include\\pros\\abstract_motor.hpp", - "include\\pros\\gps.hpp", - "firmware\\libc.a", - "include\\pros\\colors.h", - "include\\pros\\link.h", - "include\\pros\\link.hpp", - "firmware\\v5.ld", - "include\\pros\\serial.hpp", - "include\\pros\\device.hpp", - "include\\pros\\screen.hpp", - "include\\pros\\adi.hpp", - "include\\pros\\distance.h", - "include\\api.h", - "include\\pros\\serial.h", - "include\\pros\\device.h", - "include\\pros\\misc.hpp", - "common.mk", - "include\\pros\\screen.h", - "include\\pros\\rtos.hpp", - "include\\pros\\motors.h" - ], - "target": "v5", - "user_files": [ - "src\\main.cc", - ".gitignore", - "include\\main.hpp", - "Makefile", - "include\\main.h", - "src\\main.cpp", - "include\\main.hh", - "src\\main.c" - ], - "version": "4.0.5" - }, - "liblvgl": { - "location": "C:\\Users\\mayan\\AppData\\Roaming\\PROS\\templates\\liblvgl@8.3.6", - "metadata": { - "origin": "kernel-beta-mainline" - }, - "name": "liblvgl", - "py/object": "pros.conductor.templates.local_template.LocalTemplate", - "supported_kernels": ">=4.0.0", - "system_files": [ - "include\\liblvgl\\draw\\nxp\\vglite\\lv_gpu_nxp_vglite.h", - "include\\liblvgl\\extra\\lv_extra.h", - "include\\liblvgl\\draw\\lv_draw_mask.h", - "include\\liblvgl\\misc\\lv_types.h", - "include\\liblvgl\\widgets\\lv_objx_templ.h", - "include\\liblvgl\\extra\\widgets\\calendar\\lv_calendar.h", - "include\\liblvgl\\extra\\widgets\\tabview\\lv_tabview.h", - "include\\liblvgl\\draw\\stm32_dma2d\\lv_gpu_stm32_dma2d.h", - "include\\liblvgl\\font\\lv_symbol_def.h", - "include\\liblvgl\\misc\\lv_misc.mk", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_rect.h", - "include\\liblvgl\\extra\\themes\\default\\lv_theme_default.h", - "include\\liblvgl\\extra\\widgets\\animimg\\lv_animimg.h", - "include\\liblvgl\\widgets\\lv_btn.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl.mk", - "include\\liblvgl\\extra\\libs\\png\\lv_png.h", - "include\\liblvgl\\extra\\widgets\\imgbtn\\lv_imgbtn.h", - "include\\liblvgl\\misc\\lv_mem.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_mask.h", - "include\\liblvgl\\draw\\sdl\\README.md", - "include\\liblvgl\\core\\lv_obj.h", - "include\\liblvgl\\draw\\sw\\lv_draw_sw_blend.h", - "include\\liblvgl\\extra\\libs\\sjpg\\tjpgd.h", - "include\\liblvgl\\misc\\lv_color.h", - "include\\liblvgl\\draw\\nxp\\lv_draw_nxp.mk", - "include\\liblvgl\\extra\\widgets\\led\\lv_led.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_utils.h", - "include\\liblvgl\\lv_api_map.h", - "include\\liblvgl\\widgets\\lv_slider.h", - "include\\liblvgl\\draw\\nxp\\pxp\\lv_draw_nxp_pxp.mk", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_rect.h", - "include\\liblvgl\\extra\\layouts\\grid\\lv_grid.h", - "include\\liblvgl\\misc\\lv_ll.h", - "include\\liblvgl\\extra\\widgets\\menu\\lv_menu.h", - "include\\liblvgl\\extra\\libs\\rlottie\\lv_rlottie.h", - "include\\liblvgl\\extra\\others\\gridnav\\lv_gridnav.h", - "include\\liblvgl\\widgets\\lv_widgets.mk", - "include\\liblvgl\\extra\\widgets\\calendar\\lv_calendar_header_dropdown.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_layer.h", - "include\\liblvgl\\extra\\widgets\\win\\lv_win.h", - "include\\liblvgl\\extra\\libs\\fsdrv\\lv_fsdrv.h", - "include\\liblvgl\\misc\\lv_utils.h", - "include\\liblvgl\\extra\\widgets\\spinbox\\lv_spinbox.h", - "include\\liblvgl\\draw\\lv_draw_rect.h", - "firmware\\liblvgl.a", - "include\\liblvgl\\draw\\lv_draw_line.h", - "include\\liblvgl\\misc\\lv_math.h", - "include\\liblvgl\\widgets\\lv_bar.h", - "include\\liblvgl\\draw\\swm341_dma2d\\lv_draw_swm341_dma2d.mk", - "include\\liblvgl\\extra\\widgets\\span\\lv_span.h", - "include\\liblvgl\\extra\\lv_extra.mk", - "include\\liblvgl\\widgets\\lv_dropdown.h", - "include\\liblvgl\\lvgl.h", - "include\\liblvgl\\extra\\widgets\\lv_widgets.h", - "include\\liblvgl\\draw\\lv_img_buf.h", - "include\\liblvgl\\widgets\\lv_textarea.h", - "include\\liblvgl\\hal\\lv_hal_tick.h", - "include\\liblvgl\\hal\\lv_hal.mk", - "include\\liblvgl\\hal\\lv_hal_disp.h", - "include\\liblvgl\\draw\\nxp\\pxp\\lv_gpu_nxp_pxp.h", - "include\\liblvgl\\core\\lv_indev_scroll.h", - "include\\liblvgl\\draw\\nxp\\lv_gpu_nxp.h", - "include\\liblvgl\\extra\\layouts\\lv_layouts.h", - "include\\liblvgl\\draw\\lv_img_cache.h", - "include\\liblvgl\\extra\\libs\\qrcode\\lv_qrcode.h", - "include\\liblvgl\\widgets\\lv_roller.h", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_vglite_buf.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl.h", - "include\\liblvgl\\misc\\lv_bidi.h", - "include\\liblvgl\\extra\\widgets\\chart\\lv_chart.h", - "include\\liblvgl\\misc\\lv_log.h", - "include\\liblvgl\\lv_conf_internal.h", - "include\\liblvgl\\extra\\libs\\bmp\\lv_bmp.h", - "include\\liblvgl\\draw\\sw\\lv_draw_sw.mk", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite.h", - "include\\liblvgl\\widgets\\lv_btnmatrix.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_stack_blur.h", - "include\\liblvgl\\draw\\lv_draw_layer.h", - "include\\liblvgl\\core\\lv_refr.h", - "include\\liblvgl\\llemu.hpp", - "include\\liblvgl\\font\\lv_font_loader.h", - "include\\liblvgl\\extra\\themes\\mono\\lv_theme_mono.h", - "include\\liblvgl\\draw\\lv_draw_arc.h", - "include\\liblvgl\\misc\\lv_gc.h", - "include\\liblvgl\\widgets\\lv_img.h", - "include\\liblvgl\\extra\\widgets\\list\\lv_list.h", - "include\\liblvgl\\extra\\layouts\\flex\\lv_flex.h", - "include\\liblvgl\\misc\\lv_tlsf.h", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_blend.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_img.h", - "include\\liblvgl\\misc\\lv_assert.h", - "include\\liblvgl\\misc\\lv_printf.h", - "include\\liblvgl\\draw\\nxp\\pxp\\lv_draw_pxp.h", - "include\\liblvgl\\extra\\README.md", - "include\\liblvgl\\extra\\others\\snapshot\\lv_snapshot.h", - "include\\liblvgl\\misc\\lv_timer.h", - "include\\liblvgl\\misc\\lv_async.h", - "include\\liblvgl\\misc\\lv_anim_timeline.h", - "include\\liblvgl\\extra\\libs\\freetype\\arial.ttf", - "include\\liblvgl\\extra\\libs\\png\\lodepng.h", - "include\\liblvgl\\draw\\arm2d\\lv_draw_arm2d.mk", - "include\\liblvgl\\extra\\themes\\lv_themes.h", - "include\\liblvgl\\extra\\themes\\basic\\lv_theme_basic.h", - "include\\liblvgl\\extra\\widgets\\colorwheel\\lv_colorwheel.h", - "include\\liblvgl\\core\\lv_obj_style_gen.h", - "include\\liblvgl\\font\\lv_font_fmt_txt.h", - "include\\liblvgl\\hal\\lv_hal.h", - "include\\liblvgl\\widgets\\lv_canvas.h", - "include\\liblvgl\\lv_conf.h", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_vglite_utils.h", - "include\\liblvgl\\misc\\lv_area.h", - "include\\liblvgl\\draw\\lv_img_decoder.h", - "include\\liblvgl\\core\\lv_group.h", - "include\\liblvgl\\draw\\lv_draw_triangle.h", - "include\\liblvgl\\extra\\others\\fragment\\README.md", - "include\\liblvgl\\lv_conf_kconfig.h", - "include\\liblvgl\\extra\\widgets\\spinner\\lv_spinner.h", - "include\\liblvgl\\widgets\\lv_checkbox.h", - "include\\liblvgl\\draw\\lv_draw.h", - "include\\liblvgl\\misc\\lv_lru.h", - "include\\liblvgl\\draw\\lv_draw_transform.h", - "include\\liblvgl\\extra\\others\\monkey\\lv_monkey.h", - "include\\liblvgl\\widgets\\lv_table.h", - "include\\liblvgl\\draw\\nxp\\pxp\\lv_gpu_nxp_pxp_osa.h", - "include\\liblvgl\\extra\\others\\imgfont\\lv_imgfont.h", - "include\\liblvgl\\widgets\\lv_label.h", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_arc.h", - "include\\liblvgl\\draw\\stm32_dma2d\\lv_draw_stm32_dma2d.mk", - "include\\liblvgl\\extra\\libs\\ffmpeg\\lv_ffmpeg.h", - "include\\liblvgl\\extra\\others\\ime\\lv_ime_pinyin.h", - "include\\liblvgl\\misc\\lv_txt.h", - "include\\liblvgl\\widgets\\lv_arc.h", - "include\\liblvgl\\extra\\widgets\\meter\\lv_meter.h", - "include\\liblvgl\\font\\lv_font.mk", - "include\\liblvgl\\core\\lv_indev.h", - "include\\liblvgl\\extra\\widgets\\tileview\\lv_tileview.h", - "include\\liblvgl\\draw\\lv_draw_img.h", - "include\\liblvgl\\extra\\others\\lv_others.h", - "include\\liblvgl\\draw\\lv_draw_label.h", - "include\\liblvgl\\draw\\nxp\\pxp\\lv_draw_pxp_blend.h", - "include\\liblvgl\\core\\lv_theme.h", - "include\\liblvgl\\extra\\libs\\gif\\lv_gif.h", - "include\\liblvgl\\extra\\others\\fragment\\lv_fragment.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_texture_cache.h", - "include\\liblvgl\\extra\\libs\\sjpg\\tjpgdcnf.h", - "include\\liblvgl\\extra\\widgets\\msgbox\\lv_msgbox.h", - "include\\liblvgl\\draw\\arm2d\\lv_gpu_arm2d.h", - "include\\liblvgl\\extra\\others\\msg\\lv_msg.h", - "include\\liblvgl\\core\\lv_disp.h", - "include\\liblvgl\\widgets\\lv_line.h", - "include\\liblvgl\\extra\\libs\\gif\\gifdec.h", - "include\\liblvgl\\extra\\libs\\sjpg\\lv_sjpg.h", - "include\\liblvgl\\extra\\libs\\qrcode\\qrcodegen.h", - "include\\liblvgl\\core\\lv_obj_class.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_priv.h", - "include\\liblvgl\\extra\\widgets\\calendar\\lv_calendar_header_arrow.h", - "include\\liblvgl\\misc\\lv_templ.h", - "include\\liblvgl\\core\\lv_obj_draw.h", - "include\\liblvgl\\extra\\libs\\lv_libs.h", - "include\\liblvgl\\widgets\\lv_switch.h", - "include\\liblvgl\\draw\\lv_draw.mk", - "include\\liblvgl\\hal\\lv_hal_indev.h", - "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_composite.h", - "include\\liblvgl\\draw\\sw\\lv_draw_sw_gradient.h", - "include\\liblvgl\\core\\lv_core.mk", - "include\\liblvgl\\draw\\sw\\lv_draw_sw.h", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_nxp_vglite.mk", - "include\\liblvgl\\misc\\lv_style_gen.h", - "include\\liblvgl\\misc\\lv_anim.h", - "include\\liblvgl\\core\\lv_obj_style.h", - "include\\liblvgl\\core\\lv_obj_tree.h", - "include\\liblvgl\\misc\\lv_txt_ap.h", - "include\\liblvgl\\draw\\sw\\lv_draw_sw_dither.h", - "include\\liblvgl\\core\\lv_obj_pos.h", - "include\\liblvgl\\core\\lv_obj_scroll.h", - "include\\liblvgl\\llemu.h", - "include\\liblvgl\\font\\korean.ttf", - "include\\liblvgl\\misc\\lv_style.h", - "include\\liblvgl\\draw\\swm341_dma2d\\lv_gpu_swm341_dma2d.h", - "include\\liblvgl\\font\\lv_font.h", - "include\\liblvgl\\extra\\widgets\\keyboard\\lv_keyboard.h", - "include\\liblvgl\\misc\\lv_fs.h", - "include\\liblvgl\\core\\lv_event.h", - "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_line.h", - "include\\liblvgl\\extra\\libs\\freetype\\lv_freetype.h" - ], - "target": "v5", - "user_files": [], - "version": "8.3.6" - } - }, - "upload_options": { - "slot": 8 - } - } +{ + "py/object": "pros.conductor.project.Project", + "py/state": { + "project_name": "VOSS", + "target": "v5", + "templates": { + "kernel": { + "location": "/Users/rockychen/Library/Application Support/PROS/templates/kernel@4.0.7", + "metadata": { + "cold_addr": "58720256", + "cold_output": "bin/cold.package.bin", + "hot_addr": "125829120", + "hot_output": "bin/hot.package.bin", + "origin": "kernel-beta-mainline", + "output": "bin/monolith.bin" + }, + "name": "kernel", + "py/object": "pros.conductor.templates.local_template.LocalTemplate", + "supported_kernels": null, + "system_files": [ + "include\\pros\\error.h", + "include\\pros\\device.h", + "firmware\\libpros.a", + "include\\pros\\ext_adi.h", + "firmware\\v5.ld", + "include\\pros\\rotation.h", + "include\\pros\\adi.h", + "include\\pros\\motor_group.hpp", + "include\\pros\\distance.h", + "include\\pros\\gps.h", + "include\\pros\\colors.h", + "include\\pros\\abstract_motor.hpp", + "firmware\\libm.a", + "include\\pros\\optical.h", + "include\\pros\\rotation.hpp", + "include\\pros\\rtos.h", + "include\\pros\\distance.hpp", + "include\\pros\\vision.hpp", + "include\\pros\\motors.hpp", + "include\\pros\\vision.h", + "firmware\\v5-hot.ld", + "firmware\\libc.a", + "include\\pros\\imu.h", + "include\\pros\\llemu.h", + "firmware\\v5-common.ld", + "include\\pros\\link.h", + "include\\pros\\adi.hpp", + "include\\pros\\misc.hpp", + "include\\pros\\llemu.hpp", + "include\\pros\\motors.h", + "include\\pros\\screen.h", + "include\\pros\\serial.h", + "include\\pros\\colors.hpp", + "common.mk", + "include\\pros\\misc.h", + "include\\pros\\screen.hpp", + "include\\pros\\apix.h", + "include\\pros\\rtos.hpp", + "include\\pros\\optical.hpp", + "include\\pros\\device.hpp", + "include\\pros\\imu.hpp", + "include\\pros\\gps.hpp", + "include\\api.h", + "include\\pros\\link.hpp", + "include\\pros\\serial.hpp" + ], + "target": "v5", + "user_files": [ + "include\\main.hpp", + "include\\main.h", + ".gitignore", + "include\\main.hh", + "src\\main.cpp", + "src\\main.c", + "src\\main.cc", + "Makefile" + ], + "version": "4.0.7" + }, + "liblvgl": { + "location": "/Users/rockychen/Library/Application Support/PROS/templates/liblvgl@8.3.8", + "metadata": { + "origin": "kernel-beta-mainline" + }, + "name": "liblvgl", + "py/object": "pros.conductor.templates.local_template.LocalTemplate", + "supported_kernels": ">=4.0.0", + "system_files": [ + "include\\liblvgl\\extra\\others\\gridnav\\lv_gridnav.h", + "include\\liblvgl\\font\\lv_font_loader.h", + "include\\liblvgl\\misc\\lv_txt_ap.h", + "include\\liblvgl\\core\\lv_indev_scroll.h", + "include\\liblvgl\\misc\\lv_types.h", + "include\\liblvgl\\draw\\lv_img_decoder.h", + "include\\liblvgl\\extra\\libs\\freetype\\lv_freetype.h", + "include\\liblvgl\\extra\\widgets\\led\\lv_led.h", + "include\\liblvgl\\widgets\\lv_bar.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_rect.h", + "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_blend.h", + "include\\liblvgl\\extra\\libs\\png\\lv_png.h", + "include\\liblvgl\\misc\\lv_printf.h", + "include\\liblvgl\\extra\\themes\\lv_themes.h", + "include\\liblvgl\\draw\\lv_draw_transform.h", + "include\\liblvgl\\lv_conf_checker.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_priv.h", + "include\\liblvgl\\extra\\themes\\basic\\lv_theme_basic.h", + "include\\liblvgl\\extra\\widgets\\msgbox\\lv_msgbox.h", + "include\\liblvgl\\extra\\libs\\bmp\\lv_bmp.h", + "include\\liblvgl\\extra\\widgets\\span\\lv_span.h", + "include\\liblvgl\\misc\\lv_fs.h", + "include\\liblvgl\\misc\\lv_lru.h", + "include\\liblvgl\\core\\lv_obj_style.h", + "include\\liblvgl\\extra\\libs\\qrcode\\lv_qrcode.h", + "include\\liblvgl\\core\\lv_obj_class.h", + "include\\liblvgl\\lv_conf_internal.h", + "include\\liblvgl\\lv_conf.h", + "include\\liblvgl\\extra\\widgets\\lv_widgets.h", + "include\\liblvgl\\core\\lv_refr.h", + "include\\liblvgl\\extra\\widgets\\imgbtn\\lv_imgbtn.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_stack_blur.h", + "include\\liblvgl\\lvgl.h", + "include\\liblvgl\\misc\\lv_anim_timeline.h", + "include\\liblvgl\\extra\\widgets\\spinner\\lv_spinner.h", + "include\\liblvgl\\extra\\widgets\\animimg\\lv_animimg.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_texture_cache.h", + "include\\liblvgl\\extra\\libs\\fsdrv\\lv_fsdrv.h", + "include\\liblvgl\\draw\\nxp\\pxp\\lv_gpu_nxp_pxp.h", + "include\\liblvgl\\extra\\others\\fragment\\lv_fragment.h", + "include\\liblvgl\\extra\\widgets\\calendar\\lv_calendar_header_dropdown.h", + "include\\liblvgl\\draw\\lv_draw_triangle.h", + "include\\liblvgl\\lv_api_map.h", + "include\\liblvgl\\extra\\widgets\\chart\\lv_chart.h", + "include\\liblvgl\\extra\\widgets\\colorwheel\\lv_colorwheel.h", + "include\\liblvgl\\hal\\lv_hal_disp.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_img.h", + "include\\liblvgl\\extra\\widgets\\tileview\\lv_tileview.h", + "include\\liblvgl\\widgets\\lv_btnmatrix.h", + "include\\liblvgl\\core\\lv_obj_scroll.h", + "include\\liblvgl\\extra\\layouts\\grid\\lv_grid.h", + "include\\liblvgl\\misc\\lv_area.h", + "include\\liblvgl\\widgets\\lv_dropdown.h", + "include\\liblvgl\\hal\\lv_hal.h", + "include\\liblvgl\\draw\\nxp\\lv_gpu_nxp.h", + "include\\liblvgl\\extra\\others\\imgfont\\lv_imgfont.h", + "include\\liblvgl\\misc\\lv_txt.h", + "include\\liblvgl\\core\\lv_obj.h", + "include\\liblvgl\\widgets\\lv_objx_templ.h", + "include\\liblvgl\\core\\lv_group.h", + "firmware\\liblvgl.a", + "include\\liblvgl\\font\\lv_font.h", + "include\\liblvgl\\draw\\sw\\lv_draw_sw_blend.h", + "include\\liblvgl\\draw\\lv_draw_label.h", + "include\\liblvgl\\extra\\libs\\gif\\gifdec.h", + "include\\liblvgl\\lv_conf.old.h", + "include\\liblvgl\\hal\\lv_hal_tick.h", + "include\\liblvgl\\draw\\sw\\lv_draw_sw_dither.h", + "include\\liblvgl\\widgets\\lv_textarea.h", + "include\\liblvgl\\extra\\libs\\gif\\lv_gif.h", + "include\\liblvgl\\llemu.h", + "include\\liblvgl\\misc\\lv_async.h", + "include\\liblvgl\\draw\\sw\\lv_draw_sw.h", + "include\\liblvgl\\draw\\lv_draw_mask.h", + "include\\liblvgl\\widgets\\lv_img.h", + "include\\liblvgl\\extra\\widgets\\tabview\\lv_tabview.h", + "include\\liblvgl\\core\\lv_obj_style_gen.h", + "include\\liblvgl\\extra\\others\\ime\\lv_ime_pinyin.h", + "include\\liblvgl\\misc\\lv_log.h", + "include\\liblvgl\\font\\lv_symbol_def.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_utils.h", + "include\\liblvgl\\extra\\layouts\\flex\\lv_flex.h", + "include\\liblvgl\\misc\\lv_style_gen.h", + "include\\liblvgl\\extra\\libs\\sjpg\\tjpgd.h", + "include\\liblvgl\\draw\\lv_draw_rect.h", + "include\\liblvgl\\extra\\libs\\ffmpeg\\lv_ffmpeg.h", + "include\\liblvgl\\draw\\lv_draw_arc.h", + "include\\liblvgl\\misc\\lv_bidi.h", + "include\\liblvgl\\extra\\widgets\\win\\lv_win.h", + "include\\liblvgl\\draw\\lv_img_cache.h", + "include\\liblvgl\\core\\lv_obj_draw.h", + "include\\liblvgl\\extra\\others\\msg\\lv_msg.h", + "include\\liblvgl\\misc\\lv_ll.h", + "include\\liblvgl\\widgets\\lv_table.h", + "include\\liblvgl\\lv_conf_kconfig.h", + "include\\liblvgl\\draw\\lv_draw_layer.h", + "include\\liblvgl\\misc\\lv_assert.h", + "include\\liblvgl\\extra\\libs\\sjpg\\tjpgdcnf.h", + "include\\liblvgl\\widgets\\lv_checkbox.h", + "include\\liblvgl\\core\\lv_obj_tree.h", + "include\\liblvgl\\hal\\lv_hal_indev.h", + "include\\liblvgl\\widgets\\lv_label.h", + "include\\liblvgl\\misc\\lv_mem.h", + "include\\liblvgl\\widgets\\lv_btn.h", + "include\\liblvgl\\core\\lv_theme.h", + "include\\liblvgl\\font\\lv_font_fmt_txt.h", + "include\\liblvgl\\extra\\others\\snapshot\\lv_snapshot.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_layer.h", + "include\\liblvgl\\extra\\libs\\qrcode\\qrcodegen.h", + "include\\liblvgl\\draw\\sw\\lv_draw_sw_gradient.h", + "include\\liblvgl\\misc\\lv_utils.h", + "include\\liblvgl\\draw\\nxp\\pxp\\lv_draw_pxp_blend.h", + "include\\liblvgl\\misc\\lv_style.h", + "include\\liblvgl\\widgets\\lv_line.h", + "include\\liblvgl\\widgets\\lv_slider.h", + "include\\liblvgl\\extra\\widgets\\meter\\lv_meter.h", + "include\\liblvgl\\draw\\arm2d\\lv_gpu_arm2d.h", + "include\\liblvgl\\extra\\libs\\rlottie\\lv_rlottie.h", + "include\\liblvgl\\extra\\others\\lv_others.h", + "include\\liblvgl\\extra\\layouts\\lv_layouts.h", + "include\\liblvgl\\extra\\widgets\\calendar\\lv_calendar_header_arrow.h", + "include\\liblvgl\\draw\\swm341_dma2d\\lv_gpu_swm341_dma2d.h", + "include\\liblvgl\\draw\\stm32_dma2d\\lv_gpu_stm32_dma2d.h", + "include\\liblvgl\\misc\\lv_anim.h", + "include\\liblvgl\\extra\\widgets\\calendar\\lv_calendar.h", + "include\\liblvgl\\misc\\lv_templ.h", + "include\\liblvgl\\extra\\widgets\\spinbox\\lv_spinbox.h", + "include\\liblvgl\\extra\\lv_extra.h", + "include\\liblvgl\\draw\\lv_draw_img.h", + "include\\liblvgl\\draw\\lv_img_buf.h", + "include\\liblvgl\\extra\\libs\\sjpg\\lv_sjpg.h", + "include\\liblvgl\\extra\\libs\\lv_libs.h", + "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_rect.h", + "include\\liblvgl\\llemu.hpp", + "include\\liblvgl\\draw\\lv_draw.h", + "include\\liblvgl\\extra\\themes\\mono\\lv_theme_mono.h", + "include\\liblvgl\\core\\lv_event.h", + "include\\liblvgl\\widgets\\lv_canvas.h", + "include\\liblvgl\\extra\\others\\monkey\\lv_monkey.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_mask.h", + "include\\liblvgl\\draw\\nxp\\vglite\\lv_draw_vglite_arc.h", + "include\\liblvgl\\draw\\nxp\\pxp\\lv_gpu_nxp_pxp_osa.h", + "include\\liblvgl\\core\\lv_disp.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl_composite.h", + "include\\liblvgl\\widgets\\lv_switch.h", + "include\\liblvgl\\draw\\sdl\\lv_draw_sdl.h", + "include\\liblvgl\\core\\lv_indev.h", + "include\\liblvgl\\misc\\lv_timer.h", + "include\\liblvgl\\draw\\nxp\\vglite\\lv_gpu_nxp_vglite.h", + "include\\liblvgl\\extra\\widgets\\menu\\lv_menu.h", + "include\\liblvgl\\misc\\lv_math.h", + "include\\liblvgl\\misc\\lv_color.h", + "include\\liblvgl\\draw\\lv_draw_line.h", + "include\\liblvgl\\misc\\lv_gc.h", + "include\\liblvgl\\core\\lv_obj_pos.h", + "include\\liblvgl\\widgets\\lv_arc.h", + "include\\liblvgl\\extra\\themes\\default\\lv_theme_default.h", + "include\\liblvgl\\extra\\widgets\\list\\lv_list.h", + "include\\liblvgl\\widgets\\lv_roller.h", + "include\\liblvgl\\extra\\libs\\png\\lodepng.h", + "include\\liblvgl\\misc\\lv_tlsf.h", + "include\\liblvgl\\extra\\widgets\\keyboard\\lv_keyboard.h" + ], + "target": "v5", + "user_files": [], + "version": "8.3.8" + } + }, + "upload_options": { + "slot": 8 + } + } } \ No newline at end of file