Talk Watch system using NTP timer for JBB.

Dependencies:   EthernetNetIf FatFileSystem HTTPClient_ToBeRemoved HTTPServer NTPClient_NetServices TextLCD mbed

Fork of StarBoardOrangeTest3 by Yuji Notsu

Committer:
y_notsu
Date:
Sun Jun 22 05:12:34 2014 +0000
Revision:
1:8816ea8be54b
Parent:
0:ae31fe6f181c
Talk Watch using NTP client for JBB

Who changed what in which revision?

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