Packed 12bit Raw image file load to display to Nokia LCD. Add function "blit12" to Nokia LCD for native 12bit color buffer.

Dependencies:   mbed

Committer:
sakai
Date:
Thu Feb 10 14:44:49 2011 +0000
Revision:
4:f746ea56e891
Parent:
0:b9050fc6f305

        

Who changed what in which revision?

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