PokittoLib with changes to lcd refresh etc.

Dependents:   Pokittris

Fork of Pokitto by Pokitto Community Team

This is a fork by user @Spinal, and is used in Pokittris for testing. Do not import this to your own program.

Committer:
spinal
Date:
Sun Oct 15 18:03:02 2017 +0000
Revision:
11:02ad9c807a21
Parent:
5:7e5c566b1760
fixed 4color refreshRegion code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pokitto 5:7e5c566b1760 1 /* mbed Microcontroller Library
Pokitto 5:7e5c566b1760 2 * Copyright (c) 2006-2013 ARM Limited
Pokitto 5:7e5c566b1760 3 *
Pokitto 5:7e5c566b1760 4 * Licensed under the Apache License, Version 2.0 (the "License");
Pokitto 5:7e5c566b1760 5 * you may not use this file except in compliance with the License.
Pokitto 5:7e5c566b1760 6 * You may obtain a copy of the License at
Pokitto 5:7e5c566b1760 7 *
Pokitto 5:7e5c566b1760 8 * http://www.apache.org/licenses/LICENSE-2.0
Pokitto 5:7e5c566b1760 9 *
Pokitto 5:7e5c566b1760 10 * Unless required by applicable law or agreed to in writing, software
Pokitto 5:7e5c566b1760 11 * distributed under the License is distributed on an "AS IS" BASIS,
Pokitto 5:7e5c566b1760 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Pokitto 5:7e5c566b1760 13 * See the License for the specific language governing permissions and
Pokitto 5:7e5c566b1760 14 * limitations under the License.
Pokitto 5:7e5c566b1760 15 */
Pokitto 5:7e5c566b1760 16 #ifndef MBED_FILESYSTEMLIKE_H
Pokitto 5:7e5c566b1760 17 #define MBED_FILESYSTEMLIKE_H
Pokitto 5:7e5c566b1760 18
Pokitto 5:7e5c566b1760 19 #include "platform.h"
Pokitto 5:7e5c566b1760 20
Pokitto 5:7e5c566b1760 21 #include "FileBase.h"
Pokitto 5:7e5c566b1760 22 #include "FileHandle.h"
Pokitto 5:7e5c566b1760 23 #include "DirHandle.h"
Pokitto 5:7e5c566b1760 24
Pokitto 5:7e5c566b1760 25 namespace mbed {
Pokitto 5:7e5c566b1760 26
Pokitto 5:7e5c566b1760 27 /** A filesystem-like object is one that can be used to open files
Pokitto 5:7e5c566b1760 28 * though it by fopen("/name/filename", mode)
Pokitto 5:7e5c566b1760 29 *
Pokitto 5:7e5c566b1760 30 * Implementations must define at least open (the default definitions
Pokitto 5:7e5c566b1760 31 * of the rest of the functions just return error values).
Pokitto 5:7e5c566b1760 32 */
Pokitto 5:7e5c566b1760 33 class FileSystemLike : public FileBase {
Pokitto 5:7e5c566b1760 34
Pokitto 5:7e5c566b1760 35 public:
Pokitto 5:7e5c566b1760 36 /** FileSystemLike constructor
Pokitto 5:7e5c566b1760 37 *
Pokitto 5:7e5c566b1760 38 * @param name The name to use for the filesystem.
Pokitto 5:7e5c566b1760 39 */
Pokitto 5:7e5c566b1760 40 FileSystemLike(const char *name);
Pokitto 5:7e5c566b1760 41
Pokitto 5:7e5c566b1760 42 virtual ~FileSystemLike();
Pokitto 5:7e5c566b1760 43
Pokitto 5:7e5c566b1760 44 static DirHandle *opendir();
Pokitto 5:7e5c566b1760 45 friend class BaseDirHandle;
Pokitto 5:7e5c566b1760 46
Pokitto 5:7e5c566b1760 47 /** Opens a file from the filesystem
Pokitto 5:7e5c566b1760 48 *
Pokitto 5:7e5c566b1760 49 * @param filename The name of the file to open.
Pokitto 5:7e5c566b1760 50 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
Pokitto 5:7e5c566b1760 51 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
Pokitto 5:7e5c566b1760 52 *
Pokitto 5:7e5c566b1760 53 * @returns
Pokitto 5:7e5c566b1760 54 * A pointer to a FileHandle object representing the
Pokitto 5:7e5c566b1760 55 * file on success, or NULL on failure.
Pokitto 5:7e5c566b1760 56 */
Pokitto 5:7e5c566b1760 57 virtual FileHandle *open(const char *filename, int flags) = 0;
Pokitto 5:7e5c566b1760 58
Pokitto 5:7e5c566b1760 59 /** Remove a file from the filesystem.
Pokitto 5:7e5c566b1760 60 *
Pokitto 5:7e5c566b1760 61 * @param filename the name of the file to remove.
Pokitto 5:7e5c566b1760 62 * @param returns 0 on success, -1 on failure.
Pokitto 5:7e5c566b1760 63 */
Pokitto 5:7e5c566b1760 64 virtual int remove(const char *filename) { return -1; };
Pokitto 5:7e5c566b1760 65
Pokitto 5:7e5c566b1760 66 /** Rename a file in the filesystem.
Pokitto 5:7e5c566b1760 67 *
Pokitto 5:7e5c566b1760 68 * @param oldname the name of the file to rename.
Pokitto 5:7e5c566b1760 69 * @param newname the name to rename it to.
Pokitto 5:7e5c566b1760 70 *
Pokitto 5:7e5c566b1760 71 * @returns
Pokitto 5:7e5c566b1760 72 * 0 on success,
Pokitto 5:7e5c566b1760 73 * -1 on failure.
Pokitto 5:7e5c566b1760 74 */
Pokitto 5:7e5c566b1760 75 virtual int rename(const char *oldname, const char *newname) { return -1; };
Pokitto 5:7e5c566b1760 76
Pokitto 5:7e5c566b1760 77 /** Opens a directory in the filesystem and returns a DirHandle
Pokitto 5:7e5c566b1760 78 * representing the directory stream.
Pokitto 5:7e5c566b1760 79 *
Pokitto 5:7e5c566b1760 80 * @param name The name of the directory to open.
Pokitto 5:7e5c566b1760 81 *
Pokitto 5:7e5c566b1760 82 * @returns
Pokitto 5:7e5c566b1760 83 * A DirHandle representing the directory stream, or
Pokitto 5:7e5c566b1760 84 * NULL on failure.
Pokitto 5:7e5c566b1760 85 */
Pokitto 5:7e5c566b1760 86 virtual DirHandle *opendir(const char *name) { return NULL; };
Pokitto 5:7e5c566b1760 87
Pokitto 5:7e5c566b1760 88 /** Creates a directory in the filesystem.
Pokitto 5:7e5c566b1760 89 *
Pokitto 5:7e5c566b1760 90 * @param name The name of the directory to create.
Pokitto 5:7e5c566b1760 91 * @param mode The permissions to create the directory with.
Pokitto 5:7e5c566b1760 92 *
Pokitto 5:7e5c566b1760 93 * @returns
Pokitto 5:7e5c566b1760 94 * 0 on success,
Pokitto 5:7e5c566b1760 95 * -1 on failure.
Pokitto 5:7e5c566b1760 96 */
Pokitto 5:7e5c566b1760 97 virtual int mkdir(const char *name, mode_t mode) { return -1; }
Pokitto 5:7e5c566b1760 98
Pokitto 5:7e5c566b1760 99 // TODO other filesystem functions (mkdir, rm, rn, ls etc)
Pokitto 5:7e5c566b1760 100 };
Pokitto 5:7e5c566b1760 101
Pokitto 5:7e5c566b1760 102 } // namespace mbed
Pokitto 5:7e5c566b1760 103
Pokitto 5:7e5c566b1760 104 #endif