This is the David Smart RA8875 Library with mods for working with FRDM-K64F

Revision:
84:e102021864b5
Parent:
83:7bad0068cca0
Child:
85:022bba13c5c4
--- a/RA8875.cpp	Thu Jan 01 20:35:37 2015 +0000
+++ b/RA8875.cpp	Mon Jan 12 01:10:35 2015 +0000
@@ -671,26 +671,55 @@
 }
 
 
+RetCode_t RA8875::SetOrientation(RA8875::orientation_t angle)
+{
+    uint8_t fncr1Val = ReadCommand(0x22);
+    uint8_t dpcrVal = ReadCommand(0x20);
+    
+    fncr1Val &= ~0x10;      // remove the old direction bit
+    dpcrVal &= ~0x0C;       // remove the old scan direction bits
+    switch (angle) {
+        case RA8875::normal:
+            //fncr1Val |= 0x10;
+            //dpcrVal |= 0x00;
+            break;
+        case RA8875::rotate_90:
+            fncr1Val |= 0x10;
+            dpcrVal |= 0x08;
+            break;
+        case RA8875::rotate_180:
+            //fncr1Val |= 0x00;
+            dpcrVal |= 0x0C;
+            break;
+        case RA8875::rotate_270:
+            fncr1Val |= 0x10;
+            dpcrVal |= 0x04;
+            break;
+        default:
+            return bad_parameter;
+    }
+    WriteCommand(0x22, fncr1Val);
+    return WriteCommand(0x20, dpcrVal);
+}
+
+
 RetCode_t RA8875::SetTextFontControl(fill_t fillit,
-                                     RA8875::font_angle_t angle,
                                      RA8875::HorizontalScale hScale,
                                      RA8875::VerticalScale vScale,
                                      RA8875::alignment_t alignment)
 {
     if (hScale >= 1 && hScale <= 4 &&
             vScale >= 1 && vScale <= 4) {
-        unsigned char x = 0;
-
+        uint8_t fncr1Val = ReadCommand(0x22);
+        
+        fncr1Val &= ~0x10;      // do not disturbe the rotate flag
         if (alignment == align_full)
-            x |= 0x80;
+            fncr1Val |= 0x80;
         if (fillit == NOFILL)
-            x |= 0x40;
-        if (angle == rotated)
-            x |= 0x10;
-        x |= ((hScale - 1) << 2);
-        x |= ((vScale - 1) << 0);
-        WriteCommand(0x22, x);
-        return noerror;
+            fncr1Val |= 0x40;
+        fncr1Val |= ((hScale - 1) << 2);
+        fncr1Val |= ((vScale - 1) << 0);
+        return WriteCommand(0x22, fncr1Val);
     } else {
         return bad_parameter;
     }