MY TRAIAL (1)

Dependencies:   FATFileSystem GR-PEACH_video GraphicsFramework LCD_shield_config R_BSP mbed-rtos mbed

Fork of GR-PEACH_NTSC_in_2ch_MOD_try by Hirofumi Inomata

I put an OVERVIEW in the blow URL. https://developer.mbed.org/users/digiponta/notebook/my-trial-ar--vr-2-eyes-display-goes-by-a-gr-peach/

Committer:
digiponta
Date:
Thu Sep 15 11:06:34 2016 +0000
Revision:
8:0f9a45e34220
Parent:
6:3cb7758c3f17
??????????

Who changed what in which revision?

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