4D systems Picaso uLCD 32PTU touch display library

Picaso_4DGL-32PTU_File.cpp

Committer:
CaptainR
Date:
2016-09-26
Revision:
20:88e137b9ea46
Child:
21:ea68a8a3cea4

File content as of revision 20:88e137b9ea46:

//
//  Picaso_4DGL-32PTU is a class to drive 4D Systems TFT touch screens with PICASO processor
//  Tested with NUCLEO L152RE development board
//  Copyright (C) <2016> Rihards Balass <rihards.balass@gmail.com>
//
// Picaso_4DGL-32PTU is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Picaso_4DGL-32PTU is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You can see GNU General Public License at <http://www.gnu.org/licenses/>.
//

#include "mbed.h"
#include "Picaso_4DGL-32PTU.h"

//**************************************************************************
// Starts up the FAT16 disk file services and allocates a small 32 byte control block
// for subsequent use. When you open a file using the “File Open” command
// further 512 + 44 = 556 bytes are attached to the FAT16 file control block.
// When you close a file using the “File Close” command, the 556 byte allocation
// is released leaving the 32 byte file control block.
// The File Mount command must be called before any other FAT16 file related
// functions can be used. The control block and all FAT16 file resources are
// completely released with the “File Unmount” command.
//**************************************************************************
bool PICASO_4DGL :: file_Mount() {

    char command[2] = "";
    
    command[0] = (FILE_MOUNT >> (8*1)) & 0xff;
    command[1] = (FILE_MOUNT >> (8*0)) & 0xff;
    
    writeCOMMAND(command, 2);
    bool success = fileMountResponse();
#ifdef DEBUGMODE
    pc.printf("\n\r DEBUG: FAT16 Mount: %s\n\r", success ? "true" : "false");
#endif
    return success;
}