basic functional test of FT810 LCD via SPI

Dependencies:   FT810 mbed

Files at this revision

API Documentation at this revision

Comitter:
cpm219
Date:
Sun Oct 02 04:54:20 2016 +0000
Parent:
22:2bdc80e45f3b
Commit message:
latest

Changed in this revision

FT810.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
nRF24L01P.lib Show diff for this revision Revisions of this file
diff -r 2bdc80e45f3b -r 0045679060e3 FT810.lib
--- a/FT810.lib	Sat Sep 17 15:07:57 2016 +0000
+++ b/FT810.lib	Sun Oct 02 04:54:20 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/cpm219/code/FT810/#03932ce8a04e
+https://developer.mbed.org/users/cpm219/code/FT810/#506e2de9a9e6
diff -r 2bdc80e45f3b -r 0045679060e3 SDFileSystem.lib
--- a/SDFileSystem.lib	Sat Sep 17 15:07:57 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/users/neilt6/code/SDFileSystem/#e4d2567200db
diff -r 2bdc80e45f3b -r 0045679060e3 main.cpp
--- a/main.cpp	Sat Sep 17 15:07:57 2016 +0000
+++ b/main.cpp	Sun Oct 02 04:54:20 2016 +0000
@@ -1,241 +1,49 @@
-/*
-Title Block
-**  Project     : PANEL_GUI_BASE
-**  Engineers   : Curtis Mattull
-**  Processor   : MK22
-**  Version     : 1.0
-**  Compiler    : mbed
-**  Date        : 9/17/2016
-**  Abstract    : This program serves as a starting point for most applications requiring a touch screen menu.
-    Note        :
+/*  Curtis Mattull
+    10/1/16
+    This simple program tests LCD SPI functionality
 */
-
 #include "mbed.h"
 #include "FT_Platform.h"
-#include "FT_color.h"
-#include "stdio.h"
-#include "string.h"
-#include "float.h"
-#include "SDFileSystem.h"
-#include "FATFileSystem.h"
-#include "DigitalIn.h"
-#include "nRF24L01P.h"
-#include "time.h"
 
-/************************
-    function prototypes
-*************************/
-
-//for display type
-void rotate_newhaven(void);
-void rotate_beyondtek(void);
-//for gui states
-void    gui_manager(void);
-void    main_menu(uint32_t tracker, uint8_t tag);       //  main menu            0
-void    mode_a(uint32_t tracker, uint8_t tag);          //  mode A               1
-void    mode_b(uint32_t tracker, uint8_t tag);          //  mode B               2
-void    mode_c(uint32_t tracker, uint8_t tag);          //  mode C               3
-//for plot states
-void    plot_nothing(void);
-void    plot_square(void);
-void    plot_triangle(void);
-void    plot_sine(void);
-void    collect_data(void);
-//for sd card
-uint8_t read_calibration(void);
-uint8_t sd_test(void);
-uint8_t bitmap_test(uint16_t x,uint16_t y);
-int8_t  Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size, ft_uint32_t address);
-//general use
-void    display_message(uint8_t error,  const ft_char8_t *pass, const ft_char8_t *fail);
-void    start_screen(ft_char8_t *str);
-void    error_screen(ft_char8_t *str1, ft_char8_t *str2);
-
-/************************
-    function pointers
-*************************/
-
-void (*draw_screen[4])(uint32_t tracker, uint8_t tag) = {   main_menu,      //  0
-        mode_a,         //  1
-        mode_b,         //  2
-        mode_c
-                                                        };       //  3
-
-void (*plot[4])(void) = {   plot_nothing,      //  0
-                            plot_square,         //  1
-                            plot_triangle,         //  2
-//                            plot_sine
-                            collect_data
-                        };       //  3
-                    
-
-
-void (*display_rotate[2])() = { rotate_newhaven,    //  0
-                                rotate_beyondtek
-                              }; //  1
-
-/************************
-    global objects and variables
-*************************/
+void    screen1(uint32_t tracker, uint8_t tag);
+void    rotate_screen(uint8_t val);
 // create an LCD object
