diff --git a/picovga.cmake b/picovga.cmake index 710253e..28015e4 100644 --- a/picovga.cmake +++ b/picovga.cmake @@ -1,6 +1,11 @@ # This file should be included in your project to use the picovga library # the PICOVGA_PATH variable should be set to the root of the picovga project directory +if (DEFINED ENV{PICOVGA_PATH} AND (NOT PICOVGA_PATH)) + set(PICOVGA_PATH $ENV{PICOVGA_PATH}) + message("Using PICOVGA_PATH from environment ('${PICOVGA_PATH}')") +endif () + # The macro add_picovga adds the picovga path references to the specified project. # PICOVGA_PATH must be set to the root of the picovga project directory macro(add_picovga project) diff --git a/picovga_import.cmake b/picovga_import.cmake new file mode 100644 index 0000000..ccaf2e8 --- /dev/null +++ b/picovga_import.cmake @@ -0,0 +1,28 @@ +# This is a copy of /picovga_import.cmake + +# This can be dropped into an external project to help locate the PicoVGA SDK +# It should be include()ed prior to project() + +if (DEFINED ENV{PICOVGA_PATH} AND (NOT PICOVGA_PATH)) + set(PICOVGA_PATH $ENV{PICOVGA_PATH}) + message("Using PICOVGA_PATH from environment ('${PICOVGA_PATH}')") +endif () + +set(PICOVGA_PATH "${PICOVGA_PATH}" CACHE PATH "Path to the PicoVGA Library") + +if (NOT PICOVGA_PATH) + message(FATAL_ERROR "PicoVGA location was not specified. Please set PICOVGA_PATH.") +endif () + +if (NOT EXISTS ${PICOVGA_PATH}) + message(FATAL_ERROR "Directory '${PICOVGA_PATH}' not found") +endif () + +set(PICOVGA_CMAKE_FILE ${PICOVGA_PATH}/picovga.cmake) +if (NOT EXISTS ${PICOVGA_CMAKE_FILE}) + message(FATAL_ERROR "Directory '${PICOVGA_PATH}' does not appear to contain the PicoVGA library") +endif () + +set(PICOVGA_PATH ${PICOVGA_PATH} CACHE PATH "Path to the PicoVGA library" FORCE) + +include(${PICOVGA_CMAKE_FILE}) diff --git a/src/util/print.h b/src/util/print.h index 2b46965..537c8e5 100644 --- a/src/util/print.h +++ b/src/util/print.h @@ -28,6 +28,8 @@ // compose PC color #define PC_COLOR(bg,fg) (((bg)<<4)|(fg)) +#define PC_FGCOLOR(color) ((color) & 0b1111) // Added by WV +#define PC_BGCOLOR(color) ((color) >> 4) // Added by WV // ASCII characters #define CHAR_CR '\r'