This is test program for running 192GC00(240 x 320 dot, 65K Color TFT LCD module ) on Star Board Orange.

Dependencies:   TextLCD mbed

Committer:
y_notsu
Date:
Fri Jan 21 12:51:26 2011 +0000
Revision:
0:0e2aded4edb0

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
y_notsu 0:0e2aded4edb0 1 /* mbed SDFileSystem Library, for providing file access to SD cards
y_notsu 0:0e2aded4edb0 2 * Copyright (c) 2008-2010, sford
y_notsu 0:0e2aded4edb0 3 *
y_notsu 0:0e2aded4edb0 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
y_notsu 0:0e2aded4edb0 5 * of this software and associated documentation files (the "Software"), to deal
y_notsu 0:0e2aded4edb0 6 * in the Software without restriction, including without limitation the rights
y_notsu 0:0e2aded4edb0 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
y_notsu 0:0e2aded4edb0 8 * copies of the Software, and to permit persons to whom the Software is
y_notsu 0:0e2aded4edb0 9 * furnished to do so, subject to the following conditions:
y_notsu 0:0e2aded4edb0 10 *
y_notsu 0:0e2aded4edb0 11 * The above copyright notice and this permission notice shall be included in
y_notsu 0:0e2aded4edb0 12 * all copies or substantial portions of the Software.
y_notsu 0:0e2aded4edb0 13 *
y_notsu 0:0e2aded4edb0 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
y_notsu 0:0e2aded4edb0 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
y_notsu 0:0e2aded4edb0 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
y_notsu 0:0e2aded4edb0 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
y_notsu 0:0e2aded4edb0 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
y_notsu 0:0e2aded4edb0 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
y_notsu 0:0e2aded4edb0 20 * THE SOFTWARE.
y_notsu 0:0e2aded4edb0 21 */
y_notsu 0:0e2aded4edb0 22
y_notsu 0:0e2aded4edb0 23 #ifndef MBED_SDHCFILESYSTEM_H
y_notsu 0:0e2aded4edb0 24 #define MBED_SDHCFILESYSTEM_H
y_notsu 0:0e2aded4edb0 25
y_notsu 0:0e2aded4edb0 26 #include "mbed.h"
y_notsu 0:0e2aded4edb0 27 #include "FATFileSystem.h"
y_notsu 0:0e2aded4edb0 28
y_notsu 0:0e2aded4edb0 29 /* Double Words */
y_notsu 0:0e2aded4edb0 30 typedef unsigned long long uint64_t;
y_notsu 0:0e2aded4edb0 31 typedef long long sint64_t;
y_notsu 0:0e2aded4edb0 32
y_notsu 0:0e2aded4edb0 33 /** Access the filesystem on an SD Card using SPI
y_notsu 0:0e2aded4edb0 34 // *
y_notsu 0:0e2aded4edb0 35 // * @code
y_notsu 0:0e2aded4edb0 36 // * #include "mbed.h"
y_notsu 0:0e2aded4edb0 37 // * #include "SDFileSystem.h"
y_notsu 0:0e2aded4edb0 38 // *
y_notsu 0:0e2aded4edb0 39 // * SDFileSystem sd(p5, p6, p7, p12, "sd"); // mosi, miso, sclk, cs
y_notsu 0:0e2aded4edb0 40 // *
y_notsu 0:0e2aded4edb0 41 // * int main() {
y_notsu 0:0e2aded4edb0 42 // * FILE *fp = fopen("/sd/myfile.txt", "w");
y_notsu 0:0e2aded4edb0 43 // * fprintf(fp, "Hello World!\n");
y_notsu 0:0e2aded4edb0 44 // * fclose(fp);
y_notsu 0:0e2aded4edb0 45 // * }
y_notsu 0:0e2aded4edb0 46 // */
y_notsu 0:0e2aded4edb0 47 class SDFileSystem : public FATFileSystem {
y_notsu 0:0e2aded4edb0 48 public:
y_notsu 0:0e2aded4edb0 49
y_notsu 0:0e2aded4edb0 50 /** Create the File System for accessing an SD Card using SPI
y_notsu 0:0e2aded4edb0 51 *
y_notsu 0:0e2aded4edb0 52 * @param mosi SPI mosi pin connected to SD Card
y_notsu 0:0e2aded4edb0 53 * @param miso SPI miso pin conencted to SD Card
y_notsu 0:0e2aded4edb0 54 * @param sclk SPI sclk pin connected to SD Card
y_notsu 0:0e2aded4edb0 55 * @param cs DigitalOut pin used as SD Card chip select
y_notsu 0:0e2aded4edb0 56 * @param name The name used to access the virtual filesystem
y_notsu 0:0e2aded4edb0 57 */
y_notsu 0:0e2aded4edb0 58 SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
y_notsu 0:0e2aded4edb0 59 virtual int disk_initialize();
y_notsu 0:0e2aded4edb0 60 virtual int disk_write(const char *buffer, int block_number);
y_notsu 0:0e2aded4edb0 61 virtual int disk_read(char *buffer, int block_number);
y_notsu 0:0e2aded4edb0 62 virtual int disk_status();
y_notsu 0:0e2aded4edb0 63 virtual int disk_sync();
y_notsu 0:0e2aded4edb0 64 virtual int disk_sectors();
y_notsu 0:0e2aded4edb0 65
y_notsu 0:0e2aded4edb0 66
y_notsu 0:0e2aded4edb0 67 protected:
y_notsu 0:0e2aded4edb0 68
y_notsu 0:0e2aded4edb0 69 int _cmd(int cmd, int arg);
y_notsu 0:0e2aded4edb0 70 int _cmdx(int cmd, int arg);
y_notsu 0:0e2aded4edb0 71 int _cmd8();
y_notsu 0:0e2aded4edb0 72 int _cmd58();
y_notsu 0:0e2aded4edb0 73 int initialise_card();
y_notsu 0:0e2aded4edb0 74 int initialise_card_v1();
y_notsu 0:0e2aded4edb0 75 int initialise_card_v2();
y_notsu 0:0e2aded4edb0 76
y_notsu 0:0e2aded4edb0 77 int _read(char *buffer, int length);
y_notsu 0:0e2aded4edb0 78 int _write(const char *buffer, int length);
y_notsu 0:0e2aded4edb0 79 int _sd_sectors();
y_notsu 0:0e2aded4edb0 80 int _sectors;
y_notsu 0:0e2aded4edb0 81
y_notsu 0:0e2aded4edb0 82 SPI _spi;
y_notsu 0:0e2aded4edb0 83 DigitalOut _cs;
y_notsu 0:0e2aded4edb0 84 int cdv;
y_notsu 0:0e2aded4edb0 85 };
y_notsu 0:0e2aded4edb0 86
y_notsu 0:0e2aded4edb0 87 #endif