-FT800 TFT       (   PTD6,   PTD7,   PTD5,   PTE0,   PTB19,   PTA1 );
-//              (   mosi,   miso,   sclk,   ss,     intr,   pd );
-
-// create an RF object
-nRF24L01P RF    (   PTD2,   PTD3,   PTD1,   PTD4,   PTC11, PTD0);    
-//              (   mosi,   miso,   sck,    csn,    ce,     irq)
-
-
-////Create an SDFileSystem object
-SDFileSystem sd (   PTD2,   PTD3,   PTD1,   PTC4,    "sd");
-////SDFileSystem(   mosi,   miso,   sclk,   ss,     name);
-
-
-
-DigitalIn   sdcard_present(PTB16,PullDown);   // SD card detect input pin.      card_present() is the name of a function within the SDFileSystem Class!!!
-AnalogIn analog_in9(A0);
-
-const uint8_t   font_button =   28,
-                font_title =    31,
-                font_author =   21;
-
-const ft_char8_t    text_menu[32]   = {"Main Menu\0"},
-                    text_a[32]      = {"A\0"},
-                    text_b[32]      = {"B\0"},
-                    text_c[32]      = {"C\0"},
-                    text_back[32]   = {"Back\0"},
-                    text_author[32] = {"by Curtis Mattull\0"},
-                    text_time[32]   = {"Run time [s]: \0"};
-
-int16_t i = 0x00;
-static const uint32_t   mask_reg_tracker_tag        = 0x0000FFFF;
-static const uint32_t   mask_reg_tracker_tracker    = 0xFFFF0000;
-static const uint8_t    mask_tag                    = 0xFF;
-
-char buffer[50];                                                                                                    // temporary buffer for writing characters to the LCD
-
-ft_int16_t x_size, y_size;                                                                                          // stores size data for loaded jpegs, not currently used
-
-/************************
-    function:   main()
-    description:
-        -calibrate touch screen
-        -display welcome screen
-        -manages touch screen input, system states, and calls draw_screen functions
-*************************/
-int main()
+FT800 TFT( PTD6, PTD7, PTD5, PTD4, PTB19, PTA1);
+//       ( mosi, miso, sclk,   ss,  intr,  pd );
+RawSerial terminal(USBTX, USBRX);    // computer to mbed board
+int main(void)
 {
-//    static const uint8_t display_type = 0x00;   //not beyondtek display
-    static const uint8_t display_type = 0x01;
-    uint8_t error[4]    = { 0x00,   // sd_test error
-                            0x00,   // load_bitmap error
-                            0x00,   // bitmap write error
-                            0x00
-                          };  // gui_manager error
-    
-    (*display_rotate[display_type])();  // for proper orientation
-    error[3] = read_calibration();
-    display_message( error[3], "touch calibration load success!\0", "touch calibration save success!\0");
-    TFT.Sleep(500); 
-
-   // //load jpg into graphics ram
-//    error[1] = Load_jpg("/sd/Logo.jpg", &x_size, &y_size, RAM_G);
-//    display_message( error[1], "load jpg success!\0", "load jpg failed!\0");
-//    TFT.Sleep(100);                     // Wait ___ to show
+    terminal.baud(9600);
+    printf("main entered\r\n");
+    rotate_screen(1);
+    set_time(0);  // Set RTC time to 0
     
-//    RF.powerUp();
-//    RF.setTransferSize( TRANSFER_SIZE );
-//    RF.setReceiveMode();
-//    RF.enable(); 
-        
-    set_time(0);  // Set RTC time to 0
-
-    //draw initial screen
-    main_menu(0x0,0x0);
-    //program should not return from gui_manager...
-    gui_manager();
-
-    // Wait ___ to show
-    display_message( 0x1, "\0", "gui_manager failed!\0");
-    while(1) {
-        TFT.Sleep(1000);
+    //draw screen
+    for(;;)
+    {
+//        screen1(0x0,0x0);
+        wait(1);
     }
-
+ 
     return 0;
 }
 
 
-
-
-/************************
-    function: rotate_newhaven
-    description:  rotates
-*************************/
-void rotate_newhaven(void)
-{
-    TFT.MemWrite(REG_ROTATE, 1);    // rotate screen
-    TFT.Rotate(1);
-    TFT.Flush_Co_Buffer();          // Download the command list into fifo
-    TFT.WaitCmdfifo_empty();        // Wait till coprocessor completes the operation
-}
-
-
-
-/************************
-    function: rotate_beyondtek
-    description:  rotates
-*************************/
-void rotate_beyondtek(void)
+void rotate_screen(uint8_t val)
 {
-    //dont rotate
-}
-
-
-
-/************************
-    function: gui_manager()
-    description:  tracks input data and updates screen accordingly
-*************************/
-void gui_manager(void)
-{
-    static const uint8_t state_lookup[32] = {0x0, 0x1, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0,    0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1,
-                                            0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2,    0x3, 0x3, 0x3, 0x3, 0x0, 0x3, 0x3, 0x3,
-                                            };
-    /*              array index values:     {  0    1    2    3    4    5    6    7       8    9   10   11   12   13   14   15
-                                              16   17   18   19   20   21   22   23      24   25   26   27   28   29   30   31};
-    */
-
-    static uint8_t  present_state   = 0x00,
-                    tag             = 0x00,
-                    combo_input     = 0x00;
-                    
-    static uint16_t tracker         = 0x00;
-
-    static uint32_t reg32           = 0x00;
-
-    //start of gui_manager()
-    while(1) {
-        tag = 0x0;
-        //while(0x0 == tag) 
-//        {
-            reg32 = TFT.Rd32(REG_TRACKER);
-            tag = reg32 & mask_reg_tracker_tag;   //read tag register, update tag variable
-            tracker = ( reg32 & mask_reg_tracker_tracker)>> 16;   //read tracker
-//        }
-        combo_input = ( present_state << 3) + tag;      // concatenate present_state with tag to form combo input
-        present_state = state_lookup[combo_input];      // based on combo input, update present state
-        (*draw_screen[present_state])(tracker,tag);                // use present_state as operand to draw screen function
+    if (val == 0)
+    {
+        TFT.MemWrite(REG_ROTATE, 1);    // rotate screen
+        TFT.Rotate(1);
+        TFT.Flush_Co_Buffer();          // Download the command list into fifo
+        TFT.WaitCmdfifo_empty();        // Wait till coprocessor completes the operation
     }
 }
 
 
-
-/************************
-    function: main menu
-    description:  draw main menu screen
-*************************/
-void main_menu(uint32_t tracker, uint8_t tag)
+void screen1(uint32_t tracker, uint8_t tag)
 {
+    printf("screen1 entered\r\n");
     time_t seconds = time(NULL);
 
     //start new display list
@@ -243,48 +51,19 @@
     TFT.DL(CLEAR_COLOR_RGB(255,255,255));                               // set the clear color to white
     TFT.DL(CLEAR(1,1,1));                                               // clear buffers -> color buffer,stencil buffer, tag buffer
 
-    //bitmaps
-    //TFT.DL(TAG(0));     // assign TAG value 0 to bitmap
-//    TFT.DL(BITMAP_SOURCE(RAM_G));
-//    TFT.DL(BITMAP_LAYOUT(RGB565,x_size*2,y_size));
-//    TFT.DL(BITMAP_SIZE(NEAREST,BORDER,BORDER,x_size,y_size));
-//
-//    TFT.DL(BEGIN(BITMAPS));     //start drawing bitmaps
-//    TFT.DL(VERTEX2II(10,10,0,0));                                      // draw logo image with bit handle 0
-//    TFT.DL(END());
-
-    //buttons
-    TFT.DL(COLOR_RGB(0xFF,  0xFF,   0xFF)); //this sets the button text color
-    TFT.FgColor(0x007CC4);  // this sets the button color
-    
-    //button A
-    TFT.Track( 50,  165, 200, 150, 1);  // track aree of button A
-    TFT.DL(TAG(1));     // assign TAG value 1 to "mode A" button
-    TFT.Button(50, 165, 200, 150, font_title, 0, text_a);
-
-    //button B
-    TFT.Track( 300, 165, 200, 150, 2);  // track aree of button B
-    TFT.DL(TAG(2));                         // assign TAG value 2 to "mode B" button
-    TFT.Button(300,  165, 200, 150, font_title, 0, text_b);
-
-    //button C
-    TFT.Track( 550, 165, 200, 150, 3);  // track aree of button C
-    TFT.DL(TAG(3));                         // assign TAG value 3 to "mode C" button
-    TFT.Button(550, 165, 200, 150, font_title, 0, text_c);
-
     TFT.DL(TAG(0));                         // assign TAG value 0 to everything else
 
     //title text
     TFT.DL(COLOR_RGB(0, 0, 0));
-    TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_menu);        // draw Text with font 31
+    TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, 28, OPT_CENTERX, "test\0");        // draw Text with font 31
 
     // time
-    TFT.Text((TFT.DispWidth/4), TFT.DispHeight*7/8, font_title, OPT_CENTERX, text_time);        // draw Text with font 31
-    TFT.Number((TFT.DispWidth/2), (TFT.DispHeight*7/8),font_title,OPT_CENTERX, seconds);
+    TFT.Text((TFT.DispWidth/4), TFT.DispHeight*7/8, 28, OPT_CENTERX, "Run time [s]: \0");        // draw Text with font 31
+    TFT.Number((TFT.DispWidth/2), (TFT.DispHeight*7/8),28,OPT_CENTERX, seconds);
 
     //author text
     TFT.DL(COLOR_RGB(0x00,  0x00,   0x00));
-    TFT.Text((TFT.DispWidth*7/8)+9, (TFT.DispHeight*15/16), font_button, OPT_CENTERX, text_author);            // draw Text with font 31
+    TFT.Text((TFT.DispWidth*7/8)+9, (TFT.DispHeight*15/16), 28, OPT_CENTERX, "by Curtis Mattull\0");            // draw Text with font 31
 
     //display the screen
     TFT.DL(DISPLAY());                     // display the image
@@ -292,588 +71,4 @@
     TFT.Flush_Co_Buffer();                 // download the command list into fifo
     TFT.WaitCmdfifo_empty();               // wait till coprocessor completes the operation
 
-}
-
-
-/************************
-    function: mode_a
-    description: draws mode a screen
-*************************/
-void mode_a(uint32_t tracker, uint8_t tag)
-{
-
-    //start new display list
-    TFT.DLstart();                                                      // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(255,255,255));                               // set the clear color to dark grey
-    TFT.DL(CLEAR(1,1,1));                                               // clear buffers -> color buffer,stencil buffer, tag buffer
-
-    TFT.DL(TAG(0));                                                         // assign TAG value 0 to everything else
-    
-    
-    
-    
-    
-    
-
-    //button colors
-    TFT.DL(COLOR_RGB(0xFF,  0xFF,   0xFF)); //this sets the button text color
-    TFT.FgColor(0x007CC4);  // this sets the button color
-
-    //back button
-    TFT.Track( 50, 355, 100, 75, 4);    // track aree of button back
-    TFT.DL(TAG(4));
-    TFT.Button(50, 355, 100, 75, font_button, 4, text_back);                // assign TAG value 4 to text_back button
-    
-    //title, author text 
-    TFT.DL(TAG(0));                                                         // assign TAG value 0 to everything else    
-    TFT.DL(COLOR_RGB(0, 0, 0));
-    TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_a);       // draw Text with font 31
-    TFT.Text((TFT.DispWidth*7/8)+9, (TFT.DispHeight*15/16), font_button, OPT_CENTERX, text_author);    //author text // draw Text with font 31
-
-
-    //display the screen
-    TFT.DL(DISPLAY());                     // display the image
-    TFT.Swap();                            // swap the current display list
-    TFT.Flush_Co_Buffer();                 // download the command list into fifo
-    TFT.WaitCmdfifo_empty();               // wait till coprocessor completes the operation
-}
-
-
-
-/************************
-    function: mode b
-    description: draws mode b screen.
-*************************/
-void mode_b(uint32_t tracker, uint8_t tag)
-{    
-    //start new display list
-    TFT.DLstart();                                                      // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(255,255,255));                               // set the clear color to white
-    TFT.DL(CLEAR(1,1,1));                                               // clear buffers -> color buffer,stencil buffer, tag buffer
-
-
-    //button colors
-    TFT.DL(COLOR_RGB(255, 255, 255)); //this sets the button text color
-    TFT.FgColor(0x007CC4);  // this sets the button color
-
-
-    //back button
-    TFT.Track( 50, 355, 100, 75, 4);    // track aree of button back
-    TFT.DL(TAG(4));
-    TFT.Button(50, 355, 100, 75, font_button, 0, text_back);                         // assign TAG value 4 to text_back button
-
-    //title,author text
-    TFT.DL(TAG(0));                         // assign TAG value 0 to everything else
-    TFT.DL(COLOR_RGB(0, 0, 0));
-    TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_b);        // draw Text with font 31
-    TFT.Text((TFT.DispWidth*7/8)+9, (TFT.DispHeight*15/16), font_button, OPT_CENTERX, text_author);            // draw Text with font 31
-
-    //display the screen
-    TFT.DL(DISPLAY());                     // display the image
-    TFT.Swap();                            // swap the current display list
-    TFT.Flush_Co_Buffer();                 // download the command list into fifo
-    TFT.WaitCmdfifo_empty();               // wait till coprocessor completes the operation
-}
-
-
-/************************
-    function: mode_c
-    description: draws mode C screen
-*************************/
-void mode_c(uint32_t tracker, uint8_t tag)
-{
-    //start new display list
-    TFT.DLstart();                                                      // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(255,255,255));      // set the clear color to white 
-    TFT.DL(CLEAR(1,1,1));                   // clear buffers -> color buffer,stencil buffer, tag buffer
-    
-
-    //button colors
-    TFT.DL(COLOR_RGB(255, 255, 255)); //this sets the button text color
-    TFT.FgColor(0x007CC4);  // this sets the button color
-
-    //back button
-    TFT.Track( 50, 355, 100, 75, 4);    // track aree of button back
-    TFT.DL(TAG(4));
-    TFT.Button(50, 355, 100, 75, font_button, 4, text_back);                // assign TAG value 4 to text_back button
-
-    //title, author text
-    TFT.DL(TAG(0));                                                         // assign TAG value 0 to everything else
-    TFT.DL(COLOR_RGB(0,0,0));
-    TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_c);        // draw Text with font 31
-    TFT.Text((TFT.DispWidth*7/8)+9, (TFT.DispHeight*15/16), font_button, OPT_CENTERX, text_author);            // draw Text with font 31
-
-    //display the screen
-    TFT.DL(DISPLAY());                     // display the image
-    TFT.Swap();                            // swap the current display list
-    TFT.Flush_Co_Buffer();                 // download the command list into fifo
-    TFT.WaitCmdfifo_empty();               // wait till coprocessor completes the operation
-}
-
-
-
-/************************
-    function: plot_nothing
-    description: clears plot area
-*************************/
-void plot_nothing(void)
-{
-    TFT.DL(COLOR_RGB(0x00,  0x00,   0x00));
-
-}
-
-
-
-/************************
-    function: plot_square
-    description: plots square wave
-*************************/
-void plot_square(void)
-{
-    static const int16_t square_wave_lookup[40] = { -100,-100,-100,-100,-100,   100,100,100,100,100,
-            -100,-100,-100,-100,-100,   100,100,100,100,100,
-            -100,-100,-100,-100,-100,   100,100,100,100,100,
-            -100,-100,-100,-100,-100,   100,100,100,100,100
-                                                  };
-
-    TFT.DL(COLOR_RGB(0xFF,  0x00,   0x00));
-    for(i = 0; i<40; i++) {
-        TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 - (square_wave_lookup[i])*16) );
-    }
-}
-
-
-
-/************************
-    function: plot_triangle
-    description: plots triangle wave
-*************************/
-void plot_triangle(void)
-{
-    static const int16_t tri_wave_lookup[40] = {    100,0,-100,0,   100,0,-100,0,
-            100,0,-100,0,   100,0,-100,0,
-            100,0,-100,0,   100,0,-100,0,
-            100,0,-100,0,   100,0,-100,0,
-            100,0,-100,0,   100,0,-100,0
-                                               };
-    TFT.DL(COLOR_RGB(0xFF,  0xFF,   0x00));
-    for(i = 0; i<40; i++) {
-        TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 - (tri_wave_lookup[i])*16) );
-    }
-}
-
-
-
-///************************
-//    function: plot_sine
-//    description: plots sine wave
-//*************************/
-//void plot_sine(void)
-//{
-//    static const int16_t sine_wave_lookup[40] = {   0,  16,     31,     45,     59,     71,     81,     89,     95,     99,
-//            100,  99,     95,     89,     81,     71,     59,     45,     31,     16,
-//            -0, -16,    -31,    -45,    -59,    -71,    -81,    -89,    -95,    -99,
-//            -100, -99,    -95,    -89,    -81,    -71,    -59,    -45,    -31,    -16,
-//                                                };
-//
-//    TFT.DL(COLOR_RGB(0xFF,  0x00,   0xFF));
-//    for(i = 0; i<40; i++) {
-//        TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 + (sine_wave_lookup[i])*16) );
-//    }
-//}
-
-
-
-/************************
-    function: plot_data1
-    description: plots analog_in data1
-*************************/
-void plot_sine(void)
-{
-    static const int16_t sine_wave_lookup[40] = {   0,  16,     31,     45,     59,     71,     81,     89,     95,     99,
-            100,  99,     95,     89,     81,     71,     59,     45,     31,     16,
-            -0, -16,    -31,    -45,    -59,    -71,    -81,    -89,    -95,    -99,
-            -100, -99,    -95,    -89,    -81,    -71,    -59,    -45,    -31,    -16,
-                                                };
-
-    TFT.DL(COLOR_RGB(0xFF,  0x00,   0xFF));
-    for(i = 0; i<40; i++) {
-        TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 - (sine_wave_lookup[i])*16) );
-    }
-}
-
-
-
-/************************
-    function: collect_data
-    description:  store ADC samples
-*************************/
-void collect_data(void)
-{
-
-    static const uint16_t num_pts = 100;
-    
-    static float    collect_time = 0,
-                    plot_time = 0,
-                    trigger_time = 0;
-    static uint16_t i = 0x00,
-                    j = 0x00;
-    static Timer    timer;
-    static float    begin[3]    = {0,0,0},  // {trigger, sample, plot}
-                    end[3]      = {0,0,0};  // {trigger, sample, plot}
-
-//    static const uint16_t threshold = 10;
-
-    // data sample from ADC
-    static uint16_t data_raw_a9[num_pts] = {};     
-    
-    timer.start();
-    begin[0] = timer.read_us(); // trigger_begin
-
-
-    //do while trigger[0] < trigger[1]
-    //essentially find falling edge
-    do
-    {
-        data_raw_a9[0] = ((analog_in9.read_u16()>>7) & 0x1FF );
-        data_raw_a9[1] = ((analog_in9.read_u16()>>7) & 0x1FF );
-    }
-    while(data_raw_a9[1] < data_raw_a9[0]);
-    
-    do
-    {
-        data_raw_a9[0] = ((analog_in9.read_u16()>>7) & 0x1FF );
-        data_raw_a9[1] = ((analog_in9.read_u16()>>7) & 0x1FF );
-    }
-    while(data_raw_a9[1] > data_raw_a9[0]); 
-        //do
-//    {
-//        data_raw_a9[0] = ((analog_in9.read_u16()>>7) & 0x1FF );
-//        data_raw_a9[1] = ((analog_in9.read_u16()>>7) & 0x1FF );
-//    }
-//    while(data_raw_a9[1] < data_raw_a9[0]);
-//    
-//    do
-//    {
-//        data_raw_a9[0] = ((analog_in9.read_u16()>>7) & 0x1FF );
-//        data_raw_a9[1] = ((analog_in9.read_u16()>>7) & 0x1FF );
-//    }
-//    while(data_raw_a9[1] > data_raw_a9[0]);
-    
-    timer.stop();
-    end[0] = timer.read_us();   //trigger_end
-    
-    
-    timer.start();
-    begin[1] = timer.read_us(); // sample_begin
-    //collect data
-    for(i=2;i<num_pts;i++)
-    {
-        //collect adc 9 most significant bits
-        data_raw_a9[i] = ((analog_in9.read_u16()>>7) & 0x1FF );
-    }
-    timer.stop();
-    end[1] = timer.read_us();   // sample_end
-    
-    
-    timer.start();
-    begin[2] = timer.read_us(); // plot_begin
-    //green plot
-    TFT.DL(COLOR_RGB(0x00,  0xFF,   0x00));
-    //plot data
-    for(i=0;i<num_pts;i++)
-    {
-        TFT.DL(VERTEX2F(8*i*16, TFT.DispHeight*16 - data_raw_a9[i]*15));    //  15/16 *512 = 480 which is disp_height
-    }
-    timer.stop();
-    end[2] = timer.read_us();   // plot_end            
-    
-    
-    trigger_time =(end[0]-begin[0])/1000;
-    collect_time =(end[1]-begin[1])/1000;
-    plot_time = (end[2]-begin[2])/1000;
-
-    TFT.DL(COLOR_RGB(0xFF, 0xFF, 0xFF));
-    //data points
-    TFT.Text((TFT.DispWidth*7/8), TFT.DispHeight/32, font_button, OPT_RIGHTX, " data points: ");        // draw Text with font 31
-    TFT.Number((TFT.DispWidth*7/8), (TFT.DispHeight/32),font_button,0,num_pts);
-    
-    //trigger time
-    TFT.Text((TFT.DispWidth*7/8), TFT.DispHeight*3/32, font_button, OPT_RIGHTX, " trigger time [ms]: ");        // draw Text with font 31
-    TFT.Number((TFT.DispWidth*7/8), (TFT.DispHeight*3/32),font_button,0,trigger_time);
-    
-    //sample time
-    TFT.Text((TFT.DispWidth*7/8), TFT.DispHeight*5/32, font_button, OPT_RIGHTX, "sample time [ms]: ");        // draw Text with font 31
-    TFT.Number((TFT.DispWidth*7/8), (TFT.DispHeight*5/32),font_button,0,collect_time);
-    
-    //plot time
-    TFT.Text((TFT.DispWidth*7/8), TFT.DispHeight*7/32, font_button, OPT_RIGHTX, "plot time [ms]: ");        // draw Text with font 31
-    TFT.Number((TFT.DispWidth*7/8), (TFT.DispHeight*7/32),font_button,0,plot_time);
-        
-}
-
-
-
-/****************************************************************************/
-/* Checks for an SD card and reads/writes the calibration data              */
-/* from the SD card                                                         */
-/****************************************************************************/
-uint8_t read_calibration()
-{
-    static ft_char8_t temp_string[32] = {"\0"};
-    static uint8_t tcal[24];                                                                                                   // touch screen Calibration
-
-    while(!sdcard_present.read()) {
-        // checks for SD card, if not present hold program until a SD card is inserted
-        error_screen("Error!","Insert SD card!");               // write error screen to LCD
-    }
-
-    sd.mount();
-    FILE *fp= fopen("/sd/TCal/TCalData.txt", "r");
-    if (fp != NULL) {
-        //file successfully opened for reading!
-        fread(temp_string,24,1,fp);
-        for (i = 0; i < 24; i++) {
-            // convert from int to char
-            tcal[i] = temp_string[i];
-        }
-        TFT.write_calibrate(tcal);                              // write cal data to screen
-        fclose(fp);
-        sd.unmount();
-        return 0;
-    } else {
-        //file not opened. might not exist.
-        TFT.Calibrate();                                        // calibrate the touch screen
-        TFT.read_calibrate(tcal);                               // read in cal data from screen
-        mkdir("/sd/TCal", 0777);                                // open file for saving calibration data
-        FILE *fp = fopen("/sd/TCal/TCalData.txt", "w");
-        for (i = 0; i < 25; i++) {                              // save integers one at a time to the file
-            fprintf(fp, "%c", tcal[i] );
-        }
-        fclose(fp);
-        sd.unmount();
-        return 1;
-
-    }
-}
-
-
-
-/****************************************************************************
-* tests functional operation of sd card by read/write
-****************************************************************************/
-uint8_t sd_test(void)
-{
-    while(!sdcard_present.read()) {
-        // checks for SD card, if not present hold program until a SD card is inserted
-        error_screen("Error!","Insert SD card!");               // write error screen to LCD
-    }
-
-    TFT.DLstart();                         // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(0,0,0));    // clear the screen and set the background to green
-    TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-    TFT.DL(COLOR_RGB(255,255,255));
-
-    sd.mount();
-
-    //Perform a write test
-//    printf("\nWriting to SD card...");
-    TFT.Text((TFT.DispWidth/2), 150, 28, OPT_CENTERX, "Writing to SD card...\0");                // draw Text with font 31
-    FILE *fp = fopen("/sd/sdtest.txt", "w");
-    if (fp != NULL) {
-        //file successfully opened for writing!
-        fprintf(fp, "We're writing to an SD card!");
-        fclose(fp);
-        TFT.DL(CLEAR_COLOR_RGB(0,255,0));    // clear the screen and set the background to green
-        TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-        TFT.Text((TFT.DispWidth/2), 200, 28, OPT_CENTERX,"open file success\0" );                // draw Text with font 31
-
-    } else {
-//        printf("failed!\n");
-        TFT.DL(CLEAR_COLOR_RGB(255,0,0));    // clear the screen and set the background to green
-        TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-        TFT.Text((TFT.DispWidth/2), 200, 28, OPT_CENTERX, "open file failed!\0");                // draw Text with font 31
-    }
-
-    //Perform a read test
-//    fprintf("Reading from SD card...");
-    TFT.Text((TFT.DispWidth/2), 250, 28, OPT_CENTERX, "Reading from SD card...\0");                // draw Text with font 31
-
-    fp = fopen("/sd/sdtest.txt", "r");
-    if (fp != NULL) {
-        char c = fgetc(fp);
-        if (c == 'W') {
-//            printf("success!\n");
-            TFT.Text((TFT.DispWidth/2), 300, 28, OPT_CENTERX, "correct char!\0");                // draw Text with font 31
-
-        } else {
-//            fprintf("incorrect char (%c)!\n", c);
-            TFT.Text((TFT.DispWidth/2), 300, 28, OPT_CENTERX, "incorrect char!\0");                // draw Text with font 31
-        }
-        sd.unmount();
-        TFT.DL(DISPLAY());                                                      // display the image
-        TFT.Swap();                                                             // swap the current display list
-        TFT.Flush_Co_Buffer();                                                  // download the command list into fifo
-        TFT.WaitCmdfifo_empty();                                                // wait till coprocessor completes the operation
-        TFT.Sleep(2000);
-        fclose(fp);
-        return 0;
-
-    } else {
-//        printf("failed!\n");
-        TFT.Text((TFT.DispWidth/2), 250, 31, OPT_CENTERX, "failed to read!\0");                // draw Text with font 31
-        sd.unmount();
-        TFT.DL(DISPLAY());                                                      // display the image
-        TFT.Swap();                                                             // swap the current display list
-        TFT.Flush_Co_Buffer();                                                  // download the command list into fifo
-        TFT.WaitCmdfifo_empty();                                                // wait till coprocessor completes the operation
-        TFT.Sleep(2000);
-        return 1;
-    }
-}
-
-
-
-uint8_t bitmap_test(uint16_t x,uint16_t y)
-{
-
-    TFT.DLstart();                         // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(0,0,0));    // clear the screen and set the background to green
-    TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-    TFT.DL(COLOR_RGB(255,255,255));
-
-    //following 3 lines can be replaced with TFT.set_bitmap(0x00, 0, )
-    TFT.DL(BITMAP_SOURCE(RAM_G));
-    TFT.DL(BITMAP_LAYOUT(ARGB1555,2*x_size,y_size));
-    TFT.DL(BITMAP_SIZE(NEAREST,BORDER,BORDER,x_size,y_size));
-
-    TFT.DL(BEGIN(BITMAPS));     //start drawing bitmaps
-    TFT.DL(VERTEX2II(25,25,0,0));                                      // draw logo image with bit handle 0
-    TFT.DL(END());
-
-    TFT.Text((TFT.DispWidth/2), 170, 31, OPT_CENTERX, "bitmap_test() called\0");                // draw Text with font 31
-
-    TFT.DL(DISPLAY());                                                      // display the image
-    TFT.Swap();                                                             // swap the current display list
-    TFT.Flush_Co_Buffer();                                                  // download the command list into fifo
-    TFT.WaitCmdfifo_empty();                                                // wait till coprocessor completes the operation
-
-    return 0;
-}
-
-
-
-/* function to load jpg file from filesystem */
-/* return 0 if jpg is ok                     */
-/* also return x_size and y_size of jpg      */
-
-int8_t Load_jpg(char* filename, ft_int16_t* x_size, ft_int16_t* y_size, ft_uint32_t address)
-{
-    static int8_t rval = 0x00;
-
-    while(!sdcard_present.read()) {
-        // checks for SD card, if not present hold program until a SD card is inserted
-        error_screen("Error!","Insert SD card!");               // write error screen to LCD
-    }
-
-    sd.mount();
-    rval = TFT.Load_jpg( filename, x_size, y_size, address);
-    sd.unmount();
-    return rval;
-}
-
-
-
-/************************
-    function: display_message
-    description: draws a pass/fail type message to the screen.
-    useful for debugging return values from functions.
-*************************/
-void display_message(uint8_t error, const ft_char8_t *pass, const ft_char8_t *fail)
-{
-    TFT.DLstart();                         // start a new display command list
-    TFT.DL(COLOR_RGB(0,0,0));
-
-    if(error == 0x00) {
-        TFT.DL(CLEAR_COLOR_RGB(0,255,0));    // clear the screen and set the background to green
-        TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-        TFT.Text((TFT.DispWidth/2), 170, 31, OPT_CENTERX, pass);                // draw Text with font 31
-    } else {
-        TFT.DL(CLEAR_COLOR_RGB(255,0,0));    // clear the screen and set the background to red
-        TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-        TFT.Text((TFT.DispWidth/2), 170, 31, OPT_CENTERX, fail);                // draw Text with font 31
-    }
-
-    TFT.DL(DISPLAY());                                                      // display the image
-    TFT.Swap();                                                             // swap the current display list
-    TFT.Flush_Co_Buffer();                                                  // download the command list into fifo
-    TFT.WaitCmdfifo_empty();                                                // wait till coprocessor completes the operation
-}
-
-
-
-/************************
-    function: Start_Screen
-    description: draws boot up screen as images are loaded from the sd card
-*************************/
-ft_void_t start_screen(ft_char8_t *str)
-{
-    TFT.DLstart();                                             // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(255,255,255));                      // set the clear color to white
-    TFT.DL(CLEAR(1,1,1));                                      // clear buffers -> color buffer,stencil buffer, tag buffer
-
-    TFT.DL(COLOR_RGB(0x00,  0x7C,   0xC4));    // generate border in SMC blue, all functions are in 1/16 pixel format
-    TFT.DL(BEGIN(LINES));
-    TFT.DL(LINE_WIDTH(8 * 16));
-    TFT.DL(VERTEX2F(0*16,0*16));
-    TFT.DL(VERTEX2F(799*16,0*16));
-    TFT.DL(VERTEX2F(799*16,0*16));
-    TFT.DL(VERTEX2F(799*16,479*16));
-    TFT.DL(VERTEX2F(799*16,479*16));
-    TFT.DL(VERTEX2F(0*16,479*16));
-    TFT.DL(VERTEX2F(0*16,479*16));
-    TFT.DL(VERTEX2F(0*16,0*16));
-    TFT.DL(END());
-
-    TFT.Text((TFT.DispWidth/2), TFT.DispHeight/2, 31, OPT_CENTERX, str);        // draw Text with font 31
-    TFT.Text((TFT.DispWidth/2), 350, 31, OPT_CENTERX, text_author);            // draw Text with font 31
-    TFT.Spinner((TFT.DispWidth/2),TFT.DispHeight/4, 0,0);                       // draw a animated spinner
-
-    TFT.DL(DISPLAY());                   // Display the image
-    TFT.Swap();                          // Swap the current display list
-    TFT.Flush_Co_Buffer();               // Download the command list into fifo
-    TFT.WaitCmdfifo_empty();             // Wait till coprocessor completes the operation
-}
-
-
-
-/****************************************************************************/
-/* This function displays the error screen                                  */
-/* the function causes the screen to flash yellow and writes text to the LCD*/
-/****************************************************************************/
-void error_screen(ft_char8_t *str1, ft_char8_t *str2)
-{
-    TFT.DLstart();                         // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(255,242,0));    // clear the screen and set the background to yellow
-    TFT.DL(CLEAR(1,1,1));                  // clear buffers -> color buffer,stencil buffer, tag buffer
-    TFT.DL(COLOR_RGB(0,0,0));
-    TFT.Text((TFT.DispWidth/2), 170, 31, OPT_CENTERX, str1);                // draw Text with font 31
-    TFT.Text((TFT.DispWidth/2), 215, 31, OPT_CENTERX, str2);                // draw Text with font 31
-    TFT.DL(DISPLAY());                                                      // display the image
-    TFT.Swap();                                                             // swap the current display list
-    TFT.Flush_Co_Buffer();                                                  // download the command list into fifo
-    TFT.WaitCmdfifo_empty();                                                // wait till coprocessor completes the operation
-    TFT.Sleep(500);
-
-    TFT.DLstart();                                                          // start a new display command list
-    TFT.DL(CLEAR_COLOR_RGB(255,255,255));                                   // set clear color to white
-    TFT.DL(CLEAR(1,1,1));                                                   // clear buffers -> color buffer,stencil buffer, tag buffer;
-    TFT.DL(COLOR_RGB(0,0,0));
-    TFT.Text((TFT.DispWidth/2), 170, 31, OPT_CENTERX, str1);                // draw Text with font 31
-    TFT.Text((TFT.DispWidth/2), 215, 31, OPT_CENTERX, str2);                // draw Text with font 31
-    TFT.DL(DISPLAY());                                                      // display the image
-    TFT.Swap();                                                             // swap the current display list
-    TFT.Flush_Co_Buffer();                                                  // download the command list into fifo
-    TFT.WaitCmdfifo_empty();                                                // wait till coprocessor completes the operation
-    TFT.Sleep(500);
 }
\ No newline at end of file
diff -r 2bdc80e45f3b -r 0045679060e3 mbed.bld
--- a/mbed.bld	Sat Sep 17 15:07:57 2016 +0000
+++ b/mbed.bld	Sun Oct 02 04:54:20 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/2241e3a39974
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file
diff -r 2bdc80e45f3b -r 0045679060e3 nRF24L01P.lib
--- a/nRF24L01P.lib	Sat Sep 17 15:07:57 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/Owen/code/nRF24L01P/#8ae48233b4e4