diff --git a/drivers/display_st7735.cpp b/drivers/display_st7735.cpp
index d4d814d6cc96894f976d9270d13a22386be2e83a..365f826127c5336a70d94e2de6e3ef28757089ac 100644
--- a/drivers/display_st7735.cpp
+++ b/drivers/display_st7735.cpp
@@ -31,6 +31,9 @@
 #include "misc_inst.h"
 #include "line.h"
 
+//The ST7735 driver requires a color depth 16 per pixel
+#ifdef MXGUI_COLOR_DEPTH_16_BIT
+
 using namespace std;
 using namespace miosix;
 
@@ -349,3 +352,5 @@ void DisplayGenericST7735::sendCmds(const unsigned char *cmds) {
 }
 
 } //mxgui
+
+#endif //MXGUI_COLOR_DEPTH_16_BIT
diff --git a/drivers/display_st7735.h b/drivers/display_st7735.h
index 02a8f37f6d048dc5b7feb7a6629eb447a1439367..5b783ef01ef611a4df1771888f113103260f2bb9 100644
--- a/drivers/display_st7735.h
+++ b/drivers/display_st7735.h
@@ -39,9 +39,8 @@
 
 namespace mxgui {
 
-#ifndef MXGUI_COLOR_DEPTH_16_BIT
-#error The ST7735 driver requires a color depth 16 per pixel
-#endif
+//The ST7735 driver requires a color depth 16 per pixel
+#ifdef MXGUI_COLOR_DEPTH_16_BIT
 
 //Used to transiently pull low either the csx or dcx pin
 class Transaction
@@ -438,4 +437,6 @@ private:
     Color *buffer;          ///< For scanLineBuffer
 };
 
+#endif //MXGUI_COLOR_DEPTH_16_BIT
+
 } //namespace mxgui