Tried to initialize the buttons and slider but couldn't get it to work.

Dependencies:   mbed

Committer:
mturner5
Date:
Mon Sep 19 03:28:41 2016 +0000
Revision:
0:0d6b77c9ae01
basic v2;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mturner5 0:0d6b77c9ae01 1 /* mbed Microcontroller Library
mturner5 0:0d6b77c9ae01 2 * Copyright (c) 2006-2013 ARM Limited
mturner5 0:0d6b77c9ae01 3 *
mturner5 0:0d6b77c9ae01 4 * Licensed under the Apache License, Version 2.0 (the "License");
mturner5 0:0d6b77c9ae01 5 * you may not use this file except in compliance with the License.
mturner5 0:0d6b77c9ae01 6 * You may obtain a copy of the License at
mturner5 0:0d6b77c9ae01 7 *
mturner5 0:0d6b77c9ae01 8 * http://www.apache.org/licenses/LICENSE-2.0
mturner5 0:0d6b77c9ae01 9 *
mturner5 0:0d6b77c9ae01 10 * Unless required by applicable law or agreed to in writing, software
mturner5 0:0d6b77c9ae01 11 * distributed under the License is distributed on an "AS IS" BASIS,
mturner5 0:0d6b77c9ae01 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mturner5 0:0d6b77c9ae01 13 * See the License for the specific language governing permissions and
mturner5 0:0d6b77c9ae01 14 * limitations under the License.
mturner5 0:0d6b77c9ae01 15 */
mturner5 0:0d6b77c9ae01 16 #ifndef MBED_LOCALFILESYSTEM_H
mturner5 0:0d6b77c9ae01 17 #define MBED_LOCALFILESYSTEM_H
mturner5 0:0d6b77c9ae01 18
mturner5 0:0d6b77c9ae01 19 #include "platform.h"
mturner5 0:0d6b77c9ae01 20
mturner5 0:0d6b77c9ae01 21 #if DEVICE_LOCALFILESYSTEM
mturner5 0:0d6b77c9ae01 22
mturner5 0:0d6b77c9ae01 23 #include "FileSystemLike.h"
mturner5 0:0d6b77c9ae01 24
mturner5 0:0d6b77c9ae01 25 namespace mbed {
mturner5 0:0d6b77c9ae01 26
mturner5 0:0d6b77c9ae01 27 FILEHANDLE local_file_open(const char* name, int flags);
mturner5 0:0d6b77c9ae01 28
mturner5 0:0d6b77c9ae01 29 class LocalFileHandle : public FileHandle {
mturner5 0:0d6b77c9ae01 30
mturner5 0:0d6b77c9ae01 31 public:
mturner5 0:0d6b77c9ae01 32 LocalFileHandle(FILEHANDLE fh);
mturner5 0:0d6b77c9ae01 33
mturner5 0:0d6b77c9ae01 34 virtual int close();
mturner5 0:0d6b77c9ae01 35
mturner5 0:0d6b77c9ae01 36 virtual ssize_t write(const void *buffer, size_t length);
mturner5 0:0d6b77c9ae01 37
mturner5 0:0d6b77c9ae01 38 virtual ssize_t read(void *buffer, size_t length);
mturner5 0:0d6b77c9ae01 39
mturner5 0:0d6b77c9ae01 40 virtual int isatty();
mturner5 0:0d6b77c9ae01 41
mturner5 0:0d6b77c9ae01 42 virtual off_t lseek(off_t position, int whence);
mturner5 0:0d6b77c9ae01 43
mturner5 0:0d6b77c9ae01 44 virtual int fsync();
mturner5 0:0d6b77c9ae01 45
mturner5 0:0d6b77c9ae01 46 virtual off_t flen();
mturner5 0:0d6b77c9ae01 47
mturner5 0:0d6b77c9ae01 48 protected:
mturner5 0:0d6b77c9ae01 49 FILEHANDLE _fh;
mturner5 0:0d6b77c9ae01 50 int pos;
mturner5 0:0d6b77c9ae01 51 };
mturner5 0:0d6b77c9ae01 52
mturner5 0:0d6b77c9ae01 53 /** A filesystem for accessing the local mbed Microcontroller USB disk drive
mturner5 0:0d6b77c9ae01 54 *
mturner5 0:0d6b77c9ae01 55 * This allows programs to read and write files on the same disk drive that is used to program the
mturner5 0:0d6b77c9ae01 56 * mbed Microcontroller. Once created, the standard C file access functions are used to open,
mturner5 0:0d6b77c9ae01 57 * read and write files.
mturner5 0:0d6b77c9ae01 58 *
mturner5 0:0d6b77c9ae01 59 * Example:
mturner5 0:0d6b77c9ae01 60 * @code
mturner5 0:0d6b77c9ae01 61 * #include "mbed.h"
mturner5 0:0d6b77c9ae01 62 *
mturner5 0:0d6b77c9ae01 63 * LocalFileSystem local("local"); // Create the local filesystem under the name "local"
mturner5 0:0d6b77c9ae01 64 *
mturner5 0:0d6b77c9ae01 65 * int main() {
mturner5 0:0d6b77c9ae01 66 * FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
mturner5 0:0d6b77c9ae01 67 * fprintf(fp, "Hello World!");
mturner5 0:0d6b77c9ae01 68 * fclose(fp);
mturner5 0:0d6b77c9ae01 69 * remove("/local/out.txt"); // Removes the file "out.txt" from the local file system
mturner5 0:0d6b77c9ae01 70 *
mturner5 0:0d6b77c9ae01 71 * DIR *d = opendir("/local"); // Opens the root directory of the local file system
mturner5 0:0d6b77c9ae01 72 * struct dirent *p;
mturner5 0:0d6b77c9ae01 73 * while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system
mturner5 0:0d6b77c9ae01 74 * printf("%s\n", p->d_name); // to stdout.
mturner5 0:0d6b77c9ae01 75 * }
mturner5 0:0d6b77c9ae01 76 * closedir(d);
mturner5 0:0d6b77c9ae01 77 * }
mturner5 0:0d6b77c9ae01 78 * @endcode
mturner5 0:0d6b77c9ae01 79 *
mturner5 0:0d6b77c9ae01 80 * @note
mturner5 0:0d6b77c9ae01 81 * If the microcontroller program makes an access to the local drive, it will be marked as "removed"
mturner5 0:0d6b77c9ae01 82 * on the Host computer. This means it is no longer accessible from the Host Computer.
mturner5 0:0d6b77c9ae01 83 *
mturner5 0:0d6b77c9ae01 84 * The drive will only re-appear when the microcontroller program exists. Note that if the program does
mturner5 0:0d6b77c9ae01 85 * not exit, you will need to hold down reset on the mbed Microcontroller to be able to see the drive again!
mturner5 0:0d6b77c9ae01 86 */
mturner5 0:0d6b77c9ae01 87 class LocalFileSystem : public FileSystemLike {
mturner5 0:0d6b77c9ae01 88
mturner5 0:0d6b77c9ae01 89 public:
mturner5 0:0d6b77c9ae01 90 LocalFileSystem(const char* n) : FileSystemLike(n) {
mturner5 0:0d6b77c9ae01 91
mturner5 0:0d6b77c9ae01 92 }
mturner5 0:0d6b77c9ae01 93
mturner5 0:0d6b77c9ae01 94 virtual FileHandle *open(const char* name, int flags);
mturner5 0:0d6b77c9ae01 95 virtual int remove(const char *filename);
mturner5 0:0d6b77c9ae01 96 virtual DirHandle *opendir(const char *name);
mturner5 0:0d6b77c9ae01 97 };
mturner5 0:0d6b77c9ae01 98
mturner5 0:0d6b77c9ae01 99 } // namespace mbed
mturner5 0:0d6b77c9ae01 100
mturner5 0:0d6b77c9ae01 101 #endif
mturner5 0:0d6b77c9ae01 102
mturner5 0:0d6b77c9ae01 103 #endif