Fork of David Smart's RA8875 library

Fork of RA8875 by David Smart

Revision:
23:a50ded45dbaf
Parent:
22:f6ea795eb541
Child:
24:8ca861acf12d
--- a/RA8875.h	Sun Jan 12 21:18:47 2014 +0000
+++ b/RA8875.h	Wed Jan 15 12:24:54 2014 +0000
@@ -10,7 +10,8 @@
 // graphics commands.
 //#define PERF_METRICS
 
-// What better place for some test code than in here...
+// What better place for some test code than in here and the companion
+// .cpp file. See also the bottom of this file.
 #define TESTENABLE
 
 #define RGB(r,g,b) ( ((r<<8)&0xF800) | ((g<<3)&0x07E0) | (b>>3) )
@@ -131,7 +132,8 @@
     ///
     RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char * name = "lcd");
     
-    /// Destructor doesn't have much to do.
+    /// Destructor doesn't have much to do as this would typically be created
+    /// at startup, and not at runtime.
     //~RA8875();
     
     /// Write a command to the display
@@ -230,6 +232,19 @@
     ///
     RetCode_t SetTextCursor(unsigned int x, unsigned int y);
     
+    /// Configure additional Cursor Control settings.
+    ///
+    /// This API lets you modify other cursor control settings; 
+    /// Cursor visible/hidden, Cursor blink/normal, 
+    /// Cursor I-Beam/underscore/box.
+    ///
+    /// @param visible can be set to true or false (default false)
+    /// @param blink can be set to true or false (default false)
+    /// @param ?
+    /// @returns success/failure code. @see RetCode_t
+    ///
+    RetCode_t SetTextCursorControl(bool visible = false, bool blink = false);
+    
     /// Select the ISO 8859-X font to use next.
     ///
     /// Supported fonts: ISO 8859-1, -2, -3, -4
@@ -839,4 +854,56 @@
 
 //using namespace SW_graphics;
 
+
+#ifdef TESTENABLE
+//      ______________  ______________  ______________  _______________
+//     /_____   _____/ /  ___________/ /  ___________/ /_____   ______/
+//          /  /      /  /            /  /                  /  /
+//         /  /      /  /___         /  /__________        /  /
+//        /  /      /  ____/        /__________   /       /  /
+//       /  /      /  /                       /  /       /  /
+//      /  /      /  /__________  ___________/  /       /  /
+//     /__/      /_____________/ /_____________/       /__/
+
+#include "WebColors.h"
+#include "Arial12x12.h"
+#include <algorithm>
+
+extern "C" void mbed_reset();
+
+/// This activates a small set of tests for the graphics library. 
+///
+/// Call this API and pass it the reference to the display class.
+/// It will then run a series of tests. It accepts interaction via
+/// stdin to switch from automatic test mode to manual, run a specific
+/// test, or to exit the test mode.
+///
+/// @param lcd is a reference to the display class.
+/// @param pc is a reference to a serial interface, typically the USB to PC.
+///
+void RunTestSet(RA8875 & lcd, Serial & pc);
+
+
+// To enable the test code, uncomment this section, or copy the
+// necessary pieces to your "main()".
+//
+// #include "mbed.h"
+// #include "RA8875.h"
+// RA8875 lcd(p5, p6, p7, p12, NC, "tft");    // MOSI, MISO, SCK, /ChipSelect, /reset, name
+// Serial pc(USBTX, USBRX);
+// extern "C" void mbed_reset();
+// int main()
+// {
+//     pc.baud(460800);    // I like a snappy terminal, so crank it up!
+//     pc.printf("\r\nRA8875 Test - Build " __DATE__ " " __TIME__ "\r\n");
+// 
+//     pc.printf("Turning on display\r\n");
+//     lcd.Reset();
+//     lcd.Power(true);  // display power is on, but the backlight is independent
+//     lcd.Backlight(0.5);
+//     RunTestSet(lcd, pc);
+// }
+
+#endif // TESTENABLE
+
 #endif
\ No newline at end of